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

A representation of enum type. More...

#include <enum_type.h>

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

Classes

class  Value
 A representation of enum value. More...
 

Public Types

using Values = std::vector< Value >
 
using iterator = Values::iterator
 
using const_iterator = Values::const_iterator
 

Public Member Functions

virtual bool isEnum () const override
 
Enum type values.
iterator value_begin ()
 Returns an iterator to the enum value. More...
 
const_iterator value_begin () const
 Returns a constant iterator to the enum value. More...
 
iterator value_end ()
 Returns an iterator past the last enum value. More...
 
const_iterator value_end () const
 Returns a constant iterator past the last enum value. More...
 
Values::size_type getValueCount () const
 Returns number of enum's values. More...
 
const ValuegetValue (Values::size_type index) const
 Returns n-th value. 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 isArray () 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< EnumTypecreate (const std::shared_ptr< Context > &context, const std::string &name, const Values &values)
 Creates enum type. More...
 

Static Public Attributes

static const Value::ValueType DEFAULT_VALUE
 Value used for unknown values. More...
 

Private Member Functions

 EnumType (const std::string &name, const Values &values)
 Constructs a new enum type. More...
 

Private Attributes

Values values
 

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 enum type.

Member Typedef Documentation

◆ const_iterator

using retdec::ctypes::EnumType::const_iterator = Values::const_iterator

◆ iterator

using retdec::ctypes::EnumType::iterator = Values::iterator

◆ Values

Constructor & Destructor Documentation

◆ EnumType()

retdec::ctypes::EnumType::EnumType ( const std::string &  name,
const Values values 
)
private

Constructs a new enum type.

Member Function Documentation

◆ accept()

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

Creates enum type.

Parameters
contextStorage for already created functions, types.
nameName of new enum type.
valuesEnum values.
Preconditions
  • context is not null

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

◆ getValue()

const EnumType::Value & retdec::ctypes::EnumType::getValue ( Values::size_type  n) const

Returns n-th value.

Preconditions
  • 0 < n <= ValueCount

◆ getValueCount()

EnumType::Values::size_type retdec::ctypes::EnumType::getValueCount ( ) const

Returns number of enum's values.

◆ isEnum()

bool retdec::ctypes::EnumType::isEnum ( ) const
overridevirtual

Returns true when Type is enum, false otherwise.

Reimplemented from retdec::ctypes::Type.

◆ value_begin() [1/2]

EnumType::iterator retdec::ctypes::EnumType::value_begin ( )

Returns an iterator to the enum value.

◆ value_begin() [2/2]

EnumType::const_iterator retdec::ctypes::EnumType::value_begin ( ) const

Returns a constant iterator to the enum value.

◆ value_end() [1/2]

EnumType::iterator retdec::ctypes::EnumType::value_end ( )

Returns an iterator past the last enum value.

◆ value_end() [2/2]

EnumType::const_iterator retdec::ctypes::EnumType::value_end ( ) const

Returns a constant iterator past the last enum value.

Member Data Documentation

◆ DEFAULT_VALUE

const EnumType::Value::ValueType retdec::ctypes::EnumType::DEFAULT_VALUE
static
Initial value:
=
std::numeric_limits<Value::ValueType>::min()

Value used for unknown values.

Sets default enum value.

◆ values

Values retdec::ctypes::EnumType::values
private

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