diff options
author | Peng Wu <alexepico@gmail.com> | 2013-03-21 09:49:21 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2013-03-21 09:49:21 +0800 |
commit | 1ac46fc96bbdbd1c15d3fd5b3057ae606999d933 (patch) | |
tree | 8d5db82a16d431dc5aaf6bc6d2e537d85541989e /src/storage/chewing_key.h | |
parent | 04593227a1cd13020a00217e1dca1ded287cb8ed (diff) | |
download | libpinyin-1ac46fc96bbdbd1c15d3fd5b3057ae606999d933.tar.gz libpinyin-1ac46fc96bbdbd1c15d3fd5b3057ae606999d933.tar.xz libpinyin-1ac46fc96bbdbd1c15d3fd5b3057ae606999d933.zip |
re-factor ChewingKey*
Diffstat (limited to 'src/storage/chewing_key.h')
-rw-r--r-- | src/storage/chewing_key.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/storage/chewing_key.h b/src/storage/chewing_key.h index 7b25933..41b5664 100644 --- a/src/storage/chewing_key.h +++ b/src/storage/chewing_key.h @@ -37,21 +37,21 @@ namespace pinyin{ * As the chewing large table only contains information of struct ChewingKey. */ -struct ChewingKey +struct _ChewingKey { guint16 m_initial : 5; guint16 m_middle : 2; guint16 m_final : 5; guint16 m_tone : 3; - ChewingKey() { + _ChewingKey() { m_initial = CHEWING_ZERO_INITIAL; m_middle = CHEWING_ZERO_MIDDLE; m_final = CHEWING_ZERO_FINAL; m_tone = CHEWING_ZERO_TONE; } - ChewingKey(ChewingInitial initial, ChewingMiddle middle, + _ChewingKey(ChewingInitial initial, ChewingMiddle middle, ChewingFinal final) { m_initial = initial; m_middle = middle; @@ -69,6 +69,8 @@ public: gchar * get_chewing_string(); }; +typedef struct _ChewingKey ChewingKey; + static inline bool operator == (ChewingKey lhs, ChewingKey rhs) { if (lhs.m_initial != rhs.m_initial) return false; @@ -81,7 +83,7 @@ static inline bool operator == (ChewingKey lhs, ChewingKey rhs) { return true; } -struct ChewingKeyRest +struct _ChewingKeyRest { /* Note: the table index is removed, * Please use get_table_index in ChewingKey. @@ -89,7 +91,7 @@ struct ChewingKeyRest guint16 m_raw_begin; /* the begin of the raw input. */ guint16 m_raw_end; /* the end of the raw input. */ - ChewingKeyRest() { + _ChewingKeyRest() { /* the 0th item in pinyin parser table is reserved for invalid. */ m_raw_begin = 0; m_raw_end = 0; @@ -100,6 +102,8 @@ struct ChewingKeyRest } }; +typedef struct _ChewingKeyRest ChewingKeyRest; + }; #endif |