diff options
author | Peng Wu <alexepico@gmail.com> | 2012-09-04 10:47:18 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2012-09-04 10:47:18 +0800 |
commit | 44396d5f6e5fb6901fd482d2e217d7f5cf097a7f (patch) | |
tree | 758ad42c7292d7c682a89d2b82702199a96d5de7 /src | |
parent | 473bfc9ba3ffe72940570a7c6a1878a77ff45434 (diff) | |
download | libpinyin-44396d5f6e5fb6901fd482d2e217d7f5cf097a7f.tar.gz libpinyin-44396d5f6e5fb6901fd482d2e217d7f5cf097a7f.tar.xz libpinyin-44396d5f6e5fb6901fd482d2e217d7f5cf097a7f.zip |
add clear_ranges/clear_tokens back
Diffstat (limited to 'src')
-rw-r--r-- | src/storage/phrase_index.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/storage/phrase_index.h b/src/storage/phrase_index.h index d661952..acc7c4a 100644 --- a/src/storage/phrase_index.h +++ b/src/storage/phrase_index.h @@ -670,6 +670,24 @@ public: } /** + * FacadePhraseIndex::clear_ranges: + * @ranges: the ranges to be cleared. + * @returns: whether the clear operation is successful. + * + * Clear the ranges. + * + */ + bool clear_ranges(PhraseIndexRanges ranges) { + for (size_t i = 0; i < PHRASE_INDEX_LIBRARY_COUNT; ++i) { + GArray * range = ranges[i]; + if (range) { + g_array_set_size(range, 0); + } + } + return true; + } + + /** * FacadePhraseIndex::destroy_ranges: * @ranges: the ranges to be destroyed. * @returns: whether the destroy operation is successful. @@ -711,6 +729,24 @@ public: } /** + * FacadePhraseIndex::clear_tokens: + * @tokens: the tokens to be cleared. + * @return: whether the clear operation is successful. + * + * Clear the tokens. + * + */ + bool clear_tokens(PhraseTokens tokens) { + for (size_t i = 0; i < PHRASE_INDEX_LIBRARY_COUNT; ++i) { + GArray * token = tokens[i]; + if (token) { + g_array_set_size(token, 0); + } + } + return true; + } + + /** * FacadePhraseIndex::destroy_tokens: * @tokens: the tokens to be destroyed. * @returns: whether the destroy operation is successful. |