line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Thrift::IDL::Struct; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Thrift::IDL::Struct |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Inherits from L |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
6
|
|
|
6
|
|
40
|
use strict; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
200
|
|
14
|
6
|
|
|
6
|
|
36
|
use warnings; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
160
|
|
15
|
6
|
|
|
6
|
|
27
|
use base qw(Thrift::IDL::Definition); |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
2471
|
|
16
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw(name children)); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 METHODS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head2 name |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head2 children |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Scalar accessors |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head2 fields |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Returns array ref of L children |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 field_named ($name) |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 field_id ($id) |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Returns object found in fields array with given key value |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub to_str { |
39
|
28
|
|
|
|
|
923
|
return $_[0]->name . ' (' |
40
|
8
|
|
|
8
|
0
|
29
|
. join (', ', map { '' . $_ } @{ $_[0]->fields }) |
|
8
|
|
|
|
|
102
|
|
41
|
|
|
|
|
|
|
. ')'; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub fields { |
45
|
15
|
|
|
15
|
1
|
561
|
my $self = shift; |
46
|
15
|
|
|
|
|
78
|
$self->children_of_type('Thrift::IDL::Field'); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub field_named { |
50
|
5
|
|
|
5
|
1
|
29
|
my ($self, $name) = @_; |
51
|
5
|
|
|
|
|
28
|
$self->array_search($name, 'fields', 'name'); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub field_id { |
55
|
1
|
|
|
1
|
1
|
9
|
my ($self, $name) = @_; |
56
|
1
|
|
|
|
|
9
|
$self->array_search($name, 'fields', 'id'); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub setup { |
60
|
9
|
|
|
9
|
1
|
461
|
my $self = shift; |
61
|
9
|
|
|
|
|
94
|
$self->_setup('children'); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |