docs/Writerside/topics/properties.h.md

Thu, 11 Dec 2025 17:08:17 +0100

author
Mike Becker <universe@uap-core.de>
date
Thu, 11 Dec 2025 17:08:17 +0100
changeset 1571
25ead2ffb9b5
parent 1569
b5d896ad5e75
permissions
-rw-r--r--

removes buffer flush and adds maximum capacity instead - resolves #185

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
1569
b5d896ad5e75 adjusts documentation regarding line continuation support - relates to #457
Mike Becker <universe@uap-core.de>
parents: 1560
diff changeset
21
b5d896ad5e75 adjusts documentation regarding line continuation support - relates to #457
Mike Becker <universe@uap-core.de>
parents: 1560
diff changeset
22 key3 = value that \
b5d896ad5e75 adjusts documentation regarding line continuation support - relates to #457
Mike Becker <universe@uap-core.de>
parents: 1560
diff changeset
23 is continued on the next line
1230
3ec9cce0de01 add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents: 1229
diff changeset
24 ```
3ec9cce0de01 add information about supported properties syntax
Mike Becker <universe@uap-core.de>
parents: 1229
diff changeset
25
1569
b5d896ad5e75 adjusts documentation regarding line continuation support - relates to #457
Mike Becker <universe@uap-core.de>
parents: 1560
diff changeset
26 > Delimiter, line continuation character, and up to three comment characters
b5d896ad5e75 adjusts documentation regarding line continuation support - relates to #457
Mike Becker <universe@uap-core.de>
parents: 1560
diff changeset
27 > can be configured with the `CxPropertiesConfig` structure (see below).
1229
9899043d7e39 basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents: 1190
diff changeset
28
9899043d7e39 basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents: 1190
diff changeset
29 ## Basic Parsing
9899043d7e39 basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents: 1190
diff changeset
30
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
31 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
32
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 > 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
34 > 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
35 > 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
36 {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
37
1229
9899043d7e39 basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents: 1190
diff changeset
38 ```C
9899043d7e39 basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents: 1190
diff changeset
39 #include <cx/properties.h>
9899043d7e39 basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents: 1190
diff changeset
40
9899043d7e39 basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents: 1190
diff changeset
41 typedef struct cx_properties_config_s {
9899043d7e39 basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents: 1190
diff changeset
42 char delimiter;
9899043d7e39 basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents: 1190
diff changeset
43 char comment1;
9899043d7e39 basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents: 1190
diff changeset
44 char comment2;
9899043d7e39 basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents: 1190
diff changeset
45 char comment3;
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,
1557
03fbf1c99e73 add allocator support to cxPropertiesLoad() - resolves #776
Mike Becker <universe@uap-core.de>
parents: 1555
diff changeset
69 const CxAllocator *allocator,
1555
8972247f54e8 properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents: 1553
diff changeset
70 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
71
8972247f54e8 properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents: 1553
diff changeset
72 CxPropertiesStatus cxPropertiesLoadDefault(
1557
03fbf1c99e73 add allocator support to cxPropertiesLoad() - resolves #776
Mike Becker <universe@uap-core.de>
parents: 1555
diff changeset
73 const CxAllocator *allocator,
1555
8972247f54e8 properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents: 1553
diff changeset
74 AnyStr filename, CxMap *target);
1229
9899043d7e39 basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents: 1190
diff changeset
75 ```
9899043d7e39 basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents: 1190
diff changeset
76
1231
a9f9c59e0b63 write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents: 1230
diff changeset
77 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
78 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
79 and the hash-symbol `'#'` as comment symbol (the other two comment symbols remain unused in the default config).
1569
b5d896ad5e75 adjusts documentation regarding line continuation support - relates to #457
Mike Becker <universe@uap-core.de>
parents: 1560
diff changeset
80 The line continuation symbol is set to `'\'`.
b5d896ad5e75 adjusts documentation regarding line continuation support - relates to #457
Mike Becker <universe@uap-core.de>
parents: 1560
diff changeset
81 Note that leading spaces of a continuing line are ignored.
1231
a9f9c59e0b63 write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents: 1230
diff changeset
82
a9f9c59e0b63 write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents: 1230
diff changeset
83 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
84 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
85
a9f9c59e0b63 write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents: 1230
diff changeset
86 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
87 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
88 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
89 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
90
1232
781bd188f1c0 complete the properties documentation
Mike Becker <universe@uap-core.de>
parents: 1231
diff changeset
91 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
92
1231
a9f9c59e0b63 write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents: 1230
diff changeset
93 > 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
94 > 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
95 > 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
96 > 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
97 > {style="note"}
a9f9c59e0b63 write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents: 1230
diff changeset
98
a9f9c59e0b63 write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents: 1230
diff changeset
99 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
100 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
101 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
102
1424
563033aa998c fixes tons of typos and grammar issues across the documentation - fixes #667
Mike Becker <universe@uap-core.de>
parents: 1420
diff changeset
103 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
104 unless you specified some stack memory with `cxPropertiesUseStack()`.
a9f9c59e0b63 write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents: 1230
diff changeset
105 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
106 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
107 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
108
a9f9c59e0b63 write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents: 1230
diff changeset
109 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
110 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
111
1268
a84403b0a503 complete JSON documentation
Mike Becker <universe@uap-core.de>
parents: 1233
diff changeset
112 > 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
113 > 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
114
1555
8972247f54e8 properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents: 1553
diff changeset
115 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
116 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
117 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
118 The target map must either store pointers of type `char*` or elements of type `cxmutstr`.
1560
f060ecd65575 add note that cxPropertiesLoad() does not roll back the changes to the map on error
Mike Becker <universe@uap-core.de>
parents: 1557
diff changeset
119 In either case, the specified `allocator` is used to allocate the memory for the value.
f060ecd65575 add note that cxPropertiesLoad() does not roll back the changes to the map on error
Mike Becker <universe@uap-core.de>
parents: 1557
diff changeset
120 If the function encounters an error, all properties that have been added to the map so far stay in the map; there is no rollback.
1555
8972247f54e8 properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents: 1553
diff changeset
121
8972247f54e8 properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents: 1553
diff changeset
122 > 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
123 > 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
124 > (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
125
1229
9899043d7e39 basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents: 1190
diff changeset
126 ### List of Status Codes
9899043d7e39 basic structure for properties docu
Mike Becker <universe@uap-core.de>
parents: 1190
diff changeset
127
1555
8972247f54e8 properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents: 1553
diff changeset
128 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
129
a9f9c59e0b63 write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents: 1230
diff changeset
130 | Status Code | Meaning |
a9f9c59e0b63 write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents: 1230
diff changeset
131 |-----------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
a9f9c59e0b63 write basic parsing documentation
Mike Becker <universe@uap-core.de>
parents: 1230
diff changeset
132 | 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
133 | 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
134 | 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
135 | 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
136 | 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
137 | 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
138 | 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
139 | 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
140
1555
8972247f54e8 properties.h: removes the source/sink API and adds a new cxPropertiesLoad()
Mike Becker <universe@uap-core.de>
parents: 1553
diff changeset
141 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
142 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
143
1190
a7b913d5d589 bring incomplete docs into a shape that can be released
Mike Becker <universe@uap-core.de>
parents: 1143
diff changeset
144 <seealso>
a7b913d5d589 bring incomplete docs into a shape that can be released
Mike Becker <universe@uap-core.de>
parents: 1143
diff changeset
145 <category ref="apidoc">
a7b913d5d589 bring incomplete docs into a shape that can be released
Mike Becker <universe@uap-core.de>
parents: 1143
diff changeset
146 <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
147 </category>
a7b913d5d589 bring incomplete docs into a shape that can be released
Mike Becker <universe@uap-core.de>
parents: 1143
diff changeset
148 </seealso>

mercurial