本文整理汇总了C++中UMLAttribute::setID方法的典型用法代码示例。如果您正苦于以下问题:C++ UMLAttribute::setID方法的具体用法?C++ UMLAttribute::setID怎么用?C++ UMLAttribute::setID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UMLAttribute
的用法示例。
在下文中一共展示了UMLAttribute::setID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotNewParameter
void UMLOperationDialog::slotNewParameter() {
int result = 0;
UMLAttribute* pAtt = 0;
QString currentName = m_pOperation->getUniqueParameterName();
UMLAttribute* newAttribute = new UMLAttribute(m_pOperation, currentName, Uml::id_Reserved);
ParmPropDlg dlg(this, m_doc, newAttribute);
result = dlg.exec();
QString name = dlg.getName();
pAtt = m_pOperation -> findParm( name );
if( result ) {
if( name.length() == 0 ) {
KMessageBox::error(this, i18n("You have entered an invalid parameter name."),
i18n("Parameter Name Invalid"), false);
delete newAttribute;
return;
}
if( !pAtt ) {
newAttribute->setID( UniqueID::gen() );
newAttribute->setName( name );
newAttribute->setTypeName( dlg.getTypeName() );
newAttribute->setInitialValue( dlg.getInitialValue() );
newAttribute->setDoc( dlg.getDoc() );
newAttribute->setParmKind( dlg.getParmKind() );
m_pOperation->addParm( newAttribute );
m_pParmsLB -> insertItem( name );
m_doc -> setModified( true );
} else {
KMessageBox::sorry(this, i18n("The parameter name you have chosen\nis already being used in this operation."),
i18n("Parameter Name Not Unique"), false);
delete newAttribute;
}
} else {
delete newAttribute;
}
}
示例2: slotEditFinished
/**
* This slot is called to finish item editing
*/
void UMLListViewItem::slotEditFinished(const QString &newText)
{
m_label = text(0);
DEBUG(DBG_LVI) << this << "text=" << newText;
UMLListView* listView = static_cast<UMLListView*>(treeWidget());
UMLDoc* doc = listView->document();
if (newText == m_label) {
return;
}
if (newText.isEmpty()) {
cancelRenameWithMsg();
return;
}
switch (m_type) {
case lvt_UseCase:
case lvt_Actor:
case lvt_Class:
case lvt_Package:
case lvt_UseCase_Folder:
case lvt_Logical_Folder:
case lvt_Component_Folder:
case lvt_Deployment_Folder:
case lvt_EntityRelationship_Folder:
case lvt_Interface:
case lvt_Datatype:
case lvt_Enum:
case lvt_EnumLiteral:
case lvt_Subsystem:
case lvt_Component:
case lvt_Port:
case lvt_Node:
case lvt_Category:
if (m_object == 0 || !doc->isUnique(newText)) {
cancelRenameWithMsg();
return;
}
UMLApp::app()->executeCommand(new Uml::CmdRenameUMLObject(m_object, newText));
doc->setModified(true);
m_label = newText;
break;
case lvt_Operation: {
if (m_object == 0) {
cancelRenameWithMsg();
return;
}
UMLOperation *op = static_cast<UMLOperation*>(m_object);
UMLClassifier *parent = static_cast<UMLClassifier *>(op->parent());
Model_Utils::OpDescriptor od;
Model_Utils::Parse_Status st = Model_Utils::parseOperation(newText, od, parent);
if (st == Model_Utils::PS_OK) {
// TODO: Check that no operation with the exact same profile exists.
UMLApp::app()->executeCommand(new Uml::CmdRenameUMLObject(op, od.m_name));
op->setType(od.m_pReturnType);
UMLAttributeList parmList = op->getParmList();
const int newParmListCount = parmList.count();
if (newParmListCount > od.m_args.count()) {
// Remove parameters at end of of list that no longer exist.
for (int i = od.m_args.count(); i < newParmListCount; i++) {
UMLAttribute *a = parmList.at(i);
op->removeParm(a, false);
}
}
Model_Utils::NameAndType_ListIt lit = od.m_args.begin();
for (int i = 0; lit != od.m_args.end(); ++lit, ++i) {
const Model_Utils::NameAndType& nm_tp = *lit;
UMLAttribute *a;
if (i < newParmListCount) {
a = parmList.at(i);
} else {
a = new UMLAttribute(op);
a->setID(UniqueID::gen());
}
UMLApp::app()->executeCommand(new Uml::CmdRenameUMLObject(a, nm_tp.m_name));
a->setType(nm_tp.m_type);
a->setParmKind(nm_tp.m_direction);
a->setInitialValue(nm_tp.m_initialValue);
if (i >= newParmListCount) {
op->addParm(a);
}
}
m_label = op->toString(Uml::SignatureType::SigNoVis);
} else {
KMessageBox::error(0,
Model_Utils::psText(st),
i18n("Rename canceled"));
}
setText(m_label);
break;
}
case lvt_Attribute:
case lvt_EntityAttribute: {
if (m_object == 0) {
cancelRenameWithMsg();
return;
//.........这里部分代码省略.........