File: UmlUseCaseView.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 (97 lines) | stat: -rw-r--r-- 1,830 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

#include "UmlUseCaseView.h"
#include "UmlItem.h"
#include "File.h"

#include "UmlCom.h"
UmlItem * UmlUseCaseView::item() {
  return this;
}

void UmlUseCaseView::readObject(File & f, QCString) {
  f.skipNextForm();
}

void UmlUseCaseView::import(UmlItem * parent, File & f)
{
  QCString s;

  if (f.read(s) != STRING)
    f.syntaxError(s, " use case view's name expected");

  QCString a;
  QCString id;
  QCString ste;
  QCString doc;
  QDict<QCString> prop;
  
  for (;;) {
    int k = f.readDefinitionBeginning(a, id, ste, doc, prop);

    if (k != ATOM)
      f.syntaxError(a);
    
    if (a == "file_name") {
      if (f.read(a) != STRING)
	f.syntaxError(a, "a filename");
      
      File f2(a, f.name());
      
      if (! f2.open(IO_ReadOnly))
	UmlCom::trace("<br>cannot open '" + a + "' referenced in "
		      + QCString(f.name()));
      else {     
        f2.read("(");
        f2.read("object");
        f2.read("Petal");
        f2.skipBlock();
      
        f2.read("(");
        f2.read("object");
        f2.read("Class_Category");
        import(parent, f2);
      }

      f.skipBlock();
      return;
    }
    else if (!id.isEmpty()) {
      f.unread(k, a);
      
      UmlUseCaseView * ucv;
      
      if (scanning) {
	ucv = UmlBaseUseCaseView::create(parent, s);
	
	if (ucv != 0)
	  newItem(ucv, id);
	
	if (!ste.isEmpty())
	  ucv->set_Stereotype(ste);
	
	if (!doc.isEmpty())
	  ucv->set_Description(doc);
	
	ucv->setProperties(prop);
      }
      else
	ucv = (UmlUseCaseView *) findItem(id, anUseCaseView);
      
      if (ucv == 0) {
	UmlCom::trace("<br>cannot create use case view named '" +
		      s + "' in '" + parent->fullName() + "'");
	throw 0;
      }
      
      ucv->Uc::import(f);
      return;
    }
    else
      f.skipNextForm();
  }

}

UmlUseCaseView::~UmlUseCaseView() {
}