value.h

Go to the documentation of this file.
00001 #ifndef VALUE_H
00002 #define VALUE_H
00003 
00004 #include <qstring.h>
00005 #include <qimage.h>
00006 #include <vector>
00007 #include "Data/om-data.h"
00008 
00009 using namespace std;
00010 
00011 class Value;
00012 class Variable;
00013 class Reference;
00014 class TextValue;
00015 class Range;
00016 
00017 class Value
00018 {
00019  public:
00020   virtual ~Value() {};
00021   virtual QString toString() = 0;
00022   bool equals(Value *other);
00023   bool equals(Value &other) 
00024     {
00025       return equals(&other);
00026     };
00027   void print() 
00028     {
00029       printf("%s\n",(const char*)toString());
00030     };
00031   virtual Data getSaveDescription(QString prefix) = 0;
00032   static Value * load(Data from);
00033  protected:
00034   virtual bool equals_same_type(Value * other) = 0;
00035 };
00036 
00037 class Expression: public Value
00038 {
00039  private:
00040   vector<Value*> values;
00041   QString operat;
00042  public:
00043   virtual Data getSaveDescription(QString prefix);
00044   Expression(QString op) : operat(op) {};
00045   Expression(Token data);
00046   void add(Value * n) {values.push_back(n);};
00047   int argc() {return values.size();}; 
00048   QString op() {return operat;};
00049   Value * argv(int i) {return values[i];};
00050   virtual QString toString();
00051   virtual bool equals_same_type(Value * other);
00052 };
00053 
00054 class ValueArray: public Value
00055 {
00056  private:
00057   Value ** values;
00058  public:
00059   int sx;
00060   int sy;
00061   virtual Data getSaveDescription(QString prefix);
00062   ValueArray(int x, int y);
00063   ValueArray(Token data);
00064   Value* get(int x, int y) { return values[x+y*sx]; };
00065   void set(int x, int y, Value * v);
00066   virtual QString toString();
00067   virtual bool equals_same_type(Value * other);
00068 };
00069 
00070 class ValueCopier
00071 {
00072  protected:
00073   virtual Reference* copyRef(Reference*vv) = 0;
00074   virtual Value * copyText(TextValue*vv);
00075   virtual Value * copyExpr(Expression * expr);
00076   virtual Value * copyRange(Range*r);
00077  public:
00078   virtual ~ValueCopier() {};
00079   Value * copy(Value * value);
00080 };
00081 
00082 #endif

Generated on Mon Jun 5 22:08:42 2006 for iis by  doxygen 1.4.6