CompoundUserInfo< T > Class Template Reference

The main userinfo template class. You should derive this class whenever you need a new userinfo of a class which is compound from smaller elements (all having its own userinfo class prepared). More...

#include <userinfo.h>

Inheritance diagram for CompoundUserInfo< T >:

Inheritance graph
[legend]
Collaboration diagram for CompoundUserInfo< T >:

Collaboration graph
[legend]

List of all members.

Static Public Member Functions

template<class T>
static T * Assembly (DOMElement &element, const string tagName)
template<class T>
static bool Disassembly (T &instance, DOMElement &element, const string tagName, const string help)
template<class T>
static bool Disassembly (T &instance, DOMElement &element, const string tagName)

Protected Member Functions

 CompoundUserInfo (string userFriendlyTypeName)
string XMLCh2str (const XMLCh *const XMLCh_str)
 function which transcodes Xerces' XMLCh-based strings into C++ strings
string removeSpaces (const string &str)

Static Protected Attributes

static const TypedUserInfo< T > & instance

Classes

class  BindedElement
 Templated class binding inner element with its XML tag and automating data transfers in both directions. More...


Detailed Description

template<typename T>
class CompoundUserInfo< T >

The main userinfo template class. You should derive this class whenever you need a new userinfo of a class which is compound from smaller elements (all having its own userinfo class prepared).

To bind some inner element to its own userinfo class, and also to automate its assembling and disassembling, it is necessary to create a instance of an inner templated class BindedElement<T>. Those attributes have to be initialized in constructor of a new compound userinfo this way:

class BikeUI: public CompoundUserInfo<Bike>
{
private:
        BindedElement<int> year; 
        BindedElement<bool> lights; 
        BindedElement<string> manufacturer; 
public:
        BikeUI()
                :CompoundUserInfo<Bike>("bike"),
                year( this, "year", 0 ),
                lights( this, "electric lights", false ), 
                manufacturer( this, "manufacturer", "unknown")
        {
        }

        ...
}

Member Function Documentation

template<class T>
static T* UserInfo::Assembly ( DOMElement &  element,
const string  tagName 
) [inline, static, inherited]

This methods tries to assembly a new instance of type T (or some of its descendant types) according to a data stored in a DOMNode named tagName within a child nodes of the passed element. If an error occurs, it returns a NULL pointer.

References Attribute::Get(), and Attribute::type.

template<class T>
static bool UserInfo::Disassembly ( T &  instance,
DOMElement &  element,
const string  tagName,
const string  help 
) [inline, static, inherited]

This methods tries to disassembly an instance of type T (or some of its descendant types) and build DOM tree accordingly. Then, it creates a new DOMNode named according tagName and connecti it to the passed DOMElement as a new child node (with a help attribute filled).

References Attribute::help, Attribute::Set(), and Attribute::type.

Referenced by UserInfo::Disassembly(), and CompoundUserInfo< T >::BindedElement< U >::DisassemblyComponentsToXML().

template<class T>
static bool UserInfo::Disassembly ( T &  instance,
DOMElement &  element,
const string  tagName 
) [inline, static, inherited]

This methods tries to disassembly an instance of type T (or some of its descendant types) and build DOM tree accordingly. Then, it creates a new DOMNode named according tagName and connecti it to the passed DOMElement as a new child node.

References UserInfo::Disassembly().


Member Data Documentation

template<typename T>
const TypedUserInfo<T>& TypedUserInfo< T >::instance [static, protected, inherited]

the only instance of this class (each type T has its own instance) which is used as a factory for processing related userinfos


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

Generated on Thu Jan 15 10:50:51 2009 for mixpp by  doxygen 1.5.6