Boost logo

Boost Users :

Subject: Re: [Boost-users] [PropertyTree] Request to have string_path.get_separator()
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2011-11-21 06:01:54


On 21.11.2011 09:58, Gábor Márton wrote:
> Hi,
>
> I am implementing my own read function to populate a property tree:
> void read_imm(const boost::property_tree::path& path,
> boost::property_tree::ptree& pt);
> The first parameter is to specify the root of the configuration tree,
> from where the property tree will get it's values. However in the
> implementation of read_imm the path must be parsed and reversed. For
> that I need to know the separator of the path.
>
> Currently, I have the following workaround to get the separator:
> char getSeparator(const boost::property_tree::path& path)
> {
> assert(!path.single());
> assert(!path.empty());
> std::string pathStr = path.dump();
> namespace bpt = boost::property_tree;
> bpt::path pathCopy(path);
> std::string first = pathCopy.reduce();
> return pathStr.at(first.length());
> }
>
> This is inconvenient , so this letter is to request a public member
> function to get the separator to ease the use of
> boost::property_tree::path.
>
Committed to trunk in r75587. string_path (the template behind the path
typedef) now has char_type separator() const.

Sebastian


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