OSDN Git Service

Create TortoiseGitBlame
[tortoisegit/TortoiseGitJp.git] / ext / hunspell / mythes.hxx
1 #ifndef _MYTHES_HXX_\r
2 #define _MYTHES_HXX_\r
3 \r
4 // some maximum sizes for buffers\r
5 #define MAX_WD_LEN 200\r
6 #define MAX_LN_LEN 16384\r
7 \r
8 \r
9 // a meaning with definition, count of synonyms and synonym list\r
10 struct mentry {\r
11   char*  defn;\r
12   int  count;\r
13   char** psyns;\r
14 };\r
15 \r
16 \r
17 class MyThes\r
18 {\r
19 \r
20        int  nw;                  /* number of entries in thesaurus */\r
21        char**  list;               /* stores word list */\r
22        unsigned int* offst;              /* stores offset list */\r
23        char *  encoding;           /* stores text encoding; */\r
24  \r
25         FILE  *pdfile;\r
26 \r
27         // disallow copy-constructor and assignment-operator for now\r
28         MyThes();\r
29         MyThes(const MyThes &);\r
30         MyThes & operator = (const MyThes &);\r
31 \r
32 public:\r
33         MyThes(const char* idxpath, const char* datpath);\r
34         ~MyThes();\r
35 \r
36         // lookup text in index and return number of meanings\r
37         // each meaning entry has a defintion, synonym count and pointer \r
38         // when complete return the *original* meaning entry and count via \r
39         // CleanUpAfterLookup to properly handle memory deallocation\r
40 \r
41         int Lookup(const char * pText, int len, mentry** pme); \r
42 \r
43         void CleanUpAfterLookup(mentry** pme, int nmean);\r
44 \r
45         char* get_th_encoding(); \r
46 \r
47 private:\r
48         // Open index and dat files and load list array\r
49         int thInitialize (const char* indxpath, const char* datpath);\r
50         \r
51         // internal close and cleanup dat and idx files\r
52         int thCleanup ();\r
53 \r
54         // read a text line (\n terminated) stripping off line terminator\r
55         int readLine(FILE * pf, char * buf, int nc);\r
56 \r
57         // binary search on null terminated character strings\r
58         int binsearch(char * wrd, char* list[], int nlst);\r
59 \r
60         // string duplication routine\r
61         char * mystrdup(const char * p);\r
62 \r
63         // remove cross-platform text line end characters\r
64         void mychomp(char * s);\r
65 \r
66         // return index of char in string\r
67         int mystr_indexOfChar(const char * d, int c);\r
68 \r
69 };\r
70 \r
71 #endif\r
72 \r
73 \r
74 \r
75 \r
76 \r