summaryrefslogtreecommitdiffstats
path: root/src
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
parent9a0fa3e39b7efb2e965243cf81a1ed86f6cb12b6 (diff)
downloadlibpinyin-33fbca959cd63cf5de0c36695d9ec03dd8d7095a.tar.gz
libpinyin-33fbca959cd63cf5de0c36695d9ec03dd8d7095a.tar.xz
libpinyin-33fbca959cd63cf5de0c36695d9ec03dd8d7095a.zip
write get pinyin key and rest methods
Diffstat (limited to 'src')
-rw-r--r--src/pinyin.cpp30
-rw-r--r--src/pinyin.h21
2 files changed, 51 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.
*/
diff --git a/src/pinyin.h b/src/pinyin.h
index ce49517..a038327 100644
--- a/src/pinyin.h
+++ b/src/pinyin.h
@@ -581,6 +581,27 @@ bool pinyin_get_candidate_string(pinyin_instance_t * instance,
bool pinyin_get_n_pinyin(pinyin_instance_t * instance,
guint * num);
+bool pinyin_get_pinyin_key(pinyin_instance_t * instance,
+ guint index,
+ ChewingKey ** key);
+
+bool pinyin_get_pinyin_key_rest(pinyin_instance_t * instance,
+ guint index,
+ ChewingKeyRest ** key_rest);
+
+bool pinyin_get_key_rest_positions(pinyin_instance_t * instance,
+ ChewingKeyRest * key_rest,
+ guint16 * begin, guint16 * end);
+
+bool pinyin_get_key_rest_length(pinyin_instance_t * instance,
+ ChewingKeyRest * key_rest,
+ guint16 * len);
+
+bool pinyin_get_raw_pinyin_input(pinyin_instance_t * instance,
+ const gchar ** utf8_str);
+
+
+
/* hack here. */
typedef ChewingKey PinyinKey;
typedef ChewingKeyRest PinyinKeyPos;