RBStringValueMap

RBStringValueMap — specialized hash table for storing string to GValue mappings

Functions

Types and Values

Object Hierarchy

    GObject
    ╰── RBStringValueMap

Description

Simplifies the use of string:GValue maps with respect to copying of the values inserted into the map. Except for rb_string_value_map_peek, the caller retains ownership of values passed in, and assumes ownership of all values returned.

Functions

rb_string_value_map_new ()

RBStringValueMap *
rb_string_value_map_new (void);

Creates a new RBStringValueMap

Returns

new empty RBStringValueMap


rb_string_value_map_set ()

void
rb_string_value_map_set (RBStringValueMap *map,
                         const char *key,
                         const GValue *value);

Inserts a value into the map. The value is copied.

Parameters

map

a RBStringValueMap

 

key

key to set

 

value

value to store

 

rb_string_value_map_get ()

gboolean
rb_string_value_map_get (RBStringValueMap *map,
                         const char *key,
                         GValue *out);

Locates and copies the value associated with the key.

Parameters

map

a RBStringValueMap

 

key

key to retrieve

 

out

returns a copy of the value in the map

 

Returns

TRUE if the value was found


rb_string_value_map_peek ()

const GValue *
rb_string_value_map_peek (RBStringValueMap *map,
                          const char *key);

Locates the value associated with the key. This returns the GValue stored in the map, so it cannot be modified.

Parameters

map

a RBStringValueMap

 

key

key to retrieve

 

Returns

the GValue associated with the key


rb_string_value_map_remove ()

gboolean
rb_string_value_map_remove (RBStringValueMap *map,
                            const char *key);

Removes a value from the map.

Parameters

map

a RBStringValueMap

 

key

key to remove

 

Returns

TRUE if the value was found and removed


rb_string_value_map_size ()

guint
rb_string_value_map_size (RBStringValueMap *map);

Returns the number of entries in the map.

Parameters

map

a RBStringValueMap

 

Returns

number of entries


rb_string_value_map_steal_hashtable ()

GHashTable *
rb_string_value_map_steal_hashtable (RBStringValueMap *map);

Extracts and returns the underlying hash table from the map, and creates a new empty map.

Parameters

map

a RBStringValueMap

 

Returns

GHashTable from the map.

[transfer full]

Types and Values

struct RBStringValueMap

struct RBStringValueMap;

struct RBStringValueMapClass

struct RBStringValueMapClass {
	GObjectClass parent;
};