diff options
Diffstat (limited to 'languages/cpp/cppcodecompletion.cpp')
-rw-r--r-- | languages/cpp/cppcodecompletion.cpp | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/languages/cpp/cppcodecompletion.cpp b/languages/cpp/cppcodecompletion.cpp index 846aec77..be16ec28 100644 --- a/languages/cpp/cppcodecompletion.cpp +++ b/languages/cpp/cppcodecompletion.cpp @@ -348,7 +348,7 @@ struct PopupFillerHelpStruct { TQMap<TQString, TQPopupMenu*> m_namespacePopupCache; - void insertItem( TQPopupMenu* tqparent, SimpleTypeImpl::MemberInfo d , TQString prefix ) { + void insertItem( TQPopupMenu* parent, SimpleTypeImpl::MemberInfo d , TQString prefix ) { Q_UNUSED(prefix); TQString memType = d.memberTypeToString(); @@ -357,12 +357,12 @@ struct PopupFillerHelpStruct { memType = "enum"; TQString txt = i18n( "Jump to %1 %2" ).tqarg( memType ).tqarg( cleanForMenu( d.name ) ); - int id = tqparent->insertItem( txt, receiver, TQT_SLOT( popupAction( int ) ) ); + int id = parent->insertItem( txt, receiver, TQT_SLOT( popupAction( int ) ) ); receiver->m_popupActions.insert( id, d.decl ); } - void insertItem ( TQPopupMenu* tqparent, TypeDesc d , TQString prefix ) { + void insertItem ( TQPopupMenu* parent, TypeDesc d , TQString prefix ) { Debug dbg( "#insert# ", 10 ); TQString txt1, txt2; @@ -374,14 +374,14 @@ struct PopupFillerHelpStruct { for ( SimpleTypeNamespace::SlaveList::iterator it = slaves.begin(); it != slaves.end(); ++it ) { SimpleTypeCodeModel* cm = dynamic_cast<SimpleTypeCodeModel*>( ( *it ).first.first.resolved().data() ); if ( cm && cm->item() ) { - TQPopupMenu * m = PopupTracker::createPopup( tqparent ); + TQPopupMenu * m = PopupTracker::createPopup( parent ); TQString scope = cm->scope().join("::"); TQMap< TQString, TQPopupMenu* >::iterator it = m_namespacePopupCache.find( scope ); if( it != m_namespacePopupCache.end() ) { - tqparent->insertItem( "Imported Namespace " + scope, *it ); + parent->insertItem( "Imported Namespace " + scope, *it ); delete m; } else { - tqparent->insertItem( "Imported Namespace " + scope, m ); + parent->insertItem( "Imported Namespace " + scope, m ); insertItem( m, ( new SimpleTypeCachedCodeModel( cm->item() ) ) ->desc(), prefix ); m_namespacePopupCache.insert( scope, m ); @@ -390,7 +390,7 @@ struct PopupFillerHelpStruct { SimpleTypeNamespace* cn = dynamic_cast<SimpleTypeNamespace*>( ( *it ).first.first.resolved().data() ); if( cn ) { TypePointer t = new SimpleTypeNamespace( cn ); //To avoid endless recursion, this needs to be done(the dynamic-cast above fails) - insertItem( tqparent, t->desc(), prefix ); + insertItem( parent, t->desc(), prefix ); } } } @@ -423,7 +423,7 @@ struct PopupFillerHelpStruct { int sLine, sCol, eLine, eCol; i->getStartPosition( &sLine, &sCol ); i->getEndPosition( &eLine, &eCol ); - insertItem( tqparent, (new SimpleTypeCodeModel( i ))->desc(), prefix + " " + (*it)->name() + TQString(" (%1 Lines): ").tqarg( eLine - sLine ) ); ///SimpleTypeCodeModel is used instead of SimpleTypeCachedNodeModel, so the detection at (1) does not trigger, this avoids endless recursion. + insertItem( parent, (new SimpleTypeCodeModel( i ))->desc(), prefix + " " + (*it)->name() + TQString(" (%1 Lines): ").tqarg( eLine - sLine ) ); ///SimpleTypeCodeModel is used instead of SimpleTypeCachedNodeModel, so the detection at (1) does not trigger, this avoids endless recursion. } } @@ -447,12 +447,12 @@ struct PopupFillerHelpStruct { } } - int id = tqparent->insertItem( txt1, receiver, TQT_SLOT( popupAction( int ) ) ); + int id = parent->insertItem( txt1, receiver, TQT_SLOT( popupAction( int ) ) ); if ( d.resolved() ) receiver->m_popupActions.insert( id, d.resolved() ->getDeclarationInfo() ); if ( !txt2.isEmpty() ) { - int id2 = tqparent->insertItem( txt2, receiver, TQT_SLOT( popupDefinitionAction( int ) ) ); + int id2 = parent->insertItem( txt2, receiver, TQT_SLOT( popupDefinitionAction( int ) ) ); if ( d.resolved() ) receiver->m_popupDefinitionActions.insert( id2, d.resolved() ->getDeclarationInfo() ); } @@ -523,7 +523,7 @@ struct PopupClassViewFillerHelpStruct { return false; } - void insertItem( TQPopupMenu* tqparent, SimpleTypeImpl::MemberInfo d , TQString prefix ) { + void insertItem( TQPopupMenu* parent, SimpleTypeImpl::MemberInfo d , TQString prefix ) { Q_UNUSED(prefix); FileDom f = receiver->m_pSupport->codeModel() ->fileByName( d.decl.file ); if ( !f ) @@ -537,12 +537,12 @@ struct PopupClassViewFillerHelpStruct { memType = "enum"; TQString txt = i18n( "Show %1 %2" ).tqarg( memType ).tqarg( cleanForMenu( d.name ) ); - int id = tqparent->insertItem( txt, receiver, TQT_SLOT( popupClassViewAction( int ) ) ); + int id = parent->insertItem( txt, receiver, TQT_SLOT( popupClassViewAction( int ) ) ); receiver->m_popupClassViewActions.insert( id, dom ); } - void insertItem ( TQPopupMenu* tqparent, TypeDesc d , TQString prefix ) { + void insertItem ( TQPopupMenu* parent, TypeDesc d , TQString prefix ) { Debug dbg( "#insert# ", 10 ); TQString txt; @@ -565,12 +565,12 @@ struct PopupClassViewFillerHelpStruct { for ( SimpleTypeNamespace::SlaveList::iterator it = slaves.begin(); it != slaves.end(); ++it ) { SimpleTypeCodeModel* cm = dynamic_cast<SimpleTypeCodeModel*>( ( *it ).first.first.resolved().data() ); if ( cm && cm->item() ) { - insertItem( tqparent, ( new SimpleTypeCachedCodeModel( cm->item() ) ) ->desc(), prefix ); + insertItem( parent, ( new SimpleTypeCachedCodeModel( cm->item() ) ) ->desc(), prefix ); } else { SimpleTypeNamespace* cn = dynamic_cast<SimpleTypeNamespace*>( ( *it ).first.first.resolved().data() ); if( cn ) { TypePointer t = new SimpleTypeNamespace( cn ); //to avoid endless recursion (caching would be better) - insertItem( tqparent, t->desc(), prefix ); + insertItem( parent, t->desc(), prefix ); } } } @@ -596,7 +596,7 @@ struct PopupClassViewFillerHelpStruct { } } - int id = tqparent->insertItem( txt, receiver, TQT_SLOT( popupClassViewAction( int ) ) ); + int id = parent->insertItem( txt, receiver, TQT_SLOT( popupClassViewAction( int ) ) ); if ( dom ) receiver->m_popupClassViewActions.insert( id, dom ); @@ -612,13 +612,13 @@ class PopupFiller { PopupFiller( HelpStruct str , TQString dAdd, int maxCount = 100 ) : struk( str ), depthAdd( dAdd ), s( maxCount ) {} - void fillIncludes( const DeclarationInfo& decl, TQPopupMenu* tqparent, bool& needSeparator ) { + void fillIncludes( const DeclarationInfo& decl, TQPopupMenu* parent, bool& needSeparator ) { if( !struk.receiver->getIncludeFiles()[ HashedString( decl.file ) ] ) { TQString file = decl.file; //The include-file seems to be missing if( needSeparator ) { needSeparator = false; - tqparent->insertSeparator(); + parent->insertSeparator(); } TQString includeFile = file; @@ -644,7 +644,7 @@ class PopupFiller { //kdDebug( 9007 ) << "found include-file \"" << includeFile << "\"" << endl; } - int id = tqparent->insertItem( i18n( "#include \"%1\" ( defines %2 )" ).tqarg ( includeFile ).tqarg( decl.name ), struk.receiver, TQT_SLOT( popupAction( int ) ) ); + int id = parent->insertItem( i18n( "#include \"%1\" ( defines %2 )" ).tqarg ( includeFile ).tqarg( decl.name ), struk.receiver, TQT_SLOT( popupAction( int ) ) ); DeclarationInfo fakeDec; fakeDec.name = decl.name; fakeDec.file = includeFile; @@ -653,7 +653,7 @@ class PopupFiller { } } - void fill( TQPopupMenu * tqparent, LocateResult d, TQString prefix = "", const DeclarationInfo & sourceVariable = DeclarationInfo() ) { + void fill( TQPopupMenu * parent, LocateResult d, TQString prefix = "", const DeclarationInfo & sourceVariable = DeclarationInfo() ) { Debug dbg( "#fl# ", 10 ) ; @@ -673,29 +673,29 @@ class PopupFiller { /*int id = m->insertItem( i18n("jump to variable-declaration \"%1\"").tqarg( type.sourceVariable.name ) , this, TQT_SLOT( popupAction( int ) ) ); m_popupActions.insert( id, type.sourceVariable );*/ - struk.insertItem( tqparent, f, prefix ); + struk.insertItem( parent, f, prefix ); - tqparent->insertSeparator(); + parent->insertSeparator(); if ( !sourceVariable.comment.isEmpty() ) { - TQPopupMenu * m = PopupTracker::createPopup( tqparent ); - tqparent->insertItem( i18n( "Comment on %1" ).tqarg( sourceVariable.name ), m ); + TQPopupMenu * m = PopupTracker::createPopup( parent ); + parent->insertItem( i18n( "Comment on %1" ).tqarg( sourceVariable.name ), m ); TQStringList ls = prepareTextForMenu( sourceVariable.comment, 15, 100 ); for ( TQStringList::iterator it = ls.begin(); it != ls.end(); ++it ) { m->insertItem( *it, 0, TQT_SLOT( popupClassViewAction( int ) ) ); } - tqparent->insertSeparator(); + parent->insertSeparator(); } } - struk.insertItem( tqparent, d, prefix ); + struk.insertItem( parent, d, prefix ); if( d->resolved() && !d->resolved()->specialization().isEmpty() ) { - SimpleType p = d->resolved()->tqparent(); + SimpleType p = d->resolved()->parent(); LocateResult r = p->locateDecType( d->name() ); if( r ) { - TQPopupMenu * m = PopupTracker::createPopup( tqparent ); - tqparent->insertItem( i18n( "Specialized from \"%1\"" ).tqarg( cleanForMenu( r->fullNameChain() ) ), m ); + TQPopupMenu * m = PopupTracker::createPopup( parent ); + parent->insertItem( i18n( "Specialized from \"%1\"" ).tqarg( cleanForMenu( r->fullNameChain() ) ), m ); fill( m, r ); } } @@ -703,11 +703,11 @@ class PopupFiller { TypeDesc::TemplateParams p = d->templateParams(); for ( TypeDesc::TemplateParams::iterator it = p.begin(); it != p.end(); ++it ) { //if( (*it)->resolved() ) { - TQPopupMenu * m = PopupTracker::createPopup( tqparent ); - tqparent->insertItem( i18n( "Template-param \"%1\"" ).tqarg( cleanForMenu( ( *it ) ->fullNameChain() ) ), m ); + TQPopupMenu * m = PopupTracker::createPopup( parent ); + parent->insertItem( i18n( "Template-param \"%1\"" ).tqarg( cleanForMenu( ( *it ) ->fullNameChain() ) ), m ); fill( m, **it ); /*} else { - fill( tqparent, **it, prefix + depthAdd ); + fill( parent, **it, prefix + depthAdd ); }*/ } @@ -715,16 +715,16 @@ class PopupFiller { if ( d->resolved() ->asFunction() ) { LocateResult rt = d->resolved() ->locateDecType( d->resolved() ->asFunction() ->getReturnType() ); if ( rt ) { - TQPopupMenu * m = PopupTracker::createPopup( tqparent ); - tqparent->insertItem( i18n( "Return-type \"%1\"" ).tqarg( cleanForMenu( rt->fullNameChain() ) ), m ); + TQPopupMenu * m = PopupTracker::createPopup( parent ); + parent->insertItem( i18n( "Return-type \"%1\"" ).tqarg( cleanForMenu( rt->fullNameChain() ) ), m ); fill( m, rt ); } TQValueList<TypeDesc> args = d->resolved() ->asFunction() ->getArgumentTypes(); TQStringList argNames = d->resolved() ->asFunction() ->getArgumentNames(); if ( !args.isEmpty() ) { - TQPopupMenu * m = PopupTracker::createPopup( tqparent ); - tqparent->insertItem( i18n( "Argument-types" ), m ); + TQPopupMenu * m = PopupTracker::createPopup( parent ); + parent->insertItem( i18n( "Argument-types" ), m ); TQStringList::iterator it2 = argNames.begin(); for ( TQValueList<TypeDesc>::iterator it = args.begin(); it != args.end(); ++it ) { LocateResult at = d->resolved() ->locateDecType( *it ); @@ -745,8 +745,8 @@ class PopupFiller { if ( d.trace() ) { TQValueList<TQPair<SimpleTypeImpl::MemberInfo, TypeDesc> > trace = d.trace() ->trace(); if ( !trace.isEmpty() ) { - TQPopupMenu * m = PopupTracker::createPopup( tqparent ); - tqparent->insertItem( i18n( "Trace" ), m ); + TQPopupMenu * m = PopupTracker::createPopup( parent ); + parent->insertItem( i18n( "Trace" ), m ); for ( TQValueList<TQPair<SimpleTypeImpl::MemberInfo, TypeDesc> >::iterator it = trace.begin(); it != trace.end(); ++it ) { TQPopupMenu * mo = PopupTracker::createPopup( m ); @@ -778,21 +778,21 @@ class PopupFiller { if ( d->resolved() ) { TQValueList<LocateResult> bases = d->resolved() ->getBases(); for ( TQValueList<LocateResult>::iterator it = bases.begin(); it != bases.end(); ++it ) { - TQPopupMenu * m = PopupTracker::createPopup( tqparent ); - tqparent->insertItem( i18n( "Base-class \"%1\"" ).tqarg( cleanForMenu( ( *it ) ->fullNameChain() ) ), m ); + TQPopupMenu * m = PopupTracker::createPopup( parent ); + parent->insertItem( i18n( "Base-class \"%1\"" ).tqarg( cleanForMenu( ( *it ) ->fullNameChain() ) ), m ); fill( m, *it ); } - if ( d->resolved() ->tqparent() && d->resolved() ->tqparent() ->desc() ) { - TQPopupMenu * m = PopupTracker::createPopup( tqparent ); - tqparent->insertItem( i18n( "Nested in \"%1\"" ).tqarg( cleanForMenu( d->resolved() ->tqparent() ->fullTypeResolved() ) ), m ); - fill( m, d->resolved() ->tqparent() ->desc() ); + if ( d->resolved() ->parent() && d->resolved() ->parent() ->desc() ) { + TQPopupMenu * m = PopupTracker::createPopup( parent ); + parent->insertItem( i18n( "Nested in \"%1\"" ).tqarg( cleanForMenu( d->resolved() ->parent() ->fullTypeResolved() ) ), m ); + fill( m, d->resolved() ->parent() ->desc() ); } if ( !d->resolved() ->comment().isEmpty() ) { - tqparent->insertSeparator(); - TQPopupMenu * m = PopupTracker::createPopup( tqparent ); - tqparent->insertItem( i18n( "Comment on %1" ).tqarg( cleanForMenu( d->name() ) ), m ); + parent->insertSeparator(); + TQPopupMenu * m = PopupTracker::createPopup( parent ); + parent->insertItem( i18n( "Comment on %1" ).tqarg( cleanForMenu( d->name() ) ), m ); TQStringList ls = prepareTextForMenu( d->resolved() ->comment(), 15, 100 ); for ( TQStringList::iterator it = ls.begin(); it != ls.end(); ++it ) { m->insertItem( *it, 0, TQT_SLOT( popupClassViewAction( int ) ) ); @@ -809,14 +809,14 @@ class PopupFiller { if ( !trace.isEmpty() ) { for ( TQValueList<TQPair<SimpleTypeImpl::MemberInfo, TypeDesc> >::iterator it = trace.begin(); it != trace.end(); ++it ) { if( struk.shouldShowIncludeMenu() && struk.receiver->cppSupport()->codeCompletionConfig()->preProcessAllHeaders() && !(*it).first.decl.file.operator TQString().isEmpty() ) - fillIncludes( (*it).first.decl, tqparent, needSeparator ); + fillIncludes( (*it).first.decl, parent, needSeparator ); } } } //Show the include-file for the item itself if( d->resolved() && !d->resolved()->isNamespace() && struk.receiver->cppSupport() ) { - fillIncludes( d->resolved()->getDeclarationInfo(), tqparent, needSeparator ); + fillIncludes( d->resolved()->getDeclarationInfo(), parent, needSeparator ); } } } @@ -1691,7 +1691,7 @@ void CppCodeCompletion::slotTextHint( int line, int column, TQString &text ) { } text += "type: \"" + type.resultType->fullTypeResolved() + "\""; } - if( type.resultType->tqparent()) text += "\nnested in: \"" + type.resultType->tqparent()->fullTypeResolvedWithScope() + "\""; + if( type.resultType->parent()) text += "\nnested in: \"" + type.resultType->parent()->fullTypeResolvedWithScope() + "\""; DeclarationInfo i = type.resultType->getDeclarationInfo(); if( i ) text += "\n" + i.locationToText(); @@ -2790,7 +2790,7 @@ void CppCodeCompletion::completeText( bool invokedOnDemand /*= false*/ ) { } if( !t->isNamespace() || invokedOnDemand || alwaysIncludeNamespaces ) computeCompletionEntryList( t, entryList, t->scope(), false, depth ); - t = t->tqparent(); + t = t->parent(); depth++; } } @@ -2807,7 +2807,7 @@ void CppCodeCompletion::completeText( bool invokedOnDemand /*= false*/ ) { } if ( ( (t->isNamespace() && invokedOnDemand) || alwaysIncludeNamespaces ) || ( first && isInstance ) ) computeCompletionEntryList( t, entryList, t->scope(), t->isNamespace() ? true : isInstance, depth ); - t = t->tqparent(); + t = t->parent(); depth++; first = false; } @@ -2890,7 +2890,7 @@ void CppCodeCompletion::completeText( bool invokedOnDemand /*= false*/ ) { if ( method ) signatureList += computeSignatureList( method ); if ( t ) - t = t->tqparent(); + t = t->parent(); } while ( !ready && s ); if ( !signatureList.isEmpty() ) { @@ -3293,7 +3293,7 @@ FunctionDefinitionAST * CppCodeCompletion::functionDefinition( AST* node ) { while ( node ) { if ( node->nodeType() == NodeType_FunctionDefinition ) return static_cast<FunctionDefinitionAST*>( node ); - node = node->tqparent(); + node = node->parent(); } return 0; } @@ -3360,7 +3360,7 @@ TQString codeModelAccessToString( CodeModelItem::Access access ) { #define MAXCOMMENTCOLUMNS 45 -TQString CppCodeCompletion::commentFromItem( const SimpleType& tqparent, const ItemDom& item ) { +TQString CppCodeCompletion::commentFromItem( const SimpleType& parent, const ItemDom& item ) { --m_maxComments; static TQString maxReached = " "; if( m_maxComments < 0 ) { @@ -3371,8 +3371,8 @@ TQString CppCodeCompletion::commentFromItem( const SimpleType& tqparent, const I item->getStartPosition( &line, &col ); - if ( !tqparent->scope().isEmpty() ) { - ret += "Container: " + tqparent->fullTypeResolvedWithScope(); + if ( !parent->scope().isEmpty() ) { + ret += "Container: " + parent->fullTypeResolvedWithScope(); } if ( item->isEnum() ) { @@ -3451,7 +3451,7 @@ TQString CppCodeCompletion::commentFromItem( const SimpleType& tqparent, const I ret += "\nKind: Typedef"; if ( t ) { ret += "\nType: " + t->type(); - LocateResult r = tqparent->locateDecType( t->type() ); + LocateResult r = parent->locateDecType( t->type() ); if ( r.desc().resolved() ) ret += "\nResolved type: " + r.desc().resolved() ->fullTypeResolvedWithScope(); else @@ -3469,7 +3469,7 @@ TQString CppCodeCompletion::commentFromItem( const SimpleType& tqparent, const I return ret; } -TQString CppCodeCompletion::commentFromTag( const SimpleType& tqparent, Tag& tag ) { +TQString CppCodeCompletion::commentFromTag( const SimpleType& parent, Tag& tag ) { --m_maxComments; static TQString maxReached = " "; if( m_maxComments < 0 ) { @@ -3480,8 +3480,8 @@ TQString CppCodeCompletion::commentFromTag( const SimpleType& tqparent, Tag& tag tag.getStartPosition( &line, &col ); TQString ret; // = tag.comment(); - if ( !tqparent->scope().isEmpty() ) { - ret += "Container: " + tqparent->fullTypeResolvedWithScope(); + if ( !parent->scope().isEmpty() ) { + ret += "Container: " + parent->fullTypeResolvedWithScope(); } /* if( tag.kind() == Tag::Kind_Enum ) { @@ -3571,7 +3571,7 @@ TQString CppCodeCompletion::commentFromTag( const SimpleType& tqparent, Tag& tag if ( tag.kind() == Tag::Kind_Typedef ) { ret += "\nKind: Typedef"; ret += "\nType: " + tagType( tag ); - LocateResult r = tqparent->locateDecType( tagType( tag ) ); + LocateResult r = parent->locateDecType( tagType( tag ) ); if ( r.desc().resolved() ) ret += "\nResolved type: " + r.desc().resolved() ->fullTypeResolvedWithScope(); else @@ -3962,7 +3962,7 @@ void CppCodeCompletion::computeCompletionEntryList( SimpleType type, TQValueList computeCompletionEntryList( type, entryList, scope->namespaceList(), isInstance, depth ); } -void CppCodeCompletion::computeCompletionEntryList( TQString tqparent, SimpleType type, TQValueList< CodeCompletionEntry > & entryList, const ClassList & lst, bool isInstance, int depth ) { +void CppCodeCompletion::computeCompletionEntryList( TQString parent, SimpleType type, TQValueList< CodeCompletionEntry > & entryList, const ClassList & lst, bool isInstance, int depth ) { Debug d( "#cel#" ); if ( !safetyCounter || !d ) return ; @@ -3981,7 +3981,7 @@ void CppCodeCompletion::computeCompletionEntryList( TQString tqparent, SimpleTyp if ( isInstance ) continue; - entry.userdata = TQString( "%1%2%3%4%5" ).tqarg( CodeModelItem::Public ).tqarg( depth ).tqarg( tqparent ).tqarg( 6 ); + entry.userdata = TQString( "%1%2%3%4%5" ).tqarg( CodeModelItem::Public ).tqarg( depth ).tqarg( parent ).tqarg( 6 ); entryList << entry; @@ -3993,7 +3993,7 @@ void CppCodeCompletion::computeCompletionEntryList( TQString tqparent, SimpleTyp } } -void CppCodeCompletion::computeCompletionEntryList( TQString tqparent, SimpleType type, TQValueList< CodeCompletionEntry > & entryList, const TypeAliasList & lst, bool isInstance, int depth ) { +void CppCodeCompletion::computeCompletionEntryList( TQString parent, SimpleType type, TQValueList< CodeCompletionEntry > & entryList, const TypeAliasList & lst, bool isInstance, int depth ) { Debug d( "#cel#" ); if ( !safetyCounter || !d ) return ; @@ -4015,7 +4015,7 @@ void CppCodeCompletion::computeCompletionEntryList( TQString tqparent, SimpleTyp entry.prefix = stringMult( depth, " " ) + entry.prefix.stripWhiteSpace(); entry.text = klass->name(); entry.comment = commentFromItem( type, klass.data() ); - entry.userdata = TQString( "%1%2%3%4%5" ).tqarg( CodeModelItem::Public ).tqarg( depth ).tqarg( tqparent ).tqarg( 5 ); + entry.userdata = TQString( "%1%2%3%4%5" ).tqarg( CodeModelItem::Public ).tqarg( depth ).tqarg( parent ).tqarg( 5 ); entryList << entry; } } |