Using XML Adapters to implement StoreOn and LoadFrom
[Customizing the XML format for your object]

How to use XmlAdapters to implement Load and Store methods for a CLAM::Component. More...

Classes

class  CLAM::XMLAdapter< T >
 This class adapts to the XMLable interface any basic object. More...
class  CLAM::XMLArrayAdapter< T >
 This class adapts to the XMLable interface any array of basic objects. More...
class  CLAM::XMLComponentAdapter
 This class adapts to the XMLable interface any object that is a CLAM::Component. More...
class  CLAM::XMLIterableAdapter< T >
 This class adapts to the XMLable interface any STL like container of basic objects or CLAM::Component's. More...

Detailed Description

How to use XmlAdapters to implement Load and Store methods for a CLAM::Component.

Author:
David Garcia.

When you are implementing StoreOn and LoadFrom for a given Component, you should choose one of those adapters to wrap the subitems to be stored on, or loaded from, the XmlStorage.

When you create an adapter, the adaptee is specified by the the first constructor parameters, so they are adapter dependant. The later two constructor parameters are always to indicate in which XML form the subitem will be stored or loaded.

        MyAdapterClass( // Here goes the adaptee info 
                , const char * name = NULL, bool beElement = false );

You can use them in the following form:

 void StoreOn(CLAM::Storage & storage) const
 {
        SelectedAdapter adapter(subitem, "ElementName", true);
        storage.Store(adapter);
 }
 void LoadFrom(CLAM::Storage & storage)
 {
        SelectedAdapter adapter(subitem, "ElementName", true);
        if (!storage.Load(adapter))
        {
                // error handling
        }
 }
Warning:
The adapter only copies the pointer to the the null-terminated string, not a copy of it. So it is dangerous to delete or modify this string until the adapter has been stored on the Storage.

For more information see the documentation for any concrete adapter class.

Author:
David Garcia.
Generated by  doxygen 1.6.3