summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2017-05-23 17:39:07 +0800
committerPeng Wu <alexepico@gmail.com>2017-05-23 17:39:07 +0800
commit132a15bb1da8bc426cb4abf796814f4ec307bccd (patch)
tree32495417a489e60e090b68c3db220f63a9385d11
parentcfc44f039a0320a2f35d541eb4bfc39e72ad7c48 (diff)
downloadlibpinyin-132a15bb1da8bc426cb4abf796814f4ec307bccd.zip
libpinyin-132a15bb1da8bc426cb4abf796814f4ec307bccd.tar.gz
libpinyin-132a15bb1da8bc426cb4abf796814f4ec307bccd.tar.xz
update libzhuyin API
-rw-r--r--src/libzhuyin.ver6
-rw-r--r--src/zhuyin.cpp2
-rw-r--r--src/zhuyin.h60
3 files changed, 58 insertions, 10 deletions
diff --git a/src/libzhuyin.ver b/src/libzhuyin.ver
index 6ce20da..a28b410 100644
--- a/src/libzhuyin.ver
+++ b/src/libzhuyin.ver
@@ -42,12 +42,14 @@ LIBZHUYIN {
zhuyin_get_candidate;
zhuyin_get_candidate_type;
zhuyin_get_candidate_string;
- zhuyin_get_n_zhuyin;
zhuyin_get_zhuyin_key;
zhuyin_get_zhuyin_key_rest;
zhuyin_get_zhuyin_key_rest_positions;
zhuyin_get_zhuyin_key_rest_length;
- zhuyin_get_zhuyin_key_rest_offset;
+ zhuyin_get_zhuyin_offset;
+ zhuyin_get_left_zhuyin_offset;
+ zhuyin_get_right_zhuyin_offset;
+ zhuyin_get_character_offset;
zhuyin_get_n_phrase;
zhuyin_get_phrase_token;
diff --git a/src/zhuyin.cpp b/src/zhuyin.cpp
index f3b06b0..531fb86 100644
--- a/src/zhuyin.cpp
+++ b/src/zhuyin.cpp
@@ -1013,7 +1013,7 @@ bool zhuyin_parse_full_pinyin(zhuyin_instance_t * instance,
return retval;
}
-size_t pinyin_parse_more_full_pinyins(zhuyin_instance_t * instance,
+size_t zhuyin_parse_more_full_pinyins(zhuyin_instance_t * instance,
const char * pinyins){
zhuyin_context_t * & context = instance->m_context;
zhuyin_option_t options = context->m_options;
diff --git a/src/zhuyin.h b/src/zhuyin.h
index de6e100..50a3287 100644
--- a/src/zhuyin.h
+++ b/src/zhuyin.h
@@ -582,6 +582,7 @@ bool zhuyin_get_candidate_string(zhuyin_instance_t * instance,
lookup_candidate_t * candidate,
const gchar ** utf8_str);
+#if 0
/**
* zhuyin_get_n_zhuyin:
* @instance: the zhuyin instance.
@@ -593,6 +594,7 @@ bool zhuyin_get_candidate_string(zhuyin_instance_t * instance,
*/
bool zhuyin_get_n_zhuyin(zhuyin_instance_t * instance,
guint * num);
+#endif
/**
* zhuyin_get_zhuyin_key:
@@ -652,18 +654,62 @@ bool zhuyin_get_zhuyin_key_rest_length(zhuyin_instance_t * instance,
guint16 * length);
/**
- * zhuyin_get_zhuyin_key_rest_offset:
+ * zhuyin_get_zhuyin_offset:
+ * @instance: the zhuyin instance.
+ * @cursor: the user cursor.
+ * @offset: the lookup offset.
+ * @returns: whether the get operation is successful.
+ *
+ * Get the lookup offset from the user cursor.
+ *
+ */
+bool zhuyin_get_zhuyin_offset(zhuyin_instance_t * instance,
+ size_t cursor,
+ size_t * offset);
+
+/**
+ * zhuyin_get_left_zhuyin_offset:
+ * @instance: the zhuyin instance.
+ * @offset: the lookup offset.
+ * @left: the left offset.
+ * @returns: whether the get operation is successful.
+ *
+ * Get the left offset from the lookup offset.
+ *
+ */
+bool zhuyin_get_left_zhuyin_offset(zhuyin_instance_t * instance,
+ size_t offset,
+ size_t * left);
+
+/**
+ * zhuyin_get_right_zhuyin_offset:
+ * @instance: the zhuyin instance.
+ * @offset: the lookup offset.
+ * @right: the right offset.
+ * @returns: whether the get operation is successful.
+ *
+ * Get the right offset from the lookup offset.
+ *
+ */
+bool zhuyin_get_right_zhuyin_offset(zhuyin_instance_t * instance,
+ size_t offset,
+ size_t * right);
+
+/**
+ * zhuyin_get_character_offset:
* @instance: the zhuyin instance.
- * @cursor: the cursor.
- * @offset: the offset in the zhuyin array.
+ * @phrase: the utf8 phrase.
+ * @offset: the lookup offset.
+ * @length: the character offset.
* @returns: whether the get operation is successful.
*
- * Get the offset in the zhuyin key array.
+ * Get the character offset from the lookup offset.
*
*/
-bool zhuyin_get_zhuyin_key_rest_offset(zhuyin_instance_t * instance,
- guint16 cursor,
- guint16 * offset);
+bool zhuyin_get_character_offset(zhuyin_instance_t * instance,
+ const char * phrase,
+ size_t offset,
+ size_t * length);
#if 0
/**