当前位置: 首页>>代码示例>>C++>>正文


C++ LString::size方法代码示例

本文整理汇总了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' ;
}
开发者ID:FabricioLince,项目名称:http_tests,代码行数:16,代码来源:teste001.cpp

示例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;
}
开发者ID:berezhkovskaya,项目名称:Carousel3D,代码行数:31,代码来源:Console.cpp

示例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();
}
开发者ID:berezhkovskaya,项目名称:Carousel3D,代码行数:94,代码来源:Console.cpp


注:本文中的LString::size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。