Class: Mapi::Pst::RawPropertyStoreTable::Row

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/mapi/pst.rb

Instance Method Summary collapse

Constructor Details

#initialize(array_parser, index) ⇒ Row



1507
1508
1509
1510
1511
# File 'lib/mapi/pst.rb', line 1507

def initialize array_parser, index
  @array_parser = array_parser
  @index = index
  @data = @array_parser.get_record(index)
end

Instance Method Details

#each {|key, type, value| ... } ⇒ Object

iterate through the property tuples

Yields:

  • (key, type, value)

Yield Parameters:

  • key (Integer)
  • type (Integer)
  • value (Object)


1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
# File 'lib/mapi/pst.rb', line 1519

def each
  (@array_parser.index_data.length / 8).times do |i|
    ref_type, type, ind2_off, size, slot = @array_parser.index_data[8 * i, 8].unpack 'v3CC'
    # check this rescue too
    value = @data[ind2_off, size]
#         if INDIRECT_TYPES.include? ref_type
    if size <= 4
      value = value.unpack('V')[0]
    end
    #p ['0x%04x' % ref_type, '0x%04x' % type, (Msg::Properties::MAPITAGS['%04x' % type].first[/^.._(.*)/, 1].downcase rescue nil),
    #   value_orig, value, (get_data_indirect(value_orig.unpack('V')[0]) rescue nil), size, ind2_off, slot]
    key, type, value = @array_parser.handle_indirect_values type, ref_type, value
    yield key, type, value
  end
end