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

Enchant Generic spell checking library

enchant.h
1 /* enchant
2 * Copyright (C) 2003 Dom Lachowicz
3 * Copyright (C) 2016-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_H
31 #define ENCHANT_H
32
33 #include <stdint.h> /* for uint32_t */
34 #include <sys/types.h> /* for size_t, ssize_t */
35
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 typedef struct str_enchant_broker EnchantBroker;
42 typedef struct str_enchant_dict EnchantDict;
43
44 const char *enchant_get_version (void);
45
52 EnchantBroker *enchant_broker_init (void);
53
60 void enchant_broker_free (EnchantBroker * broker);
61
70 EnchantDict *enchant_broker_request_dict (EnchantBroker * broker, const char *const tag);
71
81 EnchantDict *enchant_broker_request_dict_with_pwl (EnchantBroker * broker, const char *const tag, const char *pwl);
82
93 EnchantDict *enchant_broker_request_pwl_dict (EnchantBroker * broker, const char *const pwl);
94
102 void enchant_broker_free_dict (EnchantBroker * broker, EnchantDict * dict);
103
111 int enchant_broker_dict_exists (EnchantBroker * broker, const char * const tag);
112
125 void enchant_broker_set_ordering (EnchantBroker * broker,
126 const char * const tag,
127 const char * const ordering);
137 const char *enchant_broker_get_error (EnchantBroker * broker);
138
148 typedef void (*EnchantBrokerDescribeFn) (const char * const provider_name,
149 const char * const provider_desc,
150 const char * const provider_dll_file,
151 void * user_data);
152
162 void enchant_broker_describe (EnchantBroker * broker,
163 EnchantBrokerDescribeFn fn,
164 void * user_data);
165
177 int enchant_dict_check (EnchantDict * dict, const char *const word, ssize_t len);
178
191 char **enchant_dict_suggest (EnchantDict * dict, const char *const word,
192 ssize_t len, size_t * out_n_suggs);
193
203 void enchant_dict_add (EnchantDict * dict, const char *const word, ssize_t len);
204
212 void enchant_dict_add_to_session (EnchantDict * dict, const char *const word, ssize_t len);
213
223 void enchant_dict_remove (EnchantDict * dict, const char *const word, ssize_t len);
224
232 void enchant_dict_remove_from_session (EnchantDict * dict, const char *const word, ssize_t len);
233
240 int enchant_dict_is_added (EnchantDict * dict, const char *const word, ssize_t len);
241
248 int enchant_dict_is_removed (EnchantDict * dict, const char *const word, ssize_t len);
249
260 void enchant_dict_store_replacement (EnchantDict * dict,
261 const char *const mis, ssize_t mis_len,
262 const char *const cor, ssize_t cor_len);
263
271 void enchant_dict_free_string_list (EnchantDict * dict, char **string_list);
272
282 const char *enchant_dict_get_error (EnchantDict * dict);
283
298 const char *enchant_dict_get_extra_word_characters (EnchantDict * dict);
299
320 int enchant_dict_is_word_character (EnchantDict * dict, uint32_t uc, size_t n);
321
332 typedef void (*EnchantDictDescribeFn) (const char * const lang_tag,
333 const char * const provider_name,
334 const char * const provider_desc,
335 const char * const provider_file,
336 void * user_data);
337
346 void enchant_dict_describe (EnchantDict * dict,
347 EnchantDictDescribeFn fn,
348 void * user_data);
349
359 void enchant_broker_list_dicts (EnchantBroker * broker,
360 EnchantDictDescribeFn fn,
361 void * user_data);
362
371 void enchant_set_prefix_dir(const char *);
372
373 #ifdef __cplusplus
374 }
375 #endif
376
377 #endif /* ENCHANT_H */
str_enchant_broker
Definition: lib.c:55
str_enchant_dict
Definition: enchant-provider.h:125