| 1 | package Finnigan::OLE2Header; | ||
| 2 | |||
| 3 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use warnings FATAL => qw( all ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 2 | our $VERSION = 0.0206; | |
| 6 | |||
| 7 | 2 | ▶ | use Finnigan; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 2 | ▶ | use base 'Finnigan::Decoder'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 2 | ▶ | use overload ('""' => 'stringify'); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | 1 | ▶ | sub decode { |
|
Subroutine
decode: called CC=1 SCAR=0.0
Pod
documented
| |||
| 13 | 1 | my ($class, $stream, $version) = @_; | |
| 14 | |||
| 15 | 1 | my @fields = ( | |
| 16 | "guid" => ['a16', 'RawBytes'], # used by some apps | ||
| 17 | "minor version" => ['v', 'UInt16'], | ||
| 18 | "major version" => ['v', 'UInt16'], | ||
| 19 | "endian" => ['a2', 'RawBytes'], # 0xFFFE for Intel | ||
| 20 | "bb log" => ['v', 'UInt16'], # log2-size of big blocks | ||
| 21 | "sb log" => ['v', 'UInt16'], # log2-size of small blocks (minisectors) | ||
| 22 | "reserved" => ['a6', 'RawBytes'], | ||
| 23 | "csectdir" => ['V', 'UInt32'], # Number of sector pointers in directory chain (sector size 4 kb) | ||
| 24 | "bb count" => ['V', 'UInt32'], # number of blocks in Big Block Depot (number of SECTs in the FAT chain) | ||
| 25 | "bb start" => ['V', 'UInt32'], # the first block in Big Block Depot (first SECT in the Directory chain) | ||
| 26 | "transaction" => ['a4', 'RawBytes'], # transaction signature | ||
| 27 | "ministream max" => ['V', 'UInt32'], # max. size of a ministream (4096) | ||
| 28 | "sb start" => ['V', 'UInt32'], # the first block in Small Block Depot (first SECT in the mini-FAT chain) | ||
| 29 | "sb count" => ['V', 'UInt32'], # number of blocks in Small Block Depot (number of SECTs in the mini-FAT chain) | ||
| 30 | "dif start" => ['V', 'UInt32'], # the first SECT in the DIF chain (should be 0xfffffffe if the file is smaller than 7Mb) | ||
| 31 | "dif count" => ['V', 'UInt32'], # number of SECTs in the DIF chain (should be 0 if the file is smaller than 7Mb) | ||
| 32 | ); | ||
| 33 | |||
| 34 | 1 | my $self = Finnigan::Decoder->read($stream, \@fields, $version); | |
| 35 | 1 | return bless $self, $class; | |
| 36 | } | ||
| 37 | |||
| 38 | 1 | ▶ | sub stringify { |
|
Subroutine
stringify: called CC=1 SCAR=0.0
Pod
documented
| |||
| 39 | 1 | my $self = shift; | |
| 40 | |||
| 41 | 1 | my $version = $self->{data}->{"major version"}->{value} . "." . $self->{data}->{"minor version"}->{value}; | |
| 42 | 1 | my $fat_blocks = $self->bb_count; | |
| 43 | 1 | my $minifat_blocks = $self->sb_count; | |
| 44 | 1 | my $dif_blocks = $self->dif_count; | |
| 45 | 1 | return "Version $version; block(s) in FAT chain: $fat_blocks; in mini-FAT chain: $minifat_blocks; in DIF chain: $dif_blocks"; | |
| 46 | } | ||
| 47 | |||
| 48 | 3 | ▶ | sub ministream_max { |
|
Subroutine
ministream_max: called CC=1 SCAR=0.0
Pod
documented
| |||
| 49 | 3 | shift->{data}->{"ministream max"}->{value}; | |
| 50 | } | ||
| 51 | |||
| 52 | 6 | ▶ | sub bb_log { |
|
Subroutine
bb_log: called CC=1 SCAR=0.0
Pod
documented
| |||
| 53 | 6 | shift->{data}->{"bb log"}->{value}; | |
| 54 | } | ||
| 55 | |||
| 56 | 1 | ▶ | sub sb_log { |
|
Subroutine
sb_log: called CC=1 SCAR=0.0
Pod
documented
| |||
| 57 | 1 | shift->{data}->{"sb log"}->{value}; | |
| 58 | } | ||
| 59 | |||
| 60 | 1 | ▶ | sub bb_start { |
|
Subroutine
bb_start: called CC=1 SCAR=0.0
Pod
documented
| |||
| 61 | 1 | shift->{data}->{"bb start"}->{value}; | |
| 62 | } | ||
| 63 | |||
| 64 | 2 | ▶ | sub bb_count { |
|
Subroutine
bb_count: called CC=1 SCAR=0.0
Pod
documented
| |||
| 65 | 2 | shift->{data}->{"bb count"}->{value}; | |
| 66 | } | ||
| 67 | |||
| 68 | 1 | ▶ | sub sb_start { |
|
Subroutine
sb_start: called CC=1 SCAR=0.0
Pod
documented
| |||
| 69 | 1 | shift->{data}->{"sb start"}->{value}; | |
| 70 | } | ||
| 71 | |||
| 72 | 1 | ▶ | sub sb_count { |
|
Subroutine
sb_count: called CC=1 SCAR=0.0
Pod
documented
| |||
| 73 | 1 | shift->{data}->{"sb count"}->{value}; | |
| 74 | } | ||
| 75 | |||
| 76 | 1 | ▶ | sub dif_start { |
|
Subroutine
dif_start: called CC=1 SCAR=0.0
Pod
documented
| |||
| 77 | 1 | shift->{data}->{"dif start"}->{value}; | |
| 78 | } | ||
| 79 | |||
| 80 | 2 | ▶ | sub dif_count { |
|
Subroutine
dif_count: called CC=1 SCAR=0.0
Pod
documented
| |||
| 81 | 2 | shift->{data}->{"dif count"}->{value}; | |
| 82 | } | ||
| 83 | |||
| 84 | 2 | 1; | |
| 85 | __END__ | ||