SerializationInfo Class Reference

#include <Pt/SerializationInfo.h>

Represents arbitrary types during serialization.

Inherited by Settings [private].

Classes

class  ConstIterator
 Const forward iterator for child elements. More...
 
class  Iterator
 Forward Iterator for child elements. More...
 

Public Types

enum  Type {
  Void = 0,
  Context = 1,
  Reference = 2,
  Boolean = 3,
  Char = 4,
  Str = 5,
  Int8 = 6,
  Int16 = 7,
  Int32 = 8,
  Int64 = 9,
  UInt8 = 10,
  UInt16 = 11,
  UInt32 = 12,
  UInt64 = 13,
  Float = 14,
  Double = 15,
  LongDouble = 16,
  Binary = 17,
  Struct = 18,
  Sequence = 19,
  Dict = 20,
  DictElement = 21
}
 Type identifier. More...
 

Public Member Functions

 SerializationInfo ()
 Default constructor.
 
 SerializationInfo (SerializationContext *context)
 Construct with context.
 
 ~SerializationInfo ()
 Destructor.
 
SerializationInfoaddDictElement ()
 Add a dict element.
 
SerializationInfoaddDictKey ()
 Add a dict key.
 
SerializationInfoaddDictValue ()
 Add a dict value.
 
SerializationInfoaddElement ()
 Add a sequence element.
 
SerializationInfoaddMember (const std::string &name)
 Add a struct member.
 
SerializationInfoaddMember (const char *name)
 Add a struct member.
 
SerializationInfoaddMember (const char *name, std::size_t len)
 Add a struct member.
 
SerializationInfoaddMember (const LiteralPtr< char > &name)
 Add a struct member.
 
Iterator begin ()
 Returns an iterator to the begin of child elements.
 
ConstIterator begin () const
 Returns an iterator to the begin of child elements.
 
Iterator beginFormat (Formatter &formatter)
 Begin formatting.
 
void beginLoad (void *p, const std::type_info &ti) const
 Begin loading.
 
bool beginSave (const void *p)
 Begin saving.
 
void clear ()
 Clears all content.
 
template<typename T >
bool compose (T &type) const
 Returns true if the type could be composed with a surrogate.
 
SerializationContextcontext () const
 Returns the used context.
 
template<typename T >
bool decompose (const T &type)
 Returns true if the type could be decomposed with a surrogate.
 
Iterator end ()
 Returns an iterator to the end of child elements.
 
ConstIterator end () const
 Returns an iterator to the end of child elements.
 
void endFormat (Formatter &formatter)
 End formatting.
 
const SerializationInfofindMember (const std::string &name) const
 Find a struct member. More...
 
const SerializationInfofindMember (const char *name) const
 Find a struct member. More...
 
SerializationInfofindMember (const std::string &name)
 Find a struct member. More...
 
SerializationInfofindMember (const char *name)
 Find a struct member. More...
 
void finishLoad () const
 Finish loading.
 
void finishSave ()
 Finish saving.
 
void format (Formatter &formatter) const
 Format complete value or all members.
 
const char * getBinary (std::size_t &length) const
 Get value as a binary object.
 
void getBool (bool &b) const
 Get value as a bool.
 
void getChar (char c) const
 Get value as a character.
 
void getChar (Pt::Char &c) const
 Get value as a character.
 
void getDouble (double &f) const
 Get value as a double.
 
void getFloat (float &f) const
 Get value as a float.
 
void getInt16 (Pt::int16_t &n) const
 Get value as a 16-bit integer.
 
void getInt32 (Pt::int32_t &i) const
 Get value as a 32-bit integer.
 
void getInt64 (Pt::int64_t &l) const
 Get value as a 64-bit integer.
 
void getInt8 (Pt::int8_t &n) const
 Get value as a 8-bit integer.
 
void getLongDouble (long double &d) const
 Get value as a long double.
 
const SerializationInfogetMember (const std::string &name) const
 Get a struct member.
 
const SerializationInfogetMember (const char *name) const
 Get a struct member.
 
