本文整理汇总了C++中UMLClassifier::getPackage方法的典型用法代码示例。如果您正苦于以下问题:C++ UMLClassifier::getPackage方法的具体用法?C++ UMLClassifier::getPackage怎么用?C++ UMLClassifier::getPackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UMLClassifier
的用法示例。
在下文中一共展示了UMLClassifier::getPackage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateContent
// This method will cause the class to rebuild its text representation.
// based on the parent classifier object.
// For any situation in which this is called, we are either building the code
// document up, or replacing/regenerating the existing auto-generated parts. As
// such, we will want to insert everything we resonablely will want
// during creation. We can set various parts of the document (esp. the
// comments) to appear or not, as needed.
void CPPHeaderCodeDocument::updateContent( )
{
// Gather info on the various fields and parent objects of this class...
UMLClassifier * c = getParentClassifier();
CodeGenPolicyExt *pe = UMLApp::app()->getPolicyExt();
CPPCodeGenerationPolicy * policy = dynamic_cast<CPPCodeGenerationPolicy*>(pe);
// first, set the global flag on whether or not to show classfield info
CodeClassFieldList * cfList = getCodeClassFieldList();
for(CodeClassField * field = cfList->first(); field; field = cfList->next())
field->setWriteOutMethods(policy->getAutoGenerateAccessors());
// attribute-based ClassFields
// we do it this way to have the static fields sorted out from regular ones
CodeClassFieldList staticPublicAttribClassFields = getSpecificClassFields (CodeClassField::Attribute, true, Uml::Visibility::Public );
CodeClassFieldList publicAttribClassFields = getSpecificClassFields (CodeClassField::Attribute, false, Uml::Visibility::Public );
CodeClassFieldList staticProtectedAttribClassFields = getSpecificClassFields (CodeClassField::Attribute, true, Uml::Visibility::Protected );
CodeClassFieldList protectedAttribClassFields = getSpecificClassFields (CodeClassField::Attribute, false, Uml::Visibility::Protected );
CodeClassFieldList staticPrivateAttribClassFields = getSpecificClassFields (CodeClassField::Attribute, true, Uml::Visibility::Private );
CodeClassFieldList privateAttribClassFields = getSpecificClassFields (CodeClassField::Attribute, false, Uml::Visibility::Private);
// association-based ClassFields
// don't care if they are static or not..all are lumped together
CodeClassFieldList publicPlainAssocClassFields = getSpecificClassFields ( CodeClassField::PlainAssociation , Uml::Visibility::Public);
CodeClassFieldList publicAggregationClassFields = getSpecificClassFields ( CodeClassField::Aggregation, Uml::Visibility::Public);
CodeClassFieldList publicCompositionClassFields = getSpecificClassFields ( CodeClassField::Composition, Uml::Visibility::Public );
CodeClassFieldList protPlainAssocClassFields = getSpecificClassFields ( CodeClassField::PlainAssociation , Uml::Visibility::Protected);
CodeClassFieldList protAggregationClassFields = getSpecificClassFields ( CodeClassField::Aggregation, Uml::Visibility::Protected);
CodeClassFieldList protCompositionClassFields = getSpecificClassFields ( CodeClassField::Composition, Uml::Visibility::Protected);
CodeClassFieldList privPlainAssocClassFields = getSpecificClassFields ( CodeClassField::PlainAssociation , Uml::Visibility::Private);
CodeClassFieldList privAggregationClassFields = getSpecificClassFields ( CodeClassField::Aggregation, Uml::Visibility::Private);
CodeClassFieldList privCompositionClassFields = getSpecificClassFields ( CodeClassField::Composition, Uml::Visibility::Private);
bool hasOperationMethods = c->getOpList().last() ? true : false;
bool hasNamespace = false;
bool isEnumeration = false;
bool isInterface = parentIsInterface();
bool hasclassFields = hasClassFields();
bool forcedoc = UMLApp::app()->getCommonPolicy()->getCodeVerboseDocumentComments();
QString endLine = UMLApp::app()->getCommonPolicy()->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->getName());
QString hashDefine = CodeGenerator::cleanName(c->getName().upper().simplifyWhiteSpace());
QString defText = "#ifndef "+hashDefine + "_H"+ endLine + "#define "+ hashDefine + "_H";
addOrUpdateTaggedCodeBlockWithComments("hashDefBlock", defText, "", 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 ? "<" : "\"";
QString sEndBrak = stringGlobal ? ">" : "\"";
includeStatement.append("#include "+sStartBrak+policy->getStringClassNameInclude()+sEndBrak+endLine);
if ( hasObjectVectorClassFields() )
{
bool vecGlobal = policy->vectorIncludeIsGlobal();
QString vStartBrak = vecGlobal ? "<" : "\"";
QString vEndBrak = vecGlobal ? ">" : "\"";
QString value ="#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);
for(UMLPackage *con = includes.first(); con ; con = includes.next())
if (con->getBaseType() != Uml::ot_Datatype && !packageMap.contains(con))
{
packageMap.insert(con,con->getPackage());
if(con != getParentClassifier())
includeStatement.append("#include \""+CodeGenerator::cleanName(con->getName().lower())+".h\""+endLine);
}
// 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);
//.........这里部分代码省略.........