本文整理汇总了C++中CStdStringW::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ CStdStringW::empty方法的具体用法?C++ CStdStringW::empty怎么用?C++ CStdStringW::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStdStringW
的用法示例。
在下文中一共展示了CStdStringW::empty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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.empty())
{ // 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.empty())
{
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);
}
}
示例2: InputText
void CGUIDialogKeyboardGeneric::InputText(const CStdString& aTextString)
{
CStdStringW newStr;
g_charsetConverter.utf8ToW(aTextString, newStr);
if (!newStr.empty())
{
m_strEditing.clear();
m_iEditingOffset = 0;
m_strEdit.insert(GetCursorPos(), newStr);
UpdateLabel();
MoveCursor(newStr.size());
}
}
示例3: ProcessText
void CGUIEditControl::ProcessText(unsigned int currentTime)
{
if (m_smsTimer.GetElapsedMilliseconds() > smsDelay)
UpdateText();
if (m_bInvalidated)
{
m_label.SetMaxRect(m_posX, m_posY, m_width, m_height);
m_label.SetText(m_info.GetLabel(GetParentID()));
RecalcLabelPosition();
}
bool changed = false;
m_clipRect.x1 = m_label.GetRenderRect().x1;
m_clipRect.x2 = m_clipRect.x1 + m_label.GetMaxWidth();
m_clipRect.y1 = m_posY;
m_clipRect.y2 = m_posY + m_height;
// start by rendering the normal text
float leftTextWidth = m_label.GetRenderRect().Width();
if (leftTextWidth > 0)
{
// render the text on the left
changed |= m_label.SetColor(GetTextColor());
changed |= m_label.Process(currentTime);
m_clipRect.x1 += leftTextWidth + spaceWidth;
}
if (g_graphicsContext.SetClipRegion(m_clipRect.x1, m_clipRect.y1, m_clipRect.Width(), m_clipRect.Height()))
{
uint32_t align = m_label.GetLabelInfo().align & XBFONT_CENTER_Y; // start aligned left
if (m_label2.GetTextWidth() < m_clipRect.Width())
{ // align text as our text fits
if (leftTextWidth > 0)
{ // right align as we have 2 labels
align |= XBFONT_RIGHT;
}
else
{ // align by whatever the skinner requests
align |= (m_label2.GetLabelInfo().align & 3);
}
}
CStdStringW text = GetDisplayedText();
// add the cursor if we're focused
if (HasFocus() && m_inputType != INPUT_TYPE_READONLY)
{
CStdStringW col;
if ((m_focusCounter % 64) > 32)
col = L"|";
else
col = L"[COLOR 00FFFFFF]|[/COLOR]";
text.insert(m_cursorPos, col);
}
changed |= m_label2.SetMaxRect(m_clipRect.x1 + m_textOffset, m_posY, m_clipRect.Width() - m_textOffset, m_height);
if (text.empty())
changed |= m_label2.SetText(m_hintInfo.GetLabel(GetParentID()));
else
changed |= m_label2.SetTextW(text);
changed |= m_label2.SetAlign(align);
changed |= m_label2.SetColor(GetTextColor());
changed |= m_label2.SetOverflow(CGUILabel::OVER_FLOW_CLIP);
changed |= m_label2.Process(currentTime);
g_graphicsContext.RestoreClipRegion();
}
if (changed)
MarkDirtyRegion();
}