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

simplefielddeclaration.cpp

Go to the documentation of this file.
00001 #include <typeinfo>
00002 #include "simplefielddeclaration.h"
00003 using namespace std;
00004 
00005 Ast& SimpleFieldDeclaration::operator = (const Ast& ast) {
00006         const SimpleFieldDeclaration& simpleFieldDeclaration = dynamic_cast<const SimpleFieldDeclaration&>(ast);
00007 
00008         FieldDeclaration::operator=(ast);
00009         this->identifier = simpleFieldDeclaration.identifier ? dynamic_cast<Identifier*>(&(simpleFieldDeclaration.identifier->clone())) : 0;
00010         this->fieldType = simpleFieldDeclaration.fieldType ? dynamic_cast<FieldType*>(&(simpleFieldDeclaration.fieldType->clone())) : 0;
00011         this->expression = simpleFieldDeclaration.expression ? dynamic_cast<Expression*>(&(simpleFieldDeclaration.expression->clone())) : 0;
00012         this->stringLiteral = simpleFieldDeclaration.stringLiteral ? dynamic_cast<StringLiteral*>(&(simpleFieldDeclaration.stringLiteral->clone())) : 0;
00013 
00014         return *(this);
00015 }
00016 
00017 bool SimpleFieldDeclaration::operator == (const Ast& ast) const {
00018         bool result = false;
00019         const SimpleFieldDeclaration& simpleFieldDeclaration = dynamic_cast<const SimpleFieldDeclaration&>(ast);
00020 
00021         if (typeid(ast) != typeid(SimpleFieldDeclaration))
00022                 return false;
00023 
00024         if (this->identifier && this->fieldType && this->expression && this->stringLiteral)
00025                 result = (*(this->identifier) == *(simpleFieldDeclaration.identifier) &&
00026                                    *(this->fieldType) == *(simpleFieldDeclaration.fieldType) &&
00027                                    *(this->expression) == *(simpleFieldDeclaration.expression) &&
00028                                    *(this->stringLiteral) == *(simpleFieldDeclaration.stringLiteral));
00029 
00030         return result && FieldDeclaration::operator==(ast);
00031 }
00032 

Generated on Mon Dec 1 17:36:37 2003 for Protomake by doxygen1.3