• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • KDevelop Platform Libraries
  • Sitemap
  • Contact Us
 

language/duchain

aliasdeclaration.cpp

00001 /* This  is part of KDevelop
00002     Copyright 2008 David Nolden <david.nolden.kdevelop@art-master.de>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016    Boston, MA 02110-1301, USA.
00017 */
00018 
00019 #include "aliasdeclaration.h"
00020 
00021 #include "ducontext.h"
00022 #include "duchainregister.h"
00023 #include "types/delayedtype.h"
00024 
00025 namespace KDevelop
00026 {
00027 
00028 REGISTER_DUCHAIN_ITEM(AliasDeclaration);
00029 
00030 AliasDeclaration::AliasDeclaration(const AliasDeclaration& rhs) 
00031   : Declaration(*new AliasDeclarationData(*rhs.d_func())) {
00032   setSmartRange(rhs.smartRange(), DocumentRangeObject::DontOwn);
00033 }
00034 
00035 AliasDeclaration::AliasDeclaration(const SimpleRange& range, DUContext* context)
00036   : Declaration(*new AliasDeclarationData, range)
00037 {
00038   d_func_dynamic()->setClassId(this);
00039   setKind(Alias);
00040   if( context )
00041     setContext( context );
00042 }
00043 
00044 AliasDeclaration::AliasDeclaration(AliasDeclarationData& data) : Declaration(data) {
00045 }
00046 
00047 
00048 AliasDeclaration::~AliasDeclaration()
00049 {
00050 }
00051 
00052 Declaration* AliasDeclaration::clonePrivate() const {
00053   return new AliasDeclaration(*this);
00054 }
00055 
00056 QString AliasDeclaration::toString() const {
00057   if( aliasedDeclaration().isValid() )
00058     return QString("Alias %1 as %2").arg(aliasedDeclaration().declaration()->qualifiedIdentifier().toString()).arg(identifier().toString());
00059   else
00060     return QString("Lost alias %1").arg(identifier().toString());
00061 }
00062 
00063 void AliasDeclaration::setAliasedDeclaration(const IndexedDeclaration& decl) {
00064   d_func_dynamic()->m_aliasedDeclaration = decl;
00065   Declaration* aliased = decl.data();
00066   if(aliased)
00067     Declaration::setAbstractType(aliased->abstractType());
00068 }
00069 
00070 IndexedDeclaration AliasDeclaration::aliasedDeclaration() const {
00071   return d_func()->m_aliasedDeclaration;
00072 }
00073 
00074 void AliasDeclaration::setAbstractType(AbstractType::Ptr type) {
00075   Declaration::setAbstractType(type);
00076 }
00077 
00078 }
00079 // kate: space-indent on; indent-width 2; tab-width 4; replace-tabs on; auto-insert-doxygen on

language/duchain

Skip menu "language/duchain"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

KDevelop Platform Libraries

Skip menu "KDevelop Platform Libraries"
  • interfaces
  • language
  •   codegen
  •   duchain
  •   editor
  • outputview
  • project
  • shell
  • sublime
  • util
  • vcs
Generated for KDevelop Platform Libraries by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal