From 44396d5f6e5fb6901fd482d2e217d7f5cf097a7f Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Tue, 4 Sep 2012 10:47:18 +0800 Subject: add clear_ranges/clear_tokens back --- src/storage/phrase_index.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src') 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 @@ -669,6 +669,24 @@ public: return true; } + /** + * 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. @@ -710,6 +728,24 @@ public: return true; } + /** + * 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. -- cgit