summaryrefslogtreecommitdiffstats
path: root/src/storage/phrase_index.h
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-08-10 12:58:13 +0800
committerPeng Wu <alexepico@gmail.com>2011-08-10 12:58:13 +0800
commitec332e5bcac3af0520803813a48ae4ee93c5713c (patch)
tree068d85466e66028d97033e6bc343342e0731c249 /src/storage/phrase_index.h
parente4fa0bfd58813a248674bd41b5dcf61e9be3bdeb (diff)
downloadlibpinyin-ec332e5bcac3af0520803813a48ae4ee93c5713c.tar.gz
libpinyin-ec332e5bcac3af0520803813a48ae4ee93c5713c.tar.xz
libpinyin-ec332e5bcac3af0520803813a48ae4ee93c5713c.zip
write phrase index logger format in progress
Diffstat (limited to 'src/storage/phrase_index.h')
-rw-r--r--src/storage/phrase_index.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/storage/phrase_index.h b/src/storage/phrase_index.h
index f2648e8..d853aee 100644
--- a/src/storage/phrase_index.h
+++ b/src/storage/phrase_index.h
@@ -67,10 +67,12 @@ public:
memset(m_chunk.begin(), 0, m_chunk.size());
}
- PhraseItem(MemoryChunk chunk){
- m_chunk = chunk;
- assert ( m_chunk.size() >= phrase_item_header);
+#if 0
+ PhraseItem(MemoryChunk & chunk){
+ m_chunk.set_content(0, chunk->begin(), chunk->size());
+ assert ( m_chunk.size() >= phrase_item_header);
}
+#endif
/* functions */
guint8 get_phrase_length(){
@@ -134,6 +136,17 @@ public:
*/
void append_pronunciation(PinyinKey * pinyin, guint32 freq);
void remove_nth_pronunciation(size_t index);
+
+ bool operator == (PhraseItem & rhs){
+ if (m_chunk.size() != rhs.m_chunk.size())
+ return false;
+ return memcmp(m_chunk.begin(), rhs.m_chunk.begin(),
+ m_chunk.size()) == 0;
+ }
+
+ bool operator != (PhraseItem & rhs){
+ return ! (*this == rhs);
+ }
};
/*