summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-09-16 14:38:26 +0800
committerPeng Wu <alexepico@gmail.com>2013-09-16 14:38:26 +0800
commit532bda01b0b9072036ab531f94c2ced6f9226955 (patch)
tree92197a2ca92e0b534f3ae4d46b4c704855e3a0c6 /src
parenta7f22ed919687f5a4ade1d5d698dc28edb2346a5 (diff)
downloadlibzhuyin-532bda01b0b9072036ab531f94c2ced6f9226955.tar.gz
libzhuyin-532bda01b0b9072036ab531f94c2ced6f9226955.tar.xz
libzhuyin-532bda01b0b9072036ab531f94c2ced6f9226955.zip
write set_scheme method
Diffstat (limited to 'src')
-rw-r--r--src/storage/pinyin_parser2.cpp39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index 02cec6f..7b0bf9a 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -667,8 +667,8 @@ probe:
gchar * chewing = g_strconcat(initial, middle, final, NULL);
/* search the chewing in the chewing index table. */
- if (index == len && search_chewing_index(options, bopomofo_index,
- G_N_ELEMENTS(bopomofo_index),
+ if (index == len && search_chewing_index(options, m_chewing_index,
+ m_chewing_index_len,
chewing, key)) {
/* save back tone if available. */
key.m_tone = tone;
@@ -727,6 +727,41 @@ int ChewingDiscreteParser2::parse(pinyin_option_t options,
return parsed_len;
}
+bool ChewingDiscreteParser2::set_scheme(ChewingScheme scheme) {
+ switch(scheme) {
+ case CHEWING_HSU:
+ m_options = HSU_CORRECT;
+ m_chewing_index = hsu_bopomofo_index;
+ m_chewing_index_len = G_N_ELEMENTS(hsu_bopomofo_index);
+ m_initial_table = chewing_hsu_initials;
+ m_middle_table = chewing_hsu_middles;
+ m_final_table = chewing_hsu_finals;
+ m_tone_table = chewing_hsu_tones;
+ break;
+ case CHEWING_HSU_DVORAK:
+ m_options = HSU_CORRECT;
+ m_chewing_index = hsu_bopomofo_index;
+ m_chewing_index_len = G_N_ELEMENTS(hsu_bopomofo_index);
+ m_initial_table = chewing_hsu_dvorak_initials;
+ m_middle_table = chewing_hsu_dvorak_middles;
+ m_final_table = chewing_hsu_dvorak_finals;
+ m_tone_table = chewing_hsu_dvorak_tones;
+ break;
+ case CHEWING_ETEN26:
+ m_options = ETEN26_CORRECT;
+ m_chewing_index = eten26_bopomofo_index;
+ m_chewing_index_len = G_N_ELEMENTS(eten26_bopomofo_index);
+ m_initial_table = chewing_eten26_initials;
+ m_middle_table = chewing_eten26_middles;
+ m_final_table = chewing_eten26_finals;
+ m_tone_table = chewing_eten26_tones;
+ break;
+ default:
+ assert(FALSE);
+ }
+
+ return false;
+}
bool ChewingDiscreteParser2::in_chewing_scheme(pinyin_option_t options,
const char key,