Reflection for RapidJSON
0.0.15
Reflection for serializing/deserializing with RapidJSON
|
Namespaces | |
BinaryReflector | |
The BinaryReflector namespace contains BinaryReader and BinaryWriter for automatic binary (de)serialization. | |
JsonReflector | |
The JsonReflector namespace contains helper functions to ease the use of RapidJSON for automatic (de)serialization. | |
Classes | |
struct | AdaptedBinarySerializable |
The AdaptedBinarySerializable class allows considering 3rd party classes as serializable. More... | |
struct | AdaptedJsonSerializable |
The AdaptedJsonSerializable class allows considering 3rd party classes as serializable. More... | |
struct | BinarySerializable |
The BinarySerializable class provides the CRTP-base for (de)serializable objects. 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... | |
struct | TreatAsMapOrHash |
The TreatAsMapOrHash class allows treating custom classes as std::map or std::unordered_map. More... | |
struct | TreatAsMultiMapOrHash |
The TreatAsMultiMapOrHash class allows treating custom classes as std::multimap or std::unordered_multimap. More... | |
struct | TreatAsMultiSet |
The TreatAsMultiSet class allows treating custom classes as std::multiset or std::unordered_multiset. More... | |
struct | TreatAsSet |
The TreatAsSet class allows treating custom classes as std::set or std::unordered_set. More... | |
Typedefs | |
template<typename Type > | |
using | IsMapOrHash = Traits::Any< Traits::IsSpecializationOf< Type, std::map >, Traits::IsSpecializationOf< Type, std::unordered_map >, TreatAsMapOrHash< Type > > |
template<typename Type > | |
using | IsMultiMapOrHash = Traits::Any< Traits::IsSpecializationOf< Type, std::multimap >, Traits::IsSpecializationOf< Type, std::unordered_multimap >, TreatAsMultiMapOrHash< Type > > |
template<typename Type > | |
using | IsSet = Traits::Any< Traits::IsSpecializationOf< Type, std::set >, Traits::IsSpecializationOf< Type, std::unordered_set >, TreatAsSet< Type > > |
template<typename Type > | |
using | IsMultiSet = Traits::Any< Traits::IsSpecializationOf< Type, std::multiset >, Traits::IsSpecializationOf< Type, std::unordered_multiset >, TreatAsMultiSet< Type > > |
template<typename Type > | |
using | IsArrayOrSet = Traits::Any< Traits::All< Traits::IsIteratable< Type >, Traits::Not< Traits::IsSpecializationOf< Type, std::basic_string > >, Traits::Not< Traits::IsSpecializationOf< Type, std::basic_string_view > >, Traits::Not< IsMapOrHash< Type > >, Traits::Not< IsMultiMapOrHash< Type > >>, TreatAsSet< Type >, TreatAsMultiSet< Type > > |
template<typename Type > | |
using | IsArray = Traits::All< Traits::IsIteratable< Type >, Traits::Not< Traits::IsSpecializationOf< Type, std::basic_string > >, Traits::Not< IsMapOrHash< Type > >, Traits::Not< IsMultiMapOrHash< Type > >, Traits::Not< IsSet< Type > >, Traits::Not< IsMultiSet< Type > >> |
template<typename Type > | |
using | IsIteratableExceptString = Traits::All< Traits::IsIteratable< Type >, Traits::Not< Traits::IsSpecializationOf< Type, std::basic_string > >, Traits::Not< Traits::IsSpecializationOf< Type, std::basic_string > >> |
template<typename Type > | |
using | IsVariant = Traits::All< Traits::IsSpecializationOf< Type, std::variant > > |
Enumerations | |
enum | JsonDeserializationErrorKind : std::uint8_t { JsonDeserializationErrorKind::TypeMismatch, JsonDeserializationErrorKind::ArraySizeMismatch, JsonDeserializationErrorKind::ConversionError, JsonDeserializationErrorKind::UnexpectedDuplicate, JsonDeserializationErrorKind::InvalidVariantObject, JsonDeserializationErrorKind::InvalidVariantIndex } |
The JsonDeserializationErrorKind enum specifies which kind of error happend when populating variables from parsing results. More... | |
enum | JsonType : std::uint8_t { 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 >> * = nullptr> | |
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 >> * = nullptr> | |
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 >>> * = nullptr> | |
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... | |
std::string_view | jsonTypeToString (JsonType jsonType) |
std::string | formatJsonDeserializationError (const JsonDeserializationError &error) |
REFLECTIVE_RAPIDJSON_TREAT_AS_MAP_OR_HASH (Foo) | |
REFLECTIVE_RAPIDJSON_TREAT_AS_MULTI_MAP_OR_HASH (Foo) | |
REFLECTIVE_RAPIDJSON_TREAT_AS_SET (Bar) | |
REFLECTIVE_RAPIDJSON_TREAT_AS_MULTI_SET (Foo) | |
using ReflectiveRapidJSON::IsArray = typedef Traits::All<Traits::IsIteratable<Type>, Traits::Not<Traits::IsSpecializationOf<Type, std::basic_string> >, Traits::Not<IsMapOrHash<Type> >, Traits::Not<IsMultiMapOrHash<Type> >, Traits::Not<IsSet<Type> >, Traits::Not<IsMultiSet<Type> >> |
using ReflectiveRapidJSON::IsArrayOrSet = typedef Traits::Any< Traits::All<Traits::IsIteratable<Type>, Traits::Not<Traits::IsSpecializationOf<Type, std::basic_string> >, Traits::Not<Traits::IsSpecializationOf<Type, std::basic_string_view> >, Traits::Not<IsMapOrHash<Type> >, Traits::Not<IsMultiMapOrHash<Type> >>, TreatAsSet<Type>, TreatAsMultiSet<Type> > |
using ReflectiveRapidJSON::IsIteratableExceptString = typedef Traits::All<Traits::IsIteratable<Type>, Traits::Not<Traits::IsSpecializationOf<Type, std::basic_string> >, Traits::Not<Traits::IsSpecializationOf<Type, std::basic_string> >> |
using ReflectiveRapidJSON::IsMapOrHash = typedef Traits::Any<Traits::IsSpecializationOf<Type, std::map>, Traits::IsSpecializationOf<Type, std::unordered_map>, TreatAsMapOrHash<Type> > |
using ReflectiveRapidJSON::IsMultiMapOrHash = typedef Traits::Any<Traits::IsSpecializationOf<Type, std::multimap>, Traits::IsSpecializationOf<Type, std::unordered_multimap>, TreatAsMultiMapOrHash<Type> > |
using ReflectiveRapidJSON::IsMultiSet = typedef Traits::Any<Traits::IsSpecializationOf<Type, std::multiset>, Traits::IsSpecializationOf<Type, std::unordered_multiset>, TreatAsMultiSet<Type> > |
using ReflectiveRapidJSON::IsSet = typedef Traits::Any<Traits::IsSpecializationOf<Type, std::set>, Traits::IsSpecializationOf<Type, std::unordered_set>, TreatAsSet<Type> > |
using ReflectiveRapidJSON::IsVariant = typedef Traits::All<Traits::IsSpecializationOf<Type, std::variant> > |
|
strong |
The JsonDeserializationErrorKind enum specifies which kind of error happend when populating variables from parsing results.
Definition at line 24 of file errorhandling.h.
|
strong |
The JsonType enum specifies the JSON data type.
Enumerator | |
---|---|
Null | |
Number | |
Bool | |
String | |
Array | |
Object |
Definition at line 37 of file errorhandling.h.
const JsonSerializable<Type>& ReflectiveRapidJSON::as | ( | const Type & | serializable | ) |
Helps to disambiguate when inheritance is used.
Definition at line 106 of file serializable.h.
JsonSerializable<Type>& ReflectiveRapidJSON::as | ( | Type & | serializable | ) |
Helps to disambiguate when inheritance is used.
Definition at line 97 of file serializable.h.
|
inline |
Definition at line 37 of file errorformatting.h.
|
constexpr |
Definition at line 50 of file errorhandling.h.
|
constexpr |
Maps the type info provided by RapidJSON to JsonType.
Definition at line 87 of file errorhandling.h.
|
inline |
Definition at line 17 of file errorformatting.h.
|
constexpr |
Combines to ThrowOn values.
Definition at line 196 of file errorhandling.h.
ReflectiveRapidJSON::REFLECTIVE_RAPIDJSON_TREAT_AS_MAP_OR_HASH | ( | Foo | ) |
ReflectiveRapidJSON::REFLECTIVE_RAPIDJSON_TREAT_AS_MULTI_MAP_OR_HASH | ( | Foo | ) |
ReflectiveRapidJSON::REFLECTIVE_RAPIDJSON_TREAT_AS_MULTI_SET | ( | Foo | ) |
ReflectiveRapidJSON::REFLECTIVE_RAPIDJSON_TREAT_AS_SET | ( | Bar | ) |