diff options
-rw-r--r-- | src/pinyin.cpp | 30 | ||||
-rw-r--r-- | src/pinyin.h | 21 |
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; |