File: UmlBaseOperation.cpp

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 (714 lines) | stat: -rw-r--r-- 15,267 bytes parent folder | download | duplicates (2)
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
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714

#include "UmlBaseOperation.h"
#include "UmlOperation.h"
#include "UmlClass.h"

#include "UmlCom.h"
#include "UmlBaseClass.h"
#include "UmlClassMember.h"
UmlOperation * UmlBaseOperation::create(UmlClass * parent, const char * s)
{
  return (UmlOperation *) parent->create_(anOperation, s);
}

anItemKind UmlBaseOperation::kind() {
  return anOperation;
}

bool UmlBaseOperation::isBodyGenerationForced() {
  read_if_needed_();
  return _force_body_generation;
}

bool UmlBaseOperation::set_isBodyGenerationForced(bool v) {
  bool vv;

  if (set_it_(vv, v, setIsForceBodyGenCmd)) {
    _force_body_generation = v;
    return TRUE;
  }
  else
    return FALSE;
}

bool UmlBaseOperation::isAbstract() {
  read_if_needed_();
    
  return _abstract;
}

bool UmlBaseOperation::set_isAbstract(bool y) {
  bool b;
  
  if (set_it_(b, y, setIsAbstractCmd)) {
    _abstract = y;
    if (y)
      ((UmlBaseClass *) parent())->set_isAbstract(y);
    return TRUE;
  }
  else
    return FALSE;
}

const UmlTypeSpec & UmlBaseOperation::returnType() {
  read_if_needed_();
    
  return _return_type;
}

bool UmlBaseOperation::set_ReturnType(const UmlTypeSpec & t) {
  return set_it_(_return_type, t, setReturnTypeCmd);
}

const QValueList<UmlParameter> UmlBaseOperation::params() {
  read_if_needed_();
    
  return _params;
}

bool UmlBaseOperation::addParameter(unsigned rank, const UmlParameter & p) {
  UmlCom::send_cmd(_identifier, addParameterCmd, rank, p.dir, p.name, 
		   p.default_value, p.type);
  if (UmlCom::read_bool()) {
    if (_defined)
      _params.insert(_params.at(rank), p);
    return TRUE;
  }
  else
    return FALSE;
}

bool UmlBaseOperation::removeParameter(unsigned rank) {
  UmlCom::send_cmd(_identifier, removeParameterCmd, rank);
  if (UmlCom::read_bool()) {
    if (_defined)
      _params.remove(_params.at(rank));
    return TRUE;
  }
  else
    return FALSE;
}

bool UmlBaseOperation::replaceParameter(unsigned rank, const UmlParameter & p) {
  UmlCom::send_cmd(_identifier, replaceParameterCmd, rank, p.dir, p.name, 
		   p.default_value, p.type);
  if (UmlCom::read_bool()) {
    if (_defined)
      _params[rank] = p;
    return TRUE;
  }
  else
    return FALSE;
}

const QValueList<UmlTypeSpec> UmlBaseOperation::exceptions() {
  read_if_needed_();
    
  return _exceptions;
}

bool UmlBaseOperation::addException(unsigned rank, const UmlTypeSpec & t) {
  UmlCom::send_cmd(_identifier, addExceptionCmd, rank, t);
  if (UmlCom::read_bool()) {
    if (_defined)
      _exceptions.insert(_exceptions.at(rank), t);
    return TRUE;
  }
  else
    return FALSE;
}

bool UmlBaseOperation::removeException(unsigned rank) {
  UmlCom::send_cmd(_identifier, removeExceptionCmd, rank);
  if (UmlCom::read_bool()) {
    if (_defined)
      _exceptions.remove(_exceptions.at(rank));
    return TRUE;
  }
  else
    return FALSE;
}

bool UmlBaseOperation::replaceException(unsigned rank, const UmlTypeSpec & t) {
  UmlCom::send_cmd(_identifier, replaceExceptionCmd, rank, t);
  if (UmlCom::read_bool()) {
    if (_defined)
      _exceptions[rank] = t;
    return TRUE;
  }
  else
    return FALSE;
}

