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 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369
|
#include "UmlBaseClass.h"
#include "UmlClass.h"
#include "UmlItem.h"
#include "UmlClassDiagram.h"
#include "UmlArtifact.h"
#include "UmlComponent.h"
#include "UmlPackage.h"
#include "UmlCom.h"
#include "ClassGlobalCmd.h"
UmlClass * UmlBaseClass::create(UmlItem * parent, const char * s)
{
return (UmlClass *) parent->create_(aClass, s);
}
anItemKind UmlBaseClass::kind() {
return aClass;
}
bool UmlBaseClass::isAbstract() {
read_if_needed_();
return _abstract;
}
bool UmlBaseClass::set_isAbstract(bool y) {
return set_it_(_abstract, y, setIsAbstractCmd);
}
const UmlTypeSpec & UmlBaseClass::baseType() {
read_if_needed_();
return _base_type;
}
bool UmlBaseClass::set_BaseType(const UmlTypeSpec & t) {
return set_it_(_base_type, t, setBaseTypeCmd);
}
QValueList<UmlFormalParameter> UmlBaseClass::formals() {
UmlCom::send_cmd(_identifier, formalsCmd);
QValueList<UmlFormalParameter> formals;
for (unsigned n = UmlCom::read_unsigned(); n; n -= 1) {
UmlFormalParameter f;
f.read_();
formals.append(f);
}
return formals;
}
bool UmlBaseClass::removeFormal(unsigned int rank) {
UmlCom::send_cmd(_identifier, removeFormalCmd, rank);
return UmlCom::read_bool();
}
bool UmlBaseClass::addFormal(unsigned int rank, const UmlFormalParameter & formal) {
UmlCom::send_cmd(_identifier, addFormalCmd, rank, formal._name,
formal._type, formal._default_value, formal._extends);
return UmlCom::read_bool();
}
bool UmlBaseClass::replaceFormal(unsigned int rank, const UmlFormalParameter & formal) {
UmlCom::send_cmd(_identifier, replaceFormalCmd, rank, formal._name,
formal._type, formal._default_value, formal._extends);
return UmlCom::read_bool();
}
QValueList<UmlActualParameter> UmlBaseClass::actuals() {
UmlCom::send_cmd(_identifier, actualsCmd);
QValueList<UmlActualParameter> actuals;
for (unsigned n = UmlCom::read_unsigned(); n; n -= 1) {
UmlActualParameter a;
a.read_();
actuals.append(a);
}
return actuals;
}
bool UmlBaseClass::replaceActual(unsigned int rank, const UmlTypeSpec & type) {
UmlCom::send_cmd(_identifier, replaceActualCmd, rank, type);
return UmlCom::read_bool();
}
UmlClassDiagram * UmlBaseClass::associatedDiagram() {
read_if_needed_();
return _assoc_diagram;
}
bool UmlBaseClass::set_AssociatedDiagram(UmlClassDiagram * d) {
UmlCom::send_cmd(_identifier, setAssocDiagramCmd, ((UmlBaseItem *) d)->_identifier);
if (UmlCom::read_bool()) {
_assoc_diagram = d;
return TRUE;
}
else
return FALSE;
}
UmlArtifact * UmlBaseClass::associatedArtifact() {
UmlCom::send_cmd(_identifier, assocArtifactCmd);
return (UmlArtifact *) UmlBaseItem::read_();
}
const QVector<UmlComponent> UmlBaseClass::associatedComponents() {
UmlCom::send_cmd(_identifier, assocComponentCmd);
QVector<UmlComponent> result;
unsigned n = UmlCom::read_unsigned();
result.resize(n);
for (unsigned index = 0; index != n; index += 1)
result.insert(index, (UmlComponent *) UmlBaseItem::read_());
return result;
}
#ifdef WITHCPP
bool UmlBaseClass::isCppExternal() {
read_if_needed_();
return _cpp_external;
}
bool UmlBaseClass::set_isCppExternal(bool y) {
bool r;
if (set_it_(r, y, setIsCppExternalCmd)) {
_cpp_external = y;
return TRUE;
}
else
return FALSE;
}
#endif
#ifdef WITHJAVA
bool UmlBaseClass::isJavaExternal() {
read_if_needed_();
return _java_external;
}
bool UmlBaseClass::set_isJavaExternal(bool y) {
bool r;
if (set_it_(r, y, setIsJavaExternalCmd)) {
_java_external = y;
return TRUE;
}
else
return FALSE;
}
bool UmlBaseClass::isJavaPublic() {
read_if_needed_();
return _java_public;
}
bool UmlBaseClass::set_isJavaPublic(bool y) {
bool r;
if (set_it_(r, y, setIsJavaPublicCmd)) {
_java_public = y;
return TRUE;
}
else
return FALSE;
}
bool UmlBaseClass::isJavaFinal() {
read_if_needed_();
return _java_final;
}
bool UmlBaseClass::set_isJavaFinal(bool y) {
bool r;
if (set_it_(r, y, setIsJavaFinalCmd)) {
_java_final = y;
return TRUE;
}
else
return FALSE;
}
#endif
#ifdef WITHIDL
const UmlTypeSpec & UmlBaseClass::switchType() {
read_if_needed_();
return _switch_type;
}
bool UmlBaseClass::set_SwitchType(const UmlTypeSpec & t) {
return set_it_(_switch_type, t, setSwitchTypeCmd);
}
bool UmlBaseClass::isIdlExternal() {
read_if_needed_();
return _idl_external;
}
bool UmlBaseClass::set_isIdlExternal(bool y) {
bool r;
if (set_it_(r, y, setIsIdlExternalCmd)) {
_idl_external = y;
return TRUE;
}
else
return FALSE;
}
bool UmlBaseClass::isIdlLocal() {
read_if_needed_();
return _idl_local;
}
bool UmlBaseClass::set_isIdlLocal(bool y) {
bool r;
if (set_it_(r, y, setIsIdlLocalCmd)) {
_idl_local = y;
return TRUE;
}
else
return FALSE;
}
bool UmlBaseClass::isIdlCustom() {
read_if_needed_();
return _idl_custom;
}
bool UmlBaseClass::set_isIdlCustom(bool y) {
bool r;
if (set_it_(r, y, setIsIdlCustomCmd)) {
_idl_custom = y;
return TRUE;
}
else
return FALSE;
}
#endif
UmlClass * UmlBaseClass::get(const QCString & n, const UmlPackage * p)
{
if (p == 0) {
UmlClass * x = _classes[n];
if (x != 0)
return x;
}
UmlCom::send_cmd(classGlobalCmd, findClassCmd,
(p) ? p->_identifier : 0, n);
return (UmlClass *) UmlBaseItem::read_();
}
void UmlBaseClass::unload(bool rec, bool del) {
_base_type.explicit_type = 0;
#ifdef WITHIDL
_switch_type.explicit_type = 0;
#endif
UmlBaseClassItem::unload(rec, del);
}
bool UmlBaseClass::set_Name(const QCString & s) {
if (!UmlBaseItem::set_Name(s))
return FALSE;
const QVector<UmlItem> ch = children();
QCString destr = "~" + name();
for (unsigned i = 0; i != ch.size(); i += 1) {
if (ch[i]->kind() == anOperation) {
if (ch[i]->name() == name())
ch[i]->set_Name(s);
else if (ch[i]->name() == destr)
ch[i]->set_Name("~" + s);
}
}
return TRUE;
}
QDict<UmlClass> UmlBaseClass::_classes(1001);
UmlBaseClass::UmlBaseClass(void * id, const QCString & n)
: UmlClassMember(id, n) {
_assoc_diagram = 0;
_classes.insert(n, (UmlClass *) this);
if ((_classes.count() / 2) >= _classes.size())
_classes.resize(_classes.size() * 2 - 1);
}
void UmlBaseClass::read_uml_() {
_assoc_diagram = (UmlClassDiagram *) UmlBaseItem::read_();
UmlBaseClassMember::read_uml_();
_abstract = UmlCom::read_bool();
if (_stereotype == "typedef") {
_base_type.type = (UmlClass *) UmlBaseItem::read_();
if (_base_type.type == 0)
_base_type.explicit_type = UmlCom::read_string();
}
}
#ifdef WITHCPP
void UmlBaseClass::read_cpp_() {
UmlBaseClassMember::read_cpp_();
_cpp_external = UmlCom::read_bool();
}
#endif
#ifdef WITHJAVA
void UmlBaseClass::read_java_() {
UmlBaseClassMember::read_java_();
_java_public = UmlCom::read_bool();
_java_final = UmlCom::read_bool();
_java_external = UmlCom::read_bool();
}
#endif
#ifdef WITHIDL
void UmlBaseClass::read_idl_() {
UmlBaseClassItem::read_idl_();
_switch_type.type = (UmlClass *) UmlBaseItem::read_();
if (_switch_type.type == 0)
_switch_type.explicit_type = UmlCom::read_string();
_idl_local = UmlCom::read_bool();
_idl_custom = UmlCom::read_bool();
_idl_external = UmlCom::read_bool();
}
#endif
void UmlBaseClass::reread_if_needed_() {
if (_defined) {
UmlCom::send_cmd(_identifier, getUmlDefCmd);
read_uml_();
}
}
|