• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdevelop API Reference
  • KDE Home
  • Contact Us
 

kdevplatform/language/duchain

  • sources
  • kfour-appscomplete
  • kdevelop
  • kdevplatform
  • language
  • duchain
aliasdeclaration.cpp
Go to the documentation of this file.
1 /* This is part of KDevelop
2  Copyright 2008 David Nolden <[email protected]>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17  */
18 
19 #include "aliasdeclaration.h"
20 
21 #include "ducontext.h"
22 #include "duchainregister.h"
23 #include "types/delayedtype.h"
24 #include <editor/rangeinrevision.h>
25 
26 namespace KDevelop {
27 REGISTER_DUCHAIN_ITEM(AliasDeclaration);
28 
29 AliasDeclaration::AliasDeclaration(const AliasDeclaration& rhs)
30  : ClassMemberDeclaration(*new AliasDeclarationData(*rhs.d_func()))
31 {
32 }
33 
34 AliasDeclaration::AliasDeclaration(const RangeInRevision& range, DUContext* context)
35  : ClassMemberDeclaration(*new AliasDeclarationData, range)
36 {
37  d_func_dynamic()->setClassId(this);
38  setKind(Alias);
39  if (context)
40  setContext(context);
41 }
42 
43 AliasDeclaration::AliasDeclaration(AliasDeclarationData& data) : ClassMemberDeclaration(data)
44 {
45 }
46 
47 AliasDeclaration::~AliasDeclaration()
48 {
49 }
50 
51 Declaration* AliasDeclaration::clonePrivate() const
52 {
53  return new AliasDeclaration(*this);
54 }
55 
56 QString AliasDeclaration::toString() const
57 {
58  if (aliasedDeclaration().isValid())
59  return i18n("Alias %1 as %2", aliasedDeclaration().declaration()->qualifiedIdentifier().toString(),
60  identifier().toString());
61  else
62  return i18n("Lost alias %1", identifier().toString());
63 }
64 
65 void AliasDeclaration::setAliasedDeclaration(const IndexedDeclaration& decl)
66 {
67  d_func_dynamic()->m_aliasedDeclaration = decl;
68  Declaration* aliased = decl.data();
69  if (aliased)
70  Declaration::setAbstractType(aliased->abstractType());
71 }
72 
73 IndexedDeclaration AliasDeclaration::aliasedDeclaration() const
74 {
75  return d_func()->m_aliasedDeclaration;
76 }
77 
78 void AliasDeclaration::setAbstractType(AbstractType::Ptr type)
79 {
80  Declaration::setAbstractType(type);
81 }
82 }
KDevelop::Declaration::Alias
This is an alias-declaration.
Definition: declaration.h:67
KDevelop::REGISTER_DUCHAIN_ITEM
REGISTER_DUCHAIN_ITEM(AliasDeclaration)
KDevelop::Declaration::setContext
void setContext(DUContext *context, bool anonymous=false)
Set the context in which this declaration occurs.
Definition: declaration.cpp:290
KDevelop::Declaration::identifier
Identifier identifier() const
Access this declaration's identifier.
Definition: declaration.cpp:204
KDevelop::TypePtr< AbstractType >
KDevelop::Declaration
Represents a single declaration in a definition-use chain.
Definition: declaration.h:51
aliasdeclaration.h
KDevelop::IndexedDeclaration
Represents a declaration only by its global indices.
Definition: indexeddeclaration.h:33
QString
KDevelop::AliasDeclaration::setAliasedDeclaration
void setAliasedDeclaration(const IndexedDeclaration &decl)
Set the declaration that is aliased by this declaration.
Definition: aliasdeclaration.cpp:65
KDevelop::AliasDeclaration::AliasDeclaration
AliasDeclaration(const AliasDeclaration &rhs)
Copy constructor.
Definition: aliasdeclaration.cpp:29
KDevelop::Declaration::type
TypePtr< T > type() const
Convenience function to return this declaration's type dynamically casted to T.
Definition: declaration.h:305
KDevelop::AliasDeclaration::setAbstractType
void setAbstractType(AbstractType::Ptr type) override
An AliasDeclaration cannot have a type, so setAbstractType does nothing here.
Definition: aliasdeclaration.cpp:78
KDevelop::ClassMemberDeclaration
Represents a single class member definition in a definition-use chain.
Definition: classmemberdeclaration.h:32
KDevelop::Declaration::context
DUContext * context() const
Access the parent context of this declaration.
Definition: declaration.cpp:279
delayedtype.h
KDevelop::AliasDeclarationData
Definition: aliasdeclaration.h:28
KDevelop::Declaration::setKind
void setKind(Kind kind)
Set the kind.
Definition: declaration.cpp:84
KDevelop::IndexedDeclaration::data
Declaration * data() const
Definition: indexeddeclaration.h:47
KDevelop::Declaration::qualifiedIdentifier
QualifiedIdentifier qualifiedIdentifier() const
Determine the global qualified identifier of this declaration.
Definition: declaration.cpp:267
KDevelop::AliasDeclaration::aliasedDeclaration
IndexedDeclaration aliasedDeclaration() const
Access the declaration that is aliased by this declaration.
Definition: aliasdeclaration.cpp:73
KDevelop
Definition: abstractfunctiondeclaration.cpp:27
KDevelop::DUContext
A single context in source code, represented as a node in a directed acyclic graph.
Definition: ducontext.h:72
KDevelop::AliasDeclaration::~AliasDeclaration
~AliasDeclaration() override
Destructor.
Definition: aliasdeclaration.cpp:47
KDevelop::AliasDeclaration::toString
QString toString() const override
Determine this declaration as a string.
Definition: aliasdeclaration.cpp:56
KDevelop::Declaration::abstractType
AbstractType::Ptr abstractType() const
Access this declaration's type.
Definition: declaration.cpp:243
duchainregister.h
ducontext.h
KDevelop::Declaration::setAbstractType
virtual void setAbstractType(AbstractType::Ptr type)
Set this declaration's type.
Definition: declaration.cpp:249
KDevelop::AliasDeclaration
An alias declaration maps one declaration to another.
Definition: aliasdeclaration.h:48
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Apr 9 2021 23:29:59 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kdevplatform/language/duchain

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

kdevelop API Reference

Skip menu "kdevelop API Reference"
  • kdevplatform
  •   debugger
  •   documentation
  •   interfaces
  •   language
  •     assistant
  •     backgroundparser
  •     checks
  •     classmodel
  •     codecompletion
  •     codegen
  •     duchain
  •     editor
  •     highlighting
  •     interfaces
  •     util
  •   outputview
  •   project
  •   serialization
  •   shell
  •   sublime
  •   tests
  •   util
  •   vcs

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal