|
Boost : |
From: Jarrad Waterloo (jwaterloo_at_[hidden])
Date: 2006-05-05 08:51:19
It would be nice if there were 'no seperator' variants of the the get and
out methods that took an array of strings, 'const
tr1_or_boost::array<key_type,T>& path', instead of 'const key_type &path'.
Having this makes the api a little more object oriented instead of paths
needing parsing. It can make it easier to use in more advanced scenarios as
the user need not know what the seperator is and what to do if string data
has that seperator. I am not saying any of the existing functions are wrong.
Frankly, I like them. However, the users of this api could benefit by these
minor additions.
On a side note the link to some of the examples such a changing the value
type seems to be broken. I would definitely like to see what I can do with
the ptree_trait to allow using boost::any or the optimized cdiggins::any
instead of string.
// No separator
template<class Type> Type get(const tr1_or_boost::array<key_type,T>& path,
const std::locale &loc = std::locale()) const;
// No separator
template<class Type> Type get(const tr1_or_boost::array<key_type,T>& path,
const Type &default_value, const std::locale &loc = std::locale()) const;
template<class CharType> std::basic_string<CharType> get(const
tr1_or_boost::array<key_type,T>& path, const CharType *default_value, const
std::locale &loc = std::locale()) const;
// No separator
template<class Type> boost::optional<Type> get_optional(const
tr1_or_boost::array<key_type,T>& path, const std::locale &loc =
std::locale()) const;
// No separator
template<class Type> basic_ptree &put(const tr1_or_boost::array<key_type,T>&
path, const Type &value, bool do_not_replace = false, const std::locale &loc
= std::locale());
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk