Class: Ole::Types::PropertySet
- Inherits:
-
Object
- Object
- Ole::Types::PropertySet
- Includes:
- Constants
- Defined in:
- lib/ole/property_set.rb
Overview
The PropertySet class currently supports readonly access to the properties serialized in “property set” streams, such as the file “005SummaryInformation”, in OLE files.
Think has its roots in MFC property set serialization.
See poi.apache.org/hpsf/internals.html for details
Defined Under Namespace
Modules: Constants Classes: Section
Constant Summary collapse
- HEADER_SIZE =
28
- HEADER_PACK =
"vvVa#{Clsid::SIZE}V"
- OS_MAP =
{ 0 => :win16, 1 => :mac, 2 => :win32, 0x20001 => :ooffice, # open office on linux... }
- DATA =
define a smattering of the property set guids. FMTID_SummaryInformation = Clsid.parse ‘f29f85e0-4ff9-1068-ab91-08002b27b3d9’ FMTID_DocSummaryInformation = Clsid.parse ‘d5cdd502-2e9c-101b-9397-08002b2cf9ae’ FMTID_UserDefinedProperties = Clsid.parse ‘d5cdd505-2e9c-101b-9397-08002b2cf9ae’
YAML.load_file(File.dirname(__FILE__) + '/../../data/propids.yaml'). inject({}) { |hash, (key, value)| hash.update Clsid.parse(key) => value }
Instance Attribute Summary collapse
-
#guid ⇒ Object
readonly
Returns the value of attribute guid.
-
#io ⇒ Object
readonly
Returns the value of attribute io.
-
#os ⇒ Object
readonly
Returns the value of attribute os.
-
#sections ⇒ Object
readonly
Returns the value of attribute sections.
-
#signature ⇒ Object
readonly
Returns the value of attribute signature.
-
#unknown ⇒ Object
readonly
Returns the value of attribute unknown.
Instance Method Summary collapse
-
#initialize(io) ⇒ PropertySet
constructor
A new instance of PropertySet.
- #load_header(str) ⇒ Object
- #load_section_list(str) ⇒ Object
Constructor Details
#initialize(io) ⇒ PropertySet
Returns a new instance of PropertySet.
108 109 110 111 112 113 114 |
# File 'lib/ole/property_set.rb', line 108 def initialize io @io = io load_header io.read(HEADER_SIZE) load_section_list io.read(@num_sections * Section::SIZE) # expect no gap between last section and start of data. #Log.warn "gap between section list and property data" unless io.pos == @sections.map(&:offset).min end |
Instance Attribute Details
#guid ⇒ Object (readonly)
Returns the value of attribute guid.
107 108 109 |
# File 'lib/ole/property_set.rb', line 107 def guid @guid end |
#io ⇒ Object (readonly)
Returns the value of attribute io.
107 108 109 |
# File 'lib/ole/property_set.rb', line 107 def io @io end |
#os ⇒ Object (readonly)
Returns the value of attribute os.
107 108 109 |
# File 'lib/ole/property_set.rb', line 107 def os @os end |
#sections ⇒ Object (readonly)
Returns the value of attribute sections.
107 108 109 |
# File 'lib/ole/property_set.rb', line 107 def sections @sections end |
#signature ⇒ Object (readonly)
Returns the value of attribute signature.
107 108 109 |
# File 'lib/ole/property_set.rb', line 107 def signature @signature end |
#unknown ⇒ Object (readonly)
Returns the value of attribute unknown.
107 108 109 |
# File 'lib/ole/property_set.rb', line 107 def unknown @unknown end |
Instance Method Details
#load_header(str) ⇒ Object
116 117 118 119 120 121 |
# File 'lib/ole/property_set.rb', line 116 def load_header str @signature, @unknown, @os_id, @guid, @num_sections = str.unpack HEADER_PACK # should i check that unknown == 0? it usually is. so is the guid actually @guid = Clsid.load @guid @os = OS_MAP[@os_id] || Log.warn("unknown operating system id #{@os_id}") end |