add clear_ranges/clear_tokens back
authorPeng Wu <alexepico@gmail.com>
Tue, 4 Sep 2012 02:47:18 +0000 (10:47 +0800)
committerPeng Wu <alexepico@gmail.com>
Tue, 4 Sep 2012 02:47:18 +0000 (10:47 +0800)
src/storage/phrase_index.h

index d661952..acc7c4a 100644 (file)
@@ -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.