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

A representation of struct types. More...

#include <struct_type.h>

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

Public Member Functions

virtual bool isStruct () const override
 
Visitor interface.
virtual void accept (Visitor *v) override
 Visitor pattern implementation. More...
 
- Public Member Functions inherited from retdec::ctypes::CompositeType
member_iterator member_begin ()
 Returns an iterator to the member. More...
 
const_member_iterator member_begin () const
 Returns a constant iterator to the member. More...
 
member_iterator member_end ()
 Returns an iterator past the last member. More...
 
const_member_iterator member_end () const
 Returns a constant iterator past the last member. More...
 
Members::size_type getMemberCount () const
 Returns the number of members. More...
 
const MembergetMember (Members::size_type n) const
 Returns the n-th member. More...
 
const std::string & getMemberName (Members::size_type n) const
 Returns the n-th member's name. More...
 
std::shared_ptr< TypegetMemberType (Members::size_type n) const
 Returns the n-th member's type. More...
 
void setMembers (const Members &members)
 Sets new members to composite type. 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 isTypedef () const
 
virtual bool isUnion () const
 
virtual bool isUnknown () const
 
virtual bool isVoid () const
 

Static Public Member Functions

static std::shared_ptr< StructTypecreate (const std::shared_ptr< Context > &context, const std::string &name, const Members &members)
 Creates struct type. More...
 

Private Member Functions

 StructType (const std::string &name, const Members &members)
 Constructs a new struct type. More...
 

Additional Inherited Members

- Public Types inherited from retdec::ctypes::CompositeType
using Members = std::vector< Member >
 
using member_iterator = Members::iterator
 
using const_member_iterator = Members::const_iterator
 
- Protected Member Functions inherited from retdec::ctypes::CompositeType
 CompositeType (const std::string &name, const Members &members)
 Constructs a new composite type. More...
 
- 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::CompositeType
Members members
 
- Protected Attributes inherited from retdec::ctypes::Type
std::string name
 
unsigned bitWidth
 

Detailed Description

A representation of struct types.

Constructor & Destructor Documentation

◆ StructType()

retdec::ctypes::StructType::StructType ( const std::string &  name,
const Members members 
)
private

Constructs a new struct type.

See create() for more information.

Member Function Documentation

◆ accept()

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

Creates struct type.

Parameters
contextStorage for already created functions, types.
nameName of new type.
membersItems of struct.
Preconditions
  • context is not null

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

◆ isStruct()

bool retdec::ctypes::StructType::isStruct ( ) const
overridevirtual

Returns true when Type is struct, false otherwise.

Reimplemented from retdec::ctypes::Type.


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