Sun, 07 Dec 2025 15:34:46 +0100
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
resolves #610
|
1143
0559812df10c
assign proper names to the documentation topics
Mike Becker <universe@uap-core.de>
parents:
1142
diff
changeset
|
1 | # Properties |
|
1142
9437530176bc
add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents:
1141
diff
changeset
|
2 | |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1420
diff
changeset
|
3 | The UCX properties parser can be used to parse line-based key/value strings. |
|
1229
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
4 | |
|
1230
3ec9cce0de01
add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents:
1229
diff
changeset
|
5 | ## Supported Syntax |
|
3ec9cce0de01
add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents:
1229
diff
changeset
|
6 | |
|
1420
c6f55a2b3495
fix various typos in the web documentation
Mike Becker <universe@uap-core.de>
parents:
1298
diff
changeset
|
7 | Key/value pairs must be line-based and separated by a single character delimiter. |
|
1230
3ec9cce0de01
add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents:
1229
diff
changeset
|
8 | The parser supports up to three different characters which introduce comments. |
|
3ec9cce0de01
add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents:
1229
diff
changeset
|
9 | All characters starting with a comment character up to the end of the line are ignored. |
|
3ec9cce0de01
add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents:
1229
diff
changeset
|
10 | Blank lines are also ignored. |
|
3ec9cce0de01
add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents:
1229
diff
changeset
|
11 | |
|
3ec9cce0de01
add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents:
1229
diff
changeset
|
12 | An example properties file looks like this: |
|
3ec9cce0de01
add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents:
1229
diff
changeset
|
13 | |
|
1277
637d4775e79e
fixes some docs compiler complaints
Mike Becker <universe@uap-core.de>
parents:
1268
diff
changeset
|
14 | ```Ini |
|
1230
3ec9cce0de01
add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents:
1229
diff
changeset
|
15 | # Comment line at start of file |
|
3ec9cce0de01
add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents:
1229
diff
changeset
|
16 | key1 = value1 |
|
3ec9cce0de01
add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents:
1229
diff
changeset
|
17 | key2 = value2 |
|
3ec9cce0de01
add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents:
1229
diff
changeset
|
18 | # next is a blank line and will be ignored |
|
3ec9cce0de01
add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents:
1229
diff
changeset
|
19 | |
|
3ec9cce0de01
add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents:
1229
diff
changeset
|
20 | keys_are_trimmed = and_so_are_values # also a comment |
|
3ec9cce0de01
add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents:
1229
diff
changeset
|
21 | ``` |
|
3ec9cce0de01
add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents:
1229
diff
changeset
|
22 | |
|
3ec9cce0de01
add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents:
1229
diff
changeset
|
23 | > Delimiter and comment characters are configured with the `CxPropertiesConfig` structure. |
|
3ec9cce0de01
add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents:
1229
diff
changeset
|
24 | > There is also a field reserved for `continuation` which will be used as a line continuation character |
|
3ec9cce0de01
add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents:
1229
diff
changeset
|
25 | > in a future version of UCX. |
|
3ec9cce0de01
add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents:
1229
diff
changeset
|
26 | > In UCX 3.1 this is not implemented. |
|
1229
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
27 | |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
28 | ## Basic Parsing |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
29 | |
|
1553
7c46531efd52
fix the note about AnyStr and add it to the files where it was missing
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
30 | The following listing shows the properties-parser API. |
|
7c46531efd52
fix the note about AnyStr and add it to the files where it was missing
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
31 | |
|
7c46531efd52
fix the note about AnyStr and add it to the files where it was missing
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
32 | > To simplify documentation, we introduce the pseudo-type `AnyStr` with the meaning that |
|
7c46531efd52
fix the note about AnyStr and add it to the files where it was missing
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
33 | > any UCX string and any C string are supported. |
|
7c46531efd52
fix the note about AnyStr and add it to the files where it was missing
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
34 | > The implementation is actually hidden behind a macro which uses `cx_strcast()` to guarantee compatibility. |
|
7c46531efd52
fix the note about AnyStr and add it to the files where it was missing
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
35 | {style="note"} |
|
7c46531efd52
fix the note about AnyStr and add it to the files where it was missing
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
36 | |
|
1229
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
37 | ```C |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
38 | #include <cx/properties.h> |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
39 | |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
40 | typedef struct cx_properties_config_s { |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
41 | char delimiter; |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
42 | char comment1; |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
43 | char comment2; |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
44 | char comment3; |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
45 | // reserved for future use - not implemented in UCX 3.1 |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
46 | char continuation; |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
47 | } CxPropertiesConfig; |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
48 | |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
49 | void cxPropertiesInit(CxProperties *prop, CxPropertiesConfig config); |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
50 | |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
51 | void cxPropertiesInitDefault(CxProperties *prop); |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
52 | |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
53 | void cxPropertiesDestroy(CxProperties *prop); |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
54 | |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
55 | void cxPropertiesReset(CxProperties *prop); |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
56 | |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
57 | int cxPropertiesFilln(CxProperties *prop, |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
58 | const char *buf, size_t len); |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
59 | |
|
1553
7c46531efd52
fix the note about AnyStr and add it to the files where it was missing
Mike Becker <universe@uap-core.de>
parents:
1424
diff
changeset
|
60 | int cxPropertiesFill(CxProperties *prop, AnyStr string); |
|
1229
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
61 | |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
62 | CxPropertiesStatus cxPropertiesNext(CxProperties *prop, |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
63 | cxstring *key, cxstring *value); |
|
1555
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
64 | |
|
1229
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
65 | void cxPropertiesUseStack(CxProperties *prop, |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
66 | char *buf, size_t capacity); |
|
1555
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
67 | |
|
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
68 | CxPropertiesStatus cxPropertiesLoad(CxPropertiesConfig config, |
|
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
69 | AnyStr filename, CxMap *target); |
|
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
70 | |
|
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
71 | CxPropertiesStatus cxPropertiesLoadDefault( |
|
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
72 | AnyStr filename, CxMap *target); |
|
1229
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
73 | ``` |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
74 | |
|
1231
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
75 | The first step is to initialize a `CxProperties` structure with a call to `cxPropertiesInit()` using the desired config. |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1420
diff
changeset
|
76 | The shorthand `cxPropertiesInitDefault()` creates a default configuration with the equals sign `'='` as delimiter |
|
1231
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
77 | and the hash-symbol `'#'` as comment symbol (the other two comment symbols remain unused in the default config). |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
78 | |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
79 | > In a future UCX version, the default `continuation` character will be a backslash `'\'`. |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
80 | > In UCX 3.1 this feature is not implemented, yet. |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
81 | |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
82 | The actual parsing is an interleaving invocation of the `cxPropertiesFill()` (or `cxPropertiesFilln()`) and `cxPropertiesNext()` functions. |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
83 | The `cxPropertiesFill()` function is a convenience function, that accepts UCX strings and normal zero-terminated C strings and behaves otherwise like `cxPropertiesFilln()`. |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
84 | |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
85 | Filling the input buffer is cost-free if there is no data already in the input buffer. |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
86 | In that case, the input buffer only stores the pointer to the original data without creating a copy. |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
87 | Calling `cxPropertiesNext()` will return with `CX_PROPERTIES_NO_ERROR` (= zero) for each key/value-pair that is successfully parsed, |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
88 | and stores the pointers and lengths for both the key and the value into the structures pointed to by the `key` and `value` arguments. |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
89 | |
|
1232
781bd188f1c0
complete the properties documentation
Mike Becker <universe@uap-core.de>
parents:
1231
diff
changeset
|
90 | When all the data from the input buffer was successfully consumed, `cxPropertiesNext()` returns `CX_PROPERTIES_NO_DATA`. |
|
781bd188f1c0
complete the properties documentation
Mike Becker <universe@uap-core.de>
parents:
1231
diff
changeset
|
91 | |
|
1231
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
92 | > This is all still free of any copies and allocations. |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
93 | > That means, the pointers in `key` and `value` after `cxPropertiesNext()` returns will point into the input buffer. |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
94 | > If you intend to store the key and/or the value somewhere else, it is strongly recommended to create a copy with `cx_strdup()`, |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
95 | > because you will otherwise soon end up with a dangling pointer. |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
96 | > {style="note"} |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
97 | |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
98 | If `cxPropertiesNext()` returns `CX_PROPERTIES_INCOMPLETE_DATA` it means that the input buffer is exhausted, |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
99 | but the last line did not contain a full key/value pair. |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
100 | In that case, you can call `cxPropertiesFill()` again to add more data and continue with `cxPropertiesNext()`. |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
101 | |
|
1424
563033aa998c
fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents:
1420
diff
changeset
|
102 | Note that adding more data to a non-empty input buffer will lead to an allocation, |
|
1231
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
103 | unless you specified some stack memory with `cxPropertiesUseStack()`. |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
104 | The stack capacity must be large enough to contain the longest line in your data. |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
105 | If the internal buffer is not large enough to contain a single line, it is extended. |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
106 | If that is not possible for some reason, `cxPropertiesNext()` fails and returns `CX_PROPERTIES_BUFFER_ALLOC_FAILED`. |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
107 | |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
108 | If you want to reuse a `CxProperties` structure with the same config, you can call `cxPropertiesReset()`, even if the last operation was a failure. |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
109 | Otherwise, you should always call `cxPropertiesDestroy()` when you are done with the parser. |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
110 | |
|
1268
a84403b0a503
complete JSON documentation
Mike Becker <universe@uap-core.de>
parents:
1233
diff
changeset
|
111 | > It is strongly recommended to always call `cxPropertiesDestroy()` when you are done with the parser, |
|
1231
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
112 | > even if you did not expect any allocations because you used `cxPropertiesUseStack()`. |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
113 | |
|
1555
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
114 | All the above operations are combined in the function `cxPropertiesLoad()`, |
|
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
115 | which opens the file designated by the `filename` and loads all properties from that file into the specified `CxMap`. |
|
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
116 | The convenience macro `cxPropertiesLoadDefault()` uses the default parser configuration for this. |
|
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
117 | The target map must either store pointers of type `char*` or elements of type `cxmutstr`. |
|
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
118 | |
|
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
119 | > The stack buffers used by `cxPropertiesLoad()` can be changed when building UCX from sources |
|
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
120 | > by setting the `CX_PROPERTIES_LOAD_FILL_SIZE` and `CX_PROPERTIES_LOAD_BUF_SIZE` macros |
|
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
121 | > (see [](install.md#small-buffer-optimizations)). |
|
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
122 | |
|
1229
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
123 | ### List of Status Codes |
|
9899043d7e39
basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents:
1190
diff
changeset
|
124 | |
|
1555
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
125 | Below is a full list of status codes for `cxPropertiesNext()` and `cxPropertiesLoad()`. |
|
1231
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
126 | |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
127 | | Status Code | Meaning | |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
128 | |-----------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
129 | | CX_PROPERTIES_NO_ERROR | A key/value pair was found and returned. | |
|
1555
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
130 | | CX_PROPERTIES_NO_DATA | The input buffer does not contain data. | |
|
1231
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
131 | | CX_PROPERTIES_INCOMPLETE_DATA | The input ends unexpectedly. This can happen when the last line does not terminate with a line break, or when the input ends with a parsed key but no value. Use `cxPropertiesFill()` to add more data before retrying. | |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
132 | | CX_PROPERTIES_NULL_INPUT | The input buffer was never initialized. Probably you forgot to call `cxPropertiesFill()` at least once. | |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
133 | | CX_PROPERTIES_INVALID_EMPTY_KEY | Only white-spaces were found on the left hand-side of the delimiter. Keys must not be empty. | |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
134 | | CX_PROPERTIES_INVALID_MISSING_DELIMITER | A line contains data, but no delimiter. | |
|
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
135 | | CX_PROPERTIES_BUFFER_ALLOC_FAILED | More internal buffer was needed, but could not be allocated. | |
|
1555
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
136 | | CX_PROPERTIES_FILE_ERROR | A file operation failed (only for `cxPropertiesLoad()`). | |
|
1232
781bd188f1c0
complete the properties documentation
Mike Becker <universe@uap-core.de>
parents:
1231
diff
changeset
|
137 | |
|
1555
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
138 | For `cxPropertiesLoad()` the status code `CX_PROPERTIES_NO_ERROR` means that at least one property was loaded into the map, |
|
8972247f54e8
properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents:
1553
diff
changeset
|
139 | while `CX_PROPERTIES_NO_DATA` means that the file is syntactically fine but does not contain any properties. |
|
1231
a9f9c59e0b63
write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents:
1230
diff
changeset
|
140 | |
|
1190
a7b913d5d589
bring incomplete docs into a shape that can be released
Mike Becker <universe@uap-core.de>
parents:
1143
diff
changeset
|
141 | <seealso> |
|
a7b913d5d589
bring incomplete docs into a shape that can be released
Mike Becker <universe@uap-core.de>
parents:
1143
diff
changeset
|
142 | <category ref="apidoc"> |
|
a7b913d5d589
bring incomplete docs into a shape that can be released
Mike Becker <universe@uap-core.de>
parents:
1143
diff
changeset
|
143 | <a href="https://ucx.sourceforge.io/api/properties_8h.html">properties.h</a> |
|
a7b913d5d589
bring incomplete docs into a shape that can be released
Mike Becker <universe@uap-core.de>
parents:
1143
diff
changeset
|
144 | </category> |
|
a7b913d5d589
bring incomplete docs into a shape that can be released
Mike Becker <universe@uap-core.de>
parents:
1143
diff
changeset
|
145 | </seealso> |