cesium-native 0.43.0
|
Wrapper around rapidjson::Writer
for writing objects to JSON.
More...
#include <CesiumJsonWriter/JsonWriter.h>
Public Member Functions | |
virtual bool | Null () |
Writes a null value to the output. | |
virtual bool | Bool (bool b) |
Writes a boolean value to the output. | |
virtual bool | Int (int i) |
Writes a signed integer value to the output. | |
virtual bool | Uint (unsigned int i) |
Writes an unsigned integer value to the output. | |
virtual bool | Uint64 (std::uint64_t i) |
Writes an unsigned 64-bit integer value to the output. | |
virtual bool | Int64 (std::int64_t i) |
Writes an signed 64-bit integer value to the output. | |
virtual bool | Double (double d) |
Writes a 64-bit floating point value to the output. | |
virtual bool | RawNumber (const char *str, unsigned int length, bool copy) |
Writes the given string as a number to the output without any kind of special handling. | |
virtual bool | Key (std::string_view string) |
Writes the given string as an object key to the output. | |
virtual bool | String (std::string_view string) |
Writes the given string as a value to the output. | |
virtual bool | StartObject () |
Writes the start of a JSON object to the output. | |
virtual bool | EndObject () |
Writes the end of a JSON object to the output. | |
virtual bool | StartArray () |
Writes the start of a JSON array to the output. | |
virtual bool | EndArray () |
Writes the end of a JSON array to the output. | |
virtual void | Primitive (std::int32_t value) |
Writes the given primitive to the output. This is a convenience function for Int. | |
virtual void | Primitive (std::uint32_t value) |
Writes the given primitive to the output. This is a convenience function for Uint. | |
virtual void | Primitive (std::int64_t value) |
Writes the given primitive to the output. This is a convenience function for Int64. | |
virtual void | Primitive (std::uint64_t value) |
Writes the given primitive to the output. This is a convenience function for Uint64. | |
virtual void | Primitive (float value) |
Writes the given primitive to the output. This is a convenience function for Double. | |
virtual void | Primitive (double value) |
Writes the given primitive to the output. This is a convenience function for Double. | |
virtual void | Primitive (std::nullptr_t value) |
Writes the given primitive to the output. This is a convenience function for Null. | |
virtual void | Primitive (std::string_view string) |
Writes the given primitive to the output. This is a convenience function for String. | |
virtual void | KeyPrimitive (std::string_view keyName, std::int32_t value) |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Int. | |
virtual void | KeyPrimitive (std::string_view keyName, std::uint32_t value) |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Uint. | |
virtual void | KeyPrimitive (std::string_view keyName, std::int64_t value) |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Int64. | |
virtual void | KeyPrimitive (std::string_view keyName, std::uint64_t value) |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Uint64. | |
virtual void | KeyPrimitive (std::string_view keyName, std::string_view value) |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by String. | |
virtual void | KeyPrimitive (std::string_view keyName, float value) |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Double. | |
virtual void | KeyPrimitive (std::string_view keyName, double value) |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Double. | |
virtual void | KeyPrimitive (std::string_view keyName, std::nullptr_t value) |
Writes the given key and its corresponding value primitive to the output. This is a convenience function for calling Key followed by Null. | |
virtual void | KeyArray (std::string_view keyName, std::function< void(void)> insideArray) |
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. | |
virtual void | KeyObject (std::string_view keyName, std::function< void(void)> insideObject) |
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. | |
virtual std::string | toString () |
Obtains the written output as a string. | |
virtual std::string_view | toStringView () |
Obtains the written output as a string_view. | |
virtual std::vector< std::byte > | toBytes () |
Obtains the written output as a buffer of bytes. | |
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. | |
Wrapper around rapidjson::Writer
for writing objects to JSON.
Definition at line 18 of file JsonWriter.h.
|
inlinevirtual |
Definition at line 21 of file JsonWriter.h.
|
virtual |
Writes a boolean value to the output.
b | The boolean value to write. |
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Writes a 64-bit floating point value to the output.
d | The double value to write. |
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
inline |
Emplaces a new error into the internal error buffer.
Definition at line 268 of file JsonWriter.h.
|
inline |
Emplaces a new warning into the internal warning buffer.
Definition at line 275 of file JsonWriter.h.
|
virtual |
Writes the end of a JSON array to the output.
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Writes the end of a JSON object to the output.
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
inline |
Obtains the current error buffer.
Definition at line 282 of file JsonWriter.h.
|
inline |
Obtains the current warning buffer.
Definition at line 286 of file JsonWriter.h.
|
virtual |
Writes a signed integer value to the output.
i | The integer value to write. |
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Writes an signed 64-bit integer value to the output.
i | The integer value to write. |
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Writes the given string as an object key to the output.
string | The key to write. |
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
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 in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
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 in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
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 in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
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 in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
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 in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
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 in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
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 in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
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 in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
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 in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
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 in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Writes a null
value to the output.
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Writes the given primitive to the output. This is a convenience function for Double.
value | The double value to write. |
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Writes the given primitive to the output. This is a convenience function for Double.
value | The float value to write. |
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Writes the given primitive to the output. This is a convenience function for Int.
value | The int32_t value to write. |
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Writes the given primitive to the output. This is a convenience function for Int64.
value | The int64_t value to write. |
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Writes the given primitive to the output. This is a convenience function for Null.
value | The null value to write. |
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Writes the given primitive to the output. This is a convenience function for String.
string | The string value to write. |
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Writes the given primitive to the output. This is a convenience function for Uint.
value | The uint32_t value to write. |
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Writes the given primitive to the output. This is a convenience function for Uint64.
value | The uint64_t value to write. |
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
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 in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Writes the start of a JSON array to the output.
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Writes the start of a JSON object to the output.
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Writes the given string as a value to the output.
string | The string to write. |
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Obtains the written output as a buffer of bytes.
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Obtains the written output as a string.
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Obtains the written output as a string_view.
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Writes an unsigned integer value to the output.
i | The integer value to write. |
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.
|
virtual |
Writes an unsigned 64-bit integer value to the output.
i | The integer value to write. |
Reimplemented in CesiumJsonWriter::PrettyJsonWriter.