Hi! Thank very much for the help I am study the lib implementation, and trying to extend xml_oarchive (as you suggest)... Bye
I don't know that I can offer you a good solution. But here is what I can come up with.
First a couple of relevant facts about the serialization library.
a) generally it saves in the archive only that information absolutely required to be able to recover the data. This is basad on design/efficiency considerations.
b) In some cases it stores "optional" information. That it is, the archive may be written to save and recover this information. Normally these are just stubbed out as no ops.
c) In xml archives, information about object and class id and their references is included in the xml. I'm don't remember whether its done in the "optional" types or not.
c) class name was not considered as one of these optional types i) it wasn't deemed necessary ii) it is not always available. Many types (e.g. primitives) are serialized without calling the library code. For these cases the "optional" data is not called.
So back to your situation.
What is really needed for you is the following:
a) some sort reflection for C++ so that you can write something like t.name(). b) derive from xml_oarchive to invoke t.name() and insert it into the xml stream output. Examples of deriving from one archive type to produce another are in the documentation.
So the problem is "reduced" to making/finding something like t.name() which returns a text string which can be inserted into the output stream.
This already exists on one form - the RTTI implementation uses type_id(t).name to return a pointer to a name. This may be sufficient for your needs. The only problem with it is that
a) the name will be mangled to a unique C++ name. This may not always be user friendly. b) the name will be mangled differently for each compiler.
If you can work with the above limitations - perhaps by massaging the mangled name to something readable - this can probably be made to work for you.
If not - you can use the name passed by BOOST_CLASS_EXPORT which was "invented" to address the issues above. The only problem is that BOOST_CLASS_EXPORT might not bedefined for all your types.
You should have enough here to craft a solution to your problem.
Good Luck
Robert Ramey
Ce message ?lectronique et tous les fichiers attach?s sont confidentiels et destin?s exclusivement ? l'usage de la personne ? laquelle ils sont adress?s. Si vous n'?tes pas le destinataire de ce message, merci d'avertir ou de le retourner ? son ?metteur et d?truire ce message ?lectronique et tous les fichiers attach?s de votre syst?me informatique. La publication, l'usage, la distribution, l'impression ou la copie non autoris?e de ce message et des attachements qu'il contient sont strictement interdits. This e-mail and any attachment are confidential and intended solely for the use of the individual to whom it is addressed. If you are not the intended recipient, please telephone or email the sender and delete this message and any attachment from your system. Unauthorized publication, use, dissemination, forwarding, printing or copying of this e-mail and its associated attachments is strictly prohibited. Este correo electr?nico y todos los ficheros adjuntos son confidenciales y destinados exclusivamente al uso de la persona a la cual han sido remitidos. Si Usted no es el destinatario del mensaje, agradecemos advierta al remitente y elimine el mensaje y sus adjuntos de su sistema. La publicaci?n, distribuci?n, impresi?n o copia no autorizada de este mensaje y de sus adjuntos queda estrictamente prohibida.