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


C++ WrapperStr::sprintf方法代码示例

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


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

示例1: importIt

void UmlArtifact::importIt(FileIn & in, Token & token, UmlItem * where)
{
    where = where->container(anArtifact, token, in);

    if (where == 0)
        return;

    WrapperStr s = token.valueOf("name");

    if (s.isEmpty()) {
        static unsigned n = 0;

        s.sprintf("anonymous_artifact_%u", ++n);
    }

    UmlArtifact * artifact = create((UmlDeploymentView *) where, s);

    if (artifact == 0)
        in.error("cannot create artifact '" + s +
                 "' in '" + where->name() + "'");

    artifact->addItem(token.xmiId(), in);

    if (! token.closed()) {
        WrapperStr k = token.what();
        const char * kstr = k;

        while (in.read(), !token.close(kstr)) {
            if (token.what() == "manifestation")
                Manifestation::import(in, token, artifact);
            else
                artifact->UmlItem::import(in, token);
        }
    }

    artifact->unload(TRUE, FALSE);
}
开发者ID:bleakxanadu,项目名称:douml,代码行数:37,代码来源:UmlArtifact.cpp

示例2: importIt

void UmlNode::importIt(FileIn & in, Token & token, UmlItem * where)
{
    where = where->container(aNode, token, in);

    if (where == 0)
        return;

    WrapperStr s = token.valueOf("name");

    if (s.isEmpty()) {
        static unsigned n = 0;

        s.sprintf("anonymous_node_%u", ++n);
    }

    UmlNode * node = create((UmlDeploymentView *) where, s);

    if (node == 0)
        in.error("cannot create node '" + s +
                 "' in '" + where->name() + "'");

    node->addItem(token.xmiId(), in);

    if (token.xmiType() == "uml:Device")
        node->set_Stereotype("device");

    if (! token.closed()) {
        WrapperStr k = token.what();
        const char * kstr = k;

        while (in.read(), !token.close(kstr))
            node->UmlItem::import(in, token);
    }

    node->unload(TRUE, FALSE);
}
开发者ID:ErickCastellanos,项目名称:douml,代码行数:36,代码来源:UmlNode.cpp

示例3: importIt

