[property_tree] number of sections in an inifile

Hi: If I have defined: boost::property_tree::ptree IniTree; What is the correct way to determine how many sections there are in an ini file. Should I use count, max_size, m_children or size? Any help appreciated. Cheers Sean.

On 22.03.2012, at 15:48, Sean Farrow wrote:
Hi: If I have defined: boost::property_tree::ptree IniTree; What is the correct way to determine how many sections there are in an ini file. Should I use count, max_size, m_children or size?
m_children is private. count() takes an argument. max_size(), according to the Container concept, returns how many elements (children, in the case of ptree) there could possibly be. size() returns how many there are. size() is the right answer. Sebastian

Can I know one element under a parent node existence? If my xml file's content like this: <?xml version="1.0" encoding="utf-8"?> <loader value="../../../asset/art/demo25Dv1.swf"/> <video width="1280" height="720"/> <touch> <show_points_info/> </touch> When I use ptree.count("touch"), it returns 1. But I use ptree.count("touch.show_points_info"), it returns 0 instead. What's wrong with that? Or should I use another method to get existence node of any depth? -- View this message in context: http://boost.2283326.n4.nabble.com/property-tree-number-of-sections-in-an-in... Sent from the Boost - Users mailing list archive at Nabble.com.
participants (3)
-
naive231
-
Sean Farrow
-
Sebastian Redl