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

rangetype.h

Go to the documentation of this file.
00001 #ifndef RANGE_TYPE_H
00002 #define RANGE_TYPE_H
00003 
00004 #include "ast.h"
00005 
00006 class RangeType : public Type {
00007         private:
00008                 int start;
00009                 int end;
00010                 
00011         public:
00012                 RangeType(SrcPosition *position, types typeCode, int start, int end)
00013                                 : Type(position, typeCode), start(start), end(end) {}
00014 
00015                 RangeType(const RangeType &rangeType) : Type(rangeType.position, rangeType.typeCode) {
00016                         *(this) = rangeType;
00017                 }
00018                 
00019                 virtual ~RangeType() {
00020                 }
00021 
00022                 virtual Ast& operator = (const Ast& ast) {
00023                         const RangeType& rangeType = dynamic_cast<const RangeType&>(ast); 
00024                         Type::operator=(ast);
00025                         this->start = rangeType.start;
00026                         this->end = rangeType.end;
00027 
00028                         return (*this);
00029                 }
00030 
00031                 int getStart() const {
00032                         return this->start;
00033                 }
00034 
00035                 int getEnd() const {
00036                         return this->end;
00037                 }
00038                 
00039                 virtual bool operator == (const Ast& ast) const {
00040                         const RangeType& rangeType = dynamic_cast<const RangeType&>(ast);
00041                         return Type::operator==(ast) && (this->start == rangeType.start) && (this->end == rangeType.end);
00042                 }
00043 
00044                 virtual Ast& clone() const {
00045                         return *(new RangeType(new SrcPosition(*(this->position)), this->typeCode, this->start, this->end));
00046                 }
00047 
00048                 virtual VisitorReturn *visit(Visitor& visitor) {
00049                         return visitor.visitRangeType(this);
00050                 }
00051 };
00052 
00053 #endif

Generated on Mon Dec 1 17:00:23 2003 for Protomake by doxygen1.3