Subversion Repositories FlightCtrl

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
56 elmo 1
<html>
2
<head>
3
        <meta name="author"    content="ndevilla@free.fr">
4
        <meta name="keywords"  content="ini file, config file, parser, C library">
5
        <link href="doxygen.css" rel="stylesheet" type="text/css">
6
<title>iniparser 2.x</title>
7
</head>
8
 
9
<body text="#000000" bgcolor="#ffffff">
10
 
11
 
12
 
13
<!-- Generated by Doxygen 1.4.4 -->
14
<div class="nav">
15
<a class="el" href="dir_000000.html">src</a></div>
16
<h1>iniparser.h File Reference</h1>Parser for ini files. <a href="#_details">More...</a>
17
<p>
18
<table border="0" cellpadding="0" cellspacing="0">
19
<tr><td></td></tr>
20
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
21
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="iniparser_8h.html#a0">iniparser_getnsec</a> (dictionary *d)</td></tr>
22
 
23
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get number of sections in a dictionary.  <a href="#a0"></a><br></td></tr>
24
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="iniparser_8h.html#a1">iniparser_getsecname</a> (dictionary *d, int n)</td></tr>
25
 
26
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get name for section n in a dictionary.  <a href="#a1"></a><br></td></tr>
27
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="iniparser_8h.html#a2">iniparser_dump_ini</a> (dictionary *d, FILE *f)</td></tr>
28
 
29
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Save a dictionary to a loadable ini file.  <a href="#a2"></a><br></td></tr>
30
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="iniparser_8h.html#a3">iniparser_dump</a> (dictionary *d, FILE *f)</td></tr>
31
 
32
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Dump a dictionary to an opened file pointer.  <a href="#a3"></a><br></td></tr>
33
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="iniparser_8h.html#a4">iniparser_getstr</a> (dictionary *d, char *key)</td></tr>
34
 
35
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the string associated to a key, return NULL if not found.  <a href="#a4"></a><br></td></tr>
36
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="iniparser_8h.html#a5">iniparser_getstring</a> (dictionary *d, char *key, char *def)</td></tr>
37
 
38
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the string associated to a key.  <a href="#a5"></a><br></td></tr>
39
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="iniparser_8h.html#a6">iniparser_getint</a> (dictionary *d, char *key, int notfound)</td></tr>
40
 
41
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the string associated to a key, convert to an int.  <a href="#a6"></a><br></td></tr>
42
<tr><td class="memItemLeft" nowrap align="right" valign="top">double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="iniparser_8h.html#a7">iniparser_getdouble</a> (dictionary *d, char *key, double notfound)</td></tr>
43
 
44
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the string associated to a key, convert to a double.  <a href="#a7"></a><br></td></tr>
45
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="iniparser_8h.html#a8">iniparser_getboolean</a> (dictionary *d, char *key, int notfound)</td></tr>
46
 
47
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the string associated to a key, convert to a boolean.  <a href="#a8"></a><br></td></tr>
48
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="iniparser_8h.html#a9">iniparser_setstr</a> (dictionary *ini, char *entry, char *val)</td></tr>
49
 
50
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set an entry in a dictionary.  <a href="#a9"></a><br></td></tr>
51
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="iniparser_8h.html#a10">iniparser_unset</a> (dictionary *ini, char *entry)</td></tr>
52
 
53
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Delete an entry in a dictionary.  <a href="#a10"></a><br></td></tr>
54
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="iniparser_8h.html#a11">iniparser_find_entry</a> (dictionary *ini, char *entry)</td></tr>
55
 
56
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Finds out if a given entry exists in a dictionary.  <a href="#a11"></a><br></td></tr>
57
<tr><td class="memItemLeft" nowrap align="right" valign="top">dictionary *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="iniparser_8h.html#a12">iniparser_load</a> (char *ininame)</td></tr>
58
 
59
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Parse an ini file and return an allocated dictionary object.  <a href="#a12"></a><br></td></tr>
60
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="iniparser_8h.html#a13">iniparser_freedict</a> (dictionary *d)</td></tr>
61
 
62
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Free all memory associated to an ini dictionary.  <a href="#a13"></a><br></td></tr>
63
</table>
64
<hr><a name="_details"></a><h2>Detailed Description</h2>
65
Parser for ini files.
66
<p>
67
<dl compact><dt><b>Author:</b></dt><dd>N. Devillard </dd></dl>
68
<dl compact><dt><b>Date:</b></dt><dd>Mar 2000 </dd></dl>
69
<dl compact><dt><b>Version:</b></dt><dd><dl compact><dt><b>Revision</b></dt><dd>1.20 </dd></dl>
70
</dd></dl>
71
<hr><h2>Function Documentation</h2>
72
<a class="anchor" name="a3"></a><!-- doxytag: member="iniparser.h::iniparser_dump" ref="a3" args="(dictionary *d, FILE *f)" --><p>
73
<table class="mdTable" cellpadding="2" cellspacing="0">
74
  <tr>
