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