Dee.ResourceManager¶
- Implementations:
Methods¶
class |
|
|
|
|
Virtual Methods¶
|
|
|
Properties¶
None
Signals¶
None
Fields¶
None
Class Details¶
- class Dee.ResourceManager¶
- Bases:
- Structure:
- classmethod get_default()¶
- Returns:
The default resource manager for the platform. Do not unreference. If you need to keep the instance around you must manually reference it.
- Return type:
Get a pointer to the platform default
Dee.ResourceManager
.
- load(resource_name)¶
- Parameters:
resource_name (
str
) – The name of the resource to retrieve- Raises:
- Returns:
A newly allocated
GObject.Object
in case of success andNone
otherwise. In case of a runtime error the error pointer will be set.- Return type:
Load a resource from persistent storage. The loaded resource will be of the same
GObject.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
GLib.FileError
domain. Specifically if there is no resource with the name resource_name the error code will beGLib.FileError.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.
- store(resource, resource_name)¶
- Parameters:
resource (
Dee.Serializable
) – ADee.Serializable
to store under resource_nameresource_name (
str
) – The name to store the resource under. Will overwrite any existing resource with the same name
- Raises:
- Returns:
True
on success andFalse
otherwise. In case of a runtime error the error pointer will point to aGLib.Error
in the #DeeResourceError domain.- Return type:
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.ResourceManager.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.
- do_load(resource_name) virtual¶
- Parameters:
resource_name (
str
) – The name of the resource to retrieve- Returns:
A newly allocated
GObject.Object
in case of success andNone
otherwise. In case of a runtime error the error pointer will be set.- Return type:
Load a resource from persistent storage. The loaded resource will be of the same
GObject.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
GLib.FileError
domain. Specifically if there is no resource with the name resource_name the error code will beGLib.FileError.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.
- do_store(resource, resource_name) virtual¶
- Parameters:
resource (
Dee.Serializable
) – ADee.Serializable
to store under resource_nameresource_name (
str
) – The name to store the resource under. Will overwrite any existing resource with the same name
- Returns:
True
on success andFalse
otherwise. In case of a runtime error the error pointer will point to aGLib.Error
in the #DeeResourceError domain.- Return type:
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.ResourceManager.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.