summaryrefslogtreecommitdiffstats
path: root/src/storage/pinyin_parser2.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/storage/pinyin_parser2.h')
-rw-r--r--src/storage/pinyin_parser2.h51
1 files changed, 44 insertions, 7 deletions
diff --git a/src/storage/pinyin_parser2.h b/src/storage/pinyin_parser2.h
index 0a81cf3..750f23c 100644
--- a/src/storage/pinyin_parser2.h
+++ b/src/storage/pinyin_parser2.h
@@ -170,6 +170,49 @@ public:
virtual bool in_chewing_scheme(pinyin_option_t options, const char key, gchar ** & symbols) const = 0;
};
+
+ /**
+ * ChewingSimpleParser2:
+ *
+ * Parse the chewing string into an array of struct ChewingKeys.
+ *
+ * Several keyboard scheme are supported:
+ * * CHEWING_STANDARD Standard ZhuYin keyboard, which maps 1 to Bo(ㄅ), q to Po(ㄆ) etc.
+ * * CHEWING_IBM IBM ZhuYin keyboard, which maps 1 to Bo(ㄅ), 2 to Po(ㄆ) etc.
+ * * CHEWING_GINYIEH Gin-Yieh ZhuYin keyboard.
+ * * CHEWING_ETEN Eten (倚天) ZhuYin keyboard.
+ * * CHEWING_STANDARD_DVORAK Standard Dvorak ZhuYin keyboard
+ *
+ */
+
+class ChewingSimpleParser2 : public PhoneticParser2
+{
+ /* internal options for chewing parsing. */
+ pinyin_option_t m_options;
+
+ /* Note: some internal pointers to chewing scheme table. */
+protected:
+ const chewing_symbol_item_t * m_symbol_table;
+ const chewing_tone_item_t * m_tone_table;
+
+public:
+ ChewingSimpleParser2() {
+ m_symbol_table = NULL; m_tone_table = NULL;
+ set_scheme(CHEWING_DEFAULT);
+ }
+
+ virtual ~ChewingSimpleParser2() {}
+
+ virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, const char *str, int len) const;
+
+ virtual int parse(pinyin_option_t options, ChewingKeyVector & keys, ChewingKeyRestVector & key_rests, const char *str, int len) const;
+
+public:
+ bool set_scheme(ZhuyinScheme scheme);
+ bool in_chewing_scheme(pinyin_option_t options, const char key, const char ** symbol) const;
+};
+
+
/**
* ChewingDiscreteParser2:
*
@@ -177,12 +220,6 @@ public:
*
* Initially will support HSU, HSU Dvorak and ETEN26.
*
- * Several keyboard scheme are supported:
- * * Chewing_STANDARD Standard ZhuYin keyboard.
- * * Chewing_IBM IBM ZhuYin keyboard.
- * * Chewing_GINYIEH Gin-Yieh ZhuYin keyboard.
- * * Chewing_ETEN Eten (倚天) ZhuYin keyboard.
- * * ...
*/
class ChewingDiscreteParser2 : public ChewingParser2
@@ -205,7 +242,7 @@ public:
m_chewing_index = NULL; m_chewing_index_len = 0;
m_initial_table = NULL; m_middle_table = NULL;
m_final_table = NULL; m_tone_table = NULL;
- set_scheme(CHEWING_DEFAULT);
+ set_scheme(CHEWING_HSU);
}
virtual ~ChewingDiscreteParser2() {}