Class: MachO::LoadCommands::TwolevelHintsCommand::TwolevelHintsTable

Inherits:
Object
  • Object
show all
Defined in:
lib/macho/load_commands.rb

Overview

A representation of the two-level namespace lookup hints table exposed by a MachO::LoadCommands::TwolevelHintsCommand (LC_TWOLEVEL_HINTS).

Defined Under Namespace

Classes: TwolevelHint

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view, htoffset, nhints) ⇒ TwolevelHintsTable

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of TwolevelHintsTable.

Parameters:

  • view (MachO::MachOView)

    the view into the current Mach-O

  • htoffset (Integer)

    the offset of the hints table

  • nhints (Integer)

    the number of two-level hints in the table



1095
1096
1097
1098
1099
1100
1101
# File 'lib/macho/load_commands.rb', line 1095

def initialize(view, htoffset, nhints)
  format = Utils.specialize_format("L=#{nhints}", view.endianness)
  raw_table = view.raw_data[htoffset, nhints * 4]
  blobs = raw_table.unpack(format)

  @hints = blobs.map { |b| TwolevelHint.new(b) }
end

Instance Attribute Details

#hintsArray<TwolevelHint> (readonly)

Returns all hints in the table.

Returns:



1089
1090
1091
# File 'lib/macho/load_commands.rb', line 1089

def hints
  @hints
end