本文整理汇总了C++中UMLClassifier::getVisibility方法的典型用法代码示例。如果您正苦于以下问题:C++ UMLClassifier::getVisibility方法的具体用法?C++ UMLClassifier::getVisibility怎么用?C++ UMLClassifier::getVisibility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UMLClassifier
的用法示例。
在下文中一共展示了UMLClassifier::getVisibility方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateContent
/**
* update the start and end text for this ownedhierarchicalcodeblock.
*/
void JavaClassDeclarationBlock::updateContent ( )
{
JavaClassifierCodeDocument *parentDoc = dynamic_cast<JavaClassifierCodeDocument*>(getParentDocument());
UMLClassifier *c = parentDoc->getParentClassifier();
CodeGenerationPolicy *commonPolicy = UMLApp::app()->getCommonPolicy();
QString endLine = commonPolicy->getNewLineEndingChars();
bool isInterface = parentDoc->parentIsInterface(); // a little shortcut
QString JavaClassName = parentDoc->getJavaClassName(c->getName());
// COMMENT
if(isInterface)
getComment()->setText("Interface "+JavaClassName+endLine+c->getDoc());
else
getComment()->setText("Class "+JavaClassName+endLine+c->getDoc());
bool forceDoc = UMLApp::app()->getCommonPolicy()->getCodeVerboseDocumentComments();
if(forceDoc || !c->getDoc().isEmpty())
getComment()->setWriteOutText(true);
else
getComment()->setWriteOutText(false);
// Now set START/ENDING Text
QString startText = "";
// In Java, we need declare abstract only on classes
if (c->getAbstract() && !isInterface)
startText.append("abstract ");
if (c->getVisibility() != Uml::Visibility::Public) {
// We should probably emit a warning in here .. java doesn't like to allow
// private/protected classes. The best we can do (I believe)
// is to let these declarations default to "package visibility"
// which is a level between traditional "private" and "protected"
// scopes. To get this visibility level we just print nothing..
} else
startText.append("public ");
if(parentDoc->parentIsInterface())
startText.append("interface ");
else
startText.append("class ");
startText.append(JavaClassName);
// write inheritances out
UMLClassifierList superclasses =
c->findSuperClassConcepts(UMLClassifier::CLASS);
UMLClassifierList superinterfaces =
c->findSuperClassConcepts(UMLClassifier::INTERFACE);
int nrof_superclasses = superclasses.count();
int nrof_superinterfaces = superinterfaces.count();
// write out inheritance
int i = 0;
if(nrof_superclasses >0)
startText.append(" extends ");
for (UMLClassifier * concept= superclasses.first(); concept; concept = superclasses.next())
{
startText.append(parentDoc->cleanName(concept->getName()));
if(i != (nrof_superclasses-1))
startText.append(", ");
i++;
}
// write out what we 'implement'
i = 0;
if(nrof_superinterfaces >0)
{
// In Java interfaces "extend" other interfaces. Classes "implement" interfaces
if(isInterface)
startText.append(" extends ");
else
startText.append(" implements ");
}
for (UMLClassifier * concept= superinterfaces.first(); concept; concept = superinterfaces.next())
{
startText.append(parentDoc->cleanName(concept->getName()));
if(i != (nrof_superinterfaces-1))
startText.append(", ");
i++;
}
// Set the header and end text for the hier.codeblock
setStartText(startText+" {");
// setEndText("}"); // not needed
}