UmlClassMember * UmlBaseOperation::getOf() {
  read_if_needed_();
    
  return _get_of;
}

UmlClassMember * UmlBaseOperation::setOf() {
  read_if_needed_();
    
  return _set_of;
}

#ifdef WITHCPP
bool UmlBaseOperation::isCppConst() {
  read_if_needed_();
    
  return _cpp_const;
}

bool UmlBaseOperation::set_isCppConst(bool y) {
  bool b;
  
  if (set_it_(b, y, setIsCppConstCmd)) {
    _cpp_const = y;
    return TRUE;
  }
  else
    return FALSE;
}

bool UmlBaseOperation::isCppFriend() {
  read_if_needed_();
    
  return _cpp_friend;
}

bool UmlBaseOperation::set_isCppFriend(bool y) {
  bool b;
  
  if (set_it_(b, y, setIsCppFriendCmd)) {
    _cpp_friend = y;
    return TRUE;
  }
  else
    return FALSE;
}

bool UmlBaseOperation::isCppVirtual() {
  read_if_needed_();
    
  return _cpp_virtual;
}

bool UmlBaseOperation::set_isCppVirtual(bool y) {
  bool b;
  
  if (set_it_(b, y, setIsCppVirtualCmd)) {
    _cpp_virtual = y;
    return TRUE;
  }
  else
    return FALSE;
}

bool UmlBaseOperation::isCppInline() {
  read_if_needed_();
    
  return _cpp_inline;
}

bool UmlBaseOperation::set_isCppInline(bool y) {
  bool b;
  
  if (set_it_(b, y, setIsCppInlineCmd)) {
    _cpp_inline = y;
    return TRUE;
  }
  else
    return FALSE;
}

const QCString & UmlBaseOperation::cppDef() {
  read_if_needed_();
    
  return _cpp_def;
}

bool UmlBaseOperation::set_CppDef(const char * s) {
  return set_it_(_cpp_def, s, setCppDefCmd);
}

QCString UmlBaseOperation::cppBody() {
  // not memorized in the instance for memory size reason
  UmlCom::send_cmd(_identifier, cppBodyCmd);
  return UmlCom::read_string();
}

bool UmlBaseOperation::set_CppBody(const char * s) {
  // not memorized in the instance for memory size reason
  UmlCom::send_cmd(_identifier, setCppBodyCmd, s);
  return UmlCom::read_bool();
}

const QCString & UmlBaseOperation::cppNameSpec() {
  read_if_needed_();
    
  return _cpp_name_spec;
}

bool UmlBaseOperation::set_CppNameSpec(const char * s) {
  return set_it_(_cpp_name_spec, s, setCppNameSpecCmd);
}
#endif

#ifdef WITHCPP
bool UmlBaseOperation::cppGetSetFrozen() {
  read_if_needed_();
  return _cpp_get_set_frozen;
}

bool UmlBaseOperation::set_CppGetSetFrozen(bool v) {
  bool vv;

  if (set_it_(vv, v, setCppFrozenCmd)) {
    _cpp_get_set_frozen = v;
    return TRUE;
  }
  else
    return FALSE;
}
#endif

#ifdef WITHCPP
bool UmlBaseOperation::cppContextualBodyIndent() {
  read_if_needed_();
  return _cpp_contextual_body_indent;
}

bool UmlBaseOperation::set_CppContextualBodyIndent(bool v) {
  UmlCom::send_cmd(_identifier, setCppContextualBodyIndentCmd, (char) v);
  if (UmlCom::read_bool()) {
    _cpp_contextual_body_indent = v;
    return TRUE;
  }
  else
    return FALSE;
}
#endif

#ifdef WITHJAVA
bool UmlBaseOperation::isJavaFinal() {
  read_if_needed_();
    
  return _java_final;
}

bool UmlBaseOperation::set_isJavaFinal(bool y) {
  bool b;
  
  if (set_it_(b, y, setJavaFinalCmd)) {
    _java_final = y;
    return TRUE;
  }
  else
    return FALSE;
}

