[DEV] add v1.76.0

This commit is contained in:
2021-10-05 21:37:46 +02:00
parent a97e9ae7d4
commit d0115b733d
45133 changed files with 4744437 additions and 1026325 deletions

View File

@@ -0,0 +1,224 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>How to Access Data in a Property Tree</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../property_tree.html" title="Chapter 32. Boost.PropertyTree">
<link rel="prev" href="parsers.html" title="How to Populate a Property Tree">
<link rel="next" href="appendices.html" title="Appendices">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="parsers.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../property_tree.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="appendices.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="property_tree.accessing"></a><a class="link" href="accessing.html" title="How to Access Data in a Property Tree">How to Access Data in a Property
Tree</a>
</h2></div></div></div>
<p>
Property tree resembles (almost is) a standard container with value type of
<code class="computeroutput"><span class="identifier">pair</span><span class="special">&lt;</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">ptree</span><span class="special">&gt;</span></code>.
It has the usual member functions, such as <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_17-bb">insert</a></code>,
<code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_22-bb">push_back</a></code>,
<code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_34-bb">find</a></code>,
<code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_19-bb">erase</a></code>,
etc. These can of course be used to populate and access the tree. For example
the following code adds key <code class="computeroutput"><span class="string">"pi"</span></code>
with data (almost) equal to mathematical <span class="emphasis"><em>pi</em></span> value:
</p>
<pre class="programlisting"><code class="computeroutput"><a class="link" href="../boost/property_tree/ptree.html" title="Type definition ptree">ptree</a></code> <span class="identifier">pt</span><span class="special">;</span>
<span class="identifier">pt</span><span class="special">.</span><code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_22-bb">push_back</a></code><span class="special">(</span><code class="computeroutput"><a class="link" href="../boost/property_tree/ptree.html" title="Type definition ptree">ptree</a></code><span class="special">::</span><code class="computeroutput">value_type</code><span class="special">(</span><span class="string">"pi"</span><span class="special">,</span> <code class="computeroutput"><a class="link" href="../boost/property_tree/ptree.html" title="Type definition ptree">ptree</a></code><span class="special">(</span><span class="string">"3.14159"</span><span class="special">)));</span>
</pre>
<p>
To find the value of <code class="computeroutput"><span class="identifier">pi</span></code> we
might do the following:
</p>
<pre class="programlisting"><code class="computeroutput"><a class="link" href="../boost/property_tree/ptree.html" title="Type definition ptree">ptree</a></code><span class="special">::</span><code class="computeroutput">const_iterator</code> <span class="identifier">it</span> <span class="special">=</span> <span class="identifier">pt</span><span class="special">.</span><code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_34-bb">find</a></code><span class="special">(</span><span class="string">"pi"</span><span class="special">);</span>
<span class="keyword">double</span> <span class="identifier">pi</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">lexical_cast</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;(</span><span class="identifier">it</span><span class="special">-&gt;</span><span class="identifier">second</span><span class="special">.</span><code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_42-bb">data</a></code><span class="special">());</span>
</pre>
<p>
This looks quite cumbersome, and would be even more so if <code class="computeroutput"><span class="identifier">pi</span></code>
value was not stored so near the top of the tree, and we cared just a little
bit more about errors. Fortunately, there is another, correct way of doing
it:
</p>
<pre class="programlisting"><span class="identifier">ptree</span> <span class="identifier">pt</span><span class="special">;</span>
<span class="identifier">pt</span><span class="special">.</span><code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_71-bb">put</a></code><span class="special">(</span><span class="string">"pi"</span><span class="special">,</span> <span class="number">3.14159</span><span class="special">);</span> <span class="comment">// put double</span>
<span class="keyword">double</span> <span class="identifier">pi</span> <span class="special">=</span> <span class="identifier">pt</span><span class="special">.</span><code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_63-bb">get</a></code><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;(</span><span class="string">"pi"</span><span class="special">);</span> <span class="comment">// get double</span>
</pre>
<p>
It doesn't get simpler than that. Basically, there are 2 families of member
functions, <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_63-bb">get</a></code>
and <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_71-bb">put</a></code>,
which allow intuitive access to data stored in the tree (direct children or
not).
</p>
<h4>
<a name="property_tree.accessing.h0"></a>
<span class="phrase"><a name="property_tree.accessing.three_ways_of_getting_data"></a></span><a class="link" href="accessing.html#property_tree.accessing.three_ways_of_getting_data">Three
Ways of Getting Data</a>
</h4>
<p>
There are three versions of get: get, get (default-value version), and get_optional,
which differ by failure handling strategy. All versions take path specifier,
which determines in which key to search for a value. It can be a single key,
or a path to key, where path elements are separated with a special character
(a '.' if not specified differently). For example debug.logging.errorlevel
might be a valid path with dot as a separator.
</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<p class="simpara">
The throwing version (<code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_63-bb">get</a></code>):
</p>
<pre class="programlisting"><code class="computeroutput"><a class="link" href="../boost/property_tree/ptree.html" title="Type definition ptree">ptree</a></code> <span class="identifier">pt</span><span class="special">;</span>
<span class="comment">/* ... */</span>
<span class="keyword">float</span> <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">pt</span><span class="special">.</span><code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_63-bb">get</a></code><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;(</span><span class="string">"a.path.to.float.value"</span><span class="special">);</span>
</pre>
<p class="simpara">
This call locates the proper node in the tree and tries to translate its
data string to a float value. If that fails, exception is thrown. If path
does not exist, it will be <code class="computeroutput"><a class="link" href="../boost/property_tree/ptree_bad_path.html" title="Class ptree_bad_path">ptree_bad_path</a></code>
exception. If value could not be translated, it will be <code class="computeroutput"><a class="link" href="../boost/property_tree/ptree_bad_data.html" title="Class ptree_bad_data">ptree_bad_data</a></code>.
Both of them derive from <code class="computeroutput"><a class="link" href="../boost/property_tree/ptree_error.html" title="Class ptree_error">ptree_error</a></code>
to make common handling possible.
</p>
</li>
<li class="listitem">
<p class="simpara">
The default-value version (<code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_63-bb">get</a></code>):
</p>
<pre class="programlisting"><code class="computeroutput"><a class="link" href="../boost/property_tree/ptree.html" title="Type definition ptree">ptree</a></code> <span class="identifier">pt</span><span class="special">;</span>
<span class="comment">/* ... */</span>
<span class="keyword">float</span> <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">pt</span><span class="special">.</span><code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_63-bb">get</a></code><span class="special">(</span><span class="string">"a.path.to.float.value"</span><span class="special">,</span> <span class="special">-</span><span class="number">1.f</span><span class="special">);</span>
</pre>
<p class="simpara">
It will do the same as above, but if it fails, it will return the default
value specified by second parameter (here -1.f) instead of throwing. This
is very useful in common situations where one wants to allow omitting of
some keys. Note that type specification needed in throwing version is normally
not necessary here, because type is determined by the default value parameter.
</p>
</li>
<li class="listitem">
<p class="simpara">
The optional version (<code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_69-bb">get_optional</a></code>):
</p>
<pre class="programlisting"><code class="computeroutput"><a class="link" href="../boost/property_tree/ptree.html" title="Type definition ptree">ptree</a></code> <span class="identifier">pt</span><span class="special">;</span>
<span class="comment">/* ... */</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">optional</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;</span> <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">pt</span><span class="special">.</span><code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_69-bb">get_optional</a></code><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;(</span><span class="string">"a.path.to.float.value"</span><span class="special">);</span>
</pre>
<p class="simpara">
This version uses boost::optional class to handle extraction failure. On
successful extraction, it will return boost::optional initialized with
extracted value. Otherwise, it will return uninitialized boost::optional.
</p>
</li>
</ol></div>
<p>
To retrieve a value from this tree (not some subkey), use <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_53-bb">get_value</a></code>,
<code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_53-bb">get_value</a></code>
(default-value version), and <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_59-bb">get_value_optional</a></code>.
They have identical semantics to <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_63-bb">get</a></code>
functions, except they don't take the <code class="computeroutput"><a class="link" href="../boost/property_tree/string_path.html" title="Class template string_path">path</a></code>
parameter. Don't call <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_63-bb">get</a></code>
with and empty <code class="computeroutput"><a class="link" href="../boost/property_tree/string_path.html" title="Class template string_path">path</a></code>
to do this as it will try to extract contents of subkey with empty name.
</p>
<p>
To use a separator character other than default '<code class="literal">.</code>', you
need to construct a path object explicitly. The path type for a <code class="computeroutput"><a class="link" href="../boost/property_tree/ptree.html" title="Type definition ptree">ptree</a></code> is a string_path instantiation,
so the easiest way to refer to it is <code class="computeroutput"><a class="link" href="../boost/property_tree/ptree.html" title="Type definition ptree">ptree</a></code>::path_type.
This way you can use trees that have dots in their keys:
</p>
<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">ptree</span><span class="special">::</span><span class="identifier">path_type</span> <span class="identifier">path</span><span class="special">;</span>
<span class="identifier">pt</span><span class="special">.</span><span class="identifier">get</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;(</span><span class="identifier">path</span><span class="special">(</span><span class="string">"p.a.t.h/t.o/v.a.l.u.e"</span><span class="special">,</span> <span class="char">'/'</span><span class="special">));</span>
<span class="identifier">pt</span><span class="special">.</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">path</span><span class="special">(</span><span class="string">"p.a.t.h/t.o/v.a.l.u.e"</span><span class="special">,</span> <span class="char">'/'</span><span class="special">),</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">NULL</span><span class="special">);</span>
<span class="identifier">pt</span><span class="special">.</span><span class="identifier">get_optional</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&gt;(</span><span class="identifier">path</span><span class="special">(</span><span class="string">"p.a.t.h/t.o/v.a.l.u.e"</span><span class="special">,</span> <span class="char">'/'</span><span class="special">));</span>
</pre>
<p>
Note: the special overloads of <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_63-bb">get</a></code>
and <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_69-bb">get_optional</a></code>
taking a separator character that existed in pre-release versions of PropertyTree
have been removed. This is because the overloads conflicted with using per-call
data translators.
</p>
<h4>
<a name="property_tree.accessing.h1"></a>
<span class="phrase"><a name="property_tree.accessing.two_ways_of_putting_data"></a></span><a class="link" href="accessing.html#property_tree.accessing.two_ways_of_putting_data">Two
Ways of Putting Data</a>
</h4>
<p>
To complement <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_63-bb">get</a></code>,
there are <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_71-bb">put</a></code>
and <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_73-bb">add</a></code>.
Contrary to <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_63-bb">get</a></code>,
they have only one variant each. This is because there is no need to deal with
missing values when adding data. If the supplied value cannot be converted
to the tree's data type, the functions will throw <code class="computeroutput"><a class="link" href="../boost/property_tree/ptree_bad_data.html" title="Class ptree_bad_data">ptree_bad_data</a></code>.
</p>
<pre class="programlisting"><code class="computeroutput"><a class="link" href="../boost/property_tree/ptree.html" title="Type definition ptree">ptree</a></code> <span class="identifier">pt</span><span class="special">;</span>
<span class="identifier">pt</span><span class="special">.</span><code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_71-bb">put</a></code><span class="special">(</span><span class="string">"a.path.to.float.value"</span><span class="special">,</span> <span class="number">3.14f</span><span class="special">);</span>
<span class="comment">// Overwrites the value</span>
<span class="identifier">pt</span><span class="special">.</span><code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_71-bb">put</a></code><span class="special">(</span><span class="string">"a.path.to.float.value"</span><span class="special">,</span> <span class="number">2.72f</span><span class="special">);</span>
<span class="comment">// Adds a second node with the new value.</span>
<span class="identifier">pt</span><span class="special">.</span><code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_73-bb">add</a></code><span class="special">(</span><span class="string">"a.path.to.float.value"</span><span class="special">,</span> <span class="number">3.14f</span><span class="special">);</span>
</pre>
<p>
Calling <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_71-bb">put</a></code>
will insert a new value at specified path, so that a call to <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_63-bb">get</a></code>
specifying the same path will retrieve it. Further, <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_71-bb">put</a></code>
will insert any missing path elements during path traversal. For example, calling
<code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_71-bb">put</a><span class="special">(</span><span class="string">"key1.key2.key3"</span><span class="special">,</span> <span class="number">3.14f</span><span class="special">)</span></code>
on an empty tree will insert three new children: <code class="computeroutput"><span class="identifier">key1</span></code>,
<code class="computeroutput"><span class="identifier">key1</span><span class="special">.</span><span class="identifier">key2</span></code> and <code class="computeroutput"><span class="identifier">key1</span><span class="special">.</span><span class="identifier">key2</span><span class="special">.</span><span class="identifier">key3</span></code>. The last one will receive a string
<code class="computeroutput"><span class="string">"3.14"</span></code> as data, while
the two former ones will have empty data strings. <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_71-bb">put</a></code>
always inserts new keys at the back of the existing sequences. The difference
between <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_71-bb">put</a></code>
and <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_73-bb">add</a></code>
is that put will overwrite existing values if there are any, while add will
create a new node to hold the value even if the specified path references an
existing node.
</p>
<p>
Similar to <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_53-bb">get_value</a></code>,
there is also a <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_61-bb">put_value</a></code>
function. It does the same for this property tree what <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_71-bb">put</a></code>
does for its children. Thus, it does not receive a <code class="computeroutput"><a class="link" href="../boost/property_tree/string_path.html" title="Class template string_path">path</a></code>:
</p>
<pre class="programlisting"><code class="computeroutput"><a class="link" href="../boost/property_tree/ptree.html" title="Type definition ptree">ptree</a></code> <span class="identifier">pt</span><span class="special">;</span>
<span class="identifier">pt</span><span class="special">.</span><code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_61-bb">put_value</a></code><span class="special">(</span><span class="number">3.14f</span><span class="special">);</span>
</pre>
<p>
There is no add_value function.
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2008-2010 Marcin Kalicinski<br>Copyright © 2010-2013 Sebastian
Redl<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="parsers.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../property_tree.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="appendices.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@@ -0,0 +1,127 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Appendices</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../property_tree.html" title="Chapter 32. Boost.PropertyTree">
<link rel="prev" href="accessing.html" title="How to Access Data in a Property Tree">
<link rel="next" href="reference.html" title="Reference">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="accessing.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../property_tree.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="reference.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="property_tree.appendices"></a><a class="link" href="appendices.html" title="Appendices">Appendices</a>
</h2></div></div></div>
<h4>
<a name="property_tree.appendices.h0"></a>
<span class="phrase"><a name="property_tree.appendices.compatibility"></a></span><a class="link" href="appendices.html#property_tree.appendices.compatibility">Compatibility</a>
</h4>
<p>
Property tree uses partial class template specialization. There has been no
attempt to work around lack of support for this. The library will therefore
most probably not work with Visual C++ 7.0 or earlier, or gcc 2.x.
</p>
<p>
Property tree has been tested (regressions successfully compiled and run) with
the following compilers:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Visual C++ 8.0
</li>
<li class="listitem">
gcc 3.4.2 (MinGW)
</li>
<li class="listitem">
gcc 3.3.5 (Linux)
</li>
<li class="listitem">
gcc 3.4.4 (Linux)
</li>
<li class="listitem">
gcc 4.3.3 (Linux)
</li>
<li class="listitem">
Intel C++ 9.0 (Linux)
</li>
</ul></div>
<h4>
<a name="property_tree.appendices.h1"></a>
<span class="phrase"><a name="property_tree.appendices.rationale"></a></span><a class="link" href="appendices.html#property_tree.appendices.rationale">Rationale</a>
</h4>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<span class="bold"><strong>Why are there 3 versions of <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_63-bb">get</a></code>?
Couldn't there be just one?</strong></span> The three versions reflect experience
gathered during several of years of using property tree in several different
applications. During that time I tried hard to come up with one, proper
form of the get function, and failed. I know of these three basic patterns
of usage:
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<span class="emphasis"><em>Just get the data and I do not care if it cannot be done.</em></span>
This is used when the programmer is fairly sure that data exists.
Or in homework assignments. Or when tomorrow is final deadline for
your project.
</li>
<li class="listitem">
<span class="emphasis"><em>Get the data and revert to default value if it cannot be
done.</em></span> Used when you want to allow omitting the key in
question. Implemented by some similar tools (windows INI file access
functions).
</li>
<li class="listitem">
<span class="emphasis"><em>Get the data, but I care more whether you succeeded than
I do for the data itself.</em></span> Used when you want to vary control
flow depending on get success/failure. Or to check for presence of
a key.
</li>
</ul></div>
</li></ol></div>
<h4>
<a name="property_tree.appendices.h2"></a>
<span class="phrase"><a name="property_tree.appendices.future_development"></a></span><a class="link" href="appendices.html#property_tree.appendices.future_development">Future
Development</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
More parsers: YAML, environment strings.
</li>
<li class="listitem">
More robust XML parser.
</li>
<li class="listitem">
Mathematical relations: ptree difference, union, intersection. Useful for
finding configuration file changes etc.
</li>
</ul></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2008-2010 Marcin Kalicinski<br>Copyright © 2010-2013 Sebastian
Redl<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="accessing.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../property_tree.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="reference.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@@ -0,0 +1,74 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Property Tree as a Container</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../property_tree.html" title="Chapter 32. Boost.PropertyTree">
<link rel="prev" href="tutorial.html" title="Five Minute Tutorial">
<link rel="next" href="synopsis.html" title="Property Tree Synopsis">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="tutorial.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../property_tree.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="synopsis.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="property_tree.container"></a><a class="link" href="container.html" title="Property Tree as a Container">Property Tree as a Container</a>
</h2></div></div></div>
<p>
Every property tree node models the ReversibleSequence concept, providing access
to its immediate children. This means that iterating over a <code class="computeroutput"><a class="link" href="../boost/property_tree/ptree.html" title="Type definition ptree">ptree</a></code>
(which is the same as its root node - every <code class="computeroutput"><a class="link" href="../boost/property_tree/ptree.html" title="Type definition ptree">ptree</a></code>
node is also the subtree it starts) iterates only a single level of the hierarchy.
There is no way to iterate over the entire tree.
</p>
<p>
It is very important to remember that the property sequence is <span class="bold"><strong>not</strong></span>
ordered by the key. It preserves the order of insertion. It closely resembles
a std::list. Fast access to children by name is provided via a separate lookup
structure. Do not attempt to use algorithms that expect an ordered sequence
(like binary_search) on a node's children.
</p>
<p>
The property tree exposes a second container-like interface, called the associative
view. Its iterator type is the nested type assoc_iterator (and its const counterpart
const_assoc_iterator). You can get an ordered view of all children by using
ordered_begin() and ordered_end().
</p>
<p>
The associative view also provides find() and equal_range() members, which
return assoc_iterators, but otherwise have the same semantics as the members
of std::map of the same name.
</p>
<p>
You can get a normal iterator from an assoc_iterator by using the to_iterator()
member function. Converting the other way is not possible.
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2008-2010 Marcin Kalicinski<br>Copyright © 2010-2013 Sebastian
Redl<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="tutorial.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../property_tree.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="synopsis.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@@ -0,0 +1,293 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>How to Populate a Property Tree</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../property_tree.html" title="Chapter 32. Boost.PropertyTree">
<link rel="prev" href="synopsis.html" title="Property Tree Synopsis">
<link rel="next" href="accessing.html" title="How to Access Data in a Property Tree">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="synopsis.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../property_tree.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="accessing.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="property_tree.parsers"></a><a class="link" href="parsers.html" title="How to Populate a Property Tree">How to Populate a Property Tree</a>
</h2></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="parsers.html#property_tree.parsers.xml_parser">XML Parser</a></span></dt>
<dt><span class="section"><a href="parsers.html#property_tree.parsers.json_parser">JSON Parser</a></span></dt>
<dt><span class="section"><a href="parsers.html#property_tree.parsers.ini_parser">INI Parser</a></span></dt>
<dt><span class="section"><a href="parsers.html#property_tree.parsers.info_parser">INFO Parser</a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="property_tree.parsers.xml_parser"></a><a class="link" href="parsers.html#property_tree.parsers.xml_parser" title="XML Parser">XML Parser</a>
</h3></div></div></div>
<p>
The <a href="http://en.wikipedia.org/wiki/XML" target="_top">XML format</a> is an
industry standard for storing information in textual form. Unfortunately,
there is no XML parser in <a href="http://www.boost.org" target="_top">Boost</a>
as of the time of this writing. The library therefore contains the fast and
tiny <a href="http://rapidxml.sourceforge.net/" target="_top">RapidXML</a> parser
(currently in version 1.13) to provide XML parsing support. RapidXML does
not fully support the XML standard; it is not capable of parsing DTDs and
therefore cannot do full entity substitution.
</p>
<p>
By default, the parser will preserve most whitespace, but remove element
content that consists only of whitespace. Encoded whitespaces (e.g. &amp;#32;)
does not count as whitespace in this regard. You can pass the trim_whitespace
flag if you want all leading and trailing whitespace trimmed and all continuous
whitespace collapsed into a single space.
</p>
<p>
Please note that RapidXML does not understand the encoding specification.
If you pass it a character buffer, it assumes the data is already correctly
encoded; if you pass it a filename, it will read the file using the character
conversion of the locale you give it (or the global locale if you give it
none). This means that, in order to parse a UTF-8-encoded XML file into a
wptree, you have to supply an alternate locale, either directly or by replacing
the global one.
</p>
<p>
XML / property tree conversion schema (<code class="computeroutput"><a class="link" href="../boost/property_tree/xml_parser/read__1_3_33_10_11_1_1_1_1.html" title="Function template read_xml">read_xml</a></code>
and <code class="computeroutput"><a class="link" href="../boost/property_tree/xml_parser/write_1_3_33_10_11_1_1_1_3.html" title="Function template write_xml">write_xml</a></code>):
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Each XML element corresponds to a property tree node. The child elements
correspond to the children of the node.
</li>
<li class="listitem">
The attributes of an XML element are stored in the subkey <code class="literal">&lt;xmlattr&gt;</code>.
There is one child node per attribute in the attribute node. Existence
of the <code class="literal">&lt;xmlattr&gt;</code> node is not guaranteed or necessary
when there are no attributes.
</li>
<li class="listitem">
XML comments are stored in nodes named <code class="literal">&lt;xmlcomment&gt;</code>,
unless comment ignoring is enabled via the flags.
</li>
<li class="listitem">
Text content is stored in one of two ways, depending on the flags. The
default way concatenates all text nodes and stores them as the data of
the element node. This way, the entire content can be conveniently read,
but the relative ordering of text and child elements is lost. The other
way stores each text content as a separate node, all called <code class="literal">&lt;xmltext&gt;</code>.
</li>
</ul></div>
<p>
The XML storage encoding does not round-trip perfectly. A read-write cycle
loses trimmed whitespace, low-level formatting information, and the distinction
between normal data and CDATA nodes. Comments are only preserved when enabled.
A write-read cycle loses trimmed whitespace; that is, if the origin tree
has string data that starts or ends with whitespace, that whitespace is lost.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="property_tree.parsers.json_parser"></a><a class="link" href="parsers.html#property_tree.parsers.json_parser" title="JSON Parser">JSON Parser</a>
</h3></div></div></div>
<p>
The <a href="http://en.wikipedia.org/wiki/JSON" target="_top">JSON format</a> is
a data interchange format derived from the object literal notation of JavaScript.
(JSON stands for JavaScript Object Notation.) JSON is a simple, compact format
for loosely structured node trees of any depth, very similar to the property
tree dataset. It is less structured than XML and has no schema support, but
has the advantage of being simpler, smaller and typed without the need for
a complex schema.
</p>
<p>
The property tree dataset is not typed, and does not support arrays as such.
Thus, the following JSON / property tree mapping is used:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
JSON objects are mapped to nodes. Each property is a child node.
</li>
<li class="listitem">
JSON arrays are mapped to nodes. Each element is a child node with an
empty name. If a node has both named and unnamed child nodes, it cannot
be mapped to a JSON representation.
</li>
<li class="listitem">
JSON values are mapped to nodes containing the value. However, all type
information is lost; numbers, as well as the literals "null",
"true" and "false" are simply mapped to their string
form.
</li>
<li class="listitem">
Property tree nodes containing both child nodes and data cannot be mapped.
</li>
</ul></div>
<p>
JSON round-trips, except for the type information loss.
</p>
<p>
For example this JSON:
</p>
<pre class="programlisting"><span class="special">{</span>
<span class="string">"menu"</span><span class="special">:</span>
<span class="special">{</span>
<span class="string">"foo"</span><span class="special">:</span> <span class="keyword">true</span><span class="special">,</span>
<span class="string">"bar"</span><span class="special">:</span> <span class="string">"true"</span><span class="special">,</span>
<span class="string">"value"</span><span class="special">:</span> <span class="number">102.3E+06</span><span class="special">,</span>
<span class="string">"popup"</span><span class="special">:</span>
<span class="special">[</span>
<span class="special">{</span><span class="string">"value"</span><span class="special">:</span> <span class="string">"New"</span><span class="special">,</span> <span class="string">"onclick"</span><span class="special">:</span> <span class="string">"CreateNewDoc()"</span><span class="special">},</span>
<span class="special">{</span><span class="string">"value"</span><span class="special">:</span> <span class="string">"Open"</span><span class="special">,</span> <span class="string">"onclick"</span><span class="special">:</span> <span class="string">"OpenDoc()"</span><span class="special">},</span>
<span class="special">]</span>
<span class="special">}</span>
<span class="special">}</span>
</pre>
<p>
will be translated into the following property tree:
</p>
<pre class="programlisting"><span class="identifier">menu</span>
<span class="special">{</span>
<span class="identifier">foo</span> <span class="keyword">true</span>
<span class="identifier">bar</span> <span class="keyword">true</span>
<span class="identifier">value</span> <span class="number">102.3E+06</span>
<span class="identifier">popup</span>
<span class="special">{</span>
<span class="string">""</span>
<span class="special">{</span>
<span class="identifier">value</span> <span class="identifier">New</span>
<span class="identifier">onclick</span> <span class="identifier">CreateNewDoc</span><span class="special">()</span>
<span class="special">}</span>
<span class="string">""</span>
<span class="special">{</span>
<span class="identifier">value</span> <span class="identifier">Open</span>
<span class="identifier">onclick</span> <span class="identifier">OpenDoc</span><span class="special">()</span>
<span class="special">}</span>
<span class="special">}</span>
<span class="special">}</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="property_tree.parsers.ini_parser"></a><a class="link" href="parsers.html#property_tree.parsers.ini_parser" title="INI Parser">INI Parser</a>
</h3></div></div></div>
<p>
The <a href="https://en.wikipedia.org/wiki/INI_file" target="_top">INI format</a>
was once widely used in the world of Windows. It is now deprecated, but is
still used by a surprisingly large number of applications. The reason is
probably its simplicity, plus that Microsoft recommends using the registry
as a replacement, which not all developers want to do.
</p>
<p>
INI is a simple key-value format with a single level of sectioning. It is
thus less rich than the property tree dataset, which means that not all property
trees can be serialized as INI files.
</p>
<p>
The INI parser creates a tree node for every section, and a child node for
every property in that section. All properties not in a section are directly
added to the root node. Empty sections are ignored. (They don't round-trip,
as described below.)
</p>
<p>
The INI serializer reverses this process. It first writes out every child
of the root that contains data, but no child nodes, as properties. Then it
creates a section for every child that contains child nodes, but no data.
The children of the sections must only contain data. It is an error if the
root node contains data, or any child of the root contains both data and
content, or there's more than three levels of hierarchy. There must also
not be any duplicate keys.
</p>
<p>
An empty tree node is assumed to be an empty property. There is no way to
create empty sections.
</p>
<p>
Since the Windows INI parser discards trailing spaces and does not support
quoting, the property tree parser follows this example. This means that property
values containing trailing spaces do not round-trip.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="property_tree.parsers.info_parser"></a><a class="link" href="parsers.html#property_tree.parsers.info_parser" title="INFO Parser">INFO Parser</a>
</h3></div></div></div>
<p>
The INFO format was created specifically for the property tree library. It
provides a simple, efficient format that can be used to serialize property
trees that are otherwise only stored in memory. It can also be used for any
other purpose, although the lack of widespread existing use may prove to
be an impediment.
</p>
<p>
INFO provides several features that make it familiar to C++ programmers and
efficient for medium-sized datasets, especially those used for test input.
It supports C-style character escapes, nesting via curly braces, and file
inclusion via #include.
</p>
<p>
INFO is also used for visualization of property trees in this documentation.
</p>
<p>
A typical INFO file might look like this:
</p>
<pre class="programlisting"><span class="identifier">key1</span> <span class="identifier">value1</span>
<span class="identifier">key2</span>
<span class="special">{</span>
<span class="identifier">key3</span> <span class="identifier">value3</span>
<span class="special">{</span>
<span class="identifier">key4</span> <span class="string">"value4 with spaces"</span>
<span class="special">}</span>
<span class="identifier">key5</span> <span class="identifier">value5</span>
<span class="special">}</span>
</pre>
<p>
Here's a more complicated file demonstrating all of INFO's features:
</p>
<pre class="programlisting"><span class="special">;</span> <span class="identifier">A</span> <span class="identifier">comment</span>
<span class="identifier">key1</span> <span class="identifier">value1</span> <span class="special">;</span> <span class="identifier">Another</span> <span class="identifier">comment</span>
<span class="identifier">key2</span> <span class="string">"value with special characters in it {};#\n\t\"\0"</span>
<span class="special">{</span>
<span class="identifier">subkey</span> <span class="string">"value split "</span><span class="special">\</span>
<span class="string">"over three"</span><span class="special">\</span>
<span class="string">"lines"</span>
<span class="special">{</span>
<span class="identifier">a_key_without_value</span> <span class="string">""</span>
<span class="string">"a key with special characters in it {};#\n\t\"\0"</span> <span class="string">""</span>
<span class="string">""</span> <span class="identifier">value</span> <span class="special">;</span> <span class="identifier">Empty</span> <span class="identifier">key</span> <span class="identifier">with</span> <span class="identifier">a</span> <span class="identifier">value</span>
<span class="string">""</span> <span class="string">""</span> <span class="special">;</span> <span class="identifier">Empty</span> <span class="identifier">key</span> <span class="identifier">with</span> <span class="identifier">empty</span> <span class="identifier">value</span><span class="special">!</span>
<span class="special">}</span>
<span class="special">}</span>
<span class="preprocessor">#include</span> <span class="string">"file.info"</span> <span class="special">;</span> <span class="identifier">included</span> <span class="identifier">file</span>
</pre>
<p>
INFO round-trips except for the loss of comments and include directives.
</p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2008-2010 Marcin Kalicinski<br>Copyright © 2010-2013 Sebastian
Redl<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="synopsis.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../property_tree.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="accessing.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@@ -0,0 +1,266 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Reference</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../property_tree.html" title="Chapter 32. Boost.PropertyTree">
<link rel="prev" href="appendices.html" title="Appendices">
<link rel="next" href="../boost/property_tree/ptree_bad_data.html" title="Class ptree_bad_data">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="appendices.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../property_tree.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../boost/property_tree/ptree_bad_data.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="property_tree.reference"></a>Reference</h2></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="reference.html#header.boost.property_tree.exceptions_hpp">Header &lt;boost/property_tree/exceptions.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="reference.html#header.boost.property_tree.id_translator_hpp">Header &lt;boost/property_tree/id_translator.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="reference.html#header.boost.property_tree.info_parser_hpp">Header &lt;boost/property_tree/info_parser.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="reference.html#header.boost.property_tree.ini_parser_hpp">Header &lt;boost/property_tree/ini_parser.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="reference.html#header.boost.property_tree.json_parser_hpp">Header &lt;boost/property_tree/json_parser.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="reference.html#header.boost.property_tree.ptree_hpp">Header &lt;boost/property_tree/ptree.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="reference.html#header.boost.property_tree.ptree_fwd_hpp">Header &lt;boost/property_tree/ptree_fwd.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="reference.html#header.boost.property_tree.ptree_serialization_hpp">Header &lt;boost/property_tree/ptree_serialization.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="reference.html#header.boost.property_tree.stream_translator_hpp">Header &lt;boost/property_tree/stream_translator.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="reference.html#header.boost.property_tree.string_path_hpp">Header &lt;boost/property_tree/string_path.hpp&gt;</a></span></dt>
<dt><span class="section"><a href="reference.html#header.boost.property_tree.xml_parser_hpp">Header &lt;boost/property_tree/xml_parser.hpp&gt;</a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.property_tree.exceptions_hpp"></a>Header &lt;<a href="../../../boost/property_tree/exceptions.hpp" target="_top">boost/property_tree/exceptions.hpp</a>&gt;</h3></div></div></div>
<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">property_tree</span> <span class="special">{</span>
<span class="keyword">class</span> <a class="link" href="../boost/property_tree/ptree_bad_data.html" title="Class ptree_bad_data">ptree_bad_data</a><span class="special">;</span>
<span class="keyword">class</span> <a class="link" href="../boost/property_tree/ptree_bad_path.html" title="Class ptree_bad_path">ptree_bad_path</a><span class="special">;</span>
<span class="keyword">class</span> <a class="link" href="../boost/property_tree/ptree_error.html" title="Class ptree_error">ptree_error</a><span class="special">;</span>
<span class="special">}</span>
<span class="special">}</span></pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.property_tree.id_translator_hpp"></a>Header &lt;<a href="../../../boost/property_tree/id_translator.hpp" target="_top">boost/property_tree/id_translator.hpp</a>&gt;</h3></div></div></div>
<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">property_tree</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ch<span class="special">,</span> <span class="keyword">typename</span> Traits<span class="special">,</span> <span class="keyword">typename</span> Alloc<span class="special">&gt;</span>
<span class="keyword">struct</span> <a class="link" href="../boost/property_tree/translat_1_3_33_10_2_1_1_1.html" title="Struct template translator_between&lt;std::basic_string&lt; Ch, Traits, Alloc &gt;, std::basic_string&lt; Ch, Traits, Alloc &gt;&gt;">translator_between</a><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span> <span class="identifier">Ch</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">Alloc</span> <span class="special">&gt;</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span> <span class="identifier">Ch</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">Alloc</span> <span class="special">&gt;</span><span class="special">&gt;</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="keyword">struct</span> <a class="link" href="../boost/property_tree/translat_1_3_33_10_2_1_1_2.html" title="Struct template translator_between&lt;T, T&gt;">translator_between</a><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">T</span><span class="special">&gt;</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">}</span></pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.property_tree.info_parser_hpp"></a>Header &lt;<a href="../../../boost/property_tree/info_parser.hpp" target="_top">boost/property_tree/info_parser.hpp</a>&gt;</h3></div></div></div>
<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">property_tree</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">info_parser</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ptree<span class="special">,</span> <span class="keyword">typename</span> Ch<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/info_parser/read_i_1_3_33_10_3_1_1_1_1.html" title="Function template read_info"><span class="identifier">read_info</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_istream</span><span class="special">&lt;</span> <span class="identifier">Ch</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">Ptree</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ptree<span class="special">,</span> <span class="keyword">typename</span> Ch<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/info_parser/read_i_1_3_33_10_3_1_1_1_2.html" title="Function template read_info"><span class="identifier">read_info</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_istream</span><span class="special">&lt;</span> <span class="identifier">Ch</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">Ptree</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Ptree</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ptree<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/info_parser/read_i_1_3_33_10_3_1_1_1_3.html" title="Function template read_info"><span class="identifier">read_info</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">Ptree</span> <span class="special">&amp;</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ptree<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/info_parser/read_i_1_3_33_10_3_1_1_1_4.html" title="Function template read_info"><span class="identifier">read_info</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">Ptree</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Ptree</span> <span class="special">&amp;</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ptree<span class="special">,</span> <span class="keyword">typename</span> Ch<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/info_parser/write__1_3_33_10_3_1_1_1_5.html" title="Function template write_info"><span class="identifier">write_info</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_ostream</span><span class="special">&lt;</span> <span class="identifier">Ch</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Ptree</span> <span class="special">&amp;</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">info_writer_settings</span><span class="special">&lt;</span> <span class="identifier">Ch</span> <span class="special">&gt;</span> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">info_writer_settings</span><span class="special">&lt;</span> <span class="identifier">Ch</span> <span class="special">&gt;</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ptree<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/info_parser/write__1_3_33_10_3_1_1_1_6.html" title="Function template write_info"><span class="identifier">write_info</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Ptree</span> <span class="special">&amp;</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span><span class="special">(</span><span class="special">)</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">info_writer_settings</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">Ptree</span><span class="special">::</span><span class="identifier">key_type</span><span class="special">::</span><span class="identifier">value_type</span> <span class="special">&gt;</span> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">info_writer_make_settings</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">Ptree</span><span class="special">::</span><span class="identifier">key_type</span><span class="special">::</span><span class="identifier">value_type</span> <span class="special">&gt;</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">}</span>
<span class="special">}</span></pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.property_tree.ini_parser_hpp"></a>Header &lt;<a href="../../../boost/property_tree/ini_parser.hpp" target="_top">boost/property_tree/ini_parser.hpp</a>&gt;</h3></div></div></div>
<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">property_tree</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">ini_parser</span> <span class="special">{</span>
<span class="keyword">class</span> <a class="link" href="../boost/property_tree/ini_parser/ini_parser_error.html" title="Class ini_parser_error">ini_parser_error</a><span class="special">;</span>
<span class="keyword">bool</span> <a class="link" href="../boost/property_tree/ini_parser/validate_flags.html" title="Function validate_flags"><span class="identifier">validate_flags</span></a><span class="special">(</span><span class="keyword">int</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ptree<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/ini_parser/read_i_1_3_33_10_4_1_1_1_3.html" title="Function template read_ini"><span class="identifier">read_ini</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_istream</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">Ptree</span><span class="special">::</span><span class="identifier">key_type</span><span class="special">::</span><span class="identifier">value_type</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span>
<span class="identifier">Ptree</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ptree<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/ini_parser/read_i_1_3_33_10_4_1_1_1_4.html" title="Function template read_ini"><span class="identifier">read_ini</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">Ptree</span> <span class="special">&amp;</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ptree<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/ini_parser/write__1_3_33_10_4_1_1_1_5.html" title="Function template write_ini"><span class="identifier">write_ini</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_ostream</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">Ptree</span><span class="special">::</span><span class="identifier">key_type</span><span class="special">::</span><span class="identifier">value_type</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">Ptree</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">int</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ptree<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/ini_parser/write__1_3_33_10_4_1_1_1_6.html" title="Function template write_ini"><span class="identifier">write_ini</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Ptree</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">int</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">}</span>
<span class="special">}</span></pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.property_tree.json_parser_hpp"></a>Header &lt;<a href="../../../boost/property_tree/json_parser.hpp" target="_top">boost/property_tree/json_parser.hpp</a>&gt;</h3></div></div></div>
<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">property_tree</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">json_parser</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ptree<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/json_parser/read_j_1_3_33_10_5_1_1_1_1.html" title="Function template read_json"><span class="identifier">read_json</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_istream</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">Ptree</span><span class="special">::</span><span class="identifier">key_type</span><span class="special">::</span><span class="identifier">value_type</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span>
<span class="identifier">Ptree</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ptree<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/json_parser/read_j_1_3_33_10_5_1_1_1_2.html" title="Function template read_json"><span class="identifier">read_json</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">Ptree</span> <span class="special">&amp;</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ptree<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/json_parser/write__1_3_33_10_5_1_1_1_3.html" title="Function template write_json"><span class="identifier">write_json</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_ostream</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">Ptree</span><span class="special">::</span><span class="identifier">key_type</span><span class="special">::</span><span class="identifier">value_type</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">Ptree</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ptree<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/json_parser/write__1_3_33_10_5_1_1_1_4.html" title="Function template write_json"><span class="identifier">write_json</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Ptree</span> <span class="special">&amp;</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span><span class="special">(</span><span class="special">)</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">}</span>
<span class="special">}</span></pre>
</div>
<div class="section"><div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.property_tree.ptree_hpp"></a>Header &lt;<a href="../../../boost/property_tree/ptree.hpp" target="_top">boost/property_tree/ptree.hpp</a>&gt;</h3></div></div></div></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.property_tree.ptree_fwd_hpp"></a>Header &lt;<a href="../../../boost/property_tree/ptree_fwd.hpp" target="_top">boost/property_tree/ptree_fwd.hpp</a>&gt;</h3></div></div></div>
<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">property_tree</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Key<span class="special">,</span> <span class="keyword">typename</span> Data<span class="special">,</span> <span class="keyword">typename</span> KeyCompare<span class="special">&gt;</span>
<span class="keyword">class</span> <a class="link" href="../boost/property_tree/basic_ptree.html" title="Class template basic_ptree">basic_ptree</a><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="keyword">struct</span> <a class="link" href="../boost/property_tree/id_translator.html" title="Struct template id_translator">id_translator</a><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Key<span class="special">&gt;</span> <span class="keyword">struct</span> <a class="link" href="../boost/property_tree/path_of.html" title="Struct template path_of">path_of</a><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Internal<span class="special">,</span> <span class="keyword">typename</span> External<span class="special">&gt;</span> <span class="keyword">struct</span> <a class="link" href="../boost/property_tree/translator_between.html" title="Struct template translator_between">translator_between</a><span class="special">;</span>
<span class="keyword">typedef</span> <a class="link" href="../boost/property_tree/string_path.html" title="Class template string_path">string_path</a><span class="special">&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <a class="link" href="../boost/property_tree/id_translator.html" title="Struct template id_translator">id_translator</a><span class="special">&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&gt;</span> <span class="special">&gt;</span> <a class="link" href="../boost/property_tree/path.html" title="Type definition path"><span class="identifier">path</span></a><span class="special">;</span>
<span class="keyword">typedef</span> <a class="link" href="../boost/property_tree/basic_ptree.html" title="Class template basic_ptree">basic_ptree</a><span class="special">&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&gt;</span> <a class="link" href="../boost/property_tree/ptree.html" title="Type definition ptree"><span class="identifier">ptree</span></a><span class="special">;</span>
<span class="keyword">typedef</span> <span class="emphasis"><em><span class="identifier">unspecified</span></em></span> <a class="link" href="../boost/property_tree/iptree.html" title="Type definition iptree"><span class="identifier">iptree</span></a><span class="special">;</span>
<span class="keyword">typedef</span> <a class="link" href="../boost/property_tree/string_path.html" title="Class template string_path">string_path</a><span class="special">&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">wstring</span><span class="special">,</span> <a class="link" href="../boost/property_tree/id_translator.html" title="Struct template id_translator">id_translator</a><span class="special">&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">wstring</span> <span class="special">&gt;</span> <span class="special">&gt;</span> <a class="link" href="../boost/property_tree/wpath.html" title="Type definition wpath"><span class="identifier">wpath</span></a><span class="special">;</span>
<span class="keyword">typedef</span> <a class="link" href="../boost/property_tree/basic_ptree.html" title="Class template basic_ptree">basic_ptree</a><span class="special">&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">wstring</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">wstring</span> <span class="special">&gt;</span> <a class="link" href="../boost/property_tree/wptree.html" title="Type definition wptree"><span class="identifier">wptree</span></a><span class="special">;</span>
<span class="keyword">typedef</span> <span class="emphasis"><em><span class="identifier">unspecified</span></em></span> <a class="link" href="../boost/property_tree/wiptree.html" title="Type definition wiptree"><span class="identifier">wiptree</span></a><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> K<span class="special">,</span> <span class="keyword">typename</span> D<span class="special">,</span> <span class="keyword">typename</span> C<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/swap.html" title="Function template swap"><span class="identifier">swap</span></a><span class="special">(</span><a class="link" href="../boost/property_tree/basic_ptree.html" title="Class template basic_ptree">basic_ptree</a><span class="special">&lt;</span> <span class="identifier">K</span><span class="special">,</span> <span class="identifier">D</span><span class="special">,</span> <span class="identifier">C</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> <a class="link" href="../boost/property_tree/basic_ptree.html" title="Class template basic_ptree">basic_ptree</a><span class="special">&lt;</span> <span class="identifier">K</span><span class="special">,</span> <span class="identifier">D</span><span class="special">,</span> <span class="identifier">C</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">}</span></pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.property_tree.ptree_serialization_hpp"></a>Header &lt;<a href="../../../boost/property_tree/ptree_serialization.hpp" target="_top">boost/property_tree/ptree_serialization.hpp</a>&gt;</h3></div></div></div>
<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">property_tree</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Archive<span class="special">,</span> <span class="keyword">typename</span> K<span class="special">,</span> <span class="keyword">typename</span> D<span class="special">,</span> <span class="keyword">typename</span> C<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/save.html" title="Function template save"><span class="identifier">save</span></a><span class="special">(</span><span class="identifier">Archive</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../boost/property_tree/basic_ptree.html" title="Class template basic_ptree">basic_ptree</a><span class="special">&lt;</span> <span class="identifier">K</span><span class="special">,</span> <span class="identifier">D</span><span class="special">,</span> <span class="identifier">C</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Archive<span class="special">,</span> <span class="keyword">typename</span> K<span class="special">,</span> <span class="keyword">typename</span> D<span class="special">,</span> <span class="keyword">typename</span> C<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/load.html" title="Function template load"><span class="identifier">load</span></a><span class="special">(</span><span class="identifier">Archive</span> <span class="special">&amp;</span><span class="special">,</span> <a class="link" href="../boost/property_tree/basic_ptree.html" title="Class template basic_ptree">basic_ptree</a><span class="special">&lt;</span> <span class="identifier">K</span><span class="special">,</span> <span class="identifier">D</span><span class="special">,</span> <span class="identifier">C</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Archive<span class="special">,</span> <span class="keyword">typename</span> K<span class="special">,</span> <span class="keyword">typename</span> D<span class="special">,</span> <span class="keyword">typename</span> C<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/serialize.html" title="Function template serialize"><span class="identifier">serialize</span></a><span class="special">(</span><span class="identifier">Archive</span> <span class="special">&amp;</span><span class="special">,</span> <a class="link" href="../boost/property_tree/basic_ptree.html" title="Class template basic_ptree">basic_ptree</a><span class="special">&lt;</span> <span class="identifier">K</span><span class="special">,</span> <span class="identifier">D</span><span class="special">,</span> <span class="identifier">C</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">}</span></pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.property_tree.stream_translator_hpp"></a>Header &lt;<a href="../../../boost/property_tree/stream_translator.hpp" target="_top">boost/property_tree/stream_translator.hpp</a>&gt;</h3></div></div></div>
<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">property_tree</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ch<span class="special">,</span> <span class="keyword">typename</span> Traits<span class="special">,</span> <span class="keyword">typename</span> E<span class="special">,</span>
<span class="keyword">typename</span> Enabler <span class="special">=</span> <span class="keyword">void</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <a class="link" href="../boost/property_tree/customize_stream.html" title="Struct template customize_stream">customize_stream</a><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ch<span class="special">,</span> <span class="keyword">typename</span> Traits<span class="special">&gt;</span>
<span class="keyword">struct</span> <a class="link" href="../boost/property_tree/customiz_1_3_33_10_9_1_1_2.html" title="Struct template customize_stream&lt;Ch, Traits, bool, void&gt;">customize_stream</a><span class="special">&lt;</span><span class="identifier">Ch</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">,</span> <span class="keyword">void</span><span class="special">&gt;</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ch<span class="special">,</span> <span class="keyword">typename</span> Traits<span class="special">&gt;</span>
<span class="keyword">struct</span> <a class="link" href="../boost/property_tree/customiz_1_3_33_10_9_1_1_3.html" title="Struct template customize_stream&lt;Ch, Traits, Ch, void&gt;">customize_stream</a><span class="special">&lt;</span><span class="identifier">Ch</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">Ch</span><span class="special">,</span> <span class="keyword">void</span><span class="special">&gt;</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ch<span class="special">,</span> <span class="keyword">typename</span> Traits<span class="special">,</span> <span class="keyword">typename</span> F<span class="special">&gt;</span>
<span class="keyword">struct</span> <a class="link" href="../boost/property_tree/customiz_1_3_33_10_9_1_1_4.html" title="Struct template customize_stream&lt;Ch, Traits, F, typename boost::enable_if&lt; detail::is_inexact&lt; F &gt; &gt;::type&gt;">customize_stream</a><span class="special">&lt;</span><span class="identifier">Ch</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">F</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">enable_if</span><span class="special">&lt;</span> <span class="identifier">detail</span><span class="special">::</span><span class="identifier">is_inexact</span><span class="special">&lt;</span> <span class="identifier">F</span> <span class="special">&gt;</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span><span class="special">&gt;</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ch<span class="special">,</span> <span class="keyword">typename</span> Traits<span class="special">&gt;</span>
<span class="keyword">struct</span> <a class="link" href="../boost/property_tree/customiz_1_3_33_10_9_1_1_5.html" title="Struct template customize_stream&lt;Ch, Traits, signed char, void&gt;">customize_stream</a><span class="special">&lt;</span><span class="identifier">Ch</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">signed</span> <span class="keyword">char</span><span class="special">,</span> <span class="keyword">void</span><span class="special">&gt;</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ch<span class="special">,</span> <span class="keyword">typename</span> Traits<span class="special">&gt;</span>
<span class="keyword">struct</span> <a class="link" href="../boost/property_tree/customiz_1_3_33_10_9_1_1_6.html" title="Struct template customize_stream&lt;Ch, Traits, unsigned char, void&gt;">customize_stream</a><span class="special">&lt;</span><span class="identifier">Ch</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">char</span><span class="special">,</span> <span class="keyword">void</span><span class="special">&gt;</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ch<span class="special">,</span> <span class="keyword">typename</span> Traits<span class="special">,</span> <span class="keyword">typename</span> Alloc<span class="special">,</span> <span class="keyword">typename</span> E<span class="special">&gt;</span>
<span class="keyword">class</span> <a class="link" href="../boost/property_tree/stream_translator.html" title="Class template stream_translator">stream_translator</a><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ch<span class="special">,</span> <span class="keyword">typename</span> Traits<span class="special">,</span> <span class="keyword">typename</span> Alloc<span class="special">,</span> <span class="keyword">typename</span> E<span class="special">&gt;</span>
<span class="keyword">struct</span> <a class="link" href="../boost/property_tree/translat_1_3_33_10_9_1_1_8.html" title="Struct template translator_between&lt;std::basic_string&lt; Ch, Traits, Alloc &gt;, E&gt;">translator_between</a><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span> <span class="identifier">Ch</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">Alloc</span> <span class="special">&gt;</span><span class="special">,</span> <span class="identifier">E</span><span class="special">&gt;</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">}</span></pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.property_tree.string_path_hpp"></a>Header &lt;<a href="../../../boost/property_tree/string_path.hpp" target="_top">boost/property_tree/string_path.hpp</a>&gt;</h3></div></div></div>
<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">property_tree</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ch<span class="special">,</span> <span class="keyword">typename</span> Traits<span class="special">,</span> <span class="keyword">typename</span> Alloc<span class="special">&gt;</span>
<span class="keyword">struct</span> <a class="link" href="../boost/property_tree/path_of_1_3_33_10_10_1_1_1.html" title="Struct template path_of&lt;std::basic_string&lt; Ch, Traits, Alloc &gt;&gt;">path_of</a><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span> <span class="identifier">Ch</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">Alloc</span> <span class="special">&gt;</span><span class="special">&gt;</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> String<span class="special">,</span> <span class="keyword">typename</span> Translator<span class="special">&gt;</span> <span class="keyword">class</span> <a class="link" href="../boost/property_tree/string_path.html" title="Class template string_path">string_path</a><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> String<span class="special">,</span> <span class="keyword">typename</span> Translator<span class="special">&gt;</span>
<a class="link" href="../boost/property_tree/string_path.html" title="Class template string_path">string_path</a><span class="special">&lt;</span> <span class="identifier">String</span><span class="special">,</span> <span class="identifier">Translator</span> <span class="special">&gt;</span>
<a name="boost.property_tree.operato_1_3_33_10_10_1_1_3"></a><span class="keyword">operator</span><span class="special">/</span><span class="special">(</span><a class="link" href="../boost/property_tree/string_path.html" title="Class template string_path">string_path</a><span class="special">&lt;</span> <span class="identifier">String</span><span class="special">,</span> <span class="identifier">Translator</span> <span class="special">&gt;</span> p1<span class="special">,</span>
<span class="keyword">const</span> <a class="link" href="../boost/property_tree/string_path.html" title="Class template string_path">string_path</a><span class="special">&lt;</span> <span class="identifier">String</span><span class="special">,</span> <span class="identifier">Translator</span> <span class="special">&gt;</span> <span class="special">&amp;</span> p2<span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> String<span class="special">,</span> <span class="keyword">typename</span> Translator<span class="special">&gt;</span>
<a class="link" href="../boost/property_tree/string_path.html" title="Class template string_path">string_path</a><span class="special">&lt;</span> <span class="identifier">String</span><span class="special">,</span> <span class="identifier">Translator</span> <span class="special">&gt;</span>
<a name="boost.property_tree.operato_1_3_33_10_10_1_1_4"></a><span class="keyword">operator</span><span class="special">/</span><span class="special">(</span><a class="link" href="../boost/property_tree/string_path.html" title="Class template string_path">string_path</a><span class="special">&lt;</span> <span class="identifier">String</span><span class="special">,</span> <span class="identifier">Translator</span> <span class="special">&gt;</span> p1<span class="special">,</span>
<span class="keyword">const</span> <span class="keyword">typename</span> <span class="identifier">String</span><span class="special">::</span><span class="identifier">value_type</span> <span class="special">*</span> p2<span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> String<span class="special">,</span> <span class="keyword">typename</span> Translator<span class="special">&gt;</span>
<a class="link" href="../boost/property_tree/string_path.html" title="Class template string_path">string_path</a><span class="special">&lt;</span> <span class="identifier">String</span><span class="special">,</span> <span class="identifier">Translator</span> <span class="special">&gt;</span>
<a name="boost.property_tree.operato_1_3_33_10_10_1_1_5"></a><span class="keyword">operator</span><span class="special">/</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">typename</span> <span class="identifier">String</span><span class="special">::</span><span class="identifier">value_type</span> <span class="special">*</span> p1<span class="special">,</span>
<span class="keyword">const</span> <a class="link" href="../boost/property_tree/string_path.html" title="Class template string_path">string_path</a><span class="special">&lt;</span> <span class="identifier">String</span><span class="special">,</span> <span class="identifier">Translator</span> <span class="special">&gt;</span> <span class="special">&amp;</span> p2<span class="special">)</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">}</span></pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.property_tree.xml_parser_hpp"></a>Header &lt;<a href="../../../boost/property_tree/xml_parser.hpp" target="_top">boost/property_tree/xml_parser.hpp</a>&gt;</h3></div></div></div>
<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">property_tree</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">xml_parser</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ptree<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/xml_parser/read__1_3_33_10_11_1_1_1_1.html" title="Function template read_xml"><span class="identifier">read_xml</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_istream</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">Ptree</span><span class="special">::</span><span class="identifier">key_type</span><span class="special">::</span><span class="identifier">value_type</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span>
<span class="identifier">Ptree</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">int</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ptree<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/xml_parser/read__1_3_33_10_11_1_1_1_2.html" title="Function template read_xml"><span class="identifier">read_xml</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">Ptree</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">int</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ptree<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/xml_parser/write_1_3_33_10_11_1_1_1_3.html" title="Function template write_xml"><span class="identifier">write_xml</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_ostream</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">Ptree</span><span class="special">::</span><span class="identifier">key_type</span><span class="special">::</span><span class="identifier">value_type</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">Ptree</span> <span class="special">&amp;</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">xml_writer_settings</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">Ptree</span><span class="special">::</span><span class="identifier">key_type</span> <span class="special">&gt;</span> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">xml_writer_settings</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">Ptree</span><span class="special">::</span><span class="identifier">key_type</span> <span class="special">&gt;</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Ptree<span class="special">&gt;</span>
<span class="keyword">void</span> <a class="link" href="../boost/property_tree/xml_parser/write_1_3_33_10_11_1_1_1_4.html" title="Function template write_xml"><span class="identifier">write_xml</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Ptree</span> <span class="special">&amp;</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span><span class="special">(</span><span class="special">)</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">xml_writer_settings</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">Ptree</span><span class="special">::</span><span class="identifier">key_type</span> <span class="special">&gt;</span> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">xml_writer_settings</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">Ptree</span><span class="special">::</span><span class="identifier">key_type</span> <span class="special">&gt;</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">}</span>
<span class="special">}</span></pre>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2008-2010 Marcin Kalicinski<br>Copyright © 2010-2013 Sebastian
Redl<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="appendices.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../property_tree.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../boost/property_tree/ptree_bad_data.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@@ -0,0 +1,65 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Property Tree Synopsis</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../property_tree.html" title="Chapter 32. Boost.PropertyTree">
<link rel="prev" href="container.html" title="Property Tree as a Container">
<link rel="next" href="parsers.html" title="How to Populate a Property Tree">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="container.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../property_tree.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="parsers.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="property_tree.synopsis"></a><a class="link" href="synopsis.html" title="Property Tree Synopsis">Property Tree Synopsis</a>
</h2></div></div></div>
<p>
The central component of the library is the <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html" title="Class template basic_ptree">basic_ptree</a></code>
class template. Instances of this class are property trees. It is parametrized
on key and data type, and key comparison policy; <code class="computeroutput"><a class="link" href="../boost/property_tree/ptree.html" title="Type definition ptree">ptree</a></code>,
<code class="computeroutput"><a class="link" href="../boost/property_tree/wptree.html" title="Type definition wptree">wptree</a></code>, <code class="computeroutput"><a class="link" href="../boost/property_tree/iptree.html" title="Type definition iptree">iptree</a></code> and <code class="computeroutput"><a class="link" href="../boost/property_tree/wiptree.html" title="Type definition wiptree">wiptree</a></code>
are typedefs of <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html" title="Class template basic_ptree">basic_ptree</a></code>
using predefined combinations of template parameters. Property tree is basically
a somewhat simplified standard container (the closest being std::list), plus
a bunch of extra member functions. These functions allow easy and effective
access to the data stored in property tree. They are various variants of <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_63-bb">get</a></code>, <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_71-bb">put</a></code>, <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_53-bb">get_value</a></code>,
<code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_61-bb">put_value</a></code>,
<code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_45-bb">get_child</a></code>,
<code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_51-bb">put_child</a></code>.
Additionally, there is a <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html#id-1_3_33_10_7_1_1_1_3_42-bb">data</a></code>
function to access node data directly.
</p>
<p>
See the <code class="computeroutput"><a class="link" href="../boost/property_tree/basic_ptree.html" title="Class template basic_ptree">basic_ptree class
template synopsis</a></code> for more information.
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2008-2010 Marcin Kalicinski<br>Copyright © 2010-2013 Sebastian
Redl<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="container.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../property_tree.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="parsers.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>

