File: group__Utilities.html

package info (click to toggle)
qof 0.5.0-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,376 kB
  • ctags: 2,995
  • sloc: ansic: 14,210; sh: 7,273; makefile: 204; yacc: 184; lex: 123
file content (431 lines) | stat: -rw-r--r-- 17,592 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>QOF: Misc Utilities</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.6-20040222 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<h1>Misc Utilities<br>
<small>
[<a class="el" href="group__QOF.html">Query Object Framework</a>]</small>
</h1>
<p>
<table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Files</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>file &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="gnc-engine-util_8h.html">gnc-engine-util.h</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">GnuCash engine utility functions. <br><br></td></tr>

<p>
<tr><td colspan=2><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="group__Utilities.html#ga12">SAFE_STRCMP_REAL</a>(fcn, da, db)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="ga13" doxytag="Utilities::SAFE_STRCMP" ></a>
#define&nbsp;</td><td class="memItemRight" valign=bottom><b>SAFE_STRCMP</b>(da, db)&nbsp;&nbsp;&nbsp;SAFE_STRCMP_REAL(strcmp,(da),(db))</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="ga14" doxytag="Utilities::SAFE_STRCASECMP" ></a>
#define&nbsp;</td><td class="memItemRight" valign=bottom><b>SAFE_STRCASECMP</b>(da, db)&nbsp;&nbsp;&nbsp;SAFE_STRCMP_REAL(strcasecmp,(da),(db))</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="ga15" doxytag="Utilities::GNC_SCANF_LLD" ></a>
#define&nbsp;</td><td class="memItemRight" valign=bottom><b>GNC_SCANF_LLD</b>&nbsp;&nbsp;&nbsp;"%qd"</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="ga16" doxytag="Utilities::stpcpy" ></a>
#define&nbsp;</td><td class="memItemRight" valign=bottom><b>stpcpy</b>&nbsp;&nbsp;&nbsp;gnc_stpcpy</td></tr>

<tr><td colspan=2><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="group__Utilities.html#ga0">safe_strcmp</a> (const char *da, const char *db)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="ga1" doxytag="Utilities::safe_strcasecmp" ></a>
int&nbsp;</td><td class="memItemRight" valign=bottom><b>safe_strcasecmp</b> (const char *da, const char *db)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="group__Utilities.html#ga2">null_strcmp</a> (const char *da, const char *db)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="group__Utilities.html#ga3">strncasestr</a> (const char *str1, const char *str2, size_t len)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="ga4" doxytag="Utilities::strcasestr" ></a>
char *&nbsp;</td><td class="memItemRight" valign=bottom><b>strcasestr</b> (const char *str1, const char *str2)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="group__Utilities.html#ga5">ultostr</a> (unsigned long val, int base)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>gboolean&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="group__Utilities.html#ga6">gnc_strisnum</a> (const char *s)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="group__Utilities.html#ga7">gnc_stpcpy</a> (char *dest, const char *src)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>const char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="group__Utilities.html#ga8">qof_util_whitespace_filter</a> (const char *val)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="group__Utilities.html#ga9">qof_util_bool_to_int</a> (const char *val)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>GCache *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="group__Utilities.html#ga10">gnc_engine_get_string_cache</a> (void)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="ga11" doxytag="Utilities::gnc_engine_string_cache_destroy" ></a>
void&nbsp;</td><td class="memItemRight" valign=bottom><b>gnc_engine_string_cache_destroy</b> (void)</td></tr>

