retdec
Public Types | Protected Member Functions | Protected Attributes | List of all members
retdec::ctypes::CompositeType Class Reference

A representation of composite type. More...

#include <composite_type.h>

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

Public Types

using Members = std::vector< Member >
 
using member_iterator = Members::iterator
 
using const_member_iterator = Members::const_iterator
 

Public Member Functions

Composite type members.
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 isStruct () const
 
virtual bool isTypedef () const
 
virtual bool isUnion () const
 
virtual bool isUnknown () const
 
virtual bool isVoid () const
 
- Public Member Functions inherited from retdec::ctypes::Visitable
virtual void accept (Visitor *v)=0
 Visitor pattern implementation. More...
 

Protected Member Functions

 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

Members members
 
- Protected Attributes inherited from retdec::ctypes::Type
std::string name
 
unsigned bitWidth
 

Detailed Description

A representation of composite type.

Member Typedef Documentation

◆ const_member_iterator

◆ member_iterator

◆ Members

Constructor & Destructor Documentation

◆ CompositeType()

retdec::ctypes::CompositeType::CompositeType ( const std::string &  name,
const Members members 
)
protected

Constructs a new composite type.

Member Function Documentation

◆ getMember()

const Member & retdec::ctypes::CompositeType::getMember ( Members::size_type  n) const

Returns the n-th member.

Preconditions
  • 0 < n <= MemberCount

The members are numbered starting with 1.

◆ getMemberCount()

CompositeType::Members::size_type retdec::ctypes::CompositeType::getMemberCount ( ) const

Returns the number of members.

Does not matter whether function takes variable number of members or not.

◆ getMemberName()

const std::string & retdec::ctypes::CompositeType::getMemberName ( Members::size_type  n) const

Returns the n-th member's name.

Preconditions
  • 0 < n <= MemberCount

The members are numbered starting with 1.

◆ getMemberType()

std::shared_ptr< Type > retdec::ctypes::CompositeType::getMemberType ( Members::size_type  n) const

Returns the n-th member's type.

Preconditions
  • 0 < n <= MemberCount

The members are numbered starting with 1.

◆ member_begin() [1/2]

CompositeType::member_iterator retdec::ctypes::CompositeType::member_begin ( )

Returns an iterator to the member.

◆ member_begin() [2/2]

CompositeType::const_member_iterator retdec::ctypes::CompositeType::member_begin ( ) const

Returns a constant iterator to the member.

◆ member_end() [1/2]

CompositeType::member_iterator retdec::ctypes::CompositeType::member_end ( )

Returns an iterator past the last member.

◆ member_end() [2/2]

CompositeType::const_member_iterator retdec::ctypes::CompositeType::member_end ( ) const

Returns a constant iterator past the last member.

◆ setMembers()

void retdec::ctypes::CompositeType::setMembers ( const Members members)

Sets new members to composite type.

Overwrites old members. Iterators (returned by member_{begin|end}()) pointing to the old members become invalid.

Member Data Documentation

◆ members

Members retdec::ctypes::CompositeType::members
protected

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