summaryrefslogtreecommitdiffstats
path: root/src/pinyin.cpp
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-03-21 16:16:59 +0800
committerPeng Wu <alexepico@gmail.com>2013-03-21 16:16:59 +0800
commit33fbca959cd63cf5de0c36695d9ec03dd8d7095a (patch)
tree6bce1c0e474b9c9b98c23486bc42ac5e042d23ae /src/pinyin.cpp
parent9a0fa3e39b7efb2e965243cf81a1ed86f6cb12b6 (diff)
downloadlibpinyin-33fbca959cd63cf5de0c36695d9ec03dd8d7095a.tar.gz
libpinyin-33fbca959cd63cf5de0c36695d9ec03dd8d7095a.tar.xz
libpinyin-33fbca959cd63cf5de0c36695d9ec03dd8d7095a.zip
write get pinyin key and rest methods
Diffstat (limited to 'src/pinyin.cpp')
-rw-r--r--src/pinyin.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index 21ea69c..34e6bde 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -1954,6 +1954,36 @@ bool pinyin_get_n_pinyin(pinyin_instance_t * instance,
return true;
}
+bool pinyin_get_pinyin_key(pinyin_instance_t * instance,
+ guint index,
+ ChewingKey ** key) {
+ ChewingKeyVector & pinyin_keys = instance->m_pinyin_keys;
+
+ *key = NULL;
+
+ if (index >= pinyin_keys->len)
+ return false;
+
+ *key = &g_array_index(pinyin_keys, ChewingKey, index);
+
+ return true;
+}
+
+bool pinyin_get_pinyin_key_rest(pinyin_instance_t * instance,
+ guint index,
+ ChewingKeyRest ** key_rest) {
+ ChewingKeyRestVector & pinyin_key_rests = instance->m_pinyin_key_rests;
+
+ *key_rest = NULL;
+
+ if (index >= pinyin_key_rests->len)
+ return false;
+
+ *key_rest = &g_array_index(pinyin_key_rests, ChewingKeyRest, index);
+
+ return true;
+}
+
/**
* Note: prefix is the text before the pre-edit string.
*/