diff options
author | Peng Wu <alexepico@gmail.com> | 2022-09-09 12:13:24 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2022-09-09 12:13:24 +0800 |
commit | 95d7370ba98e9a669206e1c4709dc62fa9357f72 (patch) | |
tree | 8c6eee62d78641e68cb4f3fe81a053b21a65dec0 | |
parent | 84221ba84701faccc7849becb5a5feca829f56d7 (diff) | |
download | libpinyin-95d7370ba98e9a669206e1c4709dc62fa9357f72.tar.gz |
Write FacadeChewingTable2::search_suggestion method
-rw-r--r-- | src/storage/facade_chewing_table2.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/storage/facade_chewing_table2.h b/src/storage/facade_chewing_table2.h index 1cf2a1f..0d22b5d 100644 --- a/src/storage/facade_chewing_table2.h +++ b/src/storage/facade_chewing_table2.h @@ -129,6 +129,32 @@ public: } /** + * FacadeChewingTable2::search_suggestion: + * @prefix_len: the length of the prefix to be searched. + * @prefix_keys: the pinyin key of the prefix to be searched. + * @tokens: the array of GArrays to store the matched prefix token. + * @returns: the search result of enum SearchResult. + * + * Search the phrase tokens according to the prefix pinyin keys. + * + */ + int search_suggestion(int prefix_len, + /* in */ const ChewingKey prefix_keys[], + /* out */ PhraseTokens tokens) const { + int result = SEARCH_NONE; + + if (NULL != m_system_chewing_table) + result |= m_system_chewing_table->search_suggestion + (prefix_len, prefix_keys, tokens); + + if (NULL != m_user_chewing_table) + result |= m_user_chewing_table->search_suggestion + (prefix_len, prefix_keys, tokens); + + return result; + } + + /** * FacadeChewingTable2::add_index: * @phrase_length: the length of the phrase to be added. * @keys: the pinyin keys of the phrase to be added. |