summaryrefslogtreecommitdiffstats
path: root/src/storage/chewing_large_table2.h
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-03-09 11:48:20 +0800
committerPeng Wu <alexepico@gmail.com>2016-03-09 11:48:20 +0800
commit270402c3e14b0a975da5e80e456befebdd85eced (patch)
treea0b07bf1b74acb68fb7fa58ba114ba62ecdd5815 /src/storage/chewing_large_table2.h
parent026f53bd34ba93050178b36fc4bdde2a7528b5cc (diff)
downloadlibpinyin-270402c3e14b0a975da5e80e456befebdd85eced.tar.gz
libpinyin-270402c3e14b0a975da5e80e456befebdd85eced.tar.xz
libpinyin-270402c3e14b0a975da5e80e456befebdd85eced.zip
add const modifiers
Diffstat (limited to 'src/storage/chewing_large_table2.h')
-rw-r--r--src/storage/chewing_large_table2.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/storage/chewing_large_table2.h b/src/storage/chewing_large_table2.h
index f612718..62d8e38 100644
--- a/src/storage/chewing_large_table2.h
+++ b/src/storage/chewing_large_table2.h
@@ -48,9 +48,6 @@ protected:
protected:
MemoryChunk m_chunk;
- /* The cache item of IndexItem. */
- IndexItem m_cache_item;
-
private:
/* Disallow used outside. */
ChewingTableEntry() {}
@@ -60,7 +57,7 @@ public:
/* compress consecutive tokens */
int convert(const ChewingKey keys[],
const IndexItem * begin, const IndexItem * end,
- PhraseIndexRanges ranges) {
+ PhraseIndexRanges ranges) const {
const IndexItem * iter = NULL;
PhraseIndexRange cursor;
GArray * head, * cursor_head = NULL;
@@ -104,14 +101,15 @@ public:
/* search method */
int search(/* in */ const ChewingKey keys[],
- /* out */ PhraseIndexRanges ranges) {
- compute_chewing_index(keys, m_cache_item.m_keys, phrase_length);
+ /* out */ PhraseIndexRanges ranges) const {
+ IndexItem item;
+ compute_chewing_index(keys, item.m_keys, phrase_length);
const IndexItem * begin = (IndexItem *) m_chunk.begin();
const IndexItem * end = (IndexItem *) m_chunk.end();
std_lite::pair<const IndexItem *, const IndexItem *> range =
- std_lite::equal_range(begin, end, m_cache_item,
+ std_lite::equal_range(begin, end, item,
phrase_less_than_with_tones<phrase_length>);
return convert(keys, range.first, range.second, ranges);