diff options
author | Peng Wu <alexepico@gmail.com> | 2011-12-05 14:19:20 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2011-12-05 14:21:34 +0800 |
commit | 9cf00098f4628fb9797bb14963686384d406883b (patch) | |
tree | b806e21a5651ba4d3a6f81f1325fcd318b656b1d /src/storage | |
parent | 8ff7710aabb59538eb0b9b87c865d7aac5413032 (diff) | |
download | libpinyin-9cf00098f4628fb9797bb14963686384d406883b.tar.gz libpinyin-9cf00098f4628fb9797bb14963686384d406883b.tar.xz libpinyin-9cf00098f4628fb9797bb14963686384d406883b.zip |
add const modifiers
Diffstat (limited to 'src/storage')
-rw-r--r-- | src/storage/ngram.cpp | 9 | ||||
-rw-r--r-- | src/storage/ngram.h | 8 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/storage/ngram.cpp b/src/storage/ngram.cpp index 66cdc56..86c12fe 100644 --- a/src/storage/ngram.cpp +++ b/src/storage/ngram.cpp @@ -83,7 +83,8 @@ static bool token_less_than(const SingleGramItem & lhs,const SingleGramItem & rh return lhs.m_token < rhs.m_token; } -bool SingleGram::retrieve_all(/* out */ BigramPhraseWithCountArray array){ +bool SingleGram::retrieve_all(/* out */ BigramPhraseWithCountArray array) + const { const SingleGramItem * begin = (const SingleGramItem *) ((const char *)(m_chunk.begin()) + sizeof(guint32)); const SingleGramItem * end = (const SingleGramItem *) m_chunk.end(); @@ -102,8 +103,8 @@ bool SingleGram::retrieve_all(/* out */ BigramPhraseWithCountArray array){ return true; } -bool SingleGram::search(/* in */ PhraseIndexRange * range, - /* out */ BigramPhraseArray array){ +bool SingleGram::search(/* in */ PhraseIndexRange * range, + /* out */ BigramPhraseArray array) const { const SingleGramItem * begin = (const SingleGramItem *) ((const char *)(m_chunk.begin()) + sizeof(guint32)); const SingleGramItem * end = (const SingleGramItem *)m_chunk.end(); @@ -181,7 +182,7 @@ bool SingleGram::remove_freq( /* in */ phrase_token_t token, } bool SingleGram::get_freq(/* in */ phrase_token_t token, - /* out */ guint32 & freq){ + /* out */ guint32 & freq) const { freq = 0; const SingleGramItem * begin = (const SingleGramItem *) ((const char *)(m_chunk.begin()) + sizeof(guint32)); diff --git a/src/storage/ngram.h b/src/storage/ngram.h index 8863392..73e422a 100644 --- a/src/storage/ngram.h +++ b/src/storage/ngram.h @@ -52,12 +52,12 @@ public: /* Null Constructor */ SingleGram(); /* retrieve all items */ - bool retrieve_all(/* out */ BigramPhraseWithCountArray array); + bool retrieve_all(/* out */ BigramPhraseWithCountArray array) const; /* search method */ /* the array result contains many items */ - bool search(/* in */ PhraseIndexRange * range, - /* out */ BigramPhraseArray array); + bool search(/* in */ PhraseIndexRange * range, + /* out */ BigramPhraseArray array) const; /* insert_freq method */ @@ -72,7 +72,7 @@ public: /* get_freq method */ bool get_freq(/* in */ phrase_token_t token, - /* out */ guint32 & freq); + /* out */ guint32 & freq) const; /* set_freq method */ |