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 _EnchantBroker EnchantBroker;
42 typedef struct _EnchantDict 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 
80 EnchantDict *enchant_broker_request_dict_with_pwl (EnchantBroker * broker, const char *const tag, const char *pwl);
81 
92 EnchantDict *enchant_broker_request_pwl_dict (EnchantBroker * broker, const char *const pwl);
93 
101 void enchant_broker_free_dict (EnchantBroker * broker, EnchantDict * dict);
102 
110 int enchant_broker_dict_exists (EnchantBroker * broker, const char * const tag);
111 
124 void enchant_broker_set_ordering (EnchantBroker * broker,
125  const char * const tag,
126  const char * const ordering);
136 const char *enchant_broker_get_error (EnchantBroker * broker);
137 
147 typedef void (*EnchantBrokerDescribeFn) (const char * const provider_name,
148  const char * const provider_desc,
149  const char * const provider_dll_file,
150  void * user_data);
151 
161 void enchant_broker_describe (EnchantBroker * broker,
162  EnchantBrokerDescribeFn fn,
163  void * user_data);
164 
176 int enchant_dict_check (EnchantDict * dict, const char *const word, ssize_t len);
177 
190 char **enchant_dict_suggest (EnchantDict * dict, const char *const word,
191  ssize_t len, size_t * out_n_suggs);
192 
202 void enchant_dict_add (EnchantDict * dict, const char *const word, ssize_t len);
203 
211 void enchant_dict_add_to_session (EnchantDict * dict, const char *const word, ssize_t len);
212 
222 void enchant_dict_remove (EnchantDict * dict, const char *const word, ssize_t len);
223 
231 void enchant_dict_remove_from_session (EnchantDict * dict, const char *const word, ssize_t len);
232 
239 int enchant_dict_is_added (EnchantDict * dict, const char *const word, ssize_t len);
240 
247 int enchant_dict_is_removed (EnchantDict * dict, const char *const word, ssize_t len);
248 
259 void enchant_dict_store_replacement (EnchantDict * dict,
260  const char *const mis, ssize_t mis_len,
261  const char *const cor, ssize_t cor_len);
262 
270 void enchant_dict_free_string_list (EnchantDict * dict, char **string_list);
271 
281 const char *enchant_dict_get_error (EnchantDict * dict);
282 
297 const char *enchant_dict_get_extra_word_characters (EnchantDict * dict);
298 
319 int enchant_dict_is_word_character (EnchantDict * dict, uint32_t uc, size_t n);
320 
331 typedef void (*EnchantDictDescribeFn) (const char * const lang_tag,
332  const char * const provider_name,
333  const char * const provider_desc,
334  const char * const provider_file,
335  void * user_data);
336 
345 void enchant_dict_describe (EnchantDict * dict,
346  EnchantDictDescribeFn fn,
347  void * user_data);
348 
358 void enchant_broker_list_dicts (EnchantBroker * broker,
359  EnchantDictDescribeFn fn,
360  void * user_data);
361 
370 void enchant_set_prefix_dir(const char *);
371 
372 #ifdef __cplusplus
373 }
374 #endif
375 
376 #endif /* ENCHANT_H */
Definition: broker.c:127
Definition: broker.c:176