Top | ![]() |
![]() |
![]() |
![]() |
DeeResourceManagerDeeResourceManager — Store and load DeeSerializables by name |
gboolean | dee_resource_manager_store () |
GObject * | dee_resource_manager_load () |
DeeResourceManager * | dee_resource_manager_get_default () |
The DeeResourceManager API provides a simple API for storing and loading DeeSerializables from some persistent storage. The resources are stored in a flat structure identified by names that should be chosen similarly to DBus names. That is reverse domain names ala net.launchpad.Example.MyData.
gboolean dee_resource_manager_store (DeeResourceManager *self
,DeeSerializable *resource
,const gchar *resource_name
,GError **error
);
Store a resource under a given name. The resource manager must guarantee
that the stored data survives system reboots and that you can recreate a
copy of resource
by calling dee_resource_manager_load()
using the
same resource_name
.
Important note: This call may do blocking IO. The resource manager must guarantee that this call is reasonably fast, like writing the externalized resource to a file, but not blocking IO over a network socket.
self |
The resource manager to invoke |
|
resource |
A DeeSerializable to store under |
[transfer none] |
resource_name |
The name to store the resource under. Will overwrite any existing resource with the same name |
|
error |
A return location for a GError pointer. |
GObject * dee_resource_manager_load (DeeResourceManager *self
,const gchar *resource_name
,GError **error
);
Load a resource from persistent storage. The loaded resource will be of the same GType as when it was stored (provided that the same serialization and parse functions are registered).
In case of an error the error will be in the GFileError domain. Specifically
if there is no resource with the name resource_name
the error code will
be G_FILE_ERROR_NOENT.
Important note: This call may do blocking IO. The resource manager must guarantee that this call is reasonably fast, like writing the externalized resource to a file, but not blocking IO over a network socket.
DeeResourceManager *
dee_resource_manager_get_default (void
);
Get a pointer to the platform default DeeResourceManager.