summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2015-10-16 13:13:27 +0800
committerPeng Wu <alexepico@gmail.com>2015-10-16 13:13:27 +0800
commit369a4d63b24d441c87da55aa11774881d02fd0a7 (patch)
treeef20515a918a64da17e5269cc1a408f35ca957c9
parent7f77d9dcbc043d00d3ef2eacfb1237b32b1d6136 (diff)
downloadlibpinyin-369a4d63b24d441c87da55aa11774881d02fd0a7.tar.gz
libpinyin-369a4d63b24d441c87da55aa11774881d02fd0a7.tar.xz
libpinyin-369a4d63b24d441c87da55aa11774881d02fd0a7.zip
add pinyin_get_luoma_pinyin_string and pinyin_get_secondary_zhuyin_string
-rw-r--r--src/libpinyin.ver2
-rw-r--r--src/pinyin.cpp22
-rw-r--r--src/pinyin.h42
-rw-r--r--src/storage/pinyin_custom2.h2
-rw-r--r--src/storage/pinyin_parser2.cpp2
5 files changed, 68 insertions, 2 deletions
diff --git a/src/libpinyin.ver b/src/libpinyin.ver
index 477b6e5..84198cc 100644
--- a/src/libpinyin.ver
+++ b/src/libpinyin.ver
@@ -45,6 +45,8 @@ LIBPINYIN {
pinyin_reset;
pinyin_get_chewing_string;
pinyin_get_pinyin_string;
+ pinyin_get_luoma_pinyin_string;
+ pinyin_get_secondary_zhuyin_string;
pinyin_get_pinyin_strings;
pinyin_get_pinyin_is_incomplete;
pinyin_token_get_phrase;
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index f66a0c1..b748771 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -2451,6 +2451,28 @@ bool pinyin_get_pinyin_string(pinyin_instance_t * instance,
return true;
}
+bool pinyin_get_luoma_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_luoma_pinyin_string();
+ return true;
+}
+
+bool pinyin_get_secondary_zhuyin_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_secondary_zhuyin_string();
+ return true;
+}
+
bool pinyin_get_pinyin_strings(pinyin_instance_t * instance,
ChewingKey * key,
gchar ** shengmu,
diff --git a/src/pinyin.h b/src/pinyin.h
index 31c3bf5..210e9e0 100644
--- a/src/pinyin.h
+++ b/src/pinyin.h
@@ -590,6 +590,48 @@ bool pinyin_get_pinyin_string(pinyin_instance_t * instance,
gchar ** utf8_str);
/**
+ * pinyin_get_luoma_pinyin_string:
+ * @instance: the pinyin instance.
+ * @key: the pinyin key.
+ * @utf8_str: the luoma pinyin string.
+ * @returns: whether the get operation is successful.
+ *
+ * Get the luoma pinyin string of the key.
+ *
+ */
+bool pinyin_get_luoma_pinyin_string(pinyin_instance_t * instance,
+ ChewingKey * key,
+ gchar ** utf8_str);
+
+/**
+ * pinyin_get_luoma_pinyin_string:
+ * @instance: the pinyin instance.
+ * @key: the pinyin key.
+ * @utf8_str: the luoma pinyin string.
+ * @returns: whether the get operation is successful.
+ *
+ * Get the luoma pinyin string of the key.
+ *
+ */
+bool pinyin_get_luoma_pinyin_string(pinyin_instance_t * instance,
+ ChewingKey * key,
+ gchar ** utf8_str);
+
+/**
+ * pinyin_get_secondary_zhuyin_string:
+ * @instance: the pinyin instance.
+ * @key: the pinyin key.
+ * @utf8_str: the secondary zhuyin string.
+ * @returns: whether the get operation is successful.
+ *
+ * Get the secondary zhuyin string of the key.
+ *
+ */
+bool pinyin_get_secondary_zhuyin_string(pinyin_instance_t * instance,
+ ChewingKey * key,
+ gchar ** utf8_str);
+
+/**
* pinyin_get_pinyin_strings:
* @instance: the pinyin instance.
* @key: the pinyin key.
diff --git a/src/storage/pinyin_custom2.h b/src/storage/pinyin_custom2.h
index 3b6e097..916e295 100644
--- a/src/storage/pinyin_custom2.h
+++ b/src/storage/pinyin_custom2.h
@@ -100,7 +100,7 @@ enum FullPinyinScheme
{
FULL_PINYIN_HANYU = 1,
FULL_PINYIN_LUOMA = 2,
- FULL_PINYIN_SECONDARY_BOPOMOFO = 3,
+ FULL_PINYIN_SECONDARY_ZHUYIN = 3,
FULL_PINYIN_DEFAULT = FULL_PINYIN_HANYU
};
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index 425b585..98cf04b 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -398,7 +398,7 @@ bool FullPinyinParser2::set_scheme(FullPinyinScheme scheme){
m_pinyin_index = luoma_pinyin_index;
m_pinyin_index_len = G_N_ELEMENTS(luoma_pinyin_index);
break;
- case FULL_PINYIN_SECONDARY_BOPOMOFO:
+ case FULL_PINYIN_SECONDARY_ZHUYIN:
m_pinyin_index = secondary_zhuyin_index;
m_pinyin_index_len = G_N_ELEMENTS(secondary_zhuyin_index);
break;