75
    <td class="mdRow">
76
      <table cellpadding="0" cellspacing="0" border="0">
77
        <tr>
78
          <td class="md" nowrap valign="top">void iniparser_dump           </td>
79
          <td class="md" valign="top">(&nbsp;</td>
80
          <td class="md" nowrap valign="top">dictionary *&nbsp;</td>
81
          <td class="mdname" nowrap> <em>d</em>, </td>
82
        </tr>
83
        <tr>
84
          <td class="md" nowrap align="right"></td>
85
          <td class="md"></td>
86
          <td class="md" nowrap>FILE *&nbsp;</td>
87
          <td class="mdname" nowrap> <em>f</em></td>
88
        </tr>
89
        <tr>
90
          <td class="md"></td>
91
          <td class="md">)&nbsp;</td>
92
          <td class="md" colspan="2"></td>
93
        </tr>
94
      </table>
95
    </td>
96
  </tr>
97
</table>
98
<table cellspacing="5" cellpadding="0" border="0">
99
  <tr>
100
    <td>
101
      &nbsp;
102
    </td>
103
    <td>
104
 
105
<p>
106
Dump a dictionary to an opened file pointer.
107
<p>
108
<dl compact><dt><b>Parameters:</b></dt><dd>
109
  <table border="0" cellspacing="2" cellpadding="0">
110
    <tr><td valign="top"></td><td valign="top"><em>d</em>&nbsp;</td><td>Dictionary to dump. </td></tr>
111
    <tr><td valign="top"></td><td valign="top"><em>f</em>&nbsp;</td><td>Opened file pointer to dump to. </td></tr>
112
  </table>
113
</dl>
114
<dl compact><dt><b>Returns:</b></dt><dd>void</dd></dl>
115
This function prints out the contents of a dictionary, one element by line, onto the provided file pointer. It is OK to specify <code>stderr</code> or <code>stdout</code> as output files. This function is meant for debugging purposes mostly.    </td>
116
  </tr>
117
</table>
118
<a class="anchor" name="a2"></a><!-- doxytag: member="iniparser.h::iniparser_dump_ini" ref="a2" args="(dictionary *d, FILE *f)" --><p>
119
<table class="mdTable" cellpadding="2" cellspacing="0">
120
  <tr>
121
    <td class="mdRow">
122
      <table cellpadding="0" cellspacing="0" border="0">
123
        <tr>
124
          <td class="md" nowrap valign="top">void iniparser_dump_ini           </td>
125
          <td class="md" valign="top">(&nbsp;</td>
126
          <td class="md" nowrap valign="top">dictionary *&nbsp;</td>
127
          <td class="mdname" nowrap> <em>d</em>, </td>
128
        </tr>
129
        <tr>
130
          <td class="md" nowrap align="right"></td>
131
          <td class="md"></td>
132
          <td class="md" nowrap>FILE *&nbsp;</td>
133
          <td class="mdname" nowrap> <em>f</em></td>
134
        </tr>
135
        <tr>
136
          <td class="md"></td>
137
          <td class="md">)&nbsp;</td>
138
          <td class="md" colspan="2"></td>
139
        </tr>
140
      </table>
141
    </td>
142
  </tr>
143
</table>
144
<table cellspacing="5" cellpadding="0" border="0">
145
  <tr>
146
    <td>
147
      &nbsp;
148
    </td>
149
    <td>
150
 
151
<p>
152
Save a dictionary to a loadable ini file.
153
<p>
154
<dl compact><dt><b>Parameters:</b></dt><dd>
155
  <table border="0" cellspacing="2" cellpadding="0">
156
    <tr><td valign="top"></td><td valign="top"><em>d</em>&nbsp;</td><td>Dictionary to dump </td></tr>
157
    <tr><td valign="top"></td><td valign="top"><em>f</em>&nbsp;</td><td>Opened file pointer to dump to </td></tr>
158
  </table>
159
</dl>
160
<dl compact><dt><b>Returns:</b></dt><dd>void</dd></dl>
161
This function dumps a given dictionary into a loadable ini file. It is Ok to specify <code>stderr</code> or <code>stdout</code> as output files.    </td>
162
  </tr>
