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

A representation of array types. More...

#include <array_type.h>

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

Public Types

using DimensionType = std::size_t
 
using Dimensions = std::vector< DimensionType >
 

Public Member Functions

std::shared_ptr< TypegetElementType () const
 Returns element type. More...
 
const DimensionsgetDimensions () const
 Returns array's dimensions. More...
 
Dimensions::size_type getDimensionCount () const
 Returns array's dimensions count. More...
 
virtual bool isArray () const override
 Returns true when Type is array, false otherwise. More...
 
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 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 isTypedef () const
 
virtual bool isUnion () const
 
virtual bool isUnknown () const
 
virtual bool isVoid () const
 

Static Public Member Functions

static std::shared_ptr< ArrayTypecreate (const std::shared_ptr< Context > &context, const std::shared_ptr< Type > &elementType, const Dimensions &dimensions)
 Creates array type. More...
 

Static Public Attributes

static const DimensionType UNKNOWN_DIMENSION = 0
 Value used for unknown dimension. More...
 

Private Member Functions

 ArrayType (const std::shared_ptr< Type > &elementType, const Dimensions &dimensions)
 Constructs a new array type. More...
 

Private Attributes

std::shared_ptr< TypeelementType
 
Dimensions dimensions
 

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

Member Typedef Documentation

◆ Dimensions

◆ DimensionType

Constructor & Destructor Documentation

◆ ArrayType()

retdec::ctypes::ArrayType::ArrayType ( const std::shared_ptr< Type > &  elementType,
const Dimensions dimensions 
)
private

Constructs a new array type.

Member Function Documentation

◆ accept()

void retdec::ctypes::ArrayType::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< ArrayType > retdec::ctypes::ArrayType::create ( const std::shared_ptr< Context > &  context,
const std::shared_ptr< Type > &  elementType,
const Dimensions dimensions 
)
static

Creates array type.

Parameters
contextStorage for already created functions, types.
elementTypeType that this array contains.
dimensionsArray's dimensions.
Preconditions
  • context is not null
  • elementType is not null

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

◆ getDimensionCount()

ArrayType::Dimensions::size_type retdec::ctypes::ArrayType::getDimensionCount ( ) const

Returns array's dimensions count.

◆ getDimensions()

const ArrayType::Dimensions & retdec::ctypes::ArrayType::getDimensions ( ) const

Returns array's dimensions.

◆ getElementType()

std::shared_ptr< Type > retdec::ctypes::ArrayType::getElementType ( ) const

Returns element type.

◆ isArray()

bool retdec::ctypes::ArrayType::isArray ( ) const
overridevirtual

Returns true when Type is array, false otherwise.

Reimplemented from retdec::ctypes::Type.

Member Data Documentation

◆ dimensions

Dimensions retdec::ctypes::ArrayType::dimensions
private

◆ elementType

std::shared_ptr<Type> retdec::ctypes::ArrayType::elementType
private

◆ UNKNOWN_DIMENSION

const ArrayType::DimensionType retdec::ctypes::ArrayType::UNKNOWN_DIMENSION = 0
static

Value used for unknown dimension.

Sets unknown dimension's value.


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