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

#include <XMLIterableAdapter.hxx>

Inheritance diagram for CLAM::XMLIterableAdapter< T >:

CLAM::BasicXMLable CLAM::Component CLAM::XMLable CLAM::Storable

List of all members.


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 66 of file XMLIterableAdapter.hxx.


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.

Member Typedef Documentation

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

Definition at line 69 of file XMLIterableAdapter.hxx.

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

Definition at line 70 of file XMLIterableAdapter.hxx.

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

Definition at line 71 of file XMLIterableAdapter.hxx.

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

Definition at line 72 of file XMLIterableAdapter.hxx.

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

Definition at line 73 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 98 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 104 of file XMLIterableAdapter.hxx.

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

Definition at line 110 of file XMLIterableAdapter.hxx.


Member Function Documentation

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

Return the class name.

Implements CLAM::Component.

Definition at line 111 of file XMLIterableAdapter.hxx.

References CLAM_ASSERT.

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

Implements CLAM::BasicXMLable.

Definition at line 119 of file XMLIterableAdapter.hxx.

References NULL.

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

Implements CLAM::XMLable.

Definition at line 125 of file XMLIterableAdapter.hxx.

References NULL.

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 137 of file XMLIterableAdapter.hxx.

References NULL.

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 147 of file XMLIterableAdapter.hxx.

References NULL.

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 243 of file XMLIterableAdapter.hxx.

References CLAM::BasicXMLable::FulfilsInvariant().


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

Generated on Tue Aug 12 22:33:50 2008 for CLAM by  doxygen 1.5.5