• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdespell2
 

tdespell2

  • tdespell2
  • plugins
  • ispell
ispell_checker.h
1/* tdespell2 - adopted from Enchant
2 * Copyright (C) 2003 Dom Lachowicz
3 * Copyright (C) 2004 Zack Rusin <zack@kde.org>
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
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 *
20 * In addition, as a special exception, Dom Lachowicz
21 * gives permission to link the code of this program with
22 * non-LGPL Spelling Provider libraries (eg: a MSFT Office
23 * spell checker backend) and distribute linked combinations including
24 * the two. You must obey the GNU Lesser General Public License in all
25 * respects for all of the code used other than said providers. If you modify
26 * this file, you may extend this exception to your version of the
27 * file, but you are not obligated to do so. If you do not wish to
28 * do so, delete this exception statement from your version.
29 */
30
31#ifndef ISPELL_CHECKER_H
32#define ISPELL_CHECKER_H
33
34#include "ispell.h"
35
36#include <tqstringlist.h>
37#include <tqvaluelist.h>
38#include <tqtextcodec.h>
39#include <tqstring.h>
40
41
42class ISpellChecker
43{
44public:
45 ISpellChecker();
46 ~ISpellChecker();
47
48 bool checkWord(const TQString& word);
49 TQStringList suggestWord(const TQString& word);
50
51 bool requestDictionary (const char * szLang);
52 static TQValueList<TQString> allDics();
53private:
54 ISpellChecker(const ISpellChecker&); // no impl
55 void operator=(const ISpellChecker&); // no impl
56
57 TQString loadDictionary (const char * szLang );
58 bool loadDictionaryForLanguage ( const char * szLang );
59 void setDictionaryEncoding ( const TQString& hashname, const char * enc );
60
61 //
62 // The member functions after this point were formerly global functions
63 // passed a context structure pointer...
64 //
65
66 void try_autodetect_charset(const char * inEncoding);
67
68 //
69 // From ispell correct.c
70 //
71
72 int casecmp P ((char * a, char * b, int canonical));
73 void makepossibilities P ((ichar_t * word));
74 int insert P ((ichar_t * word));
75#ifndef NO_CAPITALIZATION_SUPPORT
76 void wrongcapital P ((ichar_t * word));
77#endif /* NO_CAPITALIZATION_SUPPORT */
78 void wrongletter P ((ichar_t * word));
79 void extraletter P ((ichar_t * word));
80 void missingletter P ((ichar_t * word));
81 void missingspace P ((ichar_t * word));
82 int compoundgood P ((ichar_t * word, int pfxopts));
83 void transposedletter P ((ichar_t * word));
84 int ins_cap P ((ichar_t * word, ichar_t * pattern));
85 int save_cap P ((ichar_t * word, ichar_t * pattern,
86 ichar_t savearea[MAX_CAPS][INPUTWORDLEN + MAXAFFIXLEN]));
87 int ins_root_cap P ((ichar_t * word, ichar_t * pattern,
88 int prestrip, int preadd, int sufstrip, int sufadd,
89 struct dent * firstdent, struct flagent * pfxent,
90 struct flagent * sufent));
91 void save_root_cap P ((ichar_t * word, ichar_t * pattern,
92 int prestrip, int preadd, int sufstrip, int sufadd,
93 struct dent * firstdent, struct flagent * pfxent,
94 struct flagent * sufent,
95 ichar_t savearea[MAX_CAPS][INPUTWORDLEN + MAXAFFIXLEN],
96 int * nsaved));
97
98 //
99 // From ispell good.c
100 //
101
102 int good (ichar_t* w, int ignoreflagbits, int allhits, int pfxopts, int sfxopts);
103 void chk_aff (ichar_t* word, ichar_t* ucword, int len, int ignoreflagbits, int allhits, int pfxopts, int sfxopts);
104 int linit(char*);
105 struct dent * ispell_lookup (ichar_t* s, int dotree);
106 int strtoichar (ichar_t* out, char* in, int outlen, int canonical);
107 int ichartostr (char* out, ichar_t* in, int outlen, int canonical);
108 char * ichartosstr (ichar_t* in, int canonical);
109 int findfiletype (const char * name, int searchnames, int * deformatter);
110 long whatcap (ichar_t* word);
111
112 /*
113 HACK: macros replaced with function implementations
114 so we could do a side-effect-free check for unicode
115 characters which aren't in hashheader
116 */
117 char myupper(ichar_t c);
118 char mylower(ichar_t c);
119 int myspace(ichar_t c);
120 char iswordch(ichar_t c);
121 char isboundarych(ichar_t c);
122 char isstringstart(ichar_t c);
123 ichar_t mytolower(ichar_t c);
124 ichar_t mytoupper(ichar_t c);
125
126#ifndef ICHAR_IS_CHAR
127 int cap_ok (ichar_t* word, struct success* hit, int len);
128
129 int hash (ichar_t* s, int hashtblsize);
130#endif
131
132 //
133 // From ispell lookup.c
134 //
135
136 void clearindex P ((struct flagptr * indexp));
137 void initckch P ((char *));
138
139 void alloc_ispell_struct();
140 void free_ispell_struct();
141
142 //
143 // From ispell makedent.c
144 //
145
146 int addvheader P ((struct dent * ent));
147 void upcase P ((ichar_t * string));
148 void lowcase P ((ichar_t * string));
149 void chupcase P ((char * s));
150
151 int stringcharlen P ((char * bufp, int canonical));
152 ichar_t * strtosichar P ((char * in, int canonical));
153 char * printichar P ((int in));
154
155 //
156 // From ispell tgood.c
157 //
158
159 void pfx_list_chk P ((ichar_t * word, ichar_t * ucword,
160 int len, int optflags, int sfxopts, struct flagptr * ind,
161 int ignoreflagbits, int allhits));
162 void chk_suf P ((ichar_t * word, ichar_t * ucword, int len,
163 int optflags, struct flagent * pfxent, int ignoreflagbits,
164 int allhits));
165 void suf_list_chk P ((ichar_t * word, ichar_t * ucword, int len,
166 struct flagptr * ind, int optflags, struct flagent * pfxent,
167 int ignoreflagbits, int allhits));
168 int expand_pre P ((char * croot, ichar_t * rootword,
169 MASKTYPE mask[], int option, char * extra));
170 int pr_pre_expansion P ((char * croot, ichar_t * rootword,
171 struct flagent * flent, MASKTYPE mask[], int option,
172 char * extra));
173 int expand_suf P ((char * croot, ichar_t * rootword,
174 MASKTYPE mask[], int optflags, int option, char * extra));
175 int pr_suf_expansion P ((char * croot, ichar_t * rootword,
176 struct flagent * flent, int option, char * extra));
177 void forcelc P ((ichar_t * dst, int len));
178
179 /* this is used for converting form unsigned short to UCS-4 */
180
181 int deftflag; /* NZ for TeX mode by default */
182 int prefstringchar; /* Preferred string character type */
183 bool m_bSuccessfulInit;
184
185 //
186 // The members after this point were formerly global variables
187 // in the original ispell code
188 //
189
190 char * m_BC; /* backspace if not ^H */
191 char * m_cd; /* clear to end of display */
192 char * m_cl; /* clear display */
193 char * m_cm; /* cursor movement */
194 char * m_ho; /* home */
195 char * m_nd; /* non-destructive space */
196 char * m_so; /* standout */
197 char * m_se; /* standout end */
198 int m_sg; /* space taken by so/se */
199 char * m_ti; /* terminal initialization sequence */
200 char * m_te; /* terminal termination sequence */
201 int m_li; /* lines */
202 int m_co; /* columns */
203
204 char m_ctoken[INPUTWORDLEN + MAXAFFIXLEN]; /* Current token as char */
205 ichar_t m_itoken[INPUTWORDLEN + MAXAFFIXLEN]; /* Ctoken as ichar_t str */
206
207 int m_numhits; /* number of hits in dictionary lookups */
208 struct success
209 m_hits[MAX_HITS]; /* table of hits gotten in lookup */
210
211 char * m_hashstrings; /* Strings in hash table */
212 struct hashheader
213 m_hashheader; /* Header of hash table */
214 struct dent *
215 m_hashtbl; /* Main hash table, for dictionary */
216 int m_hashsize; /* Size of main hash table */
217
218 char m_hashname[MAXPATHLEN]; /* Name of hash table file */
219
220 int m_aflag; /* NZ if -a or -A option specified */
221 int m_cflag; /* NZ if -c (crunch) option */
222 int m_lflag; /* NZ if -l (list) option */
223 int m_incfileflag; /* whether xgets() acts exactly like gets() */
224 int m_nodictflag; /* NZ if dictionary not needed */
225
226 int m_uerasechar; /* User's erase character, from stty */
227 int m_ukillchar; /* User's kill character */
228
229 unsigned int m_laststringch; /* Number of last string character */
230 int m_defdupchar; /* Default duplicate string type */
231
232 int m_numpflags; /* Number of prefix flags in table */
233 int m_numsflags; /* Number of suffix flags in table */
234 struct flagptr m_pflagindex[SET_SIZE + MAXSTRINGCHARS];
235 /* Fast index to pflaglist */
236 struct flagent * m_pflaglist; /* Prefix flag control list */
237 struct flagptr m_sflagindex[SET_SIZE + MAXSTRINGCHARS];
238 /* Fast index to sflaglist */
239 struct flagent * m_sflaglist; /* Suffix flag control list */
240
241 struct strchartype * /* String character type collection */
242 m_chartypes;
243
244 FILE * m_infile; /* File being corrected */
245 FILE * m_outfile; /* Corrected copy of infile */
246
247 char * m_askfilename; /* File specified in -f option */
248
249 int m_changes; /* NZ if changes made to cur. file */
250 int m_readonly; /* NZ if current file is readonly */
251 int m_quit; /* NZ if we're done with this file */
252
253#define MAXPOSSIBLE 100 /* Max no. of possibilities to generate */
254
255 char m_possibilities[MAXPOSSIBLE][INPUTWORDLEN + MAXAFFIXLEN];
256 /* Table of possible corrections */
257 int m_pcount; /* Count of possibilities generated */
258 int m_maxposslen; /* Length of longest possibility */
259 int m_easypossibilities; /* Number of "easy" corrections found */
260 /* ..(defined as those using legal affixes) */
261
262 /*
263 * The following array contains a list of characters that should be tried
264 * in "missingletter." Note that lowercase characters are omitted.
265 */
266 int m_Trynum; /* Size of "Try" array */
267 ichar_t m_Try[SET_SIZE + MAXSTRINGCHARS];
268
269 TQTextCodec *m_translate_in; /* Selected translation from/to Unicode */
270};
271
272#endif /* ISPELL_CHECKER_H */

tdespell2

Skip menu "tdespell2"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

tdespell2

Skip menu "tdespell2"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdespell2 by doxygen 1.9.4
This website is maintained by Timothy Pearson.