Class: Mapi::Pst::NodePtr

Inherits:
Struct
  • Object
show all
Includes:
Module.new
Defined in:
lib/mapi/pst.rb

Overview

pst_desc idx_id is a pointer to an idx record which gets the primary data stream for the Desc record. idx2_id gets you an idx record, that when read gives you an ID2 association list, which just maps another set of ids to index values

Constant Summary collapse

UNPACK_STR32 =
'V4'
UNPACK_STR64 =
'T3V'
SIZE32 =
16
SIZE64 =
32
BLOCK_SIZE =

descriptor blocks was 520 but bogus

512
COUNT_MAX64 =
15
COUNT_MAX32 =

max active desc records (ITEM_COUNT_OFFSET / Desc::SIZE = 31)

31

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, is64) ⇒ NodePtr

Returns a new instance of NodePtr.

Parameters:

  • data (String)
  • is64 (Boolean)


476
477
478
479
# File 'lib/mapi/pst.rb', line 476

def initialize data, is64
	super(*Pst.unpack(data, is64 ? UNPACK_STR64 : UNPACK_STR32))
	@children = []
end

Instance Attribute Details

#block_idObject

Returns the value of attribute block_id

Returns:

  • (Object)

    the current value of block_id



457
458
459
# File 'lib/mapi/pst.rb', line 457

def block_id
  @block_id
end

#childrenArray (readonly)

Returns:

  • (Array)


472
473
474
# File 'lib/mapi/pst.rb', line 472

def children
  @children
end

#node_idObject

Returns the value of attribute node_id

Returns:

  • (Object)

    the current value of node_id



457
458
459
# File 'lib/mapi/pst.rb', line 457

def node_id
  @node_id
end

#parent_node_idObject

Returns the value of attribute parent_node_id

Returns:

  • (Object)

    the current value of parent_node_id



457
458
459
# File 'lib/mapi/pst.rb', line 457

def parent_node_id
  @parent_node_id
end

#pstPst

Returns:



469
470
471
# File 'lib/mapi/pst.rb', line 469

def pst
  @pst
end

#sub_block_idObject

Returns the value of attribute sub_block_id

Returns:

  • (Object)

    the current value of sub_block_id



457
458
459
# File 'lib/mapi/pst.rb', line 457

def sub_block_id
  @sub_block_id
end

Instance Method Details

#blockBlockPtr

Returns:



482
483
484
485
# File 'lib/mapi/pst.rb', line 482

def block
	raise "DO NOT USE"
	pst.block_from_id block_id
end

#get_local_node_listArray<String>

Returns:

  • (Array<String>)


515
516
517
518
519
# File 'lib/mapi/pst.rb', line 515

def get_local_node_list
	list = []
	pst.get_local_node_list_to node_id, list
	list
end

#has_sub(local_node_id) ⇒ Boolean

Check if there is a sub data exists, where it is identified by its local id

Parameters:

  • local_node_id (Integer)

Returns:

  • (Boolean)


525
526
527
528
# File 'lib/mapi/pst.rb', line 525

def has_sub local_node_id
	#TODO fixme
	read_sub_array(local_node_id).length != 0
end

#inspectObject

show all numbers in hex



531
532
533
# File 'lib/mapi/pst.rb', line 531

def inspect
	super.gsub(/=(\d+)/) { '=0x%x' % $1.to_i }
end

#read_main_arrayArray<String>

Read node data

Returns:

  • (Array<String>)


496
497
498
499
500
501
502
# File 'lib/mapi/pst.rb', line 496

def read_main_array
	@read_main ||= begin
		list = []
		pst.load_node_main_data_to node_id, list
		list
	end
end

#read_sub_array(local_node_id) ⇒ Array<String>

Locate and read node sub data by its local id

Parameters:

  • local_node_id (Integer)

Returns:

  • (Array<String>)


508
509
510
511
512
# File 'lib/mapi/pst.rb', line 508

def read_sub_array local_node_id
	list = []
	pst.load_node_sub_data_to node_id, local_node_id, list
	list
end

#sub_blockBlockPtr

Returns:



488
489
490
491
# File 'lib/mapi/pst.rb', line 488

def sub_block
	raise "DO NOT USE"
	pst.block_from_id sub_block_id
end