extensions/spellcheck/hunspell/src/affentry.hxx

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/extensions/spellcheck/hunspell/src/affentry.hxx	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,193 @@
     1.4 +/******* BEGIN LICENSE BLOCK *******
     1.5 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
     1.6 + * 
     1.7 + * The contents of this file are subject to the Mozilla Public License Version
     1.8 + * 1.1 (the "License"); you may not use this file except in compliance with
     1.9 + * the License. You may obtain a copy of the License at
    1.10 + * http://www.mozilla.org/MPL/
    1.11 + * 
    1.12 + * Software distributed under the License is distributed on an "AS IS" basis,
    1.13 + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    1.14 + * for the specific language governing rights and limitations under the
    1.15 + * License.
    1.16 + * 
    1.17 + * The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
    1.18 + * and László Németh (Hunspell). Portions created by the Initial Developers
    1.19 + * are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
    1.20 + * 
    1.21 + * Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
    1.22 + *                 David Einstein (deinst@world.std.com)
    1.23 + *                 László Németh (nemethl@gyorsposta.hu)
    1.24 + *                 Caolan McNamara (caolanm@redhat.com)
    1.25 + *                 Davide Prina
    1.26 + *                 Giuseppe Modugno
    1.27 + *                 Gianluca Turconi
    1.28 + *                 Simon Brouwer
    1.29 + *                 Noll Janos
    1.30 + *                 Biro Arpad
    1.31 + *                 Goldman Eleonora
    1.32 + *                 Sarlos Tamas
    1.33 + *                 Bencsath Boldizsar
    1.34 + *                 Halacsy Peter
    1.35 + *                 Dvornik Laszlo
    1.36 + *                 Gefferth Andras
    1.37 + *                 Nagy Viktor
    1.38 + *                 Varga Daniel
    1.39 + *                 Chris Halls
    1.40 + *                 Rene Engelhard
    1.41 + *                 Bram Moolenaar
    1.42 + *                 Dafydd Jones
    1.43 + *                 Harri Pitkanen
    1.44 + *                 Andras Timar
    1.45 + *                 Tor Lillqvist
    1.46 + * 
    1.47 + * Alternatively, the contents of this file may be used under the terms of
    1.48 + * either the GNU General Public License Version 2 or later (the "GPL"), or
    1.49 + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    1.50 + * in which case the provisions of the GPL or the LGPL are applicable instead
    1.51 + * of those above. If you wish to allow use of your version of this file only
    1.52 + * under the terms of either the GPL or the LGPL, and not to allow others to
    1.53 + * use your version of this file under the terms of the MPL, indicate your
    1.54 + * decision by deleting the provisions above and replace them with the notice
    1.55 + * and other provisions required by the GPL or the LGPL. If you do not delete
    1.56 + * the provisions above, a recipient may use your version of this file under
    1.57 + * the terms of any one of the MPL, the GPL or the LGPL.
    1.58 + *
    1.59 + ******* END LICENSE BLOCK *******/
    1.60 +
    1.61 +#ifndef _AFFIX_HXX_
    1.62 +#define _AFFIX_HXX_
    1.63 +
    1.64 +#include "hunvisapi.h"
    1.65 +
    1.66 +#include "atypes.hxx"
    1.67 +#include "baseaffix.hxx"
    1.68 +#include "affixmgr.hxx"
    1.69 +
    1.70 +/* A Prefix Entry  */
    1.71 +
    1.72 +class LIBHUNSPELL_DLL_EXPORTED PfxEntry : protected AffEntry
    1.73 +{
    1.74 +       AffixMgr*    pmyMgr;
    1.75 +
    1.76 +       PfxEntry * next;
    1.77 +       PfxEntry * nexteq;
    1.78 +       PfxEntry * nextne;
    1.79 +       PfxEntry * flgnxt;
    1.80 +
    1.81 +public:
    1.82 +
    1.83 +  PfxEntry(AffixMgr* pmgr, affentry* dp );
    1.84 +  ~PfxEntry();
    1.85 +
    1.86 +  inline bool          allowCross() { return ((opts & aeXPRODUCT) != 0); }
    1.87 +  struct hentry *      checkword(const char * word, int len, char in_compound, 
    1.88 +                            const FLAG needflag = FLAG_NULL);
    1.89 +
    1.90 +  struct hentry *      check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = FLAG_NULL);
    1.91 +
    1.92 +  char *      check_morph(const char * word, int len, char in_compound,
    1.93 +                            const FLAG needflag = FLAG_NULL);
    1.94 +
    1.95 +  char *      check_twosfx_morph(const char * word, int len,
    1.96 +                  char in_compound, const FLAG needflag = FLAG_NULL);
    1.97 +
    1.98 +  inline FLAG getFlag()   { return aflag;   }
    1.99 +  inline const char *  getKey()    { return appnd;  } 
   1.100 +  char *               add(const char * word, int len);
   1.101 +
   1.102 +  inline short getKeyLen() { return appndl; } 
   1.103 +
   1.104 +  inline const char *  getMorph()    { return morphcode;  } 
   1.105 +
   1.106 +  inline const unsigned short * getCont()    { return contclass;  } 
   1.107 +  inline short           getContLen()    { return contclasslen;  } 
   1.108 +
   1.109 +  inline PfxEntry *    getNext()   { return next;   }
   1.110 +  inline PfxEntry *    getNextNE() { return nextne; }
   1.111 +  inline PfxEntry *    getNextEQ() { return nexteq; }
   1.112 +  inline PfxEntry *    getFlgNxt() { return flgnxt; }
   1.113 +
   1.114 +  inline void   setNext(PfxEntry * ptr)   { next = ptr;   }
   1.115 +  inline void   setNextNE(PfxEntry * ptr) { nextne = ptr; }
   1.116 +  inline void   setNextEQ(PfxEntry * ptr) { nexteq = ptr; }
   1.117 +  inline void   setFlgNxt(PfxEntry * ptr) { flgnxt = ptr; }
   1.118 +  
   1.119 +  inline char * nextchar(char * p);
   1.120 +  inline int    test_condition(const char * st);
   1.121 +};
   1.122 +
   1.123 +
   1.124 +
   1.125 +
   1.126 +/* A Suffix Entry */
   1.127 +
   1.128 +class LIBHUNSPELL_DLL_EXPORTED SfxEntry : protected AffEntry
   1.129 +{
   1.130 +       AffixMgr*    pmyMgr;
   1.131 +       char *       rappnd;
   1.132 +
   1.133 +       SfxEntry *   next;
   1.134 +       SfxEntry *   nexteq;
   1.135 +       SfxEntry *   nextne;
   1.136 +       SfxEntry *   flgnxt;
   1.137 +           
   1.138 +       SfxEntry *   l_morph;
   1.139 +       SfxEntry *   r_morph;
   1.140 +       SfxEntry *   eq_morph;
   1.141 +
   1.142 +public:
   1.143 +
   1.144 +  SfxEntry(AffixMgr* pmgr, affentry* dp );
   1.145 +  ~SfxEntry();
   1.146 +
   1.147 +  inline bool          allowCross() { return ((opts & aeXPRODUCT) != 0); }
   1.148 +  struct hentry *   checkword(const char * word, int len, int optflags, 
   1.149 +                    PfxEntry* ppfx, char ** wlst, int maxSug, int * ns,
   1.150 +//                    const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, char in_compound=IN_CPD_NOT);
   1.151 +                    const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, const FLAG badflag = 0);
   1.152 +
   1.153 +  struct hentry *   check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = FLAG_NULL);
   1.154 +
   1.155 +  char *      check_twosfx_morph(const char * word, int len, int optflags,
   1.156 +                 PfxEntry* ppfx, const FLAG needflag = FLAG_NULL);
   1.157 +  struct hentry * get_next_homonym(struct hentry * he);
   1.158 +  struct hentry * get_next_homonym(struct hentry * word, int optflags, PfxEntry* ppfx, 
   1.159 +    const FLAG cclass, const FLAG needflag);
   1.160 +
   1.161 +
   1.162 +  inline FLAG getFlag()   { return aflag;   }
   1.163 +  inline const char *  getKey()    { return rappnd; } 
   1.164 +  char *               add(const char * word, int len);
   1.165 +
   1.166 +
   1.167 +  inline const char *  getMorph()    { return morphcode;  } 
   1.168 +
   1.169 +  inline const unsigned short * getCont()    { return contclass;  } 
   1.170 +  inline short           getContLen()    { return contclasslen;  } 
   1.171 +  inline const char *  getAffix()    { return appnd; } 
   1.172 +
   1.173 +  inline short getKeyLen() { return appndl; } 
   1.174 +
   1.175 +  inline SfxEntry *    getNext()   { return next;   }
   1.176 +  inline SfxEntry *    getNextNE() { return nextne; }
   1.177 +  inline SfxEntry *    getNextEQ() { return nexteq; }
   1.178 +
   1.179 +  inline SfxEntry *    getLM() { return l_morph; }
   1.180 +  inline SfxEntry *    getRM() { return r_morph; }
   1.181 +  inline SfxEntry *    getEQM() { return eq_morph; }
   1.182 +  inline SfxEntry *    getFlgNxt() { return flgnxt; }
   1.183 +
   1.184 +  inline void   setNext(SfxEntry * ptr)   { next = ptr;   }
   1.185 +  inline void   setNextNE(SfxEntry * ptr) { nextne = ptr; }
   1.186 +  inline void   setNextEQ(SfxEntry * ptr) { nexteq = ptr; }
   1.187 +  inline void   setFlgNxt(SfxEntry * ptr) { flgnxt = ptr; }
   1.188 +
   1.189 +  inline char * nextchar(char * p);
   1.190 +  inline int    test_condition(const char * st, const char * begin);
   1.191 +
   1.192 +};
   1.193 +
   1.194 +#endif
   1.195 +
   1.196 +

mercurial