summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-05-15 14:02:59 +0800
committerPeng Wu <alexepico@gmail.com>2012-05-15 14:02:59 +0800
commit26fa8c335d695379d139cd524d59482bdca7daba (patch)
treec1d0b8d3718f081e8452b8dd59976acf7aa72a43
parent78ec3a2063b88db368d41a7411c794bbc48a035c (diff)
downloadlibpinyin-26fa8c335d695379d139cd524d59482bdca7daba.tar.gz
libpinyin-26fa8c335d695379d139cd524d59482bdca7daba.tar.xz
libpinyin-26fa8c335d695379d139cd524d59482bdca7daba.zip
add methods to FacadePhraseIndex
-rw-r--r--src/storage/phrase_index.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/storage/phrase_index.h b/src/storage/phrase_index.h
index de38180..d7b8747 100644
--- a/src/storage/phrase_index.h
+++ b/src/storage/phrase_index.h
@@ -650,6 +650,43 @@ public:
return result;
}
+ /**
+ * FacadePhraseIndex::prepare_ranges:
+ * @ranges: the ranges to be prepared.
+ * @returns: whether the prepare operation is successful.
+ *
+ * Prepare the ranges.
+ *
+ */
+ bool prepare_ranges(PhraseIndexRanges ranges) {
+ for (size_t i = 0; i < PHRASE_INDEX_LIBRARY_COUNT; ++i) {
+ SubPhraseIndex * sub_phrase = m_sub_phrase_indices[i];
+ if (sub_phrase) {
+ GArray * & onerange = ranges[i];
+ onerange = g_array_new(FALSE, FALSE, sizeof(PhraseIndexRange));
+ }
+ }
+ return true;
+ }
+
+ /**
+ * FacadePhraseIndex::destroy_ranges:
+ * @ranges: the ranges to be destroyed.
+ * @returns: whether the destroy operation is successful.
+ *
+ * Destroy the ranges.
+ *
+ */
+ bool destroy_ranges(PhraseIndexRanges ranges) {
+ for (size_t i = 0; i < PHRASE_INDEX_LIBRARY_COUNT; ++i) {
+ GArray * & onerange = ranges[i];
+ if (onerange) {
+ g_array_free(onerange, TRUE);
+ onerange = NULL;
+ }
+ }
+ return true;
+ }
};
};