当前位置: 首页>>代码示例>>C++>>正文


C++ UMLClassifier::getFullyQualifiedName方法代码示例

本文整理汇总了C++中UMLClassifier::getFullyQualifiedName方法的典型用法代码示例。如果您正苦于以下问题:C++ UMLClassifier::getFullyQualifiedName方法的具体用法?C++ UMLClassifier::getFullyQualifiedName怎么用?C++ UMLClassifier::getFullyQualifiedName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UMLClassifier的用法示例。


在下文中一共展示了UMLClassifier::getFullyQualifiedName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: slotParameterProperties

void UMLOperationDialog::slotParameterProperties() {
    int result = 0;
    UMLAttribute* pAtt = 0, * pOldAtt = 0;
    pOldAtt = m_pOperation->findParm( m_pParmsLB->currentText() );

    if( !pOldAtt ) {
        kDebug() << "THE impossible has occurred for:" << m_pParmsLB->currentText() << endl;
        return;
    }//should never occur
    ParmPropDlg dlg(this, m_doc, pOldAtt);
    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);
            return;
        }
        if ( !pAtt || pOldAtt->getTypeName() != dlg.getTypeName() ||
                pOldAtt->getDoc() != dlg.getDoc() ||
                pOldAtt->getInitialValue() != dlg.getInitialValue() ) {
            pOldAtt->setName( name );
            QString typeName = dlg.getTypeName();
            if (pOldAtt->getTypeName() != typeName) {
                UMLClassifierList namesList( m_doc->getConcepts() );
                UMLClassifier* obj = NULL;
                for (obj=namesList.first(); obj!=0; obj=namesList.next()) {
                    if (typeName == obj->getFullyQualifiedName()) {
                        pOldAtt->setType( obj );
                        break;
                    }
                }
                if (obj == NULL) {
                    // Nothing found: set type name directly. Bad.
                    kDebug() << "UMLOperationDialog::slotParameterProperties: "
                    << typeName << " not found." << endl;
                    pOldAtt->setTypeName( typeName );  // Bad.
                }
            }
            m_pParmsLB->changeItem( dlg.getName(), m_pParmsLB -> currentItem() );
            pOldAtt->setDoc( dlg.getDoc() );
            pOldAtt->setInitialValue( dlg.getInitialValue() );
            m_doc->setModified( true );
        } else if( pAtt != pOldAtt ) {
            KMessageBox::error(this, i18n("The parameter name you have chosen is already being used in this operation."),
                               i18n("Parameter Name Not Unique"), false);
        }
    }
}
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:50,代码来源:umloperationdialog.cpp

示例2: toString

QString UMLAttribute::toString(Uml::Signature_Type sig) {
    QString s;

    if(sig == Uml::st_ShowSig || sig == Uml::st_NoSig) {
        s = m_Vis.toString(true) + ' ';
    }

    if(sig == Uml::st_ShowSig || sig == Uml::st_SigNoVis) {
        // Determine whether the type name needs to be scoped.
        UMLObject *owningObject = static_cast<UMLObject*>(parent());
        if (owningObject->getBaseType() == Uml::ot_Operation) {
            // The immediate parent() is the UMLOperation but we want
            // the UMLClassifier:
            owningObject = static_cast<UMLObject*>(owningObject->parent());
        }
        UMLClassifier *ownParent = dynamic_cast<UMLClassifier*>(owningObject);
        if (ownParent == NULL) {
            kError() << "UMLAttribute::toString: parent "
            << owningObject->getName()
            << " is not a UMLClassifier" << endl;
            return "";
        }
        QString typeName;
        UMLClassifier *type = UMLClassifierListItem::getType();
        if (type) {
            UMLPackage *typeScope = type->getUMLPackage();
            if (typeScope != ownParent && typeScope != ownParent->getUMLPackage())
                typeName = type->getFullyQualifiedName();
            else
                typeName = type->getName();
        }
        // The default direction, "in", is not mentioned.
        // Perhaps we should include a pd_Unspecified in
        // Uml::Parameter_Direction to have better control over this.
        if (m_ParmKind == Uml::pd_InOut)
            s += "inout ";
        else if (m_ParmKind == Uml::pd_Out)
            s += "out ";
        // Construct the attribute text.
        QString string = s + getName() + " : " + typeName;
        if(m_InitialValue.length() > 0)
            string += " = " + m_InitialValue;
        return string;
    }
    return s + getName();
}
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:46,代码来源:attribute.cpp

