1 /* This 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>
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License version 2 as published by the Free Software Foundation.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
21 #include "classmemberdeclaration.h"
22 #include "classmemberdeclarationdata.h"
23 #include "duchainregister.h"
28 ClassMemberDeclarationData::ClassMemberDeclarationData()
30 m_accessPolicy
= Declaration::Public
;
39 ClassMemberDeclarationData::ClassMemberDeclarationData( const ClassMemberDeclarationData
& rhs
)
40 : DeclarationData( rhs
)
42 m_accessPolicy
= rhs
.m_accessPolicy
;
43 m_isStatic
= rhs
.m_isStatic
;
44 m_isAuto
= rhs
.m_isAuto
;
45 m_isFriend
= rhs
.m_isFriend
;
46 m_isRegister
= rhs
.m_isRegister
;
47 m_isExtern
= rhs
.m_isExtern
;
48 m_isMutable
= rhs
.m_isMutable
;
51 ClassMemberDeclaration::ClassMemberDeclaration(const ClassMemberDeclaration
& rhs
) : Declaration(*new ClassMemberDeclarationData(*rhs
.d_func())) {
52 setSmartRange(rhs
.smartRange(), DocumentRangeObject::DontOwn
);
55 REGISTER_DUCHAIN_ITEM(ClassMemberDeclaration
);
57 Declaration
* ClassMemberDeclaration::clonePrivate() const {
58 return new ClassMemberDeclaration(*this);
61 ClassMemberDeclaration::ClassMemberDeclaration(const SimpleRange
& range
, DUContext
* context
)
62 : Declaration(*new ClassMemberDeclarationData
, range
)
64 d_func_dynamic()->setClassId(this);
66 setContext( context
);
69 ClassMemberDeclaration::ClassMemberDeclaration(ClassMemberDeclarationData
& dd
, const SimpleRange
& range
)
70 : Declaration(dd
, range
)
74 ClassMemberDeclaration::ClassMemberDeclaration(ClassMemberDeclarationData
& dd
)
79 ClassMemberDeclaration::~ClassMemberDeclaration()
83 bool ClassMemberDeclaration::isStatic() const
85 return d_func()->m_isStatic
;
88 void ClassMemberDeclaration::setStatic(bool isStatic
)
90 d_func_dynamic()->m_isStatic
= isStatic
;
93 bool ClassMemberDeclaration::isAuto() const
95 return d_func()->m_isAuto
;
98 void ClassMemberDeclaration::setAuto(bool isAuto
)
100 d_func_dynamic()->m_isAuto
= isAuto
;
103 bool ClassMemberDeclaration::isFriend() const
105 return d_func()->m_isFriend
;
108 void ClassMemberDeclaration::setFriend(bool isFriend
)
110 d_func_dynamic()->m_isFriend
= isFriend
;
113 bool ClassMemberDeclaration::isRegister() const
115 return d_func()->m_isRegister
;
118 void ClassMemberDeclaration::setRegister(bool isRegister
)
120 d_func_dynamic()->m_isRegister
= isRegister
;
123 bool ClassMemberDeclaration::isExtern() const
125 return d_func()->m_isExtern
;
128 void ClassMemberDeclaration::setExtern(bool isExtern
)
130 d_func_dynamic()->m_isExtern
= isExtern
;
133 bool ClassMemberDeclaration::isMutable() const
135 return d_func()->m_isMutable
;
138 void ClassMemberDeclaration::setMutable(bool isMutable
)
140 d_func_dynamic()->m_isMutable
= isMutable
;
143 Declaration::AccessPolicy
ClassMemberDeclaration::accessPolicy() const
145 return d_func()->m_accessPolicy
;
148 void ClassMemberDeclaration::setAccessPolicy(Declaration::AccessPolicy accessPolicy
)
150 d_func_dynamic()->m_accessPolicy
= accessPolicy
;
153 void ClassMemberDeclaration::setStorageSpecifiers(StorageSpecifiers specifiers
)
155 DUCHAIN_D_DYNAMIC(ClassMemberDeclaration
);
156 d
->m_isStatic
= specifiers
& StaticSpecifier
;
157 d
->m_isAuto
= specifiers
& AutoSpecifier
;
158 d
->m_isFriend
= specifiers
& FriendSpecifier
;
159 d
->m_isRegister
= specifiers
& RegisterSpecifier
;
160 d
->m_isExtern
= specifiers
& ExternSpecifier
;
161 d
->m_isMutable
= specifiers
& MutableSpecifier
;
164 // kate: space-indent on; indent-width 2; tab-width 4; replace-tabs on; auto-insert-doxygen on