Exemplo n.º 1
0
    /**
     * @brief SignatureMaker::makeType
     * @param type
     * @return
     */
    QString SignatureMaker::makeType(const Entity::SharedType &type) const
    {
        if (!type)
            return "";

        QString result;

        QStringList scopes;
        auto scopeId = type->scopeId();
        QSet<Common::ID> forbidden = {Common::ID::projectScopeID(),
                                            Common::ID::globalScopeID(),
                                            Common::ID::localTemplateScopeID()};
        while (!globalIds.contains(scopeId)) {
            if (auto scope = findScope(scopeId)) {
                if (!scope->name().isEmpty() && !forbidden.contains(scopeId))
                    scopes.prepend(scope->name());
                scopeId = scope->scopeId();
            } else {
                return "";
            }
        }

        scopes.removeAll("");
        if (!scopes.isEmpty())
            result.prepend(scopes.join("::").append("::"));

        result.append(type->name());

        return result;
    }
Exemplo n.º 2
0
 /**
  * @brief MoveTypeToOtherScope::MoveTypeToOtherScope
  * @param type
  * @param appModel
  * @param srcScope
  * @param dstScope
  * @param parent
  */
 MoveTypeToOtherScope::MoveTypeToOtherScope(const entity::SharedType &type,
                                            const models::SharedApplicationModel &appModel,
                                            const entity::SharedScope &srcScope,
                                            const entity::SharedScope &dstScope,
                                            QUndoCommand *parent)
     : BaseCommand(tr("Move \"%1\" from \"%2\" to \"%3\".").arg(type->name(), srcScope->name(), dstScope->name()),
                   parent)
     , m_Type(type)
     , m_SrcScope(srcScope)
     , m_DstScope(dstScope)
     , m_Model(appModel)
 {
 }