void getString (std::string &s, const TextCodec< Pt::Char, char > &codec) const
 Get value as a string.
 
void getString (std::string &s) const
 Get value as a string.
 
void getString (Pt::String &s) const
 Get value as a string.
 
void getUInt16 (Pt::uint16_t &n) const
 Get value as a 16-bit unsigned integer.
 
void getUInt32 (Pt::uint32_t &n) const
 Get value as a 32-bit unsigned integer.
 
void getUInt64 (Pt::uint64_t &n) const
 Get value as a 64-bit unsigned integer.
 
void getUInt8 (Pt::uint8_t &n) const
 Get value as a 8-bit unsigned integer.
 
const char * id () const
 Returns the reference ID.
 
bool isDict () const
 Returns true if dictionary type.
 
bool isReference () const
 Returns true if reference.
 
bool isScalar () const
 Returns true if scalar type.
 
bool isSequence () const
 Returns true if sequence type.
 
bool isStruct () const
 Returns true if struct type.
 
bool isVoid () const
 Returns true if not set to a type.
 
template<typename T >
void loadPointer (T *&fixme, unsigned mid=0) const
 Load a reference during deserialization.
 
template<typename T >
void loadReference (T &fixme, unsigned mid=0) const
 Load a reference during deserialization.
 
std::size_t memberCount () const
 Returns the number of members.
 
const char * name () const
 Returns the instance name.
 
SerializationInfoparent ()
 Returns the parent node.
 
const SerializationInfoparent () const
 Returns the parent node.
 
void rebind (void *obj) const
 Rebind to new address.
 
void rebindFixup (void *obj) const
 Rebind to new fixup address.
 
void removeMember (const std::string &name)
 Remove a struct member.
 
void removeMember (const char *name)
 Remove a struct member.
 
void setBinary (const char *data, std::size_t length)
 Set to binary value.
 
void setBool (bool b)
 Set to bool value.
 
void setChar (char c)
 Set to character value.
 
void setChar (const Pt::Char &c)
 Set to character value.
 
void setDict ()
 Set to dictionary type.
 
void setDouble (double f)
 Set to double value.
 
void setFloat (float f)
 Set to float value.
 
void setId (const std::string &id)
 Sets the reference ID.
 
void setId (const char *id)
 Sets the reference ID.
 
void setId (const char *id, std::size_t len)
 Sets the reference ID.
 
void setInt16 (Pt::int16_t n)
 Set to 16-bit integer value.
 
void setInt32 (Pt::int32_t n)
 Set to 32-bit integer value.
 
void setInt64 (Pt::int64_t l)
 Set to 64-bit integer value.
 
void setInt8 (Pt::int8_t n)
 Set to 8-bit integer value.
 
void setLongDouble (long double d)
 Set to long double value.
 
void setName (const std::string &name)
 Sets the instance name.
 
void setName (const char *name)
 Sets the instance name.
 
void setName (const char *type, std::size_t len)
 Sets the instance name.
 
void setName (const LiteralPtr< char > &type)
 Sets the instance name.
 
void setReference (const void *ref)
 Set to reference for which to create an ID.
 
void setReference (const std::string &id)
 Set to reference with ID to fixup.
 
void setReference (const char *id, std::size_t idlen)
 Set to reference with ID to fixup.
 
void setSequence ()
 Set to sequence type.
 
void setString (const char *s)
 Set to string value.
 
void setString (const char *s, std::size_t len, const TextCodec< Pt::Char, char > &codec)
 Set to string value.
 
void setString (const std::string &s)
 Set to string value.
 
void setString (const std::string &str, const TextCodec< Pt::Char, char > &codec)
 Set to string value.
 
void setString (const Pt::String &s)
 Set to string value.
 
void setString (const Pt::Char *s, std::size_t len)
 Set to string value.
 
void setTypeName (const std::string &type)
 Sets the type name.
 
void setTypeName (const char *type)
 Sets the type name.
 
void setTypeName (const char *type, std::size_t len)
 Sets the type name.
 
void setTypeName (const LiteralPtr< char > &type)
 Sets the type name.
 
