1 # Properties |
1 # Properties |
2 |
2 |
3 The UCX properties parser can be used to parse line-separated key/value strings. |
3 The UCX properties parser can be used to parse line based key/value strings. |
4 |
4 |
5 <warning> |
5 <warning> |
6 New Feature - documentation work in progress! |
6 New Feature - documentation work in progress! |
7 </warning> |
7 </warning> |
8 |
8 |
|
9 ## Supported Syntax |
|
10 |
|
11 Key/value pairs must be line based and separated by a single character delimter. |
|
12 The parser supports up to three different characters which introduce comments. |
|
13 All characters starting with a comment character up to the end of the line are ignored. |
|
14 Blank lines are also ignored. |
|
15 |
|
16 An example properties file looks like this: |
|
17 |
|
18 ```properties |
|
19 # Comment line at start of file |
|
20 key1 = value1 |
|
21 key2 = value2 |
|
22 # next is a blank line and will be ignored |
|
23 |
|
24 keys_are_trimmed = and_so_are_values # also a comment |
|
25 ``` |
|
26 |
|
27 > Delimiter and comment characters are configured with the `CxPropertiesConfig` structure. |
|
28 > There is also a field reserved for `continuation` which will be used as a line continuation character |
|
29 > in a future version of UCX. |
|
30 > In UCX 3.1 this is not implemented. |
9 |
31 |
10 ## Basic Parsing |
32 ## Basic Parsing |
11 |
33 |
12 ```C |
34 ```C |
13 #include <cx/properties.h> |
35 #include <cx/properties.h> |