Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.4 KiB

  1. //////////////////////////////////////////////////
  2. // Copyright (C) 1997, Microsoft Corporation. All Rights Reserved.
  3. //
  4. // File : DICTTYPE.HPP
  5. // Project : project SIK
  6. //////////////////////////////////////////////////
  7. #if !defined __DICTTYPE_HPP
  8. #define __DICTTYPE_HPP 1
  9. class Dict
  10. {
  11. public:
  12. virtual int FindWord(char *w, char &action, char *index) = 0; //For just abstract base class
  13. };
  14. //////////////////////////////////////////////////////////////////////
  15. //////////////////////////////////////////////////////////////////////
  16. class LenDict
  17. {
  18. HGLOBAL hDict;
  19. char *dict; int BUCKETSIZE; int WORDNUM;
  20. public:
  21. LenDict() {}
  22. LenDict(char *tempdict, int bsize, int wordnum) {
  23. InitLenDict (tempdict, bsize, wordnum);
  24. }
  25. void InitLenDict(char *tempdict, int bsize, int wordnum) {
  26. dict = tempdict;
  27. BUCKETSIZE = bsize;
  28. WORDNUM = wordnum;
  29. }
  30. int FindWord(char *stem, int &ulspos, int startindex = 0) ;
  31. void RestWord(char *stem, int &ulspos, int restindex) ;
  32. private:
  33. inline int __IsDefStem(int ulspos, int num)
  34. { return ((ulspos-num) >= 0) ? 1 : 0; }
  35. inline void __DelStemN(char *stem, int &ulspos, int num)
  36. { stem[ulspos-num+1] = 0; ulspos -= num; }
  37. };
  38. #endif