1 : /******* BEGIN LICENSE BLOCK *******
2 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 : *
4 : * The contents of this file are subject to the Mozilla Public License Version
5 : * 1.1 (the "License"); you may not use this file except in compliance with
6 : * the License. You may obtain a copy of the License at
7 : * http://www.mozilla.org/MPL/
8 : *
9 : * Software distributed under the License is distributed on an "AS IS" basis,
10 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 : * for the specific language governing rights and limitations under the
12 : * License.
13 : *
14 : * The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
15 : * and László Németh (Hunspell). Portions created by the Initial Developers
16 : * are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
17 : *
18 : * Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
19 : * David Einstein (deinst@world.std.com)
20 : * László Németh (nemethl@gyorsposta.hu)
21 : * Caolan McNamara (caolanm@redhat.com)
22 : * Davide Prina
23 : * Giuseppe Modugno
24 : * Gianluca Turconi
25 : * Simon Brouwer
26 : * Noll Janos
27 : * Biro Arpad
28 : * Goldman Eleonora
29 : * Sarlos Tamas
30 : * Bencsath Boldizsar
31 : * Halacsy Peter
32 : * Dvornik Laszlo
33 : * Gefferth Andras
34 : * Nagy Viktor
35 : * Varga Daniel
36 : * Chris Halls
37 : * Rene Engelhard
38 : * Bram Moolenaar
39 : * Dafydd Jones
40 : * Harri Pitkanen
41 : * Andras Timar
42 : * Tor Lillqvist
43 : *
44 : * Alternatively, the contents of this file may be used under the terms of
45 : * either the GNU General Public License Version 2 or later (the "GPL"), or
46 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
47 : * in which case the provisions of the GPL or the LGPL are applicable instead
48 : * of those above. If you wish to allow use of your version of this file only
49 : * under the terms of either the GPL or the LGPL, and not to allow others to
50 : * use your version of this file under the terms of the MPL, indicate your
51 : * decision by deleting the provisions above and replace them with the notice
52 : * and other provisions required by the GPL or the LGPL. If you do not delete
53 : * the provisions above, a recipient may use your version of this file under
54 : * the terms of any one of the MPL, the GPL or the LGPL.
55 : *
56 : ******* END LICENSE BLOCK *******/
57 :
58 : #ifndef _AFFIX_HXX_
59 : #define _AFFIX_HXX_
60 :
61 : #include "hunvisapi.h"
62 :
63 : #include "atypes.hxx"
64 : #include "baseaffix.hxx"
65 : #include "affixmgr.hxx"
66 :
67 : /* A Prefix Entry */
68 :
69 : class LIBHUNSPELL_DLL_EXPORTED PfxEntry : protected AffEntry
70 : {
71 : AffixMgr* pmyMgr;
72 :
73 : PfxEntry * next;
74 : PfxEntry * nexteq;
75 : PfxEntry * nextne;
76 : PfxEntry * flgnxt;
77 :
78 : public:
79 :
80 : PfxEntry(AffixMgr* pmgr, affentry* dp );
81 : ~PfxEntry();
82 :
83 0 : inline bool allowCross() { return ((opts & aeXPRODUCT) != 0); }
84 : struct hentry * checkword(const char * word, int len, char in_compound,
85 : const FLAG needflag = FLAG_NULL);
86 :
87 : struct hentry * check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = NULL);
88 :
89 : char * check_morph(const char * word, int len, char in_compound,
90 : const FLAG needflag = FLAG_NULL);
91 :
92 : char * check_twosfx_morph(const char * word, int len,
93 : char in_compound, const FLAG needflag = FLAG_NULL);
94 :
95 465 : inline FLAG getFlag() { return aflag; }
96 3033 : inline const char * getKey() { return appnd; }
97 : char * add(const char * word, int len);
98 :
99 0 : inline short getKeyLen() { return appndl; }
100 :
101 0 : inline const char * getMorph() { return morphcode; }
102 :
103 7131 : inline const unsigned short * getCont() { return contclass; }
104 3519 : inline short getContLen() { return contclasslen; }
105 :
106 947 : inline PfxEntry * getNext() { return next; }
107 462 : inline PfxEntry * getNextNE() { return nextne; }
108 2108 : inline PfxEntry * getNextEQ() { return nexteq; }
109 0 : inline PfxEntry * getFlgNxt() { return flgnxt; }
110 :
111 144 : inline void setNext(PfxEntry * ptr) { next = ptr; }
112 328 : inline void setNextNE(PfxEntry * ptr) { nextne = ptr; }
113 295 : inline void setNextEQ(PfxEntry * ptr) { nexteq = ptr; }
114 144 : inline void setFlgNxt(PfxEntry * ptr) { flgnxt = ptr; }
115 :
116 : inline char * nextchar(char * p);
117 : inline int test_condition(const char * st);
118 : };
119 :
120 :
121 :
122 :
123 : /* A Suffix Entry */
124 :
125 : class LIBHUNSPELL_DLL_EXPORTED SfxEntry : protected AffEntry
126 : {
127 : AffixMgr* pmyMgr;
128 : char * rappnd;
129 :
130 : SfxEntry * next;
131 : SfxEntry * nexteq;
132 : SfxEntry * nextne;
133 : SfxEntry * flgnxt;
134 :
135 : SfxEntry * l_morph;
136 : SfxEntry * r_morph;
137 : SfxEntry * eq_morph;
138 :
139 : public:
140 :
141 : SfxEntry(AffixMgr* pmgr, affentry* dp );
142 : ~SfxEntry();
143 :
144 0 : inline bool allowCross() { return ((opts & aeXPRODUCT) != 0); }
145 : struct hentry * checkword(const char * word, int len, int optflags,
146 : PfxEntry* ppfx, char ** wlst, int maxSug, int * ns,
147 : // const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, char in_compound=IN_CPD_NOT);
148 : const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, const FLAG badflag = 0);
149 :
150 : struct hentry * check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = NULL);
151 :
152 : char * check_twosfx_morph(const char * word, int len, int optflags,
153 : PfxEntry* ppfx, const FLAG needflag = FLAG_NULL);
154 : struct hentry * get_next_homonym(struct hentry * he);
155 : struct hentry * get_next_homonym(struct hentry * word, int optflags, PfxEntry* ppfx,
156 : const FLAG cclass, const FLAG needflag);
157 :
158 :
159 1696 : inline FLAG getFlag() { return aflag; }
160 3604 : inline const char * getKey() { return rappnd; }
161 : char * add(const char * word, int len);
162 :
163 :
164 0 : inline const char * getMorph() { return morphcode; }
165 :
166 48872 : inline const unsigned short * getCont() { return contclass; }
167 24069 : inline short getContLen() { return contclasslen; }
168 0 : inline const char * getAffix() { return appnd; }
169 :
170 0 : inline short getKeyLen() { return appndl; }
171 :
172 16082 : inline SfxEntry * getNext() { return next; }
173 456 : inline SfxEntry * getNextNE() { return nextne; }
174 1347 : inline SfxEntry * getNextEQ() { return nexteq; }
175 :
176 : inline SfxEntry * getLM() { return l_morph; }
177 : inline SfxEntry * getRM() { return r_morph; }
178 : inline SfxEntry * getEQM() { return eq_morph; }
179 0 : inline SfxEntry * getFlgNxt() { return flgnxt; }
180 :
181 283 : inline void setNext(SfxEntry * ptr) { next = ptr; }
182 670 : inline void setNextNE(SfxEntry * ptr) { nextne = ptr; }
183 739 : inline void setNextEQ(SfxEntry * ptr) { nexteq = ptr; }
184 283 : inline void setFlgNxt(SfxEntry * ptr) { flgnxt = ptr; }
185 :
186 : inline char * nextchar(char * p);
187 : inline int test_condition(const char * st, const char * begin);
188 :
189 : };
190 :
191 : #endif
192 :
193 :
|