Initial commit
[platform/upstream/glib2.0.git] / docs / reference / gobject / html / gobject-Varargs-Value-Collection.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Varargs Value Collection</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
7 <link rel="home" href="index.html" title="GObject Reference Manual">
8 <link rel="up" href="rn01.html" title="API Reference">
9 <link rel="prev" href="gobject-GParamSpec.html" title="GParamSpec">
10 <link rel="next" href="gobject-Signals.html" title="Signals">
11 <meta name="generator" content="GTK-Doc V1.13 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 <link rel="preface" href="pr01.html" title="Introduction">
14 <link rel="part" href="pt01.html" title="Part I. Concepts">
15 <link rel="chapter" href="chapter-intro.html" title="Background">
16 <link rel="chapter" href="chapter-gtype.html" title="The GLib Dynamic Type System">
17 <link rel="chapter" href="chapter-gobject.html" title="The GObject base class">
18 <link rel="chapter" href="chapter-signal.html" title="The GObject messaging system">
19 <link rel="reference" href="rn01.html" title="API Reference">
20 <link rel="reference" href="rn02.html" title="Tools Reference">
21 <link rel="part" href="pt02.html" title="Part IV. Tutorial">
22 <link rel="chapter" href="howto-gobject.html" title="How to define and implement a new GObject">
23 <link rel="chapter" href="howto-interface.html" title="How to define and implement interfaces">
24 <link rel="chapter" href="howto-signals.html" title="How to create and use signals">
25 <link rel="part" href="pt03.html" title="Part V. Related Tools">
26 <link rel="chapter" href="tools-vala.html" title="Vala">
27 <link rel="chapter" href="tools-gob.html" title="GObject builder">
28 <link rel="chapter" href="tools-ginspector.html" title="Graphical inspection of GObjects">
29 <link rel="chapter" href="tools-refdb.html" title="Debugging reference count problems">
30 <link rel="chapter" href="tools-gtkdoc.html" title="Writing API docs">
31 <link rel="index" href="api-index-full.html" title="Index">
32 <link rel="index" href="api-index-deprecated.html" title="Index of deprecated symbols">
33 <link rel="index" href="api-index-2-2.html" title="Index of new symbols in 2.2">
34 <link rel="index" href="api-index-2-4.html" title="Index of new symbols in 2.4">
35 <link rel="index" href="api-index-2-6.html" title="Index of new symbols in 2.6">
36 <link rel="index" href="api-index-2-8.html" title="Index of new symbols in 2.8">
37 <link rel="index" href="api-index-2-10.html" title="Index of new symbols in 2.10">
38 <link rel="index" href="api-index-2-12.html" title="Index of new symbols in 2.12">
39 <link rel="index" href="api-index-2-14.html" title="Index of new symbols in 2.14">
40 <link rel="index" href="api-index-2-18.html" title="Index of new symbols in 2.18">
41 <link rel="index" href="api-index-2-22.html" title="Index of new symbols in 2.22">
42 <link rel="index" href="api-index-2-24.html" title="Index of new symbols in 2.24">
43 </head>
44 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
45 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
46 <tr valign="middle">
47 <td><a accesskey="p" href="gobject-GParamSpec.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
48 <td><a accesskey="u" href="rn01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
49 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
50 <th width="100%" align="center">GObject Reference Manual</th>
51 <td><a accesskey="n" href="gobject-Signals.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
52 </tr>
53 <tr><td colspan="5" class="shortcuts">
54 <a href="#gobject-Varargs-Value-Collection.synopsis" class="shortcut">Top</a>
55                    | 
56                   <a href="#gobject-Varargs-Value-Collection.description" class="shortcut">Description</a>
57 </td></tr>
58 </table>
59 <div class="refentry" title="Varargs Value Collection">
60 <a name="gobject-Varargs-Value-Collection"></a><div class="titlepage"></div>
61 <div class="refnamediv"><table width="100%"><tr>
62 <td valign="top">
63 <h2><span class="refentrytitle"><a name="gobject-Varargs-Value-Collection.top_of_page"></a>Varargs Value Collection</span></h2>
64 <p>Varargs Value Collection — Converting varargs to generic values</p>
65 </td>
66 <td valign="top" align="right"></td>
67 </tr></table></div>
68 <div class="refsynopsisdiv" title="Synopsis">
69 <a name="gobject-Varargs-Value-Collection.synopsis"></a><h2>Synopsis</h2>
70 <pre class="synopsis">
71 #include &lt;glib-object.h&gt;
72 #include &lt;gobject/gvaluecollector.h&gt;
73
74 union               <a class="link" href="gobject-Varargs-Value-Collection.html#GTypeCValue" title="union GTypeCValue">GTypeCValue</a>;
75 #define             <a class="link" href="gobject-Varargs-Value-Collection.html#G-VALUE-COLLECT:CAPS" title="G_VALUE_COLLECT()">G_VALUE_COLLECT</a>                     (value, var_args, flags, __error)
76 #define             <a class="link" href="gobject-Varargs-Value-Collection.html#G-VALUE-LCOPY:CAPS" title="G_VALUE_LCOPY()">G_VALUE_LCOPY</a>                       (value, var_args, flags, __error)
77 #define             <a class="link" href="gobject-Varargs-Value-Collection.html#G-VALUE-COLLECT-FORMAT-MAX-LENGTH:CAPS" title="G_VALUE_COLLECT_FORMAT_MAX_LENGTH">G_VALUE_COLLECT_FORMAT_MAX_LENGTH</a>
78 </pre>
79 </div>
80 <div class="refsect1" title="Description">
81 <a name="gobject-Varargs-Value-Collection.description"></a><h2>Description</h2>
82 <p>
83 The macros in this section provide the varargs parsing support needed
84 in variadic GObject functions such as <a class="link" href="gobject-The-Base-Object-Type.html#g-object-new" title="g_object_new ()"><code class="function">g_object_new()</code></a> or <a class="link" href="gobject-The-Base-Object-Type.html#g-object-set" title="g_object_set ()"><code class="function">g_object_set()</code></a>.
85 They currently support the collection of integral types, floating point 
86 types and pointers.</p>
87 </div>
88 <div class="refsect1" title="Details">
89 <a name="gobject-Varargs-Value-Collection.details"></a><h2>Details</h2>
90 <div class="refsect2" title="union GTypeCValue">
91 <a name="GTypeCValue"></a><h3>union GTypeCValue</h3>
92 <pre class="programlisting">union GTypeCValue
93 {
94   gint     v_int;
95   glong    v_long;
96   gint64   v_int64;
97   gdouble  v_double;
98   gpointer v_pointer;
99 };
100 </pre>
101 <p>
102 A union holding one collected value.</p>
103 </div>
104 <hr>
105 <div class="refsect2" title="G_VALUE_COLLECT()">
106 <a name="G-VALUE-COLLECT:CAPS"></a><h3>G_VALUE_COLLECT()</h3>
107 <pre class="programlisting">#define             G_VALUE_COLLECT(value, var_args, flags, __error)</pre>
108 <p>
109 Collects a variable argument value from a va_list. We have to
110 implement the varargs collection as a macro, because on some systems
111 va_list variables cannot be passed by reference.
112 </p>
113 <p>
114 Note: If you are creating the <em class="parameter"><code>value</code></em> argument just before calling this macro,
115 you should use the <span class="type">G_VALUE_COLLECT_INIT</span> variant and pass the unitialized
116 <a class="link" href="gobject-Generic-values.html#GValue" title="GValue"><span class="type">GValue</span></a>. That variant is faster than <a class="link" href="gobject-Varargs-Value-Collection.html#G-VALUE-COLLECT:CAPS" title="G_VALUE_COLLECT()"><span class="type">G_VALUE_COLLECT</span></a>.</p>
117 <div class="variablelist"><table border="0">
118 <col align="left" valign="top">
119 <tbody>
120 <tr>
121 <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
122 <td> a <a class="link" href="gobject-Generic-values.html#GValue" title="GValue"><span class="type">GValue</span></a> return location. <em class="parameter"><code>value</code></em> is supposed to be initialized
123  according to the value type to be collected
124 </td>
125 </tr>
126 <tr>
127 <td><p><span class="term"><em class="parameter"><code>var_args</code></em> :</span></p></td>
128 <td> the va_list variable; it may be evaluated multiple times
129 </td>
130 </tr>
131 <tr>
132 <td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
133 <td> flags which are passed on to the <code class="function">collect_value()</code> function of
134  the <a class="link" href="gobject-Type-Information.html#GTypeValueTable" title="GTypeValueTable"><span class="type">GTypeValueTable</span></a> of <em class="parameter"><code>value</code></em>.
135 </td>
136 </tr>
137 <tr>
138 <td><p><span class="term"><em class="parameter"><code>__error</code></em> :</span></p></td>
139 <td> a <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>** variable that will be modified to hold a <a href="./../glib/glib/glib-Memory-Allocation.html#g-new"><code class="function">g_new()</code></a>
140  allocated error messages if something fails
141 </td>
142 </tr>
143 </tbody>
144 </table></div>
145 </div>
146 <hr>
147 <div class="refsect2" title="G_VALUE_LCOPY()">
148 <a name="G-VALUE-LCOPY:CAPS"></a><h3>G_VALUE_LCOPY()</h3>
149 <pre class="programlisting">#define             G_VALUE_LCOPY(value, var_args, flags, __error)</pre>
150 <p>
151 Collects a value's variable argument locations from a va_list. Usage is
152 analogous to <a class="link" href="gobject-Varargs-Value-Collection.html#G-VALUE-COLLECT:CAPS" title="G_VALUE_COLLECT()"><code class="function">G_VALUE_COLLECT()</code></a>.</p>
153 <div class="variablelist"><table border="0">
154 <col align="left" valign="top">
155 <tbody>
156 <tr>
157 <td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
158 <td> a <a class="link" href="gobject-Generic-values.html#GValue" title="GValue"><span class="type">GValue</span></a> return location. <em class="parameter"><code>value</code></em> is supposed to be initialized 
159  according to the value type to be collected
160 </td>
161 </tr>
162 <tr>
163 <td><p><span class="term"><em class="parameter"><code>var_args</code></em> :</span></p></td>
164 <td> the va_list variable; it may be evaluated multiple times
165 </td>
166 </tr>
167 <tr>
168 <td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
169 <td> flags which are passed on to the <code class="function">lcopy_value()</code> function of
170  the <a class="link" href="gobject-Type-Information.html#GTypeValueTable" title="GTypeValueTable"><span class="type">GTypeValueTable</span></a> of <em class="parameter"><code>value</code></em>.
171 </td>
172 </tr>
173 <tr>
174 <td><p><span class="term"><em class="parameter"><code>__error</code></em> :</span></p></td>
175 <td> a <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>** variable that will be modified to hold a <a href="./../glib/glib/glib-Memory-Allocation.html#g-new"><code class="function">g_new()</code></a>
176  allocated error messages if something fails
177 </td>
178 </tr>
179 </tbody>
180 </table></div>
181 </div>
182 <hr>
183 <div class="refsect2" title="G_VALUE_COLLECT_FORMAT_MAX_LENGTH">
184 <a name="G-VALUE-COLLECT-FORMAT-MAX-LENGTH:CAPS"></a><h3>G_VALUE_COLLECT_FORMAT_MAX_LENGTH</h3>
185 <pre class="programlisting">#define G_VALUE_COLLECT_FORMAT_MAX_LENGTH (8)
186 </pre>
187 <p>
188 The maximal number of <a class="link" href="gobject-Varargs-Value-Collection.html#GTypeCValue" title="union GTypeCValue"><span class="type">GTypeCValue</span></a>s which can be collected for a 
189 single <a class="link" href="gobject-Generic-values.html#GValue" title="GValue"><span class="type">GValue</span></a>.</p>
190 </div>
191 </div>
192 <div class="refsect1" title="See Also">
193 <a name="gobject-Varargs-Value-Collection.see-also"></a><h2>See Also</h2>
194 <span class="type">GValueTable</span>
195 </div>
196 </div>
197 <div class="footer">
198 <hr>
199           Generated by GTK-Doc V1.13</div>
200 </body>
201 </html>