/extensions/spellcheck/hunspell/src/affentry.hxx

http://github.com/zpao/v8monkey · C++ Header · 193 lines · 89 code · 45 blank · 59 comment · 2 complexity · 1aa173e55cd4bbbc2a6ef8b1f955fce4 MD5 · raw file

  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. #ifndef _AFFIX_HXX_
  58. #define _AFFIX_HXX_
  59. #include "hunvisapi.h"
  60. #include "atypes.hxx"
  61. #include "baseaffix.hxx"
  62. #include "affixmgr.hxx"
  63. /* A Prefix Entry */
  64. class LIBHUNSPELL_DLL_EXPORTED PfxEntry : protected AffEntry
  65. {
  66. AffixMgr* pmyMgr;
  67. PfxEntry * next;
  68. PfxEntry * nexteq;
  69. PfxEntry * nextne;
  70. PfxEntry * flgnxt;
  71. public:
  72. PfxEntry(AffixMgr* pmgr, affentry* dp );
  73. ~PfxEntry();
  74. inline bool allowCross() { return ((opts & aeXPRODUCT) != 0); }
  75. struct hentry * checkword(const char * word, int len, char in_compound,
  76. const FLAG needflag = FLAG_NULL);
  77. struct hentry * check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = NULL);
  78. char * check_morph(const char * word, int len, char in_compound,
  79. const FLAG needflag = FLAG_NULL);
  80. char * check_twosfx_morph(const char * word, int len,
  81. char in_compound, const FLAG needflag = FLAG_NULL);
  82. inline FLAG getFlag() { return aflag; }
  83. inline const char * getKey() { return appnd; }
  84. char * add(const char * word, int len);
  85. inline short getKeyLen() { return appndl; }
  86. inline const char * getMorph() { return morphcode; }
  87. inline const unsigned short * getCont() { return contclass; }
  88. inline short getContLen() { return contclasslen; }
  89. inline PfxEntry * getNext() { return next; }
  90. inline PfxEntry * getNextNE() { return nextne; }
  91. inline PfxEntry * getNextEQ() { return nexteq; }
  92. inline PfxEntry * getFlgNxt() { return flgnxt; }
  93. inline void setNext(PfxEntry * ptr) { next = ptr; }
  94. inline void setNextNE(PfxEntry * ptr) { nextne = ptr; }
  95. inline void setNextEQ(PfxEntry * ptr) { nexteq = ptr; }
  96. inline void setFlgNxt(PfxEntry * ptr) { flgnxt = ptr; }
  97. inline char * nextchar(char * p);
  98. inline int test_condition(const char * st);
  99. };
  100. /* A Suffix Entry */
  101. class LIBHUNSPELL_DLL_EXPORTED SfxEntry : protected AffEntry
  102. {
  103. AffixMgr* pmyMgr;
  104. char * rappnd;
  105. SfxEntry * next;
  106. SfxEntry * nexteq;
  107. SfxEntry * nextne;
  108. SfxEntry * flgnxt;
  109. SfxEntry * l_morph;
  110. SfxEntry * r_morph;
  111. SfxEntry * eq_morph;
  112. public:
  113. SfxEntry(AffixMgr* pmgr, affentry* dp );
  114. ~SfxEntry();
  115. inline bool allowCross() { return ((opts & aeXPRODUCT) != 0); }
  116. struct hentry * checkword(const char * word, int len, int optflags,
  117. PfxEntry* ppfx, char ** wlst, int maxSug, int * ns,
  118. // const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, char in_compound=IN_CPD_NOT);
  119. const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, const FLAG badflag = 0);
  120. struct hentry * check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = NULL);
  121. char * check_twosfx_morph(const char * word, int len, int optflags,
  122. PfxEntry* ppfx, const FLAG needflag = FLAG_NULL);
  123. struct hentry * get_next_homonym(struct hentry * he);
  124. struct hentry * get_next_homonym(struct hentry * word, int optflags, PfxEntry* ppfx,
  125. const FLAG cclass, const FLAG needflag);
  126. inline FLAG getFlag() { return aflag; }
  127. inline const char * getKey() { return rappnd; }
  128. char * add(const char * word, int len);
  129. inline const char * getMorph() { return morphcode; }
  130. inline const unsigned short * getCont() { return contclass; }
  131. inline short getContLen() { return contclasslen; }
  132. inline const char * getAffix() { return appnd; }
  133. inline short getKeyLen() { return appndl; }
  134. inline SfxEntry * getNext() { return next; }
  135. inline SfxEntry * getNextNE() { return nextne; }
  136. inline SfxEntry * getNextEQ() { return nexteq; }
  137. inline SfxEntry * getLM() { return l_morph; }
  138. inline SfxEntry * getRM() { return r_morph; }
  139. inline SfxEntry * getEQM() { return eq_morph; }
  140. inline SfxEntry * getFlgNxt() { return flgnxt; }
  141. inline void setNext(SfxEntry * ptr) { next = ptr; }
  142. inline void setNextNE(SfxEntry * ptr) { nextne = ptr; }
  143. inline void setNextEQ(SfxEntry * ptr) { nexteq = ptr; }
  144. inline void setFlgNxt(SfxEntry * ptr) { flgnxt = ptr; }
  145. inline char * nextchar(char * p);
  146. inline int test_condition(const char * st, const char * begin);
  147. };
  148. #endif