1 |
#
|
2 |
# IncFile.pm
|
3 |
#
|
4 |
# Originally Written by Christopher Williams
|
5 |
#
|
6 |
# Description
|
7 |
# -----------
|
8 |
# Private Class for the PreProcessedFile
|
9 |
#
|
10 |
# Interface
|
11 |
# ---------
|
12 |
# new() : A new IncFile object
|
13 |
# startline() : return the line in the original file of the included file
|
14 |
# endline() : return the last line in the original file of the included file
|
15 |
# lines() : return the number of lines in the included file
|
16 |
# file() : return the ProcessedFileobject ObjectStore lookup ID
|
17 |
# init(ProcessedFile_ID, startline, endline,lines, sequencenumber)
|
18 |
# : setup the vars
|
19 |
# lastsequence() : retunr the sequence number
|
20 |
# store(fh) :
|
21 |
# restore(fh) :
|
22 |
|
23 |
package IncFile;
|
24 |
require 5.004;
|
25 |
|
26 |
sub new {
|
27 |
my $class=shift;
|
28 |
$self={};
|
29 |
bless $self, $class;
|
30 |
$self->{ObjectStore}=shift;
|
31 |
return $self;
|
32 |
}
|
33 |
|
34 |
sub startline {
|
35 |
my $self=shift;
|
36 |
return $self->{start};
|
37 |
}
|
38 |
sub endline {
|
39 |
my $self=shift;
|
40 |
return $self->{end};
|
41 |
}
|
42 |
sub lines {
|
43 |
my $self=shift;
|
44 |
return $self->{lines};
|
45 |
}
|
46 |
|
47 |
sub lastsequence {
|
48 |
my $self=shift;
|
49 |
return $self->{sn};
|
50 |
}
|
51 |
|
52 |
sub file {
|
53 |
my $self=shift;
|
54 |
return $self->{fileid};
|
55 |
}
|
56 |
|
57 |
sub init {
|
58 |
my $self=shift;
|
59 |
$self->{fileid}=shift;
|
60 |
$self->{start}=shift;
|
61 |
$self->{end}=shift;
|
62 |
$self->{lines}=shift;
|
63 |
$self->{sn}=shift;
|
64 |
}
|
65 |
|
66 |
sub store {
|
67 |
my $self=shift;
|
68 |
my $fh=shift;
|
69 |
print $fh $self->{start}."\n";
|
70 |
print $fh $self->{end}."\n";
|
71 |
print $fh $self->{lines}."\n";
|
72 |
print $fh $self->{fileid}."\n";
|
73 |
print $fh $self->{sn}."\n";
|
74 |
print $fh "\n";
|
75 |
|
76 |
}
|
77 |
|
78 |
sub restore {
|
79 |
my $self=shift;
|
80 |
my $fh=shift;
|
81 |
$self->{start}=<$fh>;
|
82 |
chomp $self->{start};
|
83 |
$self->{end}=<$fh>;
|
84 |
chomp $self->{end};
|
85 |
$self->{lines}=<$fh>;
|
86 |
chomp $self->{lines};
|
87 |
$self->{fileid}=<$fh>;
|
88 |
chomp $self->{fileid};
|
89 |
$self->{sn}=<$fh>;
|
90 |
chomp $self->{sn};
|
91 |
}
|