• 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
classdeclaration.h
Go to the documentation of this file.
1 /* This file is part of KDevelop
2  Copyright 2008 David Nolden <[email protected]>
3  Copyright 2009 Lior Mualem <[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_CLASSDECLARATION_H
21 #define KDEVPLATFORM_CLASSDECLARATION_H
22 
23 #include <language/duchain/declaration.h>
24 #include <language/duchain/declarationdata.h>
25 #include <language/duchain/classmemberdeclarationdata.h>
26 #include <language/duchain/classmemberdeclaration.h>
27 
28 namespace KDevelop {
29 class DUContext;
30 class TopDUContext;
31 }
32 
33 namespace KDevelop {
34 struct KDEVPLATFORMLANGUAGE_EXPORT BaseClassInstance
35 {
36  KDevelop::IndexedType baseClass; //May either be StructureType, or DelayedType
37  KDevelop::Declaration::AccessPolicy access;
38  bool virtualInheritance;
39 };
40 
41 KDEVPLATFORMLANGUAGE_EXPORT DECLARE_LIST_MEMBER_HASH(ClassDeclarationData, baseClasses, BaseClassInstance)
42 
43 class KDEVPLATFORMLANGUAGE_EXPORT ClassDeclarationData
44  : public KDevelop::ClassMemberDeclarationData
45 {
46 public:
47  enum ClassType {
48  Class,
49  Struct,
50  Union,
51  Interface,
52  Trait
53  };
54 
55  enum ClassModifier {
56  Final,
57  Abstract,
58  None
59  };
60 
61  ClassDeclarationData()
62  : m_classType(Class)
63  , m_classModifier(None)
64  {
65  initializeAppendedLists();
66  }
67 
68  ~ClassDeclarationData()
69  {
70  freeAppendedLists();
71  }
72 
73  ClassDeclarationData(const ClassDeclarationData& rhs)
74  : KDevelop::ClassMemberDeclarationData(rhs)
75  {
76  initializeAppendedLists();
77  copyListsFrom(rhs);
78  m_classType = rhs.m_classType;
79  m_classModifier = rhs.m_classModifier;
80  }
81 
82  ClassDeclarationData& operator=(const ClassDeclarationData& rhs) = delete;
83 
85  ClassType m_classType;
87  ClassModifier m_classModifier;
88 
89  START_APPENDED_LISTS_BASE(ClassDeclarationData, KDevelop::ClassMemberDeclarationData);
90  APPENDED_LIST_FIRST(ClassDeclarationData, BaseClassInstance, baseClasses);
91  END_APPENDED_LISTS(ClassDeclarationData, baseClasses);
92 };
93 
97 class KDEVPLATFORMLANGUAGE_EXPORT ClassDeclaration
98  : public KDevelop::ClassMemberDeclaration
99 {
100 public:
101  ClassDeclaration(const ClassDeclaration& rhs);
102  explicit ClassDeclaration(ClassDeclarationData& data);
103  ClassDeclaration(const KDevelop::RangeInRevision& range, KDevelop::DUContext* context);
104  ClassDeclaration(ClassDeclarationData& data, const KDevelop::RangeInRevision& range, KDevelop::DUContext* context);
105  ~ClassDeclaration() override;
106 
107  void clearBaseClasses();
109  uint baseClassesSize() const;
111  const BaseClassInstance* baseClasses() const;
112  void addBaseClass(const BaseClassInstance& klass);
113  //Replaces the n'th base-class with the given one. The replaced base-class must have existed.
114  void replaceBaseClass(uint n, const BaseClassInstance& klass);
115 
119  bool isPublicBaseClass(ClassDeclaration* base, const KDevelop::TopDUContext* topContext,
120  int* baseConversionLevels = nullptr) const;
121 
122  QString toString() const override;
123 
124  void setClassType(ClassDeclarationData::ClassType type);
125 
126  ClassDeclarationData::ClassType classType() const;
127 
128  void setClassModifier(ClassDeclarationData::ClassModifier modifier);
129 
130  ClassDeclarationData::ClassModifier classModifier() const;
131 
132  enum {
133  Identity = 17
134  };
135 
136 private:
137  KDevelop::Declaration* clonePrivate() const override;
138  DUCHAIN_DECLARE_DATA(ClassDeclaration)
139 };
140 }
141 
142 Q_DECLARE_TYPEINFO(KDevelop::BaseClassInstance, Q_MOVABLE_TYPE);
143 
144 #endif // KDEVPLATFORM_CLASSDECLARATION_H
KDevelop::ClassDeclaration
Represents a single template-parameter definition.
Definition: classdeclaration.h:97
KDevelop::BaseClassInstance::access
KDevelop::Declaration::AccessPolicy access
Definition: classdeclaration.h:37
APPENDED_LIST_FIRST
#define APPENDED_LIST_FIRST(container, type, name)
Definition: appendedlist.h:321
START_APPENDED_LISTS_BASE
#define START_APPENDED_LISTS_BASE(container, base)
Use this if one of the base-classes of the container also has the appended lists interfaces implement...
Definition: appendedlist.h:257
classmemberdeclaration.h
DUCHAIN_DECLARE_DATA
#define DUCHAIN_DECLARE_DATA(Class)
Use this to declare the data functions in your DUChainBase based class.
Definition: duchainbase.h:41
KDevelop::Declaration
Represents a single declaration in a definition-use chain.
Definition: declaration.h:51
KDevelop::DECLARE_LIST_MEMBER_HASH
KDEVPLATFORMLANGUAGE_EXPORT DECLARE_LIST_MEMBER_HASH(DUContextData, m_childContexts, LocalIndexedDUContext) KDEVPLATFORMLANGUAGE_EXPORT DECLARE_LIST_MEMBER_HASH(DUContextData
declaration.h
declarationdata.h
QString
Q_DECLARE_TYPEINFO
Q_DECLARE_TYPEINFO(KDevelop::BaseClassInstance, Q_MOVABLE_TYPE)
KDevelop::TopDUContext
The top context in a definition-use chain for one source file.
Definition: topducontext.h:113
KDevelop::ClassMemberDeclaration
Represents a single class member definition in a definition-use chain.
Definition: classmemberdeclaration.h:32
KDevelop::Declaration::AccessPolicy
AccessPolicy
Access types.
Definition: declaration.h:56
KDevelop::ClassMemberDeclarationData
Definition: classmemberdeclarationdata.h:29
END_APPENDED_LISTS
#define END_APPENDED_LISTS(container, predecessor)
Definition: appendedlist.h:358
KDevelop::BaseClassInstance::baseClass
KDevelop::IndexedType baseClass
Definition: classdeclaration.h:36
KDevelop::BaseClassInstance::virtualInheritance
bool virtualInheritance
Definition: classdeclaration.h:38
classmemberdeclarationdata.h
KDevelop::IndexedType
Indexed type pointer.
Definition: indexedtype.h:36
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::BaseClassInstance
Definition: classdeclaration.h:34
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Apr 15 2021 23:30:11 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