kplato
kptrelation.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KPTRELATION_H
00022 #define KPTRELATION_H
00023
00024 #include "kptduration.h"
00025
00026 #include <qstring.h>
00027
00028 class QCanvas;
00029 class QDomElement;
00030
00031 namespace KPlato
00032 {
00033
00034 class Node;
00035 class Project;
00036 class PertCanvas;
00037
00045 class Relation {
00046 public:
00047 enum Type { FinishStart, FinishFinish, StartStart };
00048
00049 Relation(Node *parent, Node *child, Type type, Duration lag);
00050 Relation(Node *parent=0, Node *child=0, Type type=FinishStart);
00051 Relation(Relation *rel);
00052
00057 virtual ~Relation();
00058
00059 void setType(Type );
00060 Type type() const { return m_type; }
00061
00066 const Duration &lag() const { return m_lag; }
00067 void setLag(Duration lag) { m_lag = lag; }
00068
00072 Node *parent() const { return m_parent; }
00076 Node *child() const { return m_child; }
00077
00078 enum Result {
00079 SUCCESS = 0l,
00080 HASCHILDREN = 1l,
00081 NOTIMPL = 2l
00082 };
00083
00084 bool load(QDomElement &element, Project &project);
00085 void save(QDomElement &element) const;
00086
00087 protected:
00088 Node *m_parent;
00089 Node *m_child;
00090 Type m_type;
00091 Duration m_lag;
00092
00093 private:
00094 QString m_parentId;
00095
00096 #ifndef NDEBUG
00097 public:
00098 void printDebug(QCString indent);
00099 #endif
00100
00101 };
00102
00103 class ProxyRelation : public Relation
00104 {
00105 public:
00106 ProxyRelation(Node *parent, Node *child, Relation::Type type, Duration lag)
00107 : Relation(parent, child, type, lag)
00108 {}
00109
00110 ~ProxyRelation() { m_parent = 0; m_child = 0;}
00111 };
00112
00113 }
00114
00115 #endif
|