本文整理汇总了C++中LString::size方法的典型用法代码示例。如果您正苦于以下问题:C++ LString::size方法的具体用法?C++ LString::size怎么用?C++ LString::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LString
的用法示例。
在下文中一共展示了LString::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unescape_url
/** Reduce any %xx escape sequences to the characters they represent. **/
void unescape_url(LString& url)
{
register int i,j;
for(i=0,j=0; j<url.size(); ++i,++j)
{
if((url.at(i) = url[j]) == '%')
{
url.at(i) = x2c(url.at(j+1), url.at(j+2));
j+= 2 ;
}
}
if (i < url.size())
url.at(i) = '\0' ;
}
示例2: GetAutocompleteCommand
LStr::clStringsVector clConsole::GetAutocompleteCommand( const LString& CMDName ) const
{
LStr::clStringsVector Result;
if ( CMDName.empty() ) { return Result; }
LString CMD = LStr::GetUpper( CMDName );
size_t Len = CMD.length();
bool Lower = LStr::IsLower( CMDName[CMDName.size()-1] );
for ( clCommandsList::const_iterator i = FCommandsList.begin(); i != FCommandsList.end(); ++i )
{
if ( LStr::StartsWith( i->first, CMD ) )
{
LString Tail = LStr::CopyFromPosToEnd( i->first, Len );
Result.push_back( CMDName + ( Lower ? LStr::GetLower( Tail ) : Tail ) );
}
}
for ( clAliasesList::const_iterator i = FAliasesList.begin(); i != FAliasesList.end(); ++i )
{
if ( LStr::StartsWith( i->first, CMD ) )
{
LString Tail = LStr::CopyFromPosToEnd( i->first, Len );
Result.push_back( CMDName + ( Lower ? LStr::GetLower( Tail ) : Tail ) );
}
}
return Result;
}
示例3: SendCommand
void clConsole::SendCommand( const LString& CMDName )
{
guard( "%s", CMDName.c_str() );
FSendCommandResult.assign( "" );
if ( CMDName.size() == 0 )
{
return;
}
bool IsScript = ( LStr::GetUpper( LStr::GetToken( CMDName, 1 ) ) == "RS" );
// split command
size_t CommandsSeparator = FindCommandsSeparator( CMDName );
LString ThisCMDString = CMDName;
LString RestCMDString( "" );
if ( !IsScript )
{
if ( CommandsSeparator )
{
ThisCMDString = CMDName.substr( 0, CommandsSeparator );
RestCMDString = CMDName.substr( CommandsSeparator,
CMDName.length() - CommandsSeparator );
if ( RestCMDString.length() > 0 )
{
LStr::pop_front( &RestCMDString );
}
}
}
// extract command name and parameters
LString ThisCMDName = LStr::GetToken( ThisCMDString, 1 );
LString ThisCMDParam = ThisCMDString.substr( ThisCMDName.length(),
ThisCMDString.length() - ThisCMDName.length() );
if ( ThisCMDParam.length() > 0 )
{
LStr::pop_front( &ThisCMDParam );
}
LStr::ToUpper( &ThisCMDName );
if ( IsScript )
{
// execute script and return
ExecuteStatement( ThisCMDParam );
return;
}
if ( ThisCMDName.find( "WAIT" ) == 0 )
{
// Leave the rest of the command until the next frame
if ( CommandsSeparator )
{
QueryCommand( RestCMDString );
}
return;
}
else
{
clCommandsList::const_iterator i = FCommandsList.find( ThisCMDName );
if ( i != FCommandsList.end() )
{
( i->second ).Exec( clFileSystem::ReplaceEnvVars( ThisCMDParam ) );
}
else
{
clAliasesList::const_iterator j = FAliasesList.find( ThisCMDName );
if ( j != FAliasesList.end() )
{
QueryCommand( j->second );
}
else
{
DisplayError( "Unknown command: " + ThisCMDName );
}
}
}
if ( CommandsSeparator )
{
SendCommand( RestCMDString );
}
unguard();
}