36#ifndef UCX_PROPERTIES_H
37#define UCX_PROPERTIES_H
217#define cxPropertiesInitDefault(prop) \
218 cxPropertiesInit(prop, cx_properties_config_default)
277#define cxPropertiesFill(prop, str) cx_properties_fill(prop, cx_strcast(str))
370#define cxPropertiesLoad(allocator, filename, target, config) \
371 cx_properties_load(allocator, cx_strcast(filename), target, config)
397#define cxPropertiesLoadDefault(allocator, filename, target) \
398 cx_properties_load(allocator, cx_strcast(filename), target, cx_properties_config_default)
struct cx_allocator_s CxAllocator
High-Level type alias for the allocator type.
Definition allocator.h:80
Advanced buffer implementation.
struct cx_buffer_s CxBuffer
UCX buffer.
Definition buffer.h:143
Common definitions and feature checks.
#define CX_INLINE
Declares a function to be inlined.
Definition common.h:311
#define CX_EXPORT
Only used for building Windows DLLs.
Definition common.h:289
#define CX_NONNULL
All pointer arguments must be non-NULL.
Definition common.h:141
#define CX_NODISCARD
Warn about discarded return value.
Definition common.h:256
#define CX_NONNULL_ARG(...)
The specified pointer arguments must be non-NULL.
Definition common.h:146
#define CX_EXTERN
Declares a function with external linkage.
Definition common.h:297
#define CX_ACCESS_R(...)
Specifies that the function will only read through the given pointer.
Definition common.h:230
Interface for map implementations.
struct cx_map_s CxMap
Type for the UCX map.
Definition map.h:50
void cxPropertiesInit(CxProperties *prop, CxPropertiesConfig config)
Initialize a properties interface.
void cxPropertiesReset(CxProperties *prop)
Destroys and re-initializes the properties interface.
CxPropertiesStatus cx_properties_load(const CxAllocator *allocator, cxstring filename, CxMap *target, CxPropertiesConfig config)
Internal function - use cxPropertiesLoad() instead.
const unsigned cx_properties_load_fill_size
The size of the stack memory that cxPropertiesLoad() will use to read contents from the file.
const CxPropertiesConfig cx_properties_config_default
Default properties configuration.
void cxPropertiesDestroy(CxProperties *prop)
Destroys the properties interface.
CxPropertiesStatus cxPropertiesNext(CxProperties *prop, cxstring *key, cxstring *value)
Retrieves the next key/value-pair.
int cxPropertiesFilln(CxProperties *prop, const char *buf, size_t len)
Fills the input buffer with data.
struct cx_properties_config_s CxPropertiesConfig
Typedef for the properties config.
Definition properties.h:82
static int cx_properties_fill(CxProperties *prop, cxstring str)
Internal function, do not use.
Definition properties.h:253
void cxPropertiesUseStack(CxProperties *prop, char *buf, size_t capacity)
Specifies stack memory that shall be used as an internal buffer.
struct cx_properties_s CxProperties
Typedef for the properties interface.
Definition properties.h:174
cx_properties_status
Status codes for the properties interface.
Definition properties.h:92
@ CX_PROPERTIES_NO_ERROR
Everything is fine.
Definition properties.h:96
@ CX_PROPERTIES_MAP_ERROR
A map operation failed.
Definition properties.h:143
@ CX_PROPERTIES_INVALID_EMPTY_KEY
The line contains a delimiter but no key.
Definition properties.h:124
@ CX_PROPERTIES_OK
Not used as a status and never returned by any function.
Definition properties.h:116
@ CX_PROPERTIES_FILE_ERROR
A file operation failed.
Definition properties.h:138
@ CX_PROPERTIES_NULL_INPUT
Input buffer is NULL.
Definition properties.h:120
@ CX_PROPERTIES_INCOMPLETE_DATA
The input ends unexpectedly.
Definition properties.h:107
@ CX_PROPERTIES_BUFFER_ALLOC_FAILED
More internal buffer was needed, but could not be allocated.
Definition properties.h:132
@ CX_PROPERTIES_NO_DATA
The input buffer does not contain more data.
Definition properties.h:100
@ CX_PROPERTIES_INVALID_MISSING_DELIMITER
The line contains data but no delimiter.
Definition properties.h:128
enum cx_properties_status CxPropertiesStatus
Typedef for the properties status enum.
Definition properties.h:149
const unsigned cx_properties_load_buf_size
The size of the stack memory that cxPropertiesLoad() will reserve with cxPropertiesUseStack().
Strings that know their length.
struct cx_string_s cxstring
An immutable string.
Definition string.h:92
Configures the expected characters for the properties parser.
Definition properties.h:47
char continuation
The character, when appearing at the end of a line, continues that line.
Definition properties.h:76
char delimiter
The key/value delimiter that shall be used.
Definition properties.h:52
char comment3
The third comment character.
Definition properties.h:70
char comment2
The second comment character.
Definition properties.h:64
char comment1
The first comment character.
Definition properties.h:58
Interface for working with properties data.
Definition properties.h:154
CxBuffer input
The text input buffer.
Definition properties.h:163
CxPropertiesConfig config
The configuration.
Definition properties.h:158
CxBuffer buffer
Internal buffer.
Definition properties.h:168