2 * ExpressionTree.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.
13 #ifndef _ExpressionTree_h_
14 #define _ExpressionTree_h_
21 #include "ExpressionTreeFunction.h"
29 * @short This class represents the logical expressions that can be used to
30 * filter @see CoreAttributesList objects.
31 * @author Chris Schlaeger <cs@kde.org>
33 * @details To filter certain elements out of CoreAttributes lists one needs to
34 * specify a logical expression that describes the elements that should remain
35 * in the list. The ExpressionTree stores such a logical expression. To filter
36 * out the unwanted elements the ExpressionTree is evaluated against each of
37 * the elements. The attributes of the element can be referenced in the
44 * Use this constructor when you have rolled your own operation tree
46 * @ param op the root of the operation tree
48 ExpressionTree(const Operation* op);
50 * The usual copy constructor.
52 ExpressionTree(const ExpressionTree& et);
54 * The default constructor. When you use this, you need to call setTree()
55 * later on to assign an expression to the object.
64 * Use this fuction to assign a new expression to the object.
65 * @param expr is a logical expresion in text form.
66 * @param proj is a pointer to the project object.
68 bool setTree(const QString& expr, const Project* proj);
70 void setDefLocation(const QString file, int line)
76 long evalAsInt(const CoreAttributes* c);
77 long resolve(const QString& symbol);
79 void setErrorFlag(bool flag = true)
83 bool getErrorFlag() const
88 void registerSymbol(const QString& symbol, long value)
90 symbolTable.insert(symbol, new long(value));
92 void clearSymbolTable() { symbolTable.clear(); }
94 const CoreAttributes* getCoreAttributes() const { return ca; }
96 void errorMessage(const QString& msg);
99 void generateFunctionTable();
100 const CoreAttributes* ca;
101 QDict<long> symbolTable;
102 const Operation* expression;