PageRenderTime 37ms CodeModel.GetById 15ms app.highlight 17ms RepoModel.GetById 2ms app.codeStats 0ms

/libs/perl/Choicetool/Rules/UnaryOp.pm

#
Perl | 88 lines | 46 code | 22 blank | 20 comment | 1 complexity | c6a31627c6704eef29b59943b534066b MD5 | raw file
 1# -*- perl -*-
 2
 3#
 4# UnaryOp.pm
 5#
 6# Copyright (C) 2008, 2009 Francesco Salvestrini
 7#
 8# This program is free software; you can redistribute it and/or modify
 9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License along
19# with this program; if not, write to the Free Software Foundation, Inc.,
20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21#
22
23package Choicetool::Rules::UnaryOp;
24
25use 5.8.0;
26
27use warnings;
28use strict;
29use diagnostics;
30
31use Choicetool::Base::Debug;
32use Choicetool::Base::Trace;
33
34use vars qw(@ISA);
35@ISA = qw(Choicetool::Rules::Rule);
36
37sub new ($$)
38{
39    my $class = shift;
40
41    assert(defined($class));
42
43    my $self = { };
44
45    $self->{OPERAND} = undef;
46
47    return bless($self, $class);
48}
49
50sub operand ($$)
51{
52    my $self = shift;
53    my $oper = shift;
54
55    assert(defined($self));
56
57    if (defined($oper)) {
58        $self->{OPERAND} = $oper;
59    }
60
61    return $self->{OPERAND};
62}
63
64sub m4ify_header ($$)
65{
66    my $self   = shift;
67    my $prefix = shift;
68
69    assert(defined($self));
70    assert(defined($prefix));
71    assert(defined($self->id()));
72
73    return $prefix . "\n";
74}
75
76sub m4ify_footer ($$)
77{
78    my $self   = shift;
79    my $prefix = shift;
80
81    assert(defined($self));
82    assert(defined($prefix));
83    assert(defined($self->id()));
84
85    return $prefix . "\n";
86}
87
881;