本文整理汇总了C++中UmlRelation::roleType方法的典型用法代码示例。如果您正苦于以下问题:C++ UmlRelation::roleType方法的具体用法?C++ UmlRelation::roleType怎么用?C++ UmlRelation::roleType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UmlRelation
的用法示例。
在下文中一共展示了UmlRelation::roleType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gen_python_decl
void UmlClass::gen_python_decl(QByteArray s, bool descr)
{
QByteArray st = PythonSettings::classStereotype(stereotype());
if (st == "ignored")
return;
const char * p = bypass_comment(s);
while (*p != 0) {
if (!strncmp(p, "${comment}", 10))
p += 10;
else if (!strncmp(p, "${description}", 14))
p += 14;
else if (!strncmp(p, "${docstring}", 12))
p += 12;
else if (!strncmp(p, "${name}", 7)) {
p += 7;
writeq(name());
}
else if (!strncmp(p, "${inherit}", 10)) {
p += 10;
const QVector<UmlItem*> ch = children();
bool inh = FALSE;
for (int i = 0; i != ch.size(); i += 1) {
if (ch[i]->kind() == aRelation) {
UmlRelation * rel = (UmlRelation *) ch[i];
aRelationKind k = rel->relationKind();
if (((k == aGeneralisation) || (k == aRealization)) &&
!rel->pythonDecl().isEmpty()) {
if (inh)
fw.write(", ");
else {
inh = TRUE;
fw.write('(');
}
rel->roleType()->write();
}
}
}
if (inh)
fw.write(')');
else if (isPython_2_2())
fw.write("(object)");
break;
}
else if (!descr && ((*p == '\r') || (*p == '\n') || (*p == ':')))
break;
else if (*p == '@')
manage_alias(p);
else
writeq(*p++);
}
}
示例2: memo_ref
void UmlClass::memo_ref() {
classes.addElement(this);
UmlItem::memo_ref();
const QVector<UmlItem> ch = children();
if (inherited_opers == 0)
add_inherited_opers(0);
for (unsigned i = 0; i != ch.size(); i += 1) {
if (ch[i]->kind() == aRelation) {
UmlRelation * rel = (UmlRelation *) ch[i];
aRelationKind k = rel->relationKind();
if ((k == aGeneralisation) || (k == aRealization))
rel->roleType()->subClasses.addElement(this);
}
}
unload(TRUE, FALSE);
}
示例3: add_inherited_opers
void UmlClass::add_inherited_opers(Vector * ops)
{
if (inherited_opers == 0) {
const QVector<UmlItem*> ch = children();
inherited_opers = new Vector;
for (int i = 0; i != ch.size(); i += 1) {
switch (ch[i]->kind()) {
case aRelation: {
UmlRelation * rel = (UmlRelation *) ch[i];
aRelationKind k = rel->relationKind();
if ((k == aGeneralisation) || (k == aRealization))
rel->roleType()->add_inherited_opers(inherited_opers);
}
break;
case anOperation: {
UmlOperation * op = (UmlOperation *) ch[i];
if ((op->visibility() == PublicVisibility) &&
(op->name()[0] != '~') &&
(op->name() != name()))
inherited_opers->addElement(op);
}
default:
break;
}
}
}
if (ops != 0)
for (unsigned i = 0; i != inherited_opers->size(); i += 1)
if (! ops->contains(inherited_opers->elementAt(i)))
ops->addElement(inherited_opers->elementAt(i));
unload(TRUE, FALSE);
}
示例4: write_relation_as_attribute
void UmlRelation::write_relation_as_attribute(FileOut & out) {
UmlRelation * first = side(TRUE);
Q3CString s;
UmlClass * base;
if ((first->parent()->stereotype() == "stereotype") &&
(first->roleType()->stereotype() == "metaclass")) {
if (this != first)
return;
base = first->roleType();
s = "base_" + base->name();
}
else {
base = 0;
switch (_lang) {
case Uml:
s = roleName();
break;
case Cpp:
if (cppDecl().isEmpty())
return;
s = true_name(roleName(), cppDecl());
break;
default: // Java
if (javaDecl().isEmpty())
return;
s = true_name(roleName(), javaDecl());
}
}
out.indent();
out << "<ownedAttribute xmi:type=\"uml:Property\" name=\"" << s << '"';
out.id(this);
if (base != 0)
out.ref(first, "association", "EXT_");
else {
write_visibility(out);
write_scope(out);
if (isReadOnly())
out << " isReadOnly=\"true\"";
if (isDerived()) {
out << " isDerived=\"true\"";
if (isDerivedUnion())
out << " isDerivedUnion=\"true\"";
}
if (isOrdered())
out << " isOrdered=\"true\"";
if (isUnique())
out << " isUnique=\"true\"";
if (first->_assoc_class != 0)
out.ref(first->_assoc_class, "association");
else
out.ref(first, "association", "ASSOC_");
out << " aggregation=\"";
if (this == first) {
parent()->memo_relation(this);
if (_gen_eclipse) {
switch (relationKind()) {
case anAggregation:
case aDirectionalAggregation:
out << "shared";
break;
case anAggregationByValue:
case aDirectionalAggregationByValue:
out << "composite";
break;
default:
out << "none";
}
}
else
out << "none";
}
else if (_gen_eclipse)
out << "none";
else {
switch (relationKind()) {
case anAggregation:
case aDirectionalAggregation:
out << "shared";
break;
case anAggregationByValue:
case aDirectionalAggregationByValue:
out << "composite";
break;
default:
out << "none";
}
}
out << '"';
}
out << ">\n";
out.indent(+1);
//.........这里部分代码省略.........
示例5: gen_php_decl
void UmlClass::gen_php_decl(QCString s, bool descr) {
QCString st = PhpSettings::classStereotype(stereotype());
if (st == "ignored")
return;
const char * p = bypass_comment(s);
UmlRelation * extend = 0;
while (*p != 0) {
if (!strncmp(p, "${comment}", 10))
p += 10;
else if (!strncmp(p, "${description}", 14))
p += 14;
else if (!strncmp(p, "${visibility}", 13)) {
p += 13;
UmlItem::write(visibility(), phpLanguage);
fw.write(' ');
}
else if (!strncmp(p, "${final}", 8)) {
p += 8;
if (isPhpFinal())
fw.write("final ");
}
else if (!strncmp(p, "${abstract}", 11)) {
p += 11;
if (isAbstract())
fw.write("abstract ");
}
else if (!strncmp(p, "${name}", 7)) {
p += 7;
writeq(name());
generics();
}
else if (!strncmp(p, "${extends}", 10)) {
p += 10;
const QVector<UmlItem> ch = children();
for (unsigned i = 0; i != ch.size(); i += 1) {
if (ch[i]->kind() == aRelation) {
UmlRelation * rel = (UmlRelation *) ch[i];
aRelationKind k = rel->relationKind();
if (((k == aGeneralisation) ||
(k == aRealization)) &&
(!rel->phpDecl().isEmpty()) &&
((st == "interface") ||
(PhpSettings::classStereotype(rel->roleType()->stereotype()) != "interface"))) {
extend = rel;
fw.write(" extends ");
rel->roleType()->write();
break;
}
}
}
}
else if (!strncmp(p, "${implements}", 13)) {
p += 13;
const QVector<UmlItem> ch = children();
const char * sep = " implements ";
for (unsigned i = 0; i != ch.size(); i += 1) {
if (ch[i]->kind() == aRelation) {
UmlRelation * rel = (UmlRelation *) ch[i];
aRelationKind k = rel->relationKind();
if ((rel != extend) &&
((k == aGeneralisation) ||
(k == aRealization)) &&
(!rel->phpDecl().isEmpty())) {
fw.write(sep);
sep = ", ";
rel->roleType()->write();
}
}
}
}
else if (*p == '\r')
p += 1;
else if (*p == '\n') {
if (descr) {
fw.write("<br />");
p += 1;
}
else {
fw.write(' ');
do
p += 1;
while ((*p != 0) && (*p <= ' '));
}
}
else if ((*p == '{') || (*p == ';')) {
if (descr)
fw.write(*p++);
else
break;
}
//.........这里部分代码省略.........
示例6: gen_cpp_decl
void UmlClass::gen_cpp_decl(QCString s, bool descr) {
const char * p = (descr)
? (const char *) s
: (const char *) bypass_comment(s);
while (*p) {
if (!strncmp(p, "${comment}", 10))
p += 10;
else if (!strncmp(p, "${description}", 14))
p += 14;
else if (!strncmp(p, "${type}", 7)) {
p += 7;
bool find = FALSE;
if (baseType().type != 0) {
UmlClass * mother = baseType().type;
const QVector<UmlItem> ch = children();
for (unsigned i = 0; i != ch.size(); i += 1) {
if (ch[i]->kind() == aRelation) {
UmlRelation * rel = (UmlRelation *) ch[i];
aRelationKind k = rel->relationKind();
if (((k == aGeneralisation) ||
(k == aRealization)) &&
(rel->roleType() == mother)) {
rel->roleType()->write();
generate(actuals(), mother, TRUE);
find = TRUE;
break;
}
}
}
}
if (! find)
UmlItem::write(baseType(), cppLanguage);
}
else if (!strncmp(p, "${template}", 11)) {
p += 11;
generate(formals());
}
else if (!strncmp(p, "${name}", 7)) {
p += 7;
writeq(name());
}
else if (!strncmp(p, "${inherit}", 10)) {
p += 10;
const QVector<UmlItem> ch = children();
const char * sep = " : ";
for (unsigned i = 0; i != ch.size(); i += 1) {
if (ch[i]->kind() == aRelation) {
UmlRelation * rel = (UmlRelation *) ch[i];
aRelationKind k = rel->relationKind();
if (((k == aGeneralisation) ||
(k == aRealization)) &&
!rel->cppDecl().isEmpty()) {
fw.write(sep);
// UmlItem::write else G++ call UmlClass::write(QCString) !
UmlItem::write((rel->cppVisibility() == DefaultVisibility)
? rel->visibility() : rel->cppVisibility(),
cppLanguage);
fw.write((rel->cppVirtualInheritance()) ? " virtual " : " ");
rel->roleType()->write();
generate(actuals(), rel->roleType(), TRUE);
sep = ", ";
}
}
}
}
else if (*p == '{') {
if (descr)
fw.write(*p++);
else
break;
}
else if (*p == '\r')
p += 1;
else if (*p == '\n') {
if (descr) {
fw.write("<br />");
p += 1;
}
else {
fw.write(' ');
do
p += 1;
while ((*p != 0) && (*p <= ' '));
}
}
else if (*p == '@')
manage_alias(p);
else
writeq(*p++);
}
}
示例7: gen_java_decl
void UmlClass::gen_java_decl(QByteArray s, bool descr)
{
const char * p = bypass_comment(s);
UmlRelation * extend = 0;
while (*p != 0) {
if (!strncmp(p, "${comment}", 10))
p += 10;
else if (!strncmp(p, "${description}", 14))
p += 14;
else if (!strncmp(p, "${public}", 9)) {
p += 9;
if (isJavaPublic())
fw.write("public ");
}
else if (!strncmp(p, "${visibility}", 13)) {
p += 13;
UmlItem::write(visibility(), javaLanguage);
fw.write(' ');
}
else if (!strncmp(p, "${final}", 8)) {
p += 8;
if (isJavaFinal())
fw.write("final ");
}
else if (!strncmp(p, "${abstract}", 11)) {
p += 11;
if (isAbstract())
fw.write("abstract ");
}
else if (!strncmp(p, "${name}", 7)) {
p += 7;
writeq(name());
generics();
}
else if (!strncmp(p, "${extends}", 10)) {
p += 10;
const QVector<UmlItem*> ch = children();
for (int i = 0; i != ch.size(); i += 1) {
if (ch[i]->kind() == aRelation) {
UmlRelation * rel = (UmlRelation *) ch[i];
aRelationKind k = rel->relationKind();
if (((k == aGeneralisation) ||
(k == aRealization)) &&
(!rel->javaDecl().isEmpty()) &&
((JavaSettings::classStereotype(stereotype()) == "interface") ||
(JavaSettings::classStereotype(rel->roleType()->stereotype()) != "interface"))) {
extend = rel;
fw.write(" extends ");
rel->roleType()->write();
generate(actuals(), rel->roleType(), FALSE);
break;
}
}
}
}
else if (!strncmp(p, "${implements}", 13)) {
p += 13;
const QVector<UmlItem*> ch = children();
const char * sep = " implements ";
for (int i = 0; i != ch.size(); i += 1) {
if (ch[i]->kind() == aRelation) {
UmlRelation * rel = (UmlRelation *) ch[i];
aRelationKind k = rel->relationKind();
if ((rel != extend) &&
((k == aGeneralisation) ||
(k == aRealization)) &&
(!rel->javaDecl().isEmpty())) {
fw.write(sep);
sep = ", ";
rel->roleType()->write();
generate(actuals(), rel->roleType(), FALSE);
}
}
}
}
else if (!strncmp(p, "${@}", 4))
p += 4;
else if (*p == '\r')
p += 1;
else if (*p == '\n') {
if (descr) {
fw.write("<br />");
p += 1;
}
else {
fw.write(' ');
do
p += 1;
//.........这里部分代码省略.........