File Coverage

blib/lib/ExtUtils/XSpp/Node/Enum.pm
Criterion Covered Total %
statement 16 18 88.8
branch n/a
condition n/a
subroutine 6 7 85.7
pod 4 4 100.0
total 26 29 89.6


line stmt bran cond sub pod time code
1             package ExtUtils::XSpp::Node::Enum;
2 21     21   113 use strict;
  21         39  
  21         658  
3 21     21   109 use warnings;
  21         43  
  21         571  
4 21     21   102 use base 'ExtUtils::XSpp::Node';
  21         48  
  21         554  
5              
6             =head1 NAME
7              
8             ExtUtils::XSpp::Node::Enum - Node representing an enum declaration
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 an C object with C
22             C and two L values in the
23             C 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.
36              
37             C gives the name of the enumeration, C for anonymous
38             enumerations. C should only contain
39             L or L
40             objects.
41              
42             =cut
43              
44             sub init {
45 3     3 1 7 my $this = shift;
46 3         14 my %args = @_;
47              
48 3         17 $this->{NAME} = $args{name};
49 3         9 $this->{ELEMENTS} = $args{elements};
50 3         19 $this->{CONDITION} = $args{condition};
51             }
52              
53             sub print {
54 0     0 1 0 my( $this, $state ) = @_;
55              
56             # no standard way of emitting an enum
57 0         0 ''
58             }
59              
60             =head1 ACCESSORS
61              
62             =head2 name
63              
64             Returns the name of the enumeration, or C for anonymous
65             enumerations.
66              
67             =head2 elements
68              
69             An array reference containing mostly
70             L (it can contain other kinds of
71             nodes).
72              
73             =cut
74              
75 3     3 1 33 sub name { $_[0]->{NAME} }
76 3     3 1 33 sub elements { $_[0]->{ELEMENTS} }
77              
78             1;