File: UmlBaseOperation.h

package info (click to toggle)
bouml 4.21-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 73,336 kB
  • ctags: 55,459
  • sloc: cpp: 290,644; makefile: 228; sh: 13
file content (552 lines) | stat: -rw-r--r-- 16,382 bytes parent folder | download
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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
#ifndef _UMLBASEOPERATION_H
#define _UMLBASEOPERATION_H


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

#include "UmlParameter.h"
class UmlOperation;
class UmlClass;
struct UmlParameter;
class UmlItem;

//  Manage the class's operations
class UmlBaseOperation : public UmlClassMember {
  public:
    // returns a new operation named 'name' 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 UmlOperation * create(UmlClass * parent, const char * s);

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

    // indicates if the body is generated even if preserve body is set, returns TRUE if yes
    bool isBodyGenerationForced();

    // to set if the body is generated even if preserve body is set
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_isBodyGenerationForced(bool v);

    // indicates if the operation is abstract, returns TRUE if yes
    bool isAbstract();

    // to set the 'abstract' flag
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_isAbstract(bool y);

    // returns the operation value type
    const UmlTypeSpec & returnType();

    // to set the operation value type
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_ReturnType(const UmlTypeSpec & t);

    // returns (in java a copy of) the parameters list
    const QValueList<UmlParameter> params();

    // adds a parameter at the given rank (0...)
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool addParameter(unsigned rank, const UmlParameter & p);

    // remove the parameter of the given rank (0...)
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool removeParameter(unsigned rank);

    // replace the parameter at the given rank (0...)
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool replaceParameter(unsigned rank, const UmlParameter & p);

    // returns the exceptions
    const QValueList<UmlTypeSpec> exceptions();

    // adds the exception at the given rank (0...)
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool addException(unsigned rank, const UmlTypeSpec & t);

    // remove the exception of the given rank (0...)
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool removeException(unsigned rank);

    // replaces the exception at the given rank (0...)
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool replaceException(unsigned rank, const UmlTypeSpec & t);

    // return the behaviors (state and activities) implementing the operation
    const QVector<UmlItem> methods() const;

    // in case the operation is a 'get' operation, returns the associated
    // attribute or relation
    UmlClassMember * getOf();

    // in case the operation is a 'set' operation, returns the associated
    // attribute or relation
    UmlClassMember * setOf();

#ifdef WITHCPP
    // returns TRUE if the operation is declared const in C++
    bool isCppConst();

    // to set if the operation is declared const in C++
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_isCppConst(bool y);

    // returns TRUE if the operation is a friend in C++
    bool isCppFriend();

    // to set if the operation is a friend in C++
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_isCppFriend(bool y);

    // returns TRUE if the operation is declared virtual in C++
    bool isCppVirtual();

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

    // returns TRUE if the operation is declared inline in C++
    bool isCppInline();

    // to set if the operation is declared inline in C++
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_isCppInline(bool y);

    // returns the operation's definition in C++, notes that the declaration
    // is returned by the inherited ClassItemBase::CppDecl() operation
    const QCString & cppDef();

    // sets the operation's definition in C++, notes that the declaration
    // is set through the inherited ClassItemBase::set_CppDecl() operation
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_CppDef(const char * s);

    // returns the operation's body in C++, useless if the def does not
    // contains ${body}. Note that the body is get each time from BOUML
    // for memory size reason
    QCString cppBody();

    // sets the operation's body in C++, useless if the def does not 
    // contains ${body}
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_CppBody(const char * s);

    // in case the operation is a 'get' or 'set' operation, returns how
    // the operation's C++ name must be generated
    const QCString & cppNameSpec();

    // in case the operation is a 'get' or 'set' operation, returns how
    // the operation's C++ name must be generated
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_CppNameSpec(const char * s);
#endif

#ifdef WITHCPP
    // return the if the C++ definition is frozen, only for getter/setter operation
    bool cppGetSetFrozen();

    // set the if the C++ definition is frozen, only for getter/setter operation
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_CppGetSetFrozen(bool v);
#endif

#ifdef WITHCPP
    // indicate if the indent of the C++ body is contextual or absolute
    bool cppContextualBodyIndent();

