Enchant: enchant-2.6.5/src/enchant-provider.h Source File

Enchant Generic spell checking library

enchant-provider.h
1 /* enchant
2 * Copyright (C) 2003 Dom Lachowicz
3 * Copyright (C) 2017-2021 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 <stddef.h>
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 typedef struct str_enchant_provider EnchantProvider;
42
52 char *enchant_get_user_language(void);
53
65 char *enchant_get_user_config_dir (void);
66
80 GSList *enchant_get_conf_dirs (void);
81
92 char *enchant_get_prefix_dir(void);
93
102 char *enchant_relocate (const char *path);
103
112 void enchant_dict_set_error (EnchantDict * dict, const char * const err);
113
122 void enchant_provider_set_error (EnchantProvider * provider, const char * const err);
123
124 struct str_enchant_dict
125 {
126 void *user_data;
127 void *enchant_private_data;
128
129 int (*check) (struct str_enchant_dict * me, const char *const word,
130 size_t len);
131
132 /* returns utf8*/
133 char **(*suggest) (struct str_enchant_dict * me,
134 const char *const word, size_t len,
135 size_t * out_n_suggs);
136
137 void (*add_to_session) (struct str_enchant_dict * me,
138 const char *const word, size_t len);
139
140 void (*remove_from_session) (struct str_enchant_dict * me,
141 const char *const word, size_t len);
142
143 const char * (*get_extra_word_characters) (struct str_enchant_dict * me);
144
145 int (*is_word_character) (struct str_enchant_dict * me,
146 uint32_t uc_in, size_t n);
147 };
148
149 struct str_enchant_provider
150 {
151 void *user_data;
152 void *enchant_private_data;
153 EnchantBroker * owner;
154
155 void (*dispose) (struct str_enchant_provider * me);
156
157 EnchantDict *(*request_dict) (struct str_enchant_provider * me,
158 const char *const tag);
159
160 void (*dispose_dict) (struct str_enchant_provider * me,
161 EnchantDict * dict);
162
163 int (*dictionary_exists) (struct str_enchant_provider * me,
164 const char *const tag);
165
166 /* returns utf8*/
167 const char * (*identify) (struct str_enchant_provider * me);
168 /* returns utf8*/
169 const char * (*describe) (struct str_enchant_provider * me);
170
171 char ** (*list_dicts) (struct str_enchant_provider * me,
172 size_t * out_n_dicts);
173 };
174
175 #ifdef __cplusplus
176 }
177 #endif
178
179 #endif /* ENCHANT_PROVIDER_H */
str_enchant_broker
Definition: lib.c:55
str_enchant_dict
Definition: enchant-provider.h:125
str_enchant_provider
Definition: enchant-provider.h:150