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

ArrayType Class Reference

#include <arraytype.h>

Inheritance diagram for ArrayType:

Inheritance graph
[legend]
Collaboration diagram for ArrayType:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ArrayType (SrcPosition *position, types typeCode, Type *type, int size)
 ArrayType (const ArrayType &arrayType)
virtual ~ArrayType ()
TypegetType ()
int getSize () const
virtual Astoperator= (const Ast &ast)
virtual bool operator== (const Ast &ast) const
virtual VisitorReturnvisit (Visitor &visitor)
virtual Astclone () const

Private Attributes

Typetype
int size

Constructor & Destructor Documentation

ArrayType::ArrayType SrcPosition position,
types  typeCode,
Type type,
int  size
[inline]
 

Definition at line 12 of file arraytype.h.

Referenced by clone().

00013                                 : Type(position, typeCode), type(type), size(size) {}

ArrayType::ArrayType const ArrayType &  arrayType  )  [inline]
 

Definition at line 15 of file arraytype.h.

References Ast::position, and Type::typeCode.

00015                                                       : Type(arrayType.position, arrayType.typeCode) {
00016                         *(this) = arrayType;
00017                 }

virtual ArrayType::~ArrayType  )  [inline, virtual]
 

Definition at line 19 of file arraytype.h.

00019                                      {
00020                         delete this->type;
00021                 }


Member Function Documentation

virtual Ast& ArrayType::clone  )  const [inline, virtual]
 

Reimplemented from Type.

Definition at line 38 of file arraytype.h.

References ArrayType().

00038                                            {
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                 }

int ArrayType::getSize  )  const [inline]
 

Definition at line 27 of file arraytype.h.

00027                                     {
00028                         return this->size;
00029                 }

Type* ArrayType::getType  )  [inline]
 

Definition at line 23 of file arraytype.h.

Referenced by TypeCheckerVisitor::visitSimpleArrayReference().

00023                                 {
00024                         return this->type;
00025                 }

Ast & ArrayType::operator= const Ast ast  )  [virtual]
 

Reimplemented from Type.

Definition at line 5 of file arraytype.cpp.

References Type::clone(), Type::operator=(), size, and type.

00005                                           {
00006         const ArrayType& arrayType = dynamic_cast<const ArrayType&>(ast);
00007 
00008         Type::operator=(ast);
00009         this->type = arrayType.type ? dynamic_cast<Type*>(&(arrayType.type->clone())) : 0;
00010         this->size = arrayType.size;
00011 
00012         return *(this);
00013 }

bool ArrayType::operator== const Ast ast  )  const [virtual]
 

Reimplemented from Type.

Definition at line 15 of file arraytype.cpp.

References Type::operator==(), size, and type.

00015                                                  {
00016         bool result = false;
00017         const ArrayType& arrayType = dynamic_cast<const ArrayType&>(ast);
00018 
00019         if (typeid(ast) != typeid(ArrayType))
00020                 return false;
00021 
00022         if (this->type)
00023                 result = (*(this->type) == *(arrayType.type) &&
00024                                   this->size == arrayType.size);
00025 
00026         return result && Type::operator==(ast);
00027 }

virtual VisitorReturn* ArrayType::visit Visitor visitor  )  [inline, virtual]
 

Reimplemented from Type.

Definition at line 34 of file arraytype.h.

References Visitor::visitArrayType().

00034                                                                {
00035                         return visitor.visitArrayType(this);
00036                 }


Member Data Documentation

int ArrayType::size [private]
 

Definition at line 9 of file arraytype.h.

Referenced by operator=(), and operator==().

Type* ArrayType::type [private]
 

Definition at line 8 of file arraytype.h.

Referenced by operator=(), and operator==().


The documentation for this class was generated from the following files:
Generated on Mon Dec 1 17:38:50 2003 for Protomake by doxygen1.3