RBStringValueMap

RBStringValueMap — specialized hash table for storing string to GValue mappings

Synopsis

                    RBStringValueMap;
                    RBStringValueMapClass;
RBStringValueMap*   rb_string_value_map_new             (void);
void                rb_string_value_map_set             (RBStringValueMap *map,
                                                         const char *key,
                                                         const GValue *value);
gboolean            rb_string_value_map_get             (RBStringValueMap *map,
                                                         const char *key,
                                                         GValue *out);
const GValue*       rb_string_value_map_peek            (RBStringValueMap *map,
                                                         const char *key);
gboolean            rb_string_value_map_remove          (RBStringValueMap *map,
                                                         const char *key);
guint               rb_string_value_map_size            (RBStringValueMap *map);
GHashTable*         rb_string_value_map_steal_hashtable (RBStringValueMap *map);

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.

Details

RBStringValueMap

typedef struct _RBStringValueMap RBStringValueMap;


RBStringValueMapClass

typedef struct {
	GObjectClass parent;
} RBStringValueMapClass;


rb_string_value_map_new ()

RBStringValueMap*   rb_string_value_map_new             (void);

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.

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.

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.

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.

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);

map :

a RBStringValueMap

Returns :

the number of entries in the map

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.

map :

a RBStringValueMap

Returns :

GHashTable from the map