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

arraytype.h

Go to the documentation of this file.
00001 #ifndef ARRAY_TYPE_H
00002 #define ARRAY_TYPE_H
00003 
00004 #include "type.h"
00005 
00006 class ArrayType : public Type {
00007         private:
00008                 Type *type;
00009                 int size;
00010 
00011         public:
00012                 ArrayType(SrcPosition *position, types typeCode, Type *type, int size)
00013                                 : Type(position, typeCode), type(type), size(size) {}
00014 
00015                 ArrayType(const ArrayType& arrayType) : Type(arrayType.position, arrayType.typeCode) {
00016                         *(this) = arrayType;
00017                 }
00018 
00019                 virtual ~ArrayType() {
00020                         delete this->type;
00021                 }
00022 
00023                 Type *getType() {
00024                         return this->type;
00025                 }
00026 
00027                 int getSize() const {
00028                         return this->size;
00029                 }
00030 
00031                 virtual Ast& operator = (const Ast& ast);
00032                 virtual bool operator == (const Ast& ast) const;
00033 
00034                 virtual VisitorReturn *visit(Visitor& visitor) {
00035                         return visitor.visitArrayType(this);
00036                 }
00037 
00038                 virtual Ast& clone() const {
00039                         return *(new ArrayType(new SrcPosition(*(this->position)),
00040                                          this->typeCode,
00041                                          this->type ? dynamic_cast<Type*>(&(this->type->clone())) : 0,
00042                                          this->size));
00043                 }
00044 };
00045 
00046 #endif

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