package ExtUtils::XSpp::Node::Enum; use strict; use warnings; use base 'ExtUtils::XSpp::Node'; =head1 NAME ExtUtils::XSpp::Node::Enum - Node representing an enum declaration =head1 DESCRIPTION An L subclass representing an C declaration. As an example enum Bool { FALSE = 0, TRUE }; will create an C object with C C and two L values in the C array. Enumerations do not affect the generated code. =head1 METHODS =head2 new my $e = ExtUtils::XSpp::Node::Enum->new( name => 'Bool', elements => [ ... ], ); Creates a new C. C gives the name of the enumeration, C for anonymous enumerations. C should only contain L or L objects. =cut sub init { my $this = shift; my %args = @_; $this->{NAME} = $args{name}; $this->{ELEMENTS} = $args{elements}; $this->{CONDITION} = $args{condition}; } sub print { my( $this, $state ) = @_; # no standard way of emitting an enum '' } =head1 ACCESSORS =head2 name Returns the name of the enumeration, or C for anonymous enumerations. =head2 elements An array reference containing mostly L (it can contain other kinds of nodes). =cut sub name { $_[0]->{NAME} } sub elements { $_[0]->{ELEMENTS} } 1;