本文整理汇总了C++中CStdStringW::end方法的典型用法代码示例。如果您正苦于以下问题:C++ CStdStringW::end方法的具体用法?C++ CStdStringW::end怎么用?C++ CStdStringW::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStdStringW
的用法示例。
在下文中一共展示了CStdStringW::end方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseText
void CGUITextLayout::ParseText(const CStdStringW &text, uint32_t defaultStyle, vecColors &colors, vecText &parsedText)
{
// run through the string, searching for:
// [B] or [/B] -> toggle bold on and off
// [I] or [/I] -> toggle italics on and off
// [COLOR ffab007f] or [/COLOR] -> toggle color on and off
// [CAPS <option>] or [/CAPS] -> toggle capatilization on and off
// uint32_t currentStyle = defaultStyle; // start with the default font's style
// color_t currentColor = 0;
stack<color_t> colorStack;
colorStack.push(0);
// these aren't independent, but that's probably not too much of an issue
// eg [UPPERCASE]Glah[LOWERCASE]FReD[/LOWERCASE]Georeg[/UPPERCASE] will work (lower case >> upper case)
// but [LOWERCASE]Glah[UPPERCASE]FReD[/UPPERCASE]Georeg[/LOWERCASE] won't
#define FONT_STYLE_UPPERCASE 4
#define FONT_STYLE_LOWERCASE 8
int boldCounter = 0;
int italicsCoutner = 0;
int upperCounter = 0;
int lowerCounter = 0;
color_t color = 0;
int startPos = 0;
size_t pos = text.Find(L'[');
while (pos != CStdString::npos && pos + 1 < text.size())
{
int style = 0;
if (pos - startPos > 0)
{
if (boldCounter)
style |= FONT_STYLE_BOLD;
if (italicsCoutner)
style |= FONT_STYLE_ITALICS;
CStdStringW subText = text.Mid(startPos, pos - startPos);
if (upperCounter)
{
#if defined(_LINUX) && !defined(__APPLE__)
std::transform(subText.begin(), subText.end(), subText.begin(),
(gunichar(*)(gunichar)) g_unichar_toupper);
#else
subText.ToUpper();
#endif
}
if (lowerCounter)
{
#if defined(_LINUX) && !defined(__APPLE__)
std::transform(subText.begin(), subText.end(), subText.begin(),
(gunichar(*)(gunichar)) g_unichar_tolower);
#else
subText.ToLower();
#endif
}
AppendToUTF32(subText, ((style & 3) << 24) | (color << 16), parsedText);
startPos = pos;
}
// have a [ - check if it's an ON or OFF switch
bool ignoreTag = false;
++pos;
bool on = true;
if (text[pos] == L'/')
{
on = false;
pos++;
}
// check for each type
if (text.Mid(pos,2) == L"B]")
{ // bold - finish the current text block and assign the bold state
pos += 2;
on ? ++boldCounter : --boldCounter;
}
else if (text.Mid(pos,2) == L"I]")
{ // italics
pos += 2;
on ? ++italicsCoutner : --italicsCoutner;
}
else if (text.Mid(pos,10) == L"UPPERCASE]")
{
pos += 10;
on ? ++upperCounter : --upperCounter;
}
else if (text.Mid(pos,10) == L"LOWERCASE]")
{
pos += 10;
on ? ++lowerCounter : --lowerCounter;
}
else if (text.Mid(pos,3) == L"CR]" && on)
//.........这里部分代码省略.........