120 * Not used as a status and never returned by any function. |
120 * Not used as a status and never returned by any function. |
121 * |
121 * |
122 * You can use this enumerator to check for all "good" status results |
122 * You can use this enumerator to check for all "good" status results |
123 * by checking if the status is less than @c CX_PROPERTIES_OK. |
123 * by checking if the status is less than @c CX_PROPERTIES_OK. |
124 * |
124 * |
125 * A "good" status means, that you can refill data and continue parsing. |
125 * A "good" status means that you can refill data and continue parsing. |
126 */ |
126 */ |
127 CX_PROPERTIES_OK, |
127 CX_PROPERTIES_OK, |
128 /** |
128 /** |
129 * Input buffer is @c NULL. |
129 * Input buffer is @c NULL. |
130 */ |
130 */ |
131 CX_PROPERTIES_NULL_INPUT, |
131 CX_PROPERTIES_NULL_INPUT, |
132 /** |
132 /** |
133 * The line contains a delimiter, but no key. |
133 * The line contains a delimiter but no key. |
134 */ |
134 */ |
135 CX_PROPERTIES_INVALID_EMPTY_KEY, |
135 CX_PROPERTIES_INVALID_EMPTY_KEY, |
136 /** |
136 /** |
137 * The line contains data, but no delimiter. |
137 * The line contains data but no delimiter. |
138 */ |
138 */ |
139 CX_PROPERTIES_INVALID_MISSING_DELIMITER, |
139 CX_PROPERTIES_INVALID_MISSING_DELIMITER, |
140 /** |
140 /** |
141 * More internal buffer was needed, but could not be allocated. |
141 * More internal buffer was needed, but could not be allocated. |
142 */ |
142 */ |
198 typedef struct cx_properties_sink_s CxPropertiesSink; |
198 typedef struct cx_properties_sink_s CxPropertiesSink; |
199 |
199 |
200 /** |
200 /** |
201 * A function that consumes a k/v-pair in a sink. |
201 * A function that consumes a k/v-pair in a sink. |
202 * |
202 * |
203 * The sink could be e.g. a map and the sink function would be calling |
203 * The sink could be a map, and the sink function would be calling |
204 * a map function to store the k/v-pair. |
204 * a map function to store the k/v-pair. |
205 * |
205 * |
206 * @param prop the properties interface that wants to sink a k/v-pair |
206 * @param prop the properties interface that wants to sink a k/v-pair |
207 * @param sink the sink |
207 * @param sink the sink |
208 * @param key the key |
208 * @param key the key |
337 /** |
337 /** |
338 * Destroys the properties interface. |
338 * Destroys the properties interface. |
339 * |
339 * |
340 * @note Even when you are certain that you did not use the interface in a |
340 * @note Even when you are certain that you did not use the interface in a |
341 * way that caused a memory allocation, you should call this function anyway. |
341 * way that caused a memory allocation, you should call this function anyway. |
342 * Future versions of the library might add features that need additional memory |
342 * Future versions of the library might add features that need additional memory, |
343 * and you really don't want to search the entire code where you might need |
343 * and you really don't want to search the entire code where you might need to |
344 * add call to this function. |
344 * add a call to this function. |
345 * |
345 * |
346 * @param prop the properties interface |
346 * @param prop the properties interface |
347 */ |
347 */ |
348 cx_attr_nonnull |
348 cx_attr_nonnull |
349 cx_attr_export |
349 cx_attr_export |
350 void cxPropertiesDestroy(CxProperties *prop); |
350 void cxPropertiesDestroy(CxProperties *prop); |
351 |
351 |
352 /** |
352 /** |
353 * Destroys and re-initializes the properties interface. |
353 * Destroys and re-initializes the properties interface. |
354 * |
354 * |
355 * You might want to use this, to reset the parser after |
355 * You might want to use this to reset the parser after |
356 * encountering a syntax error. |
356 * encountering a syntax error. |
357 * |
357 * |
358 * @param prop the properties interface |
358 * @param prop the properties interface |
359 */ |
359 */ |
360 cx_attr_nonnull |
360 cx_attr_nonnull |
440 * @see cxPropertiesFilln() |
440 * @see cxPropertiesFilln() |
441 */ |
441 */ |
442 #define cxPropertiesFill(prop, str) cx_properties_fill(prop, cx_strcast(str)) |
442 #define cxPropertiesFill(prop, str) cx_properties_fill(prop, cx_strcast(str)) |
443 |
443 |
444 /** |
444 /** |
445 * Specifies stack memory that shall be used as internal buffer. |
445 * Specifies stack memory that shall be used as an internal buffer. |
446 * |
446 * |
447 * @param prop the properties interface |
447 * @param prop the properties interface |
448 * @param buf a pointer to stack memory |
448 * @param buf a pointer to stack memory |
449 * @param capacity the capacity of the stack memory |
449 * @param capacity the capacity of the stack memory |
450 */ |
450 */ |