retdec
pointer_type.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_CTYPES_POINTER_TYPE_H
8 #define RETDEC_CTYPES_POINTER_TYPE_H
9 
10 #include <memory>
11 #include <string>
12 
13 #include "retdec/ctypes/type.h"
14 
15 namespace retdec {
16 namespace ctypes {
17 
18 class Context;
19 
23 class PointerType: public Type
24 {
25  public:
26  static std::shared_ptr<PointerType> create(
27  const std::shared_ptr<Context> &context,
28  const std::shared_ptr<Type> &pointedType,
29  unsigned bitWidth = 0
30  );
31 
32  std::shared_ptr<Type> getPointedType() const;
33 
34  virtual bool isPointer() const override;
35 
38  virtual void accept(Visitor *v) override;
40 
41  private:
42  PointerType(const std::shared_ptr<Type> &pointedType, unsigned bitWidth = 0);
43 
44  private:
45  std::shared_ptr<Type> pointedType;
46 };
47 
48 } // namespace ctypes
49 } // namespace retdec
50 
51 #endif
A representation of pointer types.
Definition: pointer_type.h:24
virtual bool isPointer() const override
Definition: pointer_type.cpp:65
std::shared_ptr< Type > getPointedType() const
Returns pointed type.
Definition: pointer_type.cpp:58
virtual void accept(Visitor *v) override
Visitor pattern implementation.
Definition: pointer_type.cpp:70
static std::shared_ptr< PointerType > create(const std::shared_ptr< Context > &context, const std::shared_ptr< Type > &pointedType, unsigned bitWidth=0)
Creates pointer type.
Definition: pointer_type.cpp:36
PointerType(const std::shared_ptr< Type > &pointedType, unsigned bitWidth=0)
Constructs a new pointer type.
Definition: pointer_type.cpp:19
std::shared_ptr< Type > pointedType
Definition: pointer_type.h:45
A base class of all C types.
Definition: type.h:22
unsigned bitWidth
Definition: type.h:49
A base class of all C-types' visitors.
Definition: visitor.h:33
A base class of all C types.
Definition: archive_wrapper.h:19