eXperiment robotics framework

TinyXmlBinding.hpp File Reference

#include <vector>
#include <list>
#include <deque>
#include <boost/lexical_cast.hpp>
#include <tinyxml.h>
#include <Binding.hpp>

Include dependency graph for TinyXmlBinding.hpp:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  tpn

Classes

class  tpn::TinyXmlBinding< T, M >

Defines

#define CREATE_GENERIC_TOXMLELEMENT(type)
#define CREATE_GENERIC_TOXMLATTRIBUTE(type)
#define CREATE_GENERIC_FROMXMLELEMENT(type)
#define CREATE_GENERIC_FROMXMLATTRIBUTE(type)

Enumerations

enum  tpn::MemberType { tpn::Attribute, tpn::Element }

Functions

const TiXmlTexttpn::FirstChildText (const TiXmlNode &node)
template<typename T>
std::string tpn::ToString (T t)
template<>
std::string tpn::ToString< bool > (bool b)
template<>
std::string tpn::ToString< char > (char c)
template<>
std::string tpn::ToString< unsigned char > (unsigned char c)
template<typename T>
tpn::FromString (std::string str)
template<>
bool tpn::FromString< bool > (std::string str)
template<>
char tpn::FromString< char > (std::string str)
template<>
unsigned char tpn::FromString< unsigned char > (std::string str)
template<typename T>
void tpn::ToXml (TiXmlElement *element, T &t)
template<typename T>
void tpn::FromXml (const TiXmlElement *element, T &t)
template<typename T, typename M>
boost::shared_ptr< Binding< T > > tpn::TinyXmlBind (const std::string &name, M T::*offset, MemberType type=Element)
template<typename T, typename M>
boost::shared_ptr< Binding< T > > tpn::TinyXmlBind (const std::string &name, boost::function< M(T *)> getter, boost::function< void(T *, const M &)> setter, MemberType type=Element)
template<typename T>
void tpn::ToXmlElement (TiXmlElement *element, const std::string &name, T t)
template<typename T>
void tpn::ToXmlElement (TiXmlElement *element, const std::string &name, std::vector< T > vector)
template<typename T>
void tpn::ToXmlElement (TiXmlElement *element, const std::string &name, std::list< T > list)
template<typename T>
void tpn::ToXmlElement (TiXmlElement *element, const std::string &name, std::deque< T > deque)
 tpn::CREATE_GENERIC_TOXMLELEMENT (char)
 tpn::CREATE_GENERIC_TOXMLELEMENT (unsigned char)
 tpn::CREATE_GENERIC_TOXMLELEMENT (short)
 tpn::CREATE_GENERIC_TOXMLELEMENT (int)
 tpn::CREATE_GENERIC_TOXMLELEMENT (long)
 tpn::CREATE_GENERIC_TOXMLELEMENT (float)
 tpn::CREATE_GENERIC_TOXMLELEMENT (double)
 tpn::CREATE_GENERIC_TOXMLELEMENT (bool)
 tpn::CREATE_GENERIC_TOXMLELEMENT (std::string)
template<typename T>
void tpn::ToXmlAttribute (TiXmlElement *element, const std::string &name, T t)
 tpn::CREATE_GENERIC_TOXMLATTRIBUTE (char)
 tpn::CREATE_GENERIC_TOXMLATTRIBUTE (unsigned char)
 tpn::CREATE_GENERIC_TOXMLATTRIBUTE (short)
 tpn::CREATE_GENERIC_TOXMLATTRIBUTE (int)
 tpn::CREATE_GENERIC_TOXMLATTRIBUTE (long)
 tpn::CREATE_GENERIC_TOXMLATTRIBUTE (float)
 tpn::CREATE_GENERIC_TOXMLATTRIBUTE (double)
 tpn::CREATE_GENERIC_TOXMLATTRIBUTE (bool)
 tpn::CREATE_GENERIC_TOXMLATTRIBUTE (std::string)
