summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-05-09 16:01:36 +0800
committerPeng Wu <alexepico@gmail.com>2016-05-09 16:01:36 +0800
commite0e33b0f6a137f8d358187a27819ba9e0267d55c (patch)
tree85de48114b151ea92a0a129ae0817511b39441aa
parent1b6ef8cab2bf04c1e29c212f31af8781cf3eb38e (diff)
downloadlibpinyin-e0e33b0f6a137f8d358187a27819ba9e0267d55c.tar.gz
libpinyin-e0e33b0f6a137f8d358187a27819ba9e0267d55c.tar.xz
libpinyin-e0e33b0f6a137f8d358187a27819ba9e0267d55c.zip
write class PhoneticKeyMatrix
-rw-r--r--src/storage/phonetic_key_matrix.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/storage/phonetic_key_matrix.h b/src/storage/phonetic_key_matrix.h
index 559c5d4..8125357 100644
--- a/src/storage/phonetic_key_matrix.h
+++ b/src/storage/phonetic_key_matrix.h
@@ -67,7 +67,7 @@ public:
return true;
}
- bool append(size_t index, Item item) {
+ bool append(size_t index, Item & item) {
if (index >= m_table_content->len)
return false;
@@ -83,15 +83,25 @@ protected:
PhoneticTable<ChewingKeyRest> m_key_rests;
public:
- bool clear_all();
+ bool clear_all() {
+ return m_keys.clear_all() && m_key_rests.clear_all();
+ }
/* reserve one extra slot, same as PhoneticTable. */
- bool set_size(size_t size);
+ bool set_size(size_t size) {
+ return m_keys.set_size(size) && m_key_rests.set_size(size);
+ }
/* Array of keys and key rests. */
- bool get_items(size_t index, GArray * keys, GArray * key_rests);
+ bool get_items(size_t index, GArray * keys, GArray * key_rests) {
+ return m_keys.get_items(index, keys) &&
+ m_key_rests.get_items(index, key_rests);
+ }
- bool append(size_t index, ChewingKey & key, ChewingKeyRest & key_rest);
+ bool append(size_t index, ChewingKey & key, ChewingKeyRest & key_rest) {
+ return m_keys.append(index, key) &&
+ m_key_rests.append(index, key_rest);
+ }
};