Creation of the serialiazable class

All classes which will be serialized must be derived from xsSerializable base class. Those data members of the serializable class which should be serialized will be encapsulated by the xsProperty class.

The xsProperty class instances can be created in several ways:

The argument called member means the data member which should be serialized and field means the name of this member in the output XML structure. Macros with te suffix _EX allow user to define default property value. The property will be serialized only if the current value is different then default.

Now follows a simple example of implemenation a serializable class:

class SerializableObject : public xsSerializable
{
    // RTTI must be provided
    DECLARE_DYNAMIC_CLASS(SerializableObject);
	
    // declaration of the data members
    wxString wxStringProperty;
    wxPoint wxPointProperty;
    int IntegerProperty;	
	
    //SerializableObject() {};
    SerializableObject()
    {
        // initialization of the data members
        wxStringProperty = wxString::Format(wxT("Object No. %d encapsulates wxString,
            wxPoint and Integer data members"), ++constant);
        wxPointProperty = wxPoint::wxPoint(constant, 2*constant);
        IntegerProperty = constant*constant;		
		
        // mark the data members which should be serialized
        XS_SERIALIZE( wxStringProperty, wxT("wxStringProperty") );
        XS_SERIALIZE( wxPointProperty, wxT("wxPointProperty") );
        XS_SERIALIZE_INT( IntegerProperty, wxT("IntegerProperty") );
    }
    virtual ~SerializableObject() {;}
	
private:
    static int constant;	
};

int SerializableObject::constant = 0;