本文整理汇总了C++中CStdStringW::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ CStdStringW::clear方法的具体用法?C++ CStdStringW::clear怎么用?C++ CStdStringW::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStdStringW
的用法示例。
在下文中一共展示了CStdStringW::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateLabel
void CGUIDialogKeyboardGeneric::UpdateLabel() // FIXME seems to be called twice for one USB SDL keyboard action/character
{
CGUILabelControl* pEdit = ((CGUILabelControl*)GetControl(CTL_LABEL_EDIT));
if (pEdit)
{
CStdStringW edit = m_strEdit;
pEdit->SetHighlight(0, 0);
pEdit->SetSelection(0, 0);
if (m_hiddenInput)
{ // convert to *'s
edit.clear();
if (m_lastRemoteClickTime + REMOTE_SMS_DELAY > CTimeUtils::GetFrameTime() && m_iCursorPos > 0)
{ // using the remove to input, so display the last key input
edit.append(m_iCursorPos - 1, L'*');
edit.append(1, m_strEdit[m_iCursorPos - 1]);
}
else
edit.append(m_strEdit.size(), L'*');
}
else if (!m_strEditing.empty())
{
edit.insert(m_iCursorPos, m_strEditing);
pEdit->SetHighlight(m_iCursorPos, m_iCursorPos + m_strEditing.size());
if (m_iEditingLength > 0)
pEdit->SetSelection(m_iCursorPos + m_iEditingOffset, m_iCursorPos + m_iEditingOffset + m_iEditingLength);
}
// convert back to utf8
CStdString utf8Edit;
g_charsetConverter.wToUTF8(edit, utf8Edit);
pEdit->SetLabel(utf8Edit);
// Send off a search message
unsigned int now = CTimeUtils::GetFrameTime();
// don't send until the REMOTE_SMS_DELAY has passed
if (m_lastRemoteClickTime && m_lastRemoteClickTime + REMOTE_SMS_DELAY >= now)
return;
if (m_pCharCallback)
{
// do not send editing text comes from system input method
if (!m_hiddenInput && !m_strEditing.empty())
g_charsetConverter.wToUTF8(m_strEdit, utf8Edit);
m_pCharCallback(this, utf8Edit);
}
}
}
示例2: strW
static BOOL CALLBACK DSEnumCallback(LPGUID lpGuid, LPCTSTR lpcstrDescription, LPCTSTR lpcstrModule, LPVOID lpContext)
{
DSDevice dev;
std::list<DSDevice> &enumerator = *static_cast<std::list<DSDevice>*>(lpContext);
int bufSize = MultiByteToWideChar(CP_ACP, 0, lpcstrDescription, -1, NULL, 0);
CStdStringW strW (L"", bufSize);
if ( bufSize == 0 || MultiByteToWideChar(CP_ACP, 0, lpcstrDescription, -1, strW.GetBuf(bufSize), bufSize) != bufSize )
strW.clear();
strW.RelBuf();
dev.name = localWideToUtf(strW);
dev.lpGuid = lpGuid;
if (lpGuid)
enumerator.push_back(dev);
return TRUE;
}
示例3: BidiTransform
// BidiTransform is used to handle RTL text flipping in the string
void CGUITextLayout::BidiTransform(vector<CGUIString> &lines, bool forceLTRReadingOrder)
{
for (unsigned int i=0; i<lines.size(); i++)
{
CGUIString &line = lines[i];
// reserve enough space in the flipped text
vecText flippedText;
flippedText.reserve(line.m_text.size());
character_t sectionStyle = 0xffff0000; // impossible to achieve
CStdStringW sectionText;
for (vecText::iterator it = line.m_text.begin(); it != line.m_text.end(); ++it)
{
character_t style = *it & 0xffff0000;
if (style != sectionStyle)
{
if (!sectionText.IsEmpty())
{ // style has changed, bidi flip text
CStdStringW sectionFlipped = BidiFlip(sectionText, forceLTRReadingOrder);
for (unsigned int j = 0; j < sectionFlipped.size(); j++)
flippedText.push_back(sectionStyle | sectionFlipped[j]);
}
sectionStyle = style;
sectionText.clear();
}
sectionText.push_back( (wchar_t)(*it & 0xffff) );
}
// handle the last section
if (!sectionText.IsEmpty())
{
CStdStringW sectionFlipped = BidiFlip(sectionText, forceLTRReadingOrder);
for (unsigned int j = 0; j < sectionFlipped.size(); j++)
flippedText.push_back(sectionStyle | sectionFlipped[j]);
}
// replace the original line with the proccessed one
lines[i] = CGUIString(flippedText.begin(), flippedText.end(), line.m_carriageReturn);
}
}