void setUInt16 (Pt::uint16_t n)
 Set to 16-bit unsigned integer value.
 
void setUInt32 (Pt::uint32_t n)
 Set to 32-bit unsigned integer value.
 
void setUInt64 (Pt::uint64_t n)
 Set to 64-bit unsigned integer value.
 
void setUInt8 (Pt::uint8_t n)
 Set to 8-bit unsigned integer value.
 
void setVoid ()
 Set to void type.
 
Type type () const
 Returns the type identifier.
 
const char * typeName () const
 Returns the type name.
 

Related Functions

template<typename T >
void operator<<= (SerializationInfo &si, const T *ptr)
 Serializes a pointer reference.
 
void operator<<= (SerializationInfo &si, bool n)
 Serializes a bool.
 
void operator<<= (SerializationInfo &si, Pt::int8_t n)
 Serializes a 8-bit integer.
 
void operator<<= (SerializationInfo &si, Pt::int16_t n)
 Serializes a 16-bit integer.
 
void operator<<= (SerializationInfo &si, Pt::int32_t n)
 Serializes a 32-bit integer.
 
void operator<<= (SerializationInfo &si, Pt::int64_t n)
 Serializes a 64-bit integer.
 
void operator<<= (SerializationInfo &si, Pt::uint8_t n)
 Serializes a 8-bit unsigned integer.
 
void operator<<= (SerializationInfo &si, Pt::uint16_t n)
 Serializes a 16-bit unsigned integer.
 
void operator<<= (SerializationInfo &si, Pt::uint32_t n)
 Serializes a 32-bit unsigned integer.
 
void operator<<= (SerializationInfo &si, Pt::uint64_t n)
 Serializes a 64-bit unsigned integer.
 
void operator<<= (SerializationInfo &si, float n)
 Serializes a float value.
 
void operator<<= (SerializationInfo &si, double n)
 Serializes a double value.
 
void operator<<= (SerializationInfo &si, long double n)
 Serializes a long double value.
 
void operator<<= (SerializationInfo &si, char ch)
 Serializes a character value.
 
void operator<<= (SerializationInfo &si, const char *str)
 Serializes a string.
 
void operator<<= (SerializationInfo &si, const std::string &str)
 Serializes a std::string.
 
void operator<<= (SerializationInfo &si, const Pt::String &str)
 Serializes a string.
 
template<typename T , typename A >
void operator<<= (SerializationInfo &si, const std::vector< T, A > &vec)
 Serializes a std::vector.
 
template<typename T , typename A >
void operator<<= (SerializationInfo &si, const std::list< T, A > &list)
 Serializes a std::list.
 
template<typename T , typename A >
void operator<<= (SerializationInfo &si, const std::deque< T, A > &deque)
 Serializes a std::deque.
 
template<typename T , typename C , typename A >
void operator<<= (SerializationInfo &si, const std::set< T, C, A > &set)
 Serializes a std::set.
 
template<typename T , typename C , typename A >
void operator<<= (SerializationInfo &si, const std::multiset< T, C, A > &multiset)
 Serializes a std::multiset.
 
template<typename K , typename V , typename P , typename A >
void operator<<= (SerializationInfo &si, const std::map< K, V, P, A > &map)
 Serializes a std::map.
 
template<typename T , typename C , typename P , typename A >
void operator<<= (SerializationInfo &si, const std::multimap< T, C, P, A > &multimap)
 Serializes a std::multimap.
 
template<typename T >
void operator>>= (const SerializationInfo &si, T *&ptr)
 Deserializes a pointer reference.
 
void operator>>= (const SerializationInfo &si, bool &n)
 Deserializes a bool.
 
void operator>>= (const SerializationInfo &si, Pt::int8_t &n)
 Deserializes an 8-bit integer.
 
void operator>>= (const SerializationInfo &si, Pt::int16_t &n)
 Deserializes a 16-bit integer.
 
void operator>>= (const SerializationInfo &si, Pt::int32_t &n)
 Deserializes a 32-bit integer.
 
