Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

unaryexpression.h

Go to the documentation of this file.
00001 #ifndef UNARY_EXPRESSION_H
00002 #define UNARY_EXPRESSION_H
00003 
00004 #include <string>
00005 #include "ast.h"
00006 #include "expression.h"
00007 
00008 using namespace std;
00009 
00010 class UnaryExpression : public Expression {
00011         private:
00012                 Expression *expression;
00013                 string op;
00014 
00015         public:
00016                 UnaryExpression(SrcPosition *position, Expression *expression, string op)
00017                                 : Expression(position), Ast(position), expression(expression), op(op) {}
00018 
00019                 UnaryExpression(const UnaryExpression& unaryExpression) : Expression(unaryExpression.position), Ast(position) {
00020                         *(this) = unaryExpression;
00021                 }
00022 
00023                 virtual ~UnaryExpression() {
00024                         delete this->expression;
00025                 }
00026 
00027                 Expression *getExpression() {
00028                         return this->expression;
00029                 }
00030 
00031                 string getOp() const {
00032                         return this->op;
00033                 }
00034 
00035                 virtual Ast& operator = (const Ast& ast);
00036                 virtual bool operator == (const Ast& ast) const;
00037 
00038                 virtual VisitorReturn *visit(Visitor& visitor) {
00039                         return visitor.visitUnaryExpression(this);
00040                 }
00041 
00042                 virtual Ast& clone() const {
00043                         return *(new UnaryExpression(new SrcPosition(*(this->position)),
00044                                          this->expression ? dynamic_cast<Expression*>(&(this->expression->clone())) : 0,
00045                                          this->op));
00046                 }
00047 };
00048 
00049 #endif

Generated on Mon Dec 1 17:36:38 2003 for Protomake by doxygen1.3