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
|
<!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>NeL: string_common.h File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex"> <form class="search" action="search.php" method="get">
<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
<h1>string_common.h File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
common algorithms on string like toString() and fromString()<p>
<dl compact><dt><b>Id</b></dt><dd><a class="el" href="a05042.html">string_common.h</a>,v 1.4 2004/01/07 18:31:13 lecroart Exp </dd></dl>
<p>
Definition in file <a class="el" href="a06465.html">string_common.h</a>.
<p>
<code>#include "<a class="el" href="a06590.html">nel/misc/types_nl.h</a>"</code><br>
<code>#include <cstdio></code><br>
<code>#include <cstdarg></code><br>
<p>
<a href="a06465.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Namespaces</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>namespace </td><td class="memItemRight" valign=bottom><a class="el" href="a05378.html">NLMISC</a></td></tr>
<tr><td colspan=2><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>#define </td><td class="memItemRight" valign=bottom><a class="el" href="a05042.html#a0">NLMISC_CONVERT_VARGS</a>(_dest, _format, _size)</td></tr>
</table>
<hr><h2>Define Documentation</h2>
<a class="anchor" name="a0" doxytag="string_common.h::NLMISC_CONVERT_VARGS" ></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 NLMISC_CONVERT_VARGS</td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">_dest, <tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>_format, <tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>_size </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<b>Value:</b><div class="fragment"><pre><span class="keywordtype">char</span> _cstring[_size]; \
va_list _args; \
va_start (_args, _format); \
<span class="keywordtype">int</span> _res = vsnprintf (_cstring, _size-1, _format, _args); \
<span class="keywordflow">if</span> (_res == -1 || _res == _size-1) \
{ \
_cstring[_size-1] = <span class="charliteral">'\0'</span>; \
} \
va_end (_args); \
_dest = _cstring
</pre></div>This macro converts variable arguments into C string (zero terminated string). This function takes care to avoid buffer overflow.<p>
Example: <pre class="fragment"><div> <span class="keywordtype">void</span> MyFunction(<span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="a04223.html#a641">format</a>, ...)
{
string str;
<a class="code" href="a05042.html#a0">NLMISC_CONVERT_VARGS</a> (str, format, NLMISC::MaxCStringSize);
<span class="comment">// str contains the result of the conversion</span>
}
*
</div></pre><p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>_dest</em> </td><td><code>string</code> or <code>char*</code> that contains the result of the convertion </td></tr>
<tr><td valign=top><em>_format</em> </td><td>format of the string, it must be the last argument before the <code>'</code>...' </td></tr>
<tr><td valign=top><em>_size</em> </td><td>size of the buffer that will contain the C string </td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="a06465.html#l00070">70</a> of file <a class="el" href="a06465.html">string_common.h</a>.
<p>
Referenced by <a class="el" href="a05943.html#l00348">NLMISC::CLog::display()</a>, <a class="el" href="a05943.html#l00323">NLMISC::CLog::displayNL()</a>, <a class="el" href="a05943.html#l00467">NLMISC::CLog::displayRaw()</a>, <a class="el" href="a05943.html#l00442">NLMISC::CLog::displayRawNL()</a>, <a class="el" href="a05586.html#l00666">NLMISC::Exception::Exception()</a>, <a class="el" href="a05943.html#l00485">NLMISC::CLog::forceDisplayRaw()</a>, <a class="el" href="a05621.html#l00134">NLMISC::nlError()</a>, <a class="el" href="a05621.html#l00115">NLMISC::nlFatalError()</a>, <a class="el" href="a06503.html#l00333">NL3D::CTextContextUser::printfAt()</a>, <a class="el" href="a06502.html#l00218">NL3D::CTextContext::printfAt()</a>, <a class="el" href="a06503.html#l00357">NL3D::CTextContextUser::render3D()</a>, <a class="el" href="a05391.html#l00612">NLNET::sendAdminEmail()</a>, <a class="el" href="a06503.html#l00216">NL3D::CTextContextUser::textPush()</a>, <a class="el" href="a06501.html#l00068">NL3D::CTextContext::textPush()</a>, <a class="el" href="a06465.html#l00157">NLMISC::toString()</a>, <a class="el" href="a05800.html#l00129">NLMISC::xmlGenericErrorFuncRead()</a>, and <a class="el" href="a06107.html#l00101">NLMISC::xmlGenericErrorFuncWrite()</a>. </td>
</tr>
</table>
<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:43:22 2004 for NeL by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 >
</a>1.3.6 </small></address>
</body>
</html>
|