From b17795c4a34228f6f3962309ccb0fefe05e2fb3a Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Tue, 16 Aug 2011 15:33:54 +0800 Subject: refine pinyin parser --- src/storage/pinyin_base.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/storage/pinyin_base.h') diff --git a/src/storage/pinyin_base.h b/src/storage/pinyin_base.h index 56b260f..7b8b48f 100644 --- a/src/storage/pinyin_base.h +++ b/src/storage/pinyin_base.h @@ -26,6 +26,7 @@ #ifndef PINYIN_BASE_H #define PINYIN_BASE_H +#include #include namespace pinyin{ @@ -634,14 +635,14 @@ public: * * @return the number of chars were actually used. */ - virtual int parse_one_key (const PinyinValidator &validator, PinyinKey &key, const char *str, int len = -1) const = 0; + virtual int parse_one_key (const PinyinValidator &validator, PinyinKey &key, const char *str, int len) const = 0; /** * @brief Handy wrapper function of parse_one_key(), which accept a String object instead of char *. */ int parse_one_key (const PinyinValidator &validator, PinyinKey &key, const char * &str) const { - return parse_one_key (validator, key, str, g_utf8_strlen (str, -1)); + return parse_one_key (validator, key, str, strlen (str)); } /** @@ -670,7 +671,7 @@ class PinyinDefaultParser : public PinyinParser public: virtual ~PinyinDefaultParser (); - virtual int parse_one_key (const PinyinValidator &validator, PinyinKey &key, const char *str, int len = -1) const; + virtual int parse_one_key (const PinyinValidator &validator, PinyinKey &key, const char *str, int len) const; virtual int parse (const PinyinValidator &validator, PinyinKeyVector & keys, PinyinKeyPosVector & poses, const char *str, int len = -1) const; public: @@ -696,7 +697,7 @@ public: virtual ~PinyinShuangPinParser (); - virtual int parse_one_key (const PinyinValidator &validator, PinyinKey &key, const char *str, int len = -1) const; + virtual int parse_one_key (const PinyinValidator &validator, PinyinKey &key, const char *str, int len) const; virtual int parse (const PinyinValidator &validator, PinyinKeyVector &keys, PinyinKeyPosVector & poses, const char *str, int len = -1) const; public: -- cgit