1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<head> 4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5<title>Chapter 31. Boost.PropertyTree</title> 6<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css"> 7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 8<link rel="home" href="index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> 9<link rel="up" href="libraries.html" title="Part I. The Boost C++ Libraries (BoostBook Subset)"> 10<link rel="prev" href="BOOST_PROGRA_1_3_31_9_12_2.html" title="Macro BOOST_PROGRAM_OPTIONS_IMPLICIT_VALUE_NEXT_TOKEN"> 11<link rel="next" href="property_tree/tutorial.html" title="Five Minute Tutorial"> 12</head> 13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 14<table cellpadding="2" width="100%"><tr> 15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../boost.png"></td> 16<td align="center"><a href="../../index.html">Home</a></td> 17<td align="center"><a href="../../libs/libraries.htm">Libraries</a></td> 18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 20<td align="center"><a href="../../more/index.htm">More</a></td> 21</tr></table> 22<hr> 23<div class="spirit-nav"> 24<a accesskey="p" href="BOOST_PROGRA_1_3_31_9_12_2.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.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="property_tree/tutorial.html"><img src="../../doc/src/images/next.png" alt="Next"></a> 25</div> 26<div class="chapter"> 27<div class="titlepage"><div> 28<div><h2 class="title"> 29<a name="property_tree"></a>Chapter 31. Boost.PropertyTree</h2></div> 30<div><div class="author"><h3 class="author"> 31<span class="firstname">Marcin</span> <span class="surname">Kalicinski</span> 32</h3></div></div> 33<div><div class="author"><h3 class="author"> 34<span class="firstname">Sebastian</span> <span class="surname">Redl</span> 35</h3></div></div> 36<div><p class="copyright">Copyright © 2008-2010 Marcin Kalicinski</p></div> 37<div><p class="copyright">Copyright © 2010-2013 Sebastian 38 Redl</p></div> 39<div><div class="legalnotice"> 40<a name="property_tree.legal"></a><p> 41 Distributed under the Boost Software License, Version 1.0. (See accompanying 42 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>) 43 </p> 44</div></div> 45</div></div> 46<div class="toc"> 47<p><b>Table of Contents</b></p> 48<dl class="toc"> 49<dt><span class="section"><a href="property_tree.html#property_tree.intro">What is Property Tree?</a></span></dt> 50<dt><span class="section"><a href="property_tree/tutorial.html">Five Minute Tutorial</a></span></dt> 51<dt><span class="section"><a href="property_tree/container.html">Property Tree as a Container</a></span></dt> 52<dt><span class="section"><a href="property_tree/synopsis.html">Property Tree Synopsis</a></span></dt> 53<dt><span class="section"><a href="property_tree/parsers.html">How to Populate a Property Tree</a></span></dt> 54<dd><dl> 55<dt><span class="section"><a href="property_tree/parsers.html#property_tree.parsers.xml_parser">XML Parser</a></span></dt> 56<dt><span class="section"><a href="property_tree/parsers.html#property_tree.parsers.json_parser">JSON Parser</a></span></dt> 57<dt><span class="section"><a href="property_tree/parsers.html#property_tree.parsers.ini_parser">INI Parser</a></span></dt> 58<dt><span class="section"><a href="property_tree/parsers.html#property_tree.parsers.info_parser">INFO Parser</a></span></dt> 59</dl></dd> 60<dt><span class="section"><a href="property_tree/accessing.html">How to Access Data in a Property 61 Tree</a></span></dt> 62<dt><span class="section"><a href="property_tree/appendices.html">Appendices</a></span></dt> 63<dt><span class="section"><a href="property_tree/reference.html">Reference</a></span></dt> 64<dd><dl> 65<dt><span class="section"><a href="property_tree/reference.html#header.boost.property_tree.exceptions_hpp">Header <boost/property_tree/exceptions.hpp></a></span></dt> 66<dt><span class="section"><a href="property_tree/reference.html#header.boost.property_tree.id_translator_hpp">Header <boost/property_tree/id_translator.hpp></a></span></dt> 67<dt><span class="section"><a href="property_tree/reference.html#header.boost.property_tree.info_parser_hpp">Header <boost/property_tree/info_parser.hpp></a></span></dt> 68<dt><span class="section"><a href="property_tree/reference.html#header.boost.property_tree.ini_parser_hpp">Header <boost/property_tree/ini_parser.hpp></a></span></dt> 69<dt><span class="section"><a href="property_tree/reference.html#header.boost.property_tree.json_parser_hpp">Header <boost/property_tree/json_parser.hpp></a></span></dt> 70<dt><span class="section"><a href="property_tree/reference.html#header.boost.property_tree.ptree_hpp">Header <boost/property_tree/ptree.hpp></a></span></dt> 71<dt><span class="section"><a href="property_tree/reference.html#header.boost.property_tree.ptree_fwd_hpp">Header <boost/property_tree/ptree_fwd.hpp></a></span></dt> 72<dt><span class="section"><a href="property_tree/reference.html#header.boost.property_tree.ptree_serialization_hpp">Header <boost/property_tree/ptree_serialization.hpp></a></span></dt> 73<dt><span class="section"><a href="property_tree/reference.html#header.boost.property_tree.stream_translator_hpp">Header <boost/property_tree/stream_translator.hpp></a></span></dt> 74<dt><span class="section"><a href="property_tree/reference.html#header.boost.property_tree.string_path_hpp">Header <boost/property_tree/string_path.hpp></a></span></dt> 75<dt><span class="section"><a href="property_tree/reference.html#header.boost.property_tree.xml_parser_hpp">Header <boost/property_tree/xml_parser.hpp></a></span></dt> 76</dl></dd> 77</dl> 78</div> 79<div class="section"> 80<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 81<a name="property_tree.intro"></a><a class="link" href="property_tree.html#property_tree.intro" title="What is Property Tree?">What is Property Tree?</a> 82</h2></div></div></div> 83<p> 84 The Property Tree library provides a data structure that stores an arbitrarily 85 deeply nested tree of values, indexed at each level by some key. Each node 86 of the tree stores its own value, plus an ordered list of its subnodes and 87 their keys. The tree allows easy access to any of its nodes by means of a path, 88 which is a concatenation of multiple keys. 89 </p> 90<p> 91 In addition, the library provides parsers and generators for a number of data 92 formats that can be represented by such a tree, including XML, INI, and JSON. 93 </p> 94<p> 95 Property trees are versatile data structures, but are particularly suited for 96 holding configuration data. The tree provides its own, tree-specific interface, 97 and each node is also an STL-compatible Sequence for its child nodes. 98 </p> 99<p> 100 Conceptually, then, a node can be thought of as the following structure: 101 </p> 102<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">ptree</span> 103<span class="special">{</span> 104 <span class="identifier">data_type</span> <span class="identifier">data</span><span class="special">;</span> <span class="comment">// data associated with the node</span> 105 <span class="identifier">list</span><span class="special"><</span> <span class="identifier">pair</span><span class="special"><</span><span class="identifier">key_type</span><span class="special">,</span> <span class="identifier">ptree</span><span class="special">></span> <span class="special">></span> <span class="identifier">children</span><span class="special">;</span> <span class="comment">// ordered list of named children</span> 106<span class="special">};</span> 107</pre> 108<p> 109 Both key_type and data_type are configurable to some extent, but will usually 110 be std::string or std::wstring, and the parsers only work with this kind of 111 tree. 112 </p> 113<p> 114 Many software projects develop a similar tool at some point of their lifetime, 115 and property tree originated the same way. We hope the library can save many 116 from reinventing the wheel. 117 </p> 118</div> 119</div> 120<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 121<td align="left"><p><small>Last revised: August 11, 2020 at 15:03:11 GMT</small></p></td> 122<td align="right"><div class="copyright-footer"></div></td> 123</tr></table> 124<hr> 125<div class="spirit-nav"> 126<a accesskey="p" href="BOOST_PROGRA_1_3_31_9_12_2.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.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="property_tree/tutorial.html"><img src="../../doc/src/images/next.png" alt="Next"></a> 127</div> 128</body> 129</html> 130