{"id":168951,"date":"2013-02-10T23:48:03","date_gmt":"2013-02-10T19:48:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=168951"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=168951","title":{"rendered":"<span class=\"post_title\">Boost Property Tree \u0438 \u0435\u0433\u043e \u043f\u0430\u0440\u0441\u0435\u0440 XML<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/upload.wikimedia.org\/wikipedia\/commons\/c\/cd\/Boost.png\" alt=\"image\"\/><\/p>\n<h4>\u041e \u0447\u0435\u043c \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f<\/h4>\n<p>  \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Property Tree Library, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e:  <\/p>\n<ul>\n<li>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Property Tree;<\/li>\n<li>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Property Tree;<\/li>\n<li>\u041a\u0430\u043a \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c Property Tree \u0432 XML-\u043a\u043e\u0434 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e.<\/li>\n<\/ul>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>Property Tree<\/h4>\n<p>  \u0412 Boost \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 1.41.1 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Property Tree. \u042d\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445, \u0434\u0440\u0435\u0432\u043e\u0432\u0438\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 boost::propetry_tree::ptree.<\/p>\n<p>  ptree \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u0430\u044f \u0434\u0440\u0435\u0432\u043e\u0432\u0438\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0439, \u043f\u043e\u043c\u0438\u043c\u043e \u0434\u0430\u043d\u043d\u044b\u0445, \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0435 \u0438\u043c\u044f.<\/p>\n<p>  \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"cpp\">struct ptree {    data_type data;                         \/\/ \u0414\u0430\u043d\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430    list&lt;pair&lt;key_type, ptree&gt;&gt; children;   \/\/ \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u043d\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 }; <\/code><\/pre>\n<p>  \u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 key_type \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430.<\/p>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Property Tree<\/h4>\n<p>  \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 ptree \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u0430 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f, \u0437\u0430\u043f\u0438\u0441\u0438, \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0440\u0435\u0432\u043e\u0432\u0438\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<br \/>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u044d\u0442\u043e \u0434\u0435\u0440\u0435\u0432\u043e \u043f\u0440\u043e\u0449\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e:  <\/p>\n<pre><code class=\"cpp\">boost::property_tree::ptree heroTree;  heroTree.put(&quot;Name&quot;, &quot;John&quot;); heroTree.put(&quot;Exp&quot;, 150); heroTree.put(&quot;Inventory.Weapon&quot;, &quot;Blue Sword&quot;); heroTree.put(&quot;Inventory.Money&quot;, 3000); <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 ptree \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0432\u044f\u0437\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u0432, \u0438\u043c\u0435\u044e\u0449\u0438\u0445 \u043e\u0434\u0438\u043d \u043a\u043b\u044e\u0447:  <\/p>\n<pre><code class=\"cpp\">heroTree.put(&quot;Inventory.Item&quot;, &quot;Stone&quot;); heroTree.put(&quot;Inventory.Item&quot;, &quot;Golden helmet&quot;); heroTree.put(&quot;Inventory.Item&quot;, &quot;Thomb key&quot;); <\/code><\/pre>\n<p>  \u0416\u0435\u043b\u0430\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0434-\u0434\u0435\u0440\u0435\u0432\u043e? \u0422\u043e\u0436\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e:  <\/p>\n<pre><code class=\"cpp\">boost::property_tree::ptree inventoryTree = heroTree.get_child(&quot;Inventory&quot;); inventoryTree.put(&quot;Item&quot;, &quot;Shield of Honor&quot;); <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0442\u043e\u0436\u0435 \u043f\u0440\u043e\u0449\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e:  <\/p>\n<pre><code class=\"cpp\">int exp = pt.get&lt;int&gt;(&quot;Exp&quot;);  std::string weapon = pt.get&lt;std::string&gt;(&quot;Inventory.Weapon&quot;); <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u0442, \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u0415\u0441\u043b\u0438 \u0432\u044b \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0436\u0435\u043b\u0430\u0435\u0442\u0435, \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0434\u0430\u0439\u0442\u0435 \u0432\u0442\u043e\u0440\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b \u0436\u0435\u043b\u0430\u0435\u0442\u0435 \u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e:  <\/p>\n<pre><code class=\"cpp\">int exp = pt.get&lt;int&gt;(&quot;Exp&quot;, 0); <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u0442\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u0438\u0445:  <\/p>\n<pre><code class=\"cpp\">BOOST_FOREACH(auto &v, inventoryTree) { \tif (v.first == &quot;Item&quot;) \t{ \t\tstd::cout &lt;&lt; &quot;Hero has item: &quot; &lt;&lt; v.second.get&lt;std::string&gt;(&quot;&quot;) &lt;&lt; std::endl; \t} } <\/code><\/pre>\n<h4>XML-\u043f\u0430\u0440\u0441\u0435\u0440<\/h4>\n<p>  \u0421\u0430\u043c\u043e\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0432 Property Tree Library \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u043f\u0430\u0440\u0441\u0435\u0440\u044b XML \u0438 JSON. \u041f\u0430\u0440\u0441\u0435\u0440\u044b \u043d\u0435 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0435, \u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043f\u0440\u044f\u043c\u043e \u00ab\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u00bb \u2014 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0442\u044f\u043d\u0443\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439.<br \/>  \u0421 JSON-\u043f\u0430\u0440\u0441\u0435\u0440\u043e\u043c \u044f \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b, \u043d\u043e XML-\u043f\u0430\u0440\u0441\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0443\u0436\u0435 \u043d\u0430 \u043f\u043e\u043b\u043d\u0443\u044e \u043a\u0430\u0442\u0443\u0448\u043a\u0443. \u041e \u043d\u0435\u043c \u0438 \u043d\u0430\u043f\u0438\u0448\u0443 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435.<\/p>\n<p>  \u0414\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f xml \u0438 \u0437\u0430\u043f\u0438\u0441\u0438 xml \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043c\u0435\u0442\u043e\u0434\u044b read_xml \u0438 write_xml. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435:  <\/p>\n<pre><code class=\"cpp\"> \/\/XML-\u043a\u043e\u0434 \u0434\u043b\u044f \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 std::string xmlCode = &quot;&lt;ButtonList&gt;\\ \t&lt;Button&gt;B1&lt;\/Button&gt;\\ \t&lt;Button&gt;B2&lt;\/Button&gt;\\ \t&lt;\/ButtonList&gt;&quot;;  \/\/\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u0442\u043e\u043a std::stringstream stream(xmlCode);  try { \tboost::property_tree::ptree propertyTree; \t \t\/\/\u0427\u0438\u0442\u0430\u0435\u043c XML \tboost::property_tree::read_xml(stream, propertyTree); \t \t\/\/\u0427\u0438\u0442\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f: \tBOOST_FOREACH(auto &v, propertyTree) \t{ \t\tstd::cout &lt;&lt; &quot;Button is &quot; &lt;&lt; v.second.get&lt;std::string&gt;(&quot;&quot;) &lt;&lt; std::endl; \t} \t \t \t\/\/\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u0440\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \tpropertyTree.put(&quot;ButtonList.Button&quot;, &quot;B3&quot;); \tpropertyTree.put(&quot;ButtonList.Button&quot;, &quot;B4&quot;); \t \tstd::stringstream output_stream; \t \t\/\/\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \tboost::property_tree::write_xml(output_stream, propertyTree); \t \t\/\/\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c XML \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u0430 \tstd::string outputXmlCode = output_stream;  } catch(boost::property_tree::xml_parser_error) { \t \tstd::cout&lt;&lt;&quot;XML parser error!&quot;&lt;&lt;std::endl; \t \tthrow; } <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u0443\u0437\u043b\u0430, \u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u043f\u0441\u0435\u0432\u0434\u043e-\u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u043e &quot;&lt;xmlattr&gt;&quot;:  <\/p>\n<pre><code class=\"cpp\"> \/\/XML-\u043a\u043e\u0434 \u0434\u043b\u044f \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 std::string xmlCode = &quot;&lt;Data name=&quot;Position&quot; x=&quot;5&quot; y=&quot;5&quot;\/&gt;&quot;;  \/\/... \u043f\u0430\u0440\u0441\u0438\u043c XML  \/\/\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f std::string name = propertyTree.get&lt;std::string&gt;(&quot;Data.&lt;xmlattr&gt;.name&quot;); int x = propertyTree.get&lt;std::string&gt;(&quot;Data.&lt;xmlattr&gt;.x&quot;); int y = propertyTree.get&lt;std::string&gt;(&quot;Data.&lt;xmlattr&gt;.y&quot;); <\/code><\/pre>\n<p>  C \u043f\u0441\u0435\u0432\u0434\u043e-\u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u043e\u043c &quot;&lt;xmlattr&gt;&quot; \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0433\u0440\u0430\u0431\u043b\u0438, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0435\u0447\u0430\u044f\u043d\u043d\u043e \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u0442\u044c. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043a\u0430\u043a \u0432 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 ButtonList \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0435\u0441\u0442\u044c 4 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 Button \u2014 \u043a\u043d\u043e\u043f\u043a\u0438.<br \/>  \u0415\u0441\u043b\u0438 \u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 ButtonList \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b, \u0442\u043e \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 XML \u0434\u0435\u0440\u0435\u0432\u0435 \u0431\u0443\u0434\u0435\u0442 4 \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u0430, \u043a\u0430\u043a \u0438 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043e, \u0438 \u0443 \u0432\u0441\u0435\u0445 \u0431\u0443\u0434\u0435\u0442 \u043a\u043b\u044e\u0447 \u00abButton\u00bb. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0443 ButtonList \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u043a\u0430\u043a\u0438\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b, \u0442\u043e \u2014 \u0441\u044e\u0440\u043f\u0440\u0438\u0437! \u2014 \u043a 4 \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c \u0441 \u043a\u043d\u043e\u043f\u043a\u0430\u043c\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0449\u0435 \u043e\u0434\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u043e, \u0441 \u043a\u043b\u044e\u0447\u043e\u043c &quot;&lt;xmlattr&gt;&quot;, \u043a\u043e\u0442\u043e\u0440\u043e\u0435, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u043a \u043a\u043d\u043e\u043f\u043a\u0430\u043c \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u043d\u0435 \u0438\u043c\u0435\u0435\u0442.<\/p>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043d\u043e\u043f\u043a\u0438, \u0437\u043d\u0430\u0447\u0438\u0442, \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0435 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442 &lt;xmlattr&gt; \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"cpp\"> BOOST_FOREACH(auto &v, propertyTree) { \tif (v.first == &quot;Button&quot;) \/\/\u0412\u0432\u043e\u0434\u0438\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \t{ \t\tstd::cout &lt;&lt; &quot;Button is &quot; &lt;&lt; v.second.get&lt;std::string&gt;(&quot;&quot;) &lt;&lt; std::endl; \t} }  <\/code><\/pre>\n<h4>\u041f\u0440\u043e\u0447\u0435\u0435<\/h4>\n<p>  \u041f\u043e\u043c\u0438\u043c\u043e XML-\u043f\u0430\u0440\u0441\u0435\u0440\u0430, Property Tree Library \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u0430\u043a\u0436\u0435 JSON-, INI- \u0438 INFO-\u043f\u0430\u0440\u0441\u0435\u0440\u044b. \u0421 \u043d\u0438\u043c\u0438 \u044f \u0435\u0449\u0435 \u043d\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b\u0441\u044f, \u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u0442\u0430\u043c \u0432\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435.<\/p>\n<h4>\u0421\u043f\u0438\u0441\u043e\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u044b:<\/h4>\n<p>  <a href=\"http:\/\/www.boost.org\/doc\/libs\/1_52_0\/doc\/html\/property_tree.html\">www.boost.org\/doc\/libs\/1_52_0\/doc\/html\/property_tree.html<\/a>    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/168951\/\"> http:\/\/habrahabr.ru\/post\/168951\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/upload.wikimedia.org\/wikipedia\/commons\/c\/cd\/Boost.png\" alt=\"image\"\/><\/p>\n<h4>\u041e \u0447\u0435\u043c \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f<\/h4>\n<p>  \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Property Tree Library, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e:  <\/p>\n<ul>\n<li>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Property Tree;<\/li>\n<li>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Property Tree;<\/li>\n<li>\u041a\u0430\u043a \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c Property Tree \u0432 XML-\u043a\u043e\u0434 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e.<\/li>\n<\/ul>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-168951","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/168951","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=168951"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/168951\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=168951"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=168951"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=168951"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}