Add AbstractDeclarationNavigationContext, and move the html-method from
[kdevelopdvcssupport.git] / language / duchain / aliasdeclaration.h
blobe91d5924dc11b7d2060f9eb06492ee4d522c5897
1 /* This file is part of KDevelop
2 Copyright 2008 David Nolden<david.nolden.kdevelop@art-master.de>
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.
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.
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.
19 #ifndef ALIASDECLARATION_H
20 #define ALIASDECLARATION_H
22 #include "declaration.h"
23 #include "duchainpointer.h"
24 #include "declarationdata.h"
26 namespace KDevelop
28 class KDEVPLATFORMLANGUAGE_EXPORT AliasDeclarationData : public DeclarationData
30 public:
31 AliasDeclarationData() {}
32 AliasDeclarationData( const AliasDeclarationData& rhs )
33 : DeclarationData( rhs )
35 m_aliasedDeclaration = rhs.m_aliasedDeclaration;
37 IndexedDeclaration m_aliasedDeclaration;
39 /**
40 * An alias declaration maps one declaration to another.
41 * While searching in the duchain, an AliasDeclaration is transparently
42 * replaced by its aliased declaration.
44 class KDEVPLATFORMLANGUAGE_EXPORT AliasDeclaration : public Declaration
46 public:
47 /// Copy constructor \param rhs declaration to copy
48 AliasDeclaration(const AliasDeclaration& rhs);
49 /**
50 * Constructs an AliasDeclaration. The default value for isNamespaceAlias is true.
52 * \param url url of the document where this occurred
53 * \param range range of the alias declaration's identifier
54 * \param context context in which this declaration occurred
56 AliasDeclaration(const SimpleRange& range, DUContext* context);
58 AliasDeclaration(AliasDeclarationData& data);
59 /// Destructor
60 virtual ~AliasDeclaration();
62 /**
63 * An AliasDeclaration cannot have a type, so setAbstractType does nothing here.
65 * \param type ignored type
67 virtual void setAbstractType(AbstractType::Ptr type);
69 /**
70 * Set the declaration that is aliased by this declaration.
72 * \param decl the declaration that this declaration references
74 void setAliasedDeclaration(const IndexedDeclaration& decl);
76 /**
77 * Access the declaration that is aliased by this declaration.
79 * \returns the aliased declaration
81 IndexedDeclaration aliasedDeclaration() const;
83 virtual QString toString() const;
85 enum {
86 Identity = 6
89 private:
90 virtual Declaration* clonePrivate() const;
91 DUCHAIN_DECLARE_DATA(AliasDeclaration)
95 #endif // FUNCTIONDECLARATION_H
97 // kate: space-indent on; indent-width 2; tab-width 4; replace-tabs on; auto-insert-doxygen on