cesium-native 0.43.0
|
Implementation of JsonWriter that "pretty-prints" JSON to the output, formatted with new lines and indentation. More...
#include <CesiumJsonWriter/PrettyJsonWriter.h>
Public Member Functions | |
bool | Null () override |
Writes a null value to the output. | |
bool | Bool (bool b) override |
Writes a boolean value to the output. | |
bool | Int (int i) override |
Writes a signed integer value to the output. | |
bool | Uint (unsigned int i) override |
Writes an unsigned integer value to the output. | |
bool | Uint64 (std::uint64_t i) override |
Writes an unsigned 64-bit integer value to the output. | |
bool | Int64 (std::int64_t i) override |
Writes an signed 64-bit integer value to the output. | |
bool | Double (double d) override |
Writes a 64-bit floating point value to the output. | |
bool | RawNumber (const char *str, unsigned int length, bool copy) override |
Writes the given string as a number to the output without any kind of special handling. | |
bool | Key (std::string_view string) override |
Writes the given string as an object key to the output. | |
bool | String (std::string_view string) override |
Writes the given string as a value to the output. | |
bool | StartObject () override |
Writes the start of a JSON object to the output. | |
bool | EndObject () override |
Writes the end of a JSON object to the output. | |
bool | StartArray () override |
Writes the start of a JSON array to the output. | |
bool | EndArray () override |
Writes the end of a JSON array to the output. | |
void | Primitive (std::int32_t value) override |
Writes the given primitive to the output. This is a convenience function for Int. | |
void | Primitive (std::uint32_t value) override |
Writes the given primitive to the output. This is a convenience function for Uint. | |
void | Primitive (std::int64_t value) override |
Writes the given primitive to the output. This is a convenience function for Int64. | |
void | Primitive (std::uint64_t value) override |
Writes the given primitive to the output. This is a convenience function for Uint64. | |
void | Primitive (float value) override |
Writes the given primitive to the output. This is a convenience function for Double. | |
void | Primitive (double value) override |
Writes the given primitive to the output. This is a convenience function for Double. | |
void | Primitive (std::nullptr_t value) override |
Writes the given primitive to the output. This is a convenience function for Null. | |
void | Primitive (std::string_view string) override |
Writes the given primitive to the output. This is a convenience function for String. | |
void | KeyPrimitive (std::string_view keyName, std::int32_t value) override |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Int. | |
void | KeyPrimitive (std::string_view keyName, std::uint32_t value) override |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Uint. | |
void | KeyPrimitive (std::string_view keyName, std::int64_t value) override |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Int64. | |
void | KeyPrimitive (std::string_view keyName, std::uint64_t value) override |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Uint64. | |
void | KeyPrimitive (std::string_view keyName, std::string_view value) override |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by String. | |
void | KeyPrimitive (std::string_view keyName, float value) override |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Double. | |
void | KeyPrimitive (std::string_view keyName, double value) override |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Double. | |
void | KeyPrimitive (std::string_view keyName, std::nullptr_t value) override |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Null. | |
void | KeyArray (std::string_view keyName, std::function< void(void)> insideArray) override |
Writes an array to the output with the given key and calls the provided callback to write values inside of the array. This is a convenience function for calling Key followed by StartArray followed by the values you wish to write and ending with EndArray. | |
void | KeyObject (std::string_view keyName, std::function< void(void)> insideObject) override |
Writes an object to the output with the given key and calls the provided callback to write values inside of the object. This is a convenience function for calling Key followed by StartObject followed by the values you wish to write and ending with EndObject. | |
std::string | toString () override |
Obtains the written output as a string. | |
std::string_view | toStringView () override |
Obtains the written output as a string_view. | |
std::vector< std::byte > | toBytes () override |
Obtains the written output as a buffer of bytes. | |
Public Member Functions inherited from CesiumJsonWriter::JsonWriter | |
template<typename ErrorStr > | |
void | emplaceError (ErrorStr &&error) |
Emplaces a new error into the internal error buffer. | |
template<typename WarningStr > | |
void | emplaceWarning (WarningStr &&warning) |
Emplaces a new warning into the internal warning buffer. | |
const std::vector< std::string > & | getErrors () const |
Obtains the current error buffer. | |
const std::vector< std::string > & | getWarnings () const |
Obtains the current warning buffer. | |
Implementation of JsonWriter that "pretty-prints" JSON to the output, formatted with new lines and indentation.
Definition at line 20 of file PrettyJsonWriter.h.
|
inline |
Definition at line 26 of file PrettyJsonWriter.h.
|
overridevirtual |
Writes a boolean value to the output.
b | The boolean value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes a 64-bit floating point value to the output.
d | The double value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the end of a JSON array to the output.
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the end of a JSON object to the output.
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes a signed integer value to the output.
i | The integer value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes an signed 64-bit integer value to the output.
i | The integer value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the given string as an object key to the output.
string | The key to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes an array to the output with the given key and calls the provided callback to write values inside of the array. This is a convenience function for calling Key followed by StartArray followed by the values you wish to write and ending with EndArray.
keyName | The key to write to the output. |
insideArray | The callback to run, after StartArray but before EndArray. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes an object to the output with the given key and calls the provided callback to write values inside of the object. This is a convenience function for calling Key followed by StartObject followed by the values you wish to write and ending with EndObject.
keyName | The key to write to the output. |
insideObject | The callback to run, after StartObject but before EndObject. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Double.
keyName | The key to write to the output. |
value | The primitive value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Double.
keyName | The key to write to the output. |
value | The primitive value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Int.
keyName | The key to write to the output. |
value | The primitive value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Int64.
keyName | The key to write to the output. |
value | The primitive value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Null.
keyName | The key to write to the output. |
value | The primitive value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by String.
keyName | The key to write to the output. |
value | The primitive value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Uint.
keyName | The key to write to the output. |
value | The primitive value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Uint64.
keyName | The key to write to the output. |
value | The primitive value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes a null
value to the output.
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the given primitive to the output. This is a convenience function for Double.
value | The double value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the given primitive to the output. This is a convenience function for Double.
value | The float value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the given primitive to the output. This is a convenience function for Int.
value | The int32_t value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the given primitive to the output. This is a convenience function for Int64.
value | The int64_t value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the given primitive to the output. This is a convenience function for Null.
value | The null value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the given primitive to the output. This is a convenience function for String.
string | The string value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the given primitive to the output. This is a convenience function for Uint.
value | The uint32_t value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the given primitive to the output. This is a convenience function for Uint64.
value | The uint64_t value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the given string as a number to the output without any kind of special handling.
str | The raw number to write directly to the output. |
length | The length of the string. |
copy | If true, the string will be copied. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the start of a JSON array to the output.
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the start of a JSON object to the output.
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes the given string as a value to the output.
string | The string to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Obtains the written output as a buffer of bytes.
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Obtains the written output as a string.
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Obtains the written output as a string_view.
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes an unsigned integer value to the output.
i | The integer value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.
|
overridevirtual |
Writes an unsigned 64-bit integer value to the output.
i | The integer value to write. |
Reimplemented from CesiumJsonWriter::JsonWriter.