• 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
instantiationinformation.h
Go to the documentation of this file.
1 /* This file is part of KDevelop
2  Copyright 2007-2009 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 #ifndef KDEVPLATFORM_INSTANTIATIONINFORMATION_H
20 #define KDEVPLATFORM_INSTANTIATIONINFORMATION_H
21 
22 #include <language/languageexport.h>
23 #include "types/abstracttype.h"
24 #include "types/indexedtype.h"
25 #include "appendedlist.h"
26 
27 #include <serialization/referencecounting.h>
28 
29 namespace KDevelop {
30 class IndexedInstantiationInformation;
31 class InstantiationInformation;
32 class QualifiedIdentifier;
33 
34 KDEVPLATFORMLANGUAGE_EXPORT DECLARE_LIST_MEMBER_HASH(InstantiationInformation, templateParameters, IndexedType)
35 
36 class KDEVPLATFORMLANGUAGE_EXPORT IndexedInstantiationInformation
37  : public ReferenceCountManager
38 {
39 public:
40  IndexedInstantiationInformation();
41  explicit IndexedInstantiationInformation(uint index);
42  IndexedInstantiationInformation(const IndexedInstantiationInformation& rhs);
43  IndexedInstantiationInformation& operator=(const IndexedInstantiationInformation& rhs);
44  ~IndexedInstantiationInformation();
45 
46  const InstantiationInformation& information() const;
47 
48  uint hash() const
49  {
50  return m_index * 73;
51  }
52 
53  //Is always zero for the empty information
54  uint index() const
55  {
56  return m_index;
57  }
58 
59  bool operator==(const IndexedInstantiationInformation& rhs) const
60  {
61  return m_index == rhs.m_index;
62  }
63 
64  //Returns true if one of the values represented by this information is non-default
65  bool isValid() const;
66 
67 private:
68  uint m_index;
69 };
70 
71 class KDEVPLATFORMLANGUAGE_EXPORT InstantiationInformation
72 {
73 public:
74 
75  InstantiationInformation();
77  InstantiationInformation(const InstantiationInformation& rhs, bool dynamic = true);
78 
79  ~InstantiationInformation();
80 
81  InstantiationInformation& operator=(const InstantiationInformation& rhs);
82 
83  bool operator==(const InstantiationInformation& rhs) const;
84 
85  uint hash() const;
86 
87  bool isValid() const
88  {
89  return previousInstantiationInformation.index() || templateParametersSize();
90  }
91 
92  bool persistent() const
93  {
94  return ( bool )m_refCount;
95  }
96 
107  QualifiedIdentifier applyToIdentifier(const QualifiedIdentifier& id) const;
108 
113  QString toString(bool local = false) const;
114 
120  void addTemplateParameter(const AbstractType::Ptr& type);
121 
125  IndexedInstantiationInformation previousInstantiationInformation;
126 
127  START_APPENDED_LISTS(InstantiationInformation)
128 
129  static uint classSize()
130  {
131  return sizeof(InstantiationInformation);
132  }
133 
134  short unsigned int itemSize() const
135  {
136  return dynamicSize();
137  }
138 
142  APPENDED_LIST_FIRST(InstantiationInformation, IndexedType, templateParameters);
143 
144  END_APPENDED_LISTS(InstantiationInformation, templateParameters);
145 
146  IndexedInstantiationInformation indexed() const;
147 
148 private:
149  friend class IndexedInstantiationInformation;
150  uint m_refCount;
151 };
152 
153 inline uint qHash(const IndexedInstantiationInformation& info)
154 {
155  return info.hash();
156 }
157 inline uint qHash(const InstantiationInformation& info)
158 {
159  return info.hash();
160 }
161 }
162 
163 Q_DECLARE_TYPEINFO(KDevelop::IndexedInstantiationInformation, Q_MOVABLE_TYPE);
164 Q_DECLARE_TYPEINFO(KDevelop::InstantiationInformation, Q_MOVABLE_TYPE);
165 
166 #endif // KDEVPLATFORM_INSTANTIATIONINFORMATION_H
APPENDED_LIST_FIRST
#define APPENDED_LIST_FIRST(container, type, name)
Definition: appendedlist.h:321
appendedlist.h
KDevelop::TypePtr
QExplicitlySharedDataPointer wrapper with convenience functions attached.
Definition: typepointer.h:39
KDevelop::InstantiationInformation::hash
uint hash() const
Definition: instantiationinformation.cpp:123
KDevelop::DECLARE_LIST_MEMBER_HASH
KDEVPLATFORMLANGUAGE_EXPORT DECLARE_LIST_MEMBER_HASH(DUContextData, m_childContexts, LocalIndexedDUContext) KDEVPLATFORMLANGUAGE_EXPORT DECLARE_LIST_MEMBER_HASH(DUContextData
QString
Q_DECLARE_TYPEINFO
Q_DECLARE_TYPEINFO(KDevelop::IndexedInstantiationInformation, Q_MOVABLE_TYPE)
KDevelop::InstantiationInformation::previousInstantiationInformation
IndexedInstantiationInformation previousInstantiationInformation
Instantiation-information for the surrounding context(see IndexedInstantiationInformation).
Definition: instantiationinformation.h:125
KDevelop::InstantiationInformation::persistent
bool persistent() const
Definition: instantiationinformation.h:92
indexedtype.h
END_APPENDED_LISTS
#define END_APPENDED_LISTS(container, predecessor)
Definition: appendedlist.h:358
KDevelop::qHash
uint qHash(const KDevelop::DeclarationId &id)
Definition: declarationid.h:205
KDevelop::InstantiationInformation::isValid
bool isValid() const
Definition: instantiationinformation.h:87
KDevelop::InstantiationInformation
Definition: instantiationinformation.h:71
KDevelop::QualifiedIdentifier
Represents a qualified identifier.
Definition: identifier.h:245
ReferenceCountManager
abstracttype.h
KDevelop::IndexedType
Indexed type pointer.
Definition: indexedtype.h:36
KDevelop
Definition: abstractfunctiondeclaration.cpp:27
KDevelop::InstantiationInformation::itemSize
short unsigned int itemSize() const
Definition: instantiationinformation.h:134
START_APPENDED_LISTS
#define START_APPENDED_LISTS(container)
use this if the class does not have a base class that also uses appended lists
Definition: appendedlist.h:250
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Mar 4 2021 23:31:17 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