1#ifndef REFLECTIVE_RAPIDJSON_TRAITS
2#define REFLECTIVE_RAPIDJSON_TRAITS
4#include <c++utilities/misc/traits.h>
9#include <unordered_map>
10#include <unordered_set>
15namespace Traits = ::CppUtilities::Traits;
23template <
typename T>
struct TreatAsSet :
public Traits::Bool<false> {};
27#define REFLECTIVE_RAPIDJSON_TREAT_AS_MAP_OR_HASH(T) \
28 template <> struct TreatAsMapOrHash<T> : public Traits::Bool<true> {}
29#define REFLECTIVE_RAPIDJSON_TREAT_AS_MULTI_MAP_OR_HASH(T) \
30 template <> struct TreatAsMultiMapOrHash<T> : public Traits::Bool<true> {}
31#define REFLECTIVE_RAPIDJSON_TREAT_AS_SET(T) \
32 template <> struct TreatAsSet<T> : public Traits::Bool<true> {}
33#define REFLECTIVE_RAPIDJSON_TREAT_AS_MULTI_SET(T) \
34 template <> struct TreatAsMultiSet<T> : public Traits::Bool<true> {}
37template <
typename Type>
39 = Traits::Any<Traits::IsSpecializationOf<Type, std::map>, Traits::IsSpecializationOf<Type, std::unordered_map>,
TreatAsMapOrHash<Type>>;
40template <
typename Type>
41using IsMultiMapOrHash = Traits::Any<Traits::IsSpecializationOf<Type, std::multimap>, Traits::IsSpecializationOf<Type, std::unordered_multimap>,
43template <
typename Type>
44using IsSet = Traits::Any<Traits::IsSpecializationOf<Type, std::set>, Traits::IsSpecializationOf<Type, std::unordered_set>,
TreatAsSet<Type>>;
45template <
typename Type>
47 = Traits::Any<Traits::IsSpecializationOf<Type, std::multiset>, Traits::IsSpecializationOf<Type, std::unordered_multiset>,
TreatAsMultiSet<Type>>;
48template <
typename Type>
50 Traits::All<Traits::IsIteratable<Type>, Traits::Not<Traits::IsSpecializationOf<Type, std::basic_string>>,
51 Traits::Not<Traits::IsSpecializationOf<Type, std::basic_string_view>>, Traits::Not<IsMapOrHash<Type>>, Traits::Not<IsMultiMapOrHash<Type>>>,
53template <
typename Type>
54using IsArray = Traits::All<Traits::IsIteratable<Type>, Traits::Not<Traits::IsSpecializationOf<Type, std::basic_string>>,
55 Traits::Not<IsMapOrHash<Type>>, Traits::Not<IsMultiMapOrHash<Type>>, Traits::Not<IsSet<Type>>, Traits::Not<IsMultiSet<Type>>>;
56template <
typename Type>
57using IsIteratableExceptString = Traits::All<Traits::IsIteratable<Type>, Traits::Not<Traits::IsSpecializationOf<Type, std::basic_string>>,
58 Traits::Not<Traits::IsSpecializationOf<Type, std::basic_string>>>;
59template <
typename Type>
using IsVariant = Traits::All<Traits::IsSpecializationOf<Type, std::variant>>;
Traits::All< Traits::IsSpecializationOf< Type, std::variant > > IsVariant
Traits::Any< Traits::IsSpecializationOf< Type, std::set >, Traits::IsSpecializationOf< Type, std::unordered_set >, TreatAsSet< Type > > IsSet
Traits::Any< Traits::IsSpecializationOf< Type, std::multiset >, Traits::IsSpecializationOf< Type, std::unordered_multiset >, TreatAsMultiSet< Type > > IsMultiSet
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 > > IsArrayOrSet
Traits::Any< Traits::IsSpecializationOf< Type, std::multimap >, Traits::IsSpecializationOf< Type, std::unordered_multimap >, TreatAsMultiMapOrHash< Type > > IsMultiMapOrHash
Traits::All< Traits::IsIteratable< Type >, Traits::Not< Traits::IsSpecializationOf< Type, std::basic_string > >, Traits::Not< Traits::IsSpecializationOf< Type, std::basic_string > > > IsIteratableExceptString
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 > > > IsArray
Traits::Any< Traits::IsSpecializationOf< Type, std::map >, Traits::IsSpecializationOf< Type, std::unordered_map >, TreatAsMapOrHash< Type > > IsMapOrHash
The TreatAsMapOrHash class allows treating custom classes as std::map or std::unordered_map.
The TreatAsMultiMapOrHash class allows treating custom classes as std::multimap or std::unordered_mul...
The TreatAsMultiSet class allows treating custom classes as std::multiset or std::unordered_multiset.
The TreatAsSet class allows treating custom classes as std::set or std::unordered_set.