Brian Silverman | 836e90c | 2018-08-04 16:19:46 -0700 | [diff] [blame^] | 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 INFO Parser] |
| 9 | The INFO format was created specifically for the property tree library. It |
| 10 | provides a simple, efficient format that can be used to serialize property |
| 11 | trees that are otherwise only stored in memory. It can also be used for any |
| 12 | other purpose, although the lack of widespread existing use may prove to be an |
| 13 | impediment. |
| 14 | |
| 15 | INFO provides several features that make it familiar to C++ programmers and |
| 16 | efficient for medium-sized datasets, especially those used for test input. It |
| 17 | supports C-style character escapes, nesting via curly braces, and file inclusion |
| 18 | via #include. |
| 19 | |
| 20 | INFO is also used for visualization of property trees in this documentation. |
| 21 | |
| 22 | A typical INFO file might look like this: |
| 23 | |
| 24 | key1 value1 |
| 25 | key2 |
| 26 | { |
| 27 | key3 value3 |
| 28 | { |
| 29 | key4 "value4 with spaces" |
| 30 | } |
| 31 | key5 value5 |
| 32 | } |
| 33 | |
| 34 | Here's a more complicated file demonstrating all of INFO's features: |
| 35 | |
| 36 | ; A comment |
| 37 | key1 value1 ; Another comment |
| 38 | key2 "value with special characters in it {};#\n\t\"\0" |
| 39 | { |
| 40 | subkey "value split "\ |
| 41 | "over three"\ |
| 42 | "lines" |
| 43 | { |
| 44 | a_key_without_value "" |
| 45 | "a key with special characters in it {};#\n\t\"\0" "" |
| 46 | "" value ; Empty key with a value |
| 47 | "" "" ; Empty key with empty value! |
| 48 | } |
| 49 | } |
| 50 | #include "file.info" ; included file |
| 51 | |
| 52 | INFO round-trips except for the loss of comments and include directives. |
| 53 | |
| 54 | [endsect] [/info_parser] |