kdevplatform/language/duchain
duchainutils.cpp
Go to the documentation of this file.
52 CodeCompletionModel::CompletionProperties DUChainUtils::completionProperties(const Declaration* dec)
146 else if( dec->context()->type() != DUContext::Class && dec->context()->type() != DUContext::Enum )
157 QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kdevelop/pics/" name ".png"))\
261 qCDebug(LANGUAGE) << "url-mismatch between content and proxy:" << top->url().toUrl() << ret->url().toUrl();
301 ItemUnderCursorInternal itemUnderCursorInternal(const CursorInRevision& c, DUContext* ctx, RangeInRevision::ContainsBehavior behavior)
303 //Search all collapsed sub-contexts. In C++, those can contain declarations that have ranges out of the context
307 if(subCtx->range().contains(c, behavior) || subCtx->range().isEmpty() || subCtx->range().start.line == c.line || subCtx->range().end.line == c.line) {
325 return {ctx->topContext()->usedDeclarationForIndex(ctx->uses()[a].m_declarationIndex), ctx, ctx->uses()[a].m_range};
332 DUChainUtils::ItemUnderCursor DUChainUtils::itemUnderCursor(const QUrl& url, const KTextEditor::Cursor& cursor)
340 ItemUnderCursorInternal decl = itemUnderCursorInternal(top->transformToLocalRevision(cursor), top, RangeInRevision::Default);
343 decl = itemUnderCursorInternal(top->transformToLocalRevision(cursor), top, RangeInRevision::IncludeBackEdge);
348 Declaration* DUChainUtils::declarationForDefinition(Declaration* definition, TopDUContext* topContext)
365 Declaration* DUChainUtils::declarationInLine(const KTextEditor::Cursor& _cursor, DUContext* ctx) {
462 PersistentSymbolTable::self().declarations(decl->qualifiedIdentifier(), count, allDeclarations);
471 static QList<Declaration*> inheritersInternal(const Declaration* decl, uint& maxAllowedSteps, bool collectVersions)
503 PersistentSymbolTable::self().declarations(decl->qualifiedIdentifier(), count, allDeclarations);
519 QList<Declaration*> DUChainUtils::inheriters(const Declaration* decl, uint& maxAllowedSteps, bool collectVersions)
530 QList<Declaration*> DUChainUtils::overriders(const Declaration* currentClass, const Declaration* overriddenDeclaration, uint& maxAllowedSteps) {
536 if(currentClass != overriddenDeclaration->context()->owner() && currentClass->internalContext())
537 ret += currentClass->internalContext()->findLocalDeclarations(overriddenDeclaration->identifier(), CursorInRevision::invalid(), currentClass->topContext(), overriddenDeclaration->abstractType());
599 CursorInRevision::invalid(), decl->abstractType(), decl->topContext(), DUContext::DontSearchInParent);
626 QVector<KDevelop::Problem::Ptr> KDevelop::DUChainUtils::allProblemsForContext(const KDevelop::ReferencedTopDUContext& top)
KDEVPLATFORMLANGUAGE_EXPORT ItemUnderCursor itemUnderCursor(const QUrl &url, const KTextEditor::Cursor &cursor)
Returns 1.
Definition: duchainutils.cpp:332
QList< Declaration * > findDeclarations(const QualifiedIdentifier &identifier, const CursorInRevision &position=CursorInRevision::invalid(), const AbstractType::Ptr &dataType=AbstractType::Ptr(), const TopDUContext *topContext=nullptr, SearchFlags flags=NoSearchFlags) const
Searches for and returns a declaration with a given identifier in this context, which is currently ac...
Definition: ducontext.cpp:792
Declaration * usedDeclarationForIndex(unsigned int declarationIndex) const
Tries to retrieve the used declaration.
Definition: topducontext.cpp:1146
KDevVarLengthArray< IndexedDUContext > indexedImporters() const
Returns the list of indexed importers.
Definition: ducontext.cpp:886
A context that declares functions, namespaces or classes.
Definition: ducontext.h:103
static PersistentSymbolTable & self()
Definition: persistentsymboltable.cpp:494
KDEVPLATFORMLANGUAGE_EXPORT KDevelop::TopDUContext * standardContextForUrl(const QUrl &url, bool preferProxyContext=false)
Asks the language-plugins for standard-contexts for the given url, and returns one if available.
Definition: duchainutils.cpp:273
int indexForUsedDeclaration(Declaration *declaration, bool create=true)
Retrieves or creates a local index that is to be used for referencing the given.
Definition: topducontext.cpp:1159
KDevelop can unload unused top-context at any time.
Definition: topducontext.h:59
KDEVPLATFORMLANGUAGE_EXPORT QList< IndexedDeclaration > collectAllVersions(Declaration *decl)
Uses the persistent symbol table to find all occurrences of this declaration, based on its identifier...
Definition: duchainutils.cpp:454
KDEVPLATFORMLANGUAGE_EXPORT QIcon iconForProperties(KTextEditor::CodeCompletionModel::CompletionProperties p)
Definition: duchainutils.cpp:161
QVector< Import > importedParentContexts() const override
Returns the list of imported parent contexts for this context.
Definition: topducontext.cpp:1024
virtual ~DUChainItemFilter()
Definition: duchainutils.cpp:390
KDEVPLATFORMLANGUAGE_EXPORT TopDUContext * contentContextFromProxyContext(TopDUContext *top)
Returns the content-context associated to the given proxy-contex.
Definition: duchainutils.cpp:247
const_iterator constEnd() const
may represent multiple different types
Definition: abstracttype.h:226
KDEVPLATFORMLANGUAGE_EXPORT Declaration * declarationInLine(const KTextEditor::Cursor &cursor, KDevelop::DUContext *ctx)
Returns the first declaration in the given line.
Definition: duchainutils.cpp:365
virtual bool isFunctionDeclaration() const
Determine whether this declaration is a function declaration.
Definition: declaration.cpp:655
const_iterator constBegin() const
KTextEditor::Cursor transformFromLocalRevision(const CursorInRevision &cursor) const
KDEVPLATFORMLANGUAGE_EXPORT uint contextCountUses(DUContext *context, Declaration *declaration)
Returns the total count of uses of the given declaration under the given context.
Definition: duchainutils.cpp:583
static uint countUses(DUContext *context, int usedDeclarationIndex)
Definition: duchainutils.cpp:565
KDEVPLATFORMLANGUAGE_EXPORT QList< Declaration * > overriders(const Declaration *currentClass, const Declaration *overriddenDeclaration, uint &maxAllowedSteps)
Gets all functions that override the function overriddenDeclaration, starting the search at currentCl...
Definition: duchainutils.cpp:530
bool isProxyContext() const
A language-specific flag used by C++ to mark one context as a proxy of another.
Definition: parsingenvironment.cpp:177
QExplicitlySharedDataPointer< ParsingEnvironmentFile > parsingEnvironmentFile() const
Definition: topducontext.cpp:567
Represents a single declaration in a definition-use chain.
Definition: declaration.h:51
void declarations(const IndexedQualifiedIdentifier &id, uint &count, const IndexedDeclaration *&declarations) const
Retrieves all the declarations for a given IndexedQualifiedIdentifier in an efficient way.
Definition: persistentsymboltable.cpp:399
KDEVPLATFORMLANGUAGE_EXPORT DUContext * argumentContext(Declaration *decl)
Definition: duchainutils.cpp:439
TopDUContext * chainForDocument(const QUrl &document, bool proxyContext=false) const
Return any chain for the given document If available, the version accepting IndexedString should be u...
Definition: duchain.cpp:1389
bool isTypeAlias() const
Determine if this declaration is a type-alias (in c++ typedef).
Definition: declaration.cpp:538
virtual QVector< Import > importedParentContexts() const
Returns the list of imported parent contexts for this context.
Definition: ducontext.cpp:1220
Represents a declaration only by its global indices.
Definition: indexeddeclaration.h:33
KDEVPLATFORMLANGUAGE_EXPORT void collectItems(DUContext *context, DUChainItemFilter &filter)
walks a context, all its sub-contexts, and all its declarations in exactly the order they appear in t...
Definition: duchainutils.cpp:393
CursorInRevision transformToLocalRevision(const KTextEditor::Cursor &cursor) const
Transforms the given cursor in the current document revision to its according position in the parsed ...
Definition: duchainbase.cpp:176
An instance of a type is declared("MyClass m;")
Definition: declaration.h:65
RangeInRevision range() const
Returns the range assigned to this object, in the document revision when this document was last parse...
Definition: duchainbase.cpp:152
TopDUContext * topContext() const override
Determine the top context to which this object belongs.
Definition: declaration.cpp:633
KDEVPLATFORMLANGUAGE_EXPORT Declaration * overridden(const Declaration *decl)
Returns the declaration that is overridden by the given one, or zero.
Definition: duchainutils.cpp:587
bool inSymbolTable() const
Access whether this declaration is in the symbol table.
Definition: declaration.cpp:573
The top context in a definition-use chain for one source file.
Definition: topducontext.h:113
DUContext * context() const
Access the parent context of this declaration.
Definition: declaration.cpp:279
ItemUnderCursorInternal itemUnderCursorInternal(const CursorInRevision &c, DUContext *ctx, RangeInRevision::ContainsBehavior behavior)
Definition: duchainutils.cpp:301
KDEVPLATFORMLANGUAGE_EXPORT QVector< KDevelop::Problem::Ptr > allProblemsForContext(const ReferencedTopDUContext &top)
Definition: duchainutils.cpp:626
void reserve(int size)
Definition: duchainbase.h:29
IF this flag is set, findDeclarations(..) will not search for the identifier in parent-contexts(which...
Definition: ducontext.h:120
KDEVPLATFORMLANGUAGE_EXPORT DUContext * functionContext(Declaration *decl)
If the given declaration is a function-declaration, this follows the context-structure up to the func...
Definition: duchainutils.cpp:610
QVector< DUContext * > childContexts() const
Returns the list of immediate child contexts for this context.
Definition: ducontext.cpp:479
QList< Declaration * > findLocalDeclarations(const IndexedIdentifier &identifier, const CursorInRevision &position=CursorInRevision::invalid(), const TopDUContext *topContext=nullptr, const AbstractType::Ptr &dataType=AbstractType::Ptr(), SearchFlags flags=NoSearchFlags) const
Returns the type of any identifier defined in this context, or null if one is not found.
Definition: ducontext.cpp:535
QualifiedIdentifier qualifiedIdentifier() const
Determine the global qualified identifier of this declaration.
Definition: declaration.cpp:267
KDEVPLATFORMLANGUAGE_EXPORT QList< Declaration * > inheriters(const Declaration *decl, uint &maxAllowedSteps, bool collectVersions=true)
If the given declaration is a class, this gets all classes that inherit this one.
Definition: duchainutils.cpp:519
const_iterator constEnd() const
QList< ProblemPointer > problems() const
Returns a list of all problems encountered while parsing this top-context.
Definition: topducontext.cpp:963
#define RETURN_CACHED_ICON(name)
We have to construct the item from the pixmap, else the icon will be marked as "load on demand",...
Definition: duchainutils.cpp:156
Definition: abstractfunctiondeclaration.cpp:27
A single context in source code, represented as a node in a directed acyclic graph.
Definition: ducontext.h:72
KDEVPLATFORMLANGUAGE_EXPORT KTextEditor::CodeCompletionModel::CompletionProperties completionProperties(const Declaration *dec)
Definition: duchainutils.cpp:52
int usesCount() const
Returns the count of uses that can be accessed through uses()
Definition: ducontext.cpp:1333
KDEVPLATFORMLANGUAGE_EXPORT Declaration * declarationForDefinition(Declaration *definition, TopDUContext *topContext=nullptr)
If the given declaration is a definition, and has a real declaration attached, returns that declarati...
Definition: duchainutils.cpp:348
DUContext * internalContext() const
Retrieve the context that is opened by this declaration, if one exists.
Definition: declaration.cpp:425
static QList< Declaration * > inheritersInternal(const Declaration *decl, uint &maxAllowedSteps, bool collectVersions)
Definition: duchainutils.cpp:471
AbstractType::Ptr abstractType() const
Access this declaration's type.
Definition: declaration.cpp:243
Declaration * owner() const
If this context was opened by a declaration or definition, this returns that item.
Definition: ducontext.cpp:486
const_iterator constBegin() const
const Use * uses() const
Uses: A "Use" represents any position in a document where a Declaration is used literally.
Definition: ducontext.cpp:1321
virtual QVector< Declaration * > localDeclarations(const TopDUContext *source=nullptr) const
Returns all local declarations.
Definition: ducontext.cpp:967
KDEVPLATFORMLANGUAGE_EXPORT QIcon iconForDeclaration(const Declaration *dec)
Definition: duchainutils.cpp:242
static bool hasUse(DUContext *context, int usedDeclarationIndex)
Definition: duchainutils.cpp:547
KDEVPLATFORMLANGUAGE_EXPORT bool contextHasUse(DUContext *context, Declaration *declaration)
Returns whether the given context or any of its child-contexts contain a use of the given declaration...
Definition: duchainutils.cpp:561
Represents a context only by its global indices.
Definition: indexedducontext.h:35
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Apr 9 2021 23:29:59 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Apr 9 2021 23:29:59 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.