• 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
abstractfunctiondeclaration.h
Go to the documentation of this file.
1 /* This file is part of KDevelop
2  Copyright 2007 Hamish Rodda <[email protected]>
3  Copyright 2007-2008 David Nolden <[email protected]>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef KDEVPLATFORM_ABSTRACTFUNCTIONDECLARATION_H
21 #define KDEVPLATFORM_ABSTRACTFUNCTIONDECLARATION_H
22 
23 #include <language/languageexport.h>
24 #include "indexedducontext.h"
25 
26 namespace KDevelop {
27 class DUContext;
28 class IndexedString;
29 
30 class AbstractFunctionDeclarationData
31 {
32 public:
33  AbstractFunctionDeclarationData() : m_isVirtual(false)
34  , m_isInline(false)
35  , m_isExplicit(false)
36  {
37  }
38  IndexedDUContext m_functionContext;
39  bool m_isVirtual : 1;
40  bool m_isInline : 1;
41  bool m_isExplicit : 1;
42 };
43 
48 class KDEVPLATFORMLANGUAGE_EXPORT AbstractFunctionDeclaration
49 {
50 public:
51  virtual ~AbstractFunctionDeclaration();
52 
53  enum FunctionSpecifier {
54  VirtualSpecifier = 0x1 ,
55  InlineSpecifier = 0x2 ,
56  ExplicitSpecifier = 0x4
57  };
58  Q_DECLARE_FLAGS(FunctionSpecifiers, FunctionSpecifier)
59 
60  void setFunctionSpecifiers(FunctionSpecifiers specifiers);
61 
62  bool isInline() const;
63  void setInline(bool isInline);
64 
66  bool isVirtual() const;
67  void setVirtual(bool isVirtual);
68 
70  bool isExplicit() const;
71  void setExplicit(bool isExplicit);
72 
75  DUContext* internalFunctionContext() const;
76  void setInternalFunctionContext(DUContext* context);
77 
85  virtual const IndexedString* defaultParameters() const = 0;
86  virtual unsigned int defaultParametersSize() const = 0;
87  virtual void addDefaultParameter(const IndexedString& str) = 0;
88  virtual void clearDefaultParameters() = 0;
91  IndexedString defaultParameterForArgument(int index) const;
92 
93 private:
94  //Must be implemented by sub-classes to provide a pointer to the data
95  virtual const AbstractFunctionDeclarationData* data() const = 0;
96  virtual AbstractFunctionDeclarationData* dynamicData() = 0;
97 };
98 
99 #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
100 Q_DECLARE_OPERATORS_FOR_FLAGS(AbstractFunctionDeclaration::FunctionSpecifiers)
101 #endif
102 
106 template <class Base, class _Data>
107 class MergeAbstractFunctionDeclaration
108  : public Base
109  , public AbstractFunctionDeclaration
110 {
111 public:
112  template <class BaseData>
113  explicit MergeAbstractFunctionDeclaration(BaseData& data) : Base(data)
114  {
115  }
116  template <class BaseData, class Arg2>
117  MergeAbstractFunctionDeclaration(BaseData& data, const Arg2& arg2) : Base(data, arg2)
118  {
119  }
120  template <class BaseData, class Arg2, class Arg3>
121  MergeAbstractFunctionDeclaration(BaseData& data, const Arg2& arg2, const Arg3& arg3) : Base(data, arg2, arg3)
122  {
123  }
124 
125 private:
126  const AbstractFunctionDeclarationData* data() const override
127  {
128  return static_cast<const _Data*>(Base::d_func());
129  }
130  AbstractFunctionDeclarationData* dynamicData() override
131  {
132  return static_cast<_Data*>(Base::d_func_dynamic());
133  }
134 };
135 
136 }
137 
138 #if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
139 Q_DECLARE_OPERATORS_FOR_FLAGS(KDevelop::AbstractFunctionDeclaration::FunctionSpecifiers)
140 #endif
141 
142 #endif // KDEVPLATFORM_ABSTRACTFUNCTIONDECLARATION_H
KDevelop::AbstractFunctionDeclarationData::m_isInline
bool m_isInline
Definition: abstractfunctiondeclaration.h:40
KDevelop::AbstractFunctionDeclaration::FunctionSpecifier
FunctionSpecifier
Definition: abstractfunctiondeclaration.h:53
KDevelop::MergeAbstractFunctionDeclaration::MergeAbstractFunctionDeclaration
MergeAbstractFunctionDeclaration(BaseData &data, const Arg2 &arg2)
Definition: abstractfunctiondeclaration.h:117
KDevelop::AbstractFunctionDeclarationData::m_isVirtual
bool m_isVirtual
Definition: abstractfunctiondeclaration.h:39
Base
KDevelop::MergeAbstractFunctionDeclaration
Use this to merge AbstractFunctionDeclaration into the class hierarchy.
Definition: abstractfunctiondeclaration.h:107
KDevelop::AbstractFunctionDeclarationData
Definition: abstractfunctiondeclaration.h:30
KDevelop::AbstractFunctionDeclarationData::m_functionContext
IndexedDUContext m_functionContext
Definition: abstractfunctiondeclaration.h:38
KDevelop::MergeAbstractFunctionDeclaration::MergeAbstractFunctionDeclaration
MergeAbstractFunctionDeclaration(BaseData &data, const Arg2 &arg2, const Arg3 &arg3)
Definition: abstractfunctiondeclaration.h:121
KDevelop::AbstractFunctionDeclarationData::AbstractFunctionDeclarationData
AbstractFunctionDeclarationData()
Definition: abstractfunctiondeclaration.h:33
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::AbstractFunctionDeclaration
Provides an interface to declarations which represent functions in a definition-use chain.
Definition: abstractfunctiondeclaration.h:48
KDevelop::MergeAbstractFunctionDeclaration::MergeAbstractFunctionDeclaration
MergeAbstractFunctionDeclaration(BaseData &data)
Definition: abstractfunctiondeclaration.h:113
KDevelop::AbstractFunctionDeclarationData::m_isExplicit
bool m_isExplicit
Definition: abstractfunctiondeclaration.h:41
indexedducontext.h
KDevelop::IndexedDUContext
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 Wed Jan 20 2021 23:38:35 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