...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::property_tree::string_path — Default path class. A path is a sequence of values. Groups of values are separated by the separator value, which defaults to '.' cast to the sequence's value type. The group of values is then passed to the translator to get a key.
// In header: <boost/property_tree/string_path.hpp> template<typename String, typename Translator> class string_path { public: // types typedef Translator::external_type key_type; typedef String::value_type char_type; // construct/copy/destruct string_path(char_type = char_type('.')); string_path(const String &, char_type = char_type('.'), Translator = Translator()); string_path(const char_type *, char_type = char_type('.'), Translator = Translator()); string_path(const string_path &); string_path& operator=(const string_path &); // private member functions BOOST_STATIC_ASSERT((is_same< String, typename Translator::internal_type >::value)); s_c_iter cstart() const; // public member functions key_type reduce(); bool empty() const; bool single() const; std::string dump() const; string_path & operator/=(const string_path &); };
If instantiated with std::string and id_translator<std::string>, it accepts paths of the form "one.two.three.four".
string_path
public
construct/copy/destructstring_path(char_type separator = char_type('.'));Create an empty path.
string_path(const String & value, char_type separator = char_type('.'), Translator tr = Translator());Create a path by parsing the given string.
Parameters: |
|
string_path(const char_type * value, char_type separator = char_type('.'), Translator tr = Translator());Create a path by parsing the given string.
Parameters: |
|
string_path(const string_path & o);
string_path& operator=(const string_path & o);
string_path
public member functionskey_type reduce();Take a single element off the path at the front and return it.
bool empty() const;Test if the path is empty.
bool single() const;Test if the path contains a single element, i.e. no separators.
std::string dump() const;
string_path & operator/=(const string_path & o);Append a second path to this one.
Requires: |
o's separator is the same as this one's, or o has no separators |