LibreOffice Module tools (master) 1
|
#include <json_writer.hxx>
Public Member Functions | |
JsonWriter () | |
~JsonWriter () | |
ScopedJsonWriterNode | startNode (std::string_view) |
ScopedJsonWriterArray | startArray (std::string_view) |
ScopedJsonWriterStruct | startStruct () |
void | put (std::u16string_view pPropName, const OUString &rPropValue) |
void | put (std::string_view pPropName, const OUString &rPropValue) |
void | put (std::string_view pPropName, std::string_view rPropValue) |
void | put (std::string_view pPropName, const char *pPropVal) |
template<size_t N> | |
void | put (std::string_view pPropName, const char(&pPropVal)[N]) |
template<typename N , std::enable_if_t< std::is_arithmetic_v< N >, int > = 0> | |
void | put (std::string_view pPropName, N n) |
void | put (std::string_view pPropName, bool) |
void | putSimpleValue (const OUString &rPropValue) |
void | putRaw (std::string_view) |
This assumes that this data belongs at this point in the stream, and is valid, and properly encoded. More... | |
OString | finishAndGetAsOString () |
Closes the tags, and returns data. More... | |
bool | isDataEquals (std::string_view) const |
returns true if the current JSON data matches the string More... | |
Private Member Functions | |
void | endNode () |
void | endArray () |
void | endStruct () |
void | addCommaBeforeField () |
void | writeEscapedOUString (const OUString &rPropVal) |
void | closeDocument () |
void | ensureSpace (int noMoreBytesRequired) |
void | ensureSpaceAndWriteNameColon (std::string_view name, int valSize) |
void | putLiteral (std::string_view propName, std::string_view propValue) |
void | addValidationMark () |
void | validate () |
Private Attributes | |
char * | mpBuffer |
char * | mPos |
int | mSpaceAllocated |
int | mStartNodeCount |
bool | mbFirstFieldInNode |
bool | mbClosed |
Static Private Attributes | |
static constexpr unsigned char | JSON_WRITER_DEBUG_MARKER = 0xde |
Friends | |
class | ScopedJsonWriterNode |
class | ScopedJsonWriterArray |
class | ScopedJsonWriterStruct |
Definition at line 34 of file json_writer.hxx.
tools::JsonWriter::JsonWriter | ( | ) |
Definition at line 21 of file json_writer.cxx.
References addValidationMark(), and mPos.
tools::JsonWriter::~JsonWriter | ( | ) |
Definition at line 37 of file json_writer.cxx.
|
private |
Definition at line 331 of file json_writer.cxx.
References mbFirstFieldInNode, and mPos.
Referenced by ensureSpaceAndWriteNameColon(), put(), putRaw(), putSimpleValue(), and startStruct().
|
inlineprivate |
Definition at line 102 of file json_writer.hxx.
Referenced by ensureSpace(), and JsonWriter().
|
private |
|
private |
Definition at line 75 of file json_writer.cxx.
References ensureSpace(), mbFirstFieldInNode, mPos, mStartNodeCount, and validate().
Referenced by tools::ScopedJsonWriterArray::~ScopedJsonWriterArray().
|
private |
Definition at line 53 of file json_writer.cxx.
References ensureSpace(), mbFirstFieldInNode, mPos, mStartNodeCount, and validate().
Referenced by tools::ScopedJsonWriterNode::~ScopedJsonWriterNode().
|
private |
Definition at line 105 of file json_writer.cxx.
References ensureSpace(), mbFirstFieldInNode, mPos, mStartNodeCount, and validate().
Referenced by tools::ScopedJsonWriterStruct::~ScopedJsonWriterStruct().
|
private |
Definition at line 344 of file json_writer.cxx.
References addValidationMark(), mbClosed, mpBuffer, mPos, and mSpaceAllocated.
Referenced by endArray(), endNode(), endStruct(), ensureSpaceAndWriteNameColon(), finishAndGetAsOString(), put(), putRaw(), putSimpleValue(), and startStruct().
|
private |
Definition at line 359 of file json_writer.cxx.
References addCommaBeforeField(), ensureSpace(), mPos, and name.
Referenced by put(), and putLiteral().
OString tools::JsonWriter::finishAndGetAsOString | ( | ) |
Closes the tags, and returns data.
After this no more document modifications may be written.
Definition at line 383 of file json_writer.cxx.
References ensureSpace(), mbClosed, mpBuffer, mPos, and mStartNodeCount.
bool tools::JsonWriter::isDataEquals | ( | std::string_view | s | ) | const |
returns true if the current JSON data matches the string
Definition at line 399 of file json_writer.cxx.
void tools::JsonWriter::put | ( | std::string_view | pPropName, |
bool | nPropVal | ||
) |
Definition at line 304 of file json_writer.cxx.
References putLiteral().
|
inline |
Definition at line 60 of file json_writer.hxx.
|
inline |
Definition at line 64 of file json_writer.hxx.
References N.
void tools::JsonWriter::put | ( | std::string_view | pPropName, |
const OUString & | rPropValue | ||
) |
Definition at line 243 of file json_writer.cxx.
References ensureSpaceAndWriteNameColon(), and writeEscapedOUString().
|
inline |
Definition at line 70 of file json_writer.hxx.
References n.
void tools::JsonWriter::put | ( | std::string_view | pPropName, |
std::string_view | rPropValue | ||
) |
Definition at line 253 of file json_writer.cxx.
References ch, ensureSpaceAndWriteNameColon(), i, mPos, validate(), and tools::writeEscapedSequence().
void tools::JsonWriter::put | ( | std::u16string_view | pPropName, |
const OUString & | rPropValue | ||
) |
Definition at line 223 of file json_writer.cxx.
References addCommaBeforeField(), ensureSpace(), mPos, validate(), and writeEscapedOUString().
|
private |
Definition at line 374 of file json_writer.cxx.
References ensureSpaceAndWriteNameColon(), mPos, and validate().
Referenced by put(), startArray(), and startNode().
void tools::JsonWriter::putRaw | ( | std::string_view | rRawBuf | ) |
This assumes that this data belongs at this point in the stream, and is valid, and properly encoded.
Definition at line 319 of file json_writer.cxx.
References addCommaBeforeField(), ensureSpace(), mPos, and validate().
void tools::JsonWriter::putSimpleValue | ( | const OUString & | rPropValue | ) |
Definition at line 309 of file json_writer.cxx.
References addCommaBeforeField(), ensureSpace(), and writeEscapedOUString().
ScopedJsonWriterArray tools::JsonWriter::startArray | ( | std::string_view | pNodeName | ) |
Definition at line 65 of file json_writer.cxx.
References mbFirstFieldInNode, mStartNodeCount, putLiteral(), and ScopedJsonWriterArray.
ScopedJsonWriterNode tools::JsonWriter::startNode | ( | std::string_view | pNodeName | ) |
Definition at line 43 of file json_writer.cxx.
References mbFirstFieldInNode, mStartNodeCount, putLiteral(), and ScopedJsonWriterNode.
ScopedJsonWriterStruct tools::JsonWriter::startStruct | ( | ) |
Definition at line 87 of file json_writer.cxx.
References addCommaBeforeField(), ensureSpace(), mbFirstFieldInNode, mPos, mStartNodeCount, ScopedJsonWriterStruct, and validate().
|
inlineprivate |
Definition at line 109 of file json_writer.hxx.
Referenced by endArray(), endNode(), endStruct(), put(), putLiteral(), putRaw(), startStruct(), and writeEscapedOUString().
|
private |
Definition at line 171 of file json_writer.cxx.
References ch, i, mPos, validate(), and tools::writeEscapedSequence().
Referenced by put(), and putSimpleValue().
|
friend |
Definition at line 37 of file json_writer.hxx.
Referenced by startArray().
|
friend |
Definition at line 36 of file json_writer.hxx.
Referenced by startNode().
|
friend |
Definition at line 38 of file json_writer.hxx.
Referenced by startStruct().
|
staticconstexprprivate |
Definition at line 100 of file json_writer.hxx.
|
private |
Definition at line 45 of file json_writer.hxx.
Referenced by ensureSpace(), finishAndGetAsOString(), and ~JsonWriter().
|
private |
Definition at line 44 of file json_writer.hxx.
Referenced by addCommaBeforeField(), endArray(), endNode(), endStruct(), startArray(), startNode(), and startStruct().
|
private |
Definition at line 40 of file json_writer.hxx.
Referenced by ensureSpace(), finishAndGetAsOString(), isDataEquals(), and ~JsonWriter().
|
private |
Definition at line 41 of file json_writer.hxx.
Referenced by addCommaBeforeField(), endArray(), endNode(), endStruct(), ensureSpace(), ensureSpaceAndWriteNameColon(), finishAndGetAsOString(), isDataEquals(), JsonWriter(), put(), putLiteral(), putRaw(), startStruct(), and writeEscapedOUString().
|
private |
Definition at line 42 of file json_writer.hxx.
Referenced by ensureSpace().
|
private |
Definition at line 43 of file json_writer.hxx.
Referenced by endArray(), endNode(), endStruct(), finishAndGetAsOString(), startArray(), startNode(), and startStruct().