Class Ole::Storage::Dirent
In: lib/ole/storage/base.rb
Parent: Struct.new( :name_utf16, :name_len, :type_id, :colour, :prev, :next, :child, :clsid, :flags,

A class which wraps an ole directory entry. Can be either a directory (Dirent#dir?) or a file (Dirent#file?)

Most interaction with Ole::Storage is through this class. The 2 most important functions are Dirent#children, and Dirent#data.

was considering separate classes for dirs and files. some methods/attrs only applicable to one or the other.

As with the other classes, to_s performs the serialization.

Methods

/   <<   []   children=   copy   delete   dir?   each_child   file?   flatten   flatten_helper   inspect   name=   new   open   read   time   to_s  

Included Modules

RecursivelyEnumerable

Constants

PACK = 'a64 v C C V3 a16 V a8 a8 V2 a4'
SIZE = 128
TYPE_MAP = { # this is temporary 0 => :empty, 1 => :dir, 2 => :file, 5 => :root
COLOUR_MAP = { 0 => :red, 1 => :black   something to do with the fact that the tree is supposed to be red-black
EOT = 0xffffffff   used in the next / prev / child stuff to show that the tree ends here. also used for first_block for directory.
DEFAULT = [ 0.chr * 2, 2, 0, # will get overwritten 1, EOT, EOT, EOT, 0.chr * 16, 0, nil, nil, AllocationTable::EOC, 0, 0.chr * 4

Attributes

children  [R]  This returns all the children of this Dirent. It is filled in when the tree structure is recreated.
create_time  [R] 
idx  [RW]  i think its just used by the tree building
modify_time  [R] 
name  [R] 
name_lookup  [R]  these are for internal use and are used for faster lookup.
ole  [R] 
parent  [R] 
parent  [W] 
type  [R] 

Public Class methods

i think making the tree structure optimized is actually more complex than this, and requires some intelligent ordering of the children based on names, but as long as it is valid its ok. actually, i think its ok. gsf for example only outputs a singly-linked-list, where prev is always EOT.

Public Instance methods

maybe need some options regarding case sensitivity.

remove the Dirent child from the children array, truncating the data by default.

flattens the tree starting from here into dirents. note it modifies its argument.

move to ruby-msg. and remove from here

[Validate]