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

kdevplatform/language/codegen

  • sources
  • kfour-appscomplete
  • kdevelop
  • kdevplatform
  • language
  • codegen
codedescription.h
Go to the documentation of this file.
1 /* This file is part of KDevelop
2  Copyright 2012 Miha Čančula <[email protected]>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
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_CODEDESCRIPTION_H
21 #define KDEVPLATFORM_CODEDESCRIPTION_H
22 
23 #include <language/languageexport.h>
24 #include <language/duchain/duchainpointer.h>
25 
26 #include <QString>
27 #include <QVariant>
28 #include <QVector>
29 
35 namespace KDevelop {
41 struct KDEVPLATFORMLANGUAGE_EXPORT VariableDescription
42 {
47  VariableDescription();
54  VariableDescription(const QString& type, const QString& name);
59  explicit VariableDescription(const DeclarationPointer& declaration);
60 
64  QString name;
70  QString type;
76  QString access;
80  QString value;
81 };
82 
86 using VariableDescriptionList = QVector<VariableDescription>;
87 
93 struct KDEVPLATFORMLANGUAGE_EXPORT FunctionDescription
94 {
99  FunctionDescription();
107  FunctionDescription(const QString& name,
108  const VariableDescriptionList& arguments,
109  const VariableDescriptionList& returnArguments);
115  explicit FunctionDescription(const DeclarationPointer& declaration);
116 
121  QString returnType() const;
122 
126  QString name;
130  QVector<VariableDescription> arguments;
134  QVector<VariableDescription> returnArguments;
140  QString access;
141 
145  bool isConstructor : 1;
149  bool isDestructor : 1;
153  bool isVirtual : 1;
157  bool isAbstract : 1;
161  bool isOverriding : 1;
165  bool isFinal : 1;
169  bool isStatic : 1;
173  bool isSlot : 1;
177  bool isSignal : 1;
181  bool isConst : 1;
182 };
183 
187 using FunctionDescriptionList = QVector<FunctionDescription>;
188 
192 struct KDEVPLATFORMLANGUAGE_EXPORT InheritanceDescription
193 {
203  QString inheritanceMode;
207  QString baseType;
208 };
209 
213 using InheritanceDescriptionList = QVector<InheritanceDescription>;
214 
220 struct KDEVPLATFORMLANGUAGE_EXPORT ClassDescription
221 {
226  ClassDescription();
232  explicit ClassDescription(const QString& name);
233 
237  QString name;
241  InheritanceDescriptionList baseClasses;
245  VariableDescriptionList members;
249  FunctionDescriptionList methods;
250 };
251 
252 namespace CodeDescription {
253 template <class T> QVariant toVariantList(const QVector<T>& list)
254 {
255  QVariantList ret;
256  ret.reserve(list.size());
257  for (const T& t : list) {
258  ret << QVariant::fromValue<T>(t);
259  }
260 
261  return QVariant::fromValue(ret);
262 }
263 }
264 }
265 
266 Q_DECLARE_TYPEINFO(KDevelop::VariableDescription, Q_MOVABLE_TYPE);
267 Q_DECLARE_TYPEINFO(KDevelop::FunctionDescription, Q_MOVABLE_TYPE);
268 Q_DECLARE_TYPEINFO(KDevelop::InheritanceDescription, Q_MOVABLE_TYPE);
269 Q_DECLARE_TYPEINFO(KDevelop::ClassDescription, Q_MOVABLE_TYPE);
270 
271 Q_DECLARE_METATYPE(KDevelop::VariableDescription)
272 Q_DECLARE_METATYPE(KDevelop::VariableDescriptionList)
273 Q_DECLARE_METATYPE(KDevelop::FunctionDescription)
274 Q_DECLARE_METATYPE(KDevelop::FunctionDescriptionList)
275 Q_DECLARE_METATYPE(KDevelop::InheritanceDescription)
276 Q_DECLARE_METATYPE(KDevelop::InheritanceDescriptionList)
277 Q_DECLARE_METATYPE(KDevelop::ClassDescription)
278 
279 #endif // KDEVPLATFORM_CODEDESCRIPTION_H
KDevelop::ClassDescription::members
VariableDescriptionList members
List of all member variables in this class.
Definition: codedescription.h:245
KDevelop::FunctionDescription::isOverriding
bool isOverriding
Specifies whether this function overrides a virtual method of a base class.
Definition: codedescription.h:161
QVariant::fromValue
QVariant fromValue(const T &value)
KDevelop::ClassDescription
Represents a class.
Definition: codedescription.h:220
KDevelop::FunctionDescription::isAbstract
bool isAbstract
Specifies whether this function is abstract and needs to be overridden by subclasses.
Definition: codedescription.h:157
KDevelop::FunctionDescription::isDestructor
bool isDestructor
Specifies whether this function is a class destructor.
Definition: codedescription.h:149
KDevelop::FunctionDescription::access
QString access
Access specifier, only relevant for class members.
Definition: codedescription.h:140
KDevelop::FunctionDescription::isStatic
bool isStatic
Specifies whether this function is static and can be called without a class instance.
Definition: codedescription.h:169
KDevelop::InheritanceDescription::inheritanceMode
QString inheritanceMode
The mode of this inheritance.
Definition: codedescription.h:203
KDevelop::FunctionDescription::returnArguments
QVector< VariableDescription > returnArguments
This function's return values.
Definition: codedescription.h:134
KDevelop::CodeDescription::toVariantList
QVariant toVariantList(const QVector< T > &list)
Definition: codedescription.h:253
KDevelop::ClassDescription::name
QString name
The name of this class.
Definition: codedescription.h:237
KDevelop::VariableDescription::value
QString value
The default value of this variable.
Definition: codedescription.h:80
QString
KDevelop::ClassDescription::methods
FunctionDescriptionList methods
List of all member functions (methods) in this class.
Definition: codedescription.h:249
KDevelop::VariableDescription::name
QString name
The name of this variable.
Definition: codedescription.h:64
Q_DECLARE_TYPEINFO
Q_DECLARE_TYPEINFO(KDevelop::VariableDescription, Q_MOVABLE_TYPE)
KDevelop::FunctionDescription::isSlot
bool isSlot
Specifies whether this function is a slot.
Definition: codedescription.h:173
KDevelop::FunctionDescription::isVirtual
bool isVirtual
Specifies whether this function is virtual and can be overridden by subclasses.
Definition: codedescription.h:153
KDevelop::FunctionDescription
Represents a function.
Definition: codedescription.h:93
KDevelop::VariableDescription
Represents a variable.
Definition: codedescription.h:41
KDevelop::FunctionDescription::name
QString name
The name of this function.
Definition: codedescription.h:126
KDevelop
NOTE: changes in this file will quite probably also require changes in codedescriptionmetatype....
Definition: applychangeswidget.cpp:42
QVector::size
int size() const
KDevelop::FunctionDescription::isFinal
bool isFinal
Specifies whether this function is final and cannot be overridden by subclasses.
Definition: codedescription.h:165
QVector< VariableDescription >
KDevelop::FunctionDescription::isConstructor
bool isConstructor
Specifies whether this function is a class constructor.
Definition: codedescription.h:145
QVariant
KDevelop::VariableDescription::access
QString access
Access specifier, only relevant for class members.
Definition: codedescription.h:76
KDevelop::FunctionDescription::isSignal
bool isSignal
Specifies whether this function is a signal.
Definition: codedescription.h:177
KDevelop::ClassDescription::baseClasses
InheritanceDescriptionList baseClasses
List of base classes (classes from which this one inherits) as well as inheritance types.
Definition: codedescription.h:241
KDevelop::FunctionDescription::arguments
QVector< VariableDescription > arguments
This function's input arguments.
Definition: codedescription.h:130
KDevelop::VariableDescription::type
QString type
The type of this variable.
Definition: codedescription.h:70
KDevelop::InheritanceDescription::baseType
QString baseType
The name of the base class.
Definition: codedescription.h:207
KDevelop::FunctionDescription::isConst
bool isConst
Specifies whether this function is constant.
Definition: codedescription.h:181
KDevelop::InheritanceDescription
Description of an inheritance relation.
Definition: codedescription.h:192
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Jan 23 2021 09:40:47 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kdevplatform/language/codegen

Skip menu "kdevplatform/language/codegen"
  • 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