Robert Ramey wrote:
Your idea of what an XML archive should look like is quite different than the one I implemented. So I don't think you would want to derive from xml_[i/o]archive. Take basic_xml_oarchive<Archive> as a starting point and make your own version.
Note that my version was very much focused on permitting xml archives of arbitrary size without having to load the whole xml tree. I would hope that its possible to implement your own with the facilities that the library includes for creating archives. Of course no one can know until you try.
I try. But up to the moment i'm quite confused :)
maybe a first question: why don't i get a classname for each serialized object in common_oarchive::save_override(const class_name_type & t, int)? sometimes i get a class_id, sometimes a class_reference_id and so on. classnames are offered rarely.
In general, archives include only that which is necessary for de-serialization.
There is a type "class_name_optional" which is serialized with the class name for every type. The default implementation is to ignore it - and none of the included archives override the default.
Where is this type defined and which method do i have to override?
class_id etc are only applicable to classes - not primitives. They might not be available for all types - depending on the implementation level - I would have to investigate that.
All classes i use are exported by BOOST_CLASS_EXPORT_GUID. Is there a chance
to fetch the classname for a given class_id, class_id_reference or
class_id_optional on the level of archive derivation?
Until now I've derived three classes from boost::archive:
class my_basic_xml_oarchive : public detail::common_oarchive<Archive>
class my_xml_oarchive_impl : public basic_text_oprimitivestd::ostream,
public my_basic_xml_oarchive<Archive>
class my_xml_oarchive : public my_xml_oarchive_impl