1 /* This file is part of KDevelop
2 Copyright 2002-2005 Roberto Raggi <roberto@kdevelop.org>
3 Copyright 2006 Adam Treat <treat@kde.org>
4 Copyright 2006 Hamish Rodda <rodda@kde.org>
5 Copyright 2007-2008 David Nolden <david.nolden.kdevelop@art-master.de>
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License version 2 as published by the Free Software Foundation.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
22 #ifndef CLASSFUNCTIONDECLARATION_H
23 #define CLASSFUNCTIONDECLARATION_H
25 #include "classmemberdeclaration.h"
26 #include "abstractfunctiondeclaration.h"
27 #include "classmemberdeclarationdata.h"
32 struct QtFunctionEnumContainer
{
35 Normal
/**< Indicates a normal function */,
36 Signal
/**< indicates a Qt slot */,
37 Slot
/**< indicates a Qt signal */
41 KDEVPLATFORMLANGUAGE_EXPORT
DECLARE_LIST_MEMBER_HASH(ClassFunctionDeclarationData
, m_defaultParameters
, IndexedString
)
43 class KDEVPLATFORMLANGUAGE_EXPORT ClassFunctionDeclarationData
: public ClassMemberDeclarationData
, public AbstractFunctionDeclarationData
, public QtFunctionEnumContainer
46 ClassFunctionDeclarationData() {
47 initializeAppendedLists();
48 m_functionType
= Normal
;
50 ClassFunctionDeclarationData( const ClassFunctionDeclarationData
& rhs
)
51 : ClassMemberDeclarationData( rhs
), AbstractFunctionDeclarationData(rhs
)
53 initializeAppendedLists();
55 m_functionType
= rhs
.m_functionType
;
57 ~ClassFunctionDeclarationData() {
60 QtFunctionType m_functionType
;
61 START_APPENDED_LISTS_BASE(ClassFunctionDeclarationData
, ClassMemberDeclarationData
);
62 APPENDED_LIST_FIRST(ClassFunctionDeclarationData
, IndexedString
, m_defaultParameters
);
63 END_APPENDED_LISTS(ClassFunctionDeclarationData
, m_defaultParameters
);
66 * Represents a single variable definition in a definition-use chain.
68 typedef MergeAbstractFunctionDeclaration
<ClassMemberDeclaration
, ClassFunctionDeclarationData
> ClassFunctionDeclarationBase
;
69 class KDEVPLATFORMLANGUAGE_EXPORT ClassFunctionDeclaration
: public ClassFunctionDeclarationBase
, public QtFunctionEnumContainer
72 ClassFunctionDeclaration(const SimpleRange
& range
, DUContext
* context
);
73 ClassFunctionDeclaration(ClassFunctionDeclarationData
& data
);
74 ~ClassFunctionDeclaration();
76 QtFunctionType
functionType() const;
77 void setFunctionType(QtFunctionType functionType
);
79 bool isConstructor() const;
80 bool isDestructor() const;
81 bool isConversionFunction() const;
83 bool isFunctionDeclaration() const;
85 void setIsExternalDefinition(bool);
87 virtual QString
toString() const;
89 virtual void setAbstractType(AbstractType::Ptr type
);
91 virtual Declaration
* clonePrivate() const;
93 virtual uint
additionalIdentity() const;
95 virtual const IndexedString
* defaultParameters() const;
96 virtual int defaultParametersSize() const;
97 virtual void addDefaultParameter(const IndexedString
& str
);
98 virtual void clearDefaultParameters();
105 ClassFunctionDeclaration(const ClassFunctionDeclaration
& rhs
);
107 DUCHAIN_DECLARE_DATA(ClassFunctionDeclaration
)
111 #endif // CLASSFUNCTIONDECLARATION_H
113 // kate: space-indent on; indent-width 2; tab-width 4; replace-tabs on; auto-insert-doxygen on