summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2014-04-24 11:10:48 +0800
committerPeng Wu <alexepico@gmail.com>2014-04-24 11:10:48 +0800
commit804cf60341795c0f29638b2a6aefc47bf13604f5 (patch)
tree8c56052f249db280ad64b2fcb21818a601b1e653
parent2cbe46385660f0f2be9d6efaa172925d03ff4f7f (diff)
downloadlibzhuyin-804cf60341795c0f29638b2a6aefc47bf13604f5.tar.gz
libzhuyin-804cf60341795c0f29638b2a6aefc47bf13604f5.tar.xz
libzhuyin-804cf60341795c0f29638b2a6aefc47bf13604f5.zip
update public api
-rw-r--r--src/storage/chewing_key.h2
-rw-r--r--src/storage/pinyin_parser2.cpp6
-rw-r--r--src/storage/pinyin_parser2.h4
-rw-r--r--src/storage/zhuyin_custom2.h22
-rw-r--r--src/zhuyin.cpp6
-rw-r--r--src/zhuyin.h4
6 files changed, 18 insertions, 26 deletions
diff --git a/src/storage/chewing_key.h b/src/storage/chewing_key.h
index 439dead..47d45e1 100644
--- a/src/storage/chewing_key.h
+++ b/src/storage/chewing_key.h
@@ -66,7 +66,7 @@ public:
gint get_table_index();
/* Note: the return value should be freed by g_free. */
- gchar * get_pinyin_string(FullPinyinScheme scheme = FULL_PINYIN_DEFAULT);
+ gchar * get_pinyin_string(ZhuyinScheme scheme = FULL_PINYIN_DEFAULT);
gchar * get_bopomofo_string();
};
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index f2cf157..1a80621 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -95,7 +95,7 @@ gint _ChewingKey::get_table_index() {
return index == -1 ? 0 : index;
}
-gchar * _ChewingKey::get_pinyin_string(FullPinyinScheme scheme) {
+gchar * _ChewingKey::get_pinyin_string(ZhuyinScheme scheme) {
assert(m_tone < CHEWING_NUMBER_OF_TONES);
gint index = get_table_index();
assert(index < (int) G_N_ELEMENTS(content_table));
@@ -441,7 +441,7 @@ int FullPinyinParser2::final_step(size_t step_len, ChewingKeyVector & keys,
return parsed_len;
}
-bool FullPinyinParser2::set_scheme(FullPinyinScheme scheme){
+bool FullPinyinParser2::set_scheme(ZhuyinScheme scheme){
switch(scheme){
case FULL_PINYIN_HANYU:
m_pinyin_index = hanyu_pinyin_index;
@@ -727,7 +727,7 @@ int ChewingDiscreteParser2::parse(pinyin_option_t options,
return parsed_len;
}
-bool ChewingDiscreteParser2::set_scheme(ChewingScheme scheme) {
+bool ChewingDiscreteParser2::set_scheme(ZhuyinScheme scheme) {
m_options = 0;
#define INIT_PARSER(index, table) { \
diff --git a/src/storage/pinyin_parser2.h b/src/storage/pinyin_parser2.h
index 0fbfb54..0a81cf3 100644
--- a/src/storage/pinyin_parser2.h
+++ b/src/storage/pinyin_parser2.h
@@ -142,7 +142,7 @@ public:
virtual int parse(pinyin_option_t options, ChewingKeyVector & keys, ChewingKeyRestVector & key_rests, const char *str, int len) const;
public:
- bool set_scheme(FullPinyinScheme scheme);
+ bool set_scheme(ZhuyinScheme scheme);
};
/**
@@ -215,7 +215,7 @@ public:
virtual int parse(pinyin_option_t options, ChewingKeyVector & keys, ChewingKeyRestVector & key_rests, const char *str, int len) const;
public:
- bool set_scheme(ChewingScheme scheme);
+ bool set_scheme(ZhuyinScheme scheme);
virtual bool in_chewing_scheme(pinyin_option_t options, const char key, gchar ** & symbols) const;
};
diff --git a/src/storage/zhuyin_custom2.h b/src/storage/zhuyin_custom2.h
index bcea40b..2d49bfe 100644
--- a/src/storage/zhuyin_custom2.h
+++ b/src/storage/zhuyin_custom2.h
@@ -63,21 +63,9 @@ enum ZhuyinAmbiguity2{
};
/**
- * @brief enums of Pinyin Schemes.
+ * @brief enums of Zhuyin Schemes.
*/
-
-enum FullPinyinScheme
-{
- FULL_PINYIN_HANYU = 1,
- FULL_PINYIN_LUOMA = 2,
- FULL_PINYIN_SECONDARY_BOPOMOFO = 3,
- FULL_PINYIN_DEFAULT = FULL_PINYIN_HANYU
-};
-
-/**
- * @brief enums of Chewing Schemes.
- */
-enum ChewingScheme
+enum ZhuyinScheme
{
CHEWING_STANDARD = 1,
CHEWING_HSU = 2,
@@ -88,7 +76,11 @@ enum ChewingScheme
CHEWING_STANDARD_DVORAK = 7,
CHEWING_HSU_DVORAK = 8,
CHEWING_DACHEN_CP26 = 9,
- CHEWING_DEFAULT = CHEWING_STANDARD
+ FULL_PINYIN_HANYU = 10,
+ FULL_PINYIN_LUOMA = 11,
+ FULL_PINYIN_SECONDARY_BOPOMOFO = 12,
+ CHEWING_DEFAULT = CHEWING_STANDARD,
+ FULL_PINYIN_DEFAULT = FULL_PINYIN_HANYU
};
G_END_DECLS
diff --git a/src/zhuyin.cpp b/src/zhuyin.cpp
index c1f08a0..267de3f 100644
--- a/src/zhuyin.cpp
+++ b/src/zhuyin.cpp
@@ -36,7 +36,7 @@ typedef GArray * CandidateVector; /* GArray of lookup_candidate_t */
struct _zhuyin_context_t{
pinyin_option_t m_options;
- FullPinyinScheme m_full_pinyin_scheme;
+ ZhuyinScheme m_full_pinyin_scheme;
FullPinyinParser2 * m_full_pinyin_parser;
ChewingParser2 * m_chewing_parser;
@@ -637,7 +637,7 @@ bool zhuyin_save(zhuyin_context_t * context){
}
bool zhuyin_set_chewing_scheme(zhuyin_context_t * context,
- ChewingScheme scheme){
+ ZhuyinScheme scheme){
delete context->m_chewing_parser;
context->m_chewing_parser = NULL;
@@ -663,7 +663,7 @@ bool zhuyin_set_chewing_scheme(zhuyin_context_t * context,
}
bool zhuyin_set_full_pinyin_scheme(zhuyin_context_t * context,
- FullPinyinScheme scheme){
+ ZhuyinScheme scheme){
context->m_full_pinyin_scheme = scheme;
context->m_full_pinyin_parser->set_scheme(scheme);
return true;
diff --git a/src/zhuyin.h b/src/zhuyin.h
index 3b5341c..f0fd9b2 100644
--- a/src/zhuyin.h
+++ b/src/zhuyin.h
@@ -137,7 +137,7 @@ bool zhuyin_save(zhuyin_context_t * context);
*
*/
bool zhuyin_set_chewing_scheme(zhuyin_context_t * context,
- ChewingScheme scheme);
+ ZhuyinScheme scheme);
/**
* zhuyin_set_full_pinyin_scheme:
@@ -149,7 +149,7 @@ bool zhuyin_set_chewing_scheme(zhuyin_context_t * context,
*
*/
bool zhuyin_set_full_pinyin_scheme(zhuyin_context_t * context,
- FullPinyinScheme scheme);
+ ZhuyinScheme scheme);
/**
* zhuyin_fini: