summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-02-21 13:14:55 +0800
committerPeng Wu <alexepico@gmail.com>2013-02-21 13:14:55 +0800
commit932126ad426803596f17a7ad320c8ded1ea8b2d7 (patch)
treeaa644ff00d77fd6d4b5a1828b7a51bfbf8979ca8
parent6d73c79f073d241d57375a2c1078f4dc580d3bd9 (diff)
downloadlibpinyin-932126ad426803596f17a7ad320c8ded1ea8b2d7.tar.gz
libpinyin-932126ad426803596f17a7ad320c8ded1ea8b2d7.tar.xz
libpinyin-932126ad426803596f17a7ad320c8ded1ea8b2d7.zip
write pinyin_get_pinyin_strings
-rw-r--r--src/libpinyin.ver1
-rw-r--r--src/pinyin.cpp13
-rw-r--r--src/pinyin.h16
3 files changed, 30 insertions, 0 deletions
diff --git a/src/libpinyin.ver b/src/libpinyin.ver
index a156215..078ad86 100644
--- a/src/libpinyin.ver
+++ b/src/libpinyin.ver
@@ -34,6 +34,7 @@ LIBPINYIN {
pinyin_reset;
pinyin_get_chewing_string;
pinyin_get_pinyin_string;
+ pinyin_get_pinyin_strings;
pinyin_token_get_phrase;
pinyin_token_get_n_pronunciation;
pinyin_token_get_nth_pronunciation;
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index 2b9eb69..e880bb1 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -1763,6 +1763,19 @@ bool pinyin_get_pinyin_string(pinyin_instance_t * instance,
return true;
}
+bool pinyin_get_pinyin_strings(pinyin_instance_t * instance,
+ ChewingKey * key,
+ gchar ** shengmu,
+ gchar ** yunmu) {
+ *shengmu = NULL; *yunmu = NULL;
+ if (0 == key->get_table_index())
+ return false;
+
+ *shengmu = key->get_shengmu_string();
+ *yunmu = key->get_yunmu_string();
+ return true;
+}
+
bool pinyin_token_get_phrase(pinyin_instance_t * instance,
phrase_token_t token,
guint * len,
diff --git a/src/pinyin.h b/src/pinyin.h
index 9c2618e..6cde671 100644
--- a/src/pinyin.h
+++ b/src/pinyin.h
@@ -492,6 +492,22 @@ bool pinyin_get_pinyin_string(pinyin_instance_t * instance,
gchar ** utf8_str);
/**
+ * pinyin_get_pinyin_strings:
+ * @instance: the pinyin instance.
+ * @key: the pinyin key.
+ * @shengmu: the shengmu string.
+ * @yunmu: the yunmu string.
+ * @returns: whether the get operation is successful.
+ *
+ * Get the shengmu and yunmu strings of the key.
+ *
+ */
+bool pinyin_get_pinyin_strings(pinyin_instance_t * instance,
+ ChewingKey * key,
+ gchar ** shengmu,
+ gchar ** yunmu);
+
+/**
* pinyin_token_get_phrase:
* @instance: the pinyin instance.
* @token: the phrase token.