summaryrefslogtreecommitdiffstats
path: root/src/storage/phonetic_key_matrix.h
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-05-05 14:08:00 +0800
committerPeng Wu <alexepico@gmail.com>2016-05-05 14:08:00 +0800
commitbb539e9cbdc4d5fe951c3ee5c7dc1d8c71f00f77 (patch)
treedb7041b41d83820b5b127a53a610912fdcb3491e /src/storage/phonetic_key_matrix.h
parent8a86d87ed0247ea5fd041702c12f2980818cdd98 (diff)
downloadlibpinyin-bb539e9cbdc4d5fe951c3ee5c7dc1d8c71f00f77.tar.gz
libpinyin-bb539e9cbdc4d5fe951c3ee5c7dc1d8c71f00f77.tar.xz
libpinyin-bb539e9cbdc4d5fe951c3ee5c7dc1d8c71f00f77.zip
update phonetic_key_matrix.h
Diffstat (limited to 'src/storage/phonetic_key_matrix.h')
-rw-r--r--src/storage/phonetic_key_matrix.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/storage/phonetic_key_matrix.h b/src/storage/phonetic_key_matrix.h
index 99c6bc6..f2ff3d2 100644
--- a/src/storage/phonetic_key_matrix.h
+++ b/src/storage/phonetic_key_matrix.h
@@ -22,8 +22,46 @@
#ifndef PHONETIC_KEY_MATRIX_H
#define PHONETIC_KEY_MATRIX_H
+namespace pinyin {
+
template<struct Item>
class PhoneticTable {
+protected:
+ /* Pointer Array of Array of Item. */
+ GPtrArray * m_table_content;
+
+public:
+ bool clear_all();
+
+ /* when call this function,
+ reserve one extra slot for the end slot. */
+ bool set_size(size_t size);
+
+ /* Array of Item. */
+ bool get_items(size_t index, GArray * items);
+
+ bool append(size_t index, Item item);
+
+};
+
+class PhoneticKeyMatrix {
+protected:
+ PhoneticTable<ChewingKey> m_keys;
+ PhoneticTable<ChewingKeyRest> m_key_rests;
+
+public:
+ bool clear_all();
+
+ /* reserve one extra slot, same as PhoneticTable. */
+ bool set_size(size_t size);
+
+ /* Array of keys and key rests. */
+ bool get_column(size_t index, GArray * keys, GArray * key_rests);
+
+ bool append(size_t index, ChewingKey & key, ChewingKeyRest & key_rest);
+
+};
+
};
#endif