1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
<title>DeeResourceManager</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7
<link rel="home" href="index.html" title="Dee Reference Manual">
8
<link rel="up" href="ch04.html" title="Resources and Serialization">
9
<link rel="prev" href="DeeFileResourceManager.html" title="DeeFileResourceManager">
10
<link rel="next" href="dee-1.0-DeeSerializable.html" title="DeeSerializable">
11
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
12
<link rel="stylesheet" href="style.css" type="text/css">
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">
17
<td><a accesskey="p" href="DeeFileResourceManager.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18
<td><a accesskey="u" href="ch04.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">Dee Reference Manual</th>
21
<td><a accesskey="n" href="dee-1.0-DeeSerializable.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
23
<tr><td colspan="5" class="shortcuts">
24
<a href="#dee-1.0-DeeResourceManager.synopsis" class="shortcut">Top</a>
26
<a href="#dee-1.0-DeeResourceManager.description" class="shortcut">Description</a>
29
<div class="refentry">
30
<a name="dee-1.0-DeeResourceManager"></a><div class="titlepage"></div>
31
<div class="refnamediv"><table width="100%"><tr>
33
<h2><span class="refentrytitle"><a name="dee-1.0-DeeResourceManager.top_of_page"></a>DeeResourceManager</span></h2>
34
<p>DeeResourceManager — Store and load <a href="/usr/share/gtk-doc/html/dee-1.0/DeeSerializable.html"><span class="type">DeeSerializable</span></a>s by name</p>
36
<td valign="top" align="right"></td>
38
<div class="refsynopsisdiv">
39
<a name="dee-1.0-DeeResourceManager.synopsis"></a><h2>Synopsis</h2>
40
<pre class="synopsis">
41
#include <dee.h>
43
struct <a class="link" href="dee-1.0-DeeResourceManager.html#DeeResourceManagerIface" title="struct DeeResourceManagerIface">DeeResourceManagerIface</a>;
44
<a href="/usr/share/gtk-doc/html/dee-1.0/DeeResourceManager.html"><span class="returnvalue">DeeResourceManager</span></a> * <a class="link" href="dee-1.0-DeeResourceManager.html#dee-resource-manager-get-default" title="dee_resource_manager_get_default ()">dee_resource_manager_get_default</a> (<em class="parameter"><code><span class="type">void</span></code></em>);
45
<a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject"><span class="returnvalue">GObject</span></a> * <a class="link" href="dee-1.0-DeeResourceManager.html#dee-resource-manager-load" title="dee_resource_manager_load ()">dee_resource_manager_load</a> (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/dee-1.0/DeeResourceManager.html"><span class="type">DeeResourceManager</span></a> *self</code></em>,
46
<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *resource_name</code></em>,
47
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
48
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="dee-1.0-DeeResourceManager.html#dee-resource-manager-store" title="dee_resource_manager_store ()">dee_resource_manager_store</a> (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/dee-1.0/DeeResourceManager.html"><span class="type">DeeResourceManager</span></a> *self</code></em>,
49
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/dee-1.0/DeeSerializable.html"><span class="type">DeeSerializable</span></a> *resource</code></em>,
50
<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *resource_name</code></em>,
51
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
54
<div class="refsect1">
55
<a name="dee-1.0-DeeResourceManager.description"></a><h2>Description</h2>
57
The <a href="/usr/share/gtk-doc/html/dee-1.0/DeeResourceManager.html"><span class="type">DeeResourceManager</span></a> API provides a simple API for storing and loading
58
DeeSerializables from some persistent storage. The resources
59
are stored in a flat structure identified by names that should be chosen
60
similarly to DBus names. That is reverse domain names ala
61
net.launchpad.Example.MyData.
64
<div class="refsect1">
65
<a name="dee-1.0-DeeResourceManager.details"></a><h2>Details</h2>
66
<div class="refsect2">
67
<a name="DeeResourceManagerIface"></a><h3>struct DeeResourceManagerIface</h3>
68
<pre class="programlisting">struct DeeResourceManagerIface {
69
GTypeInterface g_iface;
71
gboolean (*store) (DeeResourceManager *self,
72
DeeSerializable *resource,
73
const gchar *resource_name,
76
GObject* (*load) (DeeResourceManager *self,
77
const gchar *resource_name,
85
<div class="refsect2">
86
<a name="dee-resource-manager-get-default"></a><h3>dee_resource_manager_get_default ()</h3>
87
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/dee-1.0/DeeResourceManager.html"><span class="returnvalue">DeeResourceManager</span></a> * dee_resource_manager_get_default (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
89
Get a pointer to the platform default <a href="/usr/share/gtk-doc/html/dee-1.0/DeeResourceManager.html"><span class="type">DeeResourceManager</span></a>.
91
<div class="variablelist"><table border="0">
92
<col align="left" valign="top">
94
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
95
<td>The default resource manager for the platform.
96
Do not unreference. If you need to keep the instance around
97
you must manually reference it. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
103
<div class="refsect2">
104
<a name="dee-resource-manager-load"></a><h3>dee_resource_manager_load ()</h3>
105
<pre class="programlisting"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject"><span class="returnvalue">GObject</span></a> * dee_resource_manager_load (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/dee-1.0/DeeResourceManager.html"><span class="type">DeeResourceManager</span></a> *self</code></em>,
106
<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *resource_name</code></em>,
107
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
109
Load a resource from persistent storage. The loaded resource will be of the
110
same GType as when it was stored (provided that the same serialization and
111
parse functions are registered).
114
In case of an error the error will be in the <a href="http://library.gnome.org/devel/glib/unstable/glib-File-Utilities.html#GFileError"><span class="type">GFileError</span></a> domain. Specifically
115
if there is no resource with the name <em class="parameter"><code>resource_name</code></em> the error code will
116
be <a href="http://library.gnome.org/devel/glib/unstable/glib-File-Utilities.html#G-FILE-ERROR-NOENT:CAPS"><span class="type">G_FILE_ERROR_NOENT</span></a>.
119
Important note: This call may do blocking IO. The resource manager must
120
guarantee that this call is reasonably fast, like writing the externalized
121
resource to a file, but not blocking IO over a network socket.
123
<div class="variablelist"><table border="0">
124
<col align="left" valign="top">
127
<td><p><span class="term"><em class="parameter"><code>self</code></em> :</span></p></td>
128
<td>The resource manager to invoke</td>
131
<td><p><span class="term"><em class="parameter"><code>resource_name</code></em> :</span></p></td>
132
<td>The name of the resource to retrieve</td>
135
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
136
<td>A return location for a <a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> pointer. <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore errors</td>
139
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
140
<td>A newly allocated <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> in case of success
141
and <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> otherwise. In case of a runtime error the <em class="parameter"><code>error</code></em>
142
pointer will be set. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
149
<div class="refsect2">
150
<a name="dee-resource-manager-store"></a><h3>dee_resource_manager_store ()</h3>
151
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> dee_resource_manager_store (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/dee-1.0/DeeResourceManager.html"><span class="type">DeeResourceManager</span></a> *self</code></em>,
152
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/dee-1.0/DeeSerializable.html"><span class="type">DeeSerializable</span></a> *resource</code></em>,
153
<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *resource_name</code></em>,
154
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
156
Store a resource under a given name. The resource manager must guarantee
157
that the stored data survives system reboots and that you can recreate a
158
copy of <em class="parameter"><code>resource</code></em> by calling <a class="link" href="dee-1.0-DeeResourceManager.html#dee-resource-manager-load" title="dee_resource_manager_load ()"><code class="function">dee_resource_manager_load()</code></a> using the
159
same <em class="parameter"><code>resource_name</code></em>.
162
Important note: This call may do blocking IO. The resource manager must
163
guarantee that this call is reasonably fast, like writing the externalized
164
resource to a file, but not blocking IO over a network socket.
166
<div class="variablelist"><table border="0">
167
<col align="left" valign="top">
170
<td><p><span class="term"><em class="parameter"><code>self</code></em> :</span></p></td>
171
<td>The resource manager to invoke</td>
174
<td><p><span class="term"><em class="parameter"><code>resource</code></em> :</span></p></td>
175
<td>A <a href="/usr/share/gtk-doc/html/dee-1.0/DeeSerializable.html"><span class="type">DeeSerializable</span></a> to store under <em class="parameter"><code>resource_name</code></em>. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
179
<td><p><span class="term"><em class="parameter"><code>resource_name</code></em> :</span></p></td>
180
<td>The name to store the resource under. Will overwrite any
181
existing resource with the same name</td>
184
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
185
<td>A return location for a <a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> pointer. <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore errors</td>
188
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
190
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success and <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise. In case of a runtime
191
error the <em class="parameter"><code>error</code></em> pointer will point to a <a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> in the
192
<span class="type">DeeResourceError</span> domain.</td>
201
Generated by GTK-Doc V1.18</div>
b'\\ No newline at end of file'