From: Peng Wu Date: Tue, 4 Sep 2012 02:47:18 +0000 (+0800) Subject: add clear_ranges/clear_tokens back X-Git-Tag: 0.7.91~37 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=44396d5f6e5fb6901fd482d2e217d7f5cf097a7f;p=platform%2Fupstream%2Flibpinyin.git add clear_ranges/clear_tokens back --- 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.