void operator>>= (const SerializationInfo &si, Pt::int64_t &n)
 Deserializes a 64-bit integer.
 
void operator>>= (const SerializationInfo &si, Pt::uint8_t &n)
 Deserializes a 8-bit unsigned integer.
 
void operator>>= (const SerializationInfo &si, Pt::uint16_t &n)
 Deserializes a 16-bit unsigned integer.
 
void operator>>= (const SerializationInfo &si, Pt::uint32_t &n)
 Deserializes a 32-bit unsigned integer.
 
void operator>>= (const SerializationInfo &si, Pt::uint64_t &n)
 Deserializes a 64-bit unsigned integer.
 
void operator>>= (const SerializationInfo &si, float &n)
 Deserializes a float value.
 
void operator>>= (const SerializationInfo &si, double &n)
 Deserializes a double value.
 
void operator>>= (const SerializationInfo &si, long double &n)
 Deserializes a long double value.
 
void operator>>= (const SerializationInfo &si, char &ch)
 Deserializes a character value.
 
void operator>>= (const SerializationInfo &si, std::string &str)
 Deserializes a std::string.
 
void operator>>= (const SerializationInfo &si, Pt::String &str)
 Deserializes a string.
 
template<typename T , typename A >
void operator>>= (const SerializationInfo &si, std::vector< T, A > &vec)
 Deserializes a std::vector.
 
template<typename T , typename A >
void operator>>= (const SerializationInfo &si, std::list< T, A > &list)
 Deserializes a std::list.
 
template<typename T , typename A >
void operator>>= (const SerializationInfo &si, std::deque< T, A > &deque)
 Deserializes a std::deque.
 
template<typename T , typename C , typename A >
void operator>>= (const SerializationInfo &si, std::set< T, C, A > &set)
 Deserializes a std::set. More...
 
template<typename T , typename C , typename A >
void operator>>= (const SerializationInfo &si, std::multiset< T, C, A > &multiset)
 Deserializes a std::multiset. More...
 
template<typename K , typename V , typename P , typename A >
void operator>>= (const SerializationInfo &si, std::map< K, V, P, A > &map)
 Deserializes a std::map.
 
template<typename K , typename V , typename P , typename A >
void operator>>= (const SerializationInfo &si, std::multimap< K, V, P, A > &multimap)
 Deserializes a std::multimap.
 

Member Enumeration Documentation

enum Type
Enumerator
Void 

Void.

Context 

Contextual.

Reference 

Reference.

Boolean 

Boolean.

Char 

Char.

Str 

Str.

Int8 

8-bit integer

Int16 

16-bit integer

Int32 

32-bit integer

Int64 

64-bit integer

UInt8 

8-bit unsigned integer

UInt16 

16-bit unsigned integer

UInt32 

32-bit unsigned integer

UInt64 

64-bit unsigned integer

Float 

Floating point.

Double 

Double floating point.

LongDouble 

Long double floating point.

Binary 

Binary.

Struct 

Structural compound type.

Sequence 

Sequence compound type.

Dict 

Dictionary compound type.

DictElement 

Dictionary element.

Member Function Documentation

const SerializationInfo* findMember ( const std::string &  name) const

This method returns the data for a member with the name name. or null if it is not present.

const SerializationInfo* findMember ( const char *  name) const

This method returns the data for a member with the name name. or null if it is not present.

SerializationInfo* findMember ( const std::string &  name)

This method returns the data for a member with the name name. or null if it is not present.

SerializationInfo* findMember ( const char *  name)

This method returns the data for a member with the name name. or null if it is not present.

Friends And Related Function Documentation

void operator>>= ( const SerializationInfo si,
std::set< T, C, A > &  set 
)
related

Deserialization of references to or from set elements is not reliably possible, due to some of std::set's constraints. However you may overload this operator for your type.

void operator>>= ( const SerializationInfo si,
std::multiset< T, C, A > &  multiset 
)
related

Deserialization of references to or from set elements is not reliably possible, due to some of std::set's constraints. However you may overload this operator for your type.