diff options
author | Peng Wu <alexepico@gmail.com> | 2016-01-21 13:29:19 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2016-01-21 13:29:19 +0800 |
commit | a7526ca001e88457c290547bd42315bd4bb876be (patch) | |
tree | 8f63aaa3cf207f249f9a7d1f9d1efa60721b8c86 /src/storage | |
parent | 9b3aad3a507b98bbccad3b37f97b7a9213ca7655 (diff) | |
download | libpinyin-a7526ca001e88457c290547bd42315bd4bb876be.tar.gz libpinyin-a7526ca001e88457c290547bd42315bd4bb876be.tar.xz libpinyin-a7526ca001e88457c290547bd42315bd4bb876be.zip |
declare class PhraseTableEntry
Diffstat (limited to 'src/storage')
-rw-r--r-- | src/storage/phrase_large_table3.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
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){ |