]>
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 | [section INI Parser] | |
9 | [def __ini__ [@http://en.wikipedia.org/wiki/INI INI format]] | |
10 | The __ini__ was once widely used in the world of Windows. It is now deprecated, | |
11 | but is still used by a surprisingly large number of applications. The reason is | |
12 | probably its simplicity, plus that Microsoft recommends using the registry as | |
13 | a replacement, which not all developers want to do. | |
14 | ||
15 | INI is a simple key-value format with a single level of sectioning. It is thus | |
16 | less rich than the property tree dataset, which means that not all property | |
17 | trees can be serialized as INI files. | |
18 | ||
19 | The INI parser creates a tree node for every section, and a child node for | |
20 | every property in that section. All properties not in a section are directly | |
21 | added to the root node. Empty sections are ignored. (They don't round-trip, as | |
22 | described below.) | |
23 | ||
24 | The INI serializer reverses this process. It first writes out every child of the | |
25 | root that contains data, but no child nodes, as properties. Then it creates a | |
26 | section for every child that contains child nodes, but no data. The children of | |
27 | the sections must only contain data. It is an error if the root node contains | |
28 | data, or any child of the root contains both data and content, or there's more | |
29 | than three levels of hierarchy. There must also not be any duplicate keys. | |
30 | ||
31 | An empty tree node is assumed to be an empty property. There is no way to create | |
32 | empty sections. | |
33 | ||
34 | Since the Windows INI parser discards trailing spaces and does not support | |
35 | quoting, the property tree parser follows this example. This means that | |
36 | property values containing trailing spaces do not round-trip. | |
37 | [endsect] [/ini_parser] |