diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2004-02-04 12:09:03 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2004-02-04 12:09:03 +0000 |
commit | cf9e966328778065dcdb1c21d1057ed034a378bb (patch) | |
tree | 65d4e700d9e9d195dcee8340da1ba84d834596c1 /lingucomponent/source | |
parent | 36c631c9d429493ef1d82974b5db55249b275003 (diff) |
INTEGRATION: CWS ooo20031216 (1.1.2); FILE ADDED
2003/12/10 14:27:02 khendricks 1.1.2.1: Issue number: None
Submitted by: Kevin B. Hendricks
Reviewed by: project owner (me)
adding in the new thesaurus implementation that removes all of the
old hardcoded limits and problems with the old thesaurus
Kevin
Diffstat (limited to 'lingucomponent/source')
-rw-r--r-- | lingucomponent/source/thesaurus/mythes/mythes.hxx | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/lingucomponent/source/thesaurus/mythes/mythes.hxx b/lingucomponent/source/thesaurus/mythes/mythes.hxx new file mode 100644 index 000000000000..3eebeda36393 --- /dev/null +++ b/lingucomponent/source/thesaurus/mythes/mythes.hxx @@ -0,0 +1,67 @@ +#ifndef _MYTHES_HXX_ +#define _MYTHES_HXX_ + +// some maximum sizes for buffers +#define MAX_WD_LEN 200 +#define MAX_LN_LEN 16384 + + +// a meaning with definition, count of synonyms and synonym list +struct mentry { + char* defn; + int count; + char** psyns; +}; + + +class MyThes +{ + + int nw; /* number of entries in thesaurus */ + char** list; /* stores word list */ + unsigned int* offst; /* stores offset list */ + char * encoding; /* stores text encoding; */ + + FILE *pdfile; + + // disallow copy-constructor and assignment-operator for now + MyThes(); + MyThes(const MyThes &); + MyThes & operator = (const MyThes &); + +public: + MyThes(const char* idxpath, const char* datpath); + ~MyThes(); + + // lookup text in index and return number of meanings + // each meaning entry has a defintion, synonym count and pointer + // when complete return the *original* meaning entry and count via + // CleanUpAfterLookup to properly handle memory deallocation + + int Lookup(const char * pText, int len, mentry** pme); + + void CleanUpAfterLookup(mentry** pme, int nmean); + + char* get_th_encoding(); + +private: + // Open index and dat files and load list array + int thInitialize (const char* indxpath, const char* datpath); + + // internal close and cleanup dat and idx files + int thCleanup (); + + // read a text line (\n terminated) stripping off line terminator + int readLine(FILE * pf, char * buf, int nc); + + // binary search on null terminated character strings + int binsearch(char * wrd, char* list[], int nlst); + +}; + +#endif + + + + + |