Class that declares a user-defined class. More...
Public Member Functions | |
template<typename Super > | |
JSonUserClass & | extends () |
Declares a superclass (the template argument is the superclass). | |
template<typename Var > | |
JSonUserClass & | addMember (JKString &name, Var &var) |
Declares a static or a non-member variable. More... | |
template<typename Var , typename T > | |
JSonUserClass & | addMember (JKString &name, Var T::*var) |
Declares a member variable. More... | |
template<typename Set , typename Get > | |
JSonUserClass & | addMember (JKString &name, void(C::*setter)(Set), Get(C::*getter)() const) |
Declares a member variable using accessors. More... | |
JSonUserClass & | addMember (JKString &name, std::function< void(C &, JSonSerial &, JKString &value)> read, std::function< void(const C &, JSonSerial &)> write) |
Declares a member variable and custom functions for serializing it. More... | |
template<typename Var > | |
JSonUserClass & | addMember (JKString &name, Var C::*var, std::function< typename makeptr< Var >::type(C &)> creator) |
Declares a member variable and a custom allocator. More... | |
template<typename Var > | |
JSonUserClass & | addMember (JKString &name, Var C::*var, std::function< typename makearrayptr< Var >::type(C &)> element_creator) |
Declares a member variable that is an array or container and a custom element allocator. More... | |
JSonUserClass & | postRead (std::function< void(C &)> fun) |
Calls a function once all members have been read. More... | |
JSonUserClass & | postWrite (std::function< void(const C &)> fun) |
Calls a function once all members have been written. More... | |
JKString & | className () const override |
Name of the C++ class. | |
Class that declares a user-defined class.
JSonUserClass& jsonserial::JSonUserClass< C >::addMember | ( | JKString & | name, |
Var & | var | ||
) |
Declares a static or a non-member variable.
name is the UTF8 name of the variable in the JSON file, var is the variable
JSonUserClass& jsonserial::JSonUserClass< C >::addMember | ( | JKString & | name, |
Var T::* | var | ||
) |
Declares a member variable.
name is the UTF8 name of the variable in the JSON file, var a pointer to the member
JSonUserClass& jsonserial::JSonUserClass< C >::addMember | ( | JKString & | name, |
void(C::*)(Set) | setter, | ||
Get(C::*)() const | getter | ||
) |
Declares a member variable using accessors.
name is the UTF8 name of the variable in the JSON file, setter its modifier, getter its accessor
JSonUserClass& jsonserial::JSonUserClass< C >::addMember | ( | JKString & | name, |
std::function< void(C &, JSonSerial &, JKString &value)> | read, | ||
std::function< void(const C &, JSonSerial &)> | write | ||
) |
Declares a member variable and custom functions for serializing it.
This method allows serializing a variable in a client-specific way. name is the UTF8 name of the variable in the JSON file, read the function for reading the variable in the JSON file, and write the function for writing it.
JSonUserClass& jsonserial::JSonUserClass< C >::addMember | ( | JKString & | name, |
Var C::* | var, | ||
std::function< typename makeptr< Var >::type(C &)> | creator | ||
) |
Declares a member variable and a custom allocator.
This method is needed when the variable is pointer which corresponding pointee does not have a no-argument constructor. name is the UTF8 name of the variable in the JSON file, var a pointer to the member, creator the function that will create the pointee (that must be returned as a pointer).
JSonUserClass& jsonserial::JSonUserClass< C >::addMember | ( | JKString & | name, |
Var C::* | var, | ||
std::function< typename makearrayptr< Var >::type(C &)> | element_creator | ||
) |
Declares a member variable that is an array or container and a custom element allocator.
This method is needed when the variable is std container or a C array and its elements do not have a no-argument constructor. name is the UTF8 name of the variable in the JSON file, var a pointer to the member, creator the function that will create each element (that must be returned as a pointer).
|
inline |
Calls a function once all members have been read.
This function can be a lambda, a static method, a non-member function or a member function, See the documentation for appropriate arguments.
|
inline |
Calls a function once all members have been written.
This function can be a lambda, a static method, a non-member function or a member function, See the documentation for appropriate arguments.