本文整理汇总了C++中UMLClassifier::umlPackage方法的典型用法代码示例。如果您正苦于以下问题:C++ UMLClassifier::umlPackage方法的具体用法?C++ UMLClassifier::umlPackage怎么用?C++ UMLClassifier::umlPackage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UMLClassifier
的用法示例。
在下文中一共展示了UMLClassifier::umlPackage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateContent
//.........这里部分代码省略.........
CodeClassFieldList privCompositionClassFields = getSpecificClassFields (CodeClassField::Composition, Uml::Visibility::Private);
bool hasOperationMethods = false;
UMLOperationList list = c->getOpList();
hasOperationMethods = ! list.isEmpty();
bool hasNamespace = false;
bool isEnumeration = false;
bool isInterface = parentIsInterface();
bool hasclassFields = hasClassFields();
bool forcedoc = UMLApp::app()->commonPolicy()->getCodeVerboseDocumentComments();
QString endLine = UMLApp::app()->commonPolicy()->getNewLineEndingChars();
UMLClassifierList superclasses = c->findSuperClassConcepts();
// START GENERATING CODE/TEXT BLOCKS and COMMENTS FOR THE DOCUMENT
//
// Write the hash define stuff to prevent multiple parsing/inclusion of header
QString cppClassName = CodeGenerator::cleanName(c->name());
QString hashDefine = CodeGenerator::cleanName(c->name().toUpper().simplified());
QString defText = QLatin1String("#ifndef ") + hashDefine + QLatin1String("_H") + endLine + QLatin1String("#define ") + hashDefine + QLatin1String("_H");
addOrUpdateTaggedCodeBlockWithComments(QLatin1String("hashDefBlock"), defText, QString(), 0, false);
// INCLUDE CODEBLOCK
//
// Q: Why all utils? Isnt just List and Vector the only classes we are using?
// A: doesn't matter at all; its more readable to just include '*' and cpp compilers
// don't slow down or anything. (TZ)
QString includeStatement;
bool stringGlobal = policy->stringIncludeIsGlobal();
QString sStartBrak = stringGlobal ? QLatin1String("<") : QLatin1String("\"");
QString sEndBrak = stringGlobal ? QLatin1String(">") : QLatin1String("\"");
includeStatement.append(QLatin1String("#include ") + sStartBrak + policy->getStringClassNameInclude() + sEndBrak + endLine);
if (hasObjectVectorClassFields())
{
bool vecGlobal = policy->vectorIncludeIsGlobal();
QString vStartBrak = vecGlobal ? QLatin1String("<") : QLatin1String("\"");
QString vEndBrak = vecGlobal ? QLatin1String(">") : QLatin1String("\"");
QString value =QLatin1String("#include ") + vStartBrak + policy->getVectorClassNameInclude() + vEndBrak;
includeStatement.append(value + endLine);
}
//only include classes in a different package from this class
UMLPackageList includes;
QMap<UMLPackage *, QString> packageMap; // so we don't repeat packages
CodeGenerator::findObjectsRelated(c, includes);
foreach(UMLPackage* con, includes) {
if (con->baseType() != UMLObject::ot_Datatype && !packageMap.contains(con)) {
packageMap.insert(con, con->package());
if(con != getParentClassifier())
includeStatement.append(QLatin1String("#include \"") + CodeGenerator::cleanName(con->name().toLower()) + QLatin1String(".h\"") + endLine);
}
}
// now, add/update the includes codeblock
CodeBlockWithComments * inclBlock = addOrUpdateTaggedCodeBlockWithComments(QLatin1String("includes"), includeStatement, QString(), 0, false);
if(includeStatement.isEmpty() && inclBlock->contentType() == CodeBlock::AutoGenerated)
inclBlock->setWriteOutText(false);
else
inclBlock->setWriteOutText(true);
// Using
QString usingStatement;
foreach(UMLClassifier* classifier, superclasses) {
if(classifier->package()!=c->package() && !classifier->package().isEmpty()) {
usingStatement.append(QLatin1String("using ") + CodeGenerator::cleanName(c->package()) + QLatin1String("::") + cleanName(c->name()) + QLatin1Char(';') + endLine);
}
}
CodeBlockWithComments * usingBlock = addOrUpdateTaggedCodeBlockWithComments(QLatin1String("using"), usingStatement, QString(), 0, false);
if(usingStatement.isEmpty() && usingBlock->contentType() == 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->umlPackage() && policy->getPackageIsNamespace())
hasNamespace = true;
else
hasNamespace = false;
// set start/end text of namespace block
m_namespaceBlock = getHierarchicalCodeBlock(QLatin1String("namespace"), QLatin1String("Namespace"), 0);
if(hasNamespace) {
UMLPackageList pkgList = c->packages();
QString pkgs;
UMLPackage *pkg;
foreach (pkg, pkgList) {
pkgs += QLatin1String("namespace ") + CodeGenerator::cleanName(pkg->name()) + QLatin1String(" { ");
}
m_namespaceBlock->setStartText(pkgs);
QString closingBraces;
foreach (pkg, pkgList) {
closingBraces += QLatin1String("} ");
}