OSDN Git Service

adjust integer's signedness
[tjqt4port/tj2qt4.git] / taskjuggler / ExpressionTreeFunction.h
1 /*
2  * ExpressionTreeFunction.h - TaskJuggler
3  *
4  * Copyright (c) 2001, 2002, 2003, 2004 by Chris Schlaeger <cs@kde.org>
5  *
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.
9  *
10  * $Id$
11  */
12 #ifndef _ExpressionTreeFunction_h_
13 #define _ExpressionTreeFunction_h_
14
15 #include "qstring.h"
16 #include "qstringlist.h"
17 //Added by qt3to4:
18 #include <Q3ValueList>
19
20 #include "taskjuggler.h"
21
22 class ExpressionTreeFunction;
23 class ExpressionTree;
24 class Operation;
25 class CoreAttributes;
26
27 typedef long (ExpressionTreeFunction::*ExpressionTreeFunctionLongPtr)
28     (ExpressionTree*, Operation* const ops[]) const;
29
30 class ExpressionTreeFunction
31 {
32 public:
33     ExpressionTreeFunction(const QString& n, ExpressionTreeFunctionLongPtr f,
34                            int a) :
35         name(n),
36         longFunc(f),
37         args(a),
38         supportedCoreAttributes()
39     { }
40     ~ExpressionTreeFunction() { }
41
42     const QString& getName() const { return name; }
43     int getArgumentCount() const { return args; }
44
45     void addSupportedCoreAttributes(CAType ca)
46     {
47         supportedCoreAttributes.append(ca);
48     }
49     bool checkCoreAttributesType(ExpressionTree* et);
50
51     long longCall(ExpressionTree* et, Operation* const ops[]) const;
52
53     long hasAssignments(ExpressionTree* et, Operation* const ops[]) const;
54     long isParentOf(ExpressionTree* et, Operation* const ops[]) const;
55     long isDependencyOf(ExpressionTree* et, Operation* const ops[]) const;
56     long isDescendantOf(ExpressionTree* et, Operation* const ops[]) const;
57     long isLeaf(ExpressionTree* et, Operation* const ops[]) const;
58     long treeLevel(ExpressionTree* et, Operation* const ops[]) const;
59     long isAccount(ExpressionTree* et, Operation* const ops[]) const;
60     long isAnAccount(ExpressionTree* et, Operation* const ops[]) const;
61     long isResource(ExpressionTree* et, Operation* const ops[]) const;
62     long isAResource(ExpressionTree* et, Operation* const ops[]) const;
63     long isMilestone(ExpressionTree* et, Operation* const ops[]) const;
64     long isTask(ExpressionTree* et, Operation* const ops[]) const;
65     long isATask(ExpressionTree* et, Operation* const ops[]) const;
66     long isSubTaskOf(ExpressionTree* et, Operation* const ops[]) const;
67     long isTaskOfProject(ExpressionTree* et, Operation* const ops[])
68         const;
69     long startsBefore(ExpressionTree* et, Operation* const ops[]) const;
70     long startsAfter(ExpressionTree* et, Operation* const ops[]) const;
71     long endsBefore(ExpressionTree* et, Operation* const ops[]) const;
72     long endsAfter(ExpressionTree* et, Operation* const ops[]) const;
73     long isAllocated(ExpressionTree* et, Operation* const ops[]) const;
74     long isDutyOf(ExpressionTree* et, Operation* const ops[]) const;
75     long isAllocatedToProject(ExpressionTree* et, Operation* const ops[])
76         const;
77     long isOnCriticalPath(ExpressionTree* et, Operation* const ops[]) const;
78
79     /* Deprecated functions */
80     long isTaskStatus(ExpressionTree* et, Operation* const ops[]) const;
81     long containsTask(ExpressionTree* et, Operation* const ops[]) const;
82     long isPlanAllocated(ExpressionTree* et, Operation* const ops[])
83         const;
84     long isActualAllocated(ExpressionTree* et, Operation* const ops[])
85         const;
86
87 private:
88     const CoreAttributes* findCoreAttributes(const CoreAttributes* ca,
89                                              const QString& id) const;
90
91     QString name;
92     ExpressionTreeFunctionLongPtr longFunc;
93     int args;
94     Q3ValueList<CAType> supportedCoreAttributes;
95 } ;
96
97 #endif
98