    // set if the indent of the C++ body is contextual or absolute
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_CppContextualBodyIndent(bool v);
#endif

#ifdef WITHJAVA
    // returns TRUE if the operation is declared final in JAVA
    bool isJavaFinal();

    // to set if the operation is declared final in JAVA
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_isJavaFinal(bool y);

    // returns TRUE if the operation is declared synchronized in JAVA
    bool isJavaSynchronized();

    // to set if the operation is declared synchronized in JAVA
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_isJavaSynchronized(bool y);

    // returns the operation's definition in Java, notes that it is
    // already made by the inherited JavaDecl operation
    const QCString & javaDef();

    // sets the operation's definition in Java, notes that it is
    // already made by the inherited set_JavaDecl operation
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_JavaDef(const char * s);

    // returns the operation's body in Java++, useless if the def does
    // not contains ${body} Note that the body is get each time from BOUML
    // for memory size reason
    QCString javaBody();

    // sets the operation's body in Java, useless if the def does not 
    // contains ${body}
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_JavaBody(const char * s);

    // in case the operation is a 'get' or 'set' operation, returns how
    // the operation's JAVA name must be generated
    const QCString & javaNameSpec();

    // in case the operation is a 'get' or 'set' operation, returns how
    // the operation's JAVA name must be generated
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_JavaNameSpec(const char * s);
#endif

#ifdef WITHJAVA
    // return the if the Java definition is frozen, only for getter/setter operation
    bool javaGetSetFrozen();

    // set the if the Java definition is frozen, only for getter/setter operation
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_JavaGetSetFrozen(bool v);
#endif

#ifdef WITHJAVA
    // indicate if the indent of the Java body is contextual or absolute
    bool javaContextualBodyIndent();

    // set if the indent of the Java body is contextual or absolute
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_JavaContextualBodyIndent(bool v);
#endif

#ifdef WITHPHP
    // returns TRUE if the operation is declared final in PHP
    bool isPhpFinal();

    // to set if the operation is declared final in PHP
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_isPhpFinal(bool y);

    // returns the operation's definition in Php, notes that it is
    // already made by the inherited PhpDecl operation
    const QCString & phpDef();

    // sets the operation's definition in Php, notes that it is
    // already made by the inherited set_PhpDecl operation
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_PhpDef(const char * s);

    // returns the operation's body in Php++, useless if the def does
    // not contains ${body} Note that the body is get each time from BOUML
    // for memory size reason
    QCString phpBody();

    // sets the operation's body in Php, useless if the def does not 
    // contains ${body}
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_PhpBody(const char * s);

    // in case the operation is a 'get' or 'set' operation, returns how
    // the operation's PHP name must be generated
    const QCString & phpNameSpec();

    // in case the operation is a 'get' or 'set' operation, returns how
    // the operation's PHP name must be generated
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_PhpNameSpec(const char * s);
#endif

#ifdef WITHPHP
    // return the if the Php definition is frozen, only for getter/setter operation
    bool phpGetSetFrozen();

    // set the if the Php definition is frozen, only for getter/setter operation
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_PhpGetSetFrozen(bool v);
#endif

#ifdef WITHPHP
    // indicate if the indent of the PHP body is contextual or absolute
    bool phpContextualBodyIndent();

    // set if the indent of the PHP body is contextual or absolute
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_PhpContextualBodyIndent(bool v);
#endif

#ifdef WITHPYTHON
    // returns the operation's definition in Python, notes that it is
    // already made by the inherited PythonDecl operation
    const QCString & pythonDef();

    // sets the operation's definition in Python, notes that it is
    // already made by the inherited set_PythonDecl operation
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_PythonDef(const char * s);

    // returns the operation's body in Python++, useless if the def does
    // not contains ${body} Note that the body is get each time from BOUML
    // for memory size reason
    QCString pythonBody();

    // sets the operation's body in Python, useless if the def does not 
    // contains ${body}
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_PythonBody(const char * s);

    // in case the operation is a 'get' or 'set' operation, returns how
    // the operation's PYTHON name must be generated
    const QCString & pythonNameSpec();

