language/duchain
delayedtype.cpp
00001 /* This file is part of KDevelop 00002 Copyright 2006 Roberto Raggi <roberto@kdevelop.org> 00003 Copyright 2006-2008 Hamish Rodda <rodda@kde.org> 00004 Copyright 2007-2008 David Nolden <david.nolden.kdevelop@art-master.de> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License version 2 as published by the Free Software Foundation. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #include "delayedtype.h" 00022 00023 #include "../indexedstring.h" 00024 #include "../repositories/typerepository.h" 00025 #include "typesystemdata.h" 00026 #include "typeregister.h" 00027 #include "typesystem.h" 00028 00029 namespace KDevelop 00030 { 00031 REGISTER_TYPE(DelayedType); 00032 00033 DelayedType::DelayedType(DelayedTypeData& data) : AbstractType(data) { 00034 } 00035 00036 AbstractType* DelayedType::clone() const { 00037 return new DelayedType(*this); 00038 } 00039 00040 bool DelayedType::equals(const AbstractType* _rhs) const 00041 { 00042 if( this == _rhs ) 00043 return true; 00044 00045 if (!AbstractType::equals(_rhs)) 00046 return false; 00047 00048 Q_ASSERT(fastCast<const DelayedType*>(_rhs)); 00049 00050 const DelayedType* rhs = static_cast<const DelayedType*>(_rhs); 00051 00052 return d_func()->m_identifier == rhs->d_func()->m_identifier && rhs->d_func()->m_kind == d_func()->m_kind; 00053 } 00054 00055 AbstractType::WhichType DelayedType::whichType() const 00056 { 00057 return AbstractType::TypeDelayed; 00058 } 00059 00060 QString DelayedType::toString() const 00061 { 00062 return AbstractType::toString(false) + identifier().toString(); 00063 } 00064 00065 DelayedType::Kind DelayedType::kind() const { 00066 return d_func()->m_kind; 00067 } 00068 00069 void DelayedType::setKind(Kind kind) { 00070 d_func_dynamic()->m_kind = kind; 00071 } 00072 00073 DelayedType::DelayedType() 00074 : AbstractType(createData<DelayedType>()) 00075 { 00076 } 00077 00078 DelayedType::DelayedType(const DelayedType& rhs) : AbstractType(copyData<DelayedType>(*rhs.d_func())) { 00079 } 00080 00081 DelayedType::~DelayedType() 00082 { 00083 } 00084 00085 void DelayedType::setIdentifier(const IndexedTypeIdentifier& identifier) 00086 { 00087 d_func_dynamic()->m_identifier = identifier; 00088 } 00089 00090 IndexedTypeIdentifier DelayedType::identifier() const 00091 { 00092 return d_func()->m_identifier; 00093 } 00094 00095 void DelayedType::accept0 (KDevelop::TypeVisitor *v) const 00096 { 00097 v->visit(this); 00098 /* v->endVisit(this);*/ 00099 } 00100 00101 uint DelayedType::hash() const 00102 { 00103 return AbstractType::hash() + 37*((d_func()->m_identifier.hash()>>1) + (uint)d_func()->m_kind); 00104 } 00105 00106 } 00107 00108 // kate: space-indent on; indent-width 2; tab-width 4; replace-tabs on; auto-insert-doxygen on
KDE 4.4 API Reference