Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
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 *******/
58 #ifndef _AFFIX_HXX_
59 #define _AFFIX_HXX_
61 #include "hunvisapi.h"
63 #include "atypes.hxx"
64 #include "baseaffix.hxx"
65 #include "affixmgr.hxx"
67 /* A Prefix Entry */
69 class LIBHUNSPELL_DLL_EXPORTED PfxEntry : protected AffEntry
70 {
71 AffixMgr* pmyMgr;
73 PfxEntry * next;
74 PfxEntry * nexteq;
75 PfxEntry * nextne;
76 PfxEntry * flgnxt;
78 public:
80 PfxEntry(AffixMgr* pmgr, affentry* dp );
81 ~PfxEntry();
83 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);
87 struct hentry * check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = FLAG_NULL);
89 char * check_morph(const char * word, int len, char in_compound,
90 const FLAG needflag = FLAG_NULL);
92 char * check_twosfx_morph(const char * word, int len,
93 char in_compound, const FLAG needflag = FLAG_NULL);
95 inline FLAG getFlag() { return aflag; }
96 inline const char * getKey() { return appnd; }
97 char * add(const char * word, int len);
99 inline short getKeyLen() { return appndl; }
101 inline const char * getMorph() { return morphcode; }
103 inline const unsigned short * getCont() { return contclass; }
104 inline short getContLen() { return contclasslen; }
106 inline PfxEntry * getNext() { return next; }
107 inline PfxEntry * getNextNE() { return nextne; }
108 inline PfxEntry * getNextEQ() { return nexteq; }
109 inline PfxEntry * getFlgNxt() { return flgnxt; }
111 inline void setNext(PfxEntry * ptr) { next = ptr; }
112 inline void setNextNE(PfxEntry * ptr) { nextne = ptr; }
113 inline void setNextEQ(PfxEntry * ptr) { nexteq = ptr; }
114 inline void setFlgNxt(PfxEntry * ptr) { flgnxt = ptr; }
116 inline char * nextchar(char * p);
117 inline int test_condition(const char * st);
118 };
123 /* A Suffix Entry */
125 class LIBHUNSPELL_DLL_EXPORTED SfxEntry : protected AffEntry
126 {
127 AffixMgr* pmyMgr;
128 char * rappnd;
130 SfxEntry * next;
131 SfxEntry * nexteq;
132 SfxEntry * nextne;
133 SfxEntry * flgnxt;
135 SfxEntry * l_morph;
136 SfxEntry * r_morph;
137 SfxEntry * eq_morph;
139 public:
141 SfxEntry(AffixMgr* pmgr, affentry* dp );
142 ~SfxEntry();
144 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);
150 struct hentry * check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = FLAG_NULL);
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);
159 inline FLAG getFlag() { return aflag; }
160 inline const char * getKey() { return rappnd; }
161 char * add(const char * word, int len);
164 inline const char * getMorph() { return morphcode; }
166 inline const unsigned short * getCont() { return contclass; }
167 inline short getContLen() { return contclasslen; }
168 inline const char * getAffix() { return appnd; }
170 inline short getKeyLen() { return appndl; }
172 inline SfxEntry * getNext() { return next; }
173 inline SfxEntry * getNextNE() { return nextne; }
174 inline SfxEntry * getNextEQ() { return nexteq; }
176 inline SfxEntry * getLM() { return l_morph; }
177 inline SfxEntry * getRM() { return r_morph; }
178 inline SfxEntry * getEQM() { return eq_morph; }
179 inline SfxEntry * getFlgNxt() { return flgnxt; }
181 inline void setNext(SfxEntry * ptr) { next = ptr; }
182 inline void setNextNE(SfxEntry * ptr) { nextne = ptr; }
183 inline void setNextEQ(SfxEntry * ptr) { nexteq = ptr; }
184 inline void setFlgNxt(SfxEntry * ptr) { flgnxt = ptr; }
186 inline char * nextchar(char * p);
187 inline int test_condition(const char * st, const char * begin);
189 };
191 #endif