163
</table>
164
<a class="anchor" name="a11"></a><!-- doxytag: member="iniparser.h::iniparser_find_entry" ref="a11" args="(dictionary *ini, char *entry)" --><p>
165
<table class="mdTable" cellpadding="2" cellspacing="0">
166
  <tr>
167
    <td class="mdRow">
168
      <table cellpadding="0" cellspacing="0" border="0">
169
        <tr>
170
          <td class="md" nowrap valign="top">int iniparser_find_entry           </td>
171
          <td class="md" valign="top">(&nbsp;</td>
172
          <td class="md" nowrap valign="top">dictionary *&nbsp;</td>
173
          <td class="mdname" nowrap> <em>ini</em>, </td>
174
        </tr>
175
        <tr>
176
          <td class="md" nowrap align="right"></td>
177
          <td class="md"></td>
178
          <td class="md" nowrap>char *&nbsp;</td>
179
          <td class="mdname" nowrap> <em>entry</em></td>
180
        </tr>
181
        <tr>
182
          <td class="md"></td>
183
          <td class="md">)&nbsp;</td>
184
          <td class="md" colspan="2"></td>
185
        </tr>
186
      </table>
187
    </td>
188
  </tr>
189
</table>
190
<table cellspacing="5" cellpadding="0" border="0">
191
  <tr>
192
    <td>
193
      &nbsp;
194
    </td>
195
    <td>
196
 
197
<p>
198
Finds out if a given entry exists in a dictionary.
199
<p>
200
<dl compact><dt><b>Parameters:</b></dt><dd>
201
  <table border="0" cellspacing="2" cellpadding="0">
202
    <tr><td valign="top"></td><td valign="top"><em>ini</em>&nbsp;</td><td>Dictionary to search </td></tr>
203
    <tr><td valign="top"></td><td valign="top"><em>entry</em>&nbsp;</td><td>Name of the entry to look for </td></tr>
204
  </table>
205
</dl>
206
<dl compact><dt><b>Returns:</b></dt><dd>integer 1 if entry exists, 0 otherwise</dd></dl>
207
Finds out if a given entry exists in the dictionary. Since sections are stored as keys with NULL associated values, this is the only way of querying for the presence of sections in a dictionary.    </td>
208
  </tr>
209
</table>
210
<a class="anchor" name="a13"></a><!-- doxytag: member="iniparser.h::iniparser_freedict" ref="a13" args="(dictionary *d)" --><p>
211
<table class="mdTable" cellpadding="2" cellspacing="0">
212
  <tr>
213
    <td class="mdRow">
214
      <table cellpadding="0" cellspacing="0" border="0">
215
        <tr>
216
          <td class="md" nowrap valign="top">void iniparser_freedict           </td>
