File: UmlUseCase.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 (76 lines) | stat: -rw-r--r-- 1,569 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

#include "UmlUseCase.h"
#include "FileOut.h"

void UmlUseCase::ref(FileOut & out) {
  out << "<UML:UseCase"; 
  out.idref(this); 
  out << "/>"; 
}

bool UmlUseCase::write_if_needed(FileOut & out) {
  // even if the use case doesn't have children 
  parent()->write(out); 
   
  out.indent(); 
  out << "<UML:UseCase name=\"";
  out.quote(name());
  out << '"'; 
  out.id(this); 
  out << " visibility=\"public\" isAbstract=\"false\" isActive=\"false\" >\n"; 
  out.indent(+1); 
  write_stereotype(out); 
  write_description_properties(out); 
     
  const QVector<UmlItem> ch = children(); 
  unsigned n = ch.size(); 
  bool used = FALSE; 
  bool haveRel= FALSE; 
     
  for (unsigned i = 0; i != n; i += 1) 
    if (ch[i]->kind() != aNcRelation) 
      used |= ch[i]->write_if_needed(out); 
    else 
      haveRel = TRUE; 
       
  if (used) { 
    out.indent(-1); 
    out.indent(); 
    out << "</UML:Namespace.ownedElement>\n"; 
  } 
   
  out.indent(-1); 
  out.indent(); 
  out << "</UML:UseCase>\n"; 
 
  if (haveRel) { 
    used = FALSE; 
    
    for (unsigned i = 0; i != n; i += 1)  
      if (ch[i]->kind() == aNcRelation) 
        used |= ch[i]->write_if_needed(out); 
       
    if (used) { 
      out.indent(-1); 
      out.indent(); 
      out << "</UML:Namespace.ownedElement>\n"; 
    } 
  }
 
  unload(); 
  
  return TRUE; 
}

void UmlUseCase::write(FileOut & out) {
  if (! _written) { 
    _written = TRUE; 
 
    // parent already written 
     
    out.indent(); 
    out << "<UML:Namespace.ownedElement>\n"; 
    out.indent(+1); 
  } 
}