File indexing completed on 2024-06-16 04:23:17
0001 /* 0002 SPDX-FileCopyrightText: 2006 Roberto Raggi <roberto@kdevelop.org> 0003 SPDX-FileCopyrightText: 2006-2008 Hamish Rodda <rodda@kde.org> 0004 SPDX-FileCopyrightText: 2007-2008 David Nolden <david.nolden.kdevelop@art-master.de> 0005 0006 SPDX-License-Identifier: LGPL-2.0-only 0007 */ 0008 0009 #ifndef KDEVPLATFORM_POINTERTYPE_H 0010 #define KDEVPLATFORM_POINTERTYPE_H 0011 0012 #include "abstracttype.h" 0013 0014 namespace KDevelop { 0015 class PointerTypeData; 0016 0017 /** 0018 * \short A type representing pointer types. 0019 * 0020 * PointerType is used to represent types which hold a pointer to a location 0021 * in memory. 0022 */ 0023 class KDEVPLATFORMLANGUAGE_EXPORT PointerType 0024 : public AbstractType 0025 { 0026 public: 0027 using Ptr = TypePtr<PointerType>; 0028 0029 /// Default constructor 0030 PointerType (); 0031 /// Copy constructor. \param rhs type to copy 0032 PointerType(const PointerType& rhs); 0033 /// Constructor using raw data. \param data internal data. 0034 explicit PointerType(PointerTypeData& data); 0035 /// Destructor 0036 ~PointerType() override; 0037 0038 PointerType& operator=(const PointerType& rhs) = delete; 0039 0040 /** 0041 * Sets the base type of the pointer, ie. what type of data the pointer points to. 0042 * 0043 * \param type the base type. 0044 */ 0045 void setBaseType(const AbstractType::Ptr& type); 0046 0047 /** 0048 * Retrieve the base type of the pointer, ie. what type of data the pointer points to. 0049 * 0050 * \returns the base type. 0051 */ 0052 AbstractType::Ptr baseType () const; 0053 0054 QString toString() const override; 0055 0056 uint hash() const override; 0057 0058 WhichType whichType() const override; 0059 0060 AbstractType* clone() const override; 0061 0062 bool equals(const AbstractType* rhs) const override; 0063 0064 void exchangeTypes(TypeExchanger* exchanger) override; 0065 0066 enum { 0067 Identity = 3 0068 }; 0069 0070 using Data = PointerTypeData; 0071 0072 protected: 0073 void accept0 (TypeVisitor* v) const override; 0074 0075 TYPE_DECLARE_DATA(PointerType) 0076 }; 0077 } 0078 0079 #endif