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

simpledeclaration.cpp

Go to the documentation of this file.
00001 #include <typeinfo>
00002 #include "simpledeclaration.h"
00003 using namespace std;
00004 
00005 Ast& SimpleDeclaration::operator = (const Ast& ast) {
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 }
00016 
00017 bool SimpleDeclaration::operator == (const Ast& ast) const {
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 }
00032 

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