本文整理汇总了C++中UMLClassifier::setBaseType方法的典型用法代码示例。如果您正苦于以下问题:C++ UMLClassifier::setBaseType方法的具体用法?C++ UMLClassifier::setBaseType怎么用?C++ UMLClassifier::setBaseType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UMLClassifier
的用法示例。
在下文中一共展示了UMLClassifier::setBaseType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: umbrellify
/**
* Create an Umbrello object from a PetalNode of the Logical View.
*
* @return True for success.
* Given a PetalNode for which the mapping to Umbrello is not yet
* implemented umbrellify() is a no-op but also returns true.
*/
bool umbrellify(PetalNode *node, UMLPackage *parentPkg = NULL)
{
if (node == NULL) {
uError() << "umbrellify: node is NULL";
return false;
}
QStringList args = node->initialArgs();
QString objType = args[0];
QString name = clean(args[1]);
Uml::IDType id = quid(node);
if (objType == "Class_Category") {
UMLObject *o = Import_Utils::createUMLObject(UMLObject::ot_Package, name, parentPkg);
o->setID(id);
PetalNode *logical_models = node->findAttribute("logical_models").node;
if (logical_models) {
UMLPackage *localParent = static_cast<UMLPackage*>(o);
PetalNode::NameValueList atts = logical_models->attributes();
for (int i = 0; i < atts.count(); ++i) {
umbrellify(atts[i].second.node, localParent);
}
} else if (!handleControlledUnit(node, name, id, parentPkg)) {
uDebug() << "umbrellify: handling of " << objType << " " << name
<< " is not yet implemented";
}
} else if (objType == "Class") {
UMLObject *o = Import_Utils::createUMLObject(UMLObject::ot_Class, name, parentPkg);
o->setID(id);
UMLClassifier *c = static_cast<UMLClassifier*>(o);
// set stereotype
QString stereotype = clean(node->findAttribute("stereotype").string);
if (!stereotype.isEmpty()) {
if (stereotype.toLower() == "interface")
c->setBaseType(UMLObject::ot_Interface);
else
c->setStereotype(stereotype);
}
// insert attributes
AttributesReader attReader(c);
attReader.read(node, c->name());
// insert operations
OperationsReader opReader(c);
opReader.read(node, c->name());
// insert generalizations
SuperclassesReader superReader(c);
superReader.read(node, c->name());
// insert realizations
RealizationsReader realReader(c);
realReader.read(node, c->name());
} else if (objType == "Association") {
PetalNode *roles = node->findAttribute("roles").node;
if (node == NULL) {
uError() << "umbrellify: cannot find roles of Association";
return false;
}
UMLAssociation *assoc = new UMLAssociation(Uml::AssociationType::UniAssociation);
PetalNode::NameValueList roleList = roles->attributes();
for (uint i = 0; i <= 1; ++i) {
PetalNode *roleNode = roleList[i].second.node;
if (roleNode == NULL) {
uError() << "umbrellify: roleNode of Association is NULL";
return false;
}
if (roleNode->name() != "Role") {
uDebug() << "umbrellify(" << name << "): expecting Role, found \""
<< roleNode->name();
continue;
}
// index 0 corresponds to Umbrello roleB
// index 1 corresponds to Umbrello roleA
UMLRole *role = assoc->getUMLRole((Uml::Role_Type) !i);
QStringList initialArgs = roleNode->initialArgs();
if (initialArgs.count() > 1) {
QString roleName = clean(initialArgs[1]);
if (! roleName.startsWith(QLatin1String("$UNNAMED")))
role->setName(roleName);
}
role->setID(quid(roleNode));
QString quidref = quidu(roleNode);
QString type = clean(roleNode->findAttribute("supplier").string);
if (!quidref.isEmpty()) {
role->setSecondaryId(quidref);
}
if (!type.isEmpty()) {
role->setSecondaryFallback(type);
}
QString label = clean(roleNode->findAttribute("label").string);
if (!label.isEmpty()) {
role->setName(label);
}
QString client_cardinality = clean(roleNode->findAttribute("client_cardinality").string);
//.........这里部分代码省略.........