本文整理汇总了C++中UMLClassifier::getPackages方法的典型用法代码示例。如果您正苦于以下问题:C++ UMLClassifier::getPackages方法的具体用法?C++ UMLClassifier::getPackages怎么用?C++ UMLClassifier::getPackages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UMLClassifier
的用法示例。
在下文中一共展示了UMLClassifier::getPackages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateContent
//.........这里部分代码省略.........
// now, add/update the includes codeblock
CodeBlockWithComments * inclBlock = addOrUpdateTaggedCodeBlockWithComments("includes", includeStatement, QString::null, 0, false);
if(includeStatement.isEmpty() && inclBlock->getContentType() == CodeBlock::AutoGenerated)
inclBlock->setWriteOutText(false);
else
inclBlock->setWriteOutText(true);
// Using
QString usingStatement;
for(UMLClassifier *classifier = superclasses.first(); classifier ; classifier = superclasses.next()) {
if(classifier->getPackage()!=c->getPackage() && !classifier->getPackage().isEmpty()) {
usingStatement.append("using "+CodeGenerator::cleanName(c->getPackage())+"::"+cleanName(c->getName())+';'+endLine);
}
}
CodeBlockWithComments * usingBlock = addOrUpdateTaggedCodeBlockWithComments("using", usingStatement, "", 0, false);
if(usingStatement.isEmpty() && usingBlock->getContentType() == CodeBlock::AutoGenerated)
usingBlock->setWriteOutText(false);
else
usingBlock->setWriteOutText(true);
// namespace
// This needs special treatment. We cant use "nowriteouttext" for this, as
// that will prevent the class declaration from being written. Instead, we
// check if "hasNamspace" is true or not, and then indent the remaining code
// appropriately as well as set the start/end text of this namespace block.
if (c->getUMLPackage() && policy->getPackageIsNamespace())
hasNamespace = true;
else
hasNamespace = false;
// set start/end text of namespace block
namespaceBlock = getHierarchicalCodeBlock("namespace", "Namespace", 0);
if(hasNamespace) {
UMLPackageList pkgList = c->getPackages();
QString pkgs;
UMLPackage *pkg;
for (pkg = pkgList.first(); pkg != NULL; pkg = pkgList.next()) {
pkgs += "namespace " + CodeGenerator::cleanName(pkg->getName()) + " { ";
}
namespaceBlock->setStartText(pkgs);
QString closingBraces;
for (pkg = pkgList.first(); pkg != NULL; pkg = pkgList.next()) {
closingBraces += "} ";
}
namespaceBlock->setEndText(closingBraces);
namespaceBlock->getComment()->setWriteOutText(true);
} else {
namespaceBlock->setStartText("");
namespaceBlock->setEndText("");
namespaceBlock->getComment()->setWriteOutText(false);
}
// Enum types for include
if (!isInterface) {
QString enumStatement;
QString indent = UMLApp::app()->getCommonPolicy()->getIndentation();
UMLEnum* e = dynamic_cast<UMLEnum*>(c);
if (e) {
enumStatement.append(indent + "enum " + cppClassName + " {" + endLine);
// populate
UMLClassifierListItemList ell = e->getFilteredList(Uml::ot_EnumLiteral);
for (UMLClassifierListItem *el=ell.first(); el ; ) {
enumStatement.append(indent+indent);
enumStatement.append(CodeGenerator::cleanName(el->getName()));
if ((el=ell.next()) != 0)