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

SimpleDeclaration Class Reference

#include <simpledeclaration.h>

Inheritance diagram for SimpleDeclaration:

Inheritance graph
[legend]
Collaboration diagram for SimpleDeclaration:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SimpleDeclaration (SrcPosition *position, IdentifierList *identifierList, Type *type, Expression *expression, bool constant)
 SimpleDeclaration (const SimpleDeclaration &simpleDeclaration)
virtual ~SimpleDeclaration ()
IdentifierListgetIdentifierList ()
TypegetType ()
ExpressiongetExpression ()
bool isConstant () const
virtual Astoperator= (const Ast &ast)
virtual bool operator== (const Ast &ast) const
virtual VisitorReturnvisit (Visitor &visitor)
virtual Astclone () const

Private Attributes

IdentifierListidentifierList
Typetype
Expressionexpression
bool constant

Constructor & Destructor Documentation

SimpleDeclaration::SimpleDeclaration SrcPosition position,
IdentifierList identifierList,
Type type,
Expression expression,
bool  constant
[inline]
 

Definition at line 17 of file simpledeclaration.h.

Referenced by clone().

00019                         : Declaration(position), identifierList(identifierList), type(type), 
00020                           expression(expression), constant(constant) {}

SimpleDeclaration::SimpleDeclaration const SimpleDeclaration &  simpleDeclaration  )  [inline]
 

Definition at line 22 of file simpledeclaration.h.

References Ast::position.

00022                                                                               : Declaration(simpleDeclaration.position) {
00023                         *(this) = simpleDeclaration;
00024                 }

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

Definition at line 26 of file simpledeclaration.h.

00026                                              {
00027                         delete this->identifierList;
00028                         delete this->type;
00029                         delete this->expression;
00030                 }


Member Function Documentation

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

Implements Ast.

Definition at line 55 of file simpledeclaration.h.

References Ast::clone(), Type::clone(), and SimpleDeclaration().

Referenced by SequentialDeclaration::clone(), and SequentialDeclaration::operator=().

00055                                            {
00056                         return *(new SimpleDeclaration(new SrcPosition(*(this->position)),
00057                                          this->identifierList ? dynamic_cast<IdentifierList*>(&(this->identifierList->clone())) : 0,
00058                                          this->type ? dynamic_cast<Type*>(&(this->type->clone())) : 0,
00059                                          this->expression ? dynamic_cast<Expression*>(&(this->expression->clone())) : 0,
00060                                          this->constant));
00061                 }

Expression* SimpleDeclaration::getExpression  )  [inline]
 

Definition at line 40 of file simpledeclaration.h.

Referenced by TypeCheckerVisitor::visitSimpleDeclaration().

00040                                             {
00041                         return this->expression;
00042                 }

IdentifierList* SimpleDeclaration::getIdentifierList  )  [inline]
 

Definition at line 32 of file simpledeclaration.h.

Referenced by TypeCheckerVisitor::visitSimpleDeclaration().

00032                                                     {
00033                         return this->identifierList;
00034                 }

Type* SimpleDeclaration::getType  )  [inline]
 

Definition at line 36 of file simpledeclaration.h.

Referenced by TypeCheckerVisitor::visitSimpleDeclaration().

00036                                 {
00037                         return this->type;
00038                 }

bool SimpleDeclaration::isConstant  )  const [inline]
 

Definition at line 44 of file simpledeclaration.h.

00044                                         {
00045                         return this->constant;
00046                 }

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

Reimplemented from Declaration.

Definition at line 5 of file simpledeclaration.cpp.

References Type::clone(), Ast::clone(), constant, expression, identifierList, Declaration::operator=(), and type.

00005                                                   {
00006         const SimpleDeclaration& simpleDeclaration = dynamic_cast<const SimpleDeclaration&>(ast);
00007 
00008         Declaration::operator=(ast);
00009         this->identifierList = this->identifierList ? dynamic_cast<IdentifierList*>(&(simpleDeclaration.identifierList->clone())) : 0;
00010         this->type = this->type ? dynamic_cast<Type*>(&(simpleDeclaration.type->clone())) : 0;
00011         this->expression = this->expression ? dynamic_cast<Expression*>(&(simpleDeclaration.expression->clone())) : 0;
00012         this->constant = simpleDeclaration.constant;
00013 
00014         return *(this);
00015 }

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

Reimplemented from Declaration.

Definition at line 17 of file simpledeclaration.cpp.

References constant, expression, identifierList, Declaration::operator==(), and type.

00017                                                          {
00018         bool result = false;
00019         const SimpleDeclaration& simpleDeclaration = dynamic_cast<const SimpleDeclaration&>(ast);
00020 
00021         if (typeid(ast) != typeid(SimpleDeclaration))
00022                 return false;
00023 
00024         if (this->identifierList && this->type && this->expression)
00025                 result = (*(this->identifierList) == *(simpleDeclaration.identifierList) &&
00026                                    *(this->type) == *(simpleDeclaration.type) &&
00027                                    *(this->expression) == *(simpleDeclaration.expression) &&
00028                                    this->constant == simpleDeclaration.constant);
00029 
00030         return result && Declaration::operator==(ast);
00031 }

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

Implements Ast.

Definition at line 51 of file simpledeclaration.h.

References Visitor::visitSimpleDeclaration().

Referenced by TypeCheckerVisitor::visitSequentialDeclaration().

00051                                                                {
00052                         return visitor.visitSimpleDeclaration(this);
00053                 }


Member Data Documentation

bool SimpleDeclaration::constant [private]
 

Definition at line 14 of file simpledeclaration.h.

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

Expression* SimpleDeclaration::expression [private]
 

Definition at line 13 of file simpledeclaration.h.

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

IdentifierList* SimpleDeclaration::identifierList [private]
 

Definition at line 11 of file simpledeclaration.h.

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

Type* SimpleDeclaration::type [private]
 

Definition at line 12 of file simpledeclaration.h.

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


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