Boost logo

Boost Users :

Subject: Re: [Boost-users] Optional XML serialization
From: Paul (elegant_dice_at_[hidden])
Date: 2010-02-23 03:50:01


On 23 February 2010 16:23, Rutger ter Borg <rutger_at_[hidden]> wrote:
> Paul wrote:
>
>> I use xml_woarchive and xml_wiarchive for reading/writing configuration
>> files.
>
> I'd recommend to use Boost.PropertyTree for this, not serialization.
>
> Cheers,
>
> Rutger

I had a look at Boost.PropertyTree, but I find the
boost::serialization way of recursing through is more convenient.

For example, in the docs you have:
   BOOST_FOREACH(const std::string &name, m_modules)
      pt.put("debug.modules.module", name, true);

and
boost::optional<float> v = pt.get_optional<float>("a.path.to.float.value");

But if my configuration is a tree of arbitrary depth then I'm going to
need to implement my own recursion, right?
Ditto for custom data types, or arrays of classes with more classes
inside or doubles, or optional<double> etc etc.

And how do you handle versioning? This is a very important issue, but
I don't see this addressed at all.
boost::serialization offers a built-in versioning system which works
well in general... but it looks like I'd have to roll my own
versioning system if I use ptree.

It seems to me that ptree is designed only for the most basic of
configuration requirements.
right?

thanks,
Paul


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net