summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-08-16 15:33:54 +0800
committerPeng Wu <alexepico@gmail.com>2011-08-16 15:33:54 +0800
commitb17795c4a34228f6f3962309ccb0fefe05e2fb3a (patch)
tree6414c2a4805cf703bb32194db954064e6c6fb798
parent96a7737277ae60adf8e724e482199d2f4f3cba84 (diff)
downloadlibpinyin-b17795c4a34228f6f3962309ccb0fefe05e2fb3a.tar.gz
libpinyin-b17795c4a34228f6f3962309ccb0fefe05e2fb3a.tar.xz
libpinyin-b17795c4a34228f6f3962309ccb0fefe05e2fb3a.zip
refine pinyin parser
-rw-r--r--src/storage/pinyin_base.h9
1 files changed, 5 insertions, 4 deletions
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 <string.h>
#include <glib.h>
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: