Zserio C++ runtime library
1.1.0
Built for Zserio 2.15.0
|
#include <JsonWriter.h>
Public Types | |
enum class | EnumerableFormat { NUMBER , STRING } |
Public Types inherited from zserio::AllocatorHolder< std::allocator< uint8_t > > | |
using | allocator_type = std::allocator< uint8_t > |
Public Member Functions | |
BasicJsonWriter (std::ostream &out, const ALLOC &allocator=ALLOC()) | |
BasicJsonWriter (std::ostream &out, uint8_t indent, const ALLOC &allocator=ALLOC()) | |
BasicJsonWriter (std::ostream &out, const string< ALLOC > &indent, const ALLOC &allocator=ALLOC()) | |
~BasicJsonWriter () override=default | |
void | setItemSeparator (const string< ALLOC > &itemSeparator) |
void | setKeySeparator (const string< ALLOC > &keySeparator) |
void | setEnumerableFormat (EnumerableFormat enumerableFormat) |
void | beginRoot (const IBasicReflectableConstPtr< ALLOC > &compound) override |
void | endRoot (const IBasicReflectableConstPtr< ALLOC > &compound) override |
void | beginArray (const IBasicReflectableConstPtr< ALLOC > &array, const BasicFieldInfo< ALLOC > &fieldInfo) override |
void | endArray (const IBasicReflectableConstPtr< ALLOC > &array, const BasicFieldInfo< ALLOC > &fieldInfo) override |
void | beginCompound (const IBasicReflectableConstPtr< ALLOC > &compound, const BasicFieldInfo< ALLOC > &fieldInfo, size_t elementIndex) override |
void | endCompound (const IBasicReflectableConstPtr< ALLOC > &compound, const BasicFieldInfo< ALLOC > &fieldInfo, size_t elementIndex) override |
void | visitValue (const IBasicReflectableConstPtr< ALLOC > &value, const BasicFieldInfo< ALLOC > &fieldInfo, size_t elementIndex) override |
BasicJsonWriter (const BasicJsonWriter &other)=delete | |
BasicJsonWriter & | operator= (const BasicJsonWriter &other)=delete |
BasicJsonWriter (BasicJsonWriter &&other)=delete | |
BasicJsonWriter & | operator= (BasicJsonWriter &&other)=delete |
Public Member Functions inherited from zserio::IBasicWalkObserver< std::allocator< uint8_t > > | |
virtual | ~IBasicWalkObserver ()=default |
virtual void | beginRoot (const IBasicReflectableConstPtr< std::allocator< uint8_t > > &compound)=0 |
virtual void | endRoot (const IBasicReflectableConstPtr< std::allocator< uint8_t > > &compound)=0 |
virtual void | beginArray (const IBasicReflectableConstPtr< std::allocator< uint8_t > > &array, const BasicFieldInfo< std::allocator< uint8_t > > &fieldInfo)=0 |
virtual void | endArray (const IBasicReflectableConstPtr< std::allocator< uint8_t > > &array, const BasicFieldInfo< std::allocator< uint8_t > > &fieldInfo)=0 |
virtual void | beginCompound (const IBasicReflectableConstPtr< std::allocator< uint8_t > > &compound, const BasicFieldInfo< std::allocator< uint8_t > > &fieldInfo, size_t elementIndex)=0 |
virtual void | endCompound (const IBasicReflectableConstPtr< std::allocator< uint8_t > > &compound, const BasicFieldInfo< std::allocator< uint8_t > > &fieldInfo, size_t elementIndex)=0 |
virtual void | visitValue (const IBasicReflectableConstPtr< std::allocator< uint8_t > > &value, const BasicFieldInfo< std::allocator< uint8_t > > &fieldInfo, size_t elementIndex)=0 |
Public Member Functions inherited from zserio::AllocatorHolder< std::allocator< uint8_t > > | |
AllocatorHolder () | |
AllocatorHolder (const allocator_type &allocator) | |
AllocatorHolder (allocator_type &&allocator) | |
allocator_type | get_allocator () const |
AllocatorHolder (const AllocatorHolder &other)=default | |
AllocatorHolder (AllocatorHolder &&other)=default | |
~AllocatorHolder ()=default | |
AllocatorHolder & | operator= (const AllocatorHolder &other)=default |
AllocatorHolder & | operator= (AllocatorHolder &&other)=default |
Static Public Attributes | |
static constexpr const char * | DEFAULT_ITEM_SEPARATOR = ", " |
static constexpr const char * | DEFAULT_ITEM_SEPARATOR_WITH_INDENT = "," |
static constexpr const char * | DEFAULT_KEY_SEPARATOR = ": " |
static constexpr EnumerableFormat | DEFAULT_ENUMERABLE_FORMAT = EnumerableFormat::STRING |
Additional Inherited Members | |
Protected Member Functions inherited from zserio::AllocatorHolder< std::allocator< uint8_t > > | |
void | set_allocator (const allocator_type &allocator) |
void | set_allocator (allocator_type &&allocator) |
allocator_type & | get_allocator_ref () |
const allocator_type & | get_allocator_ref () const |
Walker observer which dumps zserio objects to JSON format.
Definition at line 19 of file JsonWriter.h.
|
strong |
Configuration for writing of enumerable types.
Definition at line 42 of file JsonWriter.h.
|
explicit |
Constructor.
out | Stream to use for writing. |
allocator | Allocator to use. |
Definition at line 189 of file JsonWriter.h.
zserio::BasicJsonWriter< ALLOC >::BasicJsonWriter | ( | std::ostream & | out, |
uint8_t | indent, | ||
const ALLOC & | allocator = ALLOC() |
||
) |
Constructor.
out | Stream to use for writing. |
indent | Indent as a number of ' ' to be used for indentation. |
allocator | Allocator to use. |
Definition at line 194 of file JsonWriter.h.
zserio::BasicJsonWriter< ALLOC >::BasicJsonWriter | ( | std::ostream & | out, |
const string< ALLOC > & | indent, | ||
const ALLOC & | allocator = ALLOC() |
||
) |
Constructor.
out | Stream to use for writing. |
indent | Indent as a string to be used for indentation. |
allocator | Allocator to use. |
Definition at line 199 of file JsonWriter.h.
|
overridedefault |
Method generated by default.
|
delete |
Copying and moving is disallowed!
|
delete |
Copying and moving is disallowed!
|
override |
Definition at line 247 of file JsonWriter.h.
|
override |
Definition at line 266 of file JsonWriter.h.
|
override |
Definition at line 234 of file JsonWriter.h.
|
override |
Definition at line 258 of file JsonWriter.h.
|
override |
Definition at line 280 of file JsonWriter.h.
|
override |
Definition at line 240 of file JsonWriter.h.
|
delete |
Copying and moving is disallowed!
|
delete |
Copying and moving is disallowed!
void zserio::BasicJsonWriter< ALLOC >::setEnumerableFormat | ( | EnumerableFormat | enumerableFormat | ) |
Sets preferred formatting for enumerable types.
enumerableFormat | Enumerable format to use. |
Definition at line 228 of file JsonWriter.h.
void zserio::BasicJsonWriter< ALLOC >::setItemSeparator | ( | const string< ALLOC > & | itemSeparator | ) |
Sets custom item separator.
Use with caution since setting of a wrong separator can lead to invalid JSON output.
itemSeparator | Item separator to set. |
Definition at line 216 of file JsonWriter.h.
void zserio::BasicJsonWriter< ALLOC >::setKeySeparator | ( | const string< ALLOC > & | keySeparator | ) |
Sets custom key separator.
Use with caution since setting of a wrong separator can lead to invalid JSON output.
keySeparator | Key separator to set. |
Definition at line 222 of file JsonWriter.h.
|
override |
Definition at line 289 of file JsonWriter.h.
|
staticconstexpr |
Default configuration for enumerable types.
Definition at line 67 of file JsonWriter.h.
|
staticconstexpr |
Default item separator used when indent is not set.
Definition at line 27 of file JsonWriter.h.
|
staticconstexpr |
Default item separator used when indent is set.
Definition at line 32 of file JsonWriter.h.
|
staticconstexpr |
Default key separator.
Definition at line 37 of file JsonWriter.h.