![]() |
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/serial2/TextSerializer.h>
Public Member Functions | |
TextSerializer (io::Output &out=cout) | |
virtual void | flush (void) |
virtual void | beginObject (const rtti::Type &clazz, const void *object) |
virtual void | endObject (const rtti::Type &clazz, const void *object) |
virtual void | beginField (CString name) |
virtual void | endField (void) |
virtual void | onPointer (const rtti::Type &clazz, const void *object) |
virtual void | beginCompound (const void *) |
virtual void | onItem (void) |
virtual void | endCompound (const void *) |
virtual void | onEnum (const void *address, int value, const rtti::Type &clazz) |
virtual void | onValue (const bool &v) |
virtual void | onValue (const signed int &v) |
virtual void | onValue (const unsigned int &v) |
virtual void | onValue (const signed char &v) |
virtual void | onValue (const unsigned char &v) |
virtual void | onValue (const signed short &v) |
virtual void | onValue (const unsigned short &v) |
virtual void | onValue (const signed long &v) |
virtual void | onValue (const unsigned long &v) |
virtual void | onValue (const signed long long &v) |
virtual void | onValue (const unsigned long long &v) |
virtual void | onValue (const float &v) |
virtual void | onValue (const double &v) |
virtual void | onValue (const long double &v) |
virtual void | onValue (const CString &v) |
virtual void | onValue (const String &v) |
![]() | |
virtual | ~Serializer (void) |
Serialize the given data to a character output stream, readable by human being.
|
inline |
This function is called to serialize a compound object, that is, an object containing a collection of values with the same type.
object | Compound object to serialize. |
Implements Serializer.
Called to begin the serialization of a field in an object.
This call is always preceded by call to beginObject() for the object containing the field and there is no more call to this function as soon as the corresponding endObject() call is performed.
Between a call to a beginField() and of a endField(), calls to the serializer functions are performed to serialize the corresponding data.
name | Name of the field. |
Implements Serializer.
|
virtual |
Called to start the serialization of a new object.
clazz | Object class descriptor. |
object | Serialized object. |
Implements Serializer.
This function is called at the end of a compound.
This function is only called after a call to beginCompound() and matches any call to beginCompound().
Implements Serializer.
Called to begin the serialization of a field in an object.
This call is always preceded by call to beginField() and there is no more call to this function as soon as the corresponding endObject() call is performed.
Implements Serializer.
|
virtual |
Called to finish the serialization of a new object. This function call is always preceded by a call to beginObject().
clazz | Object class descriptor. |
object | Serialized object. |
Implements Serializer.
Flush to the media (disk, network) the current state of the serialization.
Implements Serializer.
References HashMap< K, T, H, A, E >::clear(), Pair< T1, T2 >::fst, HashMap< K, T, H, A, E >::get(), and Pair< T1, T2 >::snd.
|
virtual |
Called when a value of type enumerate has to be serialized.
address | Address of the value. |
value | Value to serialzie. |
clazz | Enumerated type. |
Implements Serializer.
References Type::asEnum(), and Enumerable::nameFor().
For each value of a compound object, a call to this function is performed.
This function call is always preceded by a call to beginCompound() and will not call anymore after a call to endCompound().
This call is followed by calls to other serialization function in order to serialize the value itself.
Implements Serializer.
|
virtual |
This function is called to serialize a pointer to an object.
A special caution must be devoted to serialize pointer because of the possibility of a circular data structures that may lead to endless looping on this function.
clazz | Class of the pointed object. |
object | Pointed object to serialize. |
Implements Serializer.
References HashMap< K, T, H, A, E >::exists(), elm::pair(), and HashMap< K, T, H, A, E >::put().
Called to serialize a value of type C string.
v | Value to serialize. |
Implements Serializer.
|
virtual |
Called to serialize a value of type double-precision floating point.
v | Value to serialize. |
Implements Serializer.
|
virtual |
Called to serialize a value of type single-precision floating point.
v | Value to serialize. |
Implements Serializer.
|
virtual |
Called to serialize a value of type quadruple-precision floating point.
v | Value to serialize. |
Implements Serializer.
|
virtual |
Called to serialize a value of type signed byte.
v | Value to serialize. |
Implements Serializer.
|
virtual |
Called to serialize a value of type signed integer.
v | Value to serialize. |
Implements Serializer.
|
virtual |
Called to serialize a value of type signed long integer.
v | Value to serialize. |
Implements Serializer.
|
virtual |
Called to serialize a value of type signed long long integer.
v | Value to serialize. |
Implements Serializer.
|
virtual |
Called to serialize a value of type signed short integer.
v | Value to serialize. |
Implements Serializer.
Called to serialize a value of type ELM string.
v | Value to serialize. |
Implements Serializer.
|
virtual |
Called to serialize a value of type unsigned byte.
v | Value to serialize. |
Implements Serializer.
|
virtual |
Called to serialize a value of type unsigned integer.
v | Value to serialize. |
Implements Serializer.
|
virtual |
Called to serialize a value of type unsigned long integer.
v | Value to serialize. |
Implements Serializer.
|
virtual |
Called to serialize a value of type unsigned long long integer.
v | Value to serialize. |
Implements Serializer.
|
virtual |
Called to serialize a value of type unsigned short integer.
v | Value to serialize. |
Implements Serializer.