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
|
#include "UmlBaseRelation.h"
#include "UmlRelation.h"
#include "UmlClass.h"
#include "UmlOperation.h"
#include "UmlAttribute.h"
#include "UmlCom.h"
UmlRelation * UmlBaseRelation::create(aRelationKind kind, UmlClass * start, UmlClass * end)
{
UmlCom::send_cmd(start->_identifier, createCmd, aRelation,
kind, end->_identifier);
UmlRelation * result = (UmlRelation *) UmlBaseItem::read_();
if (result != 0) {
start->reread_children_if_needed_();
switch (kind) {
case anAssociation:
case anAggregation:
case anAggregationByValue:
// bi-directional
end->reread_children_if_needed_();
break;
case aGeneralisation:
case aRealization:
if (!end->formals().isEmpty())
// to update actuals & base_type
start->reread_if_needed_();
default:
break;
}
}
return result;
}
anItemKind UmlBaseRelation::kind() {
return aRelation;
}
aRelationKind UmlBaseRelation::relationKind() {
read_if_needed_();
return _rel_kind;
}
UmlRelation * UmlBaseRelation::side(bool first) {
UmlCom::send_cmd(_identifier, sideCmd, (char) first);
return (UmlRelation *) UmlBaseItem::read_();
}
bool UmlBaseRelation::isReadOnly() {
read_if_needed_();
return _read_only;
}
bool UmlBaseRelation::set_isReadOnly(bool y) {
return set_it_(_read_only, y, setIsReadOnlyCmd);
}
const QCString & UmlBaseRelation::defaultValue() {
read_if_needed_();
return _default_value;
}
bool UmlBaseRelation::set_DefaultValue(const char * s) {
return set_it_(_default_value, s, setDefaultValueCmd);
}
bool UmlBaseRelation::set_Stereotype(const QCString & s) {
if (UmlBaseItem::set_Stereotype(s)) {
UmlBaseRelation * other = (UmlBaseRelation *) UmlBaseItem::read_();
if (other != 0)
other->_stereotype = s;
return TRUE;
}
else
return FALSE;
}
UmlClass * UmlBaseRelation::roleType() {
read_if_needed_();
return _role_type;
}
UmlTypeSpec UmlBaseRelation::association() {
read_if_needed_();
return _association;
}
bool UmlBaseRelation::set_Association(const UmlTypeSpec & t) {
if (set_it_(_association, t, setRelationAssocClassCmd)) {
UmlBaseRelation * other = (UmlBaseRelation *) UmlBaseItem::read_();
if (other != 0)
other->_association = t;
return TRUE;
}
else
return FALSE;
}
const QCString & UmlBaseRelation::roleName() {
read_if_needed_();
return _role_name;
}
bool UmlBaseRelation::set_RoleName(const char * s) {
return set_it_(_role_name, s, setRoleNameCmd);
}
const QCString & UmlBaseRelation::multiplicity() {
read_if_needed_();
return _multiplicity;
}
bool UmlBaseRelation::set_Multiplicity(const char * s) {
return set_it_(_multiplicity, s, setMultiplicityCmd);
}
UmlOperation * UmlBaseRelation::getOperation() {
read_if_needed_();
return _get_oper;
}
bool UmlBaseRelation::addGetOperation() {
UmlCom::send_cmd(_identifier, addGetOperCmd);
if (UmlCom::read_bool()) {
reread_children_if_needed_();
return TRUE;
}
else
return FALSE;
}
UmlOperation * UmlBaseRelation::setOperation() {
read_if_needed_();
return _set_oper;
}
bool UmlBaseRelation::addSetOperation() {
UmlCom::send_cmd(_identifier, addSetOperCmd);
if (UmlCom::read_bool()) {
reread_children_if_needed_();
return TRUE;
}
else
return FALSE;
}
#ifdef WITHCPP
bool UmlBaseRelation::cppVirtualInheritance() {
read_if_needed_();
return _cpp_virtual_inheritance;
}
bool UmlBaseRelation::set_CppVirtualInheritance(bool y) {
bool b;
if (set_it_(b, y, setCppVirtualInheritanceCmd)) {
_cpp_virtual_inheritance = y;
return TRUE;
}
else
return FALSE;
}
bool UmlBaseRelation::isCppMutable() {
read_if_needed_();
return _cpp_mutable;
}
bool UmlBaseRelation::set_isCppMutable(bool y) {
bool b;
if (set_it_(b, y, setIsCppMutableCmd)) {
_cpp_mutable = y;
return TRUE;
}
else
return FALSE;
}
#endif
#ifdef WITHJAVA
bool UmlBaseRelation::isJavaTransient() {
read_if_needed_();
return _java_transient;
}
bool UmlBaseRelation::set_isJavaTransient(bool y) {
bool b;
if (set_it_(b, y, setIsJavaTransientCmd)) {
_java_transient = y;
return TRUE;
}
else
return FALSE;
}
#endif
#ifdef WITHIDL
bool UmlBaseRelation::isIdlTruncatableInheritance() {
read_if_needed_();
return _idl_truncatable;
}
bool UmlBaseRelation::set_isIdlTruncatableInheritance(bool y) {
bool b;
if (set_it_(b, y, setIsIdlTruncatableCmd)) {
_idl_truncatable = y;
return TRUE;
}
else
return FALSE;
}
QCString UmlBaseRelation::idlCase() {
read_if_needed_();
return (_idl_case != 0) ? _idl_case->name() : _idl_explicit_case;
}
bool UmlBaseRelation::set_IdlCase(UmlAttribute * a) {
UmlCom::send_cmd(_identifier, setIdlCaseCmd, a->_identifier, "");
if (UmlCom::read_bool()) {
_idl_case = a;
_idl_explicit_case = 0;
return TRUE;
}
else
return FALSE;
}
bool UmlBaseRelation::set_IdlCase(const char * s) {
UmlCom::send_cmd(_identifier, setIdlCaseCmd, (void *) 0, s);
if (UmlCom::read_bool()) {
_idl_case = 0;
_idl_explicit_case = s;
return TRUE;
}
else
return FALSE;
}
#endif
void UmlBaseRelation::unload(bool rec, bool del) {
_role_name = 0;
_multiplicity = 0;
_default_value = 0;
#ifdef WITHIDL
_idl_explicit_case = 0;
#endif
UmlBaseClassMember::unload(rec, del);
}
void UmlBaseRelation::read_uml_() {
UmlBaseClassMember::read_uml_();
_rel_kind = (aRelationKind) UmlCom::read_char();
_role_type = (UmlClass *) UmlBaseItem::read_();
_association.type = (UmlClass *) UmlBaseItem::read_();
if (_association.type == 0)
_association.explicit_type = UmlCom::read_string();
_role_name = UmlCom::read_string();
_multiplicity = UmlCom::read_string();
_default_value = UmlCom::read_string();
_read_only = UmlCom::read_bool();
_get_oper = (UmlOperation *) UmlBaseItem::read_();
_set_oper = (UmlOperation *) UmlBaseItem::read_();
}
#ifdef WITHCPP
void UmlBaseRelation::read_cpp_() {
UmlBaseClassMember::read_cpp_();
_cpp_mutable = UmlCom::read_bool();
_cpp_virtual_inheritance = UmlCom::read_bool();
}
#endif
#ifdef WITHJAVA
void UmlBaseRelation::read_java_() {
UmlBaseClassMember::read_java_();
_java_transient = UmlCom::read_bool();
}
#endif
#ifdef WITHIDL
void UmlBaseRelation::read_idl_() {
UmlBaseClassItem::read_idl_();
_idl_truncatable = UmlCom::read_bool();
_idl_case = (UmlAttribute *) UmlBaseItem::read_();
if (_idl_case == 0)
_idl_explicit_case = UmlCom::read_string();
}
#endif
|