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

fieldtype.h

Go to the documentation of this file.
00001 #ifndef FIELD_TYPE_H
00002 #define FIELD_TYPE_H
00003 
00004 #include "ast.h"
00005 #include "expression.h"
00006 
00007 class FieldType : public Ast {
00008         public:
00009                 enum FType {BIT, BYTE, STRN, STRCTE, STRTERM, STRTERMSTOP, BLANKS};
00010                 
00011                 FieldType(SrcPosition *position, Expression *expression, FType type)
00012                                 : Ast(position), expression(expression), type(type) {}
00013 
00014                 FieldType(const FieldType& fieldType) : Ast(fieldType.position) {
00015                         *(this) = fieldType;
00016                 }
00017 
00018                 virtual ~FieldType() {
00019                         if (this->expression)
00020                                 delete this->expression;
00021                 }
00022 
00023                 Expression *getExpression() {
00024                         return this->expression;
00025                 }
00026 
00027                 FType getType() const {
00028                         return this->type;
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.visitFieldType(this);
00036                 }
00037 
00038                 virtual Ast& clone() const {
00039                         return *(new FieldType(new SrcPosition(*(this->position)),
00040                                          this->expression ? dynamic_cast<Expression*>(&(this->expression->clone())) : 0,
00041                                          this->type));
00042                 }
00043          private:
00044                 Expression *expression;
00045                 FType type;
00046 };
00047 
00048 #endif

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