Reflection for RapidJSON  0.0.15
Reflection for serializing/deserializing with RapidJSON
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
ReflectiveRapidJSON::JsonSerializable< Type > Struct Template Reference

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

#include <reflector.h>

Public Member Functions

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

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. More...
 
static Type fromJson (const char *json, JsonDeserializationErrors *errors=nullptr)
 Constructs a new object from the specified JSON. More...
 
static Type fromJson (const std::string &json, JsonDeserializationErrors *errors=nullptr)
 Constructs a new object from the specified JSON. More...
 

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 33 of file reflector.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 81 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 73 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 89 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 39 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 47 of file serializable.h.

◆ toJson()

template<typename Type >
RAPIDJSON_NAMESPACE::StringBuffer ReflectiveRapidJSON::JsonSerializable< Type >::toJson

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 56 of file serializable.h.

◆ toJsonDocument()

template<typename Type >
RAPIDJSON_NAMESPACE::Document ReflectiveRapidJSON::JsonSerializable< Type >::toJsonDocument

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 65 of file serializable.h.

Member Data Documentation

◆ qualifiedName

template<typename Type >
constexpr 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: