retdec
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
retdec::ctypes::IntegralType Class Reference

A representation of integral types. More...

#include <integral_type.h>

Inheritance diagram for retdec::ctypes::IntegralType:
Inheritance graph
[legend]
Collaboration diagram for retdec::ctypes::IntegralType:
Collaboration graph
[legend]

Public Types

enum class  Signess { Signed , Unsigned }
 

Public Member Functions

bool isSigned () const
 Returns true for signed types, false otherwise. More...
 
bool isUnsigned () const
 Returns true for unsigned types, false otherwise. More...
 
virtual bool isIntegral () const override
 
Visitor interface.
virtual void accept (Visitor *v) override
 Visitor pattern implementation. More...
 
- Public Member Functions inherited from retdec::ctypes::Type
virtual ~Type ()=default
 
const std::string & getName () const
 
unsigned getBitWidth () const
 
virtual bool isArray () const
 
virtual bool isEnum () const
 
virtual bool isFloatingPoint () const
 
virtual bool isFunction () const
 
virtual bool isNamed () const
 
virtual bool isPointer () const
 
virtual bool isReference () const
 
virtual bool isStruct () const
 
virtual bool isTypedef () const
 
virtual bool isUnion () const
 
virtual bool isUnknown () const
 
virtual bool isVoid () const
 

Static Public Member Functions

static std::shared_ptr< IntegralTypecreate (const std::shared_ptr< Context > &context, const std::string &name, unsigned bitWidth, Signess signess=Signess::Signed)
 Creates integral type. More...
 

Private Member Functions

 IntegralType (const std::string &name, unsigned bitWidth, Signess signess=Signess::Signed)
 Constructs a new integral type. More...
 

Private Attributes

Signess signess
 

Additional Inherited Members

- Protected Member Functions inherited from retdec::ctypes::Type
 Type ()=default
 
 Type (const std::string &name, unsigned bitWidth)
 Constructs a new type. More...
 
- Protected Member Functions inherited from retdec::ctypes::Visitable
 Visitable ()=default
 
 ~Visitable ()=default
 
- Protected Attributes inherited from retdec::ctypes::Type
std::string name
 
unsigned bitWidth
 

Detailed Description

A representation of integral types.

Member Enumeration Documentation

◆ Signess

Enumerator
Signed 
Unsigned 

Constructor & Destructor Documentation

◆ IntegralType()

retdec::ctypes::IntegralType::IntegralType ( const std::string &  name,
unsigned  bitWidth,
Signess  signess = Signess::Signed 
)
private

Constructs a new integral type.

See create() for more information.

Member Function Documentation

◆ accept()

void retdec::ctypes::IntegralType::accept ( Visitor v)
overridevirtual

Visitor pattern implementation.

Subclasses should implement this method as:

v->visit(std::static_pointer_cast<T>(std::shared_from_this()));

where T is the name of the subclass.

Implements retdec::ctypes::Visitable.

◆ create()

std::shared_ptr< IntegralType > retdec::ctypes::IntegralType::create ( const std::shared_ptr< Context > &  context,
const std::string &  name,
unsigned  bitWidth,
Signess  signess = Signess::Signed 
)
static

Creates integral type.

Parameters
contextStorage for already created functions, types.
nameName of new type.
bitWidthNumber of bits used by this type.
signessSign of type.
Preconditions
  • context is not null

Does not create new integral type, if one has already been created and stored in context.

◆ isIntegral()

bool retdec::ctypes::IntegralType::isIntegral ( ) const
overridevirtual

Returns true when Type is integral, false otherwise.

Reimplemented from retdec::ctypes::Type.

◆ isSigned()

bool retdec::ctypes::IntegralType::isSigned ( ) const

Returns true for signed types, false otherwise.

◆ isUnsigned()

bool retdec::ctypes::IntegralType::isUnsigned ( ) const

Returns true for unsigned types, false otherwise.

Member Data Documentation

◆ signess

Signess retdec::ctypes::IntegralType::signess
private

The documentation for this class was generated from the following files: