Reflection for RapidJSON 0.0.16
Reflection for serializing/deserializing with RapidJSON
Loading...
Searching...
No Matches
ReflectiveRapidJSON::JsonSerializable< Type > Struct Template Reference

The JsonSerializable class provides the CRTP-base for (de)serializable objects. More...

#include <serializable.h>

Public Member Functions

void push (RAPIDJSON_NAMESPACE::Value &container)
 Pushes the object to the specified RapidJSON array.
 
void push (RAPIDJSON_NAMESPACE::Value &container, const char *name)
 Pushes the object to the specified RapidJSON object as a member with the specified name.
 
RAPIDJSON_NAMESPACE::StringBuffer toJson () const
 Converts the object to its JSON representation (rapidjson::StringBuffer).
 
RAPIDJSON_NAMESPACE::Document toJsonDocument () const
 Converts the object to its JSON representation (rapidjson::Document).
 

Static Public Member Functions

static Type fromJson (const char *json, std::size_t jsonSize, JsonDeserializationErrors *errors=nullptr)
 Constructs a new object from the specified JSON.
 
static Type fromJson (const char *json, JsonDeserializationErrors *errors=nullptr)
 Constructs a new object from the specified JSON.
 
static Type fromJson (const std::string &json, JsonDeserializationErrors *errors=nullptr)
 Constructs a new object from the specified JSON.
 

Static Public Attributes

static constexpr const char * qualifiedName = "ReflectiveRapidJSON::JsonSerializable"
 

Detailed Description

template<typename Type>
struct ReflectiveRapidJSON::JsonSerializable< Type >

The JsonSerializable class provides the CRTP-base for (de)serializable objects.

Definition at line 21 of file serializable.h.

Member Function Documentation

◆ fromJson() [1/3]

template<typename Type >
Type ReflectiveRapidJSON::JsonSerializable< Type >::fromJson ( const char * json,
JsonDeserializationErrors * errors = nullptr )
static

Constructs a new object from the specified JSON.

Definition at line 85 of file serializable.h.

◆ fromJson() [2/3]

template<typename Type >
Type ReflectiveRapidJSON::JsonSerializable< Type >::fromJson ( const char * json,
std::size_t jsonSize,
JsonDeserializationErrors * errors = nullptr )
static

Constructs a new object from the specified JSON.

Definition at line 77 of file serializable.h.

◆ fromJson() [3/3]

template<typename Type >
Type ReflectiveRapidJSON::JsonSerializable< Type >::fromJson ( const std::string & json,
JsonDeserializationErrors * errors = nullptr )
static

Constructs a new object from the specified JSON.

Definition at line 93 of file serializable.h.

◆ push() [1/2]

template<typename Type >
void ReflectiveRapidJSON::JsonSerializable< Type >::push ( RAPIDJSON_NAMESPACE::Value & container)

Pushes the object to the specified RapidJSON array.

Definition at line 43 of file serializable.h.

◆ push() [2/2]

template<typename Type >
void ReflectiveRapidJSON::JsonSerializable< Type >::push ( RAPIDJSON_NAMESPACE::Value & container,
const char * name )

Pushes the object to the specified RapidJSON object as a member with the specified name.

Definition at line 51 of file serializable.h.

◆ toJson()

template<typename Type >
RAPIDJSON_NAMESPACE::StringBuffer ReflectiveRapidJSON::JsonSerializable< Type >::toJson ( ) const

Converts the object to its JSON representation (rapidjson::StringBuffer).

Remarks
To obtain a string from the returned buffer, just use its GetString() method.

Definition at line 60 of file serializable.h.

◆ toJsonDocument()

template<typename Type >
RAPIDJSON_NAMESPACE::Document ReflectiveRapidJSON::JsonSerializable< Type >::toJsonDocument ( ) const

Converts the object to its JSON representation (rapidjson::Document).

Remarks
To obtain a string from the returned buffer, just use its GetString() method.

Definition at line 69 of file serializable.h.

Member Data Documentation

◆ qualifiedName

template<typename Type >
const char* ReflectiveRapidJSON::JsonSerializable< Type >::qualifiedName = "ReflectiveRapidJSON::JsonSerializable"
staticconstexpr

Definition at line 33 of file serializable.h.


The documentation for this struct was generated from the following files: