本文整理汇总了C++中UmlRelation::import方法的典型用法代码示例。如果您正苦于以下问题:C++ UmlRelation::import方法的具体用法?C++ UmlRelation::import怎么用?C++ UmlRelation::import使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UmlRelation
的用法示例。
在下文中一共展示了UmlRelation::import方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: import
void UmlRelation::import(File & f)
{
if (scanning)
f.skipBlock();
else {
Q3CString s;
if (f.read(s) != STRING)
f.syntaxError(s, "relation's name");
else if (*s == '$')
// unnamed
s = "";
Q3CString id;
Q3CString ste;
Q3CString doc;
Q3Dict<Q3CString> prop;
Q3CString s2;
int k;
do {
k = f.readDefinitionBeginning(s2, id, ste, doc, prop);
} while (id.isEmpty());
for (;;) {
if (k == ATOM) {
if (s2 == "roles")
break;
f.skipNextForm();
k = f.read(s2);
}
else
f.syntaxError(s);
}
f.read("(");
f.read("list");
f.read("role_list");
Role role_1;
Role role_2;
Role * role1 = &role_1;
Role * role2 = &role_2;
role_1.import(f);
role_2.import(f);
UmlRelation * r = 0;
bool bidir = role_1.is_navigable && role_2.is_navigable;
// place information in the logical side !
bool b = role_1.is_aggregate;
role_1.is_aggregate = role_2.is_aggregate;
role_2.is_aggregate = b;
role_1.is_aggregate |= role_1.is_byvalue;
role_2.is_aggregate |= role_2.is_byvalue;
if (bidir && role_2.is_aggregate) {
// manage bouml limitation : only role1 may be an aggregate
if (role_1.is_aggregate)
bidir = FALSE;
else {
// exchange roles
role1 = &role_2;
role2 = &role_1;
}
}
if ((role1->target != 0) && (role2->target != 0)) {
if (role1->is_navigable) {
r = UmlRelation::create(role1->rel_kind(bidir), role2->target, role1->target);
if (r == 0) {
UmlCom::trace("<br>cannot create relation '" + role1->name + "' from '" +
role2->target->fullName() + "' to '" +
role1->target->fullName() + "'");
f.read(")");
f.skipBlock();
return;
}
if (!ste.isEmpty())
r->set_Stereotype(ste);
if (! s.isEmpty())
r->set_Name(s);
r->import(role1);
}
if (role2->is_navigable) {
if (bidir) {
const Q3PtrVector<UmlItem> ch = role2->target->children();
r = (UmlRelation *) ch.at(ch.count() - 1);
}
else {
r = UmlRelation::create(role2->rel_kind(FALSE),role1->target, role2->target);
//.........这里部分代码省略.........