diff --git a/Components/Overlay/src/OgreOverlayElementCommands.cpp b/Components/Overlay/src/OgreOverlayElementCommands.cpp index 85e2a9994c6..63436cf4868 100644 --- a/Components/Overlay/src/OgreOverlayElementCommands.cpp +++ b/Components/Overlay/src/OgreOverlayElementCommands.cpp @@ -89,7 +89,7 @@ namespace Ogre } void CmdMaterial::doSet( void *target, const String &val ) { - if( val != "" ) + if( !val.empty() ) { static_cast( target )->setMaterialName( val ); } diff --git a/OgreMain/src/OgreMeshSerializerImpl.cpp b/OgreMain/src/OgreMeshSerializerImpl.cpp index d1139f9556c..337a063acbc 100644 --- a/OgreMain/src/OgreMeshSerializerImpl.cpp +++ b/OgreMain/src/OgreMeshSerializerImpl.cpp @@ -1599,7 +1599,7 @@ namespace Ogre unsigned short lodNum, MeshLodUsage &usage, uint8 casterPass ) { - usage.manualName = ""; + usage.manualName.clear(); // Get one set of detail per SubMesh unsigned numSubs, i; @@ -3243,7 +3243,7 @@ namespace Ogre unsigned short lodNum, MeshLodUsage &usage, uint8 casterPass ) { - usage.manualName = ""; + usage.manualName.clear(); usage.manualMesh.reset(); pushInnerChunk( stream ); { @@ -3431,7 +3431,7 @@ namespace Ogre readFloats( stream, &( usage.userValue ), 1 ); // Set default values - usage.manualName = ""; + usage.manualName.clear(); usage.manualMesh.reset(); usage.edgeData = NULL; @@ -3835,7 +3835,7 @@ namespace Ogre usage.userValue = Math::Sqrt( usage.value ); // Set default values - usage.manualName = ""; + usage.manualName.clear(); usage.manualMesh.reset(); usage.edgeData = NULL; diff --git a/OgreMain/src/OgreOldNode.cpp b/OgreMain/src/OgreOldNode.cpp index aad24a9d43f..c8a3643c21b 100644 --- a/OgreMain/src/OgreOldNode.cpp +++ b/OgreMain/src/OgreOldNode.cpp @@ -60,7 +60,7 @@ namespace Ogre mListener( 0 ) { // Generate a name - mName = ""; + mName.clear(); needUpdate(); } diff --git a/OgreMain/src/OgreProfiler.cpp b/OgreMain/src/OgreProfiler.cpp index 65cffe4c5f5..8b43a004f54 100644 --- a/OgreMain/src/OgreProfiler.cpp +++ b/OgreMain/src/OgreProfiler.cpp @@ -238,7 +238,7 @@ namespace Ogre // empty string is reserved for the root // not really fatal anymore, however one shouldn't name one's profile as an empty string anyway. - assert( ( profileName != "" ) && ( "Profile name can't be an empty string" ) ); + assert( ( !profileName.empty() ) && ( "Profile name can't be an empty string" ) ); // this would be an internal error. assert( mCurrent ); @@ -355,7 +355,7 @@ namespace Ogre const uint64 endTime = mTimer->getMicroseconds(); // empty string is reserved for designating an empty parent - assert( ( profileName != "" ) && ( "Profile name can't be an empty string" ) ); + assert( ( !profileName.empty() ) && ( "Profile name can't be an empty string" ) ); // we only process this profile if isn't disabled // we check the current instance name against the provided profileName as a guard against @@ -533,7 +533,7 @@ namespace Ogre //----------------------------------------------------------------------- bool Profiler::watchForMax( const String &profileName ) { - assert( ( profileName != "" ) && ( "Profile name can't be an empty string" ) ); + assert( ( !profileName.empty() ) && ( "Profile name can't be an empty string" ) ); return mRoot.watchForMax( profileName ); } @@ -553,7 +553,7 @@ namespace Ogre //----------------------------------------------------------------------- bool Profiler::watchForMin( const String &profileName ) { - assert( ( profileName != "" ) && ( "Profile name can't be an empty string" ) ); + assert( ( !profileName.empty() ) && ( "Profile name can't be an empty string" ) ); return mRoot.watchForMin( profileName ); } //----------------------------------------------------------------------- @@ -572,7 +572,7 @@ namespace Ogre //----------------------------------------------------------------------- bool Profiler::watchForLimit( const String &profileName, Real limit, bool greaterThan ) { - assert( ( profileName != "" ) && ( "Profile name can't be an empty string" ) ); + assert( ( !profileName.empty() ) && ( "Profile name can't be an empty string" ) ); return mRoot.watchForLimit( profileName, limit, greaterThan ); } //----------------------------------------------------------------------- diff --git a/OgreMain/src/OgreRenderSystemCapabilitiesSerializer.cpp b/OgreMain/src/OgreRenderSystemCapabilitiesSerializer.cpp index 8ae1e705fc3..ba6d442b6cb 100644 --- a/OgreMain/src/OgreRenderSystemCapabilitiesSerializer.cpp +++ b/OgreMain/src/OgreRenderSystemCapabilitiesSerializer.cpp @@ -232,7 +232,7 @@ namespace Ogre // skip empty and comment lines // TODO: handle end of line comments - if (tokens[0] == "" || tokens[0].substr(0,2) == "//") + if (tokens[0].empty() || tokens[0].substr(0,2) == "//") continue; switch (parseAction) diff --git a/OgreMain/src/OgreScriptLexer.cpp b/OgreMain/src/OgreScriptLexer.cpp index 9bd4469ceab..b41cf309387 100644 --- a/OgreMain/src/OgreScriptLexer.cpp +++ b/OgreMain/src/OgreScriptLexer.cpp @@ -82,12 +82,12 @@ namespace Ogre if( c == slash && lastc == slash ) { // Comment start, clear out the lexeme - lexeme = ""; + lexeme.clear(); state = COMMENT; } else if( c == star && lastc == slash ) { - lexeme = ""; + lexeme.clear(); state = MULTICOMMENT; } else if( c == quote ) @@ -131,13 +131,13 @@ namespace Ogre case POSSIBLECOMMENT: if( c == slash && lastc == slash ) { - lexeme = ""; + lexeme.clear(); state = COMMENT; break; } else if( c == star && lastc == slash ) { - lexeme = ""; + lexeme.clear(); state = MULTICOMMENT; break; } diff --git a/OgreMain/src/OgreScriptTranslator.cpp b/OgreMain/src/OgreScriptTranslator.cpp index 9d7ed3b8044..c66f08e8502 100644 --- a/OgreMain/src/OgreScriptTranslator.cpp +++ b/OgreMain/src/OgreScriptTranslator.cpp @@ -6374,7 +6374,7 @@ namespace Ogre{ fsaa = atom->value; break; case ID_MSAA_AUTO: - fsaa = ""; + fsaa.clear(); break; case ID_EXPLICIT_RESOLVE: textureFlags |= TextureFlags::MsaaExplicitResolve; diff --git a/RenderSystems/Direct3D11/src/OgreD3D11HLSLProgram.cpp b/RenderSystems/Direct3D11/src/OgreD3D11HLSLProgram.cpp index 748b69c7b1a..889c30c3028 100644 --- a/RenderSystems/Direct3D11/src/OgreD3D11HLSLProgram.cpp +++ b/RenderSystems/Direct3D11/src/OgreD3D11HLSLProgram.cpp @@ -1650,7 +1650,7 @@ namespace Ogre //----------------------------------------------------------------------- void D3D11HLSLProgram::setTarget( const String &target ) { - mTarget = ""; + mTarget.clear(); vector::type profiles = StringUtil::split( target, " " ); for( unsigned int i = 0; i < profiles.size(); i++ ) { @@ -1662,7 +1662,7 @@ namespace Ogre } } - if( mTarget == "" ) + if( mTarget.empty() ) { LogManager::getSingleton().logMessage( "Invalid target for D3D11 shader '" + mName + "' - '" + target + "'" ); diff --git a/Tools/MeshTool/include/XML/tinyxml.h b/Tools/MeshTool/include/XML/tinyxml.h index 20f81a8fe86..a225f40eab0 100644 --- a/Tools/MeshTool/include/XML/tinyxml.h +++ b/Tools/MeshTool/include/XML/tinyxml.h @@ -1481,7 +1481,7 @@ class TiXmlDocument : public TiXmlNode */ void ClearError() { error = false; errorId = 0; - errorDesc = ""; + errorDesc.clear(); errorLocation.row = errorLocation.col = 0; //errorLocation.last = 0; } @@ -1739,8 +1739,8 @@ class TiXmlPrinter : public TiXmlVisitor /** Switch over to "stream printing" which is the most dense formatting without linebreaks. Common when the XML is needed for network transmission. */ - void SetStreamPrinting() { indent = ""; - lineBreak = ""; + void SetStreamPrinting() { indent.clear(); + lineBreak.clear(); } /// Return the result. const char* CStr() { return buffer.c_str(); } diff --git a/Tools/MeshTool/src/XML/OgreXMLMeshSerializer.cpp b/Tools/MeshTool/src/XML/OgreXMLMeshSerializer.cpp index 1289c190e1c..4231bd3288f 100644 --- a/Tools/MeshTool/src/XML/OgreXMLMeshSerializer.cpp +++ b/Tools/MeshTool/src/XML/OgreXMLMeshSerializer.cpp @@ -1627,7 +1627,7 @@ namespace v1 { const LodStrategy *lodStrategy = LodStrategyManager::getSingleton().getStrategy( mMesh->getLodStrategyName() ); usage.value = lodStrategy->transformUserValue(usage.userValue); usage.manualMesh.reset(); - usage.manualName = ""; + usage.manualName.clear(); usage.edgeData = NULL; mMesh->_setLodUsage(index, usage); diff --git a/Tools/MeshTool/src/XML/tinyxmlparser.cpp b/Tools/MeshTool/src/XML/tinyxmlparser.cpp index bc668da37cc..40139384a21 100644 --- a/Tools/MeshTool/src/XML/tinyxmlparser.cpp +++ b/Tools/MeshTool/src/XML/tinyxmlparser.cpp @@ -411,7 +411,7 @@ const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncodi // Oddly, not supported on some comilers, //name->clear(); // So use this: - *name = ""; + name->clear(); assert( p ); // Names start with letters or underscores. @@ -586,7 +586,7 @@ const char* TiXmlBase::ReadText( const char* p, bool caseInsensitive, TiXmlEncoding encoding ) { - *text = ""; + text->clear(); if ( !trimWhiteSpace // certain tags always keep whitespace || !condenseWhiteSpace ) // if true, whitespace is always kept { @@ -1291,7 +1291,7 @@ const char* TiXmlUnknown::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc return 0; } ++p; - value = ""; + value.clear(); while ( p && *p && *p != '>' ) { @@ -1339,7 +1339,7 @@ void TiXmlComment::StreamIn( std::istream * in, TIXML_STRING * tag ) const char* TiXmlComment::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) { TiXmlDocument* document = GetDocument(); - value = ""; + value.clear(); p = SkipWhiteSpace( p, encoding ); @@ -1420,7 +1420,7 @@ const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlE // All attribute values should be in single or double quotes. // But this is such a common error that the parser will try // its best, even without them. - value = ""; + value.clear(); while ( p && *p // existence && !IsWhiteSpace( *p ) && *p != '\n' && *p != '\r' // whitespace && *p != '/' && *p != '>' ) // tag end @@ -1473,7 +1473,7 @@ void TiXmlText::StreamIn( std::istream * in, TIXML_STRING * tag ) const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) { - value = ""; + value.clear(); TiXmlDocument* document = GetDocument(); if ( data ) @@ -1563,9 +1563,9 @@ const char* TiXmlDeclaration::Parse( const char* p, TiXmlParsingData* data, TiXm } p += 5; - version = ""; - encoding = ""; - standalone = ""; + version.clear(); + encoding.clear(); + standalone.clear(); while ( p && *p ) { diff --git a/Tools/MeshTool/src/main.cpp b/Tools/MeshTool/src/main.cpp index bcc85fef1c9..19cbab15a18 100644 --- a/Tools/MeshTool/src/main.cpp +++ b/Tools/MeshTool/src/main.cpp @@ -467,10 +467,10 @@ void buildLod(v1::MeshPtr& mesh) else { std::cout << "Wrong answer!\n"; - response = ""; + response.clear(); } } - while( response == "" ); + while( response.empty() ); } else if (askLodDtls) { @@ -490,10 +490,10 @@ void buildLod(v1::MeshPtr& mesh) else { std::cout << "Wrong answer!\n"; - response = ""; + response.clear(); } } - while( response == "" ); + while( response.empty() ); } } @@ -523,10 +523,10 @@ void buildLod(v1::MeshPtr& mesh) else { std::cout << "Wrong answer!\n"; - response = ""; + response.clear(); } } - while (response == ""); + while (response.empty()); if (!opts.lodAutoconfigure) { do @@ -545,10 +545,10 @@ void buildLod(v1::MeshPtr& mesh) else { std::cout << "Wrong answer!\n"; - response = ""; + response.clear(); } } - while (response == ""); + while (response.empty()); LodLevel lodLevel; size_t vertexCount = 0; do @@ -570,10 +570,10 @@ void buildLod(v1::MeshPtr& mesh) else { std::cout << "Wrong answer!\n"; - response = ""; + response.clear(); } } - while (response == ""); + while (response.empty()); numLod = 0; while (numLod < 1 || numLod > 99) @@ -654,10 +654,10 @@ void buildLod(v1::MeshPtr& mesh) else { std::cout << "Wrong answer!\n"; - response = ""; + response.clear(); } } - while (response == ""); + while (response.empty()); if (lodConfig.strategy == DistanceLodStrategy::getSingletonPtr()) { @@ -829,7 +829,7 @@ void resolveColourAmbiguities(v1::Mesh* mesh) else { std::cout << "Wrong answer!\n"; - response = ""; + response.clear(); } } } @@ -847,7 +847,7 @@ void resolveColourAmbiguities(v1::Mesh* mesh) { if (opts.interactive) { - response = ""; + response.clear(); std::cout << "\nYour mesh has vertex colours, which can be stored in one of two layouts,\n" << "each of which will be slightly faster to load in a different render system.\n" << "Do you want to prefer Direct3D (d3d) or OpenGL (gl)?\n"; @@ -866,7 +866,7 @@ void resolveColourAmbiguities(v1::Mesh* mesh) else { std::cout << "Wrong answer!\n"; - response = ""; + response.clear(); } } } @@ -1225,15 +1225,15 @@ int main(int numargs, char** args) unOptList["-U"] = false; unOptList["-v1"]= false; unOptList["-v2"]= false; - binOptList["-l"] = ""; - binOptList["-d"] = ""; - binOptList["-p"] = ""; - binOptList["-f"] = ""; - binOptList["-E"] = ""; - binOptList["-td"] = ""; - binOptList["-ts"] = ""; - binOptList["-V"] = ""; - binOptList["-O"] = ""; + binOptList["-l"].clear(); + binOptList["-d"].clear(); + binOptList["-p"].clear(); + binOptList["-f"].clear(); + binOptList["-E"].clear(); + binOptList["-td"].clear(); + binOptList["-ts"].clear(); + binOptList["-V"].clear(); + binOptList["-O"].clear(); int startIdx = findCommandLineOpts(numargs, args, unOptList, binOptList); parseOpts(unOptList, binOptList); diff --git a/Tools/MeshTool/src/v1/ReorganiseVertexBuffers.cpp b/Tools/MeshTool/src/v1/ReorganiseVertexBuffers.cpp index 5b4d137f93b..4d6846b95ca 100644 --- a/Tools/MeshTool/src/v1/ReorganiseVertexBuffers.cpp +++ b/Tools/MeshTool/src/v1/ReorganiseVertexBuffers.cpp @@ -199,7 +199,7 @@ void reorganiseVertexBuffers(const String& desc, v1::Mesh& mesh, v1::SubMesh* sm else { std::cout << "Wrong answer!\n"; - response = ""; + response.clear(); } } @@ -254,7 +254,7 @@ void reorganiseVertexBuffers(const String& desc, v1::Mesh& mesh, v1::SubMesh* sm else { std::cout << "Wrong answer!\n"; - response = ""; + response.clear(); } } @@ -355,7 +355,7 @@ void vertexBufferReorg(v1::Mesh& mesh) else { std::cout << "Wrong answer!\n"; - response = ""; + response.clear(); } } } diff --git a/Tools/MeshTool/src/v1/SimpleMeshOperations.cpp b/Tools/MeshTool/src/v1/SimpleMeshOperations.cpp index d9b4e257d95..2efe167e2e5 100644 --- a/Tools/MeshTool/src/v1/SimpleMeshOperations.cpp +++ b/Tools/MeshTool/src/v1/SimpleMeshOperations.cpp @@ -50,10 +50,10 @@ void buildEdgeLists( v1::MeshPtr &mesh ) else { std::cout << "Wrong answer!\n"; - response = ""; + response.clear(); } } - while (response == ""); + while (response.empty()); } else { @@ -103,10 +103,10 @@ void generateTangents( v1::MeshPtr &mesh ) else { std::cout << "Wrong answer!\n"; - response = ""; + response.clear(); } } - while (response == ""); + while (response.empty()); } // Generate tangents? @@ -136,11 +136,11 @@ void generateTangents( v1::MeshPtr &mesh ) else { std::cout << "Wrong answer!\n"; - response = ""; + response.clear(); } } - while (response == ""); + while (response.empty()); } else {