LIEF: Library to Instrument Executable Formats Version 0.16.0
Loading...
Searching...
No Matches
LIEF::MachO::FatBinary Class Reference

Class which represent a Mach-O (fat) binary This object is also used for representing Mach-O binaries that are NOT FAT More...

#include <FatBinary.hpp>

Public Types

using binaries_t = std::vector<std::unique_ptr<Binary>>
 Internal containter used to store Binary objects within a Fat Mach-O.
 
using it_binaries = ref_iterator<binaries_t&, Binary*>
 Iterator that outputs Binary&.
 
using it_const_binaries = const_ref_iterator<const binaries_t&, Binary*>
 Iterator that outputs const Binary&.
 

Public Member Functions

 FatBinary (const FatBinary &)=delete
 
FatBinaryoperator= (const FatBinary &)=delete
 
virtual ~FatBinary ()
 
size_t size () const
 Number of MachO::Binary wrapped by this object.
 
bool empty () const
 Checks whether this object contains MachO::Binary.
 
it_binaries begin ()
 
it_const_binaries begin () const
 
it_binaries end ()
 
it_const_binaries end () const
 
void release_all_binaries ()
 
std::unique_ptr< Binarypop_back ()
 Get a pointer to the last MachO::Binary object presents in this Fat Binary. It returns a nullptr if no binary are present.
 
Binaryat (size_t index)
 Get a pointer to the MachO::Binary specified by the index. It returns a nullptr if the binary does not exist at the given index.
 
const Binaryat (size_t index) const
 
Binaryback ()
 
const Binaryback () const
 
Binaryfront ()
 
const Binaryfront () const
 
Binaryoperator[] (size_t index)
 
const Binaryoperator[] (size_t index) const
 
std::unique_ptr< Binarytake (size_t index)
 Extract a MachO::Binary object. Gives ownership to the caller, and remove it from this FatBinary object.
 
std::unique_ptr< Binarytake (Header::CPU_TYPE cpu)
 Take the underlying MachO::Binary that matches the given architecture If no binary with the architecture can be found, return a nullptr.
 
void write (const std::string &filename)
 Reconstruct the Fat binary object and write it in filename
 
std::vector< uint8_t > raw ()
 Reconstruct the Fat binary object and return his content as bytes.
 

Detailed Description

Class which represent a Mach-O (fat) binary This object is also used for representing Mach-O binaries that are NOT FAT

Member Typedef Documentation

◆ binaries_t

using LIEF::MachO::FatBinary::binaries_t = std::vector<std::unique_ptr<Binary>>

Internal containter used to store Binary objects within a Fat Mach-O.

◆ it_binaries

◆ it_const_binaries

Iterator that outputs const Binary&.

Constructor & Destructor Documentation

◆ FatBinary()

LIEF::MachO::FatBinary::FatBinary ( const FatBinary & )
delete

◆ ~FatBinary()

virtual LIEF::MachO::FatBinary::~FatBinary ( )
virtual

Member Function Documentation

◆ at() [1/2]

Binary * LIEF::MachO::FatBinary::at ( size_t index)

Get a pointer to the MachO::Binary specified by the index. It returns a nullptr if the binary does not exist at the given index.

◆ at() [2/2]

const Binary * LIEF::MachO::FatBinary::at ( size_t index) const

◆ back() [1/2]

Binary * LIEF::MachO::FatBinary::back ( )

◆ back() [2/2]

const Binary * LIEF::MachO::FatBinary::back ( ) const

◆ begin() [1/2]

it_binaries LIEF::MachO::FatBinary::begin ( )
inline

◆ begin() [2/2]

it_const_binaries LIEF::MachO::FatBinary::begin ( ) const
inline

◆ empty()

bool LIEF::MachO::FatBinary::empty ( ) const
inline

Checks whether this object contains MachO::Binary.

◆ end() [1/2]

it_binaries LIEF::MachO::FatBinary::end ( )
inline

◆ end() [2/2]

it_const_binaries LIEF::MachO::FatBinary::end ( ) const
inline

◆ front() [1/2]

Binary * LIEF::MachO::FatBinary::front ( )

◆ front() [2/2]

const Binary * LIEF::MachO::FatBinary::front ( ) const

◆ operator=()

FatBinary & LIEF::MachO::FatBinary::operator= ( const FatBinary & )
delete

◆ operator[]() [1/2]

Binary * LIEF::MachO::FatBinary::operator[] ( size_t index)
inline

◆ operator[]() [2/2]

const Binary * LIEF::MachO::FatBinary::operator[] ( size_t index) const
inline

◆ pop_back()

std::unique_ptr< Binary > LIEF::MachO::FatBinary::pop_back ( )

Get a pointer to the last MachO::Binary object presents in this Fat Binary. It returns a nullptr if no binary are present.

◆ raw()

std::vector< uint8_t > LIEF::MachO::FatBinary::raw ( )

Reconstruct the Fat binary object and return his content as bytes.

◆ release_all_binaries()

void LIEF::MachO::FatBinary::release_all_binaries ( )

◆ size()

size_t LIEF::MachO::FatBinary::size ( ) const
inline

Number of MachO::Binary wrapped by this object.

◆ take() [1/2]

std::unique_ptr< Binary > LIEF::MachO::FatBinary::take ( Header::CPU_TYPE cpu)

Take the underlying MachO::Binary that matches the given architecture If no binary with the architecture can be found, return a nullptr.

◆ take() [2/2]

std::unique_ptr< Binary > LIEF::MachO::FatBinary::take ( size_t index)

Extract a MachO::Binary object. Gives ownership to the caller, and remove it from this FatBinary object.

Warning
: this invalidates any previously hold iterator!

◆ write()

void LIEF::MachO::FatBinary::write ( const std::string & filename)

Reconstruct the Fat binary object and write it in filename

Parameters
filenamePath to write the reconstructed binary

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