File: UmlClass.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 (84 lines) | stat: -rw-r--r-- 2,009 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

#include "UmlClass.h"
#include "UmlDeploymentView.h"

#include "UmlArtifact.h"
#include "UmlCom.h"
#include "aLanguage.h"
#include "CppSettings.h"
#include "JavaSettings.h"
#include "IdlSettings.h"
#include "PhpSettings.h"
#include "PythonSettings.h"
void UmlClass::deploy(UmlDeploymentView * view) {
  int flags = deployable();
  
  if (flags == 0)
    return;
      
  UmlArtifact * a = associatedArtifact();
  
  if (a == 0) {
    UmlCom::trace("Create <i>artifact</i> " + name());
    
    a = UmlArtifact::create(view, name());
      
    if (a == 0) {
      UmlCom::trace("cannot create <i>artifact</i> named " + name());
      throw 0;
    }
  
    a->set_Stereotype("source");
    a->addAssociatedClass(this);
    a->set_CppHeader("");
    a->set_CppSource("");
    a->set_JavaSource("");
    a->set_IdlSource("");
    a->set_PhpSource("");
    a->set_PythonSource("");
  }
  
  if ((flags & (1 << cppLanguage)) != 0) {
    a->set_CppHeader(CppSettings::headerContent());
    a->set_CppSource(CppSettings::sourceContent());
  }
  
  if ((flags & (1 << javaLanguage)) != 0)
    a->set_JavaSource(JavaSettings::sourceContent());
  
  if ((flags & (1 << idlLanguage)) != 0)
    a->set_IdlSource(IdlSettings::sourceContent());
  
  if ((flags & (1 << phpLanguage)) != 0)
    a->set_PhpSource(PhpSettings::sourceContent());
  
  if ((flags & (1 << pythonLanguage)) != 0)
    a->set_PythonSource(PythonSettings::sourceContent());
}

int UmlClass::deployable() {
  QCString st = stereotype();
  
  if ((st == "metaclass") || (st == "stereotype"))
    return 0;
  
  int r = 0;
  
  if (!isCppExternal() && !cppDecl().isEmpty())
    r += (1 << cppLanguage);
  
  if (!isJavaExternal() && !javaDecl().isEmpty())
    r += (1 << javaLanguage);
  
  if (!isIdlExternal() && !idlDecl().isEmpty())
    r += (1 << idlLanguage);
  
  if (!isPhpExternal() && !phpDecl().isEmpty())
    r += (1 << phpLanguage);
  
  if (!isPythonExternal() && !pythonDecl().isEmpty())
    r += (1 << pythonLanguage);
  
  return r;
}