summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-09-24 11:00:22 +0800
committerPeng Wu <alexepico@gmail.com>2013-09-24 11:13:14 +0800
commit2c9bb02d7f3e7b081952dac4746b901e8f76d77e (patch)
treeb2a00952e375631c8ab20d20397946e8c35f80d7
parentd6839ba44930779be257ecf1f3bfb756725432f0 (diff)
downloadlibzhuyin-2c9bb02d7f3e7b081952dac4746b901e8f76d77e.tar.gz
libzhuyin-2c9bb02d7f3e7b081952dac4746b901e8f76d77e.tar.xz
libzhuyin-2c9bb02d7f3e7b081952dac4746b901e8f76d77e.zip
write in_chewing_scheme method
-rw-r--r--src/storage/pinyin_parser2.cpp28
-rw-r--r--src/storage/pinyin_parser2.h2
2 files changed, 30 insertions, 0 deletions
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index b636117..b573984 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -443,6 +443,34 @@ bool FullPinyinParser2::set_scheme(PinyinScheme scheme){
}
+static const char * pinyin_symbols[27] = {
+ "a", "b", "c", "d", "e", "f", "g",
+ "h", "i", "j", "k", "l", "m", "n",
+ "o", "p", "q", "r", "s", "t",
+ "u", "v", "w", "x", "y", "z",
+ "'"
+};
+
+bool FullPinyinParser2::in_chewing_scheme(pinyin_option_t options,
+ const char key,
+ const char ** symbol) const {
+ int id;
+ if ('a' <= key && key <= 'z') {
+ id = key - 'a';
+ *symbol = pinyin_symbols[id];
+ return true;
+ }
+
+ if ('\'' == key) {
+ id = 26;
+ *symbol = pinyin_symbols[id];
+ return true;
+ }
+
+ return false;
+}
+
+
/* the chewing string must be freed with g_free. */
static bool search_chewing_symbols(const chewing_symbol_item_t * symbol_table,
const char key, const char ** chewing) {
diff --git a/src/storage/pinyin_parser2.h b/src/storage/pinyin_parser2.h
index 948b0a3..472ba5e 100644
--- a/src/storage/pinyin_parser2.h
+++ b/src/storage/pinyin_parser2.h
@@ -143,6 +143,7 @@ public:
public:
bool set_scheme(PinyinScheme scheme);
+ bool in_chewing_scheme(pinyin_option_t options, const char key, const char ** symbol) const;
};
@@ -195,6 +196,7 @@ public:
bool in_chewing_scheme(pinyin_option_t options, const char key, const char ** symbol) const;
};
+
class ChewingDaChenCP26Parser2 : public PhoneticParser2
{
/* some internal pointers to chewing scheme table. */