本文整理汇总了C++中SimpleString::FillArray方法的典型用法代码示例。如果您正苦于以下问题:C++ SimpleString::FillArray方法的具体用法?C++ SimpleString::FillArray怎么用?C++ SimpleString::FillArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleString
的用法示例。
在下文中一共展示了SimpleString::FillArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Encrypt
void Crypto::Encrypt( const SimpleString& Plaintext, const Array< SimpleString >& Keys, Array< char >& OutCiphertext )
{
Array< char > PlaintextArray;
Array< char > KeyArray;
Array< char > CiphertextArray;
Plaintext.FillArray( PlaintextArray );
ConstructKeyFromStrings( Keys, KeyArray );
Encrypt( PlaintextArray, KeyArray, OutCiphertext );
}
示例2: if
SimpleString SimpleString::URLEncodeUTF8() const
{
// First, encode all the usual stuff...
const SimpleString BasicEncoded = URLEncode();
Array<char> EncodedArray;
BasicEncoded.FillArray( EncodedArray, true );
#define PERCENT_ENCODE_CHAR \
{ \
const char c = EncodedArray[ CharIter ]; \
const uint8 UnsignedChar = static_cast<uint8>( c ); \
const SimpleString Encoded = PrintF( "%%%02X", UnsignedChar ); \
const char* const pEncoded = Encoded.CStr(); \
EncodedArray[ CharIter ] = *pEncoded; \
EncodedArray.Insert( *( pEncoded + 1 ), CharIter + 1 ); \
EncodedArray.Insert( *( pEncoded + 2 ), CharIter + 2 ); \
CharIter += 3; \
}
for( uint CharIter = 0; CharIter < EncodedArray.Size(); )
{
const char c = EncodedArray[ CharIter ];
if( ( c & UTF8_2BYTEMASKHIGH ) == UTF8_2BYTEMARKER )
{
// Encode c and following 2 byte
PERCENT_ENCODE_CHAR;
PERCENT_ENCODE_CHAR;
}
else if( ( c & UTF8_3BYTEMASKHIGH ) == UTF8_3BYTEMARKER )
{
// Encode c and following 2 bytes
PERCENT_ENCODE_CHAR;
PERCENT_ENCODE_CHAR;
PERCENT_ENCODE_CHAR;
}
else if( ( c & UTF8_4BYTEMASKHIGH ) == UTF8_4BYTEMARKER )
{
// Encode c and following 3 bytes
PERCENT_ENCODE_CHAR;
PERCENT_ENCODE_CHAR;
PERCENT_ENCODE_CHAR;
PERCENT_ENCODE_CHAR;
}
else
{
++CharIter;
}
}
SimpleString RetVal = EncodedArray;
return RetVal;
}
示例3: Parse
void ConfigParser::Parse( const IDataStream& Stream )
{
Array< SToken > Tokens;
SToken Token;
Token.m_TokenType = SToken::ET_Name;
char StrMark = 0; // Stores the character (either ' or ") that opened a string
SToken MacroToken;
List<int> ArrayCounters;
Array<char> CounterCharArray;
int LineCount = 1;
for(;;)
{
char c = Stream.ReadInt8();
// Skip the UTF-8 byte order mark if present.
if( UTF8_BOM_0 == static_cast<byte>( c ) )
{
CHECK( UTF8_BOM_1 == static_cast<byte>( Stream.ReadInt8() ) );
CHECK( UTF8_BOM_2 == static_cast<byte>( Stream.ReadInt8() ) );
c = Stream.ReadInt8();
}
if( Stream.EOS() )
{
if( Token.m_TokenString.Empty() )
{
Token.m_TokenType = SToken::ET_None;
Tokens.PushBack( Token );
DEBUGCATPRINTF( "Core", 2, "%s\n", SToken::m_TokenNames[ Token.m_TokenType ] );
}
else
{
Token.m_TokenString.PushBack( '\0' );
Tokens.PushBack( Token );
DEBUGCATPRINTF( "Core", 2, "%s: %s\n", SToken::m_TokenNames[ Token.m_TokenType ], Token.m_TokenString.GetData() );
Token.m_TokenString.Clear();
}
break;
}
if( c == '&' )
{
if( Token.m_TokenType == SToken::ET_Name )
{
// Increment the current counter and add it to the current name.
ASSERT( ArrayCounters.Size() > 0 );
List<int>::Iterator CounterIter = ArrayCounters.Back();
( *CounterIter )++;
SimpleString CounterString = SimpleString::PrintF( "%d", *CounterIter );
CounterCharArray.Clear();
CounterString.FillArray( CounterCharArray );
Token.m_TokenString.Append( CounterCharArray );
}
else if( Token.m_TokenType == SToken::ET_None )
{
// Add a new counter
// Push a counter token that will be replaced with the count int later.
ArrayCounters.PushBack( -1 );
Token.m_TokenType = SToken::ET_Counter;
}
else if( Token.m_TokenType == SToken::ET_String )
{
Token.m_TokenString.PushBack( c );
}
else
{
WARNDESC( "Unexpected character '&' in token." );
}
}
else if( c == '^' )
{
if( Token.m_TokenType == SToken::ET_Name )
{
// Add the current counter to the current name.
ASSERT( ArrayCounters.Size() > 0 );
List<int>::Iterator CounterIter = ArrayCounters.Back();
ASSERT( ( *CounterIter ) >= 0 );
SimpleString CounterString = SimpleString::PrintF( "%d", *CounterIter );
CounterCharArray.Clear();
CounterString.FillArray( CounterCharArray );
Token.m_TokenString.Append( CounterCharArray );
}
else if( Token.m_TokenType == SToken::ET_String )
{
Token.m_TokenString.PushBack( c );
}
else
{
WARNDESC( "Unexpected character '^' in token." );
}
}
else if( c == ' ' || c == '\t' )
{
switch( Token.m_TokenType )
{
case SToken::ET_None:
case SToken::ET_Equals:
// Ignore whitespace
//.........这里部分代码省略.........