line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Thrift::Parser::Types; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Thrift::Parser::Types - stores some common type ids |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
This is not documented, as it's behavior will probably change as more type data is incorporated into this from the L libraries. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
6
|
|
|
6
|
|
34
|
use strict; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
254
|
|
14
|
6
|
|
|
6
|
|
31
|
use warnings; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
201
|
|
15
|
6
|
|
|
6
|
|
40
|
use Data::Dumper; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
279
|
|
16
|
|
|
|
|
|
|
|
17
|
6
|
|
|
6
|
|
4033
|
use Thrift::Parser::Type; |
|
6
|
|
|
|
|
20
|
|
|
6
|
|
|
|
|
54
|
|
18
|
|
|
|
|
|
|
|
19
|
6
|
|
|
6
|
|
4481
|
use Thrift::Parser::Type::Struct; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
59
|
|
20
|
6
|
|
|
6
|
|
4213
|
use Thrift::Parser::Type::Exception; |
|
6
|
|
|
|
|
18
|
|
|
6
|
|
|
|
|
65
|
|
21
|
|
|
|
|
|
|
|
22
|
6
|
|
|
6
|
|
4165
|
use Thrift::Parser::Type::Enum; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
70
|
|
23
|
|
|
|
|
|
|
|
24
|
6
|
|
|
6
|
|
4439
|
use Thrift::Parser::Type::Container; |
|
6
|
|
|
|
|
19
|
|
|
6
|
|
|
|
|
68
|
|
25
|
6
|
|
|
6
|
|
4009
|
use Thrift::Parser::Type::list; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
65
|
|
26
|
6
|
|
|
6
|
|
3552
|
use Thrift::Parser::Type::map; |
|
6
|
|
|
|
|
16
|
|
|
6
|
|
|
|
|
60
|
|
27
|
6
|
|
|
6
|
|
3851
|
use Thrift::Parser::Type::set; |
|
6
|
|
|
|
|
19
|
|
|
6
|
|
|
|
|
75
|
|
28
|
|
|
|
|
|
|
|
29
|
6
|
|
|
6
|
|
4225
|
use Thrift::Parser::Type::Number; |
|
6
|
|
|
|
|
19
|
|
|
6
|
|
|
|
|
64
|
|
30
|
6
|
|
|
6
|
|
3798
|
use Thrift::Parser::Type::byte; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
63
|
|
31
|
6
|
|
|
6
|
|
3666
|
use Thrift::Parser::Type::i16; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
62
|
|
32
|
6
|
|
|
6
|
|
3729
|
use Thrift::Parser::Type::i32; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
60
|
|
33
|
6
|
|
|
6
|
|
3630
|
use Thrift::Parser::Type::i64; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
78
|
|
34
|
6
|
|
|
6
|
|
4097
|
use Thrift::Parser::Type::double; |
|
6
|
|
|
|
|
16
|
|
|
6
|
|
|
|
|
69
|
|
35
|
|
|
|
|
|
|
|
36
|
6
|
|
|
6
|
|
4833
|
use Thrift::Parser::Type::string; |
|
6
|
|
|
|
|
21
|
|
|
6
|
|
|
|
|
171
|
|
37
|
6
|
|
|
6
|
|
3732
|
use Thrift::Parser::Type::binary; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
66
|
|
38
|
6
|
|
|
6
|
|
3556
|
use Thrift::Parser::Type::bool; |
|
6
|
|
|
|
|
24
|
|
|
6
|
|
|
|
|
92
|
|
39
|
6
|
|
|
6
|
|
4126
|
use Thrift::Parser::Type::void; |
|
6
|
|
|
|
|
18
|
|
|
6
|
|
|
|
|
104
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my %types = ( |
42
|
|
|
|
|
|
|
STOP => 0, |
43
|
|
|
|
|
|
|
VOID => 1, |
44
|
|
|
|
|
|
|
BOOL => 2, |
45
|
|
|
|
|
|
|
BYTE => 3, |
46
|
|
|
|
|
|
|
I08 => 3, |
47
|
|
|
|
|
|
|
DOUBLE => 4, |
48
|
|
|
|
|
|
|
I16 => 6, |
49
|
|
|
|
|
|
|
I32 => 8, |
50
|
|
|
|
|
|
|
I64 => 10, |
51
|
|
|
|
|
|
|
STRING => 11, |
52
|
|
|
|
|
|
|
UTF7 => 11, |
53
|
|
|
|
|
|
|
STRUCT => 12, |
54
|
|
|
|
|
|
|
EXCEPTION => 12, |
55
|
|
|
|
|
|
|
MAP => 13, |
56
|
|
|
|
|
|
|
SET => 14, |
57
|
|
|
|
|
|
|
LIST => 15, |
58
|
|
|
|
|
|
|
UTF8 => 16, |
59
|
|
|
|
|
|
|
UTF16 => 17, |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
my %types_by_id = (reverse %types); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub to_name { |
64
|
4
|
|
|
4
|
0
|
9
|
my ($class, $id) = @_; |
65
|
4
|
|
|
|
|
17
|
return $types_by_id{$id}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub to_id { |
69
|
47
|
|
|
47
|
0
|
84
|
my ($class, $name) = @_; |
70
|
47
|
|
|
|
|
210
|
return $types{uc $name}; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub read_method { |
74
|
2
|
|
|
2
|
0
|
5
|
my ($class, $id) = @_; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# Grab the name with proper case ('String') |
77
|
2
|
|
|
|
|
8
|
my $name = lc $class->to_name($id); |
78
|
2
|
|
|
|
|
21
|
$name =~ s{^(.+)$}{\u$1}; |
79
|
|
|
|
|
|
|
|
80
|
2
|
|
|
|
|
9
|
return 'read' . $name; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub write_method { |
84
|
2
|
|
|
2
|
0
|
4
|
my ($class, $id) = @_; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# Grab the name with proper case ('String') |
87
|
2
|
|
|
|
|
7
|
my $name = lc $class->to_name($id); |
88
|
2
|
|
|
|
|
20
|
$name =~ s{^(.+)$}{\u$1}; |
89
|
|
|
|
|
|
|
|
90
|
2
|
|
|
|
|
9
|
return 'write' . $name; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 COPYRIGHT |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Copyright (c) 2009 Eric Waters and XMission LLC (http://www.xmission.com/). All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
The full text of the license can be found in the LICENSE file included with this module. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 AUTHOR |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Eric Waters |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
1; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
1; |