blib/lib/ExtUtils/XSpp/Node/Enum.pm

filter: Statementstmt 89.4% 17 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 100% 4 / 4 totaltotal 90.0% 27 / 30 CC 1 SCAR 1.3
CC
1
Cov
89%
print
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« blib/lib/ExtUtils/XSpp/Typemap/wrapper.pm ↑ Summary blib/lib/ExtUtils/XSpp/Plugin/feature/default_xs_typemap.pm »
1 package ExtUtils::XSpp::Node::Enum;
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::Enum - Node representing an enum declaration
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 an C<ExtUtils::XSpp::Node::Enum> object with C<name>
22 C<Bool> and two L<ExtUtils::XSpp::Node::EnumValue> values in the
23 C<arguments> array.
24  
25 Enumerations do not affect the generated code.
26  
27 =head1 METHODS
28  
29 =head2 new
30  
31 my $e = ExtUtils::XSpp::Node::Enum->new( name => 'Bool',
32 elements => [ ... ],
33 );
34  
35 Creates a new C<ExtUtils::XSpp::Node::Enum>.
36  
37 C<name> gives the name of the enumeration, C<undef> for anonymous
38 enumerations. C<elements> should only contain
39 L<ExtUtils::XSpp::Node::EnumValue> or L<ExtUtils::XSpp::Node::Raw>
40 objects.
41  
42 =cut
43  
44 3 ▶sub init {
Subroutine init: called CC=1 SCAR=0.0
Pod documented
45 3 my $this = shift;
46 3 my %args = @_;
47  
48 3 $this->{NAME} = $args{name};
49 3 $this->{ELEMENTS} = $args{elements};
50 3 $this->{CONDITION} = $args{condition};
51 }
52  
53 0 ▶sub print {
Subroutine print: not called CC=1 SCAR=6.9
Pod documented
54 0 my( $this, $state ) = @_;
55  
56 # no standard way of emitting an enum
57 0 ''
58 }
59  
60 =head1 ACCESSORS
61  
62 =head2 name
63  
64 Returns the name of the enumeration, or C<undef> for anonymous
65 enumerations.
66  
67 =head2 elements
68  
69 An array reference containing mostly
70 L<ExtUtils::XSpp::Node::EnumValue> (it can contain other kinds of
71 nodes).
72  
73 =cut
74  
75 3 ▶sub name { $_[0]->{NAME} }
Subroutine name: called CC=1 SCAR=0.0
Pod documented
76 3 ▶sub elements { $_[0]->{ELEMENTS} }
Subroutine elements: called CC=1 SCAR=0.0
Pod documented
77  
78 21 1;
« blib/lib/ExtUtils/XSpp/Typemap/wrapper.pm ↑ Summary blib/lib/ExtUtils/XSpp/Plugin/feature/default_xs_typemap.pm »