void UmlClass::importIt(FileIn & in, Token & token, UmlItem * where)
{
    where = where->container(aClass, token, in);	// can't be null

    WrapperStr s = token.valueOf("name");

    if (s.isEmpty()) {
        static unsigned n = 0;

        s.sprintf("anonymous_%u", ++n);
    }
    else
        s = legalName(s);

    UmlClass * cl = create(where, s);
    Association * assocclass = 0;
    bool stereotype = FALSE;

    if (cl == 0)
        in.error("cannot create classe '" + s +
                 "' in '" + where->name() + "'");

    cl->addItem(token.xmiId(), in);

    do
        where = where->parent();

    while (where->kind() != aPackage);

    if (where->stereotype() == "profile")
        cl->set_PropertyValue("xmiId", token.xmiId());

    if (token.xmiType() == "uml:Actor")
        cl->set_Stereotype("actor");
    else if (token.xmiType() == "uml:Interface")
        cl->set_Stereotype("interface");
    else if (token.xmiType() == "uml:Enumeration")
        cl->set_Stereotype("enum");
    else if (token.xmiType() == "uml:Stereotype") {
        cl->set_Stereotype("stereotype");
        NumberOf -= 1;
        NumberOfStereotype += 1;
        stereotype = TRUE;
    }
    else if (token.xmiType() == "uml:AssociationClass") {
        assocclass = &Association::get(token.xmiId(), token.valueOf("name"));
        assocclass->set_class_association();
    }

    cl->setVisibility(token.valueOf("visibility"));

    if (token.valueOf("isabstract") == "true")
        cl->set_isAbstract(TRUE);

    if (token.valueOf("isactive") == "true")
        cl->set_isActive(TRUE);

    if (! token.closed()) {
        WrapperStr k = token.what();
        const char * kstr = k;
        WrapperStr assocclass_ref1;
        WrapperStr assocclass_ref2;

        while (in.read(), !token.close(kstr)) {
            s = token.what();

            if ((s == "ownedtemplatesignature") &&
                ((token.xmiType() == "uml:TemplateSignature") ||
                 (token.xmiType() == "uml:RedefinableTemplateSignature")))
                cl->readFormal(in, token);
            else if ((s == "templatebinding") &&
                     (token.xmiType() == "uml:TemplateBinding")) {
                Binding::import(in, token, cl);
            }
            else if ((assocclass != 0) && (s == "memberend")) {
                if (assocclass_ref1.isEmpty())
                    assocclass_ref1 = token.xmiIdref();
                else
                    assocclass_ref2 = token.xmiIdref();

                if (! token.closed())
                    in.finish(s);
            }
            else if ((assocclass != 0) &&
                     (s == "ownedend") &&
                     (token.xmiType() == "uml:Property"))
                assocclass->import(in, token);
            else if (s == "ownedrule")
                cl->set_Constraint(UmlItem::readConstraint(in, token));
            else if (stereotype &&
                     (s == "icon") &&
                     (token.xmiType() == "uml:Image")) {
                WrapperStr path = token.valueOf("location");

                if (! path.isEmpty())
                    cl->set_PropertyValue("stereotypeIconPath", path);

                if (! token.closed())
                    in.finish(s);
            }
//.........这里部分代码省略.........
开发者ID:daniel7solis,项目名称:douml,代码行数:101,代码来源:UmlClass.cpp

示例4: importIt

void UmlPackage::importIt(FileIn & in, Token & token, UmlItem * where)
{
    while (where->kind() != aPackage)
        where = where->parent();

    WrapperStr s = token.valueOf("name");

    if (s.isEmpty()) {
        static unsigned n = 0;

        s.sprintf("anonymous %u", ++n);
    }

    UmlPackage * pack = create((UmlPackage *) where, s);

    if (pack == 0)
        in.error("cannot create package '" + s + "' in '" + where->name() + "'");

    bool profile =
        (token.what() == "uml:profile") || (token.xmiType() == "uml:Profile");

    if (profile) {
        pack->set_Stereotype("profile");
        pack->set_PropertyValue("xmiId", token.xmiId());
        NumberOf -= 1;
        NumberOfProfile += 1;

        if (!(s = token.valueOf("metamodelreference")).isEmpty())
            pack->set_PropertyValue("metamodelReference", s);

        if (!(s = token.valueOf("metaclassreference")).isEmpty())
            pack->set_PropertyValue("metaclassReference", s);
    }

    s = token.xmiId();

    if (!s.isEmpty()) {
        pack->addItem(s, in);

        if (! token.closed()) {
            WrapperStr k = token.what();
            const char * kstr = k;

            if (profile) {
                while (in.read(), !token.close(kstr)) {
                    if ((token.what() == "packagedelement") &&
                        (token.xmiType() == "uml:Extension")) {
                        if (! token.closed())
                            in.finish(token.what());
                    }
                    else if (token.what() == "packageimport")
                        pack->packageImport(in, token);
                    else
                        pack->UmlItem::import(in, token);
                }

                updateProfiles();
            }
            else
                while (in.read(), !token.close(kstr))
                    pack->UmlItem::import(in, token);
        }
    }
    else if (! token.valueOf("href", s))
        in.error("xmi:id is missing"); // doesn't return
    else {
        in.warning("bypass external package " + s);

        if (! token.closed())
            in.finish(token.what());
    }

    pack->unload(TRUE, FALSE);
}
开发者ID:bleakxanadu,项目名称:douml,代码行数:74,代码来源:UmlPackage.cpp

示例5: importIt

void UmlActivity::importIt(FileIn & in, Token & token, UmlItem * where)
{
    where = where->container(anActivity, token, in);

    if (where != 0) {
        WrapperStr s = token.valueOf("name");

        if (s.isEmpty()) {
            static unsigned n = 0;

            s.sprintf("anonymous_activity_%u", ++n);
        }

        UmlActivity * a = create((UmlClassView *) where, s);

        if (a == 0)
            in.error("cannot create activity '"
                     + s + "' in '" + where->name() + "'");

        a->addItem(token.xmiId(), in);

        if (token.valueOf("isreadonly") == "true")
            a->set_isReadOnly(TRUE);

        if (token.valueOf("issingleexecution") == "true")
            a->set_isSingleExecution(TRUE);

        if (token.valueOf("isactive") == "true")
            a->set_isActive(TRUE);

        WrapperStr spec = token.valueOf("specification");

        if (! token.closed()) {
            WrapperStr k = token.what();
            const char * kstr = k;

            while (in.read(), !token.close(kstr)) {
                s = token.what();

                if ((s == "precondition") || (s == "postcondition") ||
                    (s == "localprecondition") || (s == "localpostcondition"))
                    a->readCondition(in, token);
                else if (s == "ownedparameter")
                    a->readParameter(in, token);
                else if ((s == "node") &&
                         (token.xmiType() == "uml:ActivityParameterNode"))
                    a->readParameterNode(in, token);
                else if (s == "specification") {
                    spec = token.xmiIdref();

                    if (! token.closed())
                        in.finish(s);
                }
                else if (s == "ownedrule")
                    a->set_Constraint(UmlItem::readConstraint(in, token));
                else
                    a->UmlItem::import(in, token);
            }
        }

        if (! spec.isEmpty()) {
            QMap<WrapperStr, UmlItem *>::Iterator it = All.find(spec);

            if (it == All.end())
                Unresolved::addRef(a, spec);
            else if ((*it)->kind() == anOperation)
                a->set_Specification((UmlOperation *) *it);
        }

        a->unload(TRUE, FALSE);
    }
}
开发者ID:bleakxanadu,项目名称:douml,代码行数:72,代码来源:UmlActivity.cpp

示例6: importIt

void UmlState::importIt(FileIn & in, Token & token, UmlItem * where)
{
    where = where->container(aState, token, in);

    if (where != 0) {
        bool machine = ((token.xmiType() == "uml:StateMachine") ||
                        (token.valueOf("issubmachinestate") == "true") ||
                        (token.what() == "ownedstatemachine")); // andromda emf
        WrapperStr s = token.valueOf("name");

        if (s.isEmpty()) {
            static unsigned n = 0;

            s.sprintf((machine) ? "anonymous_state_machine_%u"
                      : "anonymous_state_%u",
                      ++n);
        }

        UmlState * st = create(where, s);

        if (st == 0)
            in.error((machine) ? "cannot create state machine '"
                     : "cannot create state '"
                     + s + "' in '" + where->name() + "'");

        st->addItem(token.xmiId(), in);

        if (token.valueOf("isactive") == "true")
            st->set_isActive(TRUE);

        WrapperStr ref = token.valueOf("submachine");
        WrapperStr spec = token.valueOf("specification");

        if (! token.closed()) {
            WrapperStr k = token.what();
            const char * kstr = k;

            while (in.read(), !token.close(kstr)) {
                s = token.what();

                if ((s == "entry") || (s == "doactivity") || (s == "exit"))
                    st->importActivity(in, token);
                else if (s == "specification") {
                    spec = token.xmiIdref();

                    if (! token.closed())
                        in.finish(s);
                }
                else
                    st->UmlItem::import(in, token);
            }
        }

        if (machine)
            st->set_Stereotype("machine");

        if (! ref.isEmpty()) {
            QMap<WrapperStr, UmlItem *>::Iterator it = All.find(ref);

            if (it == All.end())
                UnresolvedWithContext::add(st, ref, 4);
            else if ((*it)->kind() == aState)
                st->set_Reference((UmlState *) *it);
        }

        if (! spec.isEmpty()) {
            QMap<WrapperStr, UmlItem *>::Iterator it = All.find(spec);

            if (it == All.end())
                UnresolvedWithContext::add(st, spec, 3);
            else if ((*it)->kind() == anOperation)
                st->set_Specification((UmlOperation *) *it);
        }

        st->unload(TRUE, FALSE);
    }
}
开发者ID:bleakxanadu,项目名称:douml,代码行数:77,代码来源:UmlState.cpp


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