line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ExtUtils::XSpp::Node::EnumValue; |
2
|
21
|
|
|
21
|
|
112
|
use strict; |
|
21
|
|
|
|
|
43
|
|
|
21
|
|
|
|
|
687
|
|
3
|
21
|
|
|
21
|
|
118
|
use warnings; |
|
21
|
|
|
|
|
38
|
|
|
21
|
|
|
|
|
614
|
|
4
|
21
|
|
|
21
|
|
104
|
use base 'ExtUtils::XSpp::Node'; |
|
21
|
|
|
|
|
39
|
|
|
21
|
|
|
|
|
735
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
ExtUtils::XSpp::Node::EnumValue - Node representing an enum element |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 DESCRIPTION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
An L subclass representing an C declaration. |
13
|
|
|
|
|
|
|
As an example |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
enum Bool |
16
|
|
|
|
|
|
|
{ |
17
|
|
|
|
|
|
|
FALSE = 0, |
18
|
|
|
|
|
|
|
TRUE |
19
|
|
|
|
|
|
|
}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Will create two C objects, the first |
22
|
|
|
|
|
|
|
with C C and C C<0>, the second with C |
23
|
|
|
|
|
|
|
C and no value. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Enumerations do not affect the generated code. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 METHODS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 new |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $e = ExtUtils::XSpp::Node::EnumValue->new( name => 'FALSE', |
32
|
|
|
|
|
|
|
value => '0x1 | 0x4', |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Creates a new C. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
C is optional. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub init { |
42
|
8
|
|
|
8
|
1
|
13
|
my $this = shift; |
43
|
8
|
|
|
|
|
99
|
my %args = @_; |
44
|
|
|
|
|
|
|
|
45
|
8
|
|
|
|
|
31
|
$this->{NAME} = $args{name}; |
46
|
8
|
|
|
|
|
18
|
$this->{VALUE} = $args{value}; |
47
|
8
|
|
|
|
|
26
|
$this->{CONDITION} = $args{condition}; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub print { |
51
|
0
|
|
|
0
|
1
|
0
|
my( $this, $state ) = @_; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# no standard way of emitting an enum value |
54
|
0
|
|
|
|
|
0
|
'' |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 ACCESSORS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 name |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Returns the name of the enumeration element. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 value |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Returns the initializer of the enumeration element, or C. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
8
|
|
|
8
|
1
|
65
|
sub name { $_[0]->{NAME} } |
70
|
0
|
|
|
0
|
1
|
|
sub value { $_[0]->{VALUE} } |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |