00001 #ifndef SIMPLE_ARRAY_REFERENCE_H 00002 #define SIMPLE_ARRAY_REFERENCE_H 00003 00004 #include "arrayreference.h" 00005 #include "identifier.h" 00006 #include "expression.h" 00007 00008 class SimpleArrayReference : public ArrayReference { 00009 private: 00010 Identifier *identifier; 00011 Expression *expression; 00012 00013 public: 00014 SimpleArrayReference(SrcPosition *position, Identifier *identifier, Expression *expression) 00015 : ArrayReference(position), Ast(position), identifier(identifier), expression(expression) {} 00016 00017 SimpleArrayReference(const SimpleArrayReference& simpleArrayReference) : ArrayReference(simpleArrayReference.position), Ast(position) { 00018 *(this) = simpleArrayReference; 00019 } 00020 00021 virtual ~SimpleArrayReference() { 00022 delete this->identifier; 00023 delete this->expression; 00024 } 00025 00026 Identifier *getIdentifier() { 00027 return this->identifier; 00028 } 00029 00030 Expression *getExpression() { 00031 return this->expression; 00032 } 00033 00034 virtual Ast& operator = (const Ast& ast); 00035 virtual bool operator == (const Ast& ast) const; 00036 00037 virtual VisitorReturn *visit(Visitor& visitor) { 00038 return visitor.visitSimpleArrayReference(this); 00039 } 00040 00041 virtual Ast& clone() const { 00042 return *(new SimpleArrayReference(new SrcPosition(*(this->position)), 00043 this->identifier ? dynamic_cast<Identifier*>(&(this->identifier->clone())) : 0, 00044 this->expression ? dynamic_cast<Expression*>(&(this->expression->clone())) : 0)); 00045 } 00046 }; 00047 00048 #endif