F:/KPlato/koffice/kplato/kptrelation.h

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2001 Thomas Zander zander@kde.org
00003    Copyright (C) 2004 Dag Andersen <danders@get2net.dk>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
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: // variables
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 }  //KPlato namespace
00113 
00114 #endif

Généré le Wed Nov 22 23:40:57 2006 pour KPlato par  doxygen 1.5.1-p1