template<typename T>
void tpn::FromXmlElement (const TiXmlElement *element, const std::string &name, T &t)
template<typename T>
void tpn::FromXmlElement (const TiXmlElement *element, const std::string &name, std::vector< T > &vector)
template<typename T>
void tpn::FromXmlElement (const TiXmlElement *element, const std::string &name, std::list< T > &list)
template<typename T>
void tpn::FromXmlElement (const TiXmlElement *element, const std::string &name, std::deque< T > &deque)
 tpn::CREATE_GENERIC_FROMXMLELEMENT (char)
 tpn::CREATE_GENERIC_FROMXMLELEMENT (unsigned char)
 tpn::CREATE_GENERIC_FROMXMLELEMENT (short)
 tpn::CREATE_GENERIC_FROMXMLELEMENT (int)
 tpn::CREATE_GENERIC_FROMXMLELEMENT (long)
 tpn::CREATE_GENERIC_FROMXMLELEMENT (float)
 tpn::CREATE_GENERIC_FROMXMLELEMENT (double)
 tpn::CREATE_GENERIC_FROMXMLELEMENT (bool)
 tpn::CREATE_GENERIC_FROMXMLELEMENT (std::string)
template<typename T>
void tpn::FromXmlAttribute (const TiXmlElement *element, const std::string &name, T &t)
 tpn::CREATE_GENERIC_FROMXMLATTRIBUTE (char)
 tpn::CREATE_GENERIC_FROMXMLATTRIBUTE (unsigned char)
 tpn::CREATE_GENERIC_FROMXMLATTRIBUTE (short)
 tpn::CREATE_GENERIC_FROMXMLATTRIBUTE (int)
 tpn::CREATE_GENERIC_FROMXMLATTRIBUTE (long)
 tpn::CREATE_GENERIC_FROMXMLATTRIBUTE (float)
 tpn::CREATE_GENERIC_FROMXMLATTRIBUTE (double)
 tpn::CREATE_GENERIC_FROMXMLATTRIBUTE (bool)
 tpn::CREATE_GENERIC_FROMXMLATTRIBUTE (std::string)


Define Documentation

#define CREATE_GENERIC_FROMXMLATTRIBUTE ( type   ) 

Value:

template <>                                                                                 \
inline void FromXmlAttribute<type>(const TiXmlElement *element, const std::string &name, type &t)   \
{                                                                                           \
    const std::string *attribute = element->Attribute(name);                                \
    if(attribute != NULL)                                                                   \
    {                                                                                       \
        t = FromString<type>(*attribute);                                                   \
    }                                                                                       \
}

Definition at line 341 of file TinyXmlBinding.hpp.

#define CREATE_GENERIC_FROMXMLELEMENT ( type   ) 

Value:

template <>                                                                                 \
inline void FromXmlElement<type>(const TiXmlElement *element, const std::string &name, type &t) \
{                                                                                           \
    const TiXmlText *text = FirstChildText(*element);                                               \
    if(text != NULL)                                                                        \
    {                                                                                       \
        t = FromString<type>(text->Value());                                                \
    }                                                                                       \
}

Definition at line 312 of file TinyXmlBinding.hpp.

#define CREATE_GENERIC_TOXMLATTRIBUTE ( type   ) 

Value:

template <>                                                                                 \
inline void ToXmlAttribute<type>(TiXmlElement *element, const std::string &name, type t)    \
{                                                                                           \
    element->SetAttribute(name, ToString(t));                                               \
}

Definition at line 262 of file TinyXmlBinding.hpp.

#define CREATE_GENERIC_TOXMLELEMENT ( type   ) 

Value:

template <>                                                                             \
inline void ToXmlElement<type>(TiXmlElement *element, const std::string &name, type t)  \
{                                                                                       \
    TiXmlNode *node = element->InsertEndChild(TiXmlElement(name));                      \
    if(node != NULL)                                                                    \
    {                                                                                   \
        node->InsertEndChild(TiXmlText(ToString(t)));                                   \
    }                                                                                   \
}

Definition at line 233 of file TinyXmlBinding.hpp.


The miarn project - written by Joao Xavier