diff options
Diffstat (limited to 'buildtools/qmake/scope.cpp')
-rw-r--r-- | buildtools/qmake/scope.cpp | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/buildtools/qmake/scope.cpp b/buildtools/qmake/scope.cpp index e332edd2..17c360dc 100644 --- a/buildtools/qmake/scope.cpp +++ b/buildtools/qmake/scope.cpp @@ -121,8 +121,8 @@ Scope::Scope( const TQMap<TQString, TQString>& env, unsigned int num, Scope* tqp { TQString absfilename; TQString tmp = incfile.stripWhiteSpace(); - if( tmp.tqcontains(")" ) ) - tmp = tmp.mid(0, tmp.tqfind(")") ); + if( tmp.contains(")" ) ) + tmp = tmp.mid(0, tmp.find(")") ); if( tmp.startsWith( "\"" ) ) tmp = tmp.mid( 1, tmp.length()-2 ); @@ -315,7 +315,7 @@ TQStringList Scope::variableValues( const TQString& variable, bool checkIncParen if ( !m_root ) return result; - if( m_varCache.tqcontains( variable ) && fetchFromParent && ( checkIncParent || scopeType() != Scope::IncludeScope ) ) + if( m_varCache.contains( variable ) && fetchFromParent && ( checkIncParent || scopeType() != Scope::IncludeScope ) ) { return m_varCache[variable]; } @@ -336,8 +336,8 @@ void Scope::calcValuesFromStatements( const TQString& variable, TQStringList& re /* For variables that we don't know and which are not QT/CONFIG find the default value */ if( setDefault && m_defaultopts - && m_defaultopts->variables().tqfindIndex(variable) != -1 - && ( variable == "TEMPLATE" || variable == "QT" || KnownVariables.tqfindIndex(variable) == -1 || variable == "CONFIG" ) ) + && m_defaultopts->variables().findIndex(variable) != -1 + && ( variable == "TEMPLATE" || variable == "QT" || KnownVariables.findIndex(variable) == -1 || variable == "CONFIG" ) ) { result = m_defaultopts->variableValues(variable); } @@ -370,7 +370,7 @@ void Scope::calcValuesFromStatements( const TQString& variable, TQStringList& re { for ( TQStringList::const_iterator sit = assign->values.begin(); sit != assign->values.end() ; ++sit ) { - if ( result.tqfindIndex( *sit ) == -1 ) + if ( result.findIndex( *sit ) == -1 ) result.append( *sit ); } } @@ -378,7 +378,7 @@ void Scope::calcValuesFromStatements( const TQString& variable, TQStringList& re { for ( TQStringList::const_iterator sit = assign->values.begin(); sit != assign->values.end() ; ++sit ) { - if ( result.tqfindIndex( *sit ) != -1 ) + if ( result.findIndex( *sit ) != -1 ) result.remove( *sit ); } } @@ -392,7 +392,7 @@ void Scope::calcValuesFromStatements( const TQString& variable, TQStringList& re for( unsigned int i = 0; i < l.count(); ++i ) { int num = l[ i ]; - if( m_scopes.tqcontains( num ) ) + if( m_scopes.contains( num ) ) { Scope* s = m_scopes[num]; if( s && s->scopeType() == IncludeScope && s->m_incast == iast ) @@ -412,7 +412,7 @@ void Scope::calcValuesFromStatements( const TQString& variable, TQStringList& re for( unsigned int i = 0; i < l.count(); ++i ) { int num = l[ i ]; - if( m_scopes.tqcontains( num ) ) + if( m_scopes.contains( num ) ) { Scope* s = m_scopes[num]; if( s && s->m_root == past && s->m_root->scopedID == past->scopedID ) @@ -571,17 +571,17 @@ Scope* Scope::createSubProject( const TQString& projname ) if( !m_root ) return 0; - if( variableValuesForOp( "SUBDIRS", "-=").tqfindIndex( projname ) != -1 ) + if( variableValuesForOp( "SUBDIRS", "-=").findIndex( projname ) != -1 ) removeFromMinusOp( "SUBDIRS", projname ); TQString realprojname = resolveVariables(projname); - if( variableValuesForOp( "SUBDIRS", "-=").tqfindIndex( realprojname ) != -1 ) + if( variableValuesForOp( "SUBDIRS", "-=").findIndex( realprojname ) != -1 ) removeFromMinusOp( "SUBDIRS", realprojname ); TQDir curdir( projectDir() ); - if ( variableValues("TEMPLATE").tqfindIndex( "subdirs" ) != -1 ) + if ( variableValues("TEMPLATE").findIndex( "subdirs" ) != -1 ) { TQString filename; if( !realprojname.endsWith(".pro") ) @@ -592,7 +592,7 @@ Scope* Scope::createSubProject( const TQString& projname ) curdir.cd( realprojname ); TQStringList entries = curdir.entryList("*.pro", TQDir::Files); - if ( !entries.isEmpty() && entries.tqfindIndex( curdir.dirName()+".pro" ) == -1 ) + if ( !entries.isEmpty() && entries.findIndex( curdir.dirName()+".pro" ) == -1 ) filename = curdir.absPath() + TQString(TQChar(TQDir::separator()))+entries.first(); else filename = curdir.absPath() + TQString(TQChar(TQDir::separator()))+curdir.dirName()+".pro"; @@ -622,13 +622,13 @@ Scope* Scope::createSubProject( const TQString& projname ) bool Scope::deleteFunctionScope( unsigned int num ) { - if ( !m_root || !m_scopes.tqcontains( num ) ) + if ( !m_root || !m_scopes.contains( num ) ) return false; Scope* funcScope = m_scopes[ num ]; if ( funcScope ) { - TQMake::AST* ast = m_root->m_tqchildren[ m_root->m_tqchildren.tqfindIndex( funcScope->m_root ) ]; + TQMake::AST* ast = m_root->m_tqchildren[ m_root->m_tqchildren.findIndex( funcScope->m_root ) ]; if( !ast ) return false; m_scopes.remove( num ); @@ -642,13 +642,13 @@ bool Scope::deleteFunctionScope( unsigned int num ) bool Scope::deleteSimpleScope( unsigned int num ) { - if ( !m_root || !m_scopes.tqcontains( num ) ) + if ( !m_root || !m_scopes.contains( num ) ) return false; Scope* simpleScope = m_scopes[ num ]; if ( simpleScope ) { - TQMake::AST* ast = m_root->m_tqchildren[ m_root->m_tqchildren.tqfindIndex( simpleScope->m_root ) ]; + TQMake::AST* ast = m_root->m_tqchildren[ m_root->m_tqchildren.findIndex( simpleScope->m_root ) ]; if( !ast ) return false; m_scopes.remove( num ); @@ -663,7 +663,7 @@ bool Scope::deleteSimpleScope( unsigned int num ) bool Scope::deleteIncludeScope( unsigned int num ) { - if ( !m_root || !m_scopes.tqcontains( num ) ) + if ( !m_root || !m_scopes.contains( num ) ) return false; Scope * incScope = m_scopes[ num ]; @@ -682,14 +682,14 @@ bool Scope::deleteIncludeScope( unsigned int num ) bool Scope::deleteSubProject( unsigned int num, bool deleteSubdir ) { - if ( !m_root || !m_scopes.tqcontains( num ) ) + if ( !m_root || !m_scopes.contains( num ) ) return false; TQValueList<TQMake::AST*>::iterator it = findExistingVariable( "TEMPLATE" ); if ( it != m_root->m_tqchildren.end() ) { TQMake::AssignmentAST * tempast = static_cast<TQMake::AssignmentAST*>( *it ); - if ( tempast->values.tqfindIndex( "subdirs" ) != -1 || findExistingVariable( "TEMPLATE" ) != m_root->m_tqchildren.end() ) + if ( tempast->values.findIndex( "subdirs" ) != -1 || findExistingVariable( "TEMPLATE" ) != m_root->m_tqchildren.end() ) { Scope* project = m_scopes[ num ]; if( !project ) @@ -727,7 +727,7 @@ bool Scope::deleteSubProject( unsigned int num, bool deleteSubdir ) { TQMake::AssignmentAST * ast = static_cast<TQMake::AssignmentAST*>( *foundit ); updateValues( ast->values, TQStringList( projdir ), true, ast->indent ); - if( m_varCache.tqcontains( "SUBDIRS" ) ) + if( m_varCache.contains( "SUBDIRS" ) ) m_varCache.erase( "SUBDIRS" ); }else return false; @@ -746,7 +746,7 @@ void Scope::updateValues( TQStringList& origValues, const TQStringList& newValue for ( TQStringList::const_iterator it = newValues.begin(); it != newValues.end() ; ++it ) { - if ( origValues.tqfindIndex( *it ) == -1 && !remove ) + if ( origValues.findIndex( *it ) == -1 && !remove ) { while ( !origValues.isEmpty() && origValues.last() == getLineEndingString() ) origValues.pop_back(); @@ -769,17 +769,17 @@ void Scope::updateValues( TQStringList& origValues, const TQStringList& newValue origValues.append(" "); TQString newval = *it; TQRegExp re("([^$])\\$([^$\\(\\)\\{\\} /]*)( |\\)|/)"); - newval.tqreplace(re, "\\1$(\\2)\\3"); - if( (newval).tqcontains(" ") || (newval).tqcontains("\t") || (newval).tqcontains( getLineEndingString() ) || (newval).tqcontains("#") ) + newval.replace(re, "\\1$(\\2)\\3"); + if( (newval).contains(" ") || (newval).contains("\t") || (newval).contains( getLineEndingString() ) || (newval).contains("#") ) origValues.append( "\""+newval+"\"" ); else origValues.append( newval ); origValues.append( getLineEndingString() ); - } else if ( origValues.tqfindIndex( *it ) != -1 && remove ) + } else if ( origValues.findIndex( *it ) != -1 && remove ) { - TQStringList::iterator posit = origValues.tqfind( *it ); + TQStringList::iterator posit = origValues.find( *it ); posit = origValues.remove( posit ); - while( posit != origValues.end() && ( (*posit).tqfind( TQRegExp("\\\\[\\s]*"+getLineEndingString() ) ) != -1 + while( posit != origValues.end() && ( (*posit).find( TQRegExp("\\\\[\\s]*"+getLineEndingString() ) ) != -1 || (*posit).stripWhiteSpace() == "" ) ) { posit = origValues.remove( posit ); @@ -790,9 +790,9 @@ void Scope::updateValues( TQStringList& origValues, const TQStringList& newValue || origValues.last() == getLineEndingString() || origValues.last().stripWhiteSpace() == "" ) && !origValues.isEmpty() ) origValues.pop_back(); - if( !origValues.isEmpty() && origValues.last().tqfind( TQRegExp("\\\\[ \t]*#") ) != -1 ) - origValues[origValues.count()-1] = origValues[origValues.count()-1].mid(origValues[origValues.count()-1].tqfind( "#") ); - if( !origValues.isEmpty() && origValues.last().tqfind( getLineEndingString() ) == -1 ) + if( !origValues.isEmpty() && origValues.last().find( TQRegExp("\\\\[ \t]*#") ) != -1 ) + origValues[origValues.count()-1] = origValues[origValues.count()-1].mid(origValues[origValues.count()-1].find( "#") ); + if( !origValues.isEmpty() && origValues.last().find( getLineEndingString() ) == -1 ) origValues.append(getLineEndingString()); } @@ -801,7 +801,7 @@ void Scope::updateVariable( const TQString& variable, const TQString& op, const if ( !m_root || listIsEmpty( values ) ) return ; - if( m_varCache.tqcontains( variable ) ) + if( m_varCache.contains( variable ) ) m_varCache.erase( variable ); for ( int i = m_root->m_tqchildren.count() - 1; i >= 0; --i ) @@ -823,7 +823,7 @@ void Scope::updateVariable( const TQString& variable, const TQString& op, const { for ( TQStringList::const_iterator it = values.begin() ; it != values.end() ; ++it ) { - if ( op == "+=" && !removeFromOp && assignment->values.tqfindIndex( *it ) != -1 ) + if ( op == "+=" && !removeFromOp && assignment->values.findIndex( *it ) != -1 ) { if ( assignment->op == "=" ) { @@ -841,7 +841,7 @@ void Scope::updateVariable( const TQString& variable, const TQString& op, const } } } - else if ( op == "-=" && !removeFromOp && assignment->values.tqfindIndex( *it ) != -1 ) + else if ( op == "-=" && !removeFromOp && assignment->values.findIndex( *it ) != -1 ) { updateValues( assignment->values, TQStringList( *it ), true, assignment->indent ); if ( listIsEmpty( assignment->values ) ) @@ -858,7 +858,7 @@ void Scope::updateVariable( const TQString& variable, const TQString& op, const m_root->removeChildAST( assignment ); delete assignment; } - else if ( assignment->op == "+=" && assignment->values.tqfindIndex( *it ) != -1 ) + else if ( assignment->op == "+=" && assignment->values.findIndex( *it ) != -1 ) { updateValues( assignment->values, TQStringList( *it ), true, assignment->indent ); if ( listIsEmpty( assignment->values ) ) @@ -885,7 +885,7 @@ void Scope::updateVariable( const TQString& variable, const TQString& op, const else ast->setDepth( m_root->depth()+1 ); m_root->addChildAST( ast ); - if ( values.tqfindIndex( getLineEndingString() ) == -1 ) + if ( values.findIndex( getLineEndingString() ) == -1 ) { ast->values.append( getLineEndingString() ); } @@ -903,7 +903,7 @@ TQValueList<TQMake::AST*>::iterator Scope::findExistingVariable( const TQString& if ( ( *it ) ->nodeType() == TQMake::AST::AssignmentAST ) { TQMake::AssignmentAST * assignment = static_cast<TQMake::AssignmentAST*>( *it ); - if ( assignment->scopedID == variable && ops.tqfindIndex( assignment->op ) != -1 ) + if ( assignment->scopedID == variable && ops.findIndex( assignment->op ) != -1 ) { return it; } @@ -942,7 +942,7 @@ void Scope::init() { TQMake::AssignmentAST * m = static_cast<TQMake::AssignmentAST*>( *it ); // Check wether TEMPLATE==subdirs here too! - if ( m->scopedID == "SUBDIRS" && variableValues("TEMPLATE").tqfindIndex("subdirs") != -1 ) + if ( m->scopedID == "SUBDIRS" && variableValues("TEMPLATE").findIndex("subdirs") != -1 ) { for ( TQStringList::const_iterator sit = m->values.begin() ; sit != m->values.end(); ++sit ) { @@ -977,7 +977,7 @@ void Scope::init() }else continue; } - if ( subproject.entryList().isEmpty() || subproject.entryList().tqfindIndex( str + ".pro" ) != -1 ) + if ( subproject.entryList().isEmpty() || subproject.entryList().findIndex( str + ".pro" ) != -1 ) projectfile = (str) + ".pro"; else projectfile = subproject.entryList().first(); @@ -992,16 +992,16 @@ void Scope::init() else { if ( !( - KnownVariables.tqfindIndex( m->scopedID ) != -1 + KnownVariables.findIndex( m->scopedID ) != -1 && ( m->op == "=" || m->op == "+=" || m->op == "-=") ) && !( - ( m->scopedID.tqcontains( ".files" ) || m->scopedID.tqcontains( ".path" ) ) - && variableValues("INSTALLS").tqfindIndex(m->scopedID.left( m->scopedID.tqfindRev(".") != -1 ) ) + ( m->scopedID.contains( ".files" ) || m->scopedID.contains( ".path" ) ) + && variableValues("INSTALLS").findIndex(m->scopedID.left( m->scopedID.findRev(".") != -1 ) ) ) && !( - ( m->scopedID.tqcontains( ".subdir" ) ) - && variableValues("SUBDIRS").tqfindIndex(m->scopedID.left( m->scopedID.tqfindRev(".") != -1 ) ) + ( m->scopedID.contains( ".subdir" ) ) + && variableValues("SUBDIRS").findIndex(m->scopedID.left( m->scopedID.findRev(".") != -1 ) ) ) ) { @@ -1056,11 +1056,11 @@ void Scope::updateCustomVariable( unsigned int id, const TQString& name, const T { if( !m_root ) return; - if ( id > 0 && m_customVariables.tqcontains( id ) ) + if ( id > 0 && m_customVariables.contains( id ) ) { m_customVariables[ id ] ->values.clear(); updateValues( m_customVariables[ id ] ->values, newvalues.stripWhiteSpace() ); - if( m_varCache.tqcontains( m_customVariables[ id ]->scopedID ) ) + if( m_varCache.contains( m_customVariables[ id ]->scopedID ) ) m_varCache.erase( m_customVariables[ id ]->scopedID ); m_customVariables[ id ] ->op = newop; m_customVariables[ id ] ->scopedID = name; @@ -1084,7 +1084,7 @@ unsigned int Scope::addCustomVariable( const TQString& var, const TQString& op, void Scope::removeCustomVariable( unsigned int id ) { - if( m_customVariables.tqcontains(id) ) + if( m_customVariables.contains(id) ) { TQMake::AssignmentAST* m = m_customVariables[id]; m_customVariables.remove(id); @@ -1220,20 +1220,20 @@ Scope* Scope::disableSubproject( const TQString& dir) if( !m_root || ( m_root->isProject() && !m_incast ) ) return 0; - if( scopeType() != Scope::IncludeScope && variableValuesForOp( "SUBDIRS", "+=").tqfindIndex( dir ) != -1 ) + if( scopeType() != Scope::IncludeScope && variableValuesForOp( "SUBDIRS", "+=").findIndex( dir ) != -1 ) removeFromPlusOp( "SUBDIRS", dir ); else if( scopeType() != Scope::IncludeScope ) removeFromPlusOp( "SUBDIRS", dir ); TQDir curdir( projectDir() ); - if ( variableValues("TEMPLATE").tqfindIndex( "subdirs" ) != -1 ) + if ( variableValues("TEMPLATE").findIndex( "subdirs" ) != -1 ) { curdir.cd(dir); TQString filename; TQStringList entries = curdir.entryList("*.pro", TQDir::Files); - if ( !entries.isEmpty() && entries.tqfindIndex( curdir.dirName()+".pro" ) != -1 ) + if ( !entries.isEmpty() && entries.findIndex( curdir.dirName()+".pro" ) != -1 ) filename = curdir.absPath() + TQString(TQChar(TQDir::separator()))+entries.first(); else filename = curdir.absPath() + TQString(TQChar(TQDir::separator()))+curdir.dirName()+".pro"; @@ -1285,7 +1285,7 @@ TQStringList Scope::resolveVariables( const TQStringList& values, TQMake::AST* s pos = re.search( (*it), pos ); if( pos > -1 ) { - if( !variables.tqcontains( re.cap(1) ) ) + if( !variables.contains( re.cap(1) ) ) { variables[re.cap(1)] = resolveVariables( variableValues( re.cap(1), stopHere ) ); if( variables[re.cap(1)].isEmpty() && re.cap(1) == "TARGET" ) @@ -1303,7 +1303,7 @@ TQStringList Scope::resolveVariables( const TQStringList& values, TQMake::AST* s pos = re.search( (*it), pos ); if( pos > -1 ) { - if( !variables.tqcontains( re.cap(1) ) ) + if( !variables.contains( re.cap(1) ) ) { variables[re.cap(1)] = resolveVariables( variableValues( re.cap(1), stopHere ) ); if( variables[re.cap(1)].isEmpty() && re.cap(1) == "TARGET" ) @@ -1322,8 +1322,8 @@ TQStringList Scope::resolveVariables( const TQStringList& values, TQMake::AST* s pos = re.search( (*it), pos ); if( pos > -1 ) { - if( !envvars.tqcontains( re.cap(1) ) ) - if( m_environment.tqcontains( re.cap(1) ) != -1 ) + if( !envvars.contains( re.cap(1) ) ) + if( m_environment.contains( re.cap(1) ) != -1 ) envvars[re.cap(1)] = m_environment[ re.cap(1) ]; else if ( ::getenv( re.cap(1).local8Bit() ) != 0 ) envvars[re.cap(1)] = TQString::fromLocal8Bit( ::getenv( re.cap(1).local8Bit() ) ); @@ -1332,14 +1332,14 @@ TQStringList Scope::resolveVariables( const TQStringList& values, TQMake::AST* s } for( TQMap<TQString, TQString>::const_iterator it2 = envvars.begin(); it2 != envvars.end(); ++it2 ) { - (*it).tqreplace("$$("+it2.key()+")", it2.data() ); + (*it).replace("$$("+it2.key()+")", it2.data() ); } for( TQMap<TQString, TQStringList>::const_iterator it2 = variables.begin(); it2 != variables.end(); ++it2 ) { for( TQStringList::const_iterator it3 = it2.data().begin(); it3 != it2.data().end(); ++it3 ) { - (*it).tqreplace("$$"+it2.key(), *it3 ); - (*it).tqreplace("$${"+it2.key()+"}", *it3 ); + (*it).replace("$$"+it2.key(), *it3 ); + (*it).replace("$${"+it2.key()+"}", *it3 ); } } } @@ -1353,7 +1353,7 @@ void Scope::allFiles( const TQString& projectDirectory, std::set<TQString>& res TQString file; TQStringList values; TQString header = ""; - if( variableValues("TEMPLATE",false ).tqfindIndex("subdirs") == -1 ) + if( variableValues("TEMPLATE",false ).findIndex("subdirs") == -1 ) { values = variableValues( "INSTALLS" ,false, false ); TQStringList::const_iterator it; @@ -1368,7 +1368,7 @@ void Scope::allFiles( const TQString& projectDirectory, std::set<TQString>& res { file = myRelPath + TQString(TQChar(TQDir::separator())) + *filesit; file = resolveVariables( file ); - if( file.tqcontains("*") ) + if( file.contains("*") ) { TQFileInfo fi( projectDirectory + TQString( TQChar( TQDir::separator() ) ) + file ); TQDir absDir = fi.dir( true ); @@ -1408,7 +1408,7 @@ void Scope::allFiles( const TQString& projectDirectory, std::set<TQString>& res { file = myRelPath + TQString(TQChar(TQDir::separator())) + *it; file = resolveVariables( file ); - if( file.tqcontains("*") ) + if( file.contains("*") ) { TQFileInfo fi( projectDirectory + TQString( TQChar( TQDir::separator() ) ) + file ); TQDir absDir = fi.dir( true ); @@ -1493,7 +1493,7 @@ void Scope::allFiles( const TQString& projectDirectory, std::set<TQString>& res else { header = projectDir()+TQString(TQChar(TQDir::separator())) + "ui_" +*it; - header.tqreplace(TQRegExp("\\.ui$"),".h"); + header.replace(TQRegExp("\\.ui$"),".h"); if( TQFileInfo(header).exists() ) res.insert( TQDir::cleanDirPath( header ) ); } @@ -1595,13 +1595,13 @@ TQString Scope::getLineEndingString() const TQString Scope::replaceWs(TQString s) { - return s.tqreplace( getLineEndingString(), "%nl").tqreplace("\t", "%tab").tqreplace(" ", "%spc"); + return s.replace( getLineEndingString(), "%nl").replace("\t", "%tab").replace(" ", "%spc"); } bool Scope::containsContinue(const TQString& s ) const { - return( s.tqfind( TQRegExp( "\\\\\\s*"+getLineEndingString() ) ) != -1 - || s.tqfind( TQRegExp( "\\\\\\s*#" ) ) != -1 ); + return( s.find( TQRegExp( "\\\\\\s*"+getLineEndingString() ) ) != -1 + || s.find( TQRegExp( "\\\\\\s*#" ) ) != -1 ); } bool Scope::isComment( const TQString& s) const @@ -1670,7 +1670,7 @@ void Scope::PrintAST::leaveFunctionScope( TQMake::ProjectAST* p ) TQString Scope::PrintAST::replaceWs(TQString s) { - return s.tqreplace("\n", "%nl").tqreplace("\t", "%tab").tqreplace(" ", "%spc"); + return s.replace("\n", "%nl").replace("\t", "%tab").replace(" ", "%spc"); } void Scope::PrintAST::processAssignment( TQMake::AssignmentAST* a) @@ -1707,4 +1707,4 @@ TQString Scope::PrintAST::getIndent() } #endif -// kate: space-indent on; indent-width 4; tab-width 4; tqreplace-tabs on +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on |