line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::YaTeA::MessageSet; |
2
|
5
|
|
|
5
|
|
35
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
144
|
|
3
|
5
|
|
|
5
|
|
27
|
use warnings; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
116
|
|
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
1948
|
use Lingua::YaTeA::Message; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
55
|
|
6
|
5
|
|
|
5
|
|
123
|
use Data::Dumper; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
2053
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION=$Lingua::YaTeA::VERSION; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new |
11
|
|
|
|
|
|
|
{ |
12
|
4
|
|
|
4
|
1
|
16
|
my ($class,$file,$language) = @_; |
13
|
4
|
|
|
|
|
9
|
my $this = {}; |
14
|
4
|
|
|
|
|
10
|
bless ($this,$class); |
15
|
4
|
|
|
|
|
37
|
$this->{MESSAGES} = {}; |
16
|
4
|
|
|
|
|
20
|
$this->loadMessages($file,$language); |
17
|
4
|
|
|
|
|
191
|
return $this; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub loadMessages |
21
|
|
|
|
|
|
|
{ |
22
|
4
|
|
|
4
|
1
|
12
|
my ($this,$file,$language) = @_; |
23
|
4
|
|
|
|
|
12
|
my $path = $file->getPath; |
24
|
4
|
|
|
|
|
35
|
my $fh = FileHandle->new("<$path"); |
25
|
4
|
|
|
|
|
360
|
my $line; |
26
|
4
|
|
|
|
|
12
|
my $line_counter = 0; |
27
|
4
|
|
|
|
|
12
|
my $message; |
28
|
|
|
|
|
|
|
my $option; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
4
|
|
|
|
|
135
|
while ($line= $fh->getline) |
32
|
|
|
|
|
|
|
{ |
33
|
312
|
|
|
|
|
7431
|
$line_counter++; |
34
|
312
|
100
|
|
|
|
1141
|
if ($line =~ /^([^\s]+) = \"(.+)\"\s*$/) |
35
|
|
|
|
|
|
|
{ |
36
|
300
|
|
|
|
|
788
|
$message = Lingua::YaTeA::Message->new($1,$2,$language); |
37
|
300
|
|
|
|
|
647
|
$this->addMessage($message); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
else |
40
|
|
|
|
|
|
|
{ |
41
|
12
|
50
|
|
|
|
225
|
if($line !~ /^\s*$/) |
42
|
|
|
|
|
|
|
{ |
43
|
0
|
|
|
|
|
0
|
die "ill-formed message in file:" .$file->getPath . " line " . $line_counter . "\n"; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub addMessage |
50
|
|
|
|
|
|
|
{ |
51
|
300
|
|
|
300
|
1
|
537
|
my ($this,$message) = @_; |
52
|
300
|
|
|
|
|
615
|
$this->{MESSAGES}->{$message->getName} = $message; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub getMessage |
57
|
|
|
|
|
|
|
{ |
58
|
55
|
|
|
55
|
1
|
197
|
my ($this,$name) = @_; |
59
|
55
|
|
|
|
|
170
|
return $this->getMessages->{$name}; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub getMessages |
63
|
|
|
|
|
|
|
{ |
64
|
55
|
|
|
55
|
1
|
142
|
my ($this) = @_; |
65
|
55
|
|
|
|
|
398
|
return $this->{MESSAGES}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
1; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
__END__ |