Metadata Object
3
LIBTRACKER-MODULE Library

# Metadata Object

Object used to exchange metadata information between the modules and Tracker indexer

## Synopsis

    #include <libtracker-module/tracker-module-metadata.h>

    typedef             TrackerModuleMetadata;
    TrackerModuleMetadata* tracker_module_metadata_new      (void);
    void                tracker_module_metadata_clear_field (TrackerModuleMetadata *metadata,
                                                             const gchar *field_name);
    gboolean            tracker_module_metadata_add_take_string
                                                            (TrackerModuleMetadata *metadata,
                                                             const gchar *field_name,
                                                             gchar *value);
    void                tracker_module_metadata_add_string  (TrackerModuleMetadata *metadata,
                                                             const gchar *field_name,
                                                             const gchar *value);
    void                tracker_module_metadata_add_int     (TrackerModuleMetadata *metadata,
                                                             const gchar *field_name,
                                                             gint value);
    void                tracker_module_metadata_add_uint    (TrackerModuleMetadata *metadata,
                                                             const gchar *field_name,
                                                             guint value);
    void                tracker_module_metadata_add_double  (TrackerModuleMetadata *metadata,
                                                             const gchar *field_name,
                                                             gdouble value);
    void                tracker_module_metadata_add_float   (TrackerModuleMetadata *metadata,
                                                             const gchar *field_name,
                                                             gfloat value);
    void                tracker_module_metadata_add_date    (TrackerModuleMetadata *metadata,
                                                             const gchar *field_name,
                                                             time_t value);

## Object Hierarchy

      GObject
       +----TrackerModuleMetadata

## Description

TrackerModuleMetadata is used by the modules to provide metadata information to Tracker indexer. Conceptually it's a hash table, where you can pile up metadata. Depending on the metadata type, it could store single (Email:Subject for example) or multiple values (like Email:CC)

## Details

### TrackerModuleMetadata

    typedef struct TrackerModuleMetadata TrackerModuleMetadata;           /* dummy typedef */

Metadata object

### tracker_module_metadata_new ()

    TrackerModuleMetadata* tracker_module_metadata_new      (void);

Creates a new TrackerModuleMetadata

Returns :

  A newly created TrackerModuleMetadata

### tracker_module_metadata_clear_field ()

    void                tracker_module_metadata_clear_field (TrackerModuleMetadata *metadata,
                                                             const gchar *field_name);

Clears any content for the given field name.

`metadata` :

  A TrackerModuleMetadata

`field_name` :

  Field name for the metadata to clear

### tracker_module_metadata_add_take_string ()

    gboolean            tracker_module_metadata_add_take_string
                                                            (TrackerModuleMetadata *metadata,
                                                             const gchar *field_name,
                                                             gchar *value);

Adds a new metadata element as a string into `metadata`. For ontology fields that can take several values, this function will allow adding several elements to the same field name.

If the function returns TRUE, `metadata` will take ownership on `value`, else you are responsible of freeing it.

`metadata` :

  A TrackerModuleMetadata

`field_name` :

  Field name for the metadata to insert

`value` :

  Value for the metadata

Returns :

  TRUE if the value was added successfully.

### tracker_module_metadata_add_string ()

    void                tracker_module_metadata_add_string  (TrackerModuleMetadata *metadata,
                                                             const gchar *field_name,
                                                             const gchar *value);

Adds a new metadata element as a string into `metadata`. see `tracker_module_metadata_add_take_string()`.

`metadata` :

  A TrackerModuleMetadata

`field_name` :

  Field name for the metadata to insert

`value` :

  Value for the metadata

### tracker_module_metadata_add_int ()

    void                tracker_module_metadata_add_int     (TrackerModuleMetadata *metadata,
                                                             const gchar *field_name,
                                                             gint value);

Adds a new metadata element as a integer into `metadata`. see `tracker_module_metadata_add_take_string()`.

`metadata` :

  A TrackerModuleMetadata

`field_name` :

  Field name for the metadata to insert

`value` :

  Value for the metadata

### tracker_module_metadata_add_uint ()

    void                tracker_module_metadata_add_uint    (TrackerModuleMetadata *metadata,
                                                             const gchar *field_name,
                                                             guint value);

Adds a new metadata element as an unsigned integer into `metadata`. see `tracker_module_metadata_add_take_string()`.

`metadata` :

  A TrackerModuleMetadata

`field_name` :

  Field name for the metadata to insert

`value` :

  Value for the metadata

### tracker_module_metadata_add_double ()

    void                tracker_module_metadata_add_double  (TrackerModuleMetadata *metadata,
                                                             const gchar *field_name,
                                                             gdouble value);

Adds a new metadata element as a double into `metadata`. see `tracker_module_metadata_add_take_string()`.

`metadata` :

  A TrackerModuleMetadata

`field_name` :

  Field name for the metadata to insert

`value` :

  Value for the metadata

### tracker_module_metadata_add_float ()

    void                tracker_module_metadata_add_float   (TrackerModuleMetadata *metadata,
                                                             const gchar *field_name,
                                                             gfloat value);

Adds a new metadata element as a float into `metadata`. see `tracker_module_metadata_add_take_string()`.

`metadata` :

  A TrackerModuleMetadata

`field_name` :

  Field name for the metadata to insert

`value` :

  Value for the metadata

### tracker_module_metadata_add_date ()

    void                tracker_module_metadata_add_date    (TrackerModuleMetadata *metadata,
                                                             const gchar *field_name,
                                                             time_t value);

Adds a new metadata element as a time_t into `metadata`. see `tracker_module_metadata_add_take_string()`.

`metadata` :

  A TrackerModuleMetadata

`field_name` :

  Field name for the metadata to insert

`value` :

  Value for the metadata

## See Also

`tracker_module_file_get_metadata()`