bool UmlBaseOperation::isJavaSynchronized() {
  read_if_needed_();
    
  return _java_synchronized;
}

bool UmlBaseOperation::set_isJavaSynchronized(bool y) {
  bool b;
  
  if (set_it_(b, y, setJavaSynchronizedCmd)) {
    _java_synchronized = y;
    return TRUE;
  }
  else
    return FALSE;
}

const QCString & UmlBaseOperation::javaDef() {
  return javaDecl();
}

bool UmlBaseOperation::set_JavaDef(const char * s) {
  return set_JavaDecl(s);
}

QCString UmlBaseOperation::javaBody() {
  // not memorized in the instance for memory size reason
  UmlCom::send_cmd(_identifier, javaBodyCmd);
  return UmlCom::read_string();
}

bool UmlBaseOperation::set_JavaBody(const char * s) {
  // not memorized in the instance for memory size reason
  UmlCom::send_cmd(_identifier, setJavaBodyCmd, s);
  return UmlCom::read_bool();
}

const QCString & UmlBaseOperation::javaNameSpec() {
  read_if_needed_();
    
  return _java_name_spec;
}

bool UmlBaseOperation::set_JavaNameSpec(const char * s) {
  return set_it_(_java_name_spec, s, setJavaNameSpecCmd);
}
#endif

#ifdef WITHJAVA
bool UmlBaseOperation::javaGetSetFrozen() {
  read_if_needed_();
  return _java_get_set_frozen;
}

bool UmlBaseOperation::set_JavaGetSetFrozen(bool v) {
  bool vv;

  if (set_it_(vv, v, setJavaFrozenCmd)) {
    _java_get_set_frozen = v;
    return TRUE;
  }
  else
    return FALSE;
}
#endif

#ifdef WITHJAVA
bool UmlBaseOperation::javaContextualBodyIndent() {
  read_if_needed_();
  return _java_contextual_body_indent;
}

bool UmlBaseOperation::set_JavaContextualBodyIndent(bool v) {
  UmlCom::send_cmd(_identifier, setJavaContextualBodyIndentCmd, (char) v);
  if (UmlCom::read_bool()) {
    _java_contextual_body_indent = v;
    return TRUE;
  }
  else
    return FALSE;
}
#endif

#ifdef WITHPHP
bool UmlBaseOperation::isPhpFinal() {
  read_if_needed_();
    
  return _php_final;
}

bool UmlBaseOperation::set_isPhpFinal(bool y) {
  bool b;
  
  if (set_it_(b, y, setPhpFinalCmd)) {
    _php_final = y;
    return TRUE;
  }
  else
    return FALSE;
}

const QCString & UmlBaseOperation::phpDef() {
  return phpDecl();
}

bool UmlBaseOperation::set_PhpDef(const char * s) {
  return set_PhpDecl(s);
}

QCString UmlBaseOperation::phpBody() {
  // not memorized in the instance for memory size reason
  UmlCom::send_cmd(_identifier, phpBodyCmd);
  return UmlCom::read_string();
}

bool UmlBaseOperation::set_PhpBody(const char * s) {
  // not memorized in the instance for memory size reason
  UmlCom::send_cmd(_identifier, setPhpBodyCmd, s);
  return UmlCom::read_bool();
}

const QCString & UmlBaseOperation::phpNameSpec() {
  read_if_needed_();
    
  return _php_name_spec;
}

bool UmlBaseOperation::set_PhpNameSpec(const char * s) {
  return set_it_(_php_name_spec, s, setPhpNameSpecCmd);
}
#endif

#ifdef WITHPHP
bool UmlBaseOperation::phpGetSetFrozen() {
  read_if_needed_();
  return _php_get_set_frozen;
}

bool UmlBaseOperation::set_PhpGetSetFrozen(bool v) {
  bool vv;

  if (set_it_(vv, v, setPhpFrozenCmd)) {
    _php_get_set_frozen = v;
    return TRUE;
  }
  else
    return FALSE;
}
#endif

