diff options
author | Peng Wu <alexepico@gmail.com> | 2016-05-11 15:50:01 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2016-05-11 15:50:01 +0800 |
commit | f76adc9bdd2235166819494f14d689dbcbc911ae (patch) | |
tree | f87c7b05569e84483f30af05d9f1afb1234fe0e5 /src/storage/phonetic_key_matrix.h | |
parent | 7c43d981edce11bdd17b7e6e43f50af4680554aa (diff) | |
download | libpinyin-f76adc9bdd2235166819494f14d689dbcbc911ae.tar.gz libpinyin-f76adc9bdd2235166819494f14d689dbcbc911ae.tar.xz libpinyin-f76adc9bdd2235166819494f14d689dbcbc911ae.zip |
write dump_phonetic_key_matrix function
Diffstat (limited to 'src/storage/phonetic_key_matrix.h')
-rw-r--r-- | src/storage/phonetic_key_matrix.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/storage/phonetic_key_matrix.h b/src/storage/phonetic_key_matrix.h index 7fc194c..8ad885b 100644 --- a/src/storage/phonetic_key_matrix.h +++ b/src/storage/phonetic_key_matrix.h @@ -22,6 +22,7 @@ #ifndef PHONETIC_KEY_MATRIX_H #define PHONETIC_KEY_MATRIX_H +#include <assert.h> #include "novel_types.h" #include "chewing_key.h" @@ -45,6 +46,10 @@ public: return true; } + bool size() { + return m_table_content->len; + } + /* when call this function, reserve one extra slot for the end slot. */ bool set_size(size_t size) { @@ -94,6 +99,11 @@ public: return m_keys.clear_all() && m_key_rests.clear_all(); } + bool size() { + assert(m_keys.size() == m_key_rests.size()); + return m_keys.size(); + } + /* reserve one extra slot, same as PhoneticTable. */ bool set_size(size_t size) { return m_keys.set_size(size) && m_key_rests.set_size(size); @@ -117,6 +127,8 @@ bool fill_phonetic_key_matrix_from_chewing_keys(PhoneticKeyMatrix * matrix, ChewingKeyVector keys, ChewingKeyRestVector key_rests); +bool dump_phonetic_key_matrix(PhoneticKeyMatrix * matrix); + }; #endif |