Tizen 2.1 base
[platform/upstream/glib2.0.git] / docs / reference / gio / html / gio-GResource.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>GResource</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7 <link rel="home" href="index.html" title="GIO Reference Manual">
8 <link rel="up" href="resources.html" title="Resources">
9 <link rel="prev" href="resources.html" title="Resources">
10 <link rel="next" href="permissions.html" title="Permissions">
11 <meta name="generator" content="GTK-Doc V1.18 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
16 <tr valign="middle">
17 <td><a accesskey="p" href="resources.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18 <td><a accesskey="u" href="resources.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
19 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
20 <th width="100%" align="center">GIO Reference Manual</th>
21 <td><a accesskey="n" href="permissions.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
22 </tr>
23 <tr><td colspan="5" class="shortcuts">
24 <a href="#gio-GResource.synopsis" class="shortcut">Top</a>
25                    | 
26                   <a href="#gio-GResource.description" class="shortcut">Description</a>
27 </td></tr>
28 </table>
29 <div class="refentry">
30 <a name="gio-GResource"></a><div class="titlepage"></div>
31 <div class="refnamediv"><table width="100%"><tr>
32 <td valign="top">
33 <h2><span class="refentrytitle"><a name="gio-GResource.top_of_page"></a>GResource</span></h2>
34 <p>GResource — Resource framework</p>
35 </td>
36 <td valign="top" align="right"></td>
37 </tr></table></div>
38 <div class="refsynopsisdiv">
39 <a name="gio-GResource.synopsis"></a><h2>Synopsis</h2>
40 <pre class="synopsis">
41 #include &lt;gio/gio.h&gt;
42
43                     <a class="link" href="gio-GResource.html#GResource" title="GResource">GResource</a>;
44 enum                <a class="link" href="gio-GResource.html#GResourceFlags" title="enum GResourceFlags">GResourceFlags</a>;
45 enum                <a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags">GResourceLookupFlags</a>;
46 <a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="returnvalue">GResource</span></a> *         <a class="link" href="gio-GResource.html#g-resource-load" title="g_resource_load ()">g_resource_load</a>                     (<em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *filename</code></em>,
47                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
48 <a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="returnvalue">GResource</span></a> *         <a class="link" href="gio-GResource.html#g-resource-new-from-data" title="g_resource_new_from_data ()">g_resource_new_from_data</a>            (<em class="parameter"><code><a href="./../glib/glib/glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> *data</code></em>,
49                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
50 <a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="returnvalue">GResource</span></a> *         <a class="link" href="gio-GResource.html#g-resource-ref" title="g_resource_ref ()">g_resource_ref</a>                      (<em class="parameter"><code><a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> *resource</code></em>);
51 <span class="returnvalue">void</span>                <a class="link" href="gio-GResource.html#g-resource-unref" title="g_resource_unref ()">g_resource_unref</a>                    (<em class="parameter"><code><a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> *resource</code></em>);
52 <a href="./../glib/glib/glib-Byte-Arrays.html#GBytes"><span class="returnvalue">GBytes</span></a> *            <a class="link" href="gio-GResource.html#g-resource-lookup-data" title="g_resource_lookup_data ()">g_resource_lookup_data</a>              (<em class="parameter"><code><a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> *resource</code></em>,
53                                                          <em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
54                                                          <em class="parameter"><code><a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
55                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
56 <a class="link" href="GInputStream.html" title="GInputStream"><span class="returnvalue">GInputStream</span></a> *      <a class="link" href="gio-GResource.html#g-resource-open-stream" title="g_resource_open_stream ()">g_resource_open_stream</a>              (<em class="parameter"><code><a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> *resource</code></em>,
57                                                          <em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
58                                                          <em class="parameter"><code><a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
59                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
60 <span class="returnvalue">char</span> **             <a class="link" href="gio-GResource.html#g-resource-enumerate-children" title="g_resource_enumerate_children ()">g_resource_enumerate_children</a>       (<em class="parameter"><code><a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> *resource</code></em>,
61                                                          <em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
62                                                          <em class="parameter"><code><a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
63                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
64 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gio-GResource.html#g-resource-get-info" title="g_resource_get_info ()">g_resource_get_info</a>                 (<em class="parameter"><code><a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> *resource</code></em>,
65                                                          <em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
66                                                          <em class="parameter"><code><a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
67                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> *size</code></em>,
68                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> *flags</code></em>,
69                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
70
71 <span class="returnvalue">void</span>                <a class="link" href="gio-GResource.html#g-resources-register" title="g_resources_register ()">g_resources_register</a>                (<em class="parameter"><code><a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> *resource</code></em>);
72 <span class="returnvalue">void</span>                <a class="link" href="gio-GResource.html#g-resources-unregister" title="g_resources_unregister ()">g_resources_unregister</a>              (<em class="parameter"><code><a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> *resource</code></em>);
73 <a href="./../glib/glib/glib-Byte-Arrays.html#GBytes"><span class="returnvalue">GBytes</span></a> *            <a class="link" href="gio-GResource.html#g-resources-lookup-data" title="g_resources_lookup_data ()">g_resources_lookup_data</a>             (<em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
74                                                          <em class="parameter"><code><a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
75                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
76 <a class="link" href="GInputStream.html" title="GInputStream"><span class="returnvalue">GInputStream</span></a> *      <a class="link" href="gio-GResource.html#g-resources-open-stream" title="g_resources_open_stream ()">g_resources_open_stream</a>             (<em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
77                                                          <em class="parameter"><code><a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
78                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
79 <span class="returnvalue">char</span> **             <a class="link" href="gio-GResource.html#g-resources-enumerate-children" title="g_resources_enumerate_children ()">g_resources_enumerate_children</a>      (<em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
80                                                          <em class="parameter"><code><a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
81                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
82 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gio-GResource.html#g-resources-get-info" title="g_resources_get_info ()">g_resources_get_info</a>                (<em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
83                                                          <em class="parameter"><code><a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
84                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> *size</code></em>,
85                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> *flags</code></em>,
86                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
87
88 #define             <a class="link" href="gio-GResource.html#G-RESOURCE-ERROR:CAPS" title="G_RESOURCE_ERROR">G_RESOURCE_ERROR</a>
89 enum                <a class="link" href="gio-GResource.html#GResourceError" title="enum GResourceError">GResourceError</a>;
90 </pre>
91 </div>
92 <div class="refsect1">
93 <a name="gio-GResource.description"></a><h2>Description</h2>
94 <p>
95 Applications and libraries often contain binary or textual data that is really part of the
96 application, rather than user data. For instance <a href="http://developer.gnome.org/devel/gtk/GtkBuilder.html"><span class="type">GtkBuilder</span></a> .ui files, splashscreen images,
97 GMenu markup xml, CSS files, icons, etc. These are often shipped as files in <code class="filename">$datadir/appname</code>, or
98 manually included as literal strings in the code.
99 </p>
100 <p>
101 The <a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> API and the <a href="glib-compile-resources.html">glib-compile-resources</a> program
102 provide a convenient and efficient alternative to this which has some nice properties. You
103 maintain the files as normal files, so its easy to edit them, but during the build the files
104 are combined into a binary bundle that is linked into the executable. This means that loading
105 the resource files are efficient (as they are already in memory, shared with other instances) and
106 simple (no need to check for things like I/O errors or locate the files in the filesystem). It
107 also makes it easier to create relocatable applications.
108 </p>
109 <p>
110 Resource files can also be marked as compressed. Such files will be included in the resource bundle
111 in a compressed form, but will be automatically uncompressed when the resource is used. This
112 is very useful e.g. for larger text files that are parsed once (or rarely) and then thrown away.
113 </p>
114 <p>
115 Resource files can also be marked to be preprocessed, by setting the value of the
116 <code class="literal">preprocess</code> attribute to a comma-separated list of preprocessing options.
117 The only options currently supported are:
118 </p>
119 <p>
120 <code class="literal">xml-stripblanks</code> which will use <span class="command"><strong>xmllint</strong></span> to strip
121 ignorable whitespace from the xml file. For this to work, the <code class="envar">XMLLINT</code>
122 environment variable must be set to the full path to the xmllint executable, or xmllint
123 must be in the PATH; otherwise the preprocessing step is skipped.
124 </p>
125 <p>
126 <code class="literal">to-pixdata</code> which will use <span class="command"><strong>gdk-pixbuf-pixdata</strong></span> to convert
127 images to the GdkPixdata format, which allows you to create pixbufs directly using the data inside
128 the resource file, rather than an (uncompressed) copy if it. For this, the gdk-pixbuf-pixdata
129 program must be in the PATH, or the <code class="envar">GDK_PIXBUF_PIXDATA</code> environment variable must be
130 set to the full path to the gdk-pixbuf-pixdata executable; otherwise the resource compiler will
131 abort.
132 </p>
133 <p>
134 Resource bundles are created by the <a href="glib-compile-resources.html">glib-compile-resources</a> program
135 which takes an xml file that describes the bundle, and a set of files that the xml references. These
136 are combined into a binary resource bundle.
137 </p>
138 <p>
139 </p>
140 <div class="example">
141 <a name="resource-example"></a><p class="title"><b>Example 13. Example resource description</b></p>
142 <div class="example-contents">
143   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
144     <tbody>
145       <tr>
146         <td class="listing_lines" align="right"><pre>1
147 2
148 3
149 4
150 5
151 6
152 7
153 8</pre></td>
154         <td class="listing_code"><pre class="programlisting"><span class="symbol">&lt;?</span><span class="usertype">xml</span><span class="normal"> version</span><span class="symbol">=</span><span class="string">"1.0"</span><span class="normal"> encoding</span><span class="symbol">=</span><span class="string">"UTF-8"</span><span class="symbol">?&gt;</span>
155 <span class="symbol">&lt;</span><span class="normal">gresources</span><span class="symbol">&gt;</span>
156 <span class="normal">  </span><span class="symbol">&lt;</span><span class="usertype">gresource</span><span class="normal"> prefix</span><span class="symbol">=</span><span class="string">"/org/gtk/Example"</span><span class="symbol">&gt;</span>
157 <span class="normal">    </span><span class="symbol">&lt;</span><span class="normal">file</span><span class="symbol">&gt;</span><span class="normal">data</span><span class="symbol">/</span><span class="normal">splashscreen</span><span class="symbol">.</span><span class="normal">png</span><span class="symbol">&lt;/</span><span class="normal">file</span><span class="symbol">&gt;</span>
158 <span class="normal">    </span><span class="symbol">&lt;</span><span class="usertype">file</span><span class="normal"> compressed</span><span class="symbol">=</span><span class="string">"true"</span><span class="symbol">&gt;</span><span class="normal">dialog</span><span class="symbol">.</span><span class="normal">ui</span><span class="symbol">&lt;/</span><span class="normal">file</span><span class="symbol">&gt;</span>
159 <span class="normal">    </span><span class="symbol">&lt;</span><span class="usertype">file</span><span class="normal"> preprocess</span><span class="symbol">=</span><span class="string">"xml-stripblanks"</span><span class="symbol">&gt;</span><span class="normal">menumarkup</span><span class="symbol">.</span><span class="normal">xml</span><span class="symbol">&lt;/</span><span class="normal">file</span><span class="symbol">&gt;</span>
160 <span class="normal">  </span><span class="symbol">&lt;/</span><span class="normal">gresource</span><span class="symbol">&gt;</span>
161 <span class="symbol">&lt;/</span><span class="normal">gresources</span><span class="symbol">&gt;</span></pre></td>
162       </tr>
163     </tbody>
164   </table>
165 </div>
166
167 </div>
168 <p><br class="example-break">
169 </p>
170 <p>
171 This will create a resource bundle with the following files:
172 </p>
173 <pre class="programlisting">
174 /org/gtk/Example/data/splashscreen.png
175 /org/gtk/Example/dialog.ui
176 /org/gtk/Example/menumarkup.xml
177 </pre>
178 <p>
179 </p>
180 <p>
181 Note that all resources in the process share the same namespace, so use java-style
182 path prefixes (like in the above example) to avoid conflicts.
183 </p>
184 <p>
185 You can then use <a href="glib-compile-resources.html">glib-compile-resources</a> to compile the xml to a
186 binary bundle that you can load with <a class="link" href="gio-GResource.html#g-resource-load" title="g_resource_load ()"><code class="function">g_resource_load()</code></a>. However, its more common to use the --generate-source and
187 --generate-header arguments to create a source file and header to link directly into your application.
188 </p>
189 <p>
190 Once a <a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> has been created and registered all the data in it can be accessed globally in the process by
191 using API calls like <a class="link" href="gio-GResource.html#g-resources-open-stream" title="g_resources_open_stream ()"><code class="function">g_resources_open_stream()</code></a> to stream the data or <a class="link" href="gio-GResource.html#g-resources-lookup-data" title="g_resources_lookup_data ()"><code class="function">g_resources_lookup_data()</code></a> to get a direct pointer
192 to the data. You can also use uris like "resource:///org/gtk/Example/data/splashscreen.png" with <a class="link" href="GFile.html" title="GFile"><span class="type">GFile</span></a> to access
193 the resource data.
194 </p>
195 <p>
196 There are two forms of the generated source, the default version uses the compiler support for constructor
197 and destructor functions (where available) to automatically create and register the <a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> on startup
198 or library load time. If you pass --manual-register two functions to register/unregister the resource is instead
199 created. This requires an explicit initialization call in your application/library, but it works on all platforms,
200 even on the minor ones where this is not available. (Constructor support is available for at least Win32, MacOS and Linux.)
201 </p>
202 <p>
203 Note that resource data can point directly into the data segment of e.g. a library, so if you are unloading libraries
204 during runtime you need to be very careful with keeping around pointers to data from a resource, as this goes away
205 when the library is unloaded. However, in practice this is not generally a problem, since most resource accesses
206 is for your own resources, and resource data is often used once, during parsing, and then released.
207 </p>
208 </div>
209 <div class="refsect1">
210 <a name="gio-GResource.details"></a><h2>Details</h2>
211 <div class="refsect2">
212 <a name="GResource"></a><h3>GResource</h3>
213 <pre class="programlisting">typedef struct _GResource GResource;</pre>
214 <p>
215 A resource bundle.
216 </p>
217 <p class="since">Since 2.32</p>
218 </div>
219 <hr>
220 <div class="refsect2">
221 <a name="GResourceFlags"></a><h3>enum GResourceFlags</h3>
222 <pre class="programlisting">typedef enum {
223   G_RESOURCE_FLAGS_NONE       = 0,
224   G_RESOURCE_FLAGS_COMPRESSED = (1&lt;&lt;0)
225 } GResourceFlags;
226 </pre>
227 <p>
228 GResourceFlags give information about a particular file inside a resource
229 bundle.
230 </p>
231 <div class="variablelist"><table border="0">
232 <col align="left" valign="top">
233 <tbody>
234 <tr>
235 <td><p><a name="G-RESOURCE-FLAGS-NONE:CAPS"></a><span class="term"><code class="literal">G_RESOURCE_FLAGS_NONE</code></span></p></td>
236 <td>No flags set.
237 </td>
238 </tr>
239 <tr>
240 <td><p><a name="G-RESOURCE-FLAGS-COMPRESSED:CAPS"></a><span class="term"><code class="literal">G_RESOURCE_FLAGS_COMPRESSED</code></span></p></td>
241 <td>The file is compressed.
242 </td>
243 </tr>
244 </tbody>
245 </table></div>
246 <p class="since">Since 2.32</p>
247 </div>
248 <hr>
249 <div class="refsect2">
250 <a name="GResourceLookupFlags"></a><h3>enum GResourceLookupFlags</h3>
251 <pre class="programlisting">typedef enum {
252   G_RESOURCE_LOOKUP_FLAGS_NONE       = 0
253 } GResourceLookupFlags;
254 </pre>
255 <p>
256 GResourceLookupFlags determine how resource path lookups are handled.
257 </p>
258 <div class="variablelist"><table border="0">
259 <col align="left" valign="top">
260 <tbody><tr>
261 <td><p><a name="G-RESOURCE-LOOKUP-FLAGS-NONE:CAPS"></a><span class="term"><code class="literal">G_RESOURCE_LOOKUP_FLAGS_NONE</code></span></p></td>
262 <td>No flags set.
263 </td>
264 </tr></tbody>
265 </table></div>
266 <p class="since">Since 2.32</p>
267 </div>
268 <hr>
269 <div class="refsect2">
270 <a name="g-resource-load"></a><h3>g_resource_load ()</h3>
271 <pre class="programlisting"><a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="returnvalue">GResource</span></a> *         g_resource_load                     (<em class="parameter"><code>const <a href="./../glib/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *filename</code></em>,
272                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
273 <p>
274 Loads a binary resource bundle and creates a <a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> representation of it, allowing
275 you to query it for data.
276 </p>
277 <p>
278 If you want to use this resource in the global resource namespace you need
279 to register it with <a class="link" href="gio-GResource.html#g-resources-register" title="g_resources_register ()"><code class="function">g_resources_register()</code></a>.
280 </p>
281 <div class="variablelist"><table border="0">
282 <col align="left" valign="top">
283 <tbody>
284 <tr>
285 <td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
286 <td>the path of a filename to load, in the GLib filename encoding. <span class="annotation">[<acronym title="Override the parsed C type with given type"><span class="acronym">type</span></acronym> filename]</span>
287 </td>
288 </tr>
289 <tr>
290 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
291 <td>return location for a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
292 </td>
293 </tr>
294 <tr>
295 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
296 <td>a new <a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
297 </td>
298 </tr>
299 </tbody>
300 </table></div>
301 <p class="since">Since 2.32</p>
302 </div>
303 <hr>
304 <div class="refsect2">
305 <a name="g-resource-new-from-data"></a><h3>g_resource_new_from_data ()</h3>
306 <pre class="programlisting"><a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="returnvalue">GResource</span></a> *         g_resource_new_from_data            (<em class="parameter"><code><a href="./../glib/glib/glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> *data</code></em>,
307                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
308 <p>
309 Creates a GResource from a reference to the binary resource bundle.
310 This will keep a reference to <em class="parameter"><code>data</code></em> while the resource lives, so
311 the data should not be modified or freed.
312 </p>
313 <p>
314 If you want to use this resource in the global resource namespace you need
315 to register it with <a class="link" href="gio-GResource.html#g-resources-register" title="g_resources_register ()"><code class="function">g_resources_register()</code></a>.
316 </p>
317 <div class="variablelist"><table border="0">
318 <col align="left" valign="top">
319 <tbody>
320 <tr>
321 <td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
322 <td>A <a href="./../glib/glib/glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a>
323 </td>
324 </tr>
325 <tr>
326 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
327 <td>return location for a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
328 </td>
329 </tr>
330 <tr>
331 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
332 <td>a new <a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
333 </td>
334 </tr>
335 </tbody>
336 </table></div>
337 <p class="since">Since 2.32</p>
338 </div>
339 <hr>
340 <div class="refsect2">
341 <a name="g-resource-ref"></a><h3>g_resource_ref ()</h3>
342 <pre class="programlisting"><a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="returnvalue">GResource</span></a> *         g_resource_ref                      (<em class="parameter"><code><a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> *resource</code></em>);</pre>
343 <p>
344 Atomically increments the reference count of <em class="parameter"><code>array</code></em> by one. This
345 function is MT-safe and may be called from any thread.
346 </p>
347 <div class="variablelist"><table border="0">
348 <col align="left" valign="top">
349 <tbody>
350 <tr>
351 <td><p><span class="term"><em class="parameter"><code>resource</code></em> :</span></p></td>
352 <td>A <a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a>
353 </td>
354 </tr>
355 <tr>
356 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
357 <td>The passed in <a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a>
358 </td>
359 </tr>
360 </tbody>
361 </table></div>
362 <p class="since">Since 2.32</p>
363 </div>
364 <hr>
365 <div class="refsect2">
366 <a name="g-resource-unref"></a><h3>g_resource_unref ()</h3>
367 <pre class="programlisting"><span class="returnvalue">void</span>                g_resource_unref                    (<em class="parameter"><code><a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> *resource</code></em>);</pre>
368 <p>
369 Atomically decrements the reference count of <em class="parameter"><code>resource</code></em> by one. If the
370 reference count drops to 0, all memory allocated by the array is
371 released. This function is MT-safe and may be called from any
372 thread.
373 </p>
374 <div class="variablelist"><table border="0">
375 <col align="left" valign="top">
376 <tbody><tr>
377 <td><p><span class="term"><em class="parameter"><code>resource</code></em> :</span></p></td>
378 <td>A <a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a>
379 </td>
380 </tr></tbody>
381 </table></div>
382 <p class="since">Since 2.32</p>
383 </div>
384 <hr>
385 <div class="refsect2">
386 <a name="g-resource-lookup-data"></a><h3>g_resource_lookup_data ()</h3>
387 <pre class="programlisting"><a href="./../glib/glib/glib-Byte-Arrays.html#GBytes"><span class="returnvalue">GBytes</span></a> *            g_resource_lookup_data              (<em class="parameter"><code><a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> *resource</code></em>,
388                                                          <em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
389                                                          <em class="parameter"><code><a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
390                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
391 <p>
392 Looks for a file at the specified <em class="parameter"><code>path</code></em> in the resource and
393 returns a <a href="./../glib/glib/glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> that lets you directly access the data in
394 memory.
395 </p>
396 <p>
397 The data is always followed by a zero byte, so you
398 can safely use the data as a C string. However, that byte
399 is not included in the size of the GBytes.
400 </p>
401 <p>
402 For uncompressed resource files this is a pointer directly into
403 the resource bundle, which is typically in some readonly data section
404 in the program binary. For compressed files we allocate memory on
405 the heap and automatically uncompress the data.
406 </p>
407 <p>
408 <em class="parameter"><code>lookup_flags</code></em> controls the behaviour of the lookup.
409 </p>
410 <div class="variablelist"><table border="0">
411 <col align="left" valign="top">
412 <tbody>
413 <tr>
414 <td><p><span class="term"><em class="parameter"><code>resource</code></em> :</span></p></td>
415 <td>A <a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a>
416 </td>
417 </tr>
418 <tr>
419 <td><p><span class="term"><em class="parameter"><code>path</code></em> :</span></p></td>
420 <td>A pathname inside the resource</td>
421 </tr>
422 <tr>
423 <td><p><span class="term"><em class="parameter"><code>lookup_flags</code></em> :</span></p></td>
424 <td>A <a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a>
425 </td>
426 </tr>
427 <tr>
428 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
429 <td>return location for a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
430 </td>
431 </tr>
432 <tr>
433 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
434 <td>
435 <a href="./../glib/glib/glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.
436 Free the returned object with <a href="./../glib/glib/glib-Byte-Arrays.html#g-bytes-unref"><code class="function">g_bytes_unref()</code></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
437 </td>
438 </tr>
439 </tbody>
440 </table></div>
441 <p class="since">Since 2.32</p>
442 </div>
443 <hr>
444 <div class="refsect2">
445 <a name="g-resource-open-stream"></a><h3>g_resource_open_stream ()</h3>
446 <pre class="programlisting"><a class="link" href="GInputStream.html" title="GInputStream"><span class="returnvalue">GInputStream</span></a> *      g_resource_open_stream              (<em class="parameter"><code><a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> *resource</code></em>,
447                                                          <em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
448                                                          <em class="parameter"><code><a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
449                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
450 <p>
451 Looks for a file at the specified <em class="parameter"><code>path</code></em> in the resource and
452 returns a <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a> that lets you read the data.
453 </p>
454 <p>
455 <em class="parameter"><code>lookup_flags</code></em> controls the behaviour of the lookup.
456 </p>
457 <div class="variablelist"><table border="0">
458 <col align="left" valign="top">
459 <tbody>
460 <tr>
461 <td><p><span class="term"><em class="parameter"><code>resource</code></em> :</span></p></td>
462 <td>A <a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a>
463 </td>
464 </tr>
465 <tr>
466 <td><p><span class="term"><em class="parameter"><code>path</code></em> :</span></p></td>
467 <td>A pathname inside the resource</td>
468 </tr>
469 <tr>
470 <td><p><span class="term"><em class="parameter"><code>lookup_flags</code></em> :</span></p></td>
471 <td>A <a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a>
472 </td>
473 </tr>
474 <tr>
475 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
476 <td>return location for a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
477 </td>
478 </tr>
479 <tr>
480 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
481 <td>
482 <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a> or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.
483 Free the returned object with <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
484 </td>
485 </tr>
486 </tbody>
487 </table></div>
488 <p class="since">Since 2.32</p>
489 </div>
490 <hr>
491 <div class="refsect2">
492 <a name="g-resource-enumerate-children"></a><h3>g_resource_enumerate_children ()</h3>
493 <pre class="programlisting"><span class="returnvalue">char</span> **             g_resource_enumerate_children       (<em class="parameter"><code><a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> *resource</code></em>,
494                                                          <em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
495                                                          <em class="parameter"><code><a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
496                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
497 <p>
498 Returns all the names of children at the specified <em class="parameter"><code>path</code></em> in the resource.
499 The return result is a <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> terminated list of strings which should
500 be released with <a href="./../glib/glib/glib-String-Utility-Functions.html#g-strfreev"><code class="function">g_strfreev()</code></a>.
501 </p>
502 <p>
503 <em class="parameter"><code>lookup_flags</code></em> controls the behaviour of the lookup.
504 </p>
505 <div class="variablelist"><table border="0">
506 <col align="left" valign="top">
507 <tbody>
508 <tr>
509 <td><p><span class="term"><em class="parameter"><code>resource</code></em> :</span></p></td>
510 <td>A <a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a>
511 </td>
512 </tr>
513 <tr>
514 <td><p><span class="term"><em class="parameter"><code>path</code></em> :</span></p></td>
515 <td>A pathname inside the resource</td>
516 </tr>
517 <tr>
518 <td><p><span class="term"><em class="parameter"><code>lookup_flags</code></em> :</span></p></td>
519 <td>A <a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a>
520 </td>
521 </tr>
522 <tr>
523 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
524 <td>return location for a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
525 </td>
526 </tr>
527 <tr>
528 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
529 <td>an array of constant strings. <span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
530 </td>
531 </tr>
532 </tbody>
533 </table></div>
534 <p class="since">Since 2.32</p>
535 </div>
536 <hr>
537 <div class="refsect2">
538 <a name="g-resource-get-info"></a><h3>g_resource_get_info ()</h3>
539 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_resource_get_info                 (<em class="parameter"><code><a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> *resource</code></em>,
540                                                          <em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
541                                                          <em class="parameter"><code><a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
542                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> *size</code></em>,
543                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> *flags</code></em>,
544                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
545 <p>
546 Looks for a file at the specified <em class="parameter"><code>path</code></em> in the resource and
547 if found returns information about it.
548 </p>
549 <p>
550 <em class="parameter"><code>lookup_flags</code></em> controls the behaviour of the lookup.
551 </p>
552 <div class="variablelist"><table border="0">
553 <col align="left" valign="top">
554 <tbody>
555 <tr>
556 <td><p><span class="term"><em class="parameter"><code>resource</code></em> :</span></p></td>
557 <td>A <a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a>
558 </td>
559 </tr>
560 <tr>
561 <td><p><span class="term"><em class="parameter"><code>path</code></em> :</span></p></td>
562 <td>A pathname inside the resource</td>
563 </tr>
564 <tr>
565 <td><p><span class="term"><em class="parameter"><code>lookup_flags</code></em> :</span></p></td>
566 <td>A <a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a>
567 </td>
568 </tr>
569 <tr>
570 <td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
571 <td>a location to place the length of the contents of the file,
572 or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the length is not needed. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
573 </td>
574 </tr>
575 <tr>
576 <td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
577 <td>a location to place the flags about the file,
578 or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the length is not needed. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
579 </td>
580 </tr>
581 <tr>
582 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
583 <td>return location for a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
584 </td>
585 </tr>
586 <tr>
587 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
588 <td>
589 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the file was found. <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if there were errors</td>
590 </tr>
591 </tbody>
592 </table></div>
593 <p class="since">Since 2.32</p>
594 </div>
595 <hr>
596 <div class="refsect2">
597 <a name="g-resources-register"></a><h3>g_resources_register ()</h3>
598 <pre class="programlisting"><span class="returnvalue">void</span>                g_resources_register                (<em class="parameter"><code><a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> *resource</code></em>);</pre>
599 <p>
600 Registers the resource with the process-global set of resources.
601 Once a resource is registered the files in it can be accessed
602 with the global resource lookup functions like <a class="link" href="gio-GResource.html#g-resources-lookup-data" title="g_resources_lookup_data ()"><code class="function">g_resources_lookup_data()</code></a>.
603 </p>
604 <div class="variablelist"><table border="0">
605 <col align="left" valign="top">
606 <tbody><tr>
607 <td><p><span class="term"><em class="parameter"><code>resource</code></em> :</span></p></td>
608 <td>A <a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a>
609 </td>
610 </tr></tbody>
611 </table></div>
612 <p class="since">Since 2.32</p>
613 </div>
614 <hr>
615 <div class="refsect2">
616 <a name="g-resources-unregister"></a><h3>g_resources_unregister ()</h3>
617 <pre class="programlisting"><span class="returnvalue">void</span>                g_resources_unregister              (<em class="parameter"><code><a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> *resource</code></em>);</pre>
618 <p>
619 Unregisters the resource from the process-global set of resources.
620 </p>
621 <div class="variablelist"><table border="0">
622 <col align="left" valign="top">
623 <tbody><tr>
624 <td><p><span class="term"><em class="parameter"><code>resource</code></em> :</span></p></td>
625 <td>A <a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a>
626 </td>
627 </tr></tbody>
628 </table></div>
629 <p class="since">Since 2.32</p>
630 </div>
631 <hr>
632 <div class="refsect2">
633 <a name="g-resources-lookup-data"></a><h3>g_resources_lookup_data ()</h3>
634 <pre class="programlisting"><a href="./../glib/glib/glib-Byte-Arrays.html#GBytes"><span class="returnvalue">GBytes</span></a> *            g_resources_lookup_data             (<em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
635                                                          <em class="parameter"><code><a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
636                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
637 <p>
638 Looks for a file at the specified <em class="parameter"><code>path</code></em> in the set of
639 globally registred resources and returns a <a href="./../glib/glib/glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> that
640 lets you directly access the data in memory.
641 </p>
642 <p>
643 The data is always followed by a zero byte, so you
644 can safely use the data as a C string. However, that byte
645 is not included in the size of the GBytes.
646 </p>
647 <p>
648 For uncompressed resource files this is a pointer directly into
649 the resource bundle, which is typically in some readonly data section
650 in the program binary. For compressed files we allocate memory on
651 the heap and automatically uncompress the data.
652 </p>
653 <p>
654 <em class="parameter"><code>lookup_flags</code></em> controls the behaviour of the lookup.
655 </p>
656 <div class="variablelist"><table border="0">
657 <col align="left" valign="top">
658 <tbody>
659 <tr>
660 <td><p><span class="term"><em class="parameter"><code>path</code></em> :</span></p></td>
661 <td>A pathname inside the resource</td>
662 </tr>
663 <tr>
664 <td><p><span class="term"><em class="parameter"><code>lookup_flags</code></em> :</span></p></td>
665 <td>A <a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a>
666 </td>
667 </tr>
668 <tr>
669 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
670 <td>return location for a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
671 </td>
672 </tr>
673 <tr>
674 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
675 <td>
676 <a href="./../glib/glib/glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.
677 Free the returned object with <a href="./../glib/glib/glib-Byte-Arrays.html#g-bytes-unref"><code class="function">g_bytes_unref()</code></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
678 </td>
679 </tr>
680 </tbody>
681 </table></div>
682 <p class="since">Since 2.32</p>
683 </div>
684 <hr>
685 <div class="refsect2">
686 <a name="g-resources-open-stream"></a><h3>g_resources_open_stream ()</h3>
687 <pre class="programlisting"><a class="link" href="GInputStream.html" title="GInputStream"><span class="returnvalue">GInputStream</span></a> *      g_resources_open_stream             (<em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
688                                                          <em class="parameter"><code><a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
689                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
690 <p>
691 Looks for a file at the specified <em class="parameter"><code>path</code></em> in the set of
692 globally registred resources and returns a <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a>
693 that lets you read the data.
694 </p>
695 <p>
696 <em class="parameter"><code>lookup_flags</code></em> controls the behaviour of the lookup.
697 </p>
698 <div class="variablelist"><table border="0">
699 <col align="left" valign="top">
700 <tbody>
701 <tr>
702 <td><p><span class="term"><em class="parameter"><code>path</code></em> :</span></p></td>
703 <td>A pathname inside the resource</td>
704 </tr>
705 <tr>
706 <td><p><span class="term"><em class="parameter"><code>lookup_flags</code></em> :</span></p></td>
707 <td>A <a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a>
708 </td>
709 </tr>
710 <tr>
711 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
712 <td>return location for a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
713 </td>
714 </tr>
715 <tr>
716 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
717 <td>
718 <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a> or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.
719 Free the returned object with <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
720 </td>
721 </tr>
722 </tbody>
723 </table></div>
724 <p class="since">Since 2.32</p>
725 </div>
726 <hr>
727 <div class="refsect2">
728 <a name="g-resources-enumerate-children"></a><h3>g_resources_enumerate_children ()</h3>
729 <pre class="programlisting"><span class="returnvalue">char</span> **             g_resources_enumerate_children      (<em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
730                                                          <em class="parameter"><code><a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
731                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
732 <p>
733 Returns all the names of children at the specified <em class="parameter"><code>path</code></em> in the set of
734 globally registred resources.
735 The return result is a <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> terminated list of strings which should
736 be released with <a href="./../glib/glib/glib-String-Utility-Functions.html#g-strfreev"><code class="function">g_strfreev()</code></a>.
737 </p>
738 <p>
739 <em class="parameter"><code>lookup_flags</code></em> controls the behaviour of the lookup.
740 </p>
741 <div class="variablelist"><table border="0">
742 <col align="left" valign="top">
743 <tbody>
744 <tr>
745 <td><p><span class="term"><em class="parameter"><code>path</code></em> :</span></p></td>
746 <td>A pathname inside the resource</td>
747 </tr>
748 <tr>
749 <td><p><span class="term"><em class="parameter"><code>lookup_flags</code></em> :</span></p></td>
750 <td>A <a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a>
751 </td>
752 </tr>
753 <tr>
754 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
755 <td>return location for a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
756 </td>
757 </tr>
758 <tr>
759 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
760 <td>an array of constant strings. <span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
761 </td>
762 </tr>
763 </tbody>
764 </table></div>
765 <p class="since">Since 2.32</p>
766 </div>
767 <hr>
768 <div class="refsect2">
769 <a name="g-resources-get-info"></a><h3>g_resources_get_info ()</h3>
770 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_resources_get_info                (<em class="parameter"><code>const <span class="type">char</span> *path</code></em>,
771                                                          <em class="parameter"><code><a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a> lookup_flags</code></em>,
772                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> *size</code></em>,
773                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> *flags</code></em>,
774                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
775 <p>
776 Looks for a file at the specified <em class="parameter"><code>path</code></em> in the set of
777 globally registred resources and if found returns information about it.
778 </p>
779 <p>
780 <em class="parameter"><code>lookup_flags</code></em> controls the behaviour of the lookup.
781 </p>
782 <div class="variablelist"><table border="0">
783 <col align="left" valign="top">
784 <tbody>
785 <tr>
786 <td><p><span class="term"><em class="parameter"><code>path</code></em> :</span></p></td>
787 <td>A pathname inside the resource</td>
788 </tr>
789 <tr>
790 <td><p><span class="term"><em class="parameter"><code>lookup_flags</code></em> :</span></p></td>
791 <td>A <a class="link" href="gio-GResource.html#GResourceLookupFlags" title="enum GResourceLookupFlags"><span class="type">GResourceLookupFlags</span></a>
792 </td>
793 </tr>
794 <tr>
795 <td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
796 <td>a location to place the length of the contents of the file,
797 or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the length is not needed. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
798 </td>
799 </tr>
800 <tr>
801 <td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
802 <td>a location to place the flags about the file,
803 or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the length is not needed. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
804 </td>
805 </tr>
806 <tr>
807 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
808 <td>return location for a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
809 </td>
810 </tr>
811 <tr>
812 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
813 <td>
814 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the file was found. <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if there were errors</td>
815 </tr>
816 </tbody>
817 </table></div>
818 <p class="since">Since 2.32</p>
819 </div>
820 <hr>
821 <div class="refsect2">
822 <a name="G-RESOURCE-ERROR:CAPS"></a><h3>G_RESOURCE_ERROR</h3>
823 <pre class="programlisting">#define G_RESOURCE_ERROR (g_resource_error_quark ())
824 </pre>
825 <p>
826 Error domain for <a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a>. Errors in this domain will be from the
827 <a class="link" href="gio-GResource.html#GResourceError" title="enum GResourceError"><span class="type">GResourceError</span></a> enumeration. See <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for more information on
828 error domains.
829 </p>
830 </div>
831 <hr>
832 <div class="refsect2">
833 <a name="GResourceError"></a><h3>enum GResourceError</h3>
834 <pre class="programlisting">typedef enum {
835   G_RESOURCE_ERROR_NOT_FOUND,
836   G_RESOURCE_ERROR_INTERNAL
837 } GResourceError;
838 </pre>
839 <p>
840 An error code used with <a class="link" href="gio-GResource.html#G-RESOURCE-ERROR:CAPS" title="G_RESOURCE_ERROR"><code class="literal">G_RESOURCE_ERROR</code></a> in a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> returned
841 from a <a class="link" href="gio-GResource.html#GResource" title="GResource"><span class="type">GResource</span></a> routine.
842 </p>
843 <div class="variablelist"><table border="0">
844 <col align="left" valign="top">
845 <tbody>
846 <tr>
847 <td><p><a name="G-RESOURCE-ERROR-NOT-FOUND:CAPS"></a><span class="term"><code class="literal">G_RESOURCE_ERROR_NOT_FOUND</code></span></p></td>
848 <td>no file was found at the requested path
849 </td>
850 </tr>
851 <tr>
852 <td><p><a name="G-RESOURCE-ERROR-INTERNAL:CAPS"></a><span class="term"><code class="literal">G_RESOURCE_ERROR_INTERNAL</code></span></p></td>
853 <td>unknown error
854 </td>
855 </tr>
856 </tbody>
857 </table></div>
858 <p class="since">Since 2.32</p>
859 </div>
860 </div>
861 </div>
862 <div class="footer">
863 <hr>
864           Generated by GTK-Doc V1.18</div>
865 </body>
866 </html>