regify utility  2.0.0-0
ini.h
1 /*
2  * Copyright regify
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20  * SOFTWARE.
21  */
44 #ifndef REGIFY_UTIL_INI_H
45 #define REGIFY_UTIL_INI_H
46 
47 /* Only need to export C interface if used by C++ source code */
48 #ifdef __cplusplus
49 extern "C" {
50 #endif /* __cplusplus */
51 
52 
56 typedef void* ruIni;
57 
63 RUAPI ruIni ruIniFree(ruIni ini);
64 
69 RUAPI ruIni ruIniNew(void);
70 
77 RUAPI int32_t ruIniWrite(ruIni iniOb, trans_chars filename);
78 
94 RUAPI int32_t ruIniRead(trans_chars filename, ruIni* iniOb);
95 
102 RUAPI int32_t ruIniSections(ruIni iniOb, ruList* sections);
103 
111 RUAPI int32_t ruIniKeys(ruIni iniOb, trans_chars section, ruList* keys);
112 
123  trans_chars def, int32_t* code);
124 
133 RUAPI int32_t ruIniGet(ruIni iniOb, trans_chars section, trans_chars key, perm_chars* value);
134 
143 RUAPI int32_t ruIniSet(ruIni iniOb, trans_chars section, trans_chars key, trans_chars value);
144 
145 #ifdef __cplusplus
146 }
147 #endif /* __cplusplus */
148 #endif //REGIFY_UTIL_INI_H
149 
RUAPI int32_t ruIniSet(ruIni iniOb, trans_chars section, trans_chars key, trans_chars value)
Set a value in the given ini object.
RUAPI ruIni ruIniNew(void)
Create a new empty ini object.
RUAPI int32_t ruIniGet(ruIni iniOb, trans_chars section, trans_chars key, perm_chars *value)
Retrieves a value from the given ini object.
RUAPI int32_t ruIniWrite(ruIni iniOb, trans_chars filename)
Writes given ini object into given filename.
RUAPI int32_t ruIniSections(ruIni iniOb, ruList *sections)
Returns a list of sections from the given ini object.
RUAPI ruIni ruIniFree(ruIni ini)
Frees the given ini object and its members.
void * ruIni
An opaque type representing an ini object.
Definition: ini.h:56
RUAPI perm_chars ruIniGetDef(ruIni iniOb, trans_chars section, trans_chars key, trans_chars def, int32_t *code)
Retrieves a value or given default from the given ini object.
RUAPI int32_t ruIniRead(trans_chars filename, ruIni *iniOb)
Parse given INI-style file. May have [section]s, name=value pairs (whitespace stripped),...
RUAPI int32_t ruIniKeys(ruIni iniOb, trans_chars section, ruList *keys)
Returns a list of keys from given section or global.
void * ruList
Opaque pointer to list object. See List Collection.
Definition: list.h:103
const char * trans_chars
A transient NULL terminated string pointer.
Definition: regify-util.h:186
const char * perm_chars
A permanent NULL terminated string pointer.
Definition: regify-util.h:176