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

A representation of typedefed types. More...

#include <typedefed_type.h>

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

Public Member Functions

std::shared_ptr< TypegetAliasedType () const
 Returns type that typedef stands for. More...
 
std::shared_ptr< TypegetRealType () const
 Returns real type that typedef stands for. More...
 
virtual bool isTypedef () 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 isIntegral () const
 
virtual bool isNamed () const
 
virtual bool isPointer () const
 
virtual bool isReference () const
 
virtual bool isStruct () const
 
virtual bool isUnion () const
 
virtual bool isUnknown () const
 
virtual bool isVoid () const
 

Static Public Member Functions

static std::shared_ptr< TypedefedTypecreate (const std::shared_ptr< Context > &context, const std::string &name, const std::shared_ptr< Type > &aliasedType)
 Creates typedefed type. More...
 

Private Member Functions

 TypedefedType (const std::string &name, const std::shared_ptr< Type > &aliasedType)
 Constructs a new typedefed type. More...
 

Private Attributes

std::shared_ptr< TypealiasedType
 Type that this typedef stands for. More...
 

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 typedefed types.

Constructor & Destructor Documentation

◆ TypedefedType()

retdec::ctypes::TypedefedType::TypedefedType ( const std::string &  name,
const std::shared_ptr< Type > &  aliasedType 
)
private

Constructs a new typedefed type.

Member Function Documentation

◆ accept()

void retdec::ctypes::TypedefedType::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< TypedefedType > retdec::ctypes::TypedefedType::create ( const std::shared_ptr< Context > &  context,
const std::string &  name,
const std::shared_ptr< Type > &  aliasedType 
)
static

Creates typedefed type.

Parameters
contextStorage for already created functions, types.
nameName of new type.
aliasedTypeType, that this typedef stands for.
Preconditions
  • context is not null
  • aliasedType is not null

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

◆ getAliasedType()

std::shared_ptr< Type > retdec::ctypes::TypedefedType::getAliasedType ( ) const

Returns type that typedef stands for.

Aliased type for MyInt in

typedef int MyInt;

is int

Aliased type for MySecondInt in

typedef int MyInt;
typedef MyInt MySecondInt;

is MyInt

◆ getRealType()

std::shared_ptr< Type > retdec::ctypes::TypedefedType::getRealType ( ) const

Returns real type that typedef stands for.

If aliased type is typedefed type, get its real type.

Real type for MySecondint in

typedef int MyInt;
typedef MyInt MySecondInt;

is int

◆ isTypedef()

bool retdec::ctypes::TypedefedType::isTypedef ( ) const
overridevirtual

Returns true when Type is typedef, false otherwise.

Reimplemented from retdec::ctypes::Type.

Member Data Documentation

◆ aliasedType

std::shared_ptr<Type> retdec::ctypes::TypedefedType::aliasedType
private

Type that this typedef stands for.


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