return NULL;
}
- return m_parser.isPinyin (sheng, 0, PINYIN_INCOMPLETE_PINYIN);
+ return PinyinParser::isPinyin (sheng, 0, PINYIN_INCOMPLETE_PINYIN);
}
inline const Pinyin *
if (sheng == PINYIN_ID_ZERO && yun[0] == PINYIN_ID_ZERO)
return pinyin;
- pinyin = m_parser.isPinyin (sheng, yun[0],
+ pinyin = PinyinParser::isPinyin (sheng, yun[0],
Config::option () & PINYIN_FUZZY_ALL);
if (pinyin == NULL && yun[1] != PINYIN_ID_VOID)
- pinyin = m_parser.isPinyin (sheng, yun[1],
+ pinyin = PinyinParser::isPinyin (sheng, yun[1],
Config::option () & PINYIN_FUZZY_ALL);
return pinyin;
}
void reset (void);
void updateAuxiliaryTextAfter (String &buffer);
-private:
+protected:
gboolean updatePinyin (gboolean all);
+
+private:
const Pinyin *isPinyin (gint i, gint j);
const Pinyin *isPinyin (gint i);
m_pinyin_len = 0;
}
else {
- m_pinyin_len = m_parser.parse (m_text, // text
- m_cursor, // text length
- Config::option (), // option
- m_pinyin, // result
- MAX_PHRASE_LEN); // max result length
+ m_pinyin_len = PinyinParser::parse (m_text, // text
+ m_cursor, // text length
+ Config::option (), // option
+ m_pinyin, // result
+ MAX_PHRASE_LEN); // max result length
}
updatePhraseEditor ();
gboolean moveCursorToBegin (void);
gboolean moveCursorToEnd (void);
-private:
void updatePinyin (void);
};
#define MAX_PINYIN_LEN 64
/* init static members */
-PinyinParser PinyinEditor::m_parser;
-
PinyinEditor::PinyinEditor (PinyinProperties & props)
: Editor (props),
m_pinyin (MAX_PHRASE_LEN),
PhraseEditor m_phrase_editor;
std::vector<std::string> m_special_phrases;
std::string m_selected_special_phrase;
-
-protected:
- static PinyinParser m_parser;
};
};
namespace PY {
class PinyinParser {
-
public:
- PinyinParser (void) {}
- ~PinyinParser (void) {}
-
- guint parse (const String &pinyin, // pinyin string
- gint len, // length of pinyin string
- guint option, // option
- PinyinArray &result, // store pinyin in result
- guint max); // max length of the result
- const Pinyin * isPinyin (gint sheng, gint yun, guint option);
+ static guint parse (const String &pinyin, // pinyin string
+ gint len, // length of pinyin string
+ guint option, // option
+ PinyinArray &result, // store pinyin in result
+ guint max); // max length of the result
+ static const Pinyin * isPinyin (gint sheng, gint yun, guint option);
};
-
};
#endif