From bb539e9cbdc4d5fe951c3ee5c7dc1d8c71f00f77 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Thu, 5 May 2016 14:08:00 +0800 Subject: update phonetic_key_matrix.h --- src/storage/phonetic_key_matrix.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src/storage') 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 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 m_keys; + PhoneticTable 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 -- cgit