217
          <td class="md" valign="top">(&nbsp;</td>
218
          <td class="md" nowrap valign="top">dictionary *&nbsp;</td>
219
          <td class="mdname1" valign="top" nowrap> <em>d</em>          </td>
220
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
221
          <td class="md" nowrap></td>
222
        </tr>
223
      </table>
224
    </td>
225
  </tr>
226
</table>
227
<table cellspacing="5" cellpadding="0" border="0">
228
  <tr>
229
    <td>
230
      &nbsp;
231
    </td>
232
    <td>
233
 
234
<p>
235
Free all memory associated to an ini dictionary.
236
<p>
237
<dl compact><dt><b>Parameters:</b></dt><dd>
238
  <table border="0" cellspacing="2" cellpadding="0">
239
    <tr><td valign="top"></td><td valign="top"><em>d</em>&nbsp;</td><td>Dictionary to free </td></tr>
240
  </table>
241
</dl>
242
<dl compact><dt><b>Returns:</b></dt><dd>void</dd></dl>
243
Free all memory associated to an ini dictionary. It is mandatory to call this function before the dictionary object gets out of the current context.    </td>
244
  </tr>
245
</table>
246
<a class="anchor" name="a8"></a><!-- doxytag: member="iniparser.h::iniparser_getboolean" ref="a8" args="(dictionary *d, char *key, int notfound)" --><p>
247
<table class="mdTable" cellpadding="2" cellspacing="0">
248
  <tr>
249
    <td class="mdRow">
250
      <table cellpadding="0" cellspacing="0" border="0">
251
        <tr>
252
          <td class="md" nowrap valign="top">int iniparser_getboolean           </td>
253
          <td class="md" valign="top">(&nbsp;</td>
254
          <td class="md" nowrap valign="top">dictionary *&nbsp;</td>
255
          <td class="mdname" nowrap> <em>d</em>, </td>
256
        </tr>
257
        <tr>
258
          <td class="md" nowrap align="right"></td>
259
          <td class="md"></td>
260
          <td class="md" nowrap>char *&nbsp;</td>
261
          <td class="mdname" nowrap> <em>key</em>, </td>
262
        </tr>
263
        <tr>
264
          <td class="md" nowrap align="right"></td>
265
          <td class="md"></td>
266
          <td class="md" nowrap>int&nbsp;</td>
267
          <td class="mdname" nowrap> <em>notfound</em></td>
268
        </tr>
269
        <tr>
270
          <td class="md"></td>
271
          <td class="md">)&nbsp;</td>
272
          <td class="md" colspan="2"></td>
273
        </tr>
274
      </table>
275
    </td>
276
  </tr>
277
</table>
278
<table cellspacing="5" cellpadding="0" border="0">
279
  <tr>
280
    <td>
281
      &nbsp;
282
    </td>
283
    <td>
284
 
285
<p>
286
Get the string associated to a key, convert to a boolean.
287
<p>
288
<dl compact><dt><b>Parameters:</b></dt><dd>
289
  <table border="0" cellspacing="2" cellpadding="0">
290
    <tr><td valign="top"></td><td valign="top"><em>d</em>&nbsp;</td><td>Dictionary to search </td></tr>
291
    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>Key string to look for </td></tr>
292
    <tr><td valign="top"></td><td valign="top"><em>notfound</em>&nbsp;</td><td>Value to return in case of error </td></tr>
293
  </table>
294
</dl>
295
<dl compact><dt><b>Returns:</b></dt><dd>integer</dd></dl>
296
This function queries a dictionary for a key. A key as read from an ini file is given as "section:key". If the key cannot be found, the notfound value is returned.<p>
297
A true boolean is found if one of the following is matched:<p>
298
<ul>
299
<li>A string starting with 'y'</li><li>A string starting with 'Y'</li><li>A string starting with 't'</li><li>A string starting with 'T'</li><li>A string starting with '1'</li></ul>
300
<p>
301
A false boolean is found if one of the following is matched:<p>
302
<ul>
303
<li>A string starting with 'n'</li><li>A string starting with 'N'</li><li>A string starting with 'f'</li><li>A string starting with 'F'</li><li>A string starting with '0'</li></ul>
304
<p>
305
The notfound value returned if no boolean is identified, does not necessarily have to be 0 or 1.    </td>
306
  </tr>
307
</table>
308
<a class="anchor" name="a7"></a><!-- doxytag: member="iniparser.h::iniparser_getdouble" ref="a7" args="(dictionary *d, char *key, double notfound)" --><p>
309
<table class="mdTable" cellpadding="2" cellspacing="0">
310
  <tr>
311
    <td class="mdRow">
312
      <table cellpadding="0" cellspacing="0" border="0">
313
        <tr>
314
          <td class="md" nowrap valign="top">double iniparser_getdouble           </td>
315
          <td class="md" valign="top">(&nbsp;</td>
316
          <td class="md" nowrap valign="top">dictionary *&nbsp;</td>
317
          <td class="mdname" nowrap> <em>d</em>, </td>
318
        </tr>
319
        <tr>
320
          <td class="md" nowrap align="right"></td>
321
          <td class="md"></td>
322
          <td class="md" nowrap>char *&nbsp;</td>
323
          <td class="mdname" nowrap> <em>key</em>, </td>
324
        </tr>
325
        <tr>
326
          <td class="md" nowrap align="right"></td>
327
          <td class="md"></td>
328
          <td class="md" nowrap>double&nbsp;</td>
329
          <td class="mdname" nowrap> <em>notfound</em></td>
330
        </tr>
331
        <tr>
332
          <td class="md"></td>
333
          <td class="md">)&nbsp;</td>
334
          <td class="md" colspan="2"></td>
335
        </tr>
336
      </table>
337
    </td>
338
  </tr>
339
</table>
340
<table cellspacing="5" cellpadding="0" border="0">
341
  <tr>
342
    <td>
343
      &nbsp;
344
    </td>
345
    <td>
346
 
347
<p>
348
Get the string associated to a key, convert to a double.
349
<p>
350
<dl compact><dt><b>Parameters:</b></dt><dd>
351
  <table border="0" cellspacing="2" cellpadding="0">
352
    <tr><td valign="top"></td><td valign="top"><em>d</em>&nbsp;</td><td>Dictionary to search </td></tr>
353
    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>Key string to look for </td></tr>
354
    <tr><td valign="top"></td><td valign="top"><em>notfound</em>&nbsp;</td><td>Value to return in case of error </td></tr>
355
  </table>
356
</dl>
357
<dl compact><dt><b>Returns:</b></dt><dd>double</dd></dl>
358
This function queries a dictionary for a key. A key as read from an ini file is given as "section:key". If the key cannot be found, the notfound value is returned.    </td>
359
  </tr>
360
</table>
361
<a class="anchor" name="a6"></a><!-- doxytag: member="iniparser.h::iniparser_getint" ref="a6" args="(dictionary *d, char *key, int notfound)" --><p>
362
<table class="mdTable" cellpadding="2" cellspacing="0">
363
  <tr>
364
    <td class="mdRow">
365
      <table cellpadding="0" cellspacing="0" border="0">
366
        <tr>
367
          <td class="md" nowrap valign="top">int iniparser_getint           </td>
368
          <td class="md" valign="top">(&nbsp;</td>
369
          <td class="md" nowrap valign="top">dictionary *&nbsp;</td>
370
          <td class="mdname" nowrap> <em>d</em>, </td>
371
        </tr>
372
        <tr>
373
          <td class="md" nowrap align="right"></td>
374
          <td class="md"></td>
375
          <td class="md" nowrap>char *&nbsp;</td>
376
          <td class="mdname" nowrap> <em>key</em>, </td>
377
        </tr>
378
        <tr>
379
          <td class="md" nowrap align="right"></td>
380
          <td class="md"></td>
381
          <td class="md" nowrap>int&nbsp;</td>
382
          <td class="mdname" nowrap> <em>notfound</em></td>
383
        </tr>
384
        <tr>
385
          <td class="md"></td>
386
          <td class="md">)&nbsp;</td>
387
          <td class="md" colspan="2"></td>
388
        </tr>
389
      </table>
390
    </td>
391
  </tr>
392
</table>
393
<table cellspacing="5" cellpadding="0" border="0">
394
  <tr>
395
    <td>
396
      &nbsp;
397
    </td>
398
    <td>
399
 
400
<p>
401
Get the string associated to a key, convert to an int.
402
<p>
403
<dl compact><dt><b>Parameters:</b></dt><dd>
404
  <table border="0" cellspacing="2" cellpadding="0">
405
    <tr><td valign="top"></td><td valign="top"><em>d</em>&nbsp;</td><td>Dictionary to search </td></tr>
406
    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>Key string to look for </td></tr>
407
    <tr><td valign="top"></td><td valign="top"><em>notfound</em>&nbsp;</td><td>Value to return in case of error </td></tr>
408
  </table>
409
</dl>
410
<dl compact><dt><b>Returns:</b></dt><dd>integer</dd></dl>
411
This function queries a dictionary for a key. A key as read from an ini file is given as "section:key". If the key cannot be found, the notfound value is returned.    </td>
412
  </tr>
413
</table>
414
<a class="anchor" name="a0"></a><!-- doxytag: member="iniparser.h::iniparser_getnsec" ref="a0" args="(dictionary *d)" --><p>
415
<table class="mdTable" cellpadding="2" cellspacing="0">
416
  <tr>
417
    <td class="mdRow">
418
      <table cellpadding="0" cellspacing="0" border="0">
419
        <tr>
420
          <td class="md" nowrap valign="top">int iniparser_getnsec           </td>
421
          <td class="md" valign="top">(&nbsp;</td>
422
          <td class="md" nowrap valign="top">dictionary *&nbsp;</td>
423
          <td class="mdname1" valign="top" nowrap> <em>d</em>          </td>
424
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
425
          <td class="md" nowrap></td>
426
        </tr>
427
      </table>
428
    </td>
429
  </tr>
430
</table>
431
<table cellspacing="5" cellpadding="0" border="0">
432
  <tr>
433
    <td>
434
      &nbsp;
435
    </td>
436
    <td>
437
 
438
<p>
439
Get number of sections in a dictionary.
440
<p>
441
<dl compact><dt><b>Parameters:</b></dt><dd>
442
  <table border="0" cellspacing="2" cellpadding="0">
443
    <tr><td valign="top"></td><td valign="top"><em>d</em>&nbsp;</td><td>Dictionary to examine </td></tr>
444
  </table>
445
</dl>
446
<dl compact><dt><b>Returns:</b></dt><dd>int Number of sections found in dictionary</dd></dl>
447
This function returns the number of sections found in a dictionary. The test to recognize sections is done on the string stored in the dictionary: a section name is given as "section" whereas a key is stored as "section:key", thus the test looks for entries that do not contain a colon.<p>
448
This clearly fails in the case a section name contains a colon, but this should simply be avoided.<p>
449
This function returns -1 in case of error.    </td>
450
  </tr>
451
</table>
452
<a class="anchor" name="a1"></a><!-- doxytag: member="iniparser.h::iniparser_getsecname" ref="a1" args="(dictionary *d, int n)" --><p>
453
<table class="mdTable" cellpadding="2" cellspacing="0">
454
  <tr>
455
    <td class="mdRow">
456
      <table cellpadding="0" cellspacing="0" border="0">
457
        <tr>
458
          <td class="md" nowrap valign="top">char* iniparser_getsecname           </td>
459
          <td class="md" valign="top">(&nbsp;</td>
460
          <td class="md" nowrap valign="top">dictionary *&nbsp;</td>
461
          <td class="mdname" nowrap> <em>d</em>, </td>
462
        </tr>
463
        <tr>
464
          <td class="md" nowrap align="right"></td>
465
          <td class="md"></td>
466
          <td class="md" nowrap>int&nbsp;</td>
467
          <td class="mdname" nowrap> <em>n</em></td>
468
        </tr>
469
        <tr>
470
          <td class="md"></td>
471
          <td class="md">)&nbsp;</td>
472
          <td class="md" colspan="2"></td>
473
        </tr>
474
      </table>
475
    </td>
476
  </tr>
477
</table>
478
<table cellspacing="5" cellpadding="0" border="0">
479
  <tr>
480
    <td>
481
      &nbsp;
482
    </td>
483
    <td>
484
 
485
<p>
486
Get name for section n in a dictionary.
487
<p>
488
<dl compact><dt><b>Parameters:</b></dt><dd>
489
  <table border="0" cellspacing="2" cellpadding="0">
490
    <tr><td valign="top"></td><td valign="top"><em>d</em>&nbsp;</td><td>Dictionary to examine </td></tr>
491
    <tr><td valign="top"></td><td valign="top"><em>n</em>&nbsp;</td><td>Section number (from 0 to nsec-1). </td></tr>
492
  </table>
493
</dl>
494
<dl compact><dt><b>Returns:</b></dt><dd>Pointer to char string</dd></dl>
495
This function locates the n-th section in a dictionary and returns its name as a pointer to a string statically allocated inside the dictionary. Do not free or modify the returned string!<p>
496
This function returns NULL in case of error.    </td>
497
  </tr>
498
</table>
499
<a class="anchor" name="a4"></a><!-- doxytag: member="iniparser.h::iniparser_getstr" ref="a4" args="(dictionary *d, char *key)" --><p>
500
<table class="mdTable" cellpadding="2" cellspacing="0">
501
  <tr>
502
    <td class="mdRow">
503
      <table cellpadding="0" cellspacing="0" border="0">
504
        <tr>
505
          <td class="md" nowrap valign="top">char* iniparser_getstr           </td>
506
          <td class="md" valign="top">(&nbsp;</td>
507
          <td class="md" nowrap valign="top">dictionary *&nbsp;</td>
508
          <td class="mdname" nowrap> <em>d</em>, </td>
509
        </tr>
510
        <tr>
511
          <td class="md" nowrap align="right"></td>
512
          <td class="md"></td>
513
          <td class="md" nowrap>char *&nbsp;</td>
514
          <td class="mdname" nowrap> <em>key</em></td>
515
        </tr>
516
        <tr>
517
          <td class="md"></td>
518
          <td class="md">)&nbsp;</td>
519
          <td class="md" colspan="2"></td>
520
        </tr>
521
      </table>
522
    </td>
523
  </tr>
524
</table>
525
<table cellspacing="5" cellpadding="0" border="0">
526
  <tr>
527
    <td>
528
      &nbsp;
529
    </td>
530
    <td>
531
 
532
<p>
533
Get the string associated to a key, return NULL if not found.
534
<p>
535
<dl compact><dt><b>Parameters:</b></dt><dd>
536
  <table border="0" cellspacing="2" cellpadding="0">
537
    <tr><td valign="top"></td><td valign="top"><em>d</em>&nbsp;</td><td>Dictionary to search </td></tr>
538
    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>Key string to look for </td></tr>
539
  </table>
540
</dl>
541
<dl compact><dt><b>Returns:</b></dt><dd>pointer to statically allocated character string, or NULL.</dd></dl>
542
This function queries a dictionary for a key. A key as read from an ini file is given as "section:key". If the key cannot be found, NULL is returned. The returned char pointer is pointing to a string allocated in the dictionary, do not free or modify it.<p>
543
This function is only provided for backwards compatibility with previous versions of iniparser. It is recommended to use <a class="el" href="iniparser_8h.html#a5">iniparser_getstring()</a> instead.    </td>
544
  </tr>
545
</table>
546
<a class="anchor" name="a5"></a><!-- doxytag: member="iniparser.h::iniparser_getstring" ref="a5" args="(dictionary *d, char *key, char *def)" --><p>
547
<table class="mdTable" cellpadding="2" cellspacing="0">
548
  <tr>
549
    <td class="mdRow">
550
      <table cellpadding="0" cellspacing="0" border="0">
551
        <tr>
552
          <td class="md" nowrap valign="top">char* iniparser_getstring           </td>
553
          <td class="md" valign="top">(&nbsp;</td>
554
          <td class="md" nowrap valign="top">dictionary *&nbsp;</td>
555
          <td class="mdname" nowrap> <em>d</em>, </td>
556
        </tr>
557
        <tr>
558
          <td class="md" nowrap align="right"></td>
559
          <td class="md"></td>
560
          <td class="md" nowrap>char *&nbsp;</td>
561
          <td class="mdname" nowrap> <em>key</em>, </td>
562
        </tr>
563
        <tr>
564
          <td class="md" nowrap align="right"></td>
565
          <td class="md"></td>
566
          <td class="md" nowrap>char *&nbsp;</td>
567
          <td class="mdname" nowrap> <em>def</em></td>
568
        </tr>
569
        <tr>
570
          <td class="md"></td>
571
          <td class="md">)&nbsp;</td>
572
          <td class="md" colspan="2"></td>
573
        </tr>
574
      </table>
575
    </td>
576
  </tr>
577
</table>
578
<table cellspacing="5" cellpadding="0" border="0">
579
  <tr>
580
    <td>
581
      &nbsp;
582
    </td>
583
    <td>
584
 
585
<p>
586
Get the string associated to a key.
587
<p>
588
<dl compact><dt><b>Parameters:</b></dt><dd>
589
  <table border="0" cellspacing="2" cellpadding="0">
590
    <tr><td valign="top"></td><td valign="top"><em>d</em>&nbsp;</td><td>Dictionary to search </td></tr>
591
    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>Key string to look for </td></tr>
592
    <tr><td valign="top"></td><td valign="top"><em>def</em>&nbsp;</td><td>Default value to return if key not found. </td></tr>
593
  </table>
594
</dl>
595
<dl compact><dt><b>Returns:</b></dt><dd>pointer to statically allocated character string</dd></dl>
596
This function queries a dictionary for a key. A key as read from an ini file is given as "section:key". If the key cannot be found, the pointer passed as 'def' is returned. The returned char pointer is pointing to a string allocated in the dictionary, do not free or modify it.    </td>
597
  </tr>
598
</table>
599
<a class="anchor" name="a12"></a><!-- doxytag: member="iniparser.h::iniparser_load" ref="a12" args="(char *ininame)" --><p>
600
<table class="mdTable" cellpadding="2" cellspacing="0">
601
  <tr>
602
    <td class="mdRow">
603
      <table cellpadding="0" cellspacing="0" border="0">
604
        <tr>
605
          <td class="md" nowrap valign="top">dictionary* iniparser_load           </td>
606
          <td class="md" valign="top">(&nbsp;</td>
607
          <td class="md" nowrap valign="top">char *&nbsp;</td>
608
          <td class="mdname1" valign="top" nowrap> <em>ininame</em>          </td>
609
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
610
          <td class="md" nowrap></td>
611
        </tr>
612
      </table>
613
    </td>
614
  </tr>
615
</table>
616
<table cellspacing="5" cellpadding="0" border="0">
617
  <tr>
618
    <td>
619
      &nbsp;
620
    </td>
621
    <td>
622
 
623
<p>
624
Parse an ini file and return an allocated dictionary object.
625
<p>
626
<dl compact><dt><b>Parameters:</b></dt><dd>
627
  <table border="0" cellspacing="2" cellpadding="0">
628
    <tr><td valign="top"></td><td valign="top"><em>ininame</em>&nbsp;</td><td>Name of the ini file to read. </td></tr>
629
  </table>
630
</dl>
631
<dl compact><dt><b>Returns:</b></dt><dd>Pointer to newly allocated dictionary</dd></dl>
632
This is the parser for ini files. This function is called, providing the name of the file to be read. It returns a dictionary object that should not be accessed directly, but through accessor functions instead.<p>
633
The returned dictionary must be freed using <a class="el" href="iniparser_8h.html#a13">iniparser_freedict()</a>.    </td>
634
  </tr>
635
</table>
636
<a class="anchor" name="a9"></a><!-- doxytag: member="iniparser.h::iniparser_setstr" ref="a9" args="(dictionary *ini, char *entry, char *val)" --><p>
637
<table class="mdTable" cellpadding="2" cellspacing="0">
638
  <tr>
639
    <td class="mdRow">
640
      <table cellpadding="0" cellspacing="0" border="0">
641
        <tr>
642
          <td class="md" nowrap valign="top">int iniparser_setstr           </td>
643
          <td class="md" valign="top">(&nbsp;</td>
644
          <td class="md" nowrap valign="top">dictionary *&nbsp;</td>
645
          <td class="mdname" nowrap> <em>ini</em>, </td>
646
        </tr>
647
        <tr>
648
          <td class="md" nowrap align="right"></td>
649
          <td class="md"></td>
650
          <td class="md" nowrap>char *&nbsp;</td>
651
          <td class="mdname" nowrap> <em>entry</em>, </td>
652
        </tr>
653
        <tr>
654
          <td class="md" nowrap align="right"></td>
655
          <td class="md"></td>
656
          <td class="md" nowrap>char *&nbsp;</td>
657
          <td class="mdname" nowrap> <em>val</em></td>
658
        </tr>
659
        <tr>
660
          <td class="md"></td>
661
          <td class="md">)&nbsp;</td>
662
          <td class="md" colspan="2"></td>
663
        </tr>
664
      </table>
665
    </td>
666
  </tr>
667
</table>
668
<table cellspacing="5" cellpadding="0" border="0">
669
  <tr>
670
    <td>
671
      &nbsp;
672
    </td>
673
    <td>
674
 
675
<p>
676
Set an entry in a dictionary.
677
<p>
678
<dl compact><dt><b>Parameters:</b></dt><dd>
679
  <table border="0" cellspacing="2" cellpadding="0">
680
    <tr><td valign="top"></td><td valign="top"><em>ini</em>&nbsp;</td><td>Dictionary to modify. </td></tr>
681
    <tr><td valign="top"></td><td valign="top"><em>entry</em>&nbsp;</td><td>Entry to modify (entry name) </td></tr>
682
    <tr><td valign="top"></td><td valign="top"><em>val</em>&nbsp;</td><td>New value to associate to the entry. </td></tr>
683
  </table>
684
</dl>
685
<dl compact><dt><b>Returns:</b></dt><dd>int 0 if Ok, -1 otherwise.</dd></dl>
686
If the given entry can be found in the dictionary, it is modified to contain the provided value. If it cannot be found, -1 is returned. It is Ok to set val to NULL.    </td>
687
  </tr>
688
</table>
689
<a class="anchor" name="a10"></a><!-- doxytag: member="iniparser.h::iniparser_unset" ref="a10" args="(dictionary *ini, char *entry)" --><p>
690
<table class="mdTable" cellpadding="2" cellspacing="0">
691
  <tr>
692
    <td class="mdRow">
693
      <table cellpadding="0" cellspacing="0" border="0">
694
        <tr>
695
          <td class="md" nowrap valign="top">void iniparser_unset           </td>
696
          <td class="md" valign="top">(&nbsp;</td>
697
          <td class="md" nowrap valign="top">dictionary *&nbsp;</td>
698
          <td class="mdname" nowrap> <em>ini</em>, </td>
699
        </tr>
700
        <tr>
701
          <td class="md" nowrap align="right"></td>
702
          <td class="md"></td>
703
          <td class="md" nowrap>char *&nbsp;</td>
704
          <td class="mdname" nowrap> <em>entry</em></td>
705
        </tr>
706
        <tr>
707
          <td class="md"></td>
708
          <td class="md">)&nbsp;</td>
709
          <td class="md" colspan="2"></td>
710
        </tr>
711
      </table>
712
    </td>
713
  </tr>
714
</table>
715
<table cellspacing="5" cellpadding="0" border="0">
716
  <tr>
717
    <td>
718
      &nbsp;
719
    </td>
720
    <td>
721
 
722
<p>
723
Delete an entry in a dictionary.
724
<p>
725
<dl compact><dt><b>Parameters:</b></dt><dd>
726
  <table border="0" cellspacing="2" cellpadding="0">
727
    <tr><td valign="top"></td><td valign="top"><em>ini</em>&nbsp;</td><td>Dictionary to modify </td></tr>
728
    <tr><td valign="top"></td><td valign="top"><em>entry</em>&nbsp;</td><td>Entry to delete (entry name) </td></tr>
729
  </table>
730
</dl>
731
<dl compact><dt><b>Returns:</b></dt><dd>void</dd></dl>
732
If the given entry can be found, it is deleted from the dictionary.    </td>
733
  </tr>
734
</table>
735
 
736
</body>
737
</html>