00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __LITERALS_H__
00025 #define __LITERALS_H__
00026
00027 BEGIN_NAMESPACE( classad )
00028
00029 typedef std::vector<ExprTree*> ArgumentList;
00030
00034 class Literal : public ExprTree
00035 {
00036 public:
00038 ~Literal ();
00039
00041 Literal(const Literal &literal);
00042
00044 Literal &operator=(const Literal &literal);
00045
00051 static Literal* MakeAbsTime( abstime_t *now=NULL );
00052
00053
00054
00055
00056
00057
00058
00059 static Literal* MakeAbsTime( std::string timestr);
00060
00066 static Literal* MakeRelTime( time_t secs=-1 );
00067
00075 static Literal* MakeRelTime( time_t t1, time_t t2 );
00076
00077
00078
00079
00080
00081 static Literal* MakeRelTime(std::string str);
00082
00083 static Literal* MakeReal(std::string realstr);
00084
00086 virtual ExprTree* Copy( ) const;
00087
00088 void CopyFrom(const Literal &literal);
00089
00097 static Literal*MakeLiteral( const Value& v, Value::NumberFactor f=
00098 Value::NO_FACTOR );
00099
00104 void GetComponents( Value& v, Value::NumberFactor &f ) const;
00105
00109 void GetValue( Value& v ) const;
00110
00111
00112
00113
00114 static int findOffset(time_t epochsecs);
00115
00116 virtual bool SameAs(const ExprTree *tree) const;
00117
00118 friend bool operator==(Literal &literal1, Literal &literal2);
00119
00120 protected:
00122 Literal ();
00123
00124 private:
00125 friend class FunctionCall;
00126 friend class ClassAd;
00127 friend class ExprList;
00128 friend class Operation;
00129
00130 virtual void _SetParentScope( const ClassAd* ){ }
00131 virtual bool _Flatten( EvalState&, Value&, ExprTree*&, int* ) const;
00132 virtual bool _Evaluate (EvalState &, Value &) const;
00133 virtual bool _Evaluate (EvalState &, Value &, ExprTree *&) const;
00134
00135
00136 Value value;
00137 Value::NumberFactor factor;
00138 };
00139
00140 END_NAMESPACE
00141
00142 #endif//__LITERALS_H__