cxxtools::xml::XmlOObject< ObjectType > Class Template Reference

Wrapper object to easily print serializable objects as xml to a output stream. More...

#include <cxxtools/xml/xml.h>

Public Member Functions

 XmlOObject (const ObjectType &object, const std::string &name)
 Constructor.
XmlOObjectbeautify (bool sw)
bool beautify () const
XmlOObjectuseAttributes (bool sw)
bool useAttributes () const
const ObjectType & object () const
const std::string & name () const

Detailed Description

template<typename ObjectType>
class cxxtools::xml::XmlOObject< ObjectType >

Wrapper object to easily print serializable objects as xml to a output stream.

XmlOObject is a little wrapper which makes it easy to output serializable objects into a ostream. For this the XmlOObject expects a reference to the wrapped object and has a output operator for a std::ostream, or actually a std::basic_ostream, which prints the object in xml format.

Example:

std::vector<unsigned> v;
v.push_back(4);
v.push_back(17);
v.push_back(12);
std::cout << cxxtools::xml::Xml(v, "rootnode") << std::endl;

Constructor & Destructor Documentation

template<typename ObjectType>
cxxtools::xml::XmlOObject< ObjectType >::XmlOObject ( const ObjectType &  object,
const std::string &  name 
)
inline

Constructor.

Needs the wrapped object. Optionally a flag can be passed whether the xml should be nicely formatted.

Member Function Documentation

template<typename ObjectType>
XmlOObject& cxxtools::xml::XmlOObject< ObjectType >::beautify ( bool  sw)
inline
template<typename ObjectType>
bool cxxtools::xml::XmlOObject< ObjectType >::beautify ( ) const
inline
template<typename ObjectType>
const std::string& cxxtools::xml::XmlOObject< ObjectType >::name ( ) const
inline
template<typename ObjectType>
const ObjectType& cxxtools::xml::XmlOObject< ObjectType >::object ( ) const
inline
template<typename ObjectType>
XmlOObject& cxxtools::xml::XmlOObject< ObjectType >::useAttributes ( bool  sw)
inline
template<typename ObjectType>
bool cxxtools::xml::XmlOObject< ObjectType >::useAttributes ( ) const
inline

The documentation for this class was generated from the following file:
  • include/cxxtools/xml/xml.h