|
Boost : |
From: Jeff Garland (jeff_at_[hidden])
Date: 2006-04-18 11:50:32
On Tue, 11 Apr 2006 00:04:06 +0100, Marcin Kalicinski wrote
> Property tree library revision 5 (review version) is now in the
> boost vault. Documentation can be viewed online at
http://kaalus.atspace.com/ptree
I took a quick look this morning -- it's very slick. The interface is clean
and obvious -- I especially like the get_optional. The focus on supporting
multiple external formats while maintaining a common internal interface is a
very smart design decision.
I'll definately be using this class :-)
A couple things I discovered:
- Couldn't get find to work
- Docs Need an example of using the iterators (no example either)
- If you read an ini file with comments and then write it back they are lost
- Indenting and other attributes of the ini file are also lost.
Only serious thing is I can't seem to get 'find' to work.
ptree pt;
read_ini("test.ini", pt);
ptree::const_iterator ci = pt.find("value2");
if (ci != pt.end()) {
std::cout << ci->second.data() << std::endl;
}
//test.ini
[User Data] ; This is a comment
value1 = v1
value2 = v2
date = 2006-Apr-18
I tried various keys in the find -- all returned null iterator.
One really interesting extension for this would be a combination with
Boost.Filesystem for reading file properties. You could use filesystem to
populate the tree and then you'd have a really handy data structure for
accessing file properties.
Jeff
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk