SleepyDiscord::json
Classes​
Types​
Name | |
---|---|
enum | FieldType { REQUIRIED_FIELD = 0, OPTIONAL_FIELD = 1 << 0, NULLABLE_FIELD = 1 << 1, OPTIONAL_NULLABLE_FIELD = OPTIONAL_FIELD |
enum | FromJSONMode { Default = 0, ReturnOnError = 1} |
using rapidjson::Value | Value |
using rapidjson::Value::ConstArray | Array |
using Value | Values |
template <class Return > using Return(*)(const Value &) | JSONConverter |
Functions​
Name | |
---|---|
const std::string | createJSON(std::initializer_list< std::pair< std::string, std::string >> json) |
const std::string | string(const std::string & s) |
const std::string | UInteger(const uint64_t num) |
const std::string | optionalUInteger(const uint64_t num) |
const std::string | integer(const int64_t num) |
const std::string | optionalInteger(const int64_t num) |
const std::string | boolean(const bool boolean) |
template <class Type > const std::string | createJSONArray(const std::vector< Type > source) |
template <typename T > constexpr auto | hasPushBack(int ) |
template <typename T > constexpr std::false_type | hasPushBack(long ) |
const Value & | leaveAlone(const Value & value) |
const char * | toString(const Value & value) |
std::string | toStdString(const Value & value) |
nonstd::string_view | toStdStringView(const Value & value) |
int | toInt(const Value & value) |
unsigned int | toUint(const Value & value) |
int64_t | toInt64(const Value & value) |
uint64_t | toUint64(const Value & value) |
double | toDouble(const Value & value) |
float | toFloat(const Value & value) |
bool | toBool(const Value & value) |
template <class Type ,class Value > ArrayWrapper< Type, ArrayStringWrapper< Value > > | toArray(Value & value) |
template <class Type > Type | toEnum(const Value & value) |
template <class Object > Value | toJSON(const Object & object, Value::AllocatorType & allocator) |
template <int defaultValue,template< class, int > class TypeHelper =PrimitiveTypeHelper,class Class ,class Type > constexpr PairImpl< Class, Type, TypeHelper< Type, defaultValue > > | pair(Type Class:: member, const char name, FieldType type) |
template <template< class > class TypeHelper =ClassTypeHelper,class Class ,class Type > constexpr PairImpl< Class, Type, TypeHelper< Type > > | pair(Type Class:: member, const char name, FieldType type) |
template <template< class, template< class... > class > class TypeHelper,template< class... > class TypeHelper2 =ClassTypeHelper,class Class ,class Type > constexpr PairImpl< Class, Type, TypeHelper< Type, TypeHelper2 > > | pair(Type Class:: member, const char name, FieldType type) |
template <template< class, class > class TypeHelper,template< class, template< class... > class > class TypeHelper2,template< class... > class TypeHelper3,class Class ,class Type ,class Type2 > constexpr PairImpl< Class, Type, TypeHelper< Type, TypeHelper2< Type2, TypeHelper3 > > > | pair(Type Class:: member, const char name, FieldType type) |
template <class Helper ,class ResultingObject ,class Value > bool | castValue(ResultingObject & result, Value & value) |
template <FromJSONMode mode =FromJSONMode::Default,class ResultingObject ,class Value ,size_t i =0> std::enable_if< i==std::tuple_size< decltype(ResultingObject::JSONStruct)>::value, bool >::type | fromJSON(ResultingObject & , Value & ) |
Types Documentation​
enum FieldType​
Enumerator | Value | Description |
---|---|---|
REQUIRIED_FIELD | 0 | |
OPTIONAL_FIELD | 1 << 0 | |
NULLABLE_FIELD | 1 << 1 | |
OPTIONAL_NULLABLE_FIELD | OPTIONAL_FIELD | NULLABLE_FIELD |
enum FromJSONMode​
Enumerator | Value | Description |
---|---|---|
Default | 0 | |
ReturnOnError | 1 |
using Value​
using SleepyDiscord::json::Value = typedef rapidjson::Value;
using Array​
using SleepyDiscord::json::Array = typedef rapidjson::Value::ConstArray;
using Values​
using SleepyDiscord::json::Values = typedef Value;
using JSONConverter​
template <class Return >
using SleepyDiscord::json::JSONConverter = typedef Return(*)(const Value&);
Functions Documentation​
function createJSON​
const std::string createJSON(
std::initializer_list< std::pair< std::string, std::string >> json
)
function string​
const std::string string(
const std::string & s
)
function UInteger​
const std::string UInteger(
const uint64_t num
)
function optionalUInteger​
const std::string optionalUInteger(
const uint64_t num
)
function integer​
const std::string integer(
const int64_t num
)
function optionalInteger​
const std::string optionalInteger(
const int64_t num
)
function boolean​
const std::string boolean(
const bool boolean
)
function createJSONArray​
template <class Type >
const std::string createJSONArray(
const std::vector< Type > source
)
function hasPushBack​
template <typename T >
constexpr auto hasPushBack(
int
)
function hasPushBack​
template <typename T >
constexpr std::false_type hasPushBack(
long
)
function leaveAlone​
inline const Value & leaveAlone(
const Value & value
)
function toString​
inline const char * toString(
const Value & value
)
function toStdString​
inline std::string toStdString(
const Value & value
)
function toStdStringView​
inline nonstd::string_view toStdStringView(
const Value & value
)
function toInt​
inline int toInt(
const Value & value
)
function toUint​
inline unsigned int toUint(
const Value & value
)
function toInt64​
inline int64_t toInt64(
const Value & value
)
function toUint64​
inline uint64_t toUint64(
const Value & value
)
function toDouble​
inline double toDouble(
const Value & value
)
function toFloat​
inline float toFloat(
const Value & value
)
function toBool​
inline bool toBool(
const Value & value
)
function toArray​
template <class Type ,
class Value >
inline ArrayWrapper< Type, ArrayStringWrapper< Value > > toArray(
Value & value
)
function toEnum​
template <class Type >
inline Type toEnum(
const Value & value
)
function toJSON​
template <class Object >
inline Value toJSON(
const Object & object,
Value::AllocatorType & allocator
)
function pair​
template <int defaultValue,
template< class, int > class TypeHelper =PrimitiveTypeHelper,
class Class ,
class Type >
constexpr PairImpl< Class, Type, TypeHelper< Type, defaultValue > > pair(
Type Class::* member,
const char * name,
FieldType type
)
function pair​
template <template< class > class TypeHelper =ClassTypeHelper,
class Class ,
class Type >
constexpr PairImpl< Class, Type, TypeHelper< Type > > pair(
Type Class::* member,
const char * name,
FieldType type
)
function pair​
template <template< class, template< class... > class > class TypeHelper,
template< class... > class TypeHelper2 =ClassTypeHelper,
class Class ,
class Type >
constexpr PairImpl< Class, Type, TypeHelper< Type, TypeHelper2 > > pair(
Type Class::* member,
const char * name,
FieldType type
)
function pair​
template <template< class, class > class TypeHelper,
template< class, template< class... > class > class TypeHelper2,
template< class... > class TypeHelper3,
class Class ,
class Type ,
class Type2 >
constexpr PairImpl< Class, Type, TypeHelper< Type, TypeHelper2< Type2, TypeHelper3 > > > pair(
Type Class::* member,
const char * name,
FieldType type
)
function castValue​
template <class Helper ,
class ResultingObject ,
class Value >
inline bool castValue(
ResultingObject & result,
Value & value
)
function fromJSON​
template <FromJSONMode mode =FromJSONMode::Default,
class ResultingObject ,
class Value ,
size_t i =0>
inline std::enable_if< i==std::tuple_size< decltype(ResultingObject::JSONStruct)>::value, bool >::type fromJSON(
ResultingObject & ,
Value &
)
Updated on 13 April 2022 at 18:39:59 UTC