language/duchain
KDevelop::DUChainUtils Namespace Reference
A namespace which contains convenience utilities for navigating definition-use chains. More...
Functions | |
| QList< IndexedDeclaration > | collectAllVersions (Declaration *decl) |
| void | collectItems (DUContext *context, DUChainItemFilter &filter) |
| KTextEditor::CodeCompletionModel::CompletionProperties | completionProperties (const Declaration *dec) |
| uint | contextCountUses (DUContext *context, Declaration *declaration) |
| bool | contextHasUse (DUContext *context, Declaration *declaration) |
| Declaration * | declarationForDefinition (Declaration *definition, TopDUContext *topContext=0) |
| Declaration * | declarationInLine (const KDevelop::SimpleCursor &cursor, KDevelop::DUContext *ctx) |
| DUContext * | getArgumentContext (Declaration *decl) |
| DUContext * | getFunctionContext (Declaration *decl) |
| QList< Declaration * > | getInheriters (const Declaration *decl, uint &maxAllowedSteps, bool collectVersions=true) |
| Declaration * | getOverridden (const Declaration *decl) |
| QList< Declaration * > | getOverriders (const Declaration *currentClass, const Declaration *overriddenDeclaration, uint &maxAllowedSteps) |
| QIcon | iconForDeclaration (const Declaration *dec) |
| QIcon | iconForProperties (KTextEditor::CodeCompletionModel::CompletionProperties p) |
| Declaration * | itemUnderCursor (const KUrl &url, const SimpleCursor &cursor) |
| KDevelop::TopDUContext * | standardContextForUrl (const KUrl &url) |
Detailed Description
A namespace which contains convenience utilities for navigating definition-use chains.
Function Documentation
| QList< IndexedDeclaration > KDevelop::DUChainUtils::collectAllVersions | ( | Declaration * | decl | ) |
Uses the persistent symbol table to find all occurrences of this declaration, based on its identifier.
The result should be filtered to make sure that the declaration is actually useful to you.
Definition at line 395 of file duchainutils.cpp.
| void KDevelop::DUChainUtils::collectItems | ( | DUContext * | context, | |
| DUChainItemFilter & | filter | |||
| ) |
walks a context, all its sub-contexts, and all its declarations in exactly the order they appear in in the file.
Re-implement DUChainItemFilter to do something with the items.
Definition at line 335 of file duchainutils.cpp.
| uint KDevelop::DUChainUtils::contextCountUses | ( | DUContext * | context, | |
| Declaration * | declaration | |||
| ) |
Returns the total count of uses of the given declaration under the given context.
Definition at line 511 of file duchainutils.cpp.
| bool KDevelop::DUChainUtils::contextHasUse | ( | DUContext * | context, | |
| Declaration * | declaration | |||
| ) |
Returns whether the given context or any of its child-contexts contain a use of the given declaration. This is relatively expensive.
Definition at line 491 of file duchainutils.cpp.
| Declaration * KDevelop::DUChainUtils::declarationForDefinition | ( | Declaration * | definition, | |
| TopDUContext * | topContext = 0 | |||
| ) |
If the given declaration is a definition, and has a real declaration attached, returns that declarations.
Else returns the given argument.
Definition at line 294 of file duchainutils.cpp.
| Declaration * KDevelop::DUChainUtils::declarationInLine | ( | const KDevelop::SimpleCursor & | cursor, | |
| KDevelop::DUContext * | ctx | |||
| ) |
Returns the first declaration in the given line. Searches the given context and all sub-contexts.
Definition at line 311 of file duchainutils.cpp.
| DUContext * KDevelop::DUChainUtils::getFunctionContext | ( | Declaration * | decl | ) |
If the given declaration is a function-declaration, this follows the context-structure up to the function-context that contains the arguments, and returns it.
Definition at line 538 of file duchainutils.cpp.
| QList< Declaration * > KDevelop::DUChainUtils::getInheriters | ( | const Declaration * | decl, | |
| uint & | maxAllowedSteps, | |||
| bool | collectVersions = true | |||
| ) |
If the given declaration is a class, this gets all classes that inherit this one.
For a class, returns all classes that inherit it.
- Parameters:
-
collectVersions If this is true, the persistent symbol table is used to first find all registered versions of this class, and then get the inheriters from them all together. This is needed for C++. maxAllowedSteps The maximum of steps allowed. If this is zero in the end, this means the search has been stopped with the max. reached If you really want _all_ inheriters, you should initialize it with a very large value.
Definition at line 413 of file duchainutils.cpp.
| Declaration * KDevelop::DUChainUtils::getOverridden | ( | const Declaration * | decl | ) |
Returns the declaration that is overridden by the given one, or zero.
Definition at line 515 of file duchainutils.cpp.
| QList< Declaration * > KDevelop::DUChainUtils::getOverriders | ( | const Declaration * | currentClass, | |
| const Declaration * | overriddenDeclaration, | |||
| uint & | maxAllowedSteps | |||
| ) |
Gets all functions that override the function.
- Parameters:
-
overriddenDeclaration,starting the search at currentClass maxAllowedSteps The maximum of steps allowed. If this is zero in the end, this means the search has been stopped with the max. reached
Definition at line 462 of file duchainutils.cpp.
| Declaration * KDevelop::DUChainUtils::itemUnderCursor | ( | const KUrl & | url, | |
| const SimpleCursor & | cursor | |||
| ) |
Returns the Declaration/Definition under the cursor, or zero.
DUChain does not need to be locked. If the item under the cursor is a use, the declaration is returned.
Definition at line 269 of file duchainutils.cpp.
| TopDUContext * KDevelop::DUChainUtils::standardContextForUrl | ( | const KUrl & | url | ) |
Asks the language-plugins for standard-contexts for the given url, and returns one if available.
If there is no language-plugin registered for the given url, it will just try to get any top-context for the file from the du-chain.
Definition at line 231 of file duchainutils.cpp.
KDE 4.4 API Reference