| 1 | package ExtUtils::XSpp::Node::EnumValue; | ||
| 2 | 21 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 21 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 21 | ▶ | use base 'ExtUtils::XSpp::Node'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | ExtUtils::XSpp::Node::EnumValue - Node representing an enum element | ||
| 9 | |||
| 10 | =head1 DESCRIPTION | ||
| 11 | |||
| 12 | An L<ExtUtils::XSpp::Node> subclass representing an C<enum> declaration. | ||
| 13 | As an example | ||
| 14 | |||
| 15 | enum Bool | ||
| 16 | { | ||
| 17 | FALSE = 0, | ||
| 18 | TRUE | ||
| 19 | }; | ||
| 20 | |||
| 21 | Will create two C<ExtUtils::XSpp::Node::EnumValue> objects, the first | ||
| 22 | with C<name> C<FALSE> and C<value> C<0>, the second with C<name> | ||
| 23 | C<TRUE> 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<ExtUtils::XSpp::Node::EnumValue>. | ||
| 36 | |||
| 37 | C<value> is optional. | ||
| 38 | |||
| 39 | =cut | ||
| 40 | |||
| 41 | 8 | ▶ | sub init { |
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
documented
| |||
| 42 | 8 | my $this = shift; | |
| 43 | 8 | my %args = @_; | |
| 44 | |||
| 45 | 8 | $this->{NAME} = $args{name}; | |
| 46 | 8 | $this->{VALUE} = $args{value}; | |
| 47 | 8 | $this->{CONDITION} = $args{condition}; | |
| 48 | } | ||
| 49 | |||
| 50 | 0 | ▶ | sub print { |
|
Subroutine
print: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 51 | 0 | my( $this, $state ) = @_; | |
| 52 | |||
| 53 | # no standard way of emitting an enum value | ||
| 54 | 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<undef>. | ||
| 66 | |||
| 67 | =cut | ||
| 68 | |||
| 69 | 8 | ▶ | sub name { $_[0]->{NAME} } |
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
documented
| |||
| 70 | 0 | ▶ | sub value { $_[0]->{VALUE} } |
|
Subroutine
value: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 71 | |||
| 72 | 21 | 1; | |