common: new api added to GSignondDictionary to know if a key is existing
authorAmarnath Valluri <amarnath.valluri@linux.intel.com>
Tue, 27 Aug 2013 15:05:13 +0000 (18:05 +0300)
committerAmarnath Valluri <amarnath.valluri@linux.intel.com>
Thu, 5 Sep 2013 11:11:59 +0000 (14:11 +0300)
include/gsignond/gsignond-dictionary.h
src/common/gsignond-dictionary.c

index d34944f..f8eb54d 100644 (file)
@@ -116,6 +116,9 @@ gsignond_dictionary_set_string (GSignondDictionary *dict, const gchar *key,
 gboolean
 gsignond_dictionary_remove (GSignondDictionary *dict, const gchar *key);
 
+gboolean
+gsignond_dictionary_contains (GSignondDictionary *dict, const gchar *key);
+
 G_END_DECLS
 
 #endif /* __GSIGNOND_DICTIONARY_H__ */
index 8ec88c3..32fc8c4 100644 (file)
@@ -515,3 +515,23 @@ gsignond_dictionary_copy (GSignondDictionary *other)
 
     return dict;
 }
+
+/**
+ * gsignond_dictionary_contains:
+ * @dict: instance of #GSignondDictionary
+ * @key: (transfer none): key to check
+ *
+ * Checks if the @dict contains @key.
+ *
+ * Returns: TRUE if found, FALSE otherwise.
+ */
+gboolean
+gsignond_dictionary_contains (GSignondDictionary *dict,
+                              const gchar *key)
+{
+    g_return_val_if_fail (dict != NULL, FALSE);
+    g_return_val_if_fail (key != NULL, FALSE);
+
+    return g_hash_table_contains (dict, key);
+}
+