LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
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
 
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 Function Documentation

◆ take()

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: