File: UmlRelation.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 (126 lines) | stat: -rw-r--r-- 2,977 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

#include "UmlRelation.h"

#include "UmlClass.h"
#include "CppSettings.h"
#include "JavaSettings.h"
#include "IdlSettings.h"
#include "PhpSettings.h"
#include "PythonSettings.h"
void UmlRelation::uml2cpp(bool) {
  bool composition = FALSE;
  
  switch (relationKind()) {
  case aGeneralisation:
  case aRealization:
    set_CppDecl("${type}");
    break;
  case aDependency:
    if (stereotype() == "friend")
      set_CppDecl("friend " +
		  CppSettings::classStereotype(roleType()->stereotype()) + 
		  " ${type};");
    else
      set_CppDecl("#include in source");
    break;
  case anAggregationByValue:
  case aDirectionalAggregationByValue:
    composition = TRUE;
    // no break
  default:
    {
      QCString st = CppSettings::classStereotype(parent()->stereotype());
      
      set_CppDecl(((st == "enum") || (st == "typedef") || (st == "ignored"))
		  ? QCString("")
		  : CppSettings::relationDecl(composition, multiplicity()));
    }
  }
}

void UmlRelation::uml2java(bool) {
  switch (relationKind()) {
  case aGeneralisation:
  case aRealization:
    set_JavaDecl("${type}");
    break;
  case aDependency:
    break;
  default:
    {
      QCString st = JavaSettings::classStereotype(parent()->stereotype());
      
      set_JavaDecl(((st == "enum") || (st == "ignored"))
		   ? QCString("")
		   : JavaSettings::relationDecl(multiplicity()));
    }
  }
}

void UmlRelation::uml2idl(bool) {
  switch (relationKind()) {
  case aGeneralisation:
  case aRealization:
  case aDependency:
    set_IdlDecl("${type}");
    break;
  default:
    {
      QCString st = IdlSettings::classStereotype(parent()->stereotype());
      
      if ((st == "enum") || (st == "typedef") || (st == "ignored"))
	set_IdlDecl("");
      else if (st == "union")
	set_IdlDecl(IdlSettings::unionRelationDecl(multiplicity()));
      else if (st == "valuetype")
	set_IdlDecl(IdlSettings::valuetypeRelationDecl(multiplicity()));
      else
	set_IdlDecl(IdlSettings::relationDecl(multiplicity()));
    }
  }
}

void UmlRelation::uml2php(bool) {
  switch (relationKind()) {
  case aGeneralisation:
  case aRealization:
  case aDependency:
    set_PhpDecl("${type}");
    break;
  default:
    {
      QCString st = PhpSettings::classStereotype(parent()->stereotype());
      
      if ((st == "enum") || (st == "ignored"))
	set_PhpDecl("");
      else
	set_PhpDecl(PhpSettings::relationDecl());
    }
  }
}

void UmlRelation::uml2Python(bool) {
  bool composition = FALSE;
  
  switch (relationKind()) {
  case aGeneralisation:
  case aRealization:
  case aDependency:
    set_PythonDecl("${type}");
    break;
  case anAggregationByValue:
  case aDirectionalAggregationByValue:
    composition = TRUE;
    // no break
  default:
    {
      QCString st = PythonSettings::classStereotype(parent()->stereotype());
      
      if ((st == "enum") || (st == "ignored"))
	set_PythonDecl("");
      else
	set_PythonDecl(PythonSettings::relationDecl(composition, multiplicity()));
    }
  }
}