Nebula
|
#include <jsonwriter.h>
Write Json-formatted data to a stream.
Inherits IO::StreamWriter.
Public Member Functions | |
JsonWriter () | |
constructor | |
virtual | ~JsonWriter () |
destructor | |
virtual bool | Open () |
begin writing the stream | |
virtual void | Close () |
end writing the stream | |
void | BeginArray (const char *nodeName=nullptr) |
begin a new array node | |
void | BeginObject (const char *nodeName=nullptr) |
begin a new node that can host key-value pairs | |
void | End () |
end current object or array | |
template<typename T > | |
void | Add (const T &value, const Util::String &name="") |
add a value to the current array node | |
template<unsigned int N> | |
void | Add (Util::BitField< N > const &value, const Util::String &name="") |
add bitfield of N size | |
void | Add (const char *value, const Util::String &name="") |
special handling for const strings | |
template<> | |
void | Add (const Util::String &value, const Util::String &name) |
template<> | |
void | Add (const Util::StringAtom &value, const Util::String &name) |
template<> | |
void | Add (const Util::FourCC &value, const Util::String &name) |
template<> | |
void | Add (const bool &value, const Util::String &name) |
template<> | |
void | Add (const char &value, const Util::String &name) |
template<> | |
void | Add (const uchar &value, const Util::String &name) |
template<> | |
void | Add (const int &value, const Util::String &name) |
template<> | |
void | Add (const unsigned int &value, const Util::String &name) |
template<> | |
void | Add (const uint64_t &value, const Util::String &name) |
template<> | |
void | Add (const float &value, const Util::String &name) |
template<> | |
void | Add (const Math::vec3 &value, const Util::String &name) |
template<> | |
void | Add (const Math::vec4 &value, const Util::String &name) |
template<> | |
void | Add (const Util::Color &value, const Util::String &name) |
template<> | |
void | Add (const Math::quat &value, const Util::String &name) |
template<> | |
void | Add (const Math::vec2 &value, const Util::String &name) |
template<> | |
void | Add (const Math::mat4 &value, const Util::String &name) |
template<> | |
void | Add (const Math::transform44 &value, const Util::String &name) |
template<> | |
void | Add (const Util::Variant &value, const Util::String &name) |
template<> | |
void | Add (const Util::Guid &value, const Util::String &name) |
template<> | |
void | Add (const Util::Array< int > &value, const Util::String &name) |
template<> | |
void | Add (const Util::Array< Util::String > &value, const Util::String &name) |
template<> | |
void | Add (const Util::String &value, const Util::String &name) |
template<> | |
void | Add (const Util::StringAtom &value, const Util::String &name) |
template<> | |
void | Add (const Util::FourCC &value, const Util::String &name) |
template<> | |
void | Add (const bool &value, const Util::String &name) |
template<> | |
void | Add (const char &value, const Util::String &name) |
template<> | |
void | Add (const uchar &value, const Util::String &name) |
template<> | |
void | Add (const int &value, const Util::String &name) |
template<> | |
void | Add (const unsigned int &value, const Util::String &name) |
template<> | |
void | Add (const float &value, const Util::String &name) |
template<> | |
void | Add (const Math::vec3 &value, const Util::String &name) |
template<> | |
void | Add (const Math::vec4 &value, const Util::String &name) |
template<> | |
void | Add (const Math::vec2 &value, const Util::String &name) |
template<> | |
void | Add (const Math::mat4 &value, const Util::String &name) |
template<> | |
void | Add (const Math::transform44 &value, const Util::String &name) |
template<> | |
void | Add (const Util::Variant &value, const Util::String &name) |
template<> | |
void | Add (const Util::Guid &value, const Util::String &name) |
template<> | |
void | Add (const Util::Array< int > &value, const Util::String &name) |
template<> | |
void | Add (const Util::Array< Util::String > &value, const Util::String &name) |
Public Member Functions inherited from IO::StreamWriter | |
StreamWriter () | |
constructor | |
virtual | ~StreamWriter () |
destructor | |
void | SetStream (const Ptr< Stream > &s) |
set stream to write to | |
const Ptr< Stream > & | GetStream () const |
get currently set stream | |
bool | HasStream () const |
return true if a stream is set | |
bool | IsOpen () const |
return true if currently open | |
Public Member Functions inherited from Core::RefCounted | |
RefCounted () | |
constructor | |
int | GetRefCount () const |
get the current refcount | |
void | AddRef () |
increment refcount by one | |
void | Release () |
decrement refcount and destroy object if refcount is zero | |
bool | IsInstanceOf (const Rtti &rtti) const |
return true if this object is instance of given class | |
bool | IsInstanceOf (const Util::String &className) const |
return true if this object is instance of given class by string | |
bool | IsInstanceOf (const Util::FourCC &classFourCC) const |
return true if this object is instance of given class by fourcc | |
bool | IsA (const Rtti &rtti) const |
return true if this object is instance of given class, or a derived class | |
bool | IsA (const Util::String &rttiName) const |
return true if this object is instance of given class, or a derived class, by string | |
bool | IsA (const Util::FourCC &rttiFourCC) const |
return true if this object is instance of given class, or a derived class, by fourcc | |
const Util::String & | GetClassName () const |
get the class name | |
Util::FourCC | GetClassFourCC () const |
get the class FourCC code | |
Private Member Functions | |
__DeclareClass (JsonWriter) | |
Private Attributes | |
pjson::document * | document |
add a value to current object node | |
Util::Stack< pjson::value_variant * > | hierarchy |
Util::Stack< Util::String > | nameHierarchy |
Additional Inherited Members | |
Static Public Member Functions inherited from Core::RefCounted | |
static void | DumpRefCountingLeaks () |
dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!) | |
Protected Member Functions inherited from Core::RefCounted | |
virtual | ~RefCounted () |
destructor (called when refcount reaches zero) | |
Protected Attributes inherited from IO::StreamWriter | |
Ptr< Stream > | stream |
bool | isOpen |
bool | streamWasOpen |
IO::JsonWriter::JsonWriter | ( | ) |
constructor
|
virtual |
destructor
|
private |
void IO::JsonWriter::Add | ( | const bool & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const bool & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const char & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const char & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const char * | value, |
const Util::String & | name = "" ) |
special handling for const strings
void IO::JsonWriter::Add | ( | const float & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const float & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const int & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const int & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Math::mat4 & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Math::mat4 & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Math::quat & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Math::transform44 & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Math::transform44 & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Math::vec2 & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Math::vec2 & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Math::vec3 & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Math::vec3 & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Math::vec4 & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Math::vec4 & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const T & | value, |
const Util::String & | name = "" ) |
add a value to the current array node
void IO::JsonWriter::Add | ( | const uchar & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const uchar & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const uint64_t & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const unsigned int & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const unsigned int & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Util::Array< int > & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Util::Array< int > & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Util::Array< Util::String > & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Util::Array< Util::String > & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Util::Color & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Util::FourCC & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Util::FourCC & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Util::Guid & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Util::Guid & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Util::String & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Util::String & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Util::StringAtom & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Util::StringAtom & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Util::Variant & | value, |
const Util::String & | name ) |
void IO::JsonWriter::Add | ( | const Util::Variant & | value, |
const Util::String & | name ) |
|
inline |
add bitfield of N size
void IO::JsonWriter::BeginArray | ( | const char * | nodeName = nullptr | ) |
begin a new array node
void IO::JsonWriter::BeginObject | ( | const char * | nodeName = nullptr | ) |
begin a new node that can host key-value pairs
|
virtual |
end writing the stream
Reimplemented from IO::StreamWriter.
void IO::JsonWriter::End | ( | ) |
end current object or array
|
virtual |
begin writing the stream
Reimplemented from IO::StreamWriter.
|
private |
add a value to current object node
|
private |
|
private |