Top | ![]() |
![]() |
![]() |
![]() |
GeglMetadataStore is a non-instantiable base class implementing the GeglMetadata interface and provides methods for metadata access using well-known names. For consistency with other GObject features, the naming convention for metadata variables is the same as for GObject properties.
Methods are provided allowing the application to test whether a particular
metadata item has a value and to set or get the values. If a metadata value
does not exist, a GLib warning is printed. The
gegl_metadata_store_has_value()
method can be used to test silently for
unset variables.
Signals are provided to allow an application to intercept metadata values from file modules, for example a Jpeg comment block might be parsed to set multiple metadata values, or multiple values may be formatted into the comment block.
Image resolution and resolution units are accessible only as properties. Well-known metatdata values are shadowed by properties to allow applications to take advantage of features such as introspection and property binding.
GeglMetadataStore does not itself implement the storage mechanism, it must
be subclassed to provide this. GeglMetadataHash implements a store using a
hash table. For convenience gegl_metadata_hash_new()
casts its return value
to GeglMetadataStore as it does not add any new methods or properties.
void gegl_metadata_store_set_resolution_unit (GeglMetadataStore *self
,GeglResolutionUnit unit
);
Set the units used for the resolution (density) values.
GeglResolutionUnit
gegl_metadata_store_get_resolution_unit
(GeglMetadataStore *self
);
Get the units used for resolution.
void gegl_metadata_store_set_resolution_x (GeglMetadataStore *self
,gdouble resolution_x
);
Set the X resolution or density in dots per unit.
gdouble
gegl_metadata_store_get_resolution_x (GeglMetadataStore *self
);
Get the X resolution or density in dots per unit.
void gegl_metadata_store_set_resolution_y (GeglMetadataStore *self
,gdouble resolution_y
);
Set the Y resolution or density in dots per unit.
gdouble
gegl_metadata_store_get_resolution_y (GeglMetadataStore *self
);
Get the Y resolution or density in dots per unit.
const gchar *
gegl_metadata_store_get_file_module_name
(GeglMetadataStore *self
);
Return the name registered by the current file module.
void gegl_metadata_store_set_title (GeglMetadataStore *self
,const gchar *title
);
Set title or caption for image.
const gchar *
gegl_metadata_store_get_title (GeglMetadataStore *self
);
Get title or caption for image.
void gegl_metadata_store_set_artist (GeglMetadataStore *self
,const gchar *artist
);
Set name of image creator.
const gchar *
gegl_metadata_store_get_artist (GeglMetadataStore *self
);
Get name of image creator.
void gegl_metadata_store_set_description (GeglMetadataStore *self
,const gchar *description
);
Set description of image.
const gchar *
gegl_metadata_store_get_description (GeglMetadataStore *self
);
Get description of image.
void gegl_metadata_store_set_copyright (GeglMetadataStore *self
,const gchar *copyright
);
Set the copyright notice.
const gchar *
gegl_metadata_store_get_copyright (GeglMetadataStore *self
);
Get the copyright notice.
void gegl_metadata_store_set_disclaimer (GeglMetadataStore *self
,const gchar *disclaimer
);
Set the legal disclaimer.
const gchar *
gegl_metadata_store_get_disclaimer (GeglMetadataStore *self
);
Get the legal disclaimer.
void gegl_metadata_store_set_warning (GeglMetadataStore *self
,const gchar *warning
);
Set the warning of nature of content.
const gchar *
gegl_metadata_store_get_warning (GeglMetadataStore *self
);
Get warning.
void gegl_metadata_store_set_comment (GeglMetadataStore *self
,const gchar *comment
);
Set the miscellaneous comment; conversion from GIF comment.
const gchar *
gegl_metadata_store_get_comment (GeglMetadataStore *self
);
Get the comment.
void gegl_metadata_store_set_software (GeglMetadataStore *self
,const gchar *software
);
Set software used to create the image.
const gchar *
gegl_metadata_store_get_software (GeglMetadataStore *self
);
Get software used to create the image.
void gegl_metadata_store_set_source (GeglMetadataStore *self
,const gchar *source
);
Set device used to create the image.
const gchar *
gegl_metadata_store_get_source (GeglMetadataStore *self
);
Get device used to create the image.
void gegl_metadata_store_set_timestamp (GeglMetadataStore *self
,const GDateTime *timestamp
);
Set time of original image creation.
GDateTime *
gegl_metadata_store_get_timestamp (GeglMetadataStore *self
);
Get time of original image creation.
void gegl_metadata_store_declare (GeglMetadataStore *self
,GParamSpec *pspec
);
Declare a metadata value using a GParamSpec.
gboolean gegl_metadata_store_has_value (GeglMetadataStore *self
,const gchar *name
);
Test whether the GeglMetadataStore contains a value for the specified name.
GType gegl_metadata_store_typeof_value (GeglMetadataStore *self
,const gchar *name
);
Get the declared type of the value in the GeglMetadataStore.
void gegl_metadata_store_set_value (GeglMetadataStore *self
,const gchar *name
,const GValue *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.
void gegl_metadata_store_get_value (GeglMetadataStore *self
,const gchar *name
,GValue *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.
void gegl_metadata_store_set_string (GeglMetadataStore *self
,const gchar *name
,const gchar *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()
.
const gchar * gegl_metadata_store_get_string (GeglMetadataStore *self
,const gchar *name
);
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()
.
void gegl_metadata_store_register (GeglMetadataStore *self
,const gchar *local_name
,const gchar *name
,GValueTransform transform
);
self |
||
local_name |
Metadata name known to file module |
|
name |
Metadata name |
|
transform |
A GValueTransform function or |
[scope async] |
void gegl_metadata_store_notify (GeglMetadataStore *self
,GParamSpec *pspec
,gboolean shadow
);
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.
self |
||
pspec |
The GParamSpec used to declare the variable. |
|
shadow |
The metadata variable shadows a property. |
struct GeglMetadataStoreClass { /* Subclass MUST provide the following */ 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); /* Subclass MAY provide the following */ 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
The _declare virtual method creates a metadata variable in the
underlying data store. It implements |
||
The pspec virtual method returns the GParamSpec used to declare a
metadata variable. It is used to implement
|
||
Set a metadata variable using a GValue. Implements
|
||
Return a pointer to a GValue with the value of the metadata
variable or |
||
The has_value virtual method implements
|
||
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 |
||
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 |
||
This method is called to optionally generate a value to be
written to and image file. If no generator is available it returns |