This class adapts to the XMLable interface any object that is a CLAM::Component. More...
#include <XMLComponentAdapter.hxx>
Public Types | |
typedef BasicXMLable | super |
Public Member Functions | |
template<class T > | |
XMLComponentAdapter (const T &adaptee, const char *name=NULL, bool isXMLElement=false) | |
Constructs a XMLComponentAdapter. | |
virtual | ~XMLComponentAdapter () |
virtual std::string | XMLContent () const |
virtual bool | XMLContent (std::istream &str) |
const char * | GetClassName () const |
Return the class name. | |
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 () |
This class adapts to the XMLable interface any object that is a CLAM::Component.
The XMLComponent adapter implements both the XMLable and the Component interface. So, implements the retrieval of XML properties (naming, being Element, Atribute or Simple content...) and implements the StoreOn function that is called by the XMLStorage to allow the component store its subitems. The StoreOn is implemented in XMLComponentAdapter simply by forwarding the call to de Adaptee.
You should use XMLComponentAdapter when:
Note: Simple content, (XMLable::XMLContent() implementation) returns an empty string.
Pay attention to the management of the name memory (see CLAM::BasicXMLable).
Definition at line 62 of file XMLComponentAdapter.hxx.
Definition at line 65 of file XMLComponentAdapter.hxx.
CLAM::XMLComponentAdapter::XMLComponentAdapter | ( | const T & | adaptee, | |
const char * | name = NULL , |
|||
bool | isXMLElement = false | |||
) | [inline] |
Constructs a XMLComponentAdapter.
Note: You cannot use this adapter as attribute because the content adapter does not know how to extract the XML content. Alternatives: Implement << and >> and adapt it with a simple XMLAdapter.
adaptee | The Component to be adapted (where subitem will be located) | |
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 ( |
isXMLElement | Tells whether the object is an element or an attribute when the name is defined. If a name is given, this must be true because a component adapter cannot adapt as attribute. |
Definition at line 92 of file XMLComponentAdapter.hxx.
References CLAM_ASSERT.
virtual CLAM::XMLComponentAdapter::~XMLComponentAdapter | ( | ) | [inline, virtual] |
Definition at line 97 of file XMLComponentAdapter.hxx.
bool CLAM::XMLComponentAdapter::FulfilsInvariant | ( | ) |
Reimplemented from CLAM::BasicXMLable.
Definition at line 26 of file XMLComponentAdapter.cxx.
References CLAM::BasicXMLable::FulfilsInvariant().
const char* CLAM::XMLComponentAdapter::GetClassName | ( | ) | const [inline, virtual] |
Return the class name.
Implements CLAM::Component.
Definition at line 114 of file XMLComponentAdapter.hxx.
virtual void CLAM::XMLComponentAdapter::LoadFrom | ( | Storage & | store | ) | [inline, virtual] |
Loads component's subitems from the given Storage.
store | The given storage where the subitem will be loaded from |
Implements CLAM::Component.
Definition at line 131 of file XMLComponentAdapter.hxx.
References CLAM::Component::LoadFrom().
virtual void CLAM::XMLComponentAdapter::StoreOn | ( | Storage & | store | ) | const [inline, virtual] |
Stores subitems on the given Storage.
store | The given storage where the subitem will be stored |
Implements CLAM::Component.
Definition at line 123 of file XMLComponentAdapter.hxx.
References CLAM::Component::StoreOn().
virtual bool CLAM::XMLComponentAdapter::XMLContent | ( | std::istream & | str | ) | [inline, virtual] |
Implements CLAM::XMLable.
Definition at line 108 of file XMLComponentAdapter.hxx.
virtual std::string CLAM::XMLComponentAdapter::XMLContent | ( | ) | const [inline, virtual] |
Implements CLAM::BasicXMLable.
Definition at line 102 of file XMLComponentAdapter.hxx.