|
| | Builder (Options options={ 0, 4096, false }) |
| | Constructor with options.
|
| Builder & | writeStartObject () |
| | Start writing a JSON object.
|
| Builder & | writeEndObject () |
| | End writing a JSON object.
|
| Builder & | writeStartArray () |
| | Start writing a JSON array.
|
| Builder & | writeEndArray () |
| | End writing a JSON array.
|
| Builder & | writeKey (std::string_view key) |
| | Write a property key before a nested object or array.
|
| Builder & | writeRawJson (std::string_view rawJson) |
| | Write raw JSON string directly to output.
|
| Builder & | write (std::string_view key, std::nullptr_t value) |
| | Write a null value property.
|
| Builder & | write (std::string_view key, bool value) |
| | Write a boolean value property.
|
| Builder & | write (std::string_view key, int value) |
| | Write an integer value property.
|
| Builder & | write (std::string_view key, unsigned int value) |
| | Write an unsigned integer value property.
|
| Builder & | write (std::string_view key, int64_t value) |
| | Write a 64-bit integer value property.
|
| Builder & | write (std::string_view key, uint64_t value) |
| | Write an unsigned 64-bit integer value property.
|
| Builder & | write (std::string_view key, float value) |
| | Write a float value property.
|
| Builder & | write (std::string_view key, double value) |
| | Write a double value property.
|
| Builder & | write (std::string_view key, std::string_view value) |
| | Write a string value property.
|
| Builder & | write (std::string_view key, const char *value) |
| | Write a string value property.
|
| Builder & | write (std::string_view key, const std::string &value) |
| | Write a string value property.
|
| Builder & | write (std::string_view key, const Document &value) |
| | Write a Document value property.
|
| Builder & | write (std::nullptr_t value) |
| | Write a null value in an array.
|
| Builder & | write (bool value) |
| | Write a boolean value in an array.
|
| Builder & | write (int value) |
| | Write an integer value in an array.
|
| Builder & | write (unsigned int value) |
| | Write an unsigned integer value in an array.
|
| Builder & | write (int64_t value) |
| | Write a 64-bit integer value in an array.
|
| Builder & | write (uint64_t value) |
| | Write an unsigned 64-bit integer value in an array.
|
| Builder & | write (float value) |
| | Write a float value in an array.
|
| Builder & | write (double value) |
| | Write a double value in an array.
|
| Builder & | write (std::string_view value) |
| | Write a string value in an array.
|
| Builder & | write (const char *value) |
| | Write a string value in an array.
|
| Builder & | write (const std::string &value) |
| | Write a string value in an array.
|
| Builder & | write (const Document &value) |
| | Write a Document value in an array.
|
| template<typename T> |
| std::enable_if_t< std::is_same_v< T, long > &&!std::is_same_v< long, int > &&!std::is_same_v< long, int64_t >, Builder & > | write (std::string_view key, T value) |
| | Write a long integer value property (SFINAE overload for platforms where long != int64_t).
|
| template<typename T> |
| std::enable_if_t< std::is_same_v< T, unsigned long > &&!std::is_same_v< unsigned long, unsigned int > &&!std::is_same_v< unsigned long, uint64_t >, Builder & > | write (std::string_view key, T value) |
| | Write an unsigned long integer value property (SFINAE overload for platforms where unsigned long != uint64_t).
|
| template<typename T> |
| std::enable_if_t< std::is_same_v< T, long long > &&!std::is_same_v< long long, int64_t >, Builder & > | write (std::string_view key, T value) |
| | Write a long long integer value property (SFINAE overload for platforms where long long != int64_t).
|
| template<typename T> |
| std::enable_if_t< std::is_same_v< T, unsigned long long > &&!std::is_same_v< unsigned long long, uint64_t >, Builder & > | write (std::string_view key, T value) |
| | Write an unsigned long long integer value property (SFINAE overload for platforms where unsigned long long != uint64_t).
|
| template<typename T> |
| std::enable_if_t< std::is_same_v< T, long > &&!std::is_same_v< long, int > &&!std::is_same_v< long, int64_t >, Builder & > | write (T value) |
| | Write a long integer value in an array (SFINAE overload for platforms where long != int64_t).
|
| template<typename T> |
| std::enable_if_t< std::is_same_v< T, unsigned long > &&!std::is_same_v< unsigned long, unsigned int > &&!std::is_same_v< unsigned long, uint64_t >, Builder & > | write (T value) |
| | Write an unsigned long integer value in an array (SFINAE overload for platforms where unsigned long != uint64_t).
|
| template<typename T> |
| std::enable_if_t< std::is_same_v< T, long long > &&!std::is_same_v< long long, int64_t >, Builder & > | write (T value) |
| | Write a long long integer value in an array (SFINAE overload for platforms where long long != int64_t).
|
| template<typename T> |
| std::enable_if_t< std::is_same_v< T, unsigned long long > &&!std::is_same_v< unsigned long long, uint64_t >, Builder & > | write (T value) |
| | Write an unsigned long long integer value in an array (SFINAE overload for platforms where unsigned long long != uint64_t).
|
| std::string | toString () |
| | Get the constructed JSON string.
|
| Builder & | reset () |
| | Reset builder to initial state for reuse.
|
| size_t | size () const noexcept |
| | Get current JSON string size.
|
| bool | isEmpty () const noexcept |
| | Check if builder is empty.
|
| Builder & | reserve (size_t capacity) |
| | Reserve buffer capacity.
|
| std::string_view | toStringView () const noexcept |
| | Get non-destructive view of generated JSON.
|
| size_t | capacity () const noexcept |
| | Get current buffer capacity.
|
| size_t | depth () const noexcept |
| | Get current nesting depth.
|
| bool | isValid () const noexcept |
| | Check if builder state is valid.
|
| template<typename Container> |
| Builder & | writeArray (std::string_view key, const Container &values) |
| | Write a complete array from a STL container as object property.
|
| template<typename Container> |
| Builder & | writeArray (const Container &values) |
| | Write a complete array from a STL container.
|
High-performance JSON builder with incremental construction API.
Constructs JSON directly to string buffer without building DOM. Provides a fluent API for building JSON documents programmatically. Optimized with SSE2 SIMD for string escaping on supported platforms.
Example usage:
.
write(
"name",
"John Doe")
std::string toString()
Get the constructed JSON string.
Builder & writeStartObject()
Start writing a JSON object.
Builder & write(std::string_view key, std::nullptr_t value)
Write a null value property.
Builder(Options options={ 0, 4096, false })
Constructor with options.
Builder & writeEndObject()
End writing a JSON object.
Definition at line 67 of file Builder.h.