Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef XAP_DICTIONARY_H
00022 #define XAP_DICTIONARY_H
00023
00024 #include <stdio.h>
00025
00026
00027
00028
00029
00030 #ifndef UT_TYPES_H
00031 #include "ut_types.h"
00032 #endif
00033 #include "ut_hash.h"
00034
00035
00036
00037
00038
00039
00040 class ABI_EXPORT XAP_Dictionary
00041 {
00042 public:
00043 XAP_Dictionary(const char * szFilename);
00044 ~XAP_Dictionary();
00045
00046 const char * getShortName(void) const;
00047
00048 bool load(void);
00049 bool save(void);
00050 UT_uint32 countCommonChars(UT_UCSChar * pszNeedle, UT_UCSChar *pszHaystack);
00051 void suggestWord(UT_GenericVector<UT_UCSChar *> * pVecSuggestions, const UT_UCSChar * pWord, UT_uint32 len);
00052 bool addWord(const char * pWord);
00053 bool addWord(const UT_UCSChar * pWord, UT_uint32 len);
00054 bool isWord(const UT_UCSChar * pWord, UT_uint32 len) const;
00055
00056 protected:
00057 bool _openFile(const char * mode);
00058 UT_uint32 _writeBytes(const UT_Byte * pBytes, UT_uint32 length);
00059 bool _writeBytes(const UT_Byte * sz);
00060 bool _closeFile(void);
00061 void _abortFile(void);
00062
00063 bool _parseUTF8(void);
00064 void _outputUTF8(const UT_UCSChar * data, UT_uint32 length);
00065
00066 char * m_szFilename;
00067
00068 bool m_bDirty;
00069 UT_GenericStringMap<UT_UCSChar *> m_hashWords;
00070
00071 private:
00072 FILE * m_fp;
00073 };
00074
00075
00076 #endif