From 1ac46fc96bbdbd1c15d3fd5b3057ae606999d933 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Thu, 21 Mar 2013 09:49:21 +0800 Subject: re-factor ChewingKey* --- src/storage/chewing_key.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/storage/chewing_key.h') 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 -- cgit