• 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
typesystem.h
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 #ifndef KDEVPLATFORM_TYPESYSTEM_H
22 #define KDEVPLATFORM_TYPESYSTEM_H
23 
24 #include "typepointer.h"
25 #include "../identifier.h"
26 #include "abstracttype.h"
27 
28 namespace KDevelop {
29 class AbstractTypeDataRequest;
30 
31 class AbstractType;
32 class IntegralType;
33 class PointerType;
34 class ReferenceType;
35 class FunctionType;
36 class StructureType;
37 class ArrayType;
38 
39 class TypeExchanger;
40 
41 class KDEVPLATFORMLANGUAGE_EXPORT TypeVisitor
42 {
43 public:
44  virtual ~TypeVisitor ();
45 
46  virtual bool preVisit (const AbstractType*) = 0;
47  virtual void postVisit (const AbstractType*) = 0;
48 
50  virtual bool visit(const AbstractType*) = 0;
51 
52  virtual void visit (const IntegralType*) = 0;
53 
54  virtual bool visit (const PointerType*) = 0;
55  virtual void endVisit (const PointerType*) = 0;
56 
57  virtual bool visit (const ReferenceType*) = 0;
58  virtual void endVisit (const ReferenceType*) = 0;
59 
60  virtual bool visit (const FunctionType*) = 0;
61  virtual void endVisit (const FunctionType*) = 0;
62 
63  virtual bool visit (const StructureType*) = 0;
64  virtual void endVisit (const StructureType*) = 0;
65 
66  virtual bool visit (const ArrayType*) = 0;
67  virtual void endVisit (const ArrayType*) = 0;
68 };
69 
70 class KDEVPLATFORMLANGUAGE_EXPORT SimpleTypeVisitor
71  : public TypeVisitor
72 {
73 public:
76  using TypeVisitor::visit;
77 
78  bool preVisit (const AbstractType*) override;
79  void postVisit (const AbstractType*) override;
80 
81  void visit (const IntegralType*) override;
82 
83  bool visit (const PointerType*) override;
84  void endVisit (const PointerType*) override;
85 
86  bool visit (const ReferenceType*) override;
87  void endVisit (const ReferenceType*) override;
88 
89  bool visit (const FunctionType*) override;
90  void endVisit (const FunctionType*) override;
91 
92  bool visit (const StructureType*) override;
93  void endVisit (const StructureType*) override;
94 
95  bool visit (const ArrayType*) override;
96  void endVisit (const ArrayType*) override;
97 };
98 
103 class KDEVPLATFORMLANGUAGE_EXPORT TypeExchanger
104 {
105 public:
106  virtual ~TypeExchanger()
107  {
108  }
109 
115  virtual AbstractType::Ptr exchange(const AbstractType::Ptr&);
116 };
117 
119 class KDEVPLATFORMLANGUAGE_EXPORT SimpleTypeExchanger
120  : public TypeExchanger
121 {
122 public:
123  SimpleTypeExchanger(const AbstractType::Ptr& replace, const AbstractType::Ptr& replaceWith);
124  AbstractType::Ptr exchange(const AbstractType::Ptr&) override;
125 
126 private:
127  AbstractType::Ptr m_replace, m_replaceWith;
128 };
129 }
130 
131 #endif // KDEVPLATFORM_TYPESYSTEM_H
KDevelop::SimpleTypeExchanger
A simple type-exchanger that replaces one type with another.
Definition: typesystem.h:119
KDevelop::TypePtr
QExplicitlySharedDataPointer wrapper with convenience functions attached.
Definition: typepointer.h:39
KDevelop::PointerType
A type representing pointer types.
Definition: pointertype.h:35
KDevelop::TypeExchanger::~TypeExchanger
virtual ~TypeExchanger()
Definition: typesystem.h:106
KDevelop::FunctionType
A type representing function types.
Definition: functiontype.h:35
KDevelop::TypeVisitor
Definition: typesystem.h:41
KDevelop::IntegralType
A type representing inbuilt data types.
Definition: integraltype.h:35
KDevelop::ReferenceType
A type representing reference types.
Definition: referencetype.h:35
KDevelop::TypeExchanger
A class that can be used to walk through all types that are references from one type,...
Definition: typesystem.h:103
abstracttype.h
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::SimpleTypeVisitor
Definition: typesystem.h:70
KDevelop::ArrayType
Definition: arraytype.h:29
KDevelop::StructureType
A type representing structure types.
Definition: structuretype.h:38
KDevelop::AbstractType
Base class for all types.
Definition: abstracttype.h:87
typepointer.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Jan 23 2021 09:40:52 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