本文整理汇总了C++中WideString::compare方法的典型用法代码示例。如果您正苦于以下问题:C++ WideString::compare方法的具体用法?C++ WideString::compare怎么用?C++ WideString::compare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WideString
的用法示例。
在下文中一共展示了WideString::compare方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
ArrayInstance::space_key_press()
{
// space is the page down key when keying symbols and phrases
if (m_lookup_table.number_of_candidates() > m_lookup_table.get_page_size())
{
lookup_table_page_down();
return;
}
WideString inkey = m_preedit_string;
// If the user is already press the space before,
// commit the first candidate in the lookup table
if (commit_press_count == 1)
{
WideString str = m_lookup_table.get_candidate_in_current_page (0);
if (str.compare(utf8_mbstowcs(SCIM_ARRAY_EMPTY_CHAR)) == 0) {
hide_lookup_table();
return;
}
if (str.length()) {
send_commit_string(inkey, str);
return;
}
}
create_lookup_table(_ScimArray::Array_Table);
update_lookup_table(m_lookup_table);
if (m_lookup_table.number_of_candidates() > 1)
{
show_lookup_table();
commit_press_count++;
return;
}
hide_lookup_table();
WideString str = m_lookup_table.get_candidate_in_current_page (0);
if (str.length() && str.compare(utf8_mbstowcs(SCIM_ARRAY_EMPTY_CHAR))) {
send_commit_string(inkey, str);
return;
}
}
示例2: reset
bool
ArrayInstance::process_key_event (const KeyEvent& rawkey)
{
KeyEvent key = rawkey.map_to_layout(SCIM_KEYBOARD_Default);
if (key.is_key_release ()) return false;
// English/Chinese change mode key
if ( match_key_event(m_factory->m_ench_key, key))
{
trigger_property(SCIM_PROP_STATUS);
return true;
}
// Full/Half width chang mode key
if ( match_key_event(m_factory->m_full_half_key, key))
{
trigger_property(SCIM_PROP_LETTER);
return true;
}
// if in forward mode
if (m_forward)
{
if ( key.code >= SCIM_KEY_space && key.code <= SCIM_KEY_asciitilde)
{
if (m_full_width_letter)
{
char widthc = key.get_ascii_code();
WideString outws;
outws.push_back(scim_wchar_to_full_width(widthc));
commit_string(outws);
return true;
}
else
return false;
}
else
return false;
}
//reset key
if (key.code == SCIM_KEY_Escape && key.mask == 0) {
// Do not catch ESC while no key input for VI users
if (m_preedit_string.size() == 0)
return false;
reset ();
return true;
}
//delete key
if (key.code == SCIM_KEY_BackSpace && key.mask == 0 &&
m_preedit_string.size () != 0)
{
m_preedit_string.erase (m_preedit_string.length () - 1, 1);
pre_update_preedit_string (m_preedit_string);
process_preedit_string ();
commit_press_count = 0; // reset to 0 to avoid output error
return true;
}
// valid keys
if (((key.code >= SCIM_KEY_a && key.code <= SCIM_KEY_z) ||
(key.code == SCIM_KEY_comma) || (key.code == SCIM_KEY_period) ||
(key.code == SCIM_KEY_semicolon) || (key.code == SCIM_KEY_slash))
&&
(key.mask == 0))
{
if (m_preedit_string.length () >= m_max_preedit_len)
return true;
if (commit_press_count == 1)
{
WideString str = m_lookup_table.get_candidate_in_current_page (0);
if (str.length() && str.compare(utf8_mbstowcs(SCIM_ARRAY_EMPTY_CHAR)) != 0 ) {
send_commit_string(m_preedit_string,
m_lookup_table.get_candidate_in_current_page(0));
}
else
reset();
}
if (m_preedit_string.length () == 0)
{
hide_aux_string ();
show_preedit_string ();
}
ucs4_t ascii = (ucs4_t) tolower (key.get_ascii_code ());
m_preedit_string.push_back (ascii);
pre_update_preedit_string (m_preedit_string);
process_preedit_string ();
return true;
}
// apostrophe key for end of phrases
if (m_use_phrases && key.code == SCIM_KEY_apostrophe
&& m_preedit_string.length())
{
//.........这里部分代码省略.........