blob: edf107ae64c4a451add70556930613cbf11942e9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* copyright (C) 2003-2006 *
* Umbrello UML Modeller Authors <uml-devel@uml.sf.net> *
***************************************************************************/
#ifndef ENUM_H
#define ENUM_H
#include "classifier.h"
class UMLEnumLiteral;
/**
* This class contains the non-graphical information required for a UML
* Enum.
* This class inherits from @ref UMLClassifier which contains most of the
* information.
*
* @short Non-graphical Information for an Enum.
* @author Jonathan Riddell
* Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org
*/
class UMLEnum : public UMLClassifier {
Q_OBJECT
TQ_OBJECT
public:
/**
* Sets up an enum.
*
* @param name The name of the Enum.
* @param id The unique id of the Enum.
*/
explicit UMLEnum(const TQString& name = "", Uml::IDType id = Uml::id_None);
/**
* Standard deconstructor.
*/
virtual ~UMLEnum();
/**
* Overloaded '==' operator.
*/
bool operator==(UMLEnum& rhs);
/**
* Copy the internal presentation of this object into the new
* object.
*/
virtual void copyInto(UMLEnum *rhs) const;
/**
* Make a clone of this object.
*/
virtual UMLObject* clone() const;
/**
* Creates a literal for the enum.
*
* @return The UMLEnum created
*/
UMLObject* createEnumLiteral(const TQString& name = TQString());
/**
* Adds an enumliteral to the enum.
*
* @param name The name of the enumliteral.
* @param id The id of the enumliteral (optional.)
* If omitted a new ID is assigned internally.
* @return Pointer to the UMLEnumliteral created.
*/
UMLObject* addEnumLiteral(const TQString &name, Uml::IDType id = Uml::id_None);
/**
* Adds an already created enumliteral.
* The enumliteral object must not belong to any other concept.
*
* @param Att Pointer to the UMLEnumLiteral.
* @param Log Pointer to the IDChangeLog.
* @return True if the enumliteral was successfully added.
*/
bool addEnumLiteral(UMLEnumLiteral* Att, IDChangeLog* Log = 0);
/**
* Adds an enumliteral to the enum, at the given position.
* If position is negative or too large, the enumliteral is added
* to the end of the list.
*
* @param Att Pointer to the UMLEnumLiteral.
* @param position Position index for the insertion.
* @return True if the enumliteral was successfully added.
*/
//TODO: give default value -1 to position (append) - now it conflicts with the method above..
bool addEnumLiteral(UMLEnumLiteral* Att, int position );
/**
* Removes an enumliteral from the class.
*
* @param a The enumliteral to remove.
* @return Count of the remaining enumliterals after removal.
* Returns -1 if the given enumliteral was not found.
*/
int removeEnumLiteral(UMLEnumLiteral *a);
/**
* Returns the number of enumliterals for the class.
*
* @return The number of enumliterals for the class.
*/
int enumLiterals();
/**
* Emit the enumLiteralRemoved signal.
*/
void signalEnumLiteralRemoved(UMLClassifierListItem *elit);
/**
* Creates the <UML:Enum> element including its enumliterals.
*/
virtual void saveToXMI( TQDomDocument & qDoc, TQDomElement & qElement );
signals:
void enumLiteralAdded(UMLClassifierListItem*);
void enumLiteralRemoved(UMLClassifierListItem*);
protected:
/**
* Loads the <UML:Enum> element including its enumliterals.
*/
bool load( TQDomElement & element );
private:
/**
* Initializes key variables of the class.
*/
void init();
};
#endif // ENUM_H
|