Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4786: custom property_tree
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-03-20 15:52:17
#4786: custom property_tree
-------------------------------+--------------------------------------------
Reporter: anonymous | Owner: cornedbee
Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: property_tree
Version: Boost 1.44.0 | Severity: Problem
Resolution: | Keywords: property_tree
-------------------------------+--------------------------------------------
Comment (by saleyn):
Replying to [comment:3 anonymous]:
> the idea looks nice. the C-style casts don't. the try/catch cascade with
lexical_cast for guessing the type from string looks even more horrible,
but there's nothing else to do since INFO files don't have any hints like
"this property has that type" inside. it's too bad that the library
maintainer didn't pay attention yet, maybe he could suggest something.
Ideally the parsers would minimally give an ability to infer the type
based on the parsed data, and provide a hint to the derived implementation
so that the commonly identifiable inputs "1", "2.0", '"string"' are
transformed into statically overridable calls that the transform function
would be able to map into properly typed objects, e.g.:
enum hint_t {UNDEFINED, INT, FLOAT, STRING};
std::pair<std::basic_string<Ch>, hint_t> raw_data = read_data(text,
&need_more_lines);
typename Ptree::data_type typed_data = transform_data(raw_data);
last.data() = typed_data;
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4786#comment:6> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC