Boost logo

Boost :

From: Bronek Kozicki (brok_at_[hidden])
Date: 2006-04-29 17:01:41


Stephen Dolan wrote:
> The proposed property tree library uses a small internal language which is
> passed to the various functions, for instance:
>
> file = ptree.get<std::string>("config.filename");
>
> Personally, I don't think its a good idea to define new syntaxes and pass
> them around as strings. It would be a bit more effort to implement, but I
> think (something like) the following would be preferable:
>
> file = ptree.get<std::string>["config"]["filename"]

I strongly agree with this point. In case I do not find time for a full
review, this is the most important thing that I'd point out. I'd also like to
add that there should be clear distinction between nodes and leafes, eg.
   operator() (T t) - returns leaf (I do not insist on syntax)
   operator() [T t] - returns node

thus:
   file = ptree.get<std::string>["config"]["filename"];
would mean 'take whatever default value there is for node "filemane" which
belongs to node "config"'; while:
   file = ptree.get<std::string>["config"]("filename");
would mean 'take value "filemane" which belongs to node "config"'.

I'm fairly familiar with problem domain, as I implemented similar structure
with rich interface for commercial product (the structure served as kind of
DOM storage for EDIFACT documents).

B.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk