1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
|
/* This file is part of KDevelop
Copyright 2002-2005 Roberto Raggi <roberto@kdevelop.org>
Copyright 2006 Adam Treat <treat@kde.org>
Copyright 2006 Hamish Rodda <rodda@kde.org>
Copyright 2007-2008 David Nolden <david.nolden.kdevelop@art-master.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KDEVPLATFORM_CLASSMEMBERDECLARATION_H
#define KDEVPLATFORM_CLASSMEMBERDECLARATION_H
#include "declaration.h"
namespace KDevelop {
class ClassMemberDeclarationData;
/**
* Represents a single class member definition in a definition-use chain.
*/
class KDEVPLATFORMLANGUAGE_EXPORT ClassMemberDeclaration
: public Declaration
{
public:
ClassMemberDeclaration(const ClassMemberDeclaration& rhs);
ClassMemberDeclaration(const RangeInRevision& range, DUContext* context);
explicit ClassMemberDeclaration(ClassMemberDeclarationData& dd);
~ClassMemberDeclaration() override;
ClassMemberDeclaration& operator=(const ClassMemberDeclaration& rhs) = delete;
AccessPolicy accessPolicy() const;
void setAccessPolicy(AccessPolicy accessPolicy);
enum StorageSpecifier {
StaticSpecifier = 0x1 /**< indicates static member */,
AutoSpecifier = 0x2 /**< indicates automatic determination of member access */,
FriendSpecifier = 0x4 /**< indicates friend member */,
ExternSpecifier = 0x8 /**< indicates external declaration */,
RegisterSpecifier = 0x10 /**< indicates register */,
MutableSpecifier = 0x20/**< indicates a mutable member */
};
Q_DECLARE_FLAGS(StorageSpecifiers, StorageSpecifier)
void setStorageSpecifiers(StorageSpecifiers specifiers);
bool isStatic() const;
void setStatic(bool isStatic);
bool isAuto() const;
void setAuto(bool isAuto);
bool isFriend() const;
void setFriend(bool isFriend);
bool isRegister() const;
void setRegister(bool isRegister);
bool isExtern() const;
void setExtern(bool isExtern);
bool isMutable() const;
void setMutable(bool isMutable);
/**
* \returns The size in bytes or -1 if unknown.
*/
int64_t sizeOf() const;
/**
* Set the size to given number of bytes. Use -1 to represent unknown size.
*/
void setSizeOf(int64_t sizeOf);
/**
* \returns The offset of the field in bits or -1 if unknown or not applicable.
*/
int64_t bitOffsetOf() const;
/**
* Set the offset to given number of bits. Use -1 to represent unknown offset.
*/
void setBitOffsetOf(int64_t bitOffsetOf);
/**
* \returns The alignment in bytes or -1 if unknown.
*/
int64_t alignOf() const;
/**
* Set the alignment to given number of bytes.
*
* The value must be non-negative power of 2 or -1 to represent unknown alignment.
*/
void setAlignOf(int64_t alignedTo);
enum {
Identity = 9
};
protected:
ClassMemberDeclaration(ClassMemberDeclarationData& dd, const RangeInRevision& range);
DUCHAIN_DECLARE_DATA(ClassMemberDeclaration)
private:
Declaration* clonePrivate() const override;
};
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
Q_DECLARE_OPERATORS_FOR_FLAGS(ClassMemberDeclaration::StorageSpecifiers)
#endif
}
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
Q_DECLARE_OPERATORS_FOR_FLAGS(KDevelop::ClassMemberDeclaration::StorageSpecifiers)
#endif
#endif // KDEVPLATFORM_CLASSMEMBERDECLARATION_H
|