[evolution/webkit-composer: 116/130] Add e_spell_dictionary_hash().
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/webkit-composer: 116/130] Add e_spell_dictionary_hash().
- Date: Sat, 19 Jan 2013 14:36:51 +0000 (UTC)
commit e2976e099b39ad63ecd5cf13221b6197a24d1649
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Jan 17 07:38:13 2013 -0500
Add e_spell_dictionary_hash().
Generates a hash value for a dictionary based on its ISO code.
doc/reference/libeutil/libeutil-sections.txt | 1 +
e-util/e-spell-dictionary.c | 22 ++++++++++++++++++++++
e-util/e-spell-dictionary.h | 1 +
3 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/doc/reference/libeutil/libeutil-sections.txt b/doc/reference/libeutil/libeutil-sections.txt
index c9dd113..8924d90 100644
--- a/doc/reference/libeutil/libeutil-sections.txt
+++ b/doc/reference/libeutil/libeutil-sections.txt
@@ -3682,6 +3682,7 @@ ESpellCheckerPrivate
<TITLE>ESpellDictionary</TITLE>
ESpellDictionary
e_spell_dictionary_new
+e_spell_dictionary_hash
e_spell_dictionary_get_name
e_spell_dictionary_get_code
e_spell_dictionary_check
diff --git a/e-util/e-spell-dictionary.c b/e-util/e-spell-dictionary.c
index 2760366..a5d3e37 100644
--- a/e-util/e-spell-dictionary.c
+++ b/e-util/e-spell-dictionary.c
@@ -481,6 +481,28 @@ e_spell_dictionary_new (ESpellChecker *parent_checker,
}
/**
+ * e_spell_dictionary_hash:
+ * @dictionary: an #ESpellDictionary
+ *
+ * Generates a hash value for @dictionary based on its ISO code.
+ * This function is intended for easily hashing an #ESpellDictionary
+ * to add to a #GHashTable or similar data structure.
+ *
+ * Returns: a hash value for @dictionary
+ **/
+guint
+e_spell_dictionary_hash (ESpellDictionary *dictionary)
+{
+ const gchar *code;
+
+ g_return_val_if_fail (E_IS_SPELL_DICTIONARY (dictionary), 0);
+
+ code = e_spell_dictionary_get_code (dictionary);
+
+ return g_str_hash (code);
+}
+
+/**
* e_spell_dictionary_get_name:
* @dictionary: an #ESpellDictionary
*
diff --git a/e-util/e-spell-dictionary.h b/e-util/e-spell-dictionary.h
index bd28c3a..141637d 100644
--- a/e-util/e-spell-dictionary.h
+++ b/e-util/e-spell-dictionary.h
@@ -65,6 +65,7 @@ GType e_spell_dictionary_get_type (void) G_GNUC_CONST;
ESpellDictionary *
e_spell_dictionary_new (ESpellChecker *parent_checker,
EnchantDict *enchant_dict);
+guint e_spell_dictionary_hash (ESpellDictionary *dictionary);
const gchar * e_spell_dictionary_get_name (ESpellDictionary *dictionary);
const gchar * e_spell_dictionary_get_code (ESpellDictionary *dictionary);
gboolean e_spell_dictionary_check (ESpellDictionary *dictionary,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]