CLAM-Development  1.4.0
Public Types | Public Member Functions
CLAM::XMLAdapter< T > Class Template Reference

This class adapts to the XMLable interface any basic object. More...

#include <XMLAdapter.hxx>

List of all members.

Public Types

typedef BasicXMLable super
typedef T t_adaptee

Public Member Functions

 XMLAdapter (t_adaptee &anAdaptee, const char *name=NULL, bool isXMLElement=false)
 Constructs a XMLAdapter.
 XMLAdapter (const t_adaptee &anAdaptee, const char *name=NULL, bool isXMLElement=false)
virtual ~XMLAdapter ()
std::string XMLContent () const
bool XMLContent (std::istream &str)
bool FulfilsInvariant ()
- Public Member Functions inherited from CLAM::BasicXMLable
 BasicXMLable (const char *name=0, bool isXMLElement=false)
 Constructs a BasicXMLable.
virtual ~BasicXMLable ()
const char * XMLName () const
bool IsXMLElement () const
bool IsXMLAttribute () const
bool IsXMLText () const
- Public Member Functions inherited from CLAM::XMLable
virtual ~XMLable ()
- Public Member Functions inherited from CLAM::Storable
virtual ~Storable ()

Detailed Description

template<class T>
class CLAM::XMLAdapter< T >

This class adapts to the XMLable interface any basic object.

A basic object is that one that has the insertion (<<) and extractor (>>) operators defined to streams and there exists a TypeInfo struct for it (see CLAM_TYPE_INFO_GROUP). The adapter uses such operators to calculate the XML content on writing and reconstruct the object on reading.

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 also:
BasicXMLable
XMLable

Definition at line 57 of file XMLAdapter.hxx.


Member Typedef Documentation

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

Definition at line 60 of file XMLAdapter.hxx.

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

Definition at line 61 of file XMLAdapter.hxx.


Constructor & Destructor Documentation

template<class T>
CLAM::XMLAdapter< T >::XMLAdapter ( t_adaptee anAdaptee,
const char *  name = NULL,
bool  isXMLElement = false 
)
inline

Constructs a XMLAdapter.

Parameters:
anAdapteeThe object to be adapted (where the XML content will be extracted from)
nameA 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:
isXMLElementTells whether the object is an element or an attribute when the name is defined.

Definition at line 82 of file XMLAdapter.hxx.

template<class T>
CLAM::XMLAdapter< T >::XMLAdapter ( const t_adaptee anAdaptee,
const char *  name = NULL,
bool  isXMLElement = false 
)
inline

Definition at line 86 of file XMLAdapter.hxx.

template<class T>
virtual CLAM::XMLAdapter< T >::~XMLAdapter ( )
inlinevirtual

Definition at line 90 of file XMLAdapter.hxx.


Member Function Documentation

template<class T>
bool CLAM::XMLAdapter< T >::FulfilsInvariant ( )
inline

Reimplemented from CLAM::BasicXMLable.

Definition at line 114 of file XMLAdapter.hxx.

References CLAM::BasicXMLable::FulfilsInvariant().

template<class T>
std::string CLAM::XMLAdapter< T >::XMLContent ( ) const
inlinevirtual

Implements CLAM::BasicXMLable.

Definition at line 97 of file XMLAdapter.hxx.

template<class T>
bool CLAM::XMLAdapter< T >::XMLContent ( std::istream &  str)
inlinevirtual

Implements CLAM::XMLable.

Definition at line 106 of file XMLAdapter.hxx.

References NULL.


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