NAP
Public Member Functions | List of all members
JSONWriter Class Reference

#include <rtti/jsonwriter.h>

Public Member Functions

 JSONWriter ()
 
std::string GetJSON ()
 
bool supportsEmbeddedPointers () const override
 
bool start (const ObjectList &rootObjects) override
 
bool finish () override
 
bool startRootObject (const rtti::TypeInfo &type) override
 
bool finishRootObject () override
 
bool startCompound (const rtti::TypeInfo &type) override
 
bool finishCompound () override
 
bool startArray (int length) override
 
bool finishArray () override
 
bool writeProperty (const std::string &propertyName) override
 
bool writePointer (const std::string &pointeeID) override
 
bool writePrimitive (const rtti::TypeInfo &type, const rtti::Variant &value) override
 
Inheritance diagram for JSONWriter:
[legend]
Collaboration diagram for JSONWriter:
[legend]

Constructor & Destructor Documentation

◆ JSONWriter()

Member Function Documentation

◆ finish()

bool finish ( )
overridevirtual

Called when serialization is finished, after everything has been written (i.e. end of 'document')

Implements Writer.

◆ finishArray()

bool finishArray ( )
overridevirtual

Called when an array has been completely written

Implements Writer.

◆ finishCompound()

bool finishCompound ( )
overridevirtual

Called when a compound has been completely written

Implements Writer.

◆ finishRootObject()

bool finishRootObject ( )
overridevirtual

Called when a root object has been completely written

Implements Writer.

◆ GetJSON()

std::string GetJSON ( )

Get the generated json

◆ start()

bool start ( const ObjectList rootObjects)
overridevirtual

Called when serialization starts, but before any objects have been written (i.e. start of 'document')

Parameters
rootObjectsThe list of root objects that will be written to this writer

Implements Writer.

◆ startArray()

bool startArray ( int  length)
overridevirtual

Called when an array of the specified length is about to be written. Note that the elements are written in a separate call (writePointer or writePrimitive)

Implements Writer.

◆ startCompound()

bool startCompound ( const rtti::TypeInfo type)
overridevirtual

Called when a compound (i.e. struct nested inside a root object) of the specified type is about to be written

Implements Writer.

◆ startRootObject()

bool startRootObject ( const rtti::TypeInfo type)
overridevirtual

Called when a root object of the specified type is about to be written

Implements Writer.

◆ supportsEmbeddedPointers()

bool supportsEmbeddedPointers ( ) const
overridevirtual

Called to determine if this writer supports writing pointers nested in the object pointing to them (embedded pointers)

Implements Writer.

◆ writePointer()

bool writePointer ( const std::string &  pointeeID)
overridevirtual

Called to write a pointer to an object with the specified ID

Implements Writer.

◆ writePrimitive()

bool writePrimitive ( const rtti::TypeInfo type,
const rtti::Variant value 
)
overridevirtual

Called to write a primitive type with the specified value

Implements Writer.

◆ writeProperty()

bool writeProperty ( const std::string &  propertyName)
overridevirtual

Called to write a property of the specified name. Note that the value for the property is written in a separate call (writePointer or writePrimitive)

Implements Writer.