File: UmlBaseClass.h

package info (click to toggle)
bouml 2.19.2-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 42,364 kB
  • ctags: 33,402
  • sloc: cpp: 169,092; makefile: 135
file content (272 lines) | stat: -rw-r--r-- 7,987 bytes parent folder | download | duplicates (9)
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
#ifndef _UMLBASECLASS_H
#define _UMLBASECLASS_H


#include "UmlClassMember.h"
#include "anItemKind.h"
#include "UmlTypeSpec.h"
#include <qvaluelist.h>
#include <qvector.h>
#include <qcstring.h>
#include <qdict.h>

#include "UmlFormalParameter.h"
#include "UmlActualParameter.h"
class UmlClass;
class UmlItem;
class UmlFormalParameter;
class UmlActualParameter;
class UmlClassDiagram;
class UmlArtifact;
class UmlComponent;
class UmlPackage;

//  Manage the classes
class UmlBaseClass : public UmlClassMember {
  public:
    // returns a new class named 's' created under 'parent' 
    //
    // In case it cannot be created (the name is already used or
    // invalid, 'parent' cannot contain it etc ...) return 0 in C++
    // and produce a RuntimeException in Java
    static UmlClass * create(UmlItem * parent, const char * s);

    // returns the kind of the item
    virtual anItemKind kind();

    // returns TRUE in case the class is abstract
    bool isAbstract();

    // the set if the class is abstract
    //
    // On error return FALSE in C++, produce a RuntimeException in Java,
    // for instance you cannot set it to FALSE in case the class have
    // abstract operations
    bool set_isAbstract(bool y);

    // returns the type on which the class (in fact a typedef) is based
    const UmlTypeSpec & baseType();

    // to set the type on which the class (in fact a typedef) is based
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java, does not check that the class is (already) a typedef
    bool set_BaseType(const UmlTypeSpec & t);

    // returns (a copy of) the formals list
    QValueList<UmlFormalParameter> formals();

    // remove the formal of the given rank (0...), returns 0 on error
    //
    // On error return FALSE in C++, produce a RuntimeException in Java,
    // does not check that the class is (already) a typedef
    bool removeFormal(unsigned int rank);

    // adds a formal at the given rank (0...), returns 0 on error
    //
    //On error return FALSE in C++, produce a RuntimeException in Java,
    //does not check that the class is (already) a typedef
    
    bool addFormal(unsigned int rank, const UmlFormalParameter & formal);

    // replace the formal at the given rank (0...)
    //
    // On error return FALSE in C++, produce a RuntimeException in Java,
    // does not check that the class is (already) a typedef
    
    bool replaceFormal(unsigned int rank, const UmlFormalParameter & formal);

    // returns (a copy of) the actuals list
    QValueList<UmlActualParameter> actuals();

    // replace the actual value at the given rank (0...)
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool replaceActual(unsigned int rank, const UmlTypeSpec & type);

    // returns the optional associated diagram
    UmlClassDiagram * associatedDiagram();

    // sets the associated diagram, arg may be null to unset it
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_AssociatedDiagram(UmlClassDiagram * d);

    // returns the optional associated artifact,
    // to set it refer to the UmlBaseArtifact's operations
    // addAssociatedClass(), removeAssociatedClass() and
    // setAssociatedClasses()
    UmlArtifact * associatedArtifact();

    // returns the components realizing or providing the class.
    // To set them refer to the UmlBaseComponent's operation setAssociatedClasses()
    const QVector<UmlComponent> associatedComponents();

#ifdef WITHCPP
    // returns TRUE if the class is external, its definition
    // must contains how the name is made on the first line
    // (isCppExternal by default), the other lines if they exist
    // must contains the #include and may be using forms
    bool isCppExternal();

    // set if the class is external
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_isCppExternal(bool y);
#endif

#ifdef WITHJAVA
    // returns TRUE if the class is external, its definition
    // must contain how the name is made on the first line
    // (isJavaExternal by default), the other lines are ignored
    bool isJavaExternal();

    // set if the class is external
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_isJavaExternal(bool y);

    // returns TRUE is the class is public
    bool isJavaPublic();

    // set if the class is public
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_isJavaPublic(bool y);

    // returns TRUE is the class is final   
    bool isJavaFinal();

    // set if the class is final
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_isJavaFinal(bool y);
#endif

#ifdef WITHIDL
    // returns the switch's type, significant in case the class
    // is an union in IDL
    const UmlTypeSpec & switchType();

    // to set the switch type even the class is not (already) an IDL union
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_SwitchType(const UmlTypeSpec & t);

    // returns TRUE if the class is external, its definition
    // must contain how the name is made on the first line
    // (isIdlExternal by default), the other lines are ignored
    bool isIdlExternal();

    // set if the class is external
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_isIdlExternal(bool y);

    // returns TRUE if the class is local, have sense for an interface
    bool isIdlLocal();

    // set if the class is local, have sense for an interface
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_isIdlLocal(bool y);

    // returns TRUE is the class is custom, have sense for a valuetype
    bool isIdlCustom();

    // set if the class is custom have sense for aa valuetype
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_isIdlCustom(bool y);
#endif

    //returns the class having the name given in argument in case it
    //exist, else 0/null. In case the package is specified (not 0/null), 
    //the returned class will be defined in a sub-level of the package.
    
    static UmlClass * get(const QCString & n, const UmlPackage * p);

    // to unload the object to free memory, it will be reloaded automatically
    // if needed. Recursively done for the sub items if 'rec' is TRUE. 
    //
    // if 'del' is true the sub items are deleted in C++, and removed from the
    // internal dictionnary in C++ and Java (to allow it to be garbaged),
    // you will have to call Children() to re-access to them
    virtual void unload(bool rec = FALSE, bool del = FALSE);

    // to set the name
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    virtual bool set_Name(const QCString & s);

  friend class UmlBaseRelation;
  friend class UmlBaseArtifact;

  private:
    static QDict<UmlClass> _classes;

    bool _abstract;

#ifdef WITHCPP
    bool _cpp_external : 1;
#endif

#ifdef WITHJAVA
    bool _java_external : 1;

    bool _java_public : 1;

    bool _java_final : 1;
#endif

#ifdef WITHIDL
    bool _idl_external : 1;

    bool _idl_local : 1;

    bool _idl_custom : 1;
#endif
    

    UmlTypeSpec _base_type;

    UmlClassDiagram * _assoc_diagram;

#ifdef WITHIDL
    // union
    UmlTypeSpec _switch_type;
#endif


  protected:
    // the constructor, do not call it yourself !!!!!!!!!!
    UmlBaseClass(void * id, const QCString & n);

    //internal, do NOT use it
    
    virtual void read_uml_();

#ifdef WITHCPP
    //internal, do NOT use it
    
    virtual void read_cpp_();
#endif

#ifdef WITHJAVA
    //internal, do NOT use it
    
    virtual void read_java_();
#endif

#ifdef WITHIDL
    //internal, do NOT use it
    
    virtual void read_idl_();
#endif

    //internal, do NOT use it
    
    void reread_if_needed_();

};

#endif