#ifdef WITHPHP
bool UmlBaseOperation::phpContextualBodyIndent() {
  read_if_needed_();
  return _php_contextual_body_indent;
}

bool UmlBaseOperation::set_PhpContextualBodyIndent(bool v) {
  UmlCom::send_cmd(_identifier, setPhpContextualBodyIndentCmd, (char) v);
  if (UmlCom::read_bool()) {
    _php_contextual_body_indent = v;
    return TRUE;
  }
  else
    return FALSE;
}
#endif

#ifdef WITHPYTHON
const QCString & UmlBaseOperation::pythonDef() {
  return pythonDecl();
}

bool UmlBaseOperation::set_PythonDef(const char * s) {
  return set_PythonDecl(s);
}

QCString UmlBaseOperation::pythonBody() {
  // not memorized in the instance for memory size reason
  UmlCom::send_cmd(_identifier, pythonBodyCmd);
  return UmlCom::read_string();
}

bool UmlBaseOperation::set_PythonBody(const char * s) {
  // not memorized in the instance for memory size reason
  UmlCom::send_cmd(_identifier, setPythonBodyCmd, s);
  return UmlCom::read_bool();
}

const QCString & UmlBaseOperation::pythonNameSpec() {
  read_if_needed_();
    
  return _python_name_spec;
}

bool UmlBaseOperation::set_PythonNameSpec(const char * s) {
  return set_it_(_python_name_spec, s, setPythonNameSpecCmd);
}
#endif

#ifdef WITHPYTHON
bool UmlBaseOperation::pythonGetSetFrozen() {
  read_if_needed_();
  return _python_get_set_frozen;
}

bool UmlBaseOperation::set_PythonGetSetFrozen(bool v) {
  bool vv;

  if (set_it_(vv, v, setPythonFrozenCmd)) {
    _python_get_set_frozen = v;
    return TRUE;
  }
  else
    return FALSE;
}
#endif

#ifdef WITHPYTHON
bool UmlBaseOperation::pythonContextualBodyIndent() {
  read_if_needed_();
  return _python_contextual_body_indent;
}

bool UmlBaseOperation::set_PythonContextualBodyIndent(bool v) {
  UmlCom::send_cmd(_identifier, setPythonContextualBodyIndentCmd, (char) v);
  if (UmlCom::read_bool()) {
    _python_contextual_body_indent = v;
    return TRUE;
  }
  else
    return FALSE;
}
#endif

#ifdef WITHPYTHON
const QCString & UmlBaseOperation::pythonDecorators() {
  read_if_needed_();
  return _python_decorators;
}

bool UmlBaseOperation::set_PythonDecorators(const char * v) {
  return set_it_(_python_decorators, v, setPythonDecoratorsCmd);
}
#endif

#ifdef WITHIDL
bool UmlBaseOperation::isIdlOneway() {
  read_if_needed_();
    
  return _idl_oneway;
}

bool UmlBaseOperation::set_isIdlOneway(bool y) {
  bool b;
  
  if (set_it_(b, y, setIsIdlOnewayCmd)) {
    _idl_oneway = y;
    return TRUE;
  }
  else
    return FALSE;
}

const QCString & UmlBaseOperation::idlNameSpec() {
  read_if_needed_();
    
  return _idl_name_spec;
}

bool UmlBaseOperation::set_IdlNameSpec(const char * s) {
  return set_it_(_idl_name_spec, s, setIdlNameSpecCmd);
}
#endif

#ifdef WITHIDL
bool UmlBaseOperation::idlGetSetFrozen() {
  read_if_needed_();
  return _idl_get_set_frozen;
}

bool UmlBaseOperation::set_IdlGetSetFrozen(bool v) {
  bool vv;

  if (set_it_(vv, v, setIdlFrozenCmd)) {
    _idl_get_set_frozen = v;
    return TRUE;
  }
  else
    return FALSE;
}
#endif

