本文整理汇总了C++中CStdStringW::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ CStdStringW::push_back方法的具体用法?C++ CStdStringW::push_back怎么用?C++ CStdStringW::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStdStringW
的用法示例。
在下文中一共展示了CStdStringW::push_back方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.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);
}
}
示例2:
void CGUITextLayout::utf8ToW(const CStdString &utf8, CStdStringW &utf16)
{
#ifdef WORK_AROUND_NEEDED_FOR_LINE_BREAKS
// NOTE: This appears to strip \n characters from text. This may be a consequence of incorrect
// expression of the \n in utf8 (we just use character code 10) or it might be something
// more sinister. For now, we use the workaround below.
CStdStringArray multiLines;
StringUtils::SplitString(utf8, "\n", multiLines);
for (unsigned int i = 0; i < multiLines.size(); i++)
{
CStdStringW line;
g_charsetConverter.utf8ToW(multiLines[i], line);
line.Replace(L"\r", L""); // filter out '\r'
utf16 += line;
if (i < multiLines.size() - 1)
utf16.push_back(L'\n');
}
#else
g_charsetConverter.utf8ToW(utf8, utf16);
#endif
}