## osinfo_entity

osinfo_entity — Abstract base class for metadata objects

## Functions

const gchar * | osinfo_entity_get_id ()
GList * | osinfo_entity_get_param_keys ()
const gchar * | osinfo_entity_get_param_value ()
gboolean | osinfo_entity_get_param_value_boolean ()
gboolean | osinfo_entity_get_param_value_boolean_with_default ()
gint | osinfo_entity_get_param_value_enum ()
gint64 | osinfo_entity_get_param_value_int64 ()
gint64 | osinfo_entity_get_param_value_int64_with_default ()
GList * | osinfo_entity_get_param_value_list ()
void | osinfo_entity_set_param ()
void | osinfo_entity_set_param_boolean ()
void | osinfo_entity_set_param_int64 ()
void | osinfo_entity_set_param_enum ()
void | osinfo_entity_add_param ()
void | osinfo_entity_clear_param ()

## Types and Values

#define | OSINFO_TYPE_ENTITY
#define | OSINFO_ENTITY_PROP_ID

## Description

OsinfoEntity is an abstract base class for all objects against which metadata needs to be recorded. Every object has a unique identifier, which is recommended to be in URI format. Named, multi-valued data parameters can be associated with each entity. When filtering lists of entities, the parameter values can be used for matching.

## Functions

### osinfo_entity_get_id ()

    const gchar *
    osinfo_entity_get_id (OsinfoEntity *entity);

Retrieves the unique key for the entity. The format of identifiers is undefined, but the recommended practice is to use a URI.

#### Parameters

entity | an OsinfoEntity |

#### Returns

the unique key for the entity.

[transfer none]

### osinfo_entity_get_param_keys ()

    GList *
    osinfo_entity_get_param_keys (OsinfoEntity *entity);

Retrieve all the known parameter keys associated with the entity

#### Parameters

entity | an OsinfoEntity containing the parameters |

#### Returns

The list of string parameters.

[transfer container][element-type utf8]

### osinfo_entity_get_param_value ()

    const gchar *
    osinfo_entity_get_param_value (OsinfoEntity *entity,
                                   const gchar *key);

Retrieve the parameter value associated with a named key. If multiple values are stored against the key, only the first value is returned. If no value is associated, NULL is returned

#### Parameters

entity | an OsinfoEntity containing the parameters |
key | the name of the key |

#### Returns

the value associated with the key, or NULL.

[transfer none]

### osinfo_entity_get_param_value_boolean ()

    gboolean
    osinfo_entity_get_param_value_boolean (OsinfoEntity *entity,
                                           const gchar *key);

Retrieve the parameter value associated with a named key as a boolean. If multiple values are stored against the key, only the first value is returned. If no value is associated, FALSE is returned

#### Parameters

entity | an OsinfoEntity containing the parameters |
key | the name of the key |

#### Returns

the value associated with the key as a boolean, or FALSE

Since: 0.2.0

### osinfo_entity_get_param_value_boolean_with_default ()

    gboolean
    osinfo_entity_get_param_value_boolean_with_default
                                   (OsinfoEntity *entity,
                                    const char *key,
                                    gboolean default_value);

Retrieve the parameter value associated with a named key as a boolean. If multiple values are stored against the key, only the first value is returned. If no value is associated, `default_value` is returned.

#### Parameters

entity | an OsinfoEntity containing the parameters |
key | the name of the key |
default_value | the value to be returned in case there's no value associated with the `key` |

#### Returns

the value associated with the key as a boolean, or `default_value`

Since: 0.2.1

### osinfo_entity_get_param_value_enum ()

    gint
    osinfo_entity_get_param_value_enum (OsinfoEntity *entity,
                                        const char *key,
                                        GType enum_type,
                                        gint default_value);

Retrieve the parameter value associated with a named key as an enum value. If multiple values are stored against the key, only the first value is returned. If no value is associated, the `default_value` is returned.

#### Parameters

entity | an OsinfoEntity containing the parameters |
key | the name of the key |
enum_type | the enum type |
default_value | the default value to be used, in case there's no value associated with the key |

#### Returns

the enum value associated with the key, or `default_value` .

Since: 0.2.2

