ExtUtils::XSpp::Node::EnumValue - Node representing an enum element


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

Index


Code Index:

NAME

Top

ExtUtils::XSpp::Node::EnumValue - Node representing an enum element

DESCRIPTION

Top

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

    enum Bool
    {
        FALSE = 0,
        TRUE
    };

Will create two ExtUtils::XSpp::Node::EnumValue objects, the first with name FALSE and value 0, the second with name TRUE and no value.

Enumerations do not affect the generated code.

METHODS

Top

new

    my $e = ExtUtils::XSpp::Node::EnumValue->new( name  => 'FALSE',
                                                  value => '0x1 | 0x4',
                                                  );

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

value is optional.

ACCESSORS

Top

name

Returns the name of the enumeration element.

value

Returns the initializer of the enumeration element, or undef.


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

sub init {
  my $this = shift;
  my %args = @_;

  $this->{NAME}      = $args{name};
  $this->{VALUE}     = $args{value};
  $this->{CONDITION} = $args{condition};
}

sub print {
  my( $this, $state ) = @_;

  # no standard way of emitting an enum value
  ''
}

sub name { $_[0]->{NAME} }
sub value { $_[0]->{VALUE} }

1;