Reflection for RapidJSON  0.0.3
Reflection for serializing/deserializing with RapidJSON
Namespaces | Classes | Enumerations | Functions
ReflectiveRapidJSON Namespace Reference

Namespaces

 JsonReflector
 The JsonReflector namespace contains helper functions to ease the use of RapidJSON for automatic (de)serialization.
 

Classes

struct  AdaptedJsonSerializable
 The AdaptedJsonSerializable class allows considering 3rd party classes as serializable. More...
 
struct  JsonDeserializationError
 The JsonDeserializationError struct describes any errors of fromJson() except such caused by invalid JSON. More...
 
struct  JsonDeserializationErrors
 The JsonDeserializationErrors struct can be passed to fromJson() for error handling. More...
 
struct  JsonSerializable
 The JsonSerializable class provides the CRTP-base for (de)serializable objects. More...
 

Enumerations

enum  JsonDeserializationErrorKind : byte { JsonDeserializationErrorKind::TypeMismatch, JsonDeserializationErrorKind::ArraySizeMismatch, JsonDeserializationErrorKind::ConversionError }
 The JsonDeserializationErrorKind enum specifies which kind of error happend when populating variables from parsing results. More...
 
enum  JsonType : byte {
  JsonType::Null, JsonType::Number, JsonType::Bool, JsonType::String,
  JsonType::Array, JsonType::Object
}
 The JsonType enum specifies the JSON data type. More...
 

Functions

template<typename Type , Traits::EnableIf< std::is_base_of< JsonSerializable< Type >, Type >> ...>
JsonSerializable< Type > & as (Type &serializable)
 Helps to disambiguate when inheritance is used. More...
 
template<typename Type , Traits::EnableIf< std::is_base_of< JsonSerializable< Type >, Type >> ...>
const JsonSerializable< Type > & as (const Type &serializable)
 Helps to disambiguate when inheritance is used. More...
 
template<typename Type , Traits::EnableIf< Traits::Not< std::is_same< Type, bool >>, Traits::Any< std::is_integral< Type >, std::is_floating_point< Type >>> ...>
constexpr JsonType jsonType ()
 
constexpr JsonType jsonType (RAPIDJSON_NAMESPACE::Type type)
 Maps the type info provided by RapidJSON to JsonType. More...
 
constexpr JsonDeserializationErrors::ThrowOn operator| (JsonDeserializationErrors::ThrowOn lhs, JsonDeserializationErrors::ThrowOn rhs)
 Combines to ThrowOn values. More...
 

Enumeration Type Documentation

◆ JsonDeserializationErrorKind

The JsonDeserializationErrorKind enum specifies which kind of error happend when populating variables from parsing results.

Enumerator
TypeMismatch 

The expected type does not match the type actually present in the JSON document.

ArraySizeMismatch 

The expected array size does not match the actual size of the JSON array. A fixed size is expected when deserializing an std::tuple.

ConversionError 

The expected type matches the type present in the JSON document, but further conversion of the value failed.

Definition at line 24 of file errorhandling.h.

◆ JsonType

enum ReflectiveRapidJSON::JsonType : byte
strong

The JsonType enum specifies the JSON data type.

Remarks
This is currently only used for error handling to propagate expected and actual types in case of a mismatch.
Enumerator
Null 
Number 
Bool 
String 
Array 
Object 

Definition at line 34 of file errorhandling.h.

Function Documentation

◆ as() [1/2]

template<typename Type , Traits::EnableIf< std::is_base_of< JsonSerializable< Type >, Type >> ...>
JsonSerializable<Type>& ReflectiveRapidJSON::as ( Type &  serializable)

Helps to disambiguate when inheritance is used.

Definition at line 87 of file serializable.h.

◆ as() [2/2]

template<typename Type , Traits::EnableIf< std::is_base_of< JsonSerializable< Type >, Type >> ...>
const JsonSerializable<Type>& ReflectiveRapidJSON::as ( const Type &  serializable)

Helps to disambiguate when inheritance is used.

Definition at line 96 of file serializable.h.

◆ jsonType() [1/2]

template<typename Type , Traits::EnableIf< Traits::Not< std::is_same< Type, bool >>, Traits::Any< std::is_integral< Type >, std::is_floating_point< Type >>> ...>
constexpr JsonType ReflectiveRapidJSON::jsonType ( )

Definition at line 47 of file errorhandling.h.

◆ jsonType() [2/2]

constexpr JsonType ReflectiveRapidJSON::jsonType ( RAPIDJSON_NAMESPACE::Type  type)

Maps the type info provided by RapidJSON to JsonType.

Definition at line 84 of file errorhandling.h.

◆ operator|()

Combines to ThrowOn values.

Definition at line 185 of file errorhandling.h.