File indexing completed on 2024-06-16 04:23:17
0001 /* 0002 SPDX-FileCopyrightText: 2006 Roberto Raggi <roberto@kdevelop.org> 0003 SPDX-FileCopyrightText: 2006 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 #include "structuretype.h" 0010 0011 #include "typeregister.h" 0012 #include "typesystem.h" 0013 0014 namespace KDevelop { 0015 REGISTER_TYPE(StructureType); 0016 0017 StructureType::StructureType(const StructureType& rhs) 0018 : StructureTypeBase(copyData<StructureType>(*rhs.d_func())) 0019 { 0020 } 0021 0022 StructureType::StructureType(StructureTypeData& data) 0023 : StructureTypeBase(data) 0024 { 0025 } 0026 0027 AbstractType* StructureType::clone() const 0028 { 0029 return new StructureType(*this); 0030 } 0031 0032 bool StructureType::equals(const AbstractType* _rhs) const 0033 { 0034 if (this == _rhs) 0035 return true; 0036 0037 if (!StructureTypeBase::equals(_rhs)) 0038 return false; 0039 0040 Q_ASSERT(dynamic_cast<const StructureType*>(_rhs)); 0041 0042 return true; 0043 } 0044 0045 StructureType::StructureType() 0046 : StructureTypeBase(createData<StructureType>()) 0047 { 0048 } 0049 0050 StructureType::~StructureType() 0051 { 0052 } 0053 0054 void StructureType::accept0(TypeVisitor* v) const 0055 { 0056 // TYPE_D(StructureType); 0057 v->visit(this); 0058 0059 v->endVisit(this); 0060 } 0061 0062 QString StructureType::toString() const 0063 { 0064 QualifiedIdentifier id = qualifiedIdentifier(); 0065 if (!id.isEmpty()) { 0066 return AbstractType::toString() + id.toString(); 0067 } 0068 0069 return QLatin1String("<class>") + AbstractType::toString(true); 0070 } 0071 0072 AbstractType::WhichType StructureType::whichType() const 0073 { 0074 return TypeStructure; 0075 } 0076 0077 uint StructureType::hash() const 0078 { 0079 return KDevHash(AbstractType::hash()) << IdentifiedType::hash(); 0080 } 0081 }