File: UmlBaseRelation.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 (241 lines) | stat: -rw-r--r-- 6,534 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
#ifndef _UMLBASERELATION_H
#define _UMLBASERELATION_H


#include "UmlClassMember.h"
#include "aRelationKind.h"
#include "anItemKind.h"
#include <qcstring.h>
#include "UmlTypeSpec.h"

class UmlRelation;
class UmlClass;
class UmlOperation;
class UmlAttribute;

// Manage the relations between classes
class UmlBaseRelation : public UmlClassMember {
  public:
    // returns a new relation of the given 'kind' from 'start' to 'end'
    //
    // 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 UmlRelation * create(aRelationKind kind, UmlClass * start, UmlClass * end);

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

    // returns the kind of the relation
    aRelationKind relationKind();

    // if 'first' is true returns the relation associated to the
    // first role, else the relation associated to the second
    // role or 0/null if the relation is uni directional
    UmlRelation * side(bool first);

    // indicates if the relation is read only, returns TRUE if yes
    bool isReadOnly();

    // to set the 'read only' state of the relation
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_isReadOnly(bool y);

    // returns the default relation value, may be an empty string
    const QCString & defaultValue();

    // to set the default relation value ("" allowed)
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_DefaultValue(const char * s);

    // to set the stereotype
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    // redefined in case the relation is bidirectional to set the stereotype
    // of the relation corresponding to the other direction
    virtual bool set_Stereotype(const QCString & s);

    // returns the 'end' class (the 'start' class is the parent of the relation) no set !
    UmlClass * roleType();

    // return the associated class/type, may be an empty spec
    UmlTypeSpec association();

    // set the associated class/type, may be an empty spec
    //
    // On error : return FALSE in C++, produce a RuntimeException in Java
    bool set_Association(const UmlTypeSpec & t);

    // returns the name of the role
    const QCString & roleName();

    // to set the name of the role
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_RoleName(const char * s);

    // returns the multiplicity (may be an empty string)
    const QCString & multiplicity();

    // to set the multiplicity
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_Multiplicity(const char * s);

    // returns the 'get' operation of the relation, or 0 if it does not exist
    UmlOperation * getOperation();

    // to generate an associated 'get' operation
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool addGetOperation();

    // returns the 'set' operation of the relation, or 0 if it does not exist
    UmlOperation * setOperation();

    // to generate an associated 'set' operation
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool addSetOperation();

#ifdef WITHCPP
    // indicates if the inheritance is virtual in C++, returns TRUE if yes
    bool cppVirtualInheritance();

    // to set if the inheritance is virtual in C++
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_CppVirtualInheritance(bool y);

    // Indicate if the relation is 'mutable'
    bool isCppMutable();

    // Set if the relation is 'mutable'
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_isCppMutable(bool y);
#endif

#ifdef WITHJAVA
    // indicates if the relation is 'transient', returns TRUE if yes
    bool isJavaTransient();

    // to set the 'transient' state of the relation
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_isJavaTransient(bool y);
#endif

#ifdef WITHIDL
    // indicates if the relation is 'truncatable', returns TRUE if yes
    // have sense only for a valuetype inheritance
    bool isIdlTruncatableInheritance();

    // to set if the inheritance is 'truncatable'
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_isIdlTruncatableInheritance(bool y);

    // in case the relation is an IDL union's member returns the
    // corresponding 'case', an empty string in case it is not specified
    QCString idlCase();

    // to set the 'case' even the relation is not (already) known as
    // an IDL union's member
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_IdlCase(UmlAttribute * a);

    // to set the 'case' even the relation is not (already) known as
    // an IDL union's member
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_IdlCase(const char * s);
#endif

    // to unload the object to free memory, it will be reloaded
    // automatically if needed. args unused
    virtual void unload(bool = FALSE, bool = FALSE);


  private:
    bool _read_only;

#ifdef WITHCPP
    bool _cpp_virtual_inheritance : 1;

    bool _cpp_mutable;
#endif

#ifdef WITHJAVA
    bool _java_transient : 1;
#endif

#ifdef WITHIDL
    bool _idl_truncatable : 1;
#endif

    aRelationKind _rel_kind : 8;

    QCString _default_value;

    UmlClass * _role_type;

    QCString _role_name;

    QCString _multiplicity;

    UmlTypeSpec _association;

    UmlOperation * _get_oper;

    UmlOperation * _set_oper;

    // exclusive with idl_explicit_case
    UmlAttribute * _idl_case;

#ifdef WITHIDL
    QCString _idl_explicit_case;
#endif


  protected:
    //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

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

};

inline UmlBaseRelation::UmlBaseRelation(void * id, const QCString & n) : UmlClassMember(id, n) {
  _role_type = 0;
  _get_oper = 0;
  _set_oper = 0;
#ifdef WITHIDL
  _idl_case = 0;
#endif
}

#endif