Enchant: lib/enchant-provider.h Source File

Enchant 2.7.3 Generic spell checking library

enchant-provider.h
1 /* enchant
2 * Copyright (C) 2003 Dom Lachowicz
3 * Copyright (C) 2017-2024 Reuben Thomas
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 License
16 * along along with this program; if not, see
17 * <https://www.gnu.org/licenses/>.
18 *
19 * In addition, as a special exception, the copyright holders
20 * give permission to link the code of this program with
21 * non-LGPL Spelling Provider libraries (eg: a MSFT Office
22 * spell checker backend) and distribute linked combinations including
23 * the two. You must obey the GNU Lesser General Public License in all
24 * respects for all of the code used other than said providers. If you modify
25 * this file, you may extend this exception to your version of the
26 * file, but you are not obligated to do so. If you do not wish to
27 * do so, delete this exception statement from your version.
28 */
29
30 #ifndef ENCHANT_PROVIDER_H
31 #define ENCHANT_PROVIDER_H
32
33 #include <enchant.h>
34 #include <glib.h>
35 #include <glib-object.h>
36 #include <stddef.h>
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 typedef struct _EnchantProvider EnchantProvider;
43
53 char *enchant_get_user_language(void);
54
66 char *enchant_get_user_config_dir (void);
67
76 char *enchant_provider_get_user_dict_dir (EnchantProvider * provider);
77
91 GSList *enchant_get_conf_dirs (void);
92
103 char *enchant_get_prefix_dir(void);
104
113 char *enchant_relocate (const char *path);
114
120 EnchantDict *enchant_broker_new_dict (EnchantBroker *broker);
121
130 void enchant_dict_set_error (EnchantDict * dict, const char * const err);
131
137 EnchantProvider *enchant_provider_new (void);
138
147 void enchant_provider_set_error (EnchantProvider * provider, const char * const err);
148
149 typedef struct _EnchantDictPrivate *EnchantDictPrivate;
150
151 struct _EnchantDict
152 {
153 GTypeInstance parent_instance;
154 volatile int ref_count;
155 EnchantDictPrivate * priv;
156 void *user_data;
157 void *enchant_private_data;
158
159 int (*check) (struct _EnchantDict * me, const char *const word,
160 size_t len);
161
162 /* returns utf8*/
163 char **(*suggest) (struct _EnchantDict * me,
164 const char *const word, size_t len,
165 size_t * out_n_suggs);
166
167 void (*add_to_session) (struct _EnchantDict * me,
168 const char *const word, size_t len);
169
170 void (*remove_from_session) (struct _EnchantDict * me,
171 const char *const word, size_t len);
172
173 const char * (*get_extra_word_characters) (struct _EnchantDict * me);
174
175 int (*is_word_character) (struct _EnchantDict * me,
176 uint32_t uc_in, size_t n);
177 };
178
179 typedef struct _EnchantProviderPrivate *EnchantProviderPrivate;
180
181 struct _EnchantProvider {
182 GTypeInstance parent_instance;
183 volatile int ref_count;
184 EnchantProviderPrivate * priv;
185 void* user_data;
186 void* enchant_private_data;
187 EnchantBroker* owner;
188
189 void (*dispose) (struct _EnchantProvider * me);
190
191 EnchantDict *(*request_dict) (struct _EnchantProvider * me,
192 const char *const tag);
193
194 void (*dispose_dict) (struct _EnchantProvider * me,
195 EnchantDict * dict);
196
197 int (*dictionary_exists) (struct _EnchantProvider * me,
198 const char *const tag);
199
200 /* returns utf8*/
201 const char * (*identify) (struct _EnchantProvider * me);
202 /* returns utf8*/
203 const char * (*describe) (struct _EnchantProvider * me);
204
205 char ** (*list_dicts) (struct _EnchantProvider * me,
206 size_t * out_n_dicts);
207 };
208
216 EnchantDict *composite_provider_create_dict (GSList *dicts);
217
218 #ifdef __cplusplus
219 }
220 #endif
221
222 #endif /* ENCHANT_PROVIDER_H */
enchant.h
_EnchantBroker
Definition: broker.c:147
_EnchantDict
Definition: broker.c:196
_EnchantProvider
Definition: broker.c:154