Boost logo

Boost Users :

Subject: [Boost-users] [PropertyTree] Request to have string_path.get_separator()
From: Gábor Márton (martongabesz_at_[hidden])
Date: 2011-11-21 03:58:06


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.

Thanks,
Gabor


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