Tizen 2.1 base
[external/enchant.git] / src / enchant.h
1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* enchant
3  * Copyright (C) 2003 Dom Lachowicz
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02110-1301, USA.
19  *
20  * In addition, as a special exception, Dom Lachowicz
21  * gives permission to link the code of this program with
22  * non-LGPL Spelling Provider libraries (eg: a MSFT Office
23  * spell checker backend) and distribute linked combinations including
24  * the two.  You must obey the GNU Lesser General Public License in all
25  * respects for all of the code used other than said providers.  If you modify
26  * this file, you may extend this exception to your version of the
27  * file, but you are not obligated to do so.  If you do not wish to
28  * do so, delete this exception statement from your version.
29  */
30
31 #ifndef ENCHANT_H
32 #define ENCHANT_H
33
34 /* for size_t, ssize_t */
35 #include <sys/types.h>
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 #ifdef _WIN32
42 #ifdef _ENCHANT_BUILD
43 #define ENCHANT_MODULE_EXPORT(x) __declspec(dllexport) x
44 #else
45 #define ENCHANT_MODULE_EXPORT(x) __declspec(dllimport) x
46 #endif
47 #else
48 #define ENCHANT_MODULE_EXPORT(x) x
49 #endif
50
51 typedef struct str_enchant_broker EnchantBroker;
52 typedef struct str_enchant_dict   EnchantDict;
53
54 /* const */
55 ENCHANT_MODULE_EXPORT (char *)
56      enchant_get_version (void);
57
58 ENCHANT_MODULE_EXPORT (EnchantBroker *) 
59      enchant_broker_init (void);
60 ENCHANT_MODULE_EXPORT (void)
61      enchant_broker_free (EnchantBroker * broker);
62
63 ENCHANT_MODULE_EXPORT (EnchantDict *)
64      enchant_broker_request_dict (EnchantBroker * broker, const char *const tag);
65 ENCHANT_MODULE_EXPORT (EnchantDict *)
66      enchant_broker_request_pwl_dict (EnchantBroker * broker, const char *const pwl);
67 ENCHANT_MODULE_EXPORT (void)
68      enchant_broker_free_dict (EnchantBroker * broker, EnchantDict * dict);
69 ENCHANT_MODULE_EXPORT (int)
70      enchant_broker_dict_exists (EnchantBroker * broker,
71                                  const char * const tag);
72 ENCHANT_MODULE_EXPORT (void)
73      enchant_broker_set_ordering (EnchantBroker * broker,
74                                   const char * const tag,
75                                   const char * const ordering);
76 /* const */
77 ENCHANT_MODULE_EXPORT(char *)
78      enchant_broker_get_error (EnchantBroker * broker);
79
80 /* const */
81 ENCHANT_MODULE_EXPORT(char *)
82         enchant_broker_get_param (EnchantBroker * broker, const char * const param_name);
83 ENCHANT_MODULE_EXPORT(void)
84         enchant_broker_set_param (EnchantBroker * broker, const char * const param_name, const char * const param_value);
85
86 /**
87  * EnchantBrokerDescribeFn
88  * @provider_name: The provider's identifier, such as "ispell" or "aspell" in UTF8 encoding
89  * @provider_desc: A description of the provider, such as "Aspell 0.53" in UTF8 encoding
90  * @provider_dll_file: The provider's DLL filename in Glib file encoding (UTF8 on Windows)
91  * @user_data: Supplied user data, or %null if you don't care
92  *
93  * Callback used to enumerate and describe Enchant's various providers
94  */
95 typedef void (*EnchantBrokerDescribeFn) (const char * const provider_name,
96                                          const char * const provider_desc,
97                                          const char * const provider_dll_file,
98                                          void * user_data);
99         
100 ENCHANT_MODULE_EXPORT (void)
101      enchant_broker_describe (EnchantBroker * broker,
102                               EnchantBrokerDescribeFn fn,
103                               void * user_data);
104
105 ENCHANT_MODULE_EXPORT (int)
106      enchant_dict_check (EnchantDict * dict, const char *const word, ssize_t len);
107 ENCHANT_MODULE_EXPORT (char **)
108      enchant_dict_suggest (EnchantDict * dict, const char *const word,
109                            ssize_t len, size_t * out_n_suggs);
110 ENCHANT_MODULE_EXPORT (void)
111      enchant_dict_add (EnchantDict * dict, const char *const word,
112                               ssize_t len);
113 ENCHANT_MODULE_EXPORT (void)
114      enchant_dict_add_to_session (EnchantDict * dict, const char *const word,
115                                   ssize_t len);
116 ENCHANT_MODULE_EXPORT (void)
117      enchant_dict_remove (EnchantDict * dict, const char *const word,
118                               ssize_t len);
119 ENCHANT_MODULE_EXPORT (void)
120      enchant_dict_remove_from_session (EnchantDict * dict, const char *const word,
121                                   ssize_t len);
122 ENCHANT_MODULE_EXPORT (int)
123      enchant_dict_is_added (EnchantDict * dict, const char *const word,
124                                  ssize_t len);
125 ENCHANT_MODULE_EXPORT (int)
126      enchant_dict_is_removed (EnchantDict * dict, const char *const word,
127                                  ssize_t len);
128 ENCHANT_MODULE_EXPORT (void)
129      enchant_dict_store_replacement (EnchantDict * dict,
130                                      const char *const mis, ssize_t mis_len,
131                                      const char *const cor, ssize_t cor_len);
132 ENCHANT_MODULE_EXPORT (void)
133              enchant_dict_free_string_list (EnchantDict * dict, char **string_list);
134
135 #ifndef ENCHANT_DISABLE_DEPRECATED
136 ENCHANT_MODULE_EXPORT (void)
137      enchant_dict_free_suggestions (EnchantDict * dict, char **suggestions);
138 ENCHANT_MODULE_EXPORT (void)
139      enchant_dict_add_to_personal (EnchantDict * dict, const char *const word,
140                                    ssize_t len);
141 ENCHANT_MODULE_EXPORT (void)
142      enchant_dict_add_to_pwl (EnchantDict * dict, const char *const word,
143                               ssize_t len);
144 ENCHANT_MODULE_EXPORT (int)
145      enchant_dict_is_in_session (EnchantDict * dict, const char *const word,
146                                  ssize_t len);
147 #endif /* ENCHANT_DISABLE_DEPRECATED */
148
149 /* const */
150 ENCHANT_MODULE_EXPORT(char *)
151      enchant_dict_get_error (EnchantDict * dict);
152
153 /**
154  * EnchantDictDescribeFn
155  * @lang_tag: The dictionary's language tag (eg: en_US, de_AT, ...)
156  * @provider_name: The provider's name (eg: Aspell) in UTF8 encoding
157  * @provider_desc: The provider's description (eg: Aspell 0.50.3) in UTF8 encoding
158  * @provider_file: The DLL/SO where this dict's provider was loaded from in Glib file encoding (UTF8 on Windows)
159  * @user_data: Supplied user data, or %null if you don't care
160  *
161  * Callback used to describe an individual dictionary
162  */
163 typedef void (*EnchantDictDescribeFn) (const char * const lang_tag,
164                                        const char * const provider_name,
165                                        const char * const provider_desc,
166                                        const char * const provider_file,
167                                        void * user_data);
168
169 ENCHANT_MODULE_EXPORT (void)
170      enchant_dict_describe (EnchantDict * dict,
171                             EnchantDictDescribeFn fn,
172                             void * user_data);
173
174 ENCHANT_MODULE_EXPORT (void)
175      enchant_broker_list_dicts (EnchantBroker * broker,
176                                 EnchantDictDescribeFn fn,
177                                 void * user_data);
178
179 #ifdef __cplusplus
180 }
181 #endif
182
183 #endif /* ENCHANT_H */