</table>
<hr><h2>Define Documentation</h2>
<a class="anchor" name="ga12" doxytag="gnc-engine-util.h::SAFE_STRCMP_REAL" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> #define SAFE_STRCMP_REAL</td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">fcn,         <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>da,         <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>db&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
<b>Value:</b><div class="fragment"><pre>{    \
  <span class="keywordflow">if</span> ((da) &amp;&amp; (db)) {                    \
    <span class="keywordflow">if</span> ((da) != (db)) {                  \
      <span class="keywordtype">int</span> retval = fcn ((da), (db));     \
      <span class="comment">/* if strings differ, return */</span>    \
      <span class="keywordflow">if</span> (retval) <span class="keywordflow">return</span> retval;         \
    }                                    \
  } <span class="keywordflow">else</span>                                 \
  <span class="keywordflow">if</span> ((!(da)) &amp;&amp; (db)) {                 \
    <span class="keywordflow">return</span> -1;                           \
  } <span class="keywordflow">else</span>                                 \
  <span class="keywordflow">if</span> ((da) &amp;&amp; (!(db))) {                 \
    <span class="keywordflow">return</span> +1;                           \
  }                                      \
}
</pre></div>Macros ****************************************************     </td>
  </tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="ga10" doxytag="gnc-engine-util.h::gnc_engine_get_string_cache" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> GCache* gnc_engine_get_string_cache </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Get the gnc_string_cache. Create it if it doesn't exist already     </td>
  </tr>
</table>
<a class="anchor" name="ga7" doxytag="gnc-engine-util.h::gnc_stpcpy" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> char* gnc_stpcpy </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">char *&nbsp;</td>
          <td class="mdname" nowrap> <em>dest</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap> <em>src</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Local copy of stpcpy, used wtih libc's that don't have one.     </td>
  </tr>
</table>
<a class="anchor" name="ga6" doxytag="gnc-engine-util.h::gnc_strisnum" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> gboolean gnc_strisnum </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>s</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Returns true if string s is a number, possibly surrounded by whitespace.     </td>
  </tr>
</table>
<a class="anchor" name="ga2" doxytag="gnc-engine-util.h::null_strcmp" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int null_strcmp </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap> <em>da</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap> <em>db</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
The null_strcmp compares strings a and b the same way that strcmp() does, except that either may be null. This routine assumes that a null string is equal to the empty string.     </td>
  </tr>
</table>
<a class="anchor" name="ga9" doxytag="gnc-engine-util.h::qof_util_bool_to_int" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int qof_util_bool_to_int </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>val</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Return integer 1 if the string starts with 't' or 'T' or contains the word 'true' or 'TRUE'; if string is a number, return that number. (Leading whitespace is ignored).     </td>
  </tr>
</table>
<a class="anchor" name="ga8" doxytag="gnc-engine-util.h::qof_util_whitespace_filter" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> const char* qof_util_whitespace_filter </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>val</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Return NULL if the field is whitespace (blank, tab, formfeed etc.) Else return pointer to first non-whitespace character.     </td>
  </tr>
</table>
<a class="anchor" name="ga0" doxytag="gnc-engine-util.h::safe_strcmp" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int safe_strcmp </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap> <em>da</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap> <em>db</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
The safe_strcmp compares strings a and b the same way that strcmp() does, except that either may be null. This routine assumes that a non-null string is always greater than a null string.     </td>
  </tr>
</table>
<a class="anchor" name="ga3" doxytag="gnc-engine-util.h::strncasestr" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> char* strncasestr </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap> <em>str1</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap> <em>str2</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>size_t&nbsp;</td>
          <td class="mdname" nowrap> <em>len</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Search for str2 in first nchar chars of str1, ignore case. Return pointer to first match, or null. These are just like that strnstr and the strstr functions, except that they ignore the case.     </td>
  </tr>
</table>
<a class="anchor" name="ga5" doxytag="gnc-engine-util.h::ultostr" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> char* ultostr </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">unsigned long&nbsp;</td>
          <td class="mdname" nowrap> <em>val</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>int&nbsp;</td>
          <td class="mdname" nowrap> <em>base</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
The <a class="el" href="group__Utilities.html#ga7">ultostr()</a> subroutine is the inverse of strtoul(). It accepts a number and prints it in the indicated base. The returned string should be g_freed when done.     </td>
  </tr>
</table>
<hr size="1"><address style="align: right;"><small>Generated on Sun May 23 15:41:47 2004 for QOF by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 > </a>1.3.6-20040222 </small></address>
</body>
</html>