summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-02-10 14:25:59 +0800
committerPeng Wu <alexepico@gmail.com>2012-02-10 14:25:59 +0800
commit64e3ee153b152091983cf830d214bb20bfa44b46 (patch)
tree49c08ec8ec2772c6c8c85c6d54750c8b3d8d277e
parentb5bec43f6ccd58e6eaf23eea0120bc50afdffb07 (diff)
downloadlibpinyin-64e3ee153b152091983cf830d214bb20bfa44b46.tar.gz
libpinyin-64e3ee153b152091983cf830d214bb20bfa44b46.tar.xz
libpinyin-64e3ee153b152091983cf830d214bb20bfa44b46.zip
fixes in_chewing_scheme
-rw-r--r--src/pinyin.cpp3
-rw-r--r--src/storage/pinyin_parser2.cpp8
-rw-r--r--src/storage/pinyin_parser2.h2
3 files changed, 9 insertions, 4 deletions
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index 4f32c68..e1ec93e 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -425,7 +425,8 @@ size_t pinyin_parse_more_chewings(pinyin_instance_t * instance,
bool pinyin_in_chewing_keyboard(pinyin_instance_t * instance,
const char key, const char ** symbol) {
pinyin_context_t * & context = instance->m_context;
- return context->m_chewing_parser->in_chewing_scheme(key, symbol);
+ return context->m_chewing_parser->in_chewing_scheme
+ (context->m_options, key, symbol);
}
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index ab8330c..494daad 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -777,7 +777,7 @@ int ChewingParser2::parse(pinyin_option_t options, ChewingKeyVector & keys,
int maximum_len = 0; int i;
/* probe the longest possible chewing string. */
for (i = 0; i < len; ++i) {
- if (!in_chewing_scheme(str[i], NULL))
+ if (!in_chewing_scheme(options, str[i], NULL))
break;
}
maximum_len = i;
@@ -835,7 +835,8 @@ bool ChewingParser2::set_scheme(ChewingScheme scheme) {
}
-bool ChewingParser2::in_chewing_scheme(const char key, const char ** symbol)
+bool ChewingParser2::in_chewing_scheme(pinyin_option_t options,
+ const char key, const char ** symbol)
const {
const gchar * chewing = NULL;
char tone = CHEWING_ZERO_TONE;
@@ -846,6 +847,9 @@ bool ChewingParser2::in_chewing_scheme(const char key, const char ** symbol)
return true;
}
+ if (!(options & USE_TONE))
+ return false;
+
if (search_chewing_tones(m_tone_table, key, &tone)) {
if (symbol)
*symbol = chewing_tone_table[tone];
diff --git a/src/storage/pinyin_parser2.h b/src/storage/pinyin_parser2.h
index d651554..2ff46f3 100644
--- a/src/storage/pinyin_parser2.h
+++ b/src/storage/pinyin_parser2.h
@@ -213,7 +213,7 @@ public:
public:
bool set_scheme(ChewingScheme scheme);
- bool in_chewing_scheme(const char key, const char ** symbol) const;
+ bool in_chewing_scheme(pinyin_option_t options, const char key, const char ** symbol) const;
};