Enchant
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 <stddef.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
42 
52 char *enchant_get_user_language(void);
53 
65 char *enchant_get_user_config_dir (void);
66 
75 char *enchant_get_user_dict_dir (EnchantProvider * provider);
76 
90 GSList *enchant_get_conf_dirs (void);
91 
102 char *enchant_get_prefix_dir(void);
103 
112 char *enchant_relocate (const char *path);
113 
122 void enchant_dict_set_error (EnchantDict * dict, const char * const err);
123 
132 void enchant_provider_set_error (EnchantProvider * provider, const char * const err);
133 
135 {
136  void *user_data;
137  void *enchant_private_data;
138 
139  int (*check) (struct str_enchant_dict * me, const char *const word,
140  size_t len);
141 
142  /* returns utf8*/
143  char **(*suggest) (struct str_enchant_dict * me,
144  const char *const word, size_t len,
145  size_t * out_n_suggs);
146 
147  void (*add_to_session) (struct str_enchant_dict * me,
148  const char *const word, size_t len);
149 
150  void (*remove_from_session) (struct str_enchant_dict * me,
151  const char *const word, size_t len);
152 
153  const char * (*get_extra_word_characters) (struct str_enchant_dict * me);
154 
155  int (*is_word_character) (struct str_enchant_dict * me,
156  uint32_t uc_in, size_t n);
157 };
158 
160 {
161  void *user_data;
162  void *enchant_private_data;
163  EnchantBroker * owner;
164 
165  void (*dispose) (struct str_enchant_provider * me);
166 
167  EnchantDict *(*request_dict) (struct str_enchant_provider * me,
168  const char *const tag);
169 
170  void (*dispose_dict) (struct str_enchant_provider * me,
171  EnchantDict * dict);
172 
173  int (*dictionary_exists) (struct str_enchant_provider * me,
174  const char *const tag);
175 
176  /* returns utf8*/
177  const char * (*identify) (struct str_enchant_provider * me);
178  /* returns utf8*/
179  const char * (*describe) (struct str_enchant_provider * me);
180 
181  char ** (*list_dicts) (struct str_enchant_provider * me,
182  size_t * out_n_dicts);
183 };
184 
185 #ifdef __cplusplus
186 }
187 #endif
188 
189 #endif /* ENCHANT_PROVIDER_H */
Definition: lib.c:55
Definition: enchant-provider.h:135
Definition: enchant-provider.h:160