From 7bcaabf8549d55b8c51d9c74ac7841fd635d18b8 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Wed, 14 Oct 2015 16:53:06 +0800 Subject: update chewing_key.cpp --- src/storage/chewing_key.cpp | 50 ++++++++++++++++++++++----------------------- 1 file 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); } } -- cgit