diff options
author | Peng Wu <alexepico@gmail.com> | 2015-10-14 16:53:06 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2015-10-14 16:53:06 +0800 |
commit | 7bcaabf8549d55b8c51d9c74ac7841fd635d18b8 (patch) | |
tree | d79d643c57bb0d198e99be2f64a0c92eaff73f39 | |
parent | 987b82c533f31d6730c4057b67d6cb59b30d8c74 (diff) | |
download | libpinyin-7bcaabf8549d55b8c51d9c74ac7841fd635d18b8.tar.gz libpinyin-7bcaabf8549d55b8c51d9c74ac7841fd635d18b8.tar.xz libpinyin-7bcaabf8549d55b8c51d9c74ac7841fd635d18b8.zip |
update chewing_key.cpp
-rw-r--r-- | src/storage/chewing_key.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/storage/chewing_key.cpp b/src/storage/chewing_key.cpp index 735a2f0..66be039 100644 --- a/src/storage/chewing_key.cpp +++ b/src/storage/chewing_key.cpp @@ -48,59 +48,59 @@ gchar * _ChewingKey::get_pinyin_string() { } } -gchar * _ChewingKey::get_luoma_pinyin_string() { - assert(m_tone < CHEWING_NUMBER_OF_TONES); +gchar * _ChewingKey::get_shengmu_string() { gint index = get_table_index(); assert(index < (int) G_N_ELEMENTS(content_table)); const content_table_item_t & item = content_table[index]; + return g_strdup(item.m_shengmu_str); +} - if (CHEWING_ZERO_TONE == m_tone) { - return g_strdup(item.m_luoma_pinyin_str); - } else { - return g_strdup_printf("%s%d", item.m_luoma_pinyin_str, m_tone); - } +gchar * _ChewingKey::get_yunmu_string() { + gint index = get_table_index(); + assert(index < (int) G_N_ELEMENTS(content_table)); + const content_table_item_t & item = content_table[index]; + return g_strdup(item.m_yunmu_str); } -gchar * _ChewingKey::get_secondary_zhuyin_string() { +gchar * _ChewingKey::get_zhuyin_string() { assert(m_tone < CHEWING_NUMBER_OF_TONES); gint index = get_table_index(); assert(index < (int) G_N_ELEMENTS(content_table)); const content_table_item_t & item = content_table[index]; if (CHEWING_ZERO_TONE == m_tone) { - return g_strdup(item.m_secondary_zhuyin_str); + return g_strdup(item.m_zhuyin_str); + } else if (CHEWING_1 == m_tone) { + /* for first tone, usually not display it. */ + return g_strdup(item.m_zhuyin_str); } else { - return g_strdup_printf("%s%d", item.m_secondary_zhuyin_str, m_tone); + return g_strdup_printf("%s%s", item.m_zhuyin_str, + chewing_tone_table[m_tone]); } } -gchar * _ChewingKey::get_shengmu_string() { +gchar * _ChewingKey::get_luoma_pinyin_string() { + assert(m_tone < CHEWING_NUMBER_OF_TONES); gint index = get_table_index(); assert(index < (int) G_N_ELEMENTS(content_table)); const content_table_item_t & item = content_table[index]; - return g_strdup(item.m_shengmu_str); -} -gchar * _ChewingKey::get_yunmu_string() { - gint index = get_table_index(); - assert(index < (int) G_N_ELEMENTS(content_table)); - const content_table_item_t & item = content_table[index]; - return g_strdup(item.m_yunmu_str); + if (CHEWING_ZERO_TONE == m_tone) { + return g_strdup(item.m_luoma_pinyin_str); + } else { + return g_strdup_printf("%s%d", item.m_luoma_pinyin_str, m_tone); + } } -gchar * _ChewingKey::get_chewing_string() { +gchar * _ChewingKey::get_secondary_zhuyin_string() { assert(m_tone < CHEWING_NUMBER_OF_TONES); gint index = get_table_index(); assert(index < (int) G_N_ELEMENTS(content_table)); const content_table_item_t & item = content_table[index]; if (CHEWING_ZERO_TONE == m_tone) { - return g_strdup(item.m_zhuyin_str); - } else if (CHEWING_1 == m_tone) { - /* for first tone, usually not display it. */ - return g_strdup(item.m_zhuyin_str); + return g_strdup(item.m_secondary_zhuyin_str); } else { - return g_strdup_printf("%s%s", item.m_zhuyin_str, - chewing_tone_table[m_tone]); + return g_strdup_printf("%s%d", item.m_secondary_zhuyin_str, m_tone); } } |