• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdevelop API Reference
  • KDE Home
  • Contact Us
 

kdevplatform/language/duchain

  • sources
  • kfour-appscomplete
  • kdevelop
  • kdevplatform
  • language
  • duchain
duchainutils.h
Go to the documentation of this file.
1 /*
2  * DUChain Utilities
3  *
4  * Copyright 2007 Hamish Rodda <[email protected]>
5  * Copyright 2007-2009 David Nolden <[email protected]>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Library General Public License as
9  * published by the Free Software Foundation; either version 2 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public
18  * License along with this program; if not, write to the
19  * Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef KDEVPLATFORM_DUCHAINUTILS_H
24 #define KDEVPLATFORM_DUCHAINUTILS_H
25 
26 #include <QUrl>
27 
28 #include <language/languageexport.h>
29 #include <language/duchain/problem.h>
30 #include <language/duchain/topducontext.h>
31 
32 #include <KTextEditor/CodeCompletionModel>
33 
34 class QIcon;
35 
36 namespace KTextEditor {
37 class Cursor;
38 }
39 
40 namespace KDevelop {
41 class Declaration;
42 class DUChainBase;
43 class DUContext;
44 class IndexedString;
45 class TopDUContext;
46 class IndexedDeclaration;
47 
51 namespace DUChainUtils {
52 KDEVPLATFORMLANGUAGE_EXPORT KTextEditor::CodeCompletionModel::CompletionProperties completionProperties(
53  const Declaration* dec);
54 KDEVPLATFORMLANGUAGE_EXPORT QIcon iconForProperties(KTextEditor::CodeCompletionModel::CompletionProperties p);
55 KDEVPLATFORMLANGUAGE_EXPORT QIcon iconForDeclaration(const Declaration* dec);
63 KDEVPLATFORMLANGUAGE_EXPORT KDevelop::TopDUContext* standardContextForUrl(const QUrl& url,
64  bool preferProxyContext = false);
70 KDEVPLATFORMLANGUAGE_EXPORT TopDUContext* contentContextFromProxyContext(TopDUContext* top);
71 struct KDEVPLATFORMLANGUAGE_EXPORT ItemUnderCursor
72 {
73  Declaration* declaration; // found declaration (either declared/defined or used)
74  DUContext* context; // context in which the declaration, definition, or use was found
75  KTextEditor::Range range; // range of the declaration/definition/use
76 };
81 KDEVPLATFORMLANGUAGE_EXPORT ItemUnderCursor itemUnderCursor(const QUrl& url, const KTextEditor::Cursor& cursor);
84 KDEVPLATFORMLANGUAGE_EXPORT Declaration* declarationForDefinition(Declaration* definition,
85  TopDUContext* topContext = nullptr);
88 KDEVPLATFORMLANGUAGE_EXPORT Declaration* declarationInLine(const KTextEditor::Cursor& cursor, KDevelop::DUContext* ctx);
89 
90 class KDEVPLATFORMLANGUAGE_EXPORT DUChainItemFilter
91 {
92 public:
93  virtual bool accept(Declaration* decl) = 0;
94  //Should return whether processing should be deepened into the given context
95  virtual bool accept(DUContext* ctx) = 0;
96  virtual ~DUChainItemFilter();
97 };
100 KDEVPLATFORMLANGUAGE_EXPORT void collectItems(DUContext* context, DUChainItemFilter& filter);
101 
102 KDEVPLATFORMLANGUAGE_EXPORT DUContext* argumentContext(Declaration* decl);
103 
106 KDEVPLATFORMLANGUAGE_EXPORT QList<IndexedDeclaration> collectAllVersions(Declaration* decl);
107 
113 KDEVPLATFORMLANGUAGE_EXPORT QList<Declaration*> inheriters(const Declaration* decl, uint& maxAllowedSteps,
114  bool collectVersions = true);
115 
118 KDEVPLATFORMLANGUAGE_EXPORT QList<Declaration*> overriders(const Declaration* currentClass,
119  const Declaration* overriddenDeclaration,
120  uint& maxAllowedSteps);
121 
123 KDEVPLATFORMLANGUAGE_EXPORT bool contextHasUse(DUContext* context, Declaration* declaration);
124 
126 KDEVPLATFORMLANGUAGE_EXPORT uint contextCountUses(DUContext* context, Declaration* declaration);
127 
129 KDEVPLATFORMLANGUAGE_EXPORT Declaration* overridden(const Declaration* decl);
130 
133 KDEVPLATFORMLANGUAGE_EXPORT DUContext* functionContext(Declaration* decl);
134 
135 KDEVPLATFORMLANGUAGE_EXPORT QVector<KDevelop::Problem::Ptr> allProblemsForContext(const ReferencedTopDUContext& top);
136 }
137 }
138 
139 #endif // KDEVPLATFORM_DUCHAINUTILS_H
KDevelop::DUChainUtils::itemUnderCursor
KDEVPLATFORMLANGUAGE_EXPORT ItemUnderCursor itemUnderCursor(const QUrl &url, const KTextEditor::Cursor &cursor)
Returns 1.
Definition: duchainutils.cpp:332
KDevelop::DUChainUtils::standardContextForUrl
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
KDevelop::DUChainUtils::DUChainItemFilter
Definition: duchainutils.h:90
QUrl
KDevelop::ReferencedTopDUContext
KDevelop can unload unused top-context at any time.
Definition: topducontext.h:59
KDevelop::DUChainUtils::collectAllVersions
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
KDevelop::DUChainUtils::iconForProperties
KDEVPLATFORMLANGUAGE_EXPORT QIcon iconForProperties(KTextEditor::CodeCompletionModel::CompletionProperties p)
Definition: duchainutils.cpp:161
KDevelop::DUChainUtils::contentContextFromProxyContext
KDEVPLATFORMLANGUAGE_EXPORT TopDUContext * contentContextFromProxyContext(TopDUContext *top)
Returns the content-context associated to the given proxy-contex.
Definition: duchainutils.cpp:247
KDevelop::DUChainUtils::declarationInLine
KDEVPLATFORMLANGUAGE_EXPORT Declaration * declarationInLine(const KTextEditor::Cursor &cursor, KDevelop::DUContext *ctx)
Returns the first declaration in the given line.
Definition: duchainutils.cpp:365
KDevelop::DUChainUtils::contextCountUses
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
QList
KDevelop::DUChainUtils::overriders
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
topducontext.h
KDevelop::Declaration
Represents a single declaration in a definition-use chain.
Definition: declaration.h:51
problem.h
KDevelop::DUChainUtils::argumentContext
KDEVPLATFORMLANGUAGE_EXPORT DUContext * argumentContext(Declaration *decl)
Definition: duchainutils.cpp:439
KDevelop::DUChainUtils::ItemUnderCursor
Definition: duchainutils.h:71
KDevelop::DUChainUtils::collectItems
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
KDevelop::DUChainUtils::overridden
KDEVPLATFORMLANGUAGE_EXPORT Declaration * overridden(const Declaration *decl)
Returns the declaration that is overridden by the given one, or zero.
Definition: duchainutils.cpp:587
KDevelop::TopDUContext
The top context in a definition-use chain for one source file.
Definition: topducontext.h:113
QIcon
KDevelop::DUChainUtils::allProblemsForContext
KDEVPLATFORMLANGUAGE_EXPORT QVector< KDevelop::Problem::Ptr > allProblemsForContext(const ReferencedTopDUContext &top)
Definition: duchainutils.cpp:626
KTextEditor
Definition: duchainbase.h:29
KDevelop::DUChainUtils::functionContext
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
KDevelop::DUChainUtils::inheriters
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
KDevelop::DUChainUtils::ItemUnderCursor::declaration
Declaration * declaration
Definition: duchainutils.h:73
KDevelop::DUChainUtils::ItemUnderCursor::context
DUContext * context
Definition: duchainutils.h:74
KDevelop
Definition: abstractfunctiondeclaration.cpp:27
KDevelop::DUContext
A single context in source code, represented as a node in a directed acyclic graph.
Definition: ducontext.h:72
KDevelop::DUChainUtils::completionProperties
KDEVPLATFORMLANGUAGE_EXPORT KTextEditor::CodeCompletionModel::CompletionProperties completionProperties(const Declaration *dec)
Definition: duchainutils.cpp:52
KDevelop::DUChainUtils::declarationForDefinition
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
QVector
KDevelop::DUChainUtils::ItemUnderCursor::range
KTextEditor::Range range
Definition: duchainutils.h:75
KDevelop::DUChainUtils::iconForDeclaration
KDEVPLATFORMLANGUAGE_EXPORT QIcon iconForDeclaration(const Declaration *dec)
Definition: duchainutils.cpp:242
KDevelop::DUChainUtils::contextHasUse
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
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Jan 19 2021 23:36:33 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kdevplatform/language/duchain

Skip menu "kdevplatform/language/duchain"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdevelop API Reference

Skip menu "kdevelop API Reference"
  • kdevplatform
  •   debugger
  •   documentation
  •   interfaces
  •   language
  •     assistant
  •     backgroundparser
  •     checks
  •     classmodel
  •     codecompletion
  •     codegen
  •     duchain
  •     editor
  •     highlighting
  •     interfaces
  •     util
  •   outputview
  •   project
  •   serialization
  •   shell
  •   sublime
  •   tests
  •   util
  •   vcs

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal