From 918cd6a4d934f56bfe07a384c5b2eeb6bf6486c4 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Wed, 14 Oct 2015 16:39:56 +0800 Subject: use Zhuyin instead of Chewing --- src/storage/pinyin_parser2.h | 36 +++++++++---------- src/storage/zhuyin_parser2.cpp | 82 +++++++++++++++++++++--------------------- 2 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/storage/pinyin_parser2.h b/src/storage/pinyin_parser2.h index 713a9dc..a24d600 100644 --- a/src/storage/pinyin_parser2.h +++ b/src/storage/pinyin_parser2.h @@ -230,19 +230,19 @@ public: }; /** - * ChewingParser2: + * ZhuyinParser2: * * Parse the chewing input string into an array of struct ChewingKeys. * */ -class ChewingParser2 : public PhoneticParser2 +class ZhuyinParser2 : public PhoneticParser2 { public: - virtual ~ChewingParser2() {} + virtual ~ZhuyinParser2() {} public: /** - * ChewingParser2::in_chewing_scheme: + * ZhuyinParser2::in_chewing_scheme: * @options: the pinyin options. * @key: the user input ascii character. * @symbol: the corresponding chewing symbol. @@ -256,7 +256,7 @@ public: /** - * ChewingSimpleParser2: + * ZhuyinSimpleParser2: * * Parse the chewing string into an array of struct ChewingKeys. * @@ -269,7 +269,7 @@ public: * */ -class ChewingSimpleParser2 : public ChewingParser2 +class ZhuyinSimpleParser2 : public ZhuyinParser2 { /* internal options for chewing parsing. */ pinyin_option_t m_options; @@ -280,12 +280,12 @@ protected: const zhuyin_tone_item_t * m_tone_table; public: - ChewingSimpleParser2() { + ZhuyinSimpleParser2() { m_symbol_table = NULL; m_tone_table = NULL; set_scheme(ZHUYIN_DEFAULT); } - virtual ~ChewingSimpleParser2() {} + virtual ~ZhuyinSimpleParser2() {} virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, const char *str, int len) const; @@ -298,7 +298,7 @@ public: /** - * ChewingDiscreteParser2: + * ZhuyinDiscreteParser2: * * Parse the chewing string into an array of struct ChewingKeys. * @@ -306,7 +306,7 @@ public: * */ -class ChewingDiscreteParser2 : public ChewingParser2 +class ZhuyinDiscreteParser2 : public ZhuyinParser2 { protected: /* internal options for chewing parsing. */ @@ -321,7 +321,7 @@ protected: const zhuyin_tone_item_t * m_tone_table; public: - ChewingDiscreteParser2() { + ZhuyinDiscreteParser2() { m_options = 0; m_chewing_index = NULL; m_chewing_index_len = 0; m_initial_table = NULL; m_middle_table = NULL; @@ -329,7 +329,7 @@ public: set_scheme(ZHUYIN_HSU); } - virtual ~ChewingDiscreteParser2() {} + virtual ~ZhuyinDiscreteParser2() {} virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, const char *str, int len) const; @@ -341,7 +341,7 @@ public: }; -class ChewingDaChenCP26Parser2 : public ChewingParser2 +class ZhuyinDaChenCP26Parser2 : public ZhuyinParser2 { /* some internal pointers to chewing scheme table. */ const chewing_index_item_t * m_chewing_index; @@ -352,9 +352,9 @@ class ChewingDaChenCP26Parser2 : public ChewingParser2 const zhuyin_tone_item_t * m_tone_table; public: - ChewingDaChenCP26Parser2(); + ZhuyinDaChenCP26Parser2(); - virtual ~ChewingDaChenCP26Parser2() {} + virtual ~ZhuyinDaChenCP26Parser2() {} virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, const char *str, int len) const; @@ -366,15 +366,15 @@ public: /* Direct Parser for Chewing table load. */ -class ChewingDirectParser2 : public PhoneticParser2 +class ZhuyinDirectParser2 : public PhoneticParser2 { const chewing_index_item_t * m_chewing_index; size_t m_chewing_index_len; public: - ChewingDirectParser2(); + ZhuyinDirectParser2(); - virtual ~ChewingDirectParser2() {} + virtual ~ZhuyinDirectParser2() {} virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, const char *str, int len) const; diff --git a/src/storage/zhuyin_parser2.cpp b/src/storage/zhuyin_parser2.cpp index 2b866e7..5788db8 100644 --- a/src/storage/zhuyin_parser2.cpp +++ b/src/storage/zhuyin_parser2.cpp @@ -159,9 +159,9 @@ static int search_chewing_symbols2(const zhuyin_symbol_item_t * symbol_table, return num; } -bool ChewingSimpleParser2::parse_one_key(pinyin_option_t options, - ChewingKey & key, - const char * str, int len) const { +bool ZhuyinSimpleParser2::parse_one_key(pinyin_option_t options, + ChewingKey & key, + const char * str, int len) const { options &= ~PINYIN_AMB_ALL; unsigned char tone = CHEWING_ZERO_TONE; @@ -212,10 +212,10 @@ bool ChewingSimpleParser2::parse_one_key(pinyin_option_t options, } /* only characters in chewing keyboard scheme are accepted here. */ -int ChewingSimpleParser2::parse(pinyin_option_t options, - ChewingKeyVector & keys, - ChewingKeyRestVector & key_rests, - const char *str, int len) const { +int ZhuyinSimpleParser2::parse(pinyin_option_t options, + ChewingKeyVector & keys, + ChewingKeyRestVector & key_rests, + const char *str, int len) const { /* add keyboard mapping specific options. */ options |= m_options; @@ -263,7 +263,7 @@ int ChewingSimpleParser2::parse(pinyin_option_t options, } -bool ChewingSimpleParser2::set_scheme(ZhuyinScheme scheme) { +bool ZhuyinSimpleParser2::set_scheme(ZhuyinScheme scheme) { m_options = ZHUYIN_CORRECT_SHUFFLE; switch(scheme) { @@ -293,9 +293,9 @@ bool ChewingSimpleParser2::set_scheme(ZhuyinScheme scheme) { return false; } -bool ChewingSimpleParser2::in_chewing_scheme(pinyin_option_t options, - const char key, - gchar ** & symbols) const { +bool ZhuyinSimpleParser2::in_chewing_scheme(pinyin_option_t options, + const char key, + gchar ** & symbols) const { symbols = NULL; GPtrArray * array = g_ptr_array_new(); @@ -324,9 +324,9 @@ bool ChewingSimpleParser2::in_chewing_scheme(pinyin_option_t options, return false; } -bool ChewingDiscreteParser2::parse_one_key(pinyin_option_t options, - ChewingKey & key, - const char * str, int len) const { +bool ZhuyinDiscreteParser2::parse_one_key(pinyin_option_t options, + ChewingKey & key, + const char * str, int len) const { if (0 == len) return false; @@ -396,10 +396,10 @@ probe: } /* only characters in chewing keyboard scheme are accepted here. */ -int ChewingDiscreteParser2::parse(pinyin_option_t options, - ChewingKeyVector & keys, - ChewingKeyRestVector & key_rests, - const char *str, int len) const { +int ZhuyinDiscreteParser2::parse(pinyin_option_t options, + ChewingKeyVector & keys, + ChewingKeyRestVector & key_rests, + const char *str, int len) const { /* add keyboard mapping specific options. */ options |= m_options; @@ -446,7 +446,7 @@ int ChewingDiscreteParser2::parse(pinyin_option_t options, return parsed_len; } -bool ChewingDiscreteParser2::set_scheme(ZhuyinScheme scheme) { +bool ZhuyinDiscreteParser2::set_scheme(ZhuyinScheme scheme) { m_options = 0; #define INIT_PARSER(index, table) { \ @@ -480,9 +480,9 @@ bool ChewingDiscreteParser2::set_scheme(ZhuyinScheme scheme) { return true; } -bool ChewingDiscreteParser2::in_chewing_scheme(pinyin_option_t options, - const char key, - gchar ** & symbols) const { +bool ZhuyinDiscreteParser2::in_chewing_scheme(pinyin_option_t options, + const char key, + gchar ** & symbols) const { symbols = NULL; GPtrArray * array = g_ptr_array_new(); @@ -531,7 +531,7 @@ end: return false; } -ChewingDaChenCP26Parser2::ChewingDaChenCP26Parser2() { +ZhuyinDaChenCP26Parser2::ZhuyinDaChenCP26Parser2() { m_chewing_index = zhuyin_index; m_chewing_index_len = G_N_ELEMENTS(zhuyin_index); @@ -541,9 +541,9 @@ ChewingDaChenCP26Parser2::ChewingDaChenCP26Parser2() { m_tone_table = chewing_dachen_cp26_tones; } -bool ChewingDaChenCP26Parser2::parse_one_key(pinyin_option_t options, - ChewingKey & key, - const char *str, int len) const { +bool ZhuyinDaChenCP26Parser2::parse_one_key(pinyin_option_t options, + ChewingKey & key, + const char *str, int len) const { if (0 == len) return false; @@ -731,10 +731,10 @@ probe: return false; } -int ChewingDaChenCP26Parser2::parse(pinyin_option_t options, - ChewingKeyVector & keys, - ChewingKeyRestVector & key_rests, - const char *str, int len) const { +int ZhuyinDaChenCP26Parser2::parse(pinyin_option_t options, + ChewingKeyVector & keys, + ChewingKeyRestVector & key_rests, + const char *str, int len) const { g_array_set_size(keys, 0); g_array_set_size(key_rests, 0); @@ -804,9 +804,9 @@ int ChewingDaChenCP26Parser2::parse(pinyin_option_t options, } -bool ChewingDaChenCP26Parser2::in_chewing_scheme(pinyin_option_t options, - const char key, - gchar ** & symbols) const { +bool ZhuyinDaChenCP26Parser2::in_chewing_scheme(pinyin_option_t options, + const char key, + gchar ** & symbols) const { symbols = NULL; GPtrArray * array = g_ptr_array_new(); @@ -860,14 +860,14 @@ end: return false; } -ChewingDirectParser2::ChewingDirectParser2 (){ +ZhuyinDirectParser2::ZhuyinDirectParser2 (){ m_chewing_index = zhuyin_index; m_chewing_index_len = G_N_ELEMENTS(zhuyin_index); } -bool ChewingDirectParser2::parse_one_key(pinyin_option_t options, - ChewingKey & key, - const char *str, int len) const { +bool ZhuyinDirectParser2::parse_one_key(pinyin_option_t options, + ChewingKey & key, + const char *str, int len) const { options &= ~PINYIN_AMB_ALL; /* by default, chewing will use the first tone. */ unsigned char tone = CHEWING_1; @@ -919,10 +919,10 @@ bool ChewingDirectParser2::parse_one_key(pinyin_option_t options, return false; } -int ChewingDirectParser2::parse(pinyin_option_t options, - ChewingKeyVector & keys, - ChewingKeyRestVector & key_rests, - const char *str, int len) const { +int ZhuyinDirectParser2::parse(pinyin_option_t options, + ChewingKeyVector & keys, + ChewingKeyRestVector & key_rests, + const char *str, int len) const { g_array_set_size(keys, 0); g_array_set_size(key_rests, 0); -- cgit