00001 #ifndef IF_STATEMENT_H 00002 #define IF_STATEMENT_H 00003 00004 #include "simplestatement.h" 00005 #include "guardedstatement.h" 00006 00007 class IfStatement : public SimpleStatement { 00008 private: 00009 GuardedStatement *guardedStatement; 00010 00011 public: 00012 IfStatement(SrcPosition *position, GuardedStatement *guardedStatement) 00013 : SimpleStatement(position), guardedStatement(guardedStatement) {} 00014 00015 IfStatement(const IfStatement& ifStatement) : SimpleStatement(ifStatement.position) { 00016 *(this) = ifStatement; 00017 } 00018 00019 virtual ~IfStatement() { 00020 delete this->guardedStatement; 00021 } 00022 00023 GuardedStatement *getGuardedStatement() { 00024 return this->guardedStatement; 00025 } 00026 00027 virtual Ast& operator = (const Ast& ast); 00028 virtual bool operator == (const Ast& ast) const; 00029 00030 virtual VisitorReturn *visit(Visitor& visitor) { 00031 return visitor.visitIfStatement(this); 00032 } 00033 00034 virtual Ast& clone() const { 00035 return *(new IfStatement(new SrcPosition(*(this->position)), 00036 this->guardedStatement ? dynamic_cast<GuardedStatement*>(&(this->guardedStatement->clone())) : 0)); 00037 } 00038 }; 00039 00040 #endif