ucx/properties.h

changeset 225
a1a068c2c4ef
parent 215
e0853e077770
child 250
b7d1317b138e
equal deleted inserted replaced
224:f9ba63fc6a80 225:a1a068c2c4ef
1 /* 1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 * 3 *
4 * Copyright 2015 Olaf Wintermann. All rights reserved. 4 * Copyright 2016 Olaf Wintermann. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
125 * @return a pointer to the new UcxProperties object 125 * @return a pointer to the new UcxProperties object
126 */ 126 */
127 UcxProperties *ucx_properties_new(); 127 UcxProperties *ucx_properties_new();
128 128
129 /** 129 /**
130 * Destroys an UcxProperties object. 130 * Destroys a UcxProperties object.
131 * @param prop the UcxProperties object to destroy 131 * @param prop the UcxProperties object to destroy
132 */ 132 */
133 void ucx_properties_free(UcxProperties *prop); 133 void ucx_properties_free(UcxProperties *prop);
134 134
135 /** 135 /**
168 * @see ucx_properties_fill() 168 * @see ucx_properties_fill()
169 */ 169 */
170 int ucx_properties_next(UcxProperties *prop, sstr_t *name, sstr_t *value); 170 int ucx_properties_next(UcxProperties *prop, sstr_t *name, sstr_t *value);
171 171
172 /** 172 /**
173 * Retrieves all available key/value-pairs and puts them into an UcxMap. 173 * Retrieves all available key/value-pairs and puts them into a UcxMap.
174 * 174 *
175 * This is done by successive calls to ucx_properties_next() until no more 175 * This is done by successive calls to ucx_properties_next() until no more
176 * key/value-pairs can be retrieved. 176 * key/value-pairs can be retrieved.
177 * 177 *
178 * @param prop the UcxProperties object 178 * @param prop the UcxProperties object
181 * @see ucx_properties_fill() 181 * @see ucx_properties_fill()
182 */ 182 */
183 int ucx_properties2map(UcxProperties *prop, UcxMap *map); 183 int ucx_properties2map(UcxProperties *prop, UcxMap *map);
184 184
185 /** 185 /**
186 * Loads a properties file to an UcxMap. 186 * Loads a properties file to a UcxMap.
187 * 187 *
188 * This is a convenience function that reads data from an input 188 * This is a convenience function that reads data from an input
189 * stream until the end of the stream is reached. 189 * stream until the end of the stream is reached.
190 * 190 *
191 * @param map the map object to write the key/value-pairs to 191 * @param map the map object to write the key/value-pairs to
196 * @see ucx_properties2map() 196 * @see ucx_properties2map()
197 */ 197 */
198 int ucx_properties_load(UcxMap *map, FILE *file); 198 int ucx_properties_load(UcxMap *map, FILE *file);
199 199
200 /** 200 /**
201 * Stores an UcxMap to a file. 201 * Stores a UcxMap to a file.
202 * 202 *
203 * The key/value-pairs are written by using the following format: 203 * The key/value-pairs are written by using the following format:
204 * 204 *
205 * <code>[key] = [value]\\n</code> 205 * <code>[key] = [value]\\n</code>
206 * 206 *

mercurial