Opened 8 years ago

Closed 7 years ago

#10854 closed Support Requests (wontfix)

How to add "class_name" tag into the serialized xml archive?

Reported by: power_devil@… Owned by: Robert Ramey
Milestone: To Be Determined Component: serialization
Version: Boost 1.57.0 Severity: Not Applicable
Keywords: serialization class_name Cc:

Description

here's my xml archive created by boost.serialization:

<s class_id="0" tracking_level="1" version="2" object_id="_0">

i need to add a "class_name" tag like this:

<s class_id="0" class_name="bus_schedule" tracking_level="1" version="2" object_id="_0">

please tell me how modify my code, thanks very much!

Attachments (2)

Serialization.rar (1.1 KB ) - added by power_devil@… 8 years ago.
demo_save.xml (1.3 KB ) - added by power_devil@… 8 years ago.

Download all attachments as: .zip

Change History (4)

by power_devil@…, 8 years ago

Attachment: Serialization.rar added

by power_devil@…, 8 years ago

Attachment: demo_save.xml added

in reply to:  description comment:1 by power_devil@…, 8 years ago

Replying to power_devil@…:

here's my xml archive created by boost.serialization:

<s class_id="0" tracking_level="1" version="2" object_id="_0">

i need to add a "class_name" tag like this:

<s class_id="0" class_name="bus_schedule" tracking_level="1" version="2" object_id="_0">

please tell me how modify my code, thanks very much!

bus_schedule is a user-defined class in serialization.cpp.

comment:2 by Robert Ramey, 7 years ago

Resolution: wontfix
Status: newclosed

I don't see an obvious way to get what you want here.

This would be definitely doable, but you'd have to invest some more effort than you might want to. The short version of ow to do this is to create your own version of xml_oarchive and maybe xml_iarchive. These might be just extensions of the current ones created by derivation:

class my_xml_oarchive : public xml_archive_impl {
   // overridden functions
};

It's not a lot of work to do, but doing so would require pretty good understanding of the implementation of the serialization library. I can't know how much time that would take.

Note: See TracTickets for help on using tickets.