summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-12-04 10:04:09 +0800
committerPeng Wu <alexepico@gmail.com>2012-12-04 10:04:09 +0800
commit3d1f1928a5d3317e90767a094466f3b2a0604254 (patch)
treeda166271c3a582927619c6e312fbbe7300dd13d8 /src
parent9cb03603a51252708a0f43992ce9d40e38e88a55 (diff)
downloadlibpinyin-3d1f1928a5d3317e90767a094466f3b2a0604254.tar.gz
libpinyin-3d1f1928a5d3317e90767a094466f3b2a0604254.tar.xz
libpinyin-3d1f1928a5d3317e90767a094466f3b2a0604254.zip
write pinyin_get_chewing/pinyin_string
Diffstat (limited to 'src')
-rw-r--r--src/libpinyin.ver3
-rw-r--r--src/pinyin.cpp23
-rw-r--r--src/pinyin.h8
3 files changed, 33 insertions, 1 deletions
diff --git a/src/libpinyin.ver b/src/libpinyin.ver
index 54e389b..3ed126e 100644
--- a/src/libpinyin.ver
+++ b/src/libpinyin.ver
@@ -36,7 +36,8 @@ LIBPINYIN {
pinyin_get_pinyins_from_token;
pinyin_train;
pinyin_reset;
- _ZN6pinyin10ChewingKey*;
+ pinyin_get_chewing_string;
+ pinyin_get_pinyin_string;
local:
*;
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index a7d83be..bba9f1a 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -1795,6 +1795,29 @@ bool pinyin_reset(pinyin_instance_t * instance){
return true;
}
+bool pinyin_get_chewing_string(pinyin_instance_t * instance,
+ ChewingKey * key,
+ gchar ** utf8_str) {
+ *utf8_str = NULL;
+ if (0 == key->get_table_index())
+ return false;
+
+ *utf8_str = key->get_chewing_string();
+ return true;
+}
+
+bool pinyin_get_pinyin_string(pinyin_instance_t * instance,
+ ChewingKey * key,
+ gchar ** utf8_str) {
+ *utf8_str = NULL;
+ if (0 == key->get_table_index())
+ return false;
+
+ *utf8_str = key->get_pinyin_string();
+ return true;
+}
+
+
/**
* Note: prefix is the text before the pre-edit string.
*/
diff --git a/src/pinyin.h b/src/pinyin.h
index 645e02e..fd4e43a 100644
--- a/src/pinyin.h
+++ b/src/pinyin.h
@@ -514,6 +514,14 @@ bool pinyin_train(pinyin_instance_t * instance);
bool pinyin_reset(pinyin_instance_t * instance);
+bool pinyin_get_chewing_string(pinyin_instance_t * instance,
+ ChewingKey * key,
+ gchar ** utf8_str);
+
+bool pinyin_get_pinyin_string(pinyin_instance_t * instance,
+ ChewingKey * key,
+ gchar ** utf8_str);
+
/* hack here. */
typedef ChewingKey PinyinKey;
typedef ChewingKeyRest PinyinKeyPos;