View File

@@ -0,0 +1,154 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Five Minute Tutorial</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../property_tree.html" title="Chapter 32. Boost.PropertyTree">
<link rel="prev" href="../property_tree.html" title="Chapter 32. Boost.PropertyTree">
<link rel="next" href="container.html" title="Property Tree as a Container">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../property_tree.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../property_tree.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="container.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="property_tree.tutorial"></a><a class="link" href="tutorial.html" title="Five Minute Tutorial">Five Minute Tutorial</a>
</h2></div></div></div>
<p>
This tutorial uses XML. Note that the library is not specifically bound to
XML, and any other supported format (such as INI or JSON) could be used instead.
XML was chosen because the author thinks that a wide range of people is familiar
with it.
</p>
<p>
Suppose we are writing a logging system for some application, and need to read
log configuration from a file when the program starts. The file with the log
configuration looks like this:
</p>
<pre class="programlisting">&lt;debug&gt;
&lt;filename&gt;debug.log&lt;/filename&gt;
&lt;modules&gt;
&lt;module&gt;Finance&lt;/module&gt;
&lt;module&gt;Admin&lt;/module&gt;
&lt;module&gt;HR&lt;/module&gt;
&lt;/modules&gt;
&lt;level&gt;2&lt;/level&gt;
&lt;/debug&gt;
</pre>
<p>
It contains the log filename, a list of modules where logging is enabled, and
the debug level value.
</p>
<p>
First we need some includes:
</p>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">property_tree</span><span class="special">/</span><span class="identifier">ptree</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">property_tree</span><span class="special">/</span><span class="identifier">xml_parser</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">foreach</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">string</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">set</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">exception</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span>
<span class="keyword">namespace</span> <span class="identifier">pt</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_tree</span><span class="special">;</span>
</pre>
<p>
To store the logging configuration in the program we create a debug_settings
structure:
</p>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">debug_settings</span>
<span class="special">{</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">m_file</span><span class="special">;</span> <span class="comment">// log filename</span>
<span class="keyword">int</span> <span class="identifier">m_level</span><span class="special">;</span> <span class="comment">// debug level</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&gt;</span> <span class="identifier">m_modules</span><span class="special">;</span> <span class="comment">// modules where logging is enabled</span>
<span class="keyword">void</span> <span class="identifier">load</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span><span class="identifier">filename</span><span class="special">);</span>
<span class="keyword">void</span> <span class="identifier">save</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span><span class="identifier">filename</span><span class="special">);</span>
<span class="special">};</span>
</pre>
<p>
All that needs to be done now is to write implementations of load() and save()
member functions. Let's first deal with load(). It contains just 7 lines of
code, although it does all the necessary things, including error reporting:
</p>
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">debug_settings</span><span class="special">::</span><span class="identifier">load</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span><span class="identifier">filename</span><span class="special">)</span>
<span class="special">{</span>
<span class="comment">// Create empty property tree object</span>
<span class="identifier">pt</span><span class="special">::</span><span class="identifier">ptree</span> <span class="identifier">tree</span><span class="special">;</span>
<span class="comment">// Parse the XML into the property tree.</span>
<span class="identifier">pt</span><span class="special">::</span><span class="identifier">read_xml</span><span class="special">(</span><span class="identifier">filename</span><span class="special">,</span> <span class="identifier">tree</span><span class="special">);</span>
<span class="comment">// Use the throwing version of get to find the debug filename.</span>
<span class="comment">// If the path cannot be resolved, an exception is thrown.</span>
<span class="identifier">m_file</span> <span class="special">=</span> <span class="identifier">tree</span><span class="special">.</span><span class="identifier">get</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&gt;(</span><span class="string">"debug.filename"</span><span class="special">);</span>
<span class="comment">// Use the default-value version of get to find the debug level.</span>
<span class="comment">// Note that the default value is used to deduce the target type.</span>
<span class="identifier">m_level</span> <span class="special">=</span> <span class="identifier">tree</span><span class="special">.</span><span class="identifier">get</span><span class="special">(</span><span class="string">"debug.level"</span><span class="special">,</span> <span class="number">0</span><span class="special">);</span>
<span class="comment">// Use get_child to find the node containing the modules, and iterate over</span>
<span class="comment">// its children. If the path cannot be resolved, get_child throws.</span>
<span class="comment">// A C++11 for-range loop would also work.</span>
<span class="identifier">BOOST_FOREACH</span><span class="special">(</span><span class="identifier">pt</span><span class="special">::</span><span class="identifier">ptree</span><span class="special">::</span><span class="identifier">value_type</span> <span class="special">&amp;</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">tree</span><span class="special">.</span><span class="identifier">get_child</span><span class="special">(</span><span class="string">"debug.modules"</span><span class="special">))</span> <span class="special">{</span>
<span class="comment">// The data function is used to access the data stored in a node.</span>
<span class="identifier">m_modules</span><span class="special">.</span><span class="identifier">insert</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">second</span><span class="special">.</span><span class="identifier">data</span><span class="special">());</span>
<span class="special">}</span>
<span class="special">}</span>
</pre>
<p>
Now the save() function. It is also 7 lines of code:
</p>
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">debug_settings</span><span class="special">::</span><span class="identifier">save</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span><span class="identifier">filename</span><span class="special">)</span>
<span class="special">{</span>
<span class="comment">// Create an empty property tree object.</span>
<span class="identifier">pt</span><span class="special">::</span><span class="identifier">ptree</span> <span class="identifier">tree</span><span class="special">;</span>
<span class="comment">// Put the simple values into the tree. The integer is automatically</span>
<span class="comment">// converted to a string. Note that the "debug" node is automatically</span>
<span class="comment">// created if it doesn't exist.</span>
<span class="identifier">tree</span><span class="special">.</span><span class="identifier">put</span><span class="special">(</span><span class="string">"debug.filename"</span><span class="special">,</span> <span class="identifier">m_file</span><span class="special">);</span>
<span class="identifier">tree</span><span class="special">.</span><span class="identifier">put</span><span class="special">(</span><span class="string">"debug.level"</span><span class="special">,</span> <span class="identifier">m_level</span><span class="special">);</span>
<span class="comment">// Add all the modules. Unlike put, which overwrites existing nodes, add</span>
<span class="comment">// adds a new node at the lowest level, so the "modules" node will have</span>
<span class="comment">// multiple "module" children.</span>
<span class="identifier">BOOST_FOREACH</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span><span class="identifier">name</span><span class="special">,</span> <span class="identifier">m_modules</span><span class="special">)</span>
<span class="identifier">tree</span><span class="special">.</span><span class="identifier">add</span><span class="special">(</span><span class="string">"debug.modules.module"</span><span class="special">,</span> <span class="identifier">name</span><span class="special">);</span>
<span class="comment">// Write property tree to XML file</span>
<span class="identifier">pt</span><span class="special">::</span><span class="identifier">write_xml</span><span class="special">(</span><span class="identifier">filename</span><span class="special">,</span> <span class="identifier">tree</span><span class="special">);</span>
<span class="special">}</span>
</pre>
<p>
The full program <a href="../../../libs/property_tree/examples/debug_settings.cpp" target="_top">debug_settings.cpp</a>
is included in the examples directory.
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2008-2010 Marcin Kalicinski<br>Copyright © 2010-2013 Sebastian
Redl<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../property_tree.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../property_tree.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="container.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>