diff options
Diffstat (limited to 'languages/cpp/store_walker.cpp')
-rw-r--r-- | languages/cpp/store_walker.cpp | 176 |
1 files changed, 88 insertions, 88 deletions
diff --git a/languages/cpp/store_walker.cpp b/languages/cpp/store_walker.cpp index cd66dd23..bcea1a05 100644 --- a/languages/cpp/store_walker.cpp +++ b/languages/cpp/store_walker.cpp @@ -15,10 +15,10 @@ #include "driver.h" #include <kdebug.h> -#include <qfileinfo.h> -#include <qdir.h> +#include <tqfileinfo.h> +#include <tqdir.h> -StoreWalker::StoreWalker( const QString& fileName, CodeModel* store ) +StoreWalker::StoreWalker( const TQString& fileName, CodeModel* store ) : m_store( store ), m_anon( 0 ) { m_fileName = URLUtil::canonicalPath( fileName ); @@ -53,7 +53,7 @@ void StoreWalker::parseTranslationUnit( const ParsedFile& ast ) m_anon = 0; m_imports.clear(); - m_imports << QPair<QMap<QString, ClassDom>, QStringList>(QMap<QString, ClassDom>(), QStringList()); + m_imports << QPair<TQMap<TQString, ClassDom>, TQStringList>(TQMap<TQString, ClassDom>(), TQStringList()); TreeParser::parseTranslationUnit( ast ); m_imports.pop_back(); } @@ -84,11 +84,11 @@ void StoreWalker::parseNamespace( NamespaceAST* ast ) ast->getStartPosition( &startLine, &startColumn ); ast->getEndPosition( &endLine, &endColumn ); - QString nsName; + TQString nsName; if ( !ast->namespaceName() || ast->namespaceName()->text().isEmpty() ) { - QFileInfo fileInfo( m_fileName ); - QString shortFileName = fileInfo.baseName(); + TQFileInfo fileInfo( m_fileName ); + TQString shortFileName = fileInfo.baseName(); nsName.sprintf( "(%s_%d)", shortFileName.local8Bit().data(), m_anon++ ); } @@ -110,8 +110,8 @@ void StoreWalker::parseNamespace( NamespaceAST* ast ) void StoreWalker::parseNamespaceAlias( NamespaceAliasAST* ast ) { - QString nsName; - QString aliasName; + TQString nsName; + TQString aliasName; if( !ast->namespaceName() || ast->namespaceName()->text().isEmpty() ) { @@ -145,7 +145,7 @@ void StoreWalker::parseUsing( UsingAST* ast ) void StoreWalker::parseUsingDirective( UsingDirectiveAST* ast ) { - QString name; + TQString name; if( ast->name() ) name = ast->name()->text(); @@ -169,7 +169,7 @@ void StoreWalker::parseTypedef( TypedefAST* ast ) if ( ast && ast->initDeclaratorList() && ast->initDeclaratorList() ->initDeclaratorList().count() > 0 ) { - QPtrList<InitDeclaratorAST> lst( ast->initDeclaratorList() ->initDeclaratorList() ); + TQPtrList<InitDeclaratorAST> lst( ast->initDeclaratorList() ->initDeclaratorList() ); m_currentDeclarator = lst.at( 0 ) ->declarator(); } @@ -186,19 +186,19 @@ void StoreWalker::parseTypedef( TypedefAST* ast ) if ( typeSpec && declarators ) { - QString typeId; + TQString typeId; if ( typeSpec->name() ) typeId = typeSpec->name() ->text(); - QPtrList<InitDeclaratorAST> l( declarators->initDeclaratorList() ); - QPtrListIterator<InitDeclaratorAST> it( l ); + TQPtrList<InitDeclaratorAST> l( declarators->initDeclaratorList() ); + TQPtrListIterator<InitDeclaratorAST> it( l ); InitDeclaratorAST* initDecl = 0; while ( 0 != ( initDecl = it.current() ) ) { - QString type, id; + TQString type, id; if ( initDecl->declarator() ) { type = typeOfDeclaration( typeSpec, initDecl->declarator() ); @@ -283,9 +283,9 @@ void StoreWalker::parseSimpleDeclaration( SimpleDeclarationAST* ast ) if ( declarators ) { - QPtrList<InitDeclaratorAST> l = declarators->initDeclaratorList(); + TQPtrList<InitDeclaratorAST> l = declarators->initDeclaratorList(); - QPtrListIterator<InitDeclaratorAST> it( l ); + TQPtrListIterator<InitDeclaratorAST> it( l ); while ( it.current() ) { parseDeclaration( ast->functionSpecifier(), ast->storageSpecifier(), @@ -296,11 +296,11 @@ void StoreWalker::parseSimpleDeclaration( SimpleDeclarationAST* ast ) } -QStringList StoreWalker::findScope( const QStringList& scope ) { +TQStringList StoreWalker::findScope( const TQStringList& scope ) { ClassDom d = findClassFromScope( scope ); if( d ) { - QStringList ret = d->scope(); + TQStringList ret = d->scope(); ret << d->name(); return ret; } @@ -330,11 +330,11 @@ void StoreWalker::parseFunctionDefinition( FunctionDefinitionAST* ast ) if ( funSpec ) { - QPtrList<AST> l = funSpec->nodeList(); - QPtrListIterator<AST> it( l ); + TQPtrList<AST> l = funSpec->nodeList(); + TQPtrListIterator<AST> it( l ); while ( it.current() ) { - QString text = it.current() ->text(); + TQString text = it.current() ->text(); if ( text == "virtual" ) isVirtual = true; else if ( text == "inline" ) @@ -345,11 +345,11 @@ void StoreWalker::parseFunctionDefinition( FunctionDefinitionAST* ast ) if ( storageSpec ) { - QPtrList<AST> l = storageSpec->nodeList(); - QPtrListIterator<AST> it( l ); + TQPtrList<AST> l = storageSpec->nodeList(); + TQPtrListIterator<AST> it( l ); while ( it.current() ) { - QString text = it.current() ->text(); + TQString text = it.current() ->text(); if ( text == "friend" ) isFriend = true; else if ( text == "static" ) @@ -363,9 +363,9 @@ void StoreWalker::parseFunctionDefinition( FunctionDefinitionAST* ast ) ast->getStartPosition( &startLine, &startColumn ); ast->getEndPosition( &endLine, &endColumn ); - QString id = d->declaratorId() ->unqualifiedName() ->text().stripWhiteSpace(); + TQString id = d->declaratorId() ->unqualifiedName() ->text().stripWhiteSpace(); - QStringList scope = scopeOfDeclarator( d, m_currentScope ); + TQStringList scope = scopeOfDeclarator( d, m_currentScope ); ClassDom c; ///c should be nonzero if it is a function-definition for a function within another class if( !m_currentClass.top() ) { ///It is not a local definition within a class, so search the scope so it can be corrected using imports @@ -383,7 +383,7 @@ void StoreWalker::parseFunctionDefinition( FunctionDefinitionAST* ast ) parseFunctionArguments( d, model_cast<FunctionDom>( method ) ); - QString text = typeOfDeclaration( typeSpec, d ); + TQString text = typeOfDeclaration( typeSpec, d ); if ( !text.isEmpty() ) method->setResultType( text ); @@ -437,11 +437,11 @@ void StoreWalker::parseTypeSpecifier( TypeSpecifierAST* ast ) void StoreWalker::takeTemplateParams( TemplateModelItem& target, TemplateDeclarationAST* ast) { TemplateParameterListAST* pl = ast->templateParameterList(); if( pl ) { - QPtrList<TemplateParameterAST> list = pl->templateParameterList(); + TQPtrList<TemplateParameterAST> list = pl->templateParameterList(); TemplateParameterAST* curr = list.first(); while( curr != 0 ) { - QString a, b; + TQString a, b; if( curr->typeParameter() && curr->typeParameter()->name() ) { a = curr->typeParameter()->name()->text(); if( curr->typeParameter()->typeId() ) @@ -450,7 +450,7 @@ void StoreWalker::takeTemplateParams( TemplateModelItem& target, TemplateDeclara target.addTemplateParam( a, b ); CodeModelItem* cmi = dynamic_cast<CodeModelItem*>(&target); - QString nm = "0"; + TQString nm = "0"; if(cmi) nm = cmi->name(); kdDebug() << "item " << nm << " taking template-parameters " << a << ", default=" << b << "\n"; curr = list.next(); @@ -471,7 +471,7 @@ void StoreWalker::checkTemplateDeclarator( TemplateModelItem* item ) { int StoreWalker::mergeGroups( int g1, int g2 ) { int ng = m_store->mergeGroups( g1, g2 ); - for( QMap<QString, FileDom>::iterator it = m_overrides.begin(); it != m_overrides.end(); ++it ) { + for( TQMap<TQString, FileDom>::iterator it = m_overrides.begin(); it != m_overrides.end(); ++it ) { int g =(*it)->groupId(); if( g == g1 || g == g2 ) (*it)->setGroupId( ng ); @@ -490,7 +490,7 @@ void StoreWalker::parseClassSpecifier( ClassSpecifierAST* ast ) bool oldInSlots = m_inSlots; bool oldInSignals = m_inSignals; - QString kind = ast->classKey() ->text(); + TQString kind = ast->classKey() ->text(); if ( kind == "class" ) m_currentAccess = CodeModelItem::Private; else @@ -498,15 +498,15 @@ void StoreWalker::parseClassSpecifier( ClassSpecifierAST* ast ) m_inSlots = false; m_inSignals = false; - QString className; + TQString className; if ( !ast->name() && m_currentDeclarator && m_currentDeclarator->declaratorId() ) { className = m_currentDeclarator->declaratorId() ->text().stripWhiteSpace(); } else if ( !ast->name() ) { - QFileInfo fileInfo( m_fileName ); - QString shortFileName = fileInfo.baseName(); + TQFileInfo fileInfo( m_fileName ); + TQString shortFileName = fileInfo.baseName(); className.sprintf( "(%s_%d)", shortFileName.local8Bit().data(), m_anon++ ); } else @@ -530,13 +530,13 @@ void StoreWalker::parseClassSpecifier( ClassSpecifierAST* ast ) checkTemplateDeclarator( &(*klass) ); - bool embed = !scopeOfName( ast->name(), QStringList() ).isEmpty(); + bool embed = !scopeOfName( ast->name(), TQStringList() ).isEmpty(); - QStringList oldScope; + TQStringList oldScope; if( embed ) { - ClassDom embedderClass = findClassFromScope( m_currentScope + scopeOfName( ast->name(), QStringList() )); + ClassDom embedderClass = findClassFromScope( m_currentScope + scopeOfName( ast->name(), TQStringList() )); if(embedderClass) { if(embedderClass->fileName() != klass->fileName()) { @@ -556,7 +556,7 @@ void StoreWalker::parseClassSpecifier( ClassSpecifierAST* ast ) //m_file->addClass( klass );//experiment }else{ - kdDebug( 9007 ) << "could not find embedding class " << QStringList(m_currentScope + scopeOfName( ast->name(), QStringList() )).join("::") << " for " << className << endl; + kdDebug( 9007 ) << "could not find embedding class " << TQStringList(m_currentScope + scopeOfName( ast->name(), TQStringList() )).join("::") << " for " << className << endl; embed = false; } } @@ -577,7 +577,7 @@ void StoreWalker::parseClassSpecifier( ClassSpecifierAST* ast ) m_currentScope.push_back( className ); m_currentClass.push( klass ); - //m_imports.push_back( QStringList() ); + //m_imports.push_back( TQStringList() ); TreeParser::parseClassSpecifier( ast ); @@ -621,8 +621,8 @@ void StoreWalker::parseEnumSpecifier( EnumSpecifierAST* ast ) m_file->addTypeAlias( typeAlias ); } - QPtrList<EnumeratorAST> l = ast->enumeratorList(); - QPtrListIterator<EnumeratorAST> it( l ); + TQPtrList<EnumeratorAST> l = ast->enumeratorList(); + TQPtrListIterator<EnumeratorAST> it( l ); while ( it.current() ) { VariableDom attr = m_store->create<VariableModel>(); @@ -688,13 +688,13 @@ void StoreWalker::parseDeclaration( GroupAST* funSpec, GroupAST* storageSpec, while ( t && t->subDeclarator() ) t = t->subDeclarator(); - QString id; + TQString id; if ( t && t->declaratorId() && t->declaratorId() ->unqualifiedName() ) id = t->declaratorId() ->unqualifiedName() ->text(); - if ( !scopeOfDeclarator( d, QStringList() ).isEmpty() ) + if ( !scopeOfDeclarator( d, TQStringList() ).isEmpty() ) { - kdDebug( 9007 ) << "skip declaration of " << QStringList(scopeOfDeclarator( d, QStringList() )).join("::") << "::" << id << endl; + kdDebug( 9007 ) << "skip declaration of " << TQStringList(scopeOfDeclarator( d, TQStringList() )).join("::") << "::" << id << endl; return ; } @@ -712,7 +712,7 @@ void StoreWalker::parseDeclaration( GroupAST* funSpec, GroupAST* storageSpec, attr->setAccess( m_currentAccess ); - QString text = typeOfDeclaration( typeSpec, d ); + TQString text = typeOfDeclaration( typeSpec, d ); if ( !text.isEmpty() ) { attr->setType( text ); } @@ -725,11 +725,11 @@ void StoreWalker::parseDeclaration( GroupAST* funSpec, GroupAST* storageSpec, if ( storageSpec ) { - QPtrList<AST> l = storageSpec->nodeList(); - QPtrListIterator<AST> it( l ); + TQPtrList<AST> l = storageSpec->nodeList(); + TQPtrListIterator<AST> it( l ); while ( it.current() ) { - QString text = it.current() ->text(); + TQString text = it.current() ->text(); if ( text == "friend" ) isFriend = true; else if ( text == "static" ) @@ -750,9 +750,9 @@ void StoreWalker::parseDeclaration( GroupAST* funSpec, GroupAST* storageSpec, void StoreWalker::parseAccessDeclaration( AccessDeclarationAST * access ) { - QPtrList<AST> l = access->accessList(); + TQPtrList<AST> l = access->accessList(); - QString accessStr = l.at( 0 ) ->text(); + TQString accessStr = l.at( 0 ) ->text(); if ( accessStr == "public" ) m_currentAccess = CodeModelItem::Public; else if ( accessStr == "protected" ) @@ -768,7 +768,7 @@ void StoreWalker::parseAccessDeclaration( AccessDeclarationAST * access ) m_inSignals = l.count() >= 1 ? l.at( 0 ) ->text() == "signals" : false; } -NamespaceDom StoreWalker::findOrInsertNamespace( NamespaceAST* ast, const QString & name ) +NamespaceDom StoreWalker::findOrInsertNamespace( NamespaceAST* ast, const TQString & name ) { if ( m_currentNamespace.top() && m_currentNamespace.top() ->hasNamespace( name ) ) return m_currentNamespace.top() ->namespaceByName( name ); @@ -809,11 +809,11 @@ void StoreWalker::parseFunctionDeclaration( GroupAST* funSpec, GroupAST* storage if ( funSpec ) { - QPtrList<AST> l = funSpec->nodeList(); - QPtrListIterator<AST> it( l ); + TQPtrList<AST> l = funSpec->nodeList(); + TQPtrListIterator<AST> it( l ); while ( it.current() ) { - QString text = it.current() ->text(); + TQString text = it.current() ->text(); if ( text == "virtual" ) isVirtual = true; else if ( text == "inline" ) @@ -824,11 +824,11 @@ void StoreWalker::parseFunctionDeclaration( GroupAST* funSpec, GroupAST* storage if ( storageSpec ) { - QPtrList<AST> l = storageSpec->nodeList(); - QPtrListIterator<AST> it( l ); + TQPtrList<AST> l = storageSpec->nodeList(); + TQPtrListIterator<AST> it( l ); while ( it.current() ) { - QString text = it.current() ->text(); + TQString text = it.current() ->text(); if ( text == "friend" ) isFriend = true; else if ( text == "static" ) @@ -843,7 +843,7 @@ void StoreWalker::parseFunctionDeclaration( GroupAST* funSpec, GroupAST* storage decl->getEndPosition( &endLine, &endColumn ); DeclaratorAST* d = decl->declarator(); - QString id = d->declaratorId() ->unqualifiedName() ->text(); + TQString id = d->declaratorId() ->unqualifiedName() ->text(); FunctionDom method = m_store->create<FunctionModel>(); method->setName( id ); @@ -867,7 +867,7 @@ void StoreWalker::parseFunctionDeclaration( GroupAST* funSpec, GroupAST* storage if ( m_inSlots ) method->setSlot( true ); - QString text = typeOfDeclaration( typeSpec, d ); + TQString text = typeOfDeclaration( typeSpec, d ); if ( !text.isEmpty() ) method->setResultType( text ); @@ -889,8 +889,8 @@ void StoreWalker::parseFunctionArguments( DeclaratorAST* declarator, FunctionDom if ( clause && clause->parameterDeclarationList() ) { ParameterDeclarationListAST * params = clause->parameterDeclarationList(); - QPtrList<ParameterDeclarationAST> l( params->parameterList() ); - QPtrListIterator<ParameterDeclarationAST> it( l ); + TQPtrList<ParameterDeclarationAST> l( params->parameterList() ); + TQPtrListIterator<ParameterDeclarationAST> it( l ); while ( it.current() ) { ParameterDeclarationAST * param = it.current(); @@ -900,12 +900,12 @@ void StoreWalker::parseFunctionArguments( DeclaratorAST* declarator, FunctionDom if ( param->declarator() ) { - QString text = declaratorToString( param->declarator(), QString::null, true ); + TQString text = declaratorToString( param->declarator(), TQString::null, true ); if ( !text.isEmpty() ) arg->setName( text ); } - QString tp = typeOfDeclaration( param->typeSpec(), param->declarator() ); + TQString tp = typeOfDeclaration( param->typeSpec(), param->declarator() ); if ( !tp.isEmpty() ) arg->setType( tp ); @@ -914,17 +914,17 @@ void StoreWalker::parseFunctionArguments( DeclaratorAST* declarator, FunctionDom } } -QString StoreWalker::typeOfDeclaration( TypeSpecifierAST* typeSpec, DeclaratorAST* declarator ) +TQString StoreWalker::typeOfDeclaration( TypeSpecifierAST* typeSpec, DeclaratorAST* declarator ) { if ( !typeSpec || !declarator ) - return QString::null; + return TQString::null; - QString text; + TQString text; text += typeSpec->text(); - QPtrList<AST> ptrOpList = declarator->ptrOpList(); - for ( QPtrListIterator<AST> it( ptrOpList ); it.current(); ++it ) + TQPtrList<AST> ptrOpList = declarator->ptrOpList(); + for ( TQPtrListIterator<AST> it( ptrOpList ); it.current(); ++it ) { text += it.current() ->text(); } @@ -938,13 +938,13 @@ QString StoreWalker::typeOfDeclaration( TypeSpecifierAST* typeSpec, DeclaratorAS void StoreWalker::parseBaseClause( BaseClauseAST * baseClause, ClassDom klass ) { - QPtrList<BaseSpecifierAST> l = baseClause->baseSpecifierList(); - QPtrListIterator<BaseSpecifierAST> it( l ); + TQPtrList<BaseSpecifierAST> l = baseClause->baseSpecifierList(); + TQPtrListIterator<BaseSpecifierAST> it( l ); while ( it.current() ) { BaseSpecifierAST * baseSpecifier = it.current(); - QString baseName; + TQString baseName; if ( baseSpecifier->name() ) baseName = baseSpecifier->name() ->text(); @@ -954,15 +954,15 @@ void StoreWalker::parseBaseClause( BaseClauseAST * baseClause, ClassDom klass ) } } -QStringList StoreWalker::scopeOfName( NameAST* id, const QStringList& startScope ) +TQStringList StoreWalker::scopeOfName( NameAST* id, const TQStringList& startScope ) { - QStringList scope = startScope; + TQStringList scope = startScope; if ( id && id->classOrNamespaceNameList().count() ) { if ( id->isGlobal() ) scope.clear(); - QPtrList<ClassOrNamespaceNameAST> l = id->classOrNamespaceNameList(); - QPtrListIterator<ClassOrNamespaceNameAST> it( l ); + TQPtrList<ClassOrNamespaceNameAST> l = id->classOrNamespaceNameList(); + TQPtrListIterator<ClassOrNamespaceNameAST> it( l ); while ( it.current() ) { if ( it.current() ->name() ) @@ -978,11 +978,11 @@ QStringList StoreWalker::scopeOfName( NameAST* id, const QStringList& startScope ///@todo respect the imports that result from the headers etc. -ClassDom StoreWalker::findClassFromScope( const QStringList& scope ) +ClassDom StoreWalker::findClassFromScope( const TQStringList& scope ) { - QString scopeText = scope.join("::"); + TQString scopeText = scope.join("::"); if( !m_imports.isEmpty() ) { - QMapIterator<QString, ClassDom> it = m_imports.back().first.find( scopeText ); + TQMapIterator<TQString, ClassDom> it = m_imports.back().first.find( scopeText ); if( it != m_imports.back().first.end() ) { return *it; } @@ -997,9 +997,9 @@ ClassDom StoreWalker::findClassFromScope( const QStringList& scope ) if(!m_imports.isEmpty() && !m_imports.back().second.isEmpty()) { ///try the same using one of the imports(performance-wise this is not good, but simple) - QStringList::iterator it = m_imports.back().second.begin(); + TQStringList::iterator it = m_imports.back().second.begin(); while(it != m_imports.back().second.end()) { - QStringList scp = QStringList::split("::", *it) + m_currentScope + scope; + TQStringList scp = TQStringList::split("::", *it) + m_currentScope + scope; c = classFromScope( scp ); if( c ) { if( !m_imports.isEmpty() ) m_imports.back().first[ scopeText ] = c; @@ -1011,12 +1011,12 @@ ClassDom StoreWalker::findClassFromScope( const QStringList& scope ) return c; } -ClassDom findScopeInFile( const QStringList& scope, NamespaceModel* glob ) { +ClassDom findScopeInFile( const TQStringList& scope, NamespaceModel* glob ) { if( !glob ) return ClassDom(); ClassModel* curr = glob ; - QStringList::const_iterator mit = scope.begin(); + TQStringList::const_iterator mit = scope.begin(); while(curr->isNamespace() && mit != scope.end() && ((NamespaceModel*)curr)->hasNamespace( *mit )) { curr = &(*( ((NamespaceModel*)curr)->namespaceByName( *mit ) )); @@ -1036,7 +1036,7 @@ ClassDom findScopeInFile( const QStringList& scope, NamespaceModel* glob ) { } } -ClassDom StoreWalker::classFromScope(const QStringList& scope) { +ClassDom StoreWalker::classFromScope(const TQStringList& scope) { if(scope.isEmpty())return ClassDom(0); //Since another instance of the current file may still be in the code-model this must be testede BEFORE the code-model @@ -1048,7 +1048,7 @@ ClassDom StoreWalker::classFromScope(const QStringList& scope) { c = findScopeInFile( scope, glob ); - QMap<QString, FileDom>::const_iterator it; + TQMap<TQString, FileDom>::const_iterator it; if( c ) { ///Check the file that overrides the code-model file @@ -1062,7 +1062,7 @@ ClassDom StoreWalker::classFromScope(const QStringList& scope) { } } else { ///Search in all overrides, because they will be added later all at once - for( QMap<QString, FileDom>::const_iterator it = m_overrides.begin(); it != m_overrides.end(); ++it ) { + for( TQMap<TQString, FileDom>::const_iterator it = m_overrides.begin(); it != m_overrides.end(); ++it ) { c = findScopeInFile( scope, *it ); if( c ) return c; @@ -1073,7 +1073,7 @@ ClassDom StoreWalker::classFromScope(const QStringList& scope) { } -QStringList StoreWalker::scopeOfDeclarator( DeclaratorAST* d, const QStringList& startScope ) +TQStringList StoreWalker::scopeOfDeclarator( DeclaratorAST* d, const TQStringList& startScope ) { return scopeOfName( d->declaratorId(), startScope ); } |