From 6d5f16ffc0aa2ee3a8a3cd7adf1ae430b4f3384a Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Tue, 17 Sep 2013 13:16:38 +0800 Subject: update set_scheme method --- src/storage/pinyin_parser2.cpp | 44 +++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 24 deletions(-) (limited to 'src/storage/pinyin_parser2.cpp') diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp index 51b42db..9a73d3e 100644 --- a/src/storage/pinyin_parser2.cpp +++ b/src/storage/pinyin_parser2.cpp @@ -567,25 +567,6 @@ int ChewingSimpleParser2::parse(pinyin_option_t options, bool ChewingSimpleParser2::set_scheme(ChewingScheme scheme) { switch(scheme) { - case CHEWING_STANDARD: - m_symbol_table = chewing_standard_symbols; - m_tone_table = chewing_standard_tones; - return true; - case CHEWING_IBM: - m_symbol_table = chewing_ibm_symbols; - m_tone_table = chewing_ibm_tones; - return true; - case CHEWING_GINYIEH: - m_symbol_table = chewing_ginyieh_symbols; - m_tone_table = chewing_ginyieh_tones; - return true; - case CHEWING_ETEN: - m_symbol_table = chewing_eten_symbols; - m_tone_table = chewing_eten_tones; - return true; - case CHEWING_STANDARD_DVORAK: - m_symbol_table = chewing_standard_dvorak_symbols; - m_tone_table = chewing_standard_dvorak_tones; default: assert(FALSE); } @@ -740,17 +721,32 @@ bool ChewingDiscreteParser2::set_scheme(ChewingScheme scheme) { } switch(scheme) { + case CHEWING_STANDARD: + INIT_PARSER(bopomofo_index, standard); + break; case CHEWING_HSU: m_options = HSU_CORRECT; INIT_PARSER(hsu_bopomofo_index, hsu); break; - case CHEWING_HSU_DVORAK: - m_options = HSU_CORRECT; - INIT_PARSER(hsu_bopomofo_index, hsu_dvorak); + case CHEWING_IBM: + INIT_PARSER(bopomofo_index, ibm); + break; + case CHEWING_GINYIEH: + INIT_PARSER(bopomofo_index, ginyieh); + break; + case CHEWING_ETEN: + INIT_PARSER(bopomofo_index, eten); break; case CHEWING_ETEN26: m_options = ETEN26_CORRECT; - INIT_PARSER(eten26_bopomofo_index, eten26) + INIT_PARSER(eten26_bopomofo_index, eten26); + break; + case CHEWING_STANDARD_DVORAK: + INIT_PARSER(bopomofo_index, standard_dvorak); + break; + case CHEWING_HSU_DVORAK: + m_options = HSU_CORRECT; + INIT_PARSER(hsu_bopomofo_index, hsu_dvorak); break; default: assert(FALSE); @@ -758,7 +754,7 @@ bool ChewingDiscreteParser2::set_scheme(ChewingScheme scheme) { #undef INIT_PARSER - return false; + return true; } bool ChewingDiscreteParser2::in_chewing_scheme(pinyin_option_t options, -- cgit