1 #ifndef _HASHMGR_HXX_ 2 #define _HASHMGR_HXX_ 3 4 #include "hunvisapi.h" 5 6 #include <stdio.h> 7 8 #include "htypes.hxx" 9 #include "filemgr.hxx" 10 11 enum flag { FLAG_CHAR, FLAG_LONG, FLAG_NUM, FLAG_UNI }; 12 13 class LIBHUNSPELL_DLL_EXPORTED HashMgr 14 { 15 int tablesize; 16 struct hentry ** tableptr; 17 int userword; 18 flag flag_mode; 19 int complexprefixes; 20 int utf8; 21 unsigned short forbiddenword; 22 int langnum; 23 char * enc; 24 char * lang; 25 struct cs_info * csconv; 26 char * ignorechars; 27 unsigned short * ignorechars_utf16; 28 int ignorechars_utf16_len; 29 int numaliasf; // flag vector `compression' with aliases 30 unsigned short ** aliasf; 31 unsigned short * aliasflen; 32 int numaliasm; // morphological desciption `compression' with aliases 33 char ** aliasm; 34 35 36 public: 37 HashMgr(const char * tpath, const char * apath, const char * key = NULL); 38 ~HashMgr(); 39 40 struct hentry * lookup(const char *) const; 41 int hash(const char *) const; 42 struct hentry * walk_hashtable(int & col, struct hentry * hp) const; 43 44 int add(const char * word); 45 int add_with_affix(const char * word, const char * pattern); 46 int remove(const char * word); 47 int decode_flags(unsigned short ** result, char * flags, FileMgr * af); 48 unsigned short decode_flag(const char * flag); 49 char * encode_flag(unsigned short flag); 50 int is_aliasf(); 51 int get_aliasf(int index, unsigned short ** fvec, FileMgr * af); 52 int is_aliasm(); 53 char * get_aliasm(int index); 54 55 private: 56 int get_clen_and_captype(const char * word, int wbl, int * captype); 57 int load_tables(const char * tpath, const char * key); 58 int add_word(const char * word, int wbl, int wcl, unsigned short * ap, 59 int al, const char * desc, bool onlyupcase); 60 int load_config(const char * affpath, const char * key); 61 int parse_aliasf(char * line, FileMgr * af); 62 int add_hidden_capitalized_word(char * word, int wbl, int wcl, 63 unsigned short * flags, int al, char * dp, int captype); 64 int parse_aliasm(char * line, FileMgr * af); 65 int remove_forbidden_flag(const char * word); 66 67 }; 68 69 #endif 70