language/duchain
identifiedtype.cpp
00001 /* This file is part of KDevelop 00002 Copyright 2002-2005 Roberto Raggi <roberto@kdevelop.org> 00003 Copyright 2006 Adam Treat <treat@kde.org> 00004 Copyright 2006 Hamish Rodda <rodda@kde.org> 00005 Copyright 2007-2008 David Nolden <david.nolden.kdevelop@art-master.de> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License version 2 as published by the Free Software Foundation. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #include "identifiedtype.h" 00023 #include "../declaration.h" 00024 #include "../duchainpointer.h" 00025 #include "../declarationid.h" 00026 00027 namespace KDevelop 00028 { 00029 00030 IdentifiedType::~IdentifiedType() 00031 { 00032 } 00033 00034 void IdentifiedType::clear() { 00035 idData()->m_id = DeclarationId(); 00036 } 00037 00038 bool IdentifiedType::equals(const IdentifiedType* rhs) const 00039 { 00040 bool ret = false; 00041 if( idData()->m_id == rhs->idData()->m_id ) 00042 ret = true; 00043 00044 //kDebug() << this << rhs << true; 00045 return ret; 00046 } 00047 00048 // QualifiedIdentifier IdentifiedType::identifier() const 00049 // { 00050 // return idData()->m_id ? idData()->m_iidData()->qualifiedIdentifier() : QualifiedIdentifier(); 00051 // } 00052 00053 QualifiedIdentifier IdentifiedType::qualifiedIdentifier() const { 00054 return idData()->m_id.qualifiedIdentifier(); 00055 } 00056 00057 uint IdentifiedType::hash() const { 00058 return idData()->m_id.hash(); 00059 } 00060 00061 DeclarationId IdentifiedType::declarationId() const { 00062 return idData()->m_id; 00063 } 00064 00065 void IdentifiedType::setDeclarationId(const DeclarationId& id) { 00066 idData()->m_id = id; 00067 } 00068 00069 Declaration* IdentifiedType::declaration(const TopDUContext* top) const 00070 { 00071 return idData()->m_id.getDeclaration(top); 00072 } 00073 00074 KDevelop::DUContext* IdentifiedType::internalContext(const KDevelop::TopDUContext* top) const { 00075 Declaration* decl = declaration(top); 00076 if(decl) 00077 return decl->internalContext(); 00078 else 00079 return 0; 00080 } 00081 00082 void IdentifiedType::setDeclaration(Declaration* declaration) 00083 { 00084 if(declaration) 00085 idData()->m_id = declaration->id(); 00086 else 00087 idData()->m_id = DeclarationId(); 00088 } 00089 00090 // QString IdentifiedType::idMangled() const 00091 // { 00092 // return identifier().mangled(); 00093 // } 00094 00095 } 00096 00097 // kate: space-indent on; indent-width 2; tab-width 4; replace-tabs on; auto-insert-doxygen on
KDE 4.4 API Reference