00001
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>
00027
00028 class QDomElement;
00029
00030 namespace KPlato
00031 {
00032
00033 class Node;
00034 class Project;
00035 class PertCanvas;
00036
00044 class Relation {
00045 public:
00046 enum Type { None, FinishStart, FinishFinish, StartStart };
00047
00048 Relation(Node *parent, Node *child, Type type, Duration lag);
00049 Relation(Node *parent=0, Node *child=0, Type type=FinishStart);
00050 Relation(Relation *rel);
00051
00056 virtual ~Relation();
00057
00058 void setType(Type );
00059 Type type() const { return m_type; }
00060
00065 const Duration &lag() const { return m_lag; }
00066 void setLag(Duration lag) { m_lag = lag; }
00067
00071 Node *parent() const { return m_parent; }
00075 Node *child() const { return m_child; }
00076
00077 enum Result {
00078 SUCCESS = 0l,
00079 HASCHILDREN = 1l,
00080 NOTIMPL = 2l
00081 };
00082
00083 bool load(QDomElement &element, Project &project);
00084 void save(QDomElement &element) const;
00085
00086 protected:
00087 Node *m_parent;
00088 Node *m_child;
00089 Type m_type;
00090 Duration m_lag;
00091
00092 private:
00093 QString m_parentId;
00094
00095 #ifndef NDEBUG
00096 public:
00097 void printDebug(QByteArray indent);
00098 #endif
00099
00100 };
00101
00102 class ProxyRelation : public Relation
00103 {
00104 public:
00105 ProxyRelation(Node *parent, Node *child, Relation::Type type, Duration lag)
00106 : Relation(parent, child, type, lag)
00107 {}
00108
00109 ~ProxyRelation() { m_parent = 0; m_child = 0;}
00110 };
00111
00112 }
00113
00114 #endif