Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2008-05-15 16:44:12


There's some confusion here, the name in name value pair is used for the
name data - not the typename.

In any case, you might try deriving from xml_oachive and re-implement the
following function:

typedef detail::common_oarchive<Archive> detail_common_oarchive;
template<class T>
void save_override(
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
const
#endif
::boost::serialization::nvp<my_type> & t,
int
){
save_start(t.name()); // t.name includes "item" replace with whatever you
choose like "my_type" + t.name

this->detail_common_oarchive::save_override(t.const_value(), 0);
save_end(t.name());

Of course this would likely have all manner of undesired side-effects - like
changing ALL the tags for this type - not just "item". And of course it
would only work for my_type, etc.,etc.

Robert Ramey

Chris Weed wrote:
> Hi,
> I am interested in using the xml serialization code for std::vector,
> but currently it is hard-coded to name items, "item".
> Is this customizable by overloading/specializing make_nvp for my type
> to replace "item" with a type-specific name?
> I tried the following code which didn't accomplish this.
> Chris
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk