• 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
  • types
delayedtype.cpp
Go to the documentation of this file.
1 /* This file is part of KDevelop
2  Copyright 2006 Roberto Raggi <[email protected]>
3  Copyright 2006-2008 Hamish Rodda <[email protected]>
4  Copyright 2007-2008 David Nolden <[email protected]>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License version 2 as published by the Free Software Foundation.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19  */
20 
21 #include "delayedtype.h"
22 
23 #include "typerepository.h"
24 #include "typesystemdata.h"
25 #include "typeregister.h"
26 #include "typesystem.h"
27 
28 #include <QHash>
29 
30 namespace KDevelop {
31 REGISTER_TYPE(DelayedType);
32 
33 DelayedType::DelayedType(DelayedTypeData& data) : AbstractType(data)
34 {
35 }
36 
37 AbstractType* DelayedType::clone() const
38 {
39  return new DelayedType(*this);
40 }
41 
42 bool DelayedType::equals(const AbstractType* _rhs) const
43 {
44  if (this == _rhs)
45  return true;
46 
47  if (!AbstractType::equals(_rhs))
48  return false;
49 
50  Q_ASSERT(fastCast<const DelayedType*>(_rhs));
51 
52  const auto* rhs = static_cast<const DelayedType*>(_rhs);
53 
54  return d_func()->m_identifier == rhs->d_func()->m_identifier && rhs->d_func()->m_kind == d_func()->m_kind;
55 }
56 
57 AbstractType::WhichType DelayedType::whichType() const
58 {
59  return AbstractType::TypeDelayed;
60 }
61 
62 QString DelayedType::toString() const
63 {
64  return AbstractType::toString(false) + identifier().toString();
65 }
66 
67 DelayedType::Kind DelayedType::kind() const
68 {
69  return d_func()->m_kind;
70 }
71 
72 void DelayedType::setKind(Kind kind)
73 {
74  d_func_dynamic()->m_kind = kind;
75 }
76 
77 DelayedType::DelayedType()
78  : AbstractType(createData<DelayedType>())
79 {
80 }
81 
82 DelayedType::DelayedType(const DelayedType& rhs) : AbstractType(copyData<DelayedType>(*rhs.d_func()))
83 {
84 }
85 
86 DelayedType::~DelayedType()
87 {
88 }
89 
90 void DelayedType::setIdentifier(const IndexedTypeIdentifier& identifier)
91 {
92  d_func_dynamic()->m_identifier = identifier;
93 }
94 
95 IndexedTypeIdentifier DelayedType::identifier() const
96 {
97  return d_func()->m_identifier;
98 }
99 
100 void DelayedType::accept0(KDevelop::TypeVisitor* v) const
101 {
102  v->visit(this);
103 /* v->endVisit(this);*/
104 }
105 
106 inline uint qHash(DelayedType::Kind kind)
107 {
108  return ::qHash(static_cast<quint8>(kind));
109 }
110 
111 uint DelayedType::hash() const
112 {
113  return KDevHash(AbstractType::hash()) << d_func()->m_identifier.hash() << d_func()->m_kind;
114 }
115 }
KDevelop::DelayedTypeData
Private data structure for DelayedType.
Definition: typesystemdata.h:229
KDevelop::DelayedType::kind
Kind kind() const
Definition: delayedtype.cpp:67
KDevelop::DelayedType::clone
AbstractType * clone() const override
Should create a clone of the source-type, with as much data copied as possible without breaking the d...
Definition: delayedtype.cpp:37
KDevelop::DelayedType
A type which has not yet been resolved.
Definition: delayedtype.h:38
KDevelop::DelayedType::~DelayedType
~DelayedType() override
Destructor.
Definition: delayedtype.cpp:86
KDevelop::DelayedType::Kind
Kind
An enumeration of.
Definition: delayedtype.h:45
KDevelop::AbstractType::equals
virtual bool equals(const AbstractType *rhs) const
Should return whether this type's content equals the given one Since this is used by the type-reposit...
Definition: abstracttype.cpp:134
KDevelop::REGISTER_TYPE
REGISTER_TYPE(ArrayType)
typerepository.h
KDevelop::AbstractType::toString
virtual QString toString() const
Returns this type as a string, preferably the same as it is expressed in the code.
Definition: abstracttype.cpp:148
typesystemdata.h
KDevelop::IndexedTypeIdentifier::toString
QString toString(IdentifierStringFormattingOptions options=NoOptions) const
Definition: identifier.cpp:1245
KDevelop::DelayedType::identifier
KDevelop::IndexedTypeIdentifier identifier() const
Access the type identifier which this type represents.
Definition: delayedtype.cpp:95
QString
KDevelop::DelayedType::setKind
void setKind(Kind kind)
Definition: delayedtype.cpp:72
typesystem.h
KDevelop::DelayedType::toString
QString toString() const override
Returns this type as a string, preferably the same as it is expressed in the code.
Definition: delayedtype.cpp:62
KDevelop::DelayedType::hash
uint hash() const override
A hash-value that should have the following properties:
Definition: delayedtype.cpp:111
KDevelop::qHash
uint qHash(DelayedType::Kind kind)
Definition: delayedtype.cpp:106
delayedtype.h
KDevelop::TypeVisitor
Definition: typesystem.h:41
typeregister.h
KDevelop::qHash
uint qHash(const KDevelop::DeclarationId &id)
Definition: declarationid.h:205
KDevelop::DelayedType::setIdentifier
void setIdentifier(const KDevelop::IndexedTypeIdentifier &identifier)
Set the type identifier which this type represents.
Definition: delayedtype.cpp:90
KDevelop::AbstractType::TypeDelayed
a delayed type
Definition: abstracttype.h:222
KDevelop::TypeVisitor::visit
virtual bool visit(const AbstractType *)=0
Return whether sub-types should be visited(same for the other visit functions)
KDevelop
Definition: abstractfunctiondeclaration.cpp:27
KDevelop::DelayedType::whichType
WhichType whichType() const override
Determine which data type this abstract type represents.
Definition: delayedtype.cpp:57
KDevelop::AbstractType::hash
virtual uint hash() const
A hash-value that should have the following properties:
Definition: abstracttype.cpp:142
KDevelop::DelayedType::equals
bool equals(const AbstractType *rhs) const override
Should return whether this type's content equals the given one Since this is used by the type-reposit...
Definition: delayedtype.cpp:42
KDevelop::DelayedType::DelayedType
DelayedType()
Default constructor.
Definition: delayedtype.cpp:77
KDevelop::IndexedTypeIdentifier
Extends IndexedQualifiedIdentifier by:
Definition: identifier.h:381
KDevelop::DelayedType::accept0
void accept0(KDevelop::TypeVisitor *v) const override
Visitor method, reimplement to allow visiting of types.
Definition: delayedtype.cpp:100
KDevelop::AbstractType::WhichType
WhichType
Enumeration of major data types.
Definition: abstracttype.h:214
KDevelop::AbstractType
Base class for all types.
Definition: abstracttype.h:87
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Mar 3 2021 00:37:28 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