/usr/lib/bouml/singleton/6017.bodies is in bouml-plugouts-src 4.21-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | class UmlClass
!!!128080.cpp!!! singleton() : void
// checking
QVector<UmlItem> ch = children();
int index;
bool ok = TRUE;
for (index = 0; index != (int) ch.size(); index += 1)
if (ch[index]->kind() != aNcRelation)
ok &= ((UmlClassItem *) ch[index])->check();
if (! ok)
return;
// the private constructor
UmlOperation * op = UmlBaseOperation::create(this, name());
if (op == 0)
UmlCom::trace(QCString("<font face=helvetica><b>cannot create constructor for <i>")
+ name() + "</i></b></font><br><hr><br>");
else {
op->set_Visibility(PrivateVisibility);
// the 'instance()' operation
op = UmlBaseOperation::create(this, "instance");
if (op == 0)
UmlCom::trace(QCString("<font face=helvetica><b>cannot create operation <i>instance</i> for <i>")
+ name() + "</i></b></font><br><hr><br>");
else {
op->set_Visibility(PublicVisibility);
op->set_isClassMember(TRUE);
UmlTypeSpec t;
QCString s;
t.type = this;
op->set_ReturnType(t);
// Cpp, try to reuse default declaration & definition
s = CppSettings::operationDecl();
if ((index = s.find("${type}")) != -1) {
s.insert(index + 7, " *");
op->set_CppDecl(s);
}
else {
UmlCom::trace("<font face=helvetica><b>strange default cpp operation declaration : no <i>${type}</i></b></font><br><hr><br>");
op->set_CppDecl("${comment}static ${type} * ${name}${(}${)};");
}
s = CppSettings::operationDef();
if (((s.find("${body}")) != -1) && ((index = s.find("${type}")) != -1))
s.insert(index + 7, " *");
else {
UmlCom::trace("<font face=helvetica><b>strange default cpp operation definition: no <i>${type}</i> or <i>${body}</i></b></font><br><hr><br>");
s = "${inline}${type} * ${class}::${name}${(}${)}${const}${volatile}${staticnl}{\n${body}}\n";
}
s.replace(s.findRev("${body}"), // cannot be -1 !
7,
" return (the == 0) ? the = new ${type}() : the;\n");
op->set_CppDef(s);
// Java, try to reuse default definition
s = JavaSettings::operationDef();
if ((index = s.findRev("${body}")) != -1)
op->set_JavaDecl(s.replace(index, 7,
" return (the == null) ? the = new ${type}() : the;\n"));
else {
UmlCom::trace("<font face=helvetica><b>strange default java operation definition: no <i>${body}</i></b></font><br><hr><br>");
op->set_JavaDecl(" ${comment}${final}static ${type} ${name}${(}${)}${throws}\n\
{\n\
return (the == null) ? the = new ${type}() : the;\n\
}\n");
}
op->set_isJavaFinal(TRUE);
// change the stereotype before the relation is add
// to set the canvas appropriate width, else the relation
// may be hidden
bool stereotype_changed;
if ((stereotype_changed = stereotype().isEmpty()) != 0)
set_Stereotype("singleton");
// the relation to the unique instance (cannot have a static variable
// to memorise it in the instance() operation in Java). class relation, private
UmlRelation * rel =
UmlBaseRelation::create(aDirectionalAssociation, this, this);
if (rel == 0) {
UmlCom::trace(QCString("<font face=helvetica><b>cannot create relation <i>the</i> for <i>")
+ name() + "</i></b></font><br><hr><br>");
if (stereotype_changed)
set_Stereotype("");
}
else {
rel->set_Visibility(PrivateVisibility);
rel->set_isClassMember(TRUE);
rel->set_RoleName("the");
rel->set_CppDecl(CppSettings::relationDecl(FALSE, "1"));
rel->set_JavaDecl(JavaSettings::relationDecl("1"));
}
}
}
!!!128080.java!!! singleton() : void
// checking
UmlItem[] ch = children();
int index;
boolean ok = true;
for (index = 0; index != ch.length; index += 1)
if (ch[index].kind() != anItemKind.aNcRelation)
ok &= ((UmlClassItem) ch[index]).check();
if (! ok)
return;
// the private constructor
UmlOperation op = UmlBaseOperation.create(this, name());
op.set_Visibility(aVisibility.PrivateVisibility);
// the 'instance()' operation
op = UmlBaseOperation.create(this, "instance");
op.set_Visibility(aVisibility.PublicVisibility);
op.set_isClassMember(true);
UmlTypeSpec t = new UmlTypeSpec();
StringBuffer s;
t.type = this;
op.set_ReturnType(t);
// Cpp, try to reuse default declaration & definition
s = new StringBuffer(CppSettings.operationDecl());
if ((index = s.indexOf("${type}")) != -1) {
s.insert(index + 7, " *");
op.set_CppDecl(s.toString());
}
else {
UmlCom.trace("<font face=helvetica><b>strange default cpp operation declaration : no <i>${type}</i></b></font><br><hr><br>");
op.set_CppDecl("${comment}static ${type} * ${name}${(}${)};");
}
s = new StringBuffer(CppSettings.operationDef());
if (((s.indexOf("${body}")) != -1) && ((index = s.indexOf("${type}")) != -1))
s.insert(index + 7, " *");
else {
UmlCom.trace("<font face=helvetica><b>strange default cpp operation definition: no <i>${type}</i> or <i>${body}</i></b></font><br><hr><br>");
s = new StringBuffer("${inline}${type} * ${class}.${name}${(}${)}${const}${volatile}${staticnl}{\n${body}}\n");
}
index = s.lastIndexOf("${body}"); // cannot be -1 !
s.replace(index, index + 7,
" return (the == 0) ? the = new ${type}() : the;\n");
op.set_CppDef(s.toString());
// Java, try to reuse default definition
s = new StringBuffer(JavaSettings.operationDef());
if ((index = s.lastIndexOf("${body}")) != -1)
op.set_JavaDecl(s.replace(index, index + 7,
" return (the == null) ? the = new ${type}() : the;\n")
.toString());
else {
UmlCom.trace("<font face=helvetica><b>strange default java operation definition: no <i>${body}</i></b></font><br><hr><br>");
op.set_JavaDecl(" ${comment}${final}static ${type} ${name}${(}${)}${throws}\n{\nreturn (the == null) ? the = new ${type}() : the;\n}\n");
}
op.set_isJavaFinal(true);
// change the stereotype before the relation is add
// to set the canvas appropriate width, else the relation
// may be hidden
if (stereotype() == "")
set_Stereotype("singleton");
// the relation to the unique instance (cannot have a static variable
// to memorise it in the instance() operation in Java). class relation, private
UmlRelation rel =
UmlBaseRelation.create(aRelationKind.aDirectionalAssociation, this, this);
rel.set_Visibility(aVisibility.PrivateVisibility);
rel.set_isClassMember(true);
rel.set_RoleName("the");
rel.set_CppDecl(CppSettings.relationDecl(false, "1"));
rel.set_JavaDecl(JavaSettings.relationDecl("1"));
|