summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-02-21 11:23:21 +0800
committerPeng Wu <alexepico@gmail.com>2013-02-21 11:30:41 +0800
commitd963dc50f1d00f9d70bbe4ed51ad65329da22542 (patch)
tree188b6120630b1e1a58409b90d835f9dc80b79a83
parent7dfc18b954da70f977c8b272503dd34df042419b (diff)
downloadlibpinyin-d963dc50f1d00f9d70bbe4ed51ad65329da22542.tar.gz
libpinyin-d963dc50f1d00f9d70bbe4ed51ad65329da22542.tar.xz
libpinyin-d963dc50f1d00f9d70bbe4ed51ad65329da22542.zip
add get_shengmu/yunmu_string
-rw-r--r--src/storage/chewing_key.h2
-rw-r--r--src/storage/pinyin_parser2.cpp14
2 files changed, 16 insertions, 0 deletions
diff --git a/src/storage/chewing_key.h b/src/storage/chewing_key.h
index 721f566..c853eb0 100644
--- a/src/storage/chewing_key.h
+++ b/src/storage/chewing_key.h
@@ -92,6 +92,8 @@ public:
/* Note: the return value should be freed by g_free. */
gchar * get_pinyin_string();
+ gchar * get_shengmu_string();
+ gchar * get_yunmu_string();
gchar * get_chewing_string();
};
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index 131231c..f4ea2dd 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -94,6 +94,20 @@ gchar * ChewingKey::get_pinyin_string() {
}
}
+gchar * ChewingKey::get_shengmu_string() {
+ gint index = get_table_index();
+ assert(index < 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 < G_N_ELEMENTS(content_table));
+ const content_table_item_t & item = content_table[index];
+ return g_strdup(item.m_yunmu_str);
+}
+
gchar * ChewingKey::get_chewing_string() {
assert(m_tone < CHEWING_NUMBER_OF_TONES);
gint index = get_table_index();