00001 #ifndef _STREE_CONSTANT_H_ 00002 #define _STREE_CONSTANT_H_ 00003 00004 #include <sstream> 00005 #include "streenode.h" 00006 00007 #define CConstant "Constant" 00008 00010 00017 class Constant : public Node 00018 { 00020 string value; 00021 public: 00022 00024 Constant(const string &ivalue, const string &icomment = "", const int ilineno = 0) : Node(icomment,ilineno), value(ivalue) {}; 00025 00026 virtual SType getType() const { return SConstant; }; 00027 00029 string getValue() const { return value; }; 00030 00031 virtual string getName() const { return value; }; 00032 00033 virtual ostream& print(ostream &os) const; 00034 00035 virtual ostream& php(ostream &os) const; 00036 00037 virtual bool match(const Node *p, Assignment &assign, const NameSpace &nameSpace)const; 00038 00039 virtual bool matchToBegining(const List *p, Assignment &assign, const NameSpace &nameSpace) const; 00040 00041 virtual bool compare(const Node *p) const; 00042 00043 virtual Node* copy() const; 00044 00045 virtual void getVariables(VariableList &vlist) const; 00046 00048 int toInt() const; 00049 00050 virtual Node* substitute(const Assignment &assign); 00051 00052 virtual string evaluate(const NameSpace &nameSpace) const; 00053 }; 00054 00055 #endif