ExtUtils::XSpp::Node::Enum - Node representing an enum declaration


ExtUtils-XSpp documentation Contained in the ExtUtils-XSpp distribution.

Index


Code Index:

NAME

Top

ExtUtils::XSpp::Node::Enum - Node representing an enum declaration

DESCRIPTION

Top

An ExtUtils::XSpp::Node subclass representing an enum declaration. As an example

    enum Bool
    {
        FALSE = 0,
        TRUE
    };

will create an ExtUtils::XSpp::Node::Enum object with name Bool and two ExtUtils::XSpp::Node::EnumValue values in the arguments array.

Enumerations do not affect the generated code.

METHODS

Top

new

    my $e = ExtUtils::XSpp::Node::Enum->new( name     => 'Bool',
                                             elements => [ ... ],
                                             );

Creates a new ExtUtils::XSpp::Node::Enum.

name gives the name of the enumeration, undef for anonymous enumerations. elements should only contain ExtUtils::XSpp::Node::EnumValue or ExtUtils::XSpp::Node::Raw objects.

ACCESSORS

Top

name

Returns the name of the enumeration, or undef for anonymous enumerations.

elements

An array reference containing mostly ExtUtils::XSpp::Node::EnumValue (it can contain other kinds of nodes).


ExtUtils-XSpp documentation Contained in the ExtUtils-XSpp distribution.
package ExtUtils::XSpp::Node::Enum;
use strict;
use warnings;
use base 'ExtUtils::XSpp::Node';

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
  ''
}

sub name { $_[0]->{NAME} }
sub elements { $_[0]->{ELEMENTS} }

1;