void UmlBaseOperation::unload(bool rec, bool del) {
  _return_type.explicit_type = 0;
  _params.clear();
  _exceptions.clear();
#ifdef WITHCPP
  _cpp_def = 0;
  _cpp_name_spec = 0;
#endif
#ifdef WITHJAVA
  _java_name_spec = 0;
#endif
#ifdef WITHPHP
  _php_name_spec = 0;
#endif
#ifdef WITHPYTHON
  _python_name_spec = 0;
  _python_decorators = 0;
#endif
#ifdef WITHIDL
  _idl_name_spec = 0;
#endif
  UmlBaseClassMember::unload(rec, del);
}

void UmlBaseOperation::read_uml_() {
  UmlBaseClassMember::read_uml_();
  _return_type.type = (UmlClass *) UmlBaseItem::read_();
  if (_return_type.type == 0)
    _return_type.explicit_type = UmlCom::read_string();
  _abstract = UmlCom::read_bool();
  
  _force_body_generation = UmlCom::read_bool();
  
  unsigned n;
  
  for (n = UmlCom::read_unsigned(); n; n -= 1) {
    UmlParameter param;
    
    param.dir = (aDirection) UmlCom::read_char();
    param.type.type = (UmlClass *) UmlBaseItem::read_();
    if (param.type.type == 0)
      param.type.explicit_type = UmlCom::read_string();
    param.name = UmlCom::read_string();
    param.default_value = UmlCom::read_string();
    _params.append(param);
  }
  
  for (n = UmlCom::read_unsigned(); n; n -= 1) {
    UmlTypeSpec exception;
    
    exception.type = (UmlClass *) UmlBaseItem::read_();
    if (exception.type == 0)
      exception.explicit_type = UmlCom::read_string();
    _exceptions.append(exception);
  }
  _get_of = (UmlClassMember *) UmlBaseItem::read_();
  _set_of = (UmlClassMember *) UmlBaseItem::read_();
}

#ifdef WITHCPP
void UmlBaseOperation::read_cpp_() {
  UmlBaseClassMember::read_cpp_();
  _cpp_const = UmlCom::read_bool();
  _cpp_friend = UmlCom::read_bool();
  _cpp_virtual = UmlCom::read_bool();
  _cpp_inline = UmlCom::read_bool();
  _cpp_def = UmlCom::read_string();
  _cpp_name_spec = UmlCom::read_string();
  _cpp_get_set_frozen = UmlCom::read_bool();
  _cpp_contextual_body_indent = UmlCom::read_bool();
}
#endif

#ifdef WITHJAVA
void UmlBaseOperation::read_java_() {
  UmlBaseClassMember::read_java_();
  _java_final = UmlCom::read_bool();
  _java_synchronized = UmlCom::read_bool();
  _java_name_spec = UmlCom::read_string();
  _java_get_set_frozen = UmlCom::read_bool();
  _java_contextual_body_indent = UmlCom::read_bool();
}
#endif

#ifdef WITHPHP
void UmlBaseOperation::read_php_() {
  UmlBaseClassMember::read_php_();
  _php_final = UmlCom::read_bool();
  _php_name_spec = UmlCom::read_string();
  _php_get_set_frozen = UmlCom::read_bool();
  _php_contextual_body_indent = UmlCom::read_bool();
}
#endif

#ifdef WITHPYTHON
void UmlBaseOperation::read_python_() {
  UmlBaseClassMember::read_python_();
  _python_decorators = UmlCom::read_string();
  _python_name_spec = UmlCom::read_string();
  _python_get_set_frozen = UmlCom::read_bool();
  _python_contextual_body_indent = UmlCom::read_bool();
}
#endif

#ifdef WITHIDL
void UmlBaseOperation::read_idl_() {
  UmlBaseClassMember::read_idl_();
  _idl_oneway = UmlCom::read_bool();
  _idl_name_spec = UmlCom::read_string();
  _idl_get_set_frozen = UmlCom::read_bool();
}
#endif