From 4d0e7eebec72ed95b4278161b115f78b0550753a Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Fri, 24 Jul 2020 14:59:16 +0800 Subject: refactor parse_one_key method --- src/storage/pinyin_parser2.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/storage/pinyin_parser2.h') diff --git a/src/storage/pinyin_parser2.h b/src/storage/pinyin_parser2.h index 4a2f0f2..790c0cb 100644 --- a/src/storage/pinyin_parser2.h +++ b/src/storage/pinyin_parser2.h @@ -42,6 +42,7 @@ typedef struct { const char * m_pinyin_input; guint32 m_flags; guint16 m_table_index; + guint16 m_distance; } pinyin_index_item_t; typedef struct { @@ -114,7 +115,7 @@ public: * Parse only one struct ChewingKey from a string. * */ - virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, const char *str, int len) const = 0; + virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, gint16 & distance, const char *str, int len) const = 0; /** * PhoneticParser2::parse: @@ -156,7 +157,7 @@ public: g_array_free(m_parse_steps, TRUE); } - virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, const char *str, int len) const; + virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, gint16 & distance, const char *str, int len) const; /* Note: * the parse method will use dynamic programming to drive parse_one_key. @@ -195,7 +196,7 @@ public: virtual ~DoublePinyinParser2() {} - virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, const char *str, int len) const; + virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, gint16 & distance, const char *str, int len) const; virtual int parse(pinyin_option_t options, ChewingKeyVector & keys, ChewingKeyRestVector & key_rests, const char *str, int len) const; @@ -215,7 +216,7 @@ public: virtual ~PinyinDirectParser2() {} - virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, const char *str, int len) const; + virtual bool parse_one_key(pinyin_option_t options, ChewingKey & key, gint16 & distance, const char *str, int len) const; virtual int parse(pinyin_option_t options, ChewingKeyVector & keys, ChewingKeyRestVector & key_rests, const char *str, int len) const; }; -- cgit