]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | [/ |
2 | / Copyright (c) 2008 Marcin Kalicinski (kalita <at> poczta dot onet dot pl) | |
3 | / Copyright (c) 2009 Sebastian Redl (sebastian dot redl <at> getdesigned dot at) | |
4 | / | |
5 | / Distributed under the Boost Software License, Version 1.0. (See accompanying | |
6 | / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
7 | /] | |
8 | [template ptree2codeImage[] [$images/ptree2code.png]] | |
9 | [section:intro What is Property Tree?] | |
10 | The Property Tree library provides a data structure that stores an arbitrarily | |
11 | deeply nested tree of values, indexed at each level by some key. Each node of | |
12 | the tree stores its own value, plus an ordered list of its subnodes and their | |
13 | keys. The tree allows easy access to any of its nodes by means of a path, which | |
14 | is a concatenation of multiple keys. | |
15 | ||
16 | In addition, the library provides parsers and generators for a number of data | |
17 | formats that can be represented by such a tree, including XML, INI, and JSON. | |
18 | ||
19 | Property trees are versatile data structures, but are particularly suited for | |
20 | holding configuration data. The tree provides its own, tree-specific interface, | |
21 | and each node is also an STL-compatible Sequence for its child nodes. | |
22 | ||
23 | Conceptually, then, a node can be thought of as the following structure: | |
24 | ||
25 | struct ptree | |
26 | { | |
27 | data_type data; // data associated with the node | |
28 | list< pair<key_type, ptree> > children; // ordered list of named children | |
29 | }; | |
30 | ||
31 | Both key_type and data_type are configurable to some extent, but will usually be | |
32 | std::string or std::wstring, and the parsers only work with this kind of tree. | |
33 | ||
34 | Many software projects develop a similar tool at some point of their lifetime, | |
35 | and property tree originated the same way. We hope the library can save many | |
36 | from reinventing the wheel. | |
37 | [endsect] [/intro] |