libvdo
vdo-map.h
Go to the documentation of this file.
1 
9 #ifndef __VDO_MAP_H__
10 #define __VDO_MAP_H__
11 
12 #include <glib-object.h>
13 #include "vdo-types.h"
14 
15 G_BEGIN_DECLS
16 
58 #define VDO_TYPE_MAP (vdo_map_get_type())
59 G_DECLARE_FINAL_TYPE(VdoMap, vdo_map, VDO, MAP, GObject)
60 
61 
76 #define vdo_map_get_printf(self, type, def, len, format, ...) __extension__ ({\
77  gchar name[len];\
78  g_snprintf(name, len, format, __VA_ARGS__);\
79  vdo_map_get_##type(self, name, def);\
80 })
81 
82 #define vdo_map_get_boolean_printf(self, def, len, format, ...) __extension__ ({\
83  gchar name[len];\
84  g_snprintf(name, len, format, __VA_ARGS__);\
85  vdo_map_get_boolean(self, name, def);\
86 })
87 
88 #define vdo_map_get_string_printf(self, def, len, format, ...) __extension__ ({\
89  gchar name[len];\
90  g_snprintf(name, len, format, __VA_ARGS__);\
91  vdo_map_get_string(self, name, NULL, def);\
92 })
93 
94 #define vdo_map_dup_string_printf(self, def, len, format, ...) __extension__ ({\
95  gchar name[len];\
96  g_snprintf(name, len, format, __VA_ARGS__);\
97  vdo_map_dup_string(self, name, def);\
98 })
99 
109 #define vdo_map_set_printf(self, type, value, len, format, ...) {\
110  gchar name[len];\
111  g_snprintf(name, len, format, __VA_ARGS__);\
112  vdo_map_set_##type(self, name, value);\
113 }
114 
115 #define vdo_map_set_boolean_printf(self, value, len, format, ...) {\
116  gchar name[len];\
117  g_snprintf(name, len, format, __VA_ARGS__);\
118  vdo_map_set_boolean(self, name, value);\
119 }
120 
128 #define vdo_map_remove_printf(self, len, format, ...) {\
129  gchar name[len];\
130  g_snprintf(name, len, format, __VA_ARGS__);\
131  vdo_map_remove(self, name);\
132 }
133 
140 
148 VdoMap* vdo_map_clone(const VdoMap* other);
149 
159 #ifndef AXISOS_13_PREVIEW
160 VdoMap *vdo_map_new_from_variant(GVariant *dictionary);
161 #endif
162 
170 gboolean vdo_map_empty(const VdoMap *self);
171 
179 gsize vdo_map_size(const VdoMap *self);
180 
187 void vdo_map_swap(VdoMap *lhs, VdoMap *rhs);
188 
197 gboolean vdo_map_contains(const VdoMap *self, const gchar *name);
198 
211 gboolean vdo_map_contains_va(const VdoMap *self, ...);
212 
225 gboolean vdo_map_contains_strv(const VdoMap *self, const gchar * const *names);
226 
237 gboolean vdo_map_entry_equals(const VdoMap *self, const VdoMap *map, const gchar *name);
238 
249 gboolean vdo_map_entry_updates(const VdoMap *self, const VdoMap *map, const gchar *name);
250 
259 gboolean vdo_map_equals(const VdoMap *self, const VdoMap *map);
260 
275 gboolean vdo_map_equals_va(const VdoMap *self, const VdoMap *map, ...);
276 
291 gboolean vdo_map_equals_strv(const VdoMap *self, const VdoMap *map, const gchar * const *names);
292 
299 void vdo_map_remove(VdoMap *self, const gchar *name);
300 
311 void vdo_map_remove_va(VdoMap *self, ...);
312 
323 void vdo_map_remove_strv(VdoMap *self, const gchar * const *names);
324 
330 void vdo_map_clear(VdoMap *self);
331 
342 VdoMap *vdo_map_filter_prefix(const VdoMap *self, const gchar *prefix);
343 
358 VdoMap *vdo_map_filter_va(const VdoMap *self, ...);
359 
374 VdoMap *vdo_map_filter_strv(const VdoMap *self, const gchar * const *names);
375 
382 void vdo_map_merge(VdoMap *self, const VdoMap *map);
383 
394 void vdo_map_copy_value(VdoMap *self, const gchar *src, const gchar *dst);
395 
404 #ifndef AXISOS_13_PREVIEW
405 GVariant *vdo_map_to_variant(const VdoMap *self);
406 #endif
407 
413 void vdo_map_dump(const VdoMap *self);
414 
416 guchar vdo_map_get_byte(const VdoMap *self, const gchar *name, guchar def);
417 gint16 vdo_map_get_int16(const VdoMap *self, const gchar *name, gint16 def);
418 guint16 vdo_map_get_uint16(const VdoMap *self, const gchar *name, guint16 def);
419 guint32* vdo_map_get_uint32x2(const VdoMap *self, const gchar *name, guint32 def[2]);
420 guint32* vdo_map_get_uint32x4(const VdoMap *self, const gchar *name, guint32 def[4]);
421 gdouble* vdo_map_get_doublex4(const VdoMap *self, const gchar *name, gdouble def[4]);
422 
424 #ifndef AXISOS_13_PREVIEW
425 GVariant* vdo_map_get_variant(const VdoMap *self, const gchar *name, GVariant *def);
426 #endif
427 
440 gboolean vdo_map_get_boolean(const VdoMap *self, const gchar *name, gboolean def);
441 
454 gint32 vdo_map_get_int32(const VdoMap *self, const gchar *name, gint32 def);
455 
468 guint32 vdo_map_get_uint32(const VdoMap *self, const gchar *name, guint32 def);
469 
482 gint64 vdo_map_get_int64(const VdoMap *self, const gchar *name, gint64 def);
483 
496 guint64 vdo_map_get_uint64(const VdoMap *self, const gchar *name, guint64 def);
497 
510 gdouble vdo_map_get_double(const VdoMap *self, const gchar *name, gdouble def);
511 
525 const gchar *vdo_map_get_string(const VdoMap *self, const gchar *name, gsize *size, const gchar *def);
526 
539 gchar *vdo_map_dup_string(const VdoMap *self, const gchar *name, const gchar *def);
540 
553 VdoPair32i vdo_map_get_pair32i(const VdoMap *self, const gchar *name, VdoPair32i def);
554 
567 VdoPair32u vdo_map_get_pair32u(const VdoMap *self, const gchar *name, VdoPair32u def);
568 
581 VdoQuad32i vdo_map_get_quad32i(const VdoMap *self, const gchar *name, VdoQuad32i def);
582 
595 VdoQuad32u vdo_map_get_quad32u(const VdoMap *self, const gchar *name, VdoQuad32u def);
596 
598 void vdo_map_set_byte(VdoMap *self, const gchar *name, guchar value);
599 void vdo_map_set_int16(VdoMap *self, const gchar *name, gint16 value);
600 void vdo_map_set_uint16(VdoMap *self, const gchar *name, guint16 value);
601 void vdo_map_set_uint32x2(VdoMap *self, const gchar *name, const guint32 value[2]);
602 void vdo_map_set_uint32x4(VdoMap *self, const gchar *name, const guint32 value[4]);
603 void vdo_map_set_doublex4(VdoMap *self, const gchar *name, const gdouble value[4]);
604 
615 void vdo_map_set_boolean(VdoMap *self, const gchar *name, gboolean value);
616 
627 void vdo_map_set_int32(VdoMap *self, const gchar *name, gint32 value);
628 
639 void vdo_map_set_uint32(VdoMap *self, const gchar *name, guint32 value);
640 
651 void vdo_map_set_int64(VdoMap *self, const gchar *name, gint64 value);
652 
663 void vdo_map_set_uint64(VdoMap *self, const gchar *name, guint64 value);
664 
675 void vdo_map_set_double(VdoMap *self, const gchar *name, gdouble value);
676 
687 void vdo_map_set_string(VdoMap *self, const gchar *name, const gchar *value);
688 
699 void vdo_map_set_pair32i(VdoMap *self, const gchar *name, VdoPair32i value);
700 
711 void vdo_map_set_pair32u(VdoMap *self, const gchar *name, VdoPair32u value);
712 
723 void vdo_map_set_quad32i(VdoMap *self, const gchar *name, VdoQuad32i value);
724 
735 void vdo_map_set_quad32u(VdoMap *self, const gchar *name, VdoQuad32u value);
736 
737 G_END_DECLS
738 
739 #endif
A class representing a dictionary mapping keys to values.
guint32 vdo_map_get_uint32(const VdoMap *self, const gchar *name, guint32 def)
Returns the value which the key name is associated with.
guint64 vdo_map_get_uint64(const VdoMap *self, const gchar *name, guint64 def)
Returns the value which the key name is associated with.
gboolean vdo_map_equals(const VdoMap *self, const VdoMap *map)
Checks if all entries in this map and the specified map are equal.
gint32 vdo_map_get_int32(const VdoMap *self, const gchar *name, gint32 def)
Returns the value which the key name is associated with.
void vdo_map_set_pair32i(VdoMap *self, const gchar *name, VdoPair32i value)
Sets the value associated with the specified key.
gboolean vdo_map_contains_strv(const VdoMap *self, const gchar *const *names)
Checks if this map contains the specified set of keys.
void vdo_map_set_quad32u(VdoMap *self, const gchar *name, VdoQuad32u value)
Sets the value associated with the specified key.
void vdo_map_swap(VdoMap *lhs, VdoMap *rhs)
Swaps the contents of two maps.
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.
void vdo_map_set_uint64(VdoMap *self, const gchar *name, guint64 value)
Sets the value associated with the specified key.
gboolean vdo_map_contains_va(const VdoMap *self,...)
Checks if this map contains the specified set of keys.
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.
gchar * vdo_map_dup_string(const VdoMap *self, const gchar *name, const gchar *def)
Returns the value which the key name is associated with.
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.
void vdo_map_remove(VdoMap *self, const gchar *name)
Removes the entry with the specified key from this map.
const gchar * vdo_map_get_string(const VdoMap *self, const gchar *name, gsize *size, const gchar *def)
Returns the value which the key name is associated with.
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.
VdoQuad32u vdo_map_get_quad32u(const VdoMap *self, const gchar *name, VdoQuad32u def)
Returns the value which the key name is associated with.
void vdo_map_set_quad32i(VdoMap *self, const gchar *name, VdoQuad32i value)
Sets the value associated with the specified key.
VdoPair32i vdo_map_get_pair32i(const VdoMap *self, const gchar *name, VdoPair32i def)
Returns the value which the key name is associated with.
void vdo_map_set_boolean(VdoMap *self, const gchar *name, gboolean value)
Sets the value associated with the specified key.
VdoMap * vdo_map_new(void)
Constructs an new empty VdoMap.
void vdo_map_set_double(VdoMap *self, const gchar *name, gdouble value)
Sets the value associated with the specified key.
void vdo_map_set_uint32(VdoMap *self, const gchar *name, guint32 value)
Sets the value associated with the specified key.
void vdo_map_set_pair32u(VdoMap *self, const gchar *name, VdoPair32u value)
Sets the value associated with the specified key.
VdoQuad32i vdo_map_get_quad32i(const VdoMap *self, const gchar *name, VdoQuad32i def)
Returns the value which the key name is associated with.
VdoMap * vdo_map_clone(const VdoMap *other)
Creates a deep copy of the specified VdoMap.
gsize vdo_map_size(const VdoMap *self)
Returns the number of entries in this map.
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 th...
void vdo_map_set_string(VdoMap *self, const gchar *name, const gchar *value)
Sets the value associated with the specified key.
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.
void vdo_map_remove_va(VdoMap *self,...)
Removes all entries with the specified keys from this map.
void vdo_map_clear(VdoMap *self)
Removes all of the entries from this map.
gdouble vdo_map_get_double(const VdoMap *self, const gchar *name, gdouble def)
Returns the value which the key name is associated with.
void vdo_map_set_int32(VdoMap *self, const gchar *name, gint32 value)
Sets the value associated with the specified key.
VdoPair32u vdo_map_get_pair32u(const VdoMap *self, const gchar *name, VdoPair32u def)
Returns the value which the key name is associated with.
void vdo_map_set_int64(VdoMap *self, const gchar *name, gint64 value)
Sets the value associated with the specified key.
gint64 vdo_map_get_int64(const VdoMap *self, const gchar *name, gint64 def)
Returns the value which the key name is associated with.
void vdo_map_merge(VdoMap *self, const VdoMap *map)
Merges the specified map into this map.
VdoMap * vdo_map_filter_va(const VdoMap *self,...)
Returns a new map containing all entries from this map with the specified keys.
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.
void vdo_map_remove_strv(VdoMap *self, const gchar *const *names)
Removes all entries with the specified keys from this map.
gboolean vdo_map_contains(const VdoMap *self, const gchar *name)
Checks if this map contains the specified key.
Vdo common type definitions.