### osinfo_entity_get_param_value_int64 ()

    gint64
    osinfo_entity_get_param_value_int64 (OsinfoEntity *entity,
                                         const gchar *key);

Retrieve the parameter value associated with a named key as an int64. If multiple values are stored against the key, only the first value is returned. If no value is associated, -1 is returned.

#### Parameters

entity | an OsinfoEntity containing the parameters |
key | the name of the key |

#### Returns

the value associated with the key as an int64, or -1.

Since: 0.2.1

### osinfo_entity_get_param_value_int64_with_default ()

    gint64
    osinfo_entity_get_param_value_int64_with_default
                                   (OsinfoEntity *entity,
                                    const gchar *key,
                                    gint64 default_value);

Retrieve the parameter value associated with a named key as an int64. If multiple values are stored against the key, only the first value is returned. If no value is associated, `default_value` is returned.

#### Parameters

entity | an OsinfoEntity containing the parameters |
key | the name of the key |
default_value | the value to be returned in case there's no value associated with the `key` |

#### Returns

the value associated with the key as an int64, or `default_value`

Since: 0.2.1

### osinfo_entity_get_param_value_list ()

    GList *
    osinfo_entity_get_param_value_list (OsinfoEntity *entity,
                                        const gchar *key);

Retrieve all the parameter values associated with a named key. If no values are associated, NULL is returned

#### Parameters

entity | an OsinfoEntity containing the parameters |
key | the name of the key |

#### Returns

the values associated with the key.

[transfer container][element-type utf8]

### osinfo_entity_set_param ()

    void
    osinfo_entity_set_param (OsinfoEntity *entity,
                             const gchar *key,
                             const gchar *value);

Sets a new parameter against the entity. If the key already has a value associated with it, the existing value will be cleared.

#### Parameters

entity | an OsinfoEntity containing the parameters |
key | the name of the key |
value | the data to associated with that key |

### osinfo_entity_set_param_boolean ()

    void
    osinfo_entity_set_param_boolean (OsinfoEntity *entity,
                                     const gchar *key,
                                     gboolean value);

Sets a new parameter against the entity. If the key already has a value associated with it, the existing value will be cleared.

#### Parameters

entity | an OsinfoEntity containing the parameters |
key | the name of the key |
value | the boolean value to be associated with that key |

Since: 0.2.0

### osinfo_entity_set_param_int64 ()

    void
    osinfo_entity_set_param_int64 (OsinfoEntity *entity,
                                   const gchar *key,
                                   gint64 value);

Sets a new parameter against the entity. If the key already has a value associated with it, the existing value will be cleared.

#### Parameters

entity | an OsinfoEntity containing the parameters |
key | the name of the key |
value | the int64 value to be associated with that key |

Since: 0.2.1

### osinfo_entity_set_param_enum ()

    void
    osinfo_entity_set_param_enum (OsinfoEntity *entity,
                                  const gchar *key,
                                  gint value,
                                  GType enum_type);

Sets a new parameter against the entity. If the key already has a value associated with it, the existing value will be cleared.

#### Parameters

entity | an OsinfoEntity containing the parameters |
key | the name of the key |
value | the enum value to be associated with that key |
enum_type | the enum type |

Since: 0.2.2

### osinfo_entity_add_param ()

    void
    osinfo_entity_add_param (OsinfoEntity *entity,
                             const gchar *key,
                             const gchar *value);

Adds a new parameter against the entity. A key can have multiple values associated. Thus repeated calls with the same key will build up a list of possible values.

#### Parameters

entity | an OsinfoEntity containing the parameters |
key | the name of the key |
value | the data to associated with that key |

### osinfo_entity_clear_param ()

    void
    osinfo_entity_clear_param (OsinfoEntity *entity,
                               const gchar *key);

Remove all values associated with a key

#### Parameters

entity | an OsinfoEntity containing the parameters |
key | the name of the key |

## Types and Values

### OSINFO_TYPE_ENTITY

    #define OSINFO_TYPE_ENTITY (osinfo_entity_get_type ())

### OSINFO_ENTITY_PROP_ID

    #define OSINFO_ENTITY_PROP_ID "id"

## See Also

OsinfoList, OsinfoDb