Class
GeglMetadataStore
Instance methods
gegl_metadata_store_get_string
A slightly more efficient version of gegl_metadata_store_get_value()
for string values avoiding a duplication. Otherwise it behaves the same gegl_metadata_store_get_value().
gegl_metadata_store_get_value
Retrieve the metadata value. value
must be initialised with a compatible
type. If the value is unset or has not been previously declared value
is
unchanged and an error message is logged.
gegl_metadata_store_has_value
Test whether the GeglMetadataStore
contains a value for the specified name.
gegl_metadata_store_notify
Gegl_metadata_store_notify() is called by subclasses when the value of a
metadata variable changes. It emits the ::changed
signal with the variable
name as the detail parameter. Set shadow
= TRUE
if variable is shadowed
by a property so that a notify signal is emitted with the property name as
the detail parameter.
gegl_metadata_store_set_string
A slightly more efficient version of gegl_metadata_store_set_value()
for string values avoiding a duplication. Otherwise it behaves the same gegl_metadata_store_set_value().
gegl_metadata_store_set_value
Set the specified metadata value. If value
is NULL
the default value from
the associated GParamSpec
is used. This operation will fail if the value
has not been previously declared. A changed::name
signal is emitted when
the value is set. If the value is shadowed by a property a notify::name
signal is also emitted.
Methods inherited from GeglMetadata (9)
gegl_metadata_get_resolution
Retrieve resolution from the application image metadata. Intended for use
by the image file writer. If resolution is not supported by the application
or if the operation fails FALSE
is returned and the resolution values are
not updated.
gegl_metadata_iter_get_value
Retrieve image file metadata from the application. Intended for use by the
image file writer. If the operation fails it returns FALSE
and value
is
not updated.
gegl_metadata_iter_init
Initialise an iterator to find all supported metadata keys.
gegl_metadata_iter_lookup
Look up the specified key and initialise an iterator to reference the
associated metadata. The iterator is used in conjunction with
gegl_metadata_set_value()
and gegl_metadata_get_value(). Note that this
iterator is not valid for gegl_metadata_iter_next().
gegl_metadata_iter_next
Move the iterator to the next metadata item.
gegl_metadata_iter_set_value
Set application data retrieved from image file’s metadata. Intended for use
by the image file reader. If the operation fails it returns FALSE
and
value
is ignored.
gegl_metadata_register_map
Set the name of the file module and pass an array of mappings from file-format specific metadata names to those used by Gegl. A GValue transformation function may be supplied, e.g. to parse or format timestamps.
gegl_metadata_set_resolution
Set resolution retrieved from image file’s metadata. Intended for use by
the image file reader. If resolution is not supported by the application or
if the operation fails FALSE
is returned and the values are ignored.
gegl_metadata_unregister_map
Unregister the file module mappings and any further mappings added or modified by the application. This should be called after the file module completes operations.
Properties
Gegl.MetadataStore:file-module-name
Current file loader/saver module name. Valid only while a GeglMetadata
mapping is registered. This property is mainly provided for use in signal handlers.
Gegl.MetadataStore:resolution-unit
A GeglResolutionUnit
specifying units for the image resolution (density).
Signals
Gegl.MetadataStore::changed
::changed
is emitted when a metadata value is changed. This is analogous
to the GObject::notify
signal.
Gegl.MetadataStore::generate-value
If a signal handler is connected to ::generate-value
a signal is emitted
when the file module accesses a value using gegl_metadata_get_value().
The signal handler must generate a value of the type specified in the pspec
argument. The signal handler’s return value indicates the success of the operation.
Gegl.MetadataStore::mapped
::mapped
is emitted after a file module registers a mapping and before
other processing takes place. An application may respond to the signal by
registering additional mappings or overriding existing values, for example
it might override the TIFF ImageDescription tag to format multiple metadata
values into the description.
Gegl.MetadataStore::parse-value
If a signal handler is connected to ::parse-value
a signal is emitted when
the file module accesses a value using gegl_metadata_set_value(). The
signal handler should parse the value supplied in the GValue
and may set
any number of metadata values using gegl_metadata_store_set_value().
Gegl.MetadataStore::unmapped
::unmapped
is emitted when a file module tries to look up an unmapped
metadata name. When the handler returns a second attempt is made to look
up the metadata.
Signals inherited from GObject (1)
GObject::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.
Class structure
struct GeglMetadataStoreClass {
void (* _declare) (
GeglMetadataStore* self,
GParamSpec* pspec,
gboolean shadow
);
GParamSpec* (* pspec) (
GeglMetadataStore* self,
const gchar* name
);
void (* set_value) (
GeglMetadataStore* self,
const gchar* name,
const GValue* value
);
const GValue* (* _get_value) (
GeglMetadataStore* self,
const gchar* name
);
gboolean (* has_value) (
GeglMetadataStore* self,
const gchar* name
);
void (* register_hook) (
GeglMetadataStore* self,
const gchar* file_module_name,
guint flags
);
gboolean (* parse_value) (
GeglMetadataStore* self,
GParamSpec* pspec,
GValueTransform transform,
const GValue* value
);
gboolean (* generate_value) (
GeglMetadataStore* self,
GParamSpec* pspec,
GValueTransform transform,
GValue* value
);
}
The class structure for the GeglMetadataStore
.
Class members
_declare: void (* _declare) ( GeglMetadataStore* self, GParamSpec* pspec, gboolean shadow )
The _declare virtual method creates a metadata variable in the underlying data store. It implements gegl_metadata_store_declare(). A
GParamSpec
is used to describe the variable. If the metadata shadows an object property, shadow should beTRUE
, otherwiseFALSE
. It is acceptable for a subclass to provide additional variables which are implicitly declared, that is, they need not be declared using gegl_metadata_store_declare(), however thepspec
method must still retrieve aGParamSpec
describing such variables. This method MUST be provided by the subclass.pspec: GParamSpec* (* pspec) ( GeglMetadataStore* self, const gchar* name )
The pspec virtual method returns the
GParamSpec
used to declare a metadata variable. It is used to implement gegl_metadata_store_typeof_value(). This method MUST be provided by the subclass.set_value: void (* set_value) ( GeglMetadataStore* self, const gchar* name, const GValue* value )
Set a metadata variable using a
GValue
. Implements gegl_metadata_store_set_value(). The metadata variable should be declared and theGValue
must be of the correct type. Note that failure to set a variable may be dependent of properties of the underlying storage mechanism. This method MUST be provided by the subclass._get_value: const GValue* (* _get_value) ( GeglMetadataStore* self, const gchar* name )
Return a pointer to a
GValue
with the value of the metadata variable orNULL
if not declared or the variable does not contain a valid value. Implements gegl_metadata_store_get_value(). This method MUST be provided by the subclass.has_value: gboolean (* has_value) ( GeglMetadataStore* self, const gchar* name )
The has_value virtual method implements
gegl_metadata_store_has_value()
It should returnTRUE
if the variable is declared and contains a valid value of the correct type, otherwiseFALSE
. This method MUST be provided by the subclass.register_hook: void (* register_hook) ( GeglMetadataStore* self, const gchar* file_module_name, guint flags )
This method is called after a file loader or saver registers a
GeglMetadataMap
and before any further processing takes place. It is intended to allow an application to create further application-specific mappings using gegl_metadata_store_register().GeglMetadataStore
provides a default method which emits the::mapped
signal.parse_value: gboolean (* parse_value) ( GeglMetadataStore* self, GParamSpec* pspec, GValueTransform transform, const GValue* value )
This method is called to optionally parse image file metadata prior to setting metadata variables in the
GeglMetadataStore
. If no parser is available it returnsFALSE
and the registered mapping is used. If a parser available it should set one or more metadata variables usinggegl_metadata_store_set_value()
and returnTRUE
. Note that the parser MUST returnTRUE
even if setting individual values fails. The default method checks if a signal handler is registered for the parse-value signal with the variable name as the detail parameter. If a handler is registered it emits the signal with the file metadata provided as aGValue
and returnsTRUE
otherwiseFALSE
.generate_value: gboolean (* generate_value) ( GeglMetadataStore* self, GParamSpec* pspec, GValueTransform transform, GValue* value )
This method is called to optionally generate a value to be written to and image file. If no generator is available it returns
FALSE
and the registered mapping is used. If a generator is available it should create a suitable value to be written to the image file and returnTRUE
. The default method checks if a signal handler is registered for the generate-value signal with the variable name as the detail parameter. If a handler is registered it emits the signal with an initialisedGValue
to receive the file metadata and returnsTRUE
otherwiseFALSE
.parse_value
andgenerate_value
are provided to handle the case where some file formats overload, for example, image comments. A typical case is formatting many values into a TIFF file’s ImageDescription field.
Virtual methods
Gegl.MetadataStoreClass._declare
The _declare virtual method creates a metadata variable in the
underlying data store. It implements gegl_metadata_store_declare(). A
GParamSpec
is used to describe the variable. If the metadata shadows an
object property, shadow should be TRUE
, otherwise FALSE
. It is acceptable
for a subclass to provide additional variables which are implicitly
declared, that is, they need not be declared using
gegl_metadata_store_declare(), however the pspec
method must still retrieve
a GParamSpec
describing such variables. This method MUST be provided by
the subclass.
Gegl.MetadataStoreClass._get_value
Return a pointer to a GValue
with the value of the metadata
variable or NULL
if not declared or the variable does not contain a valid
value. Implements gegl_metadata_store_get_value(). This method MUST be
provided by the subclass.
Gegl.MetadataStoreClass.generate_value
This method is called to optionally generate a value to be
written to and image file. If no generator is available it returns FALSE
and the registered mapping is used. If a generator is available it should
create a suitable value to be written to the image file and return TRUE
.
The default method checks if a signal handler is registered for the
generate-value signal with the variable name as the detail parameter. If a
handler is registered it emits the signal with an initialised GValue
to
receive the file metadata and returns TRUE
otherwise FALSE
. parse_value
and generate_value
are provided to handle the case where some file formats
overload, for example, image comments. A typical case is formatting many
values into a TIFF file’s ImageDescription field.
Gegl.MetadataStoreClass.has_value
Test whether the GeglMetadataStore
contains a value for the specified name.
Gegl.MetadataStoreClass.parse_value
This method is called to optionally parse image file metadata
prior to setting metadata variables in the GeglMetadataStore
. If no parser
is available it returns FALSE
and the registered mapping is used. If a
parser available it should set one or more metadata variables using
gegl_metadata_store_set_value()
and return TRUE
. Note that the parser MUST
return TRUE
even if setting individual values fails. The default method
checks if a signal handler is registered for the parse-value signal with
the variable name as the detail parameter. If a handler is registered it
emits the signal with the file metadata provided as a GValue
and returns
TRUE
otherwise FALSE
.
Gegl.MetadataStoreClass.pspec
The pspec virtual method returns the GParamSpec
used to declare a
metadata variable. It is used to implement
gegl_metadata_store_typeof_value(). This method MUST be provided by the subclass.
Gegl.MetadataStoreClass.register_hook
This method is called after a file loader or saver registers
a GeglMetadataMap
and before any further processing takes place. It is
intended to allow an application to create further application-specific
mappings using gegl_metadata_store_register(). GeglMetadataStore
provides
a default method which emits the ::mapped
signal.
Gegl.MetadataStoreClass.set_value
Set the specified metadata value. If value
is NULL
the default value from
the associated GParamSpec
is used. This operation will fail if the value
has not been previously declared. A changed::name
signal is emitted when
the value is set. If the value is shadowed by a property a notify::name
signal is also emitted.