libvdo
|
A class representing a dictionary mapping keys to values. More...
#include <glib-object.h>
Go to the source code of this file.
Macros | |
#define | vdo_map_get_printf(self, type, def, len, format, ...) |
Returns a value using a printf-style format string to specify a key. More... | |
#define | vdo_map_set_printf(self, type, value, len, format, ...) |
Sets a value using a printf-style format string to specify a key. More... | |
Functions | |
VdoMap * | vdo_map_new (void) |
Constructs an new empty VdoMap. More... | |
VdoMap * | vdo_map_new_from_variant (GVariant *dictionary) |
Constructs a new VdoMap with the same entries as the specified GVariant dictionary. More... | |
gboolean | vdo_map_empty (const VdoMap *self) |
Checks if this map is empty. More... | |
gsize | vdo_map_size (const VdoMap *self) |
Returns the number of entries in this map. More... | |
void | vdo_map_swap (VdoMap *lhs, VdoMap *rhs) |
Swaps the contents of two maps. More... | |
gboolean | vdo_map_contains (const VdoMap *self, const gchar *name) |
Checks if this map contains the specified key. More... | |
gboolean | vdo_map_contains_va (const VdoMap *self,...) |
Checks if this map contains the specified set of keys. More... | |
gboolean | vdo_map_contains_strv (const VdoMap *self, const gchar *const *names) |
Checks if this map contains the specified set of keys. More... | |
gboolean | vdo_map_entry_equals (const VdoMap *self, const VdoMap *map, const gchar *name) |
Checks if the specified entry in this map and the specified map are equal. More... | |
gboolean | vdo_map_entry_updates (const VdoMap *self, const VdoMap *map, const gchar *name) |
Checks if the specified key in the specified map is mapped to a value that differs from the one in this map. More... | |
gboolean | vdo_map_equals (const VdoMap *self, const VdoMap *map) |
Checks if all entries in this map and the specified map are equal. More... | |
gboolean | vdo_map_equals_va (const VdoMap *self, const VdoMap *map,...) |
Checks if all of the specified entries in this map and the specified map are equal. More... | |
gboolean | vdo_map_equals_strv (const VdoMap *self, const VdoMap *map, const gchar *const *names) |
Checks if all of the specified entries in this map and the specified map are equal. More... | |
void | vdo_map_remove (VdoMap *self, const gchar *name) |
Removes the entry with the specified key from this map. More... | |
void | vdo_map_remove_va (VdoMap *self,...) |
Removes all entries with the specified keys from this map. More... | |
void | vdo_map_remove_strv (VdoMap *self, const gchar *const *names) |
Removes all entries with the specified keys from this map. More... | |
void | vdo_map_clear (VdoMap *self) |
Removes all of the entries from this map. More... | |
VdoMap * | vdo_map_filter_prefix (const VdoMap *self, const gchar *prefix) |
Returns a new map containing all entries from this map with a key that matches the specified prefix. More... | |
VdoMap * | vdo_map_filter_va (const VdoMap *self,...) |
Returns a new map containing all entries from this map with the specified keys. More... | |
VdoMap * | vdo_map_filter_strv (const VdoMap *self, const gchar *const *names) |
Returns a new map containing all entries from this map with the specified keys. More... | |
void | vdo_map_merge (VdoMap *self, const VdoMap *map) |
Merges the specified map into this map. More... | |
void | vdo_map_copy_value (VdoMap *self, const gchar *src, const gchar *dst) |
Copies the value associated with the key src to an entry with the key dst. More... | |
GVariant * | vdo_map_to_variant (const VdoMap *self) |
Create a GVariant dictionary containing all entries from this map. More... | |
void | vdo_map_dump (const VdoMap *self) |
Print a string representation of this map to stdout. More... | |
GVariant * | vdo_map_get_variant (const VdoMap *self, const gchar *name, GVariant *def) |
Returns the value which the key name is associated with. More... | |
void | vdo_map_set_boolean (VdoMap *self, const gchar *name, gboolean value) |
Sets the value associated with the specified key. More... | |
A class representing a dictionary mapping keys to values.
Copyright (C) 2016-2019, Axis Communications AB, Lund
#define vdo_map_get_printf | ( | self, | |
type, | |||
def, | |||
len, | |||
format, | |||
... | |||
) |
Returns a value using a printf-style format string to specify a key.
These macros work due to a GCC extension: parentheses around a compound statement implicitly make the value of the last expression inside the block the return value of the whole block.
self | A VdoMap. |
type | The type of the value to retrieve. |
def | Default return value. |
len | Maximum string length. |
format | A printf-style format string to use as a key. |
#define vdo_map_set_printf | ( | self, | |
type, | |||
value, | |||
len, | |||
format, | |||
... | |||
) |
Sets a value using a printf-style format string to specify a key.
self | A VdoMap. |
type | The type of the value to set. |
value | The value to set. |
len | Maximum string length. |
format | A printf-style format string to use as a key. |
void vdo_map_clear | ( | VdoMap * | self | ) |
Removes all of the entries from this map.
self | A VdoMap. |
gboolean vdo_map_contains | ( | const VdoMap * | self, |
const gchar * | name | ||
) |
Checks if this map contains the specified key.
self | A VdoMap. |
name | The key to check for. |
TRUE
if this map contains the specified key, otherwise FALSE
. gboolean vdo_map_contains_strv | ( | const VdoMap * | self, |
const gchar *const * | names | ||
) |
Checks if this map contains the specified set of keys.
NULL
.self | A VdoMap. |
names | A NULL terminated string array containing the keys to be checked for containment in this map. |
TRUE
if this map contains all the specified keys, otherwise FALSE
. gboolean vdo_map_contains_va | ( | const VdoMap * | self, |
... | |||
) |
Checks if this map contains the specified set of keys.
NULL
.self | A VdoMap. |
... | A NULL terminated variable argument list containing the keys to be checked for containment in this map. |
TRUE
if this map contains all the specified keys, otherwise FALSE
. void vdo_map_copy_value | ( | VdoMap * | self, |
const gchar * | src, | ||
const gchar * | dst | ||
) |
Copies the value associated with the key src to an entry with the key dst.
If an entry with the key dst does not already exist, a new one is created. The value of the existing entry is modified otherwise.
self | A VdoMap. |
src | The key associated with the value to copy. |
dst | The key for the entry to be created/modified. |
void vdo_map_dump | ( | const VdoMap * | self | ) |
Print a string representation of this map to stdout.
self | A VdoMap. |
gboolean vdo_map_empty | ( | const VdoMap * | self | ) |
Checks if this map is empty.
self | A VdoMap. |
TRUE
if this map is empty, otherwise FALSE
. Checks if the specified entry in this map and the specified map are equal.
self | A VdoMap. |
map | A map to be checked for equality with this map. |
name | The key specifying the entry to be checked for equality. |
TRUE
if the values mapped to the specified key in both maps are equal, otherwise FALSE
Checks if the specified key in the specified map is mapped to a value that differs from the one in this map.
self | A VdoMap. |
map | A map to be checked for an updating entry. |
name | the name of the map entry to check. |
TRUE
if map
contains an updating entry for this map. gboolean vdo_map_equals_strv | ( | const VdoMap * | self, |
const VdoMap * | map, | ||
const gchar *const * | names | ||
) |
Checks if all of the specified entries in this map and the specified map are equal.
This function takes a string array which must be terminated with the value NULL
.
self | A VdoMap. |
map | A map to be checked for equality with this map. |
names | A NULL terminated string array containing keys to be checked for equality. |
TRUE
if all entries are equal, otherwise FALSE
. Checks if all of the specified entries in this map and the specified map are equal.
This function takes a variable length argument list which must be terminated with the value NULL.
self | A VdoMap. |
map | A map to be checked for equality with this map. |
... | A NULL terminated variable argument list containing keys to be checked for equality. |
TRUE
if all the specified entries are equal, otherwise FALSE
Returns a new map containing all entries from this map with a key that matches the specified prefix.
self | A VdoMap. |
prefix | A prefix string to use as filter. |
self
. Free with g_object_unref()
. Returns a new map containing all entries from this map with the specified keys.
This function takes a string array which must be terminated with the value NULL
.
self | A VdoMap. |
names | A NULL terminated array of strings containing keys for entries to be copied to the new map. |
self
. Free with g_object_unref()
. Returns a new map containing all entries from this map with the specified keys.
This function takes a variable length argument list which must be terminated with the value NULL
.
self | A VdoMap. |
... | A NULL terminated variable argument list containing keys for entries to be copied to the new map. |
self
. Free with g_object_unref()
. GVariant* vdo_map_get_variant | ( | const VdoMap * | self, |
const gchar * | name, | ||
GVariant * | def | ||
) |
Returns the value which the key name is associated with.
The specified default value def
is returned if the specified key does not exists in this map.
self | A VdoMap. |
name | The key associated with the value to be returned. |
def | Default return value. |
Merges the specified map into this map.
self | A VdoMap. |
map | A map to be merged into this map. |
VdoMap* vdo_map_new_from_variant | ( | GVariant * | dictionary | ) |
void vdo_map_remove | ( | VdoMap * | self, |
const gchar * | name | ||
) |
Removes the entry with the specified key from this map.
self | A VdoMap. |
name | The key to remove. |
void vdo_map_remove_strv | ( | VdoMap * | self, |
const gchar *const * | names | ||
) |
Removes all entries with the specified keys from this map.
This function takes a string array which must be terminated with the value NULL
.
self | A VdoMap. |
names | A NULL terminated array of strings containing keys to be removed |
void vdo_map_remove_va | ( | VdoMap * | self, |
... | |||
) |
Removes all entries with the specified keys from this map.
This function takes a variable length argument list which must be terminated with the value NULL
.
self | A VdoMap. |
... | A NULL terminated variable argument list containing keys to be removed. |
void vdo_map_set_boolean | ( | VdoMap * | self, |
const gchar * | name, | ||
gboolean | value | ||
) |
Sets the value associated with the specified key.
If an entry with the key name does not exist in this map. a new entry will be created.
self | A VdoMap. |
name | The key associated with the value to be set. |
value | The value to set. |
gsize vdo_map_size | ( | const VdoMap * | self | ) |
Returns the number of entries in this map.
self | A VdoMap. |