retdec
typedefed_type.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_CTYPES_TYPEDEFED_TYPE_H
8 #define RETDEC_CTYPES_TYPEDEFED_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 TypedefedType: public Type
24 {
25  public:
26  static std::shared_ptr<TypedefedType> create(
27  const std::shared_ptr<Context> &context,
28  const std::string &name,
29  const std::shared_ptr<Type> &aliasedType
30  );
31 
32  std::shared_ptr<Type> getAliasedType() const;
33  std::shared_ptr<Type> getRealType() const;
34 
35  virtual bool isTypedef() const override;
36 
39  virtual void accept(Visitor *v) override;
41 
42  private:
43  // Instances are created by static method create().
44  TypedefedType(const std::string &name,
45  const std::shared_ptr<Type> &aliasedType);
46 
47  private:
49  std::shared_ptr<Type> aliasedType;
50 };
51 
52 } // namespace ctypes
53 } // namespace retdec
54 
55 #endif
A base class of all C types.
Definition: type.h:22
std::string name
Definition: type.h:48
A representation of typedefed types.
Definition: typedefed_type.h:24
std::shared_ptr< Type > getRealType() const
Returns real type that typedef stands for.
Definition: typedefed_type.cpp:90
static std::shared_ptr< TypedefedType > create(const std::shared_ptr< Context > &context, const std::string &name, const std::shared_ptr< Type > &aliasedType)
Creates typedefed type.
Definition: typedefed_type.cpp:37
std::shared_ptr< Type > getAliasedType() const
Returns type that typedef stands for.
Definition: typedefed_type.cpp:73
virtual bool isTypedef() const override
Definition: typedefed_type.cpp:103
virtual void accept(Visitor *v) override
Visitor pattern implementation.
Definition: typedefed_type.cpp:108
std::shared_ptr< Type > aliasedType
Type that this typedef stands for.
Definition: typedefed_type.h:49
TypedefedType(const std::string &name, const std::shared_ptr< Type > &aliasedType)
Constructs a new typedefed type.
Definition: typedefed_type.cpp:19
A base class of all C-types' visitors.
Definition: visitor.h:33
A base class of all C types.
Definition: archive_wrapper.h:19