本文整理汇总了C++中UMLClassifier::isAbstract方法的典型用法代码示例。如果您正苦于以下问题:C++ UMLClassifier::isAbstract方法的具体用法?C++ UMLClassifier::isAbstract怎么用?C++ UMLClassifier::isAbstract使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UMLClassifier
的用法示例。
在下文中一共展示了UMLClassifier::isAbstract方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveToXMI
/**
* Reimplemented from UMLWidget::saveToXMI to save
* classifierwidget data either to 'interfacewidget' or 'classwidget'
* XMI element.
*/
void ClassifierWidget::saveToXMI(QDomDocument & qDoc, QDomElement & qElement)
{
QDomElement conceptElement;
UMLClassifier *umlc = classifier();
QString tagName = umlc->isInterface() ?
"interfacewidget" : "classwidget";
conceptElement = qDoc.createElement(tagName);
UMLWidget::saveToXMI( qDoc, conceptElement );
conceptElement.setAttribute("showoperations", visualProperty(ShowOperations));
conceptElement.setAttribute("showpubliconly", visualProperty(ShowPublicOnly));
conceptElement.setAttribute("showopsigs", m_operationSignature);
conceptElement.setAttribute("showpackage", visualProperty(ShowPackage));
conceptElement.setAttribute("showscope", visualProperty(ShowVisibility));
if (! umlc->isInterface()) {
conceptElement.setAttribute("showattributes", visualProperty(ShowAttributes));
conceptElement.setAttribute("showattsigs", m_attributeSignature);
}
if (umlc->isInterface() || umlc->isAbstract()) {
conceptElement.setAttribute("drawascircle", visualProperty(DrawAsCircle));
}
qElement.appendChild(conceptElement);
}
示例2: updateTextItemGroups
/**
* Reimplemented from UMLWidget::updateTextItemGroups to
* calculate the Text strings, their properties and also hide/show
* them based on the current state.
*/
void ClassifierWidget::updateTextItemGroups()
{
// Invalidate stuff and recalculate them.
invalidateDummies();
TextItemGroup *headerGroup = textItemGroupAt(HeaderGroupIndex);
TextItemGroup *attribOpGroup = textItemGroupAt(AttribOpGroupIndex);
TextItemGroup *templateGroup = textItemGroupAt(TemplateGroupIndex);
attribOpGroup->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
templateGroup->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
UMLClassifier *umlC = classifier();
UMLClassifierListItemList attribList = umlC->getFilteredList(UMLObject::ot_Attribute);
UMLClassifierListItemList opList = umlC->getFilteredList(UMLObject::ot_Operation);
// Set up template group and template text items.
UMLTemplateList tlist = umlC->getTemplateList();
templateGroup->setTextItemCount(tlist.size());
bool templateHide = shouldDrawAsCircle(); // Hide if draw as circle.
for(int i = 0; i < tlist.size(); ++i) {
UMLTemplate *t = tlist[i];
templateGroup->textItemAt(i)->setText(t->toString());
templateGroup->textItemAt(i)->setExplicitVisibility(!templateHide);
}
// Stereo type and name.
const int headerItemCount = 2;
headerGroup->setTextItemCount(headerItemCount);
const int cnt = attribList.count() + opList.count();
attribOpGroup->setTextItemCount(cnt);
// Setup Stereo text item.
TextItem *stereoItem = headerGroup->textItemAt(StereotypeItemIndex);
stereoItem->setBold(true);
stereoItem->setText(umlC->stereotype(true));
bool v = !shouldDrawAsCircle()
&& visualProperty(ShowStereotype)
&& !(umlC->stereotype(false).isEmpty());
stereoItem->setExplicitVisibility(v);
// name item is always visible.
TextItem *nameItem = headerGroup->textItemAt(NameItemIndex);
nameItem->setBold(true);
nameItem->setItalic(umlC->isAbstract());
nameItem->setUnderline(shouldDrawAsCircle());
QString nameText = name();
if (visualProperty(ShowPackage) == true) {
nameText = umlC->fullyQualifiedName();
}
bool showNameOnly = (!visualProperty(ShowAttributes) && !visualProperty(ShowOperations)
&& !visualProperty(ShowStereotype) && !shouldDrawAsCircle());
nameItem->setText(nameText);
int attribStartIndex = 0;
int opStartIndex = attribStartIndex + attribList.size();
// Now setup attribute texts.
int visibleAttributes = 0;
for (int i=0; i < attribList.size(); ++i) {
UMLClassifierListItem *obj = attribList[i];
TextItem *item = attribOpGroup->textItemAt(attribStartIndex + i);
item->setItalic(obj->isAbstract());
item->setUnderline(obj->isStatic());
item->setText(obj->toString(m_attributeSignature));
bool v = !shouldDrawAsCircle()
&& ( !visualProperty(ShowPublicOnly)
|| obj->visibility() == Uml::Visibility::Public)
&& visualProperty(ShowAttributes) == true;
item->setExplicitVisibility(v);
if (v) {
++visibleAttributes;
}
}
// Update expander box to reflect current state and also visibility
m_attributeExpanderBox->setExpanded(visualProperty(ShowAttributes));
const QString dummyText;
// Setup line and dummies.
if (!showNameOnly) {
// Stuff in a dummy item as spacer if there are no attributes,
if (!shouldDrawAsCircle() && (visibleAttributes == 0 || !visualProperty(ShowAttributes))) {
m_dummyAttributeItem = new TextItem(dummyText);
int index = attribStartIndex;
if (visibleAttributes == 0 && !attribList.isEmpty()) {
index = opStartIndex;
}
attribOpGroup->insertTextItemAt(index, m_dummyAttributeItem);
//.........这里部分代码省略.........
示例3: updateContent
/**
* update the start and end text for this hierarchicalcodeblock.
*/
void CPPHeaderClassDeclarationBlock::updateContent ()
{
CPPHeaderCodeDocument *parentDoc = dynamic_cast<CPPHeaderCodeDocument*>(getParentDocument());
UMLClassifier *c = parentDoc->getParentClassifier();
QString endLine = UMLApp::app()->commonPolicy()->getNewLineEndingChars();
bool isInterface = parentDoc->parentIsInterface(); // a little shortcut
QString CPPHeaderClassName = CodeGenerator::cleanName(c->name());
bool forceDoc = UMLApp::app()->commonPolicy()->getCodeVerboseDocumentComments();
// COMMENT
//check if class is abstract.. it should have abstract methods
if(!isInterface && c->isAbstract() && !c->hasAbstractOps())
{
getComment()->setText(QLatin1String("******************************* Abstract Class ****************************") + endLine
+ CPPHeaderClassName + QLatin1String(" does not have any pure virtual methods, but its author") + endLine
+ QLatin1String(" defined it as an abstract class, so you should not use it directly.") + endLine
+ QLatin1String(" Inherit from it instead and create only objects from the derived classes") + endLine
+ QLatin1String("*****************************************************************************"));
} else {
if(isInterface)
getComment()->setText(QLatin1String("Interface ") + CPPHeaderClassName + endLine + c->doc());
else
getComment()->setText(QLatin1String("Class ") + CPPHeaderClassName + endLine + c->doc());
}
if(forceDoc || !c->doc().isEmpty())
getComment()->setWriteOutText(true);
else
getComment()->setWriteOutText(false);
// Now set START/ENDING Text
QString startText;
/*
*/
/*
if(parentDoc->parentIsInterface())
startText.append(QLatin1String("interface "));
else
*/
startText.append(QLatin1String("class "));
startText.append(CPPHeaderClassName);
// write inheritances out
UMLClassifierList superclasses = c->findSuperClassConcepts();
int nrof_superclasses = superclasses.count();
// write out inheritance
int i = 0;
if(nrof_superclasses >0)
startText.append(QLatin1String(" : "));
foreach (UMLClassifier* concept, superclasses) {
startText.append(Uml::Visibility::toString(concept->visibility()) + QLatin1Char(' ') +
CodeGenerator::cleanName(concept->name()));
if(i != (nrof_superclasses-1))
startText.append(QLatin1String(", "));
i++;
}