本文整理汇总了C++中LString::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ LString::empty方法的具体用法?C++ LString::empty怎么用?C++ LString::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LString
的用法示例。
在下文中一共展示了LString::empty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetPropertyC
void clConsole::SetPropertyC( const LString& Param )
{
LString ObjID = LStr::GetToken( Param, 1 );
LString PropID = LStr::GetToken( Param, 2 );
LString PropVal = LStr::GetToken( Param, 3 );
if ( ObjID.empty() || PropID.empty() || PropVal.empty() )
{
Env->Console->DisplayInfoTip( "Usage: SETPROPERTY <ObjectID> <Property name> <Property value>" );
return;
}
Env->Linker->SetObjectProperty( ObjID, PropID, PropVal );
}
示例2: GetCorrectMapName
LString GetCorrectMapName( sEnvironment* Env, const LString& Name )
{
if ( Env->FileSystem->FileExists( Name ) )
{
return Name;
}
LString FileName;
LString FileExt;
Env->FileSystem->SplitPath( Name, NULL, NULL, &FileName, &FileExt );
LString MapName = FileName + FileExt;
if ( Env->FileSystem->FileExists( MapName ) )
{
return MapName;
}
if ( !Name.empty() )
{
Env->Console->DisplayError( "Material map not found: " + Name );
}
return "";
}
示例3: 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;
}
示例4: ReCacheC
void clResourcesManager::ReCacheC( const LString& Param )
{
guard( "%s", Param.c_str() );
if ( Param.empty() )
{
Env->Console->DisplayInfoTip( "Usage: RECACHE <file name>" );
return;
}
iResource* Resource = Env->Resources->FindResourceInGraph( FResourcesGraph, Param );
if ( !Resource )
{
Env->Console->DisplayError( "Unable to find resource: " + Param );
return;
}
Env->Console->DisplayInfoTip( Resource->GetFileName() );
Env->Console->Display( "Recaching " + Resource->ClassName() );
Resource->ReloadResource( true );
unguard();
}
示例5: InitOpenAL
void clAudioThread::InitOpenAL()
{
#if L_AUDIO_USE_OPENAL
guard();
// Env->Logger->Log( L_LOG, "Initializing OpenAL..." );
LString DeviceName = Env->Console->GetVarValueStr( "Audio.AudioDeviceName", "" );
FDevice = alcOpenDevice( DeviceName.empty() ? NULL : DeviceName.c_str() );
FATAL( !FDevice, "Unable to open OpenAL device" );
FContext = alcCreateContext( FDevice, NULL );
FATAL( !FContext, "Unable to create OpenAL context" );
FATAL( !alcMakeContextCurrent( FContext ), "Unable to select OpenAL context" );
Env->Logger->LogP( L_LOG, "OpenAL (%s, %s, %s), extensions : %s", alGetString( AL_VERSION ), alGetString( AL_VENDOR ), alGetString( AL_RENDERER ), alGetString( AL_EXTENSIONS ) );
// Env->Logger->Log( L_LOG, "OpenAL vendor : " + LString( ) );
// Env->Logger->Log( L_LOG, "OpenAL renderer : " + LString( alGetString( AL_RENDERER ) ) );
// Env->Logger->Log( L_LOG, "OpenAL extensions: " );
/*
{
LString Extensions;
Extensions.assign( alGetString( AL_EXTENSIONS ) );
LStr::ReplaceAll( &Extensions, ' ', '\n' );
Env->Logger->Log( L_LOG, '\n' + Extensions );
}
*/
unguard();
#endif
}
示例6: SetLogLevelC
void clConsole::SetLogLevelC(const LString& Params)
{
if(Params.empty())
{
Env->Console->DisplayInfoTip( "Usage: SetLogLevel <Level: Paranoid, Debug, Notice, Log, Warning>" );
return;
}
Env->SetLogLevel( StringToLogLevel( LStr::GetTrimmedSpaces(Params) ) );
}
示例7: AliasC
void clConsole::AliasC( const LString& Param )
{
guard();
LString Alias = LStr::GetUpper( LStr::GetToken( Param, 1 ) );
LString Command = LStr::GetToken( Param, 2 );
if ( Alias.empty() || Command.empty() )
{
DisplayInfoTip( "Usage: ALIAS <Alias name> <Command>" );
return;
}
FATAL( FCommandsList.find( Command ) != FCommandsList.end(), "Aliases cann't override commands: " + Alias );
FAliasesList[ Alias ] = Command;
unguard();
}
示例8: ExecC
void clConsole::ExecC( const LString& Param )
{
guard();
LString Parameter = Param;
LStr::TrimSpaces( &Parameter );
if ( Parameter.empty() )
{
DisplayInfoTip( "Usage: EXEC <File Name>" );
return;
}
LString FName = LStr::GetToken( Parameter, 1 );
Env->Logger->LogP( L_DEBUG, "Exec: %s", FName.c_str() );
if ( Env->FileSystem->FileExists( FName ) )
{
iIStream* FCFGStream = Env->FileSystem->CreateFileReader( FName );
while ( !FCFGStream->Eof() )
{
LString Cmd = FCFGStream->ReadLine();
LStr::TrimSpaces( &Cmd );
if ( !Cmd.empty() && Cmd.at( 0 ) != ';' )
{
SendCommand( Cmd );
}
}
delete( FCFGStream );
}
else
{
Env->Logger->LogP( L_WARNING, "Config file %s not found", FName.c_str() );
DisplayError( "Config file \"" + FName + "\" not found" );
}
unguard();
}
示例9: PreCacheC
void clResourcesManager::PreCacheC( const LString& Param )
{
if ( Param.empty() )
{
Env->Console->DisplayInfoTip( "Usage: PRECACHE <shader or texture file name>" );
return;
}
Env->Console->Display( "Precaching shader... " + Param );
Env->Resources->LoadShader( Param );
}
示例10: LoadMaterialMap
LString LoadMaterialMap( sEnvironment* Env, const LString& FileName, clRenderState* Shader, LMatSysSlot Slot, iTexture* OverridenTex, const LString& Define, LTextureType Type )
{
if ( OverridenTex )
{
Shader->SetTexture( Slot, OverridenTex, false );
return Define;
}
if ( !FileName.empty() )
{
Shader->SetTexture( Slot, Env->Resources->LoadImg( FileName, Type )->GetTexture(), false );
return Define;
}
return "";
}
示例11: SaveVarsC
void clConsole::SaveVarsC( const LString& Param )
{
if ( Param.empty() )
{
DisplayInfoTip( "Usage: SAVEVARS <FileName>" );
return;
}
iOStream* Output = Env->FileSystem->CreateFileWriter( Param );
for ( size_t i = 0; i != FCVars.size(); ++i )
{
Output->WriteLine( FCVars[i]->GetObjectID() + " \"" + FCVars[i]->GetString() + "\"" );
}
delete( Output );
DisplayInfoTip( LStr::ToStr( ( int )FCVars.size() ) + " vars were saved into " + Param );
}
示例12: ExecuteScriptCode
LString clConsole::ExecuteScriptCode( const LString& ScriptCode, bool DisplayResult )
{
// delayed initilaization :
if ( !FScriptCompiler->IsInitialized() )
{
InitializeScript();
}
LString Code = FScriptCompiler->CompileStatement( ScriptCode );
if ( !Code.empty() )
{
std::vector<LString> CodeLines;
LStr::LineToMultiline( Code, CodeLines );
LString Result = Env->Linker->ExecuteCode( CodeLines );
if ( DisplayResult )
{
Display( "Result = " + Result );
}
FSendCommandResult = Result;
}
else
{
if ( DisplayResult )
{
Display( "Error while compiling statement" );
}
FSendCommandResult.assign( "" );
}
return FSendCommandResult;
}
示例13: GetRenderStateForPass
clRenderState* sMaterialDesc::GetRenderStateForPass( sEnvironment* Env, const sMaterialDesc& Material, LMatSysPass Pass ) const
{
guard();
bool MaterialExists = Env->FileSystem->FileExists( Material.FMaterialName.ToString() );
if ( MaterialExists && LStr::ContainsSubStr( Material.FMaterialName.ToString(), ".shader" ) )
{
// just load .shader and don't do anything here
// NOTE: subject to deprecation...
return Env->Resources->LoadShader( Material.FMaterialName.ToString() );
}
LString ShaderProgramName = "MaterialSystem/default.sp";
if ( IsDeferredPass( Pass ) )
{
ShaderProgramName = "MaterialSystem/default_pass1.sp";
}
LString AmbientName = GetCorrectMapName( Env, Material.FAmbientMap.ToString() );
LString DiffuseName = GetCorrectMapName( Env, Material.FDiffuseMap.ToString() );
LString SpecularName = GetCorrectMapName( Env, Material.FSpecularMap.ToString() );
LString BumpName = GetCorrectMapName( Env, Material.FBumpMap.ToString() );
LString NoiseName = "Textures/NoiseVolume.dds";
LString ReflectionName = GetCorrectMapName( Env, Material.FReflectionMap.ToString() );
clRenderState* Shader = Env->Resources->CreateShader();
LString EnabledMaps( "" );
switch ( Pass )
{
case L_MATSYS_PASS_NORMAL:
EnabledMaps = "MATSYS_PASS_NORMAL ";
break;
case L_MATSYS_PASS_SHADOW:
EnabledMaps = "MATSYS_PASS_SHADOW ";
break;
case L_MATSYS_PASS_REFL:
EnabledMaps = "MATSYS_PASS_NORMAL MATSYS_PASS_REFL ";
break;
case L_MATSYS_PASS_DEFERRED_NORMAL:
EnabledMaps = "L_MATSYS_PASS_DEFERRED_NORMAL ";
break;
case L_MATSYS_PASS_DEFERRED_SHADOW:
EnabledMaps = "L_MATSYS_PASS_DEFERRED_SHADOW ";
break;
}
LString MaterialClass = LStr::GetUpper( Material.FMaterialClass.ToString() );
if ( MaterialClass.empty() ) { MaterialClass = "DEFAULT"; }
// parse custom material class
/*
if ( MaterialClass == "CUSTOM" )
{
EnabledMaps += "MATSYS_CUSTOM_MATERIAL ";
}
// parse known material classes
else if ( MaterialClass == "WOOD" )
{
EnabledMaps += "MATSYS_WOOD_MATERIAL ";
}
else if ( MaterialClass == "MARBLE" )
{
EnabledMaps += "MATSYS_MARBLE_MATERIAL ";
}
else if ( MaterialClass == "WATER" )
{
EnabledMaps += "MATSYS_WATER_MATERIAL ";
}
else
{
EnabledMaps += "MATSYS_DEFAULT_MATERIAL ";
}
*/
EnabledMaps += "MATSYS_" + MaterialClass + "_MATERIAL ";
EnabledMaps += LoadMaterialMap( Env, AmbientName, Shader, L_MAT_SLOT_AMBIENT, FAmbientMapOverride, "MATSYS_USE_AMBIENT_MAP ", L_TEXTURE_2D );
EnabledMaps += LoadMaterialMap( Env, DiffuseName, Shader, L_MAT_SLOT_DIFFUSE, FDiffuseMapOverride, "MATSYS_USE_DIFFUSE_MAP ", L_TEXTURE_2D );
EnabledMaps += LoadMaterialMap( Env, SpecularName, Shader, L_MAT_SLOT_SPECULAR, FSpecularMapOverride, "MATSYS_USE_SPECULAR_MAP ", L_TEXTURE_2D );
EnabledMaps += LoadMaterialMap( Env, BumpName, Shader, L_MAT_SLOT_BUMP, FBumpMapOverride, "MATSYS_USE_BUMP_MAP ", L_TEXTURE_2D );
EnabledMaps += LoadMaterialMap( Env, NoiseName, Shader, L_MAT_SLOT_NOISE, NULL, "", L_TEXTURE_3D );
EnabledMaps += LoadMaterialMap( Env, ReflectionName, Shader, L_MAT_SLOT_REFLECT, FReflectionMapOverride, "MATSYS_USE_REFLECTION_MAP ", L_TEXTURE_CUBE );
Env->Logger->Log( L_NOTICE, "Setting transparency" );
if ( Material.FProperties.FTransparency > 0.0f )
{
Shader->SetBlending( L_SRC_ALPHA, L_ONE_MINUS_SRC_ALPHA );
EnabledMaps += "MATSYS_TRANSPARENT ";
}
if ( Material.FAlphaTransparency )
{
Shader->SetBlending( L_SRC_ALPHA, L_ONE_MINUS_SRC_ALPHA );
EnabledMaps += "MATSYS_ALPHATRANSPARENCY ";
}
//.........这里部分代码省略.........
示例14: BindConsoleVariableS
void iGUIView::BindConsoleVariableS( const LString& VarName )
{
if ( !VarName.empty() ) { FConsoleVariable = Env->Console->GetVar( VarName ); }
else { FConsoleVariable = NULL; }
}
示例15: SetEnableVarName
void iPostprocessor::SetEnableVarName( const LString& EnableVarName )
{
FEnableVar = EnableVarName.empty() ? NULL : Env->Console->GetVar( EnableVarName );
}