| 64 |
64 |
| 65 void cxPropertiesUseStack(CxProperties *prop, |
65 void cxPropertiesUseStack(CxProperties *prop, |
| 66 char *buf, size_t capacity); |
66 char *buf, size_t capacity); |
| 67 |
67 |
| 68 CxPropertiesStatus cxPropertiesLoad(CxPropertiesConfig config, |
68 CxPropertiesStatus cxPropertiesLoad(CxPropertiesConfig config, |
| |
69 const CxAllocator *allocator, |
| 69 AnyStr filename, CxMap *target); |
70 AnyStr filename, CxMap *target); |
| 70 |
71 |
| 71 CxPropertiesStatus cxPropertiesLoadDefault( |
72 CxPropertiesStatus cxPropertiesLoadDefault( |
| |
73 const CxAllocator *allocator, |
| 72 AnyStr filename, CxMap *target); |
74 AnyStr filename, CxMap *target); |
| 73 ``` |
75 ``` |
| 74 |
76 |
| 75 The first step is to initialize a `CxProperties` structure with a call to `cxPropertiesInit()` using the desired config. |
77 The first step is to initialize a `CxProperties` structure with a call to `cxPropertiesInit()` using the desired config. |
| 76 The shorthand `cxPropertiesInitDefault()` creates a default configuration with the equals sign `'='` as delimiter |
78 The shorthand `cxPropertiesInitDefault()` creates a default configuration with the equals sign `'='` as delimiter |
| 113 |
115 |
| 114 All the above operations are combined in the function `cxPropertiesLoad()`, |
116 All the above operations are combined in the function `cxPropertiesLoad()`, |
| 115 which opens the file designated by the `filename` and loads all properties from that file into the specified `CxMap`. |
117 which opens the file designated by the `filename` and loads all properties from that file into the specified `CxMap`. |
| 116 The convenience macro `cxPropertiesLoadDefault()` uses the default parser configuration for this. |
118 The convenience macro `cxPropertiesLoadDefault()` uses the default parser configuration for this. |
| 117 The target map must either store pointers of type `char*` or elements of type `cxmutstr`. |
119 The target map must either store pointers of type `char*` or elements of type `cxmutstr`. |
| |
120 In either case, the specified `allocator` is used to allocate the memory for the value. |
| 118 |
121 |
| 119 > The stack buffers used by `cxPropertiesLoad()` can be changed when building UCX from sources |
122 > The stack buffers used by `cxPropertiesLoad()` can be changed when building UCX from sources |
| 120 > by setting the `CX_PROPERTIES_LOAD_FILL_SIZE` and `CX_PROPERTIES_LOAD_BUF_SIZE` macros |
123 > by setting the `CX_PROPERTIES_LOAD_FILL_SIZE` and `CX_PROPERTIES_LOAD_BUF_SIZE` macros |
| 121 > (see [](install.md#small-buffer-optimizations)). |
124 > (see [](install.md#small-buffer-optimizations)). |
| 122 |
125 |