CLAM::XMLIterableAdapter< T > Class Template Reference
[Using XML Adapters to implement StoreOn and LoadFrom]

This class adapts to the XMLable interface any STL like container of basic objects or CLAM::Component's. More...

#include <XMLIterableAdapter.hxx>

List of all members.

Public Types

typedef BasicXMLable super
typedef T t_adaptee
typedef t_adaptee::value_type t_adapteeValues
typedef t_adaptee::iterator t_adapteeIterator
typedef TypeInfo
< t_adapteeValues >
::StorableAsLeaf 
BasicIsStorableAsLeaf

Public Member Functions

 XMLIterableAdapter (T &anAdaptee, const char *elementName, const char *name=NULL, bool isXMLElement=false)
 Constructs a XMLIterableAdapter.
 XMLIterableAdapter (const T &anAdaptee, const char *elementName, const char *name=NULL, bool isXMLElement=false)
virtual ~XMLIterableAdapter ()
const char * GetClassName () const
 Return the class name.
std::string XMLContent () const
bool XMLContent (std::istream &str)
virtual void StoreOn (Storage &store) const
 Stores subitems on the given Storage.
virtual void LoadFrom (Storage &store)
 Loads component's subitems from the given Storage.
bool FulfilsInvariant ()
 Check the internal status for a class instance is valid.

Detailed Description

template<class T>
class CLAM::XMLIterableAdapter< T >

This class adapts to the XMLable interface any STL like container of basic objects or CLAM::Component's.

It supports both kind of subitems: Components and Basic Types. Depending on the kind of subitem it calculates the XML content with such extraction operator operator when subitems are basic objects or it stores recursivelly when they are components. The content is the same one which the insertion operator generates inserting an space between elements.

During the construction, the adapter stores a reference to the adaptee. The content string extracted on demand when the adapter is stored on a XMLStorage, so the adapter is sensitive to the adaptee changes after the construction.

Important: At storage time, the adaptee must exist in order to follow the reference.

Pay attention to the management of the name memory (see CLAM::BasicXMLable).

See also:
XMLable
XMLAdapter
XMLComponentAdapter

Definition at line 60 of file XMLIterableAdapter.hxx.


Member Typedef Documentation

template<class T>
typedef TypeInfo<t_adapteeValues>::StorableAsLeaf CLAM::XMLIterableAdapter< T >::BasicIsStorableAsLeaf

Definition at line 38 of file XMLIterableAdapter.hxx.

template<class T>
typedef BasicXMLable CLAM::XMLIterableAdapter< T >::super

Definition at line 34 of file XMLIterableAdapter.hxx.

template<class T>
typedef T CLAM::XMLIterableAdapter< T >::t_adaptee

Definition at line 35 of file XMLIterableAdapter.hxx.

template<class T>
typedef t_adaptee::iterator CLAM::XMLIterableAdapter< T >::t_adapteeIterator

Definition at line 37 of file XMLIterableAdapter.hxx.

template<class T>
typedef t_adaptee::value_type CLAM::XMLIterableAdapter< T >::t_adapteeValues

Definition at line 36 of file XMLIterableAdapter.hxx.


Constructor & Destructor Documentation

template<class T>
CLAM::XMLIterableAdapter< T >::XMLIterableAdapter ( T &  anAdaptee,
const char *  elementName,
const char *  name = NULL,
bool  isXMLElement = false 
) [inline]

Constructs a XMLIterableAdapter.

Parameters:
anAdaptee The object to be adapted (where the XML content will be extracted from)
elementName The XML tag that will be open for every element on the iterable. Only apliable when elements are not basics.
name A pointer to a 0 terminated string containing the xml name (for elements and attributes) or 0 (the default) if the element is neither an element nor an attribute (
See also:
BasicXMLable for important details about memory managing). Because no internal copy of the string is done, the 0 terminated string pointed by name must exist during the BasicXMLable life as is directly used.
Parameters:
isXMLElement Tells whether the object is an element or an attribute when the name is defined.

Definition at line 63 of file XMLIterableAdapter.hxx.

template<class T>
CLAM::XMLIterableAdapter< T >::XMLIterableAdapter ( const T &  anAdaptee,
const char *  elementName,
const char *  name = NULL,
bool  isXMLElement = false 
) [inline]

Definition at line 69 of file XMLIterableAdapter.hxx.

template<class T>
virtual CLAM::XMLIterableAdapter< T >::~XMLIterableAdapter (  )  [inline, virtual]

Definition at line 75 of file XMLIterableAdapter.hxx.


Member Function Documentation

template<class T >
bool CLAM::XMLIterableAdapter< T >::FulfilsInvariant (  )  [inline]

Check the internal status for a class instance is valid.

Reimplemented from CLAM::BasicXMLable.

Definition at line 237 of file XMLIterableAdapter.hxx.

template<class T>
const char* CLAM::XMLIterableAdapter< T >::GetClassName (  )  const [inline, virtual]

Return the class name.

Implements CLAM::Component.

Definition at line 76 of file XMLIterableAdapter.hxx.

template<class T>
virtual void CLAM::XMLIterableAdapter< T >::LoadFrom ( Storage store  )  [inline, virtual]

Loads component's subitems from the given Storage.

Parameters:
store The given storage where the subitem will be loaded from
Todo:
Not yet implemented
See also:
Storage

Implements CLAM::Component.

Definition at line 112 of file XMLIterableAdapter.hxx.

template<class T>
virtual void CLAM::XMLIterableAdapter< T >::StoreOn ( Storage store  )  const [inline, virtual]

Stores subitems on the given Storage.

Parameters:
store The given storage where the subitem will be stored
See also:
Storage

Implements CLAM::Component.

Definition at line 102 of file XMLIterableAdapter.hxx.

template<class T>
bool CLAM::XMLIterableAdapter< T >::XMLContent ( std::istream &  str  )  [inline, virtual]

Implements CLAM::XMLable.

Definition at line 90 of file XMLIterableAdapter.hxx.

template<class T>
std::string CLAM::XMLIterableAdapter< T >::XMLContent (  )  const [inline, virtual]

Implements CLAM::BasicXMLable.

Definition at line 84 of file XMLIterableAdapter.hxx.


The documentation for this class was generated from the following file:
Generated by  doxygen 1.6.3