2 * Operation.h - TaskJuggler
4 * Copyright (c) 2001, 2002, 2003, 2004 by Chris Schlaeger <cs@kde.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of version 2 of the GNU General Public License as
8 * published by the Free Software Foundation.
19 #include <q3ptrlist.h>
29 enum opType { Const = 1, Variable, Function, Id, Date, String,
31 Greater, Smaller, Equal, GreaterOrEqual, SmallerOrEqual };
42 Operation(opType ot, const QString& n) :
51 Operation(opType ot, long v) :
60 Operation(opType ot, const QString& n, long v) :
69 Operation(const QString& v) :
78 Operation(Operation* o1, opType ot, Operation* o2 = 0) :
82 ops(new Operation*[2]),
90 Operation(const QString& n, Operation* o1) :
94 ops(new Operation*[1]),
101 Operation(const QString& n, Operation* o1, Operation* o2) :
105 ops(new Operation*[2]),
113 Operation(const QString& n, Operation* args[], int c) :
122 Operation(const Operation& op);
126 long evalAsInt(ExpressionTree* et) const;
127 time_t evalAsTime(ExpressionTree* et) const;
128 QString evalAsString(ExpressionTree* et) const;
130 void setValid(bool v = true)
134 bool isValid() const { return valid; }
136 QString debugString();
139 long evalFunction(ExpressionTree* et) const;
140 QString evalFunctionAsString(ExpressionTree* et) const;