    // in case the operation is a 'get' or 'set' operation, returns how
    // the operation's PYTHON name must be generated
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_PythonNameSpec(const char * s);
#endif

#ifdef WITHPYTHON
    // return the if the Python definition is frozen, only for getter/setter operation
    bool pythonGetSetFrozen();

    // set the if the Python definition is frozen, only for getter/setter operation
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_PythonGetSetFrozen(bool v);
#endif

#ifdef WITHPYTHON
    // indicate if the indent of the Python body is contextual or absolute
    bool pythonContextualBodyIndent();

    // set if the indent of the Python body is contextual or absolute
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_PythonContextualBodyIndent(bool v);
#endif

#ifdef WITHPYTHON
    // return the  decorators
    const QCString & pythonDecorators();

    // set the  decorators
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_PythonDecorators(const char * v);
#endif

#ifdef WITHIDL
    // returns TRUE if the operation is declared oneway in IDL
    bool isIdlOneway();

    // to set if the operation is declared oneway in IDL
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_isIdlOneway(bool y);

    // in case the operation is a 'get' or 'set' operation, returns how
    // the operation's IDL name must be generated
    const QCString & idlNameSpec();

    // in case the operation is a 'get' or 'set' operation, returns how
    // the operation's IDL name must be generated
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_IdlNameSpec(const char * s);
#endif

#ifdef WITHIDL
    // return the if the IDL definition is frozen, only for getter/setter operation
    bool idlGetSetFrozen();

    // set the if the IDL definition is frozen, only for getter/setter operation
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_IdlGetSetFrozen(bool v);
#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 _force_body_generation : 1;

    bool _abstract : 1;

#ifdef WITHCPP
    bool _cpp_const : 1;

    bool _cpp_friend : 1;

    bool _cpp_virtual : 1;

    bool _cpp_inline : 1;
#endif

#ifdef WITHJAVA
    bool _java_final : 1;

    bool _java_synchronized : 1;
#endif

#ifdef WITHPHP
    bool _php_final : 1;
#endif

#ifdef WITHIDL
    bool _idl_oneway : 1;
#endif

#ifdef WITHCPP
    bool _cpp_get_set_frozen : 1;
#endif

#ifdef WITHJAVA
    bool _java_get_set_frozen : 1;
#endif

#ifdef WITHPHP
    bool _php_get_set_frozen : 1;
#endif

#ifdef WITHPYTHON
    bool _python_get_set_frozen : 1;
#endif

#ifdef WITHIDL
    bool _idl_get_set_frozen : 1;
#endif

#ifdef WITHCPP
    bool _cpp_contextual_body_indent : 1;
#endif

#ifdef WITHJAVA
    bool _java_contextual_body_indent : 1;
#endif

#ifdef WITHPHP
    bool _php_contextual_body_indent : 1;
#endif

#ifdef WITHPYTHON
    bool _python_contextual_body_indent : 1;
#endif

    UmlTypeSpec _return_type;

    QValueList<UmlParameter> _params;

    QValueList<UmlTypeSpec> _exceptions;

#ifdef WITHCPP
    QCString _cpp_def;

    QCString _cpp_name_spec;
#endif

#ifdef WITHJAVA
    QCString _java_name_spec;
#endif

#ifdef WITHPHP
    QCString _php_name_spec;
#endif

#ifdef WITHPYTHON
    QCString _python_name_spec;

    QCString _python_decorators;
#endif

#ifdef WITHIDL
    QCString _idl_name_spec;
#endif

    // exclusive with set_of
    UmlClassMember * _get_of;

    // exclusive with get_of
    UmlClassMember * _set_of;


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

    virtual void read_uml_();

#ifdef WITHCPP
    virtual void read_cpp_();
#endif

#ifdef WITHJAVA
    virtual void read_java_();
#endif

#ifdef WITHPHP
    virtual void read_php_();
#endif

#ifdef WITHPYTHON
    //internal, do NOT use it
    
    virtual void read_python_();
#endif

#ifdef WITHIDL
    virtual void read_idl_();
#endif

};

inline UmlBaseOperation::UmlBaseOperation(void * id, const QCString & n) : UmlClassMember(id, n) {
  _get_of = 0;
  _set_of = 0;
}

#endif