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


C++ UmlClass::stereotype方法代码示例

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


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

示例1: extend

void UmlClass::extend(WrapperStr mcl)
{
    if (parent()->parent()->kind() != aPackage)
        return;

    int index = mcl.find('#');

    if (index == -1)
        return;

    WrapperStr path = mcl.left(index);
    const char * defltpath0 = "http://schema.omg.org/spec/UML/2.0/uml.xml";
    const char * defltpath1 = "http://schema.omg.org/spec/UML/2.1/uml.xml";
    bool dflt = ((path == defltpath0) || (path == defltpath1));

    mcl = mcl.mid(index + 1);

    static Q3PtrList<UmlClass> metaclasses;

    Q3PtrListIterator<UmlClass> it(metaclasses);
    UmlClass * metacl = UmlClass::get(mcl, 0);
    WrapperStr s;

    if ((metacl == 0) ||
        (metacl->stereotype() != "metaclass") ||
        !((dflt) ? (!metacl->propertyValue("metaclassPath", s) ||
                    (s == defltpath0) ||
                    (s == defltpath1))
          : (metacl->propertyValue("metaclassPath", s) &&
             (path == s)))) {
        metacl = 0;

        if (dflt) {
            for (; (metacl = it.current()) != 0; ++it) {
                if (!strcmp(mcl, metacl->name()) &&
                    (!metacl->propertyValue("metaclassPath", s) ||
                     (s == defltpath0) ||
                     (s == defltpath1)))
                    break;
            }
        }
        else {
            for (; (metacl = it.current()) != 0; ++it) {
                if (!strcmp(mcl, metacl->name()) &&
                    metacl->propertyValue("metaclassPath", s) &&
                    (path == s))
                    break;
            }
        }

        if (metacl == 0) {
            metacl = addMetaclass(mcl, (dflt) ? 0 : (const char *)path); //[rageek] different types for ? :
            metaclasses.append(metacl);
        }
    }

    UmlRelation::create(aDirectionalAssociation, this, metacl);
}
开发者ID:daniel7solis,项目名称:douml,代码行数:58,代码来源:UmlClass.cpp

示例2: new_one


//.........这里部分代码省略.........
            if (at->isVolatile() != volatilep) {
                at->set_isVolatile(volatilep);
                container->set_updated();
            }

            if (at->isClassMember() != staticp) {
                at->set_isClassMember(staticp);
                container->set_updated();
            }

            if (!array.isEmpty())
                decl.insert(index + 7, "${multiplicity}");

            if (neq(at->multiplicity(), array)) {
                at->set_Multiplicity(array);
                container->set_updated();
            }

            WrapperStr v = at->defaultValue();

            if (!v.isEmpty() && (((const char *) v)[0] == '='))
                v = v.mid(1);

            if (nequal(v, value)) {
                at->set_DefaultValue(value);
                container->set_updated();
            }

            if (nequal(at->javaAnnotations(), annotation)) {
                at->set_JavaAnnotations(annotation);
                container->set_updated();
            }

            WrapperStr stereotype;
            bool force_ste = FALSE;

            if (cl->stereotype() == "enum") {
                stereotype = "attribute";
                force_ste = TRUE;
            }
            else if (typespec.type == 0) {
                WrapperStr t = typespec.explicit_type;
                int index2;

                if (!t.isEmpty() &&
                    (t.at(t.length() - 1) == ">") &&
                    ((index2 = t.find('<')) > 0)) {
                    stereotype = t.left(index2);
                    typespec.explicit_type =
                        // may be a,b ...
                        t.mid(index2 + 1, t.length() - 2 - index2);
                    decl.replace(index, 7, "${stereotype}<${type}>");
                    force_ste = TRUE;
                }
            }

            if (at->visibility() != visibility) {
                at->set_Visibility(visibility);
                container->set_updated();
            }

            if (neq(at->stereotype(), stereotype)) {
                WrapperStr jst;

                if (! at->stereotype().isEmpty())
                    jst = JavaSettings::relationAttributeStereotype(at->stereotype());
开发者ID:ErickCastellanos,项目名称:douml,代码行数:67,代码来源:UmlAttribute.cpp

示例3: s

UmlClass * UmlClass::auxilarily_typedef(const WrapperStr & base
#ifdef REVERSE
                                        , bool libp
# ifdef ROUNDTRIP
                                        , bool container_roundtrip
                                        , QList<UmlItem *> & container_expected_order
# endif
#endif
                                       )
{
    WrapperStr typedef_decl = CppSettings::typedefDecl();
    const QVector<UmlItem*>& children = parent()->children();
    unsigned n = children.count();
    unsigned index;

    // a typedef with the right definition already exist ?
    for (index = 0; index != n; index += 1) {
        if (children[index]->kind() == aClass) {
            UmlClass * cl = (UmlClass *) children[index];

            if ((cl->stereotype() == "typedef") &&
                (cl->cppDecl() == typedef_decl) &&
                (cl->baseType().explicit_type == base)) {
#ifdef ROUNDTRIP
                cl->set_usefull();

                if (container_roundtrip)
                    container_expected_order.append(cl);

#endif
                return cl;
            }
        }
    }

    // must create typedef with a new name
    for (;;) {
        static unsigned nty;

        QString s("typedef%1");
        s=s.arg(QString::number(++nty));


        for (index = 0; index != n; index += 1)
            if (children[index]->name() == s)
                break;

        if (index == n) {
            UmlClass * cl = UmlClass::create(parent(), s.toLatin1().constData());

            if (cl == 0) {
#ifdef REVERSE
                UmlCom::message("");
                CppCatWindow::trace(WrapperStr("<font face=helvetica><b>cannot create class <i>")
                                    + s + "</i> under <i>"
                                    + parent()->name() + "</b></font><br>");
                throw 0;
#else
                QMessageBox::critical(0, "Fatal Error",
                                      WrapperStr("<font face=helvetica><b>cannot create class <i>")
                                      + s + "</i> under <i>"
                                      + parent()->name() + "</b></font><br>");
                QApplication::exit(1);
#endif
            }

            UmlTypeSpec typespec;

            typespec.explicit_type = base;
            cl->set_Stereotype("typedef");
            cl->set_BaseType(typespec);
            cl->set_CppDecl(typedef_decl);
#ifdef REVERSE

            if (!libp)
                cl->need_artifact(Namespace::current());

# ifdef ROUNDTRIP

            if (container_roundtrip)
                container_expected_order.append(cl);

# endif
#endif

            return cl;
        }
    }
}
开发者ID:ErickCastellanos,项目名称:douml,代码行数:89,代码来源:UmlClass.cpp


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