retdec
integral_type.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_CTYPES_INTEGRAL_TYPE_H
8 #define RETDEC_CTYPES_INTEGRAL_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 IntegralType: public Type
24 {
25  public:
26  enum class Signess {
27  Signed,
28  Unsigned
29  };
30 
31  public:
32  static std::shared_ptr<IntegralType> create(
33  const std::shared_ptr<Context> &context, const std::string &name,
35 
36  bool isSigned() const;
37  bool isUnsigned() const;
38 
39  virtual bool isIntegral() const override;
40 
43  virtual void accept(Visitor *v) override;
45 
46  private:
47  // Instances are created by static method create().
48  IntegralType(const std::string &name, unsigned bitWidth,
50 
51  private:
53 };
54 
55 } // namespace ctypes
56 } // namespace retdec
57 
58 #endif
A representation of integral types.
Definition: integral_type.h:24
static std::shared_ptr< IntegralType > create(const std::shared_ptr< Context > &context, const std::string &name, unsigned bitWidth, Signess signess=Signess::Signed)
Creates integral type.
Definition: integral_type.cpp:38
Signess signess
Definition: integral_type.h:52
virtual bool isIntegral() const override
Definition: integral_type.cpp:73
Signess
Definition: integral_type.h:26
bool isSigned() const
Returns true for signed types, false otherwise.
Definition: integral_type.cpp:57
bool isUnsigned() const
Returns true for unsigned types, false otherwise.
Definition: integral_type.cpp:65
virtual void accept(Visitor *v) override
Visitor pattern implementation.
Definition: integral_type.cpp:78
IntegralType(const std::string &name, unsigned bitWidth, Signess signess=Signess::Signed)
Constructs a new integral type.
Definition: integral_type.cpp:21
A base class of all C types.
Definition: type.h:22
unsigned bitWidth
Definition: type.h:49
std::string name
Definition: type.h:48
A base class of all C-types' visitors.
Definition: visitor.h:33
A base class of all C types.
Definition: archive_wrapper.h:19