本文整理汇总了C++中UmlRelation::set_Stereotype方法的典型用法代码示例。如果您正苦于以下问题:C++ UmlRelation::set_Stereotype方法的具体用法?C++ UmlRelation::set_Stereotype怎么用?C++ UmlRelation::set_Stereotype使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UmlRelation
的用法示例。
在下文中一共展示了UmlRelation::set_Stereotype方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: importInstantiate
void UmlClass::importInstantiate(File & f) {
if (scanning) {
f.skipNextForm();
return;
}
f.read("(");
f.read("object");
f.read("Instantiation_Relationship");
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 == "quidu")
break;
f.skipNextForm();
k = f.read(s2);
}
else
f.syntaxError(s2);
}
if (f.read(s2) != STRING)
f.syntaxError(s2, "quidu value");
UmlClass * target = (UmlClass *) findItem(s2, aClass);
if (target != 0) {
UmlRelation * r = UmlRelation::create(aRealization, this, target);
if (r == 0)
UmlCom::trace("<br>cannot create aRealization from '" +
fullName() + "' to '" + target->fullName() + "'");
else {
newItem(r, id);
if (!ste.isEmpty())
r->set_Stereotype(ste);
if (!doc.isEmpty())
r->set_Description(doc);
r->setProperties(prop);
}
}
f.skipBlock();
}
示例2: new_friend
bool UmlRelation::new_friend(Class * container, UmlClass * to,
Q3PtrList<UmlItem> & expected_order)
{
UmlClass * from = container->get_uml();
#ifdef DEBUG_BOUML
cout << "FRIEND from '" << from->name() << "' to '" << to->name() << "'\n";
#endif
const Q3PtrVector<UmlItem> & ch = from->children();
UmlItem ** v = ch.data();
UmlItem ** const vsup = v + ch.size();
for (;v != vsup; v += 1) {
if (((*v)->kind() == aRelation) &&
(((UmlRelation *) *v)->relationKind() == aDependency) &&
(((UmlRelation *) *v)->roleType() == to) &&
!neq((*v)->stereotype(), "friend")) {
expected_order.append(*v);
((UmlRelation *) *v)->set_usefull();
return TRUE;
}
}
// relation not found
UmlRelation * rel = UmlBaseRelation::create(aDependency, from, to);
if (rel == 0) {
UmlCom::trace(Q3CString("<font face=helvetica><b>cannot add friend relation in <i>")
+ from->name() + "</i> to <i>"
+ to->name() + "</i></b></font><br><hr><br>");
return FALSE;
}
expected_order.append(rel);
container->set_updated();
rel->set_CppDecl("Generated");
return rel->set_Stereotype("friend");
}
示例3: bind
bool UmlClass::bind(UmlClass * tmpl)
{
const Q3PtrVector<UmlItem> ch = children();
unsigned int n = ch.size();
int i;
for (i = 0; i != (int) n; i += 1) {
if ((ch[i]->kind() == aRelation) &&
(((UmlRelation *) ch[i])->roleType() == tmpl)) {
switch (((UmlRelation *) ch[i])->relationKind()) {
case aRealization:
((UmlRelation *) ch[i])->set_Stereotype("bind");
// no break
case aGeneralisation:
return TRUE;
default:
break;
}
}
}
// add realization
UmlRelation * r =
UmlRelation::create(aRealization, this, tmpl);
if (r == 0) {
UmlCom::trace("class reference '" + id() +
"' can't realize class reference '" + tmpl->id() + "'<br>");
return FALSE;
}
r->set_Stereotype("bind");
return TRUE;
}
示例4: 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);
//.........这里部分代码省略.........
示例5: set_unidir
void UmlRelation::set_unidir()
{
UmlRelation * r1 = side(TRUE);
UmlRelation * r2 = (r1 != this) ? this : side(FALSE);
if (r1->isReadOnly() || r2->isReadOnly()) {
UmlCom::trace(WrapperStr("<font face=helvetica>in <i>") + WrapperStr(Lex::filename().toAscii().constData())
+ "</i> line " + WrapperStr().setNum(Lex::line_number())
+ " <b>cannot remove relation between classes <i>"
+ roleType()->name() + "</i> and <i>" + parent()->name()
+ "</i> because one is read only</b></font><br>");
throw 0;
}
aRelationKind k;
switch (relationKind()) {
case anAssociation:
k = aDirectionalAssociation;
break;
case anAggregation:
k = aDirectionalAggregation;
break;
default:
k = aDirectionalAggregationByValue;
}
if (this == r1)
set_rel_kind(k);
else {
UmlRelation * rel =
UmlBaseRelation::create(aDirectionalAssociation,
(UmlClass *) parent(), roleType());
WrapperStr role = roleName();
rel->moveAfter(this);
rel->set_Visibility(visibility());
if (!description().isEmpty())
rel->set_Description(description());
if (isReadOnly())
rel->set_isReadOnly(TRUE);
if (isJavaTransient())
rel->set_isJavaTransient(TRUE);
if (isVolatile())
rel->set_isVolatile(TRUE);
if (isClassMember())
rel->set_isClassMember(TRUE);
if (!multiplicity().isEmpty())
rel->set_Multiplicity(multiplicity());
if (!defaultValue().isEmpty())
rel->set_DefaultValue(defaultValue());
if (!javaAnnotations().isEmpty())
rel->set_JavaAnnotations(javaAnnotations());
if (!stereotype().isEmpty())
rel->set_Stereotype(stereotype());
rel->set_JavaDecl(javaDecl());
UmlOperation * op;
UmlOperation * oper;
if (((op = getOperation()) != 0) &&
rel->addGetOperation() &&
((oper = rel->getOperation()) != 0))
copy(op, oper);
if (((op = setOperation()) != 0) &&
rel->addSetOperation() &&
((oper = rel->getOperation()) != 0))
copy(op, oper);
r1->deleteIt();
r2->deleteIt();
rel->set_RoleName(role);
}
}
示例6: new_one
//.........这里部分代码省略.........
container->set_updated();
}
if (rel->isReadOnly() != constp) {
rel->set_isReadOnly(constp);
container->set_updated();
}
if (rel->isJavaTransient() != transientp) {
rel->set_isJavaTransient(transientp);
container->set_updated();
}
if (rel->isVolatile() != volatilep) {
rel->set_isVolatile(volatilep);
container->set_updated();
}
if (rel->isClassMember() != staticp) {
rel->set_isClassMember(staticp);
container->set_updated();
}
if (neq(rel->multiplicity(), array)) {
rel->set_Multiplicity(array);
container->set_updated();
}
if (neq(rel->defaultValue(), value)) {
rel->set_DefaultValue(value);
container->set_updated();
}
if (nequal(rel->javaAnnotations(), annotation)) {
rel->set_JavaAnnotations(annotation);
container->set_updated();
}
if (neq(rel->stereotype(), st) &&
(rel->stereotype().isEmpty() ||
(JavaSettings::relationAttributeStereotype(rel->stereotype()) != st))) {
rel->set_Stereotype(st);
container->set_updated();
}
if (neq(rel->javaDecl(), decl)) {
rel->set_JavaDecl(decl);
container->set_updated();
}
// role name is the right one
rel->set_usefull();
expected_order.append(rel);
}
else {
#endif
rel->set_Visibility(visibility);
if (!comment.isEmpty())
rel->set_Description((decl.find("${description}") != -1)
? description : Lex::simplify_comment(comment));
if (constp)
rel->set_isReadOnly(TRUE);
if (transientp)
rel->set_isJavaTransient(TRUE);
if (volatilep)
rel->set_isVolatile(TRUE);
if (staticp)
rel->set_isClassMember(TRUE);
if (!array.isEmpty())
rel->set_Multiplicity(array);
if (! value.isEmpty())
rel->set_DefaultValue(value);
if (! annotation.isEmpty())
rel->set_JavaAnnotations(annotation);
rel->set_Stereotype(st);
rel->set_JavaDecl(decl);
rel->set_RoleName(name);
#ifdef ROUNDTRIP
if (roundtrip)
expected_order.append(rel);
}
#endif
return TRUE;
}
示例7: new_one
//.........这里部分代码省略.........
if (rel->isVolatile() != volatilep) {
rel->set_isVolatile(volatilep);
container->set_updated();
}
}
else {
#endif
rel->set_Visibility(visibility);
if (constp) rel->set_isReadOnly(TRUE);
if (staticp) rel->set_isClassMember(TRUE);
if (mutablep) rel->set_isCppMutable(TRUE);
if (volatilep) rel->set_isVolatile(TRUE);
#ifdef ROUNDTRIP
}
#endif
Q3CString decl;
if (typeform != "${type}") {
// array & modified are empty, pretype is empty ?
decl = CppSettings::relationDecl(TRUE, "*");
int index = typeform.find("<"); // cannot be -1
Q3CString st = typeform.left(index);
Q3CString st_uml = CppSettings::umlType(st);
#ifdef ROUNDTRIP
if (roundtrip) {
if (st_uml.isEmpty())
st_uml = st;
if (neq(rel->stereotype(), st_uml)) {
rel->set_Stereotype(st_uml);
container->set_updated();
}
}
else
#endif
rel->set_Stereotype((st_uml.isEmpty()) ? st : st_uml);
int index2;
if ((index2 = decl.find("<${type}>")) == -1) {
decl = " ${comment}${static}${mutable}${volatile}${const}${stereotype}<${type}> ${name}${value};";
index2 = decl.find("<${type}>");
}
decl.replace(index2, 9, typeform.mid(index));
}
else {
if (!array.isEmpty()) {
#ifdef ROUNDTRIP
if (roundtrip) {
if (neq(rel->multiplicity(), array)) {
rel->set_Multiplicity(array);
container->set_updated();
}
}
else
#endif
rel->set_Multiplicity(array);
}
decl = CppSettings::relationDecl(modifier != "*", array);
int index;
示例8: importRelations
void UmlClass::importRelations(File & f) {
Q3CString s;
f.read("(");
f.read("list");
if (f.read(s) != ATOM)
f.syntaxError(s, "an atom");
for (;;) {
switch (f.read(s)) {
case ')':
return;
case '(':
break;
default:
f.syntaxError(s);
}
f.read("object");
if (f.read(s) != ATOM)
f.syntaxError(s, "an atom");
aRelationKind rk;
Q3CString sr;
if (s == "Uses_Relationship") {
rk = aDependency;
sr = "dependency";
}
else if (s == "Inheritance_Relationship") {
rk = aGeneralisation;
sr = "generalisation";
}
else if (s == "Realize_Relationship") {
rk = aRealization;
sr = "realization";
}
else {
f.skipBlock();
continue;
}
// dependency or generalisation
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());
Q3CString target_id;
aVisibility visibility = PublicVisibility;
bool virtual_inheritance = FALSE;
bool a_friend = FALSE;
for (;;) {
if (k == ATOM) {
if (s2 == "quidu") {
if (f.read(target_id) != STRING)
f.syntaxError(target_id, "quidu value");
}
else if (s2 == "exportControl")
visibility = f.readVisibility();
else if (s2 == "virtual")
virtual_inheritance = f.readBool();
else if (s2 == "friend")
a_friend = f.readBool();
else
f.skipNextForm();
k = f.read(s2);
}
else if (k == ')')
break;
else
f.syntaxError(s2);
}
if (target_id.isEmpty())
f.syntaxError("quidu missing");
UmlClass * target = (UmlClass *) findItem(target_id, aClass);
if (target != 0) {
UmlRelation * r;
if (a_friend) {
if ((r = UmlRelation::create(rk, target, this)) == 0) {
UmlCom::trace("<br>cannot create " + sr + " from '" +
target->fullName() + "' to '" + fullName() + "'");
f.skipBlock();
return;
}
r->set_Stereotype("friend");
}
else {
//.........这里部分代码省略.........
示例9: manage_inherit
//.........这里部分代码省略.........
#endif
mother_name += "<" + after_gt;
Lex::come_back();
// must add inheritance before setting actuals
if (
#ifdef ROUNDTRIP
is_new && (
#endif
(rel = UmlBaseRelation::create(aRealization, this, mother.type)) == 0
#ifdef ROUNDTRIP
)
#endif
)
{
Lex::warn("cannot inherit <font color =\"red\">" +
Lex::quote(mother_name) + " </font>");
#ifdef DEBUG_DOUML
QLOG_INFO() << "cannot create <|---\n";
#endif
return FALSE;
}
else if (!get_actuals(mother.type, container, tmplts
#ifdef ROUNDTRIP
, !is_new
#endif
))
return FALSE;
#ifdef ROUNDTRIP
if (! is_new) {
if (neq(rel->stereotype(), "bind")) {
rel->set_Stereotype("bind");
the_class->set_updated();
}
}
else
#endif
rel->set_Stereotype("bind");
s = Lex::read_word();
}
}
if (mother.type == 0) {
mother.type = auxilarily_typedef(mother_name
#ifdef REVERSE
, libp
# ifdef ROUNDTRIP
, container_roundtrip
, container_expected_order
# endif
#endif
);
if (mother.type == 0)
return FALSE;
}
#ifdef ROUNDTRIP
if (rel == 0)
is_new = !roundtrip || ((rel = search_for_inherit(mother.type)) == 0);
#endif