本文整理汇总了C++中MemoryOutputStream::appendUTF8Char方法的典型用法代码示例。如果您正苦于以下问题:C++ MemoryOutputStream::appendUTF8Char方法的具体用法?C++ MemoryOutputStream::appendUTF8Char怎么用?C++ MemoryOutputStream::appendUTF8Char使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemoryOutputStream
的用法示例。
在下文中一共展示了MemoryOutputStream::appendUTF8Char方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseString
static Result parseString (const juce_wchar quoteChar, String::CharPointerType& t, var& result)
{
MemoryOutputStream buffer (256);
for (;;)
{
juce_wchar c = t.getAndAdvance();
if (c == quoteChar)
break;
if (c == '\\')
{
c = t.getAndAdvance();
switch (c)
{
case '"':
case '\'':
case '\\':
case '/': break;
case 'a': c = '\a'; break;
case 'b': c = '\b'; break;
case 'f': c = '\f'; break;
case 'n': c = '\n'; break;
case 'r': c = '\r'; break;
case 't': c = '\t'; break;
case 'u':
{
c = 0;
for (int i = 4; --i >= 0;)
{
const int digitValue = CharacterFunctions::getHexDigitValue (t.getAndAdvance());
if (digitValue < 0)
return createFail ("Syntax error in unicode escape sequence");
c = (juce_wchar) ((c << 4) + digitValue);
}
break;
}
}
}
if (c == 0)
return createFail ("Unexpected end-of-input in string constant");
buffer.appendUTF8Char (c);
}
result = buffer.toUTF8();
return Result::ok();
}
示例2: readChildElements
//.........这里部分代码省略.........
}
}
else // must be a character block
{
input = preWhitespaceInput; // roll back to include the leading whitespace
MemoryOutputStream textElementContent;
bool contentShouldBeUsed = ! ignoreEmptyTextElements;
for (;;)
{
const juce_wchar c = *input;
if (c == '<')
{
if (input[1] == '!' && input[2] == '-' && input[3] == '-')
{
input += 4;
const int closeComment = input.indexOf (CharPointer_ASCII ("-->"));
if (closeComment < 0)
{
setLastError ("unterminated comment", false);
outOfData = true;
return;
}
input += closeComment + 3;
continue;
}
break;
}
if (c == 0)
{
setLastError ("unmatched tags", false);
outOfData = true;
return;
}
if (c == '&')
{
String entity;
readEntity (entity);
if (entity.startsWithChar ('<') && entity [1] != 0)
{
const String::CharPointerType oldInput (input);
const bool oldOutOfData = outOfData;
input = entity.getCharPointer();
outOfData = false;
while (XmlElement* n = readNextElement (true))
childAppender.append (n);
input = oldInput;
outOfData = oldOutOfData;
}
else
{
textElementContent << entity;
contentShouldBeUsed = contentShouldBeUsed || entity.containsNonWhitespaceChars();
}
}
else
{
for (;; ++input)
{
juce_wchar nextChar = *input;
if (nextChar == '\r')
{
nextChar = '\n';
if (input[1] == '\n')
continue;
}
if (nextChar == '<' || nextChar == '&')
break;
if (nextChar == 0)
{
setLastError ("unmatched tags", false);
outOfData = true;
return;
}
textElementContent.appendUTF8Char (nextChar);
contentShouldBeUsed = contentShouldBeUsed || ! CharacterFunctions::isWhitespace (nextChar);
}
}
}
if (contentShouldBeUsed)
childAppender.append (XmlElement::createTextElement (textElementContent.toUTF8()));
}
}
}