summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVidhoon Vishwanathan <vidhu2366@gmail.com>2013-07-20 13:47:40 +0000
committerVidhoon Vishwanathan <vidhu2366@gmail.com>2013-07-20 13:47:40 +0000
commit28d961fccc21e6d48073758d1d4998f1b025fccb (patch)
treee330be02d07e5dfb0044f1bd6afcd0533600dfbc
parentf84a83e8ae85efd11239d21bcacfe9924a1e0d02 (diff)
downloadenchant-28d961fccc21e6d48073758d1d4998f1b025fccb.tar.gz
[COMPDICT] Implement composite_provider_create_dict API
The composite_provider_create_dict method creates composite dictionary using a list of enchant dicts and maps all methods for dictionary operations. Signed-off-by: Vidhoon Viswanathan <vidhu2366@gmail.com> git-svn-id: svn+ssh://svn.abisource.com/svnroot/enchant/branches/gsoc2013cdict@33278 bcba8976-2d24-0410-9c9c-aab3bd5fdfd6
-rw-r--r--src/composite_provider.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/composite_provider.c b/src/composite_provider.c
index bc402ae..98b062d 100644
--- a/src/composite_provider.c
+++ b/src/composite_provider.c
@@ -72,9 +72,34 @@ composite_dict_store_replacement (EnchantDict * me,
{
}
+/**
+ * composite_provider_create_dict
+ * @list_of_dicts: A non-null list of #EnchantDicts
+ *
+ * Remarks: creates a composite dictionary that composes of EnchantDicts in @list_of_dicts
+ * and maps all methods to composite provider methods for dictionary operations.
+ */
EnchantDict *
composite_provider_create_dict (GSList* list_of_dicts)
{
+ EnchantDict *dict;
+ CompositeDict *comp_dict;
+
+ g_return_if_fail (list_of_dicts);
+
+ comp_dict = g_new0 (CompositeDict, 1);
+ comp_dict->dict_list = list_of_dicts;
+
+ dict = g_new0 (EnchantDict, 1);
+ dict->user_data = (void *) comp_dict;
+
+ dict->check = composite_dict_check;
+ dict->suggest = composite_dict_suggest;
+ dict->add_to_personal = composite_dict_add_to_personal;
+ dict->add_to_session = composite_dict_add_to_session;
+ dict->store_replacement = composite_dict_store_replacement;
+
+ return dict;
}
#ifdef __cplusplus