OSDN Git Service

* Support for later completion of task and resources added. By
[tjqt4port/tj2qt4.git] / taskjuggler / CoreAttributes.h
1 /*
2  * CoreAttributes.h - TaskJuggler
3  *
4  * Copyright (c) 2001, 2002 by Chris Schlaeger <cs@suse.de>
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
13 #ifndef _CoreAttributes_h_
14 #define _CoreAttributes_h_
15
16 #include <qstring.h>
17
18 #include "FlagList.h"
19
20 class Project;
21 class CoreAttributes;
22
23 class CoreAttributesList : public QPtrList<CoreAttributes>
24 {
25 public:
26         CoreAttributesList() { sorting = Pointer; }
27         virtual ~CoreAttributesList();
28
29         enum SortCriteria { Pointer, TreeMode, NameUp, NameDown, FullNameUp,
30                                                 FullNameDown, IdUp, IdDown, IndexUp, IndexDown, 
31                                                 StartUp, StartDown, EndUp, EndDown,
32                                                 PrioUp, PrioDown,
33                                                 ResponsibleUp, ResponsibleDown,
34                                                 MinEffortUp, MinEffortDown,
35                                                 MaxEffortUp, MaxEffortDown,
36                                                 RateUp, RateDown,
37                                                 KotrusIdUp, KotrusIdDown
38         };
39
40         void setSorting(SortCriteria s);
41         void createIndex();
42
43 protected:
44         virtual int compareItems(QCollection::Item i1, QCollection::Item i2);
45
46         SortCriteria sorting;
47 } ;
48
49 class CoreAttributes
50 {
51 public:
52         CoreAttributes(Project* p, const QString& i, const QString& n,
53                                    CoreAttributes* parent_) :
54                 project(p), id(i), name(n), parent(parent_) { }
55         virtual ~CoreAttributes() { }
56
57         virtual char* getType() { return "CoreAttributes"; }
58
59         const QString& getId() const { return id; }
60
61         void setIndex(uint idx) { index = idx; }
62         uint getIndex() const { return index; }
63
64         void setSequenceNo(uint no) { sequenceNo = no; }
65
66         Project* getProject() { return project; }
67
68         void setName(const QString& n) { name = n; }
69         const QString& getName() const { return name; }
70         void getFullName(QString& fullName);
71
72         CoreAttributes* getParent() const { return parent; }
73
74         void addSub(CoreAttributes* c) { sub.append(c); }
75         virtual CoreAttributesList getSubList()  const { return sub; }
76
77         void addFlag(QString flag) { flags.addFlag(flag); }
78         void clearFlag(const QString& flag) { flags.clearFlag(flag); }
79         bool hasFlag(const QString& flag) { return flags.hasFlag(flag); }
80         FlagList getFlagList() const { return flags; }
81
82 protected:
83         /// A pointer to access information that are global to the project.
84         Project* project;
85
86         /// An ID that must be unique within the attribute class.
87         QString id;
88
89         /// An index number that must be unique within the attribute class.
90         uint index;
91
92         /// The index of the task declaration.
93         uint sequenceNo;
94
95         /// A short description of the attribute.
96         QString name;
97
98         /// Pointer to parent. If there is no parent the pointer is 0.
99         CoreAttributes* parent;
100
101         /// List of child attributes. 
102         CoreAttributesList sub;
103
104         /// List of flags set for this attribute.
105         FlagList flags;
106
107         CoreAttributes() { }    // Don't use this!
108 } ;
109
110 #endif