本文整理汇总了C++中SimpleString::GetChar方法的典型用法代码示例。如果您正苦于以下问题:C++ SimpleString::GetChar方法的具体用法?C++ SimpleString::GetChar怎么用?C++ SimpleString::GetChar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleString
的用法示例。
在下文中一共展示了SimpleString::GetChar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Parse
//.........这里部分代码省略.........
Token.m_TokenString.PushBack( '\\' );
}
else if( next == 'x' )
{
char Hex = 0;
for( uint HexIndex = 0; HexIndex < 2; ++HexIndex )
{
next = Stream.ReadInt8();
ASSERT( IsHex( next ) );
Hex = ( Hex << 4 ) | GetHex( next );
}
Token.m_TokenString.PushBack( Hex );
}
else if( next == 'u' )
{
// First, extract a unicode code point (e.g. \u00d7 for U+00D7)
// NOTE: This only support the first Unicode plane, and is strict about
// using four characters, so \ud7 is not a valid substitute for \u00d7.
unicode_t CodePoint = 0;
for( uint UnicodeIndex = 0; UnicodeIndex < 4; ++UnicodeIndex )
{
next = Stream.ReadInt8();
ASSERT( IsHex( next ) );
CodePoint = ( CodePoint << 4 ) | GetHex( next );
}
// Then convert the two-byte code point to UTF-8.
Array<unicode_t> CodePointArray;
CodePointArray.PushBack( CodePoint );
const SimpleString UTF8String = SimpleString::SetUTF8( CodePointArray );
for( uint CharIndex = 0; CharIndex < UTF8String.Length(); ++CharIndex )
{
const char NextChar = UTF8String.GetChar( CharIndex );
Token.m_TokenString.PushBack( NextChar );
}
}
else
{
PRINTF( "Unrecognized escape sequence \\%c at line %d\n", next, LineCount );
WARNDESC( "Unrecognized escape sequence" );
}
}
else if( c == 0x0d )
{
// DOS linebreak is 0D 0A, so ignore and expect \n to follow
}
else if( c == '\0' )
{
// Don't know how these are getting in either, but ignore them
}
else if( c == '\n' || c == '\v' )
{
if( Token.m_TokenType == SToken::ET_Macro )
{
MacroToken = Token;
}
// Dunno how vertical tabs are getting in, but treat them as linebreaks
if( Token.m_TokenString.Empty() )
{
if( Token.m_TokenType != SToken::ET_Counter )
{
Token.m_TokenType = SToken::ET_None;
}
Tokens.PushBack( Token );