示例3: getFullyQualifiedName

QString UMLAttribute::getFullyQualifiedName( const QString& separator,
                                            bool includeRoot /* = false */) const {
    UMLOperation *op = NULL;
    UMLObject *owningObject = static_cast<UMLObject*>(parent());
    if (owningObject->getBaseType() == Uml::ot_Operation) {
        op = static_cast<UMLOperation*>(owningObject);
        owningObject = static_cast<UMLObject*>(owningObject->parent());
    }
    UMLClassifier *ownParent = dynamic_cast<UMLClassifier*>(owningObject);
    if (ownParent == NULL) {
        kError() << "UMLAttribute::getFullyQualifiedName(" << m_Name
        << "): parent " << owningObject->getName()
        << " is not a UMLClassifier" << endl;
        return "";
    }
    QString tempSeparator = separator;
    if (tempSeparator.isEmpty())
        tempSeparator = UMLApp::app()->activeLanguageScopeSeparator();
    QString fqn = ownParent->getFullyQualifiedName(tempSeparator, includeRoot);
    if (op)
        fqn.append(tempSeparator + op->getName());
    fqn.append(tempSeparator + m_Name);
    return fqn;
}
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:24,代码来源:attribute.cpp

示例4: setupDialog


//.........这里部分代码省略.........
    m_pDeleteButton = buttonBox->addButton( i18n("&Delete"), this, SLOT(slotDeleteParameter()) );
    m_pPropertiesButton = buttonBox->addButton( i18n("&Properties"), this,
                          SLOT(slotParameterProperties()) );
    parmsLayout->addWidget(buttonBox);

    topLayout -> addWidget(m_pParmsGB);

    m_pDeleteButton->setEnabled(false);
    m_pPropertiesButton->setEnabled(false);
    m_pUpButton->setEnabled(false);
    m_pDownButton->setEnabled(false);

    // Add "void". We use this for denoting "no return type" independent
    // of the programming language.
    // For example, the Ada generator would interpret the return type
    // "void" as an instruction to generate a procedure instead of a
    // function.
    insertType( "void" );

    m_pRtypeCB->setDuplicatesEnabled(false);//only allow one of each type in box
    m_pRtypeCB->setCompletionMode( KGlobalSettings::CompletionPopup );

    // add template parameters
    UMLClassifier *classifier = dynamic_cast<UMLClassifier*>(m_pOperation->parent());
    if (classifier) {
        UMLClassifierListItemList tmplParams( classifier->getFilteredList(Uml::ot_Template) );
        for (UMLClassifierListItem *li = tmplParams.first(); li; li = tmplParams.next())
            insertType( li->getName() );
    }
    //now add the Classes and Interfaces (both are Concepts)
    UMLClassifierList namesList( m_doc->getConcepts() );
    UMLClassifier* pConcept = 0;
    for(pConcept=namesList.first(); pConcept!=0 ;pConcept=namesList.next()) {
        insertType( pConcept->getFullyQualifiedName() );
    }

    //work out which one to select
    int returnBoxCount = 0;
    bool foundReturnType = false;
    while (returnBoxCount < m_pRtypeCB->count() && foundReturnType == false) {
        QString returnBoxString = m_pRtypeCB->text(returnBoxCount);
        if ( returnBoxString == m_pOperation->getTypeName() ) {
            foundReturnType = true;
            m_pRtypeCB->setCurrentItem(returnBoxCount);
            break;
        }
        returnBoxCount++;
    }

    if (!foundReturnType) {
        insertType( m_pOperation->getTypeName(), 0 );
        m_pRtypeCB->setCurrentItem(0);
    }

    //fill in parm list box
    UMLAttributeList list = m_pOperation->getParmList();
    UMLAttribute * pAtt = 0;
    for (pAtt = list.first(); pAtt; pAtt = list.next())
        m_pParmsLB->insertItem( pAtt->getName() );

    //set scope
    Uml::Visibility scope = m_pOperation -> getVisibility();
    if( scope == Uml::Visibility::Public )
      m_pPublicRB -> setChecked( true );
    else if( scope == Uml::Visibility::Private )
      m_pPrivateRB -> setChecked( true );
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:67,代码来源:umloperationdialog.cpp


注:本文中的UMLClassifier::getFullyQualifiedName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。