add set scheme for chewing parser2
authorPeng Wu <alexepico@gmail.com>
Wed, 23 Nov 2011 07:29:57 +0000 (15:29 +0800)
committerPeng Wu <alexepico@gmail.com>
Wed, 23 Nov 2011 07:29:57 +0000 (15:29 +0800)
src/storage/chewing_key.h
src/storage/pinyin_parser2.cpp
src/storage/pinyin_parser2.h

index b83b5d7..5bbd6ed 100644 (file)
@@ -141,11 +141,9 @@ enum DoublePinyinScheme
 enum ChewingScheme
 {
     CHEWING_STANDARD = 1,
-    CHEWING_HSU      = 2,
-    CHEWING_IBM      = 3,
-    CHEWING_GIN_YIEH = 4,
-    CHEWING_ET       = 5,
-    CHEWING_ET26     = 6,
+    CHEWING_IBM      = 2,
+    CHEWING_GINYIEH  = 3,
+    CHEWING_ETEN     = 4,
     CHEWING_DEFAULT  = CHEWING_STANDARD
 };
 
index b54e7f2..29ea8a4 100644 (file)
@@ -562,3 +562,37 @@ bool DoublePinyinParser2::set_scheme(DoublePinyinScheme scheme) {
 
     return false; /* no such scheme. */
 }
+
+
+bool ChewingParser2::parse_one_key(guint32 options, ChewingKey & key, ChewingKeyRest & key_rest, const char *str, int len) const {
+    assert(FALSE);
+}
+
+
+int ChewingParser2::parse(guint32 options, ChewingKeyVector & keys, ChewingKeyRestVector & key_rests, const char *str, int len) const {
+    assert(FALSE);
+}
+
+
+bool ChewingParser2::set_scheme(ChewingScheme scheme) {
+    switch(scheme) {
+    case CHEWING_STANDARD:
+        m_symbol_table = chewing_standard_symbols;
+        m_tone_table   = chewing_standard_tones;
+        return true;
+    case CHEWING_IBM:
+        m_symbol_table = chewing_ibm_symbols;
+        m_tone_table   = chewing_ibm_tones;
+        return true;
+    case CHEWING_GINYIEH:
+        m_symbol_table = chewing_ginyieh_symbols;
+        m_tone_table   = chewing_ginyieh_tones;
+        return true;
+    case CHEWING_ETEN:
+        m_symbol_table = chewing_eten_symbols;
+        m_tone_table   = chewing_eten_tones;
+        return true;
+    }
+
+    return false;
+}
index b81240e..ea7c796 100644 (file)
@@ -197,8 +197,8 @@ class ChewingParser2 : public PinyinParser2
 {
     /* Note: some internal pointers to chewing scheme table. */
 protected:
-    chewing_symbol_item_t * m_symbol_table;
-    chewing_tone_item_t   * m_tone_table;
+    const chewing_symbol_item_t * m_symbol_table;
+    const chewing_tone_item_t   * m_tone_table;
 
 public:
     ChewingParser2() {