cxxtools::xml::XmlDeserializer Class Reference

Deserialize objects or object data to XML. More...

#include <cxxtools/xml/xmldeserializer.h>

Inheritance diagram for cxxtools::xml::XmlDeserializer:
cxxtools::Deserializer

Public Member Functions

 XmlDeserializer (bool readAttributes=false, const String &attributePrefix=cxxtools::String())
 Initializes a deserializer.
 XmlDeserializer (XmlReader &reader, bool readAttributes=false, const String &attributePrefix=cxxtools::String())
 Initializes a deserializer and reads a xml structure into the underlying SerializationInfo.
 XmlDeserializer (std::istream &is, bool readAttributes=false, const String &attributePrefix=cxxtools::String())
 Initializes a deserializer and reads a xml structure into the underlying SerializationInfo.
void parse (XmlReader &reader)
 Reads a xml structure into the underlying SerializationInfo.
void parse (std::istream &is)
 Reads a xml structure into the underlying SerializationInfo.
void parse (std::basic_istream< Char > &is)
 Reads a xml structure into the underlying SerializationInfo.
void readAttributes (bool readAttributes)
 Specifies whether xml attributes should be read into members.
bool readAttributes () const
 Returns true, when the readAttribute flag is set.
void attributePrefix (const String &attributePrefix)
 When reading attributes, the member names can be prefixed with a string.
const StringattributePrefix () const
 When reading attributes, the member names can be prefixed with a string.
- Public Member Functions inherited from cxxtools::Deserializer
 Deserializer ()
virtual ~Deserializer ()
template<typename T >
void deserialize (T &type) const
 Deserialize an object.
template<typename T >
void deserialize (T &type, const std::string &name) const
SerializationInfosi ()
const SerializationInfosi () const
void begin ()
void clear ()
SerializationInfocurrent ()
const SerializationInfocurrent () const
void setCategory (SerializationInfo::Category category)
void setName (const std::string &name)
void setTypeName (const std::string &type)
void setValue (const String &value)
void setValue (const std::string &value)
void setValue (const char *value)
void setValue (bool value)
void setValue (int_type value)
void setValue (unsigned_type value)
void setValue (long double value)
void setNull ()
void beginMember (const std::string &name, const std::string &type, SerializationInfo::Category category)
void leaveMember ()

Static Public Member Functions

template<typename T >
static void toObject (const std::string &str, T &type, bool readAttributes=false)
template<typename T >
static void toObject (XmlReader &in, T &type, bool readAttributes=false)
template<typename T >
static void toObject (std::istream &in, T &type, bool readAttributes=false)

Additional Inherited Members

- Public Types inherited from cxxtools::Deserializer
typedef long int_type
typedef unsigned long unsigned_type

Detailed Description

Deserialize objects or object data to XML.

Thic class performs XML deserialization of a single object or object data.

Constructor & Destructor Documentation

cxxtools::xml::XmlDeserializer::XmlDeserializer ( bool  readAttributes = false,
const String attributePrefix = cxxtools::String() 
)
inlineexplicit

Initializes a deserializer.

To read a xml structure, the parse method has to be called.

cxxtools::xml::XmlDeserializer::XmlDeserializer ( XmlReader reader,
bool  readAttributes = false,
const String attributePrefix = cxxtools::String() 
)
explicit

Initializes a deserializer and reads a xml structure into the underlying SerializationInfo.

cxxtools::xml::XmlDeserializer::XmlDeserializer ( std::istream &  is,
bool  readAttributes = false,
const String attributePrefix = cxxtools::String() 
)
explicit

Initializes a deserializer and reads a xml structure into the underlying SerializationInfo.

Member Function Documentation

void cxxtools::xml::XmlDeserializer::attributePrefix ( const String attributePrefix)
inline

When reading attributes, the member names can be prefixed with a string.

The string is set with this method.

const String& cxxtools::xml::XmlDeserializer::attributePrefix ( ) const
inline

When reading attributes, the member names can be prefixed with a string.

The currently set string is returned with this method.

void cxxtools::xml::XmlDeserializer::parse ( XmlReader reader)

Reads a xml structure into the underlying SerializationInfo.

void cxxtools::xml::XmlDeserializer::parse ( std::istream &  is)

Reads a xml structure into the underlying SerializationInfo.

void cxxtools::xml::XmlDeserializer::parse ( std::basic_istream< Char > &  is)

Reads a xml structure into the underlying SerializationInfo.

void cxxtools::xml::XmlDeserializer::readAttributes ( bool  readAttributes)
inline

Specifies whether xml attributes should be read into members.

By default attributes are ignored. When the flag is set, attributes are added as scalar members.

bool cxxtools::xml::XmlDeserializer::readAttributes ( ) const
inline

Returns true, when the readAttribute flag is set.

template<typename T >
static void cxxtools::xml::XmlDeserializer::toObject ( const std::string &  str,
T &  type,
bool  readAttributes = false 
)
inlinestatic
template<typename T >
static void cxxtools::xml::XmlDeserializer::toObject ( XmlReader in,
T &  type,
bool  readAttributes = false 
)
inlinestatic
template<typename T >
static void cxxtools::xml::XmlDeserializer::toObject ( std::istream &  in,
T &  type,
bool  readAttributes = false 
)
inlinestatic

The documentation for this class was generated from the following file: