本文整理汇总了C++中UMLAttribute::setParmKind方法的典型用法代码示例。如果您正苦于以下问题:C++ UMLAttribute::setParmKind方法的具体用法?C++ UMLAttribute::setParmKind怎么用?C++ UMLAttribute::setParmKind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UMLAttribute
的用法示例。
在下文中一共展示了UMLAttribute::setParmKind方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: parseStmt
//.........这里部分代码省略.........
}
typeName = advance();
} else if (direction == QLatin1String("out")) {
dir = Uml::ParameterDirection::Out;
typeName = advance();
} else {
typeName = direction; // In Ada, the default direction is "in"
}
typeName.remove(QLatin1String("Standard."), Qt::CaseInsensitive);
typeName = expand(typeName);
if (op == NULL) {
// In Ada, the first parameter indicates the class.
UMLObject *type = Import_Utils::createUMLObject(UMLObject::ot_Class, typeName, currentScope());
UMLObject::ObjectType t = type->baseType();
if ((t != UMLObject::ot_Interface &&
(t != UMLObject::ot_Class || type->stereotype() == QLatin1String("record"))) ||
!m_classesDefinedInThisScope.contains(type)) {
// Not an instance bound method - we cannot represent it.
skipStmt(QLatin1String(")"));
break;
}
klass = static_cast<UMLClassifier*>(type);
op = Import_Utils::makeOperation(klass, name);
// The controlling parameter is suppressed.
parNameCount--;
if (parNameCount) {
for (uint i = 0; i < parNameCount; ++i) {
parName[i] = parName[i + 1];
}
}
}
for (uint i = 0; i < parNameCount; ++i) {
UMLAttribute *att = Import_Utils::addMethodParameter(op, typeName, parName[i]);
att->setParmKind(dir);
}
if (advance() != QLatin1String(";"))
break;
}
if (keyword == QLatin1String("function")) {
if (advance() != QLatin1String("return")) {
if (klass)
uError() << "importAda: expecting \"return\" at function "
<< name;
return false;
}
returnType = expand(advance());
returnType.remove(QLatin1String("Standard."), Qt::CaseInsensitive);
}
bool isAbstract = false;
if (advance() == QLatin1String("is") && advance() == QLatin1String("abstract"))
isAbstract = true;
if (klass != NULL && op != NULL)
Import_Utils::insertMethod(klass, op, m_currentAccess, returnType,
false, isAbstract, false, false, m_comment);
skipStmt();
return true;
}
if (keyword == QLatin1String("task") || keyword == QLatin1String("protected")) {
// Can task and protected objects/types be mapped to UML?
QString name = advance();
if (name == QLatin1String("type")) {
name = advance();
}
QString next = advance();
if (next == QLatin1String("(")) {
skipStmt(QLatin1String(")")); // skip discriminant
示例3: 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;
//.........这里部分代码省略.........
示例4: parseStmt
//.........这里部分代码省略.........
} else if (nextToken == "const") {
advance();
} else if (nextToken == "out") {
dir = Uml::pd_Out;
advance();
}
QString parName[MAX_PARNAMES];
uint parNameCount = 0;
do {
if (parNameCount >= MAX_PARNAMES) {
uError() << "MAX_PARNAMES is exceeded at " << name;
break;
}
parName[parNameCount++] = advance();
} while (advance() == ",");
if (m_source[m_srcIndex] != ":") {
uError() << "importPascal: expecting ':' at " << m_source[m_srcIndex];
skipStmt();
break;
}
nextToken = advance();
if (nextToken.toLower() == "array") {
nextToken = advance().toLower();
if (nextToken != "of") {
uError() << "importPascal(" << name << "): expecting 'array OF' at "
<< nextToken;
skipStmt();
return false;
}
nextToken = advance();
}
for (uint i = 0; i < parNameCount; ++i) {
UMLAttribute *att = Import_Utils::addMethodParameter(op, nextToken, parName[i]);
att->setParmKind(dir);
}
if (advance() != ";")
break;
}
}
QString returnType;
if (keyword == "function") {
if (advance() != ":") {
uError() << "importPascal: expecting \":\" at function "
<< name;
return false;
}
returnType = advance();
} else if (keyword == "constructor" || keyword == "destructor") {
op->setStereotype(keyword);
}
skipStmt();
bool isVirtual = false;
bool isAbstract = false;
checkModifiers(isVirtual, isAbstract);
Import_Utils::insertMethod(m_klass, op, m_currentAccess, returnType,
!isVirtual, isAbstract, false, false, m_comment);
return true;
}
if (m_section != sect_TYPE) {
skipStmt();
return true;
}
if (m_klass == NULL) {
const QString& name = m_source[m_srcIndex];
QString nextToken = advance();
if (nextToken != "=") {