diff options
-rw-r--r-- | src/include/novel_types.h | 3 | ||||
-rw-r--r-- | src/storage/phrase_large_table3.cpp | 29 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/include/novel_types.h b/src/include/novel_types.h index fcb801e..2d309a1 100644 --- a/src/include/novel_types.h +++ b/src/include/novel_types.h @@ -125,8 +125,11 @@ const phrase_token_t token_min = 0; const phrase_token_t token_max = UINT_MAX; const char c_separate = '#'; + typedef guint32 table_offset_t; +typedef guint32 table_entry_header_t; + typedef double parameter_t; /* Array of ChewingKey/ChewingKeyRest */ diff --git a/src/storage/phrase_large_table3.cpp b/src/storage/phrase_large_table3.cpp index 12632ae..07c5e70 100644 --- a/src/storage/phrase_large_table3.cpp +++ b/src/storage/phrase_large_table3.cpp @@ -23,6 +23,35 @@ namespace pinyin{ +/** + * Data Structure: + * m_chunk consists of table entry header and array of tokens. + */ + +class PhraseTableEntry{ + friend class PhraseLargeTable3; +protected: + MemoryChunk m_chunk; + +private: + /* Disallow used outside. */ + PhraseTableEntry() {} + +public: + /* search method */ + int search(/* in */ const ucs4_t phrase[], /* out */ PhraseTokens tokens) const; + + /* add_index/remove_index method */ + int add_index(/* in */ const ucs4_t phrase[], /* in */ phrase_token_t token); + int remove_index(/* in */ const ucs4_t phrase[], /* in */ phrase_token_t token); + + /* get length method */ + int get_length() const; + + /* mask out method */ + bool mask_out(phrase_token_t mask, phrase_token_t value); +}; + /* load text method */ bool PhraseLargeTable3::load_text(FILE * infile){ |