• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ UmlOperation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: QLOG_INFO

void UmlClass::addContructor(bool expl)
{
    TRACE_FUNCTION;
    QLOG_INFO() << "1.1.1";
    UmlOperation * op = UmlOperation::create(this, name());
    QLOG_INFO() << "1.1.2";
    if (op == 0)
        UmlCom::trace("can't add contructor");
    else {
        QLOG_INFO() << "1.1.3";
        QByteArray s;
        int index;

        // remove the useless "${type} " mainly to remove the space

        s = op->cppDecl();
        QLOG_INFO() << s;
        QLOG_INFO() << "1.1.4";
        if (s.isEmpty())
            s = CppSettings::operationDecl();
        QLOG_INFO() << s;
        QLOG_INFO() << "1.1.5";
        if ((index = s.indexOf("${type} ")) != -1)
            s.remove(index, 8);
        QLOG_INFO() << s;
        QLOG_INFO() << "1.1.6";
        if (expl && ((index = s.indexOf("${name}")) != -1))
            s.insert(index, "explicit ");
        QLOG_INFO() << s;
        QLOG_INFO() << "1.1.7";
        op->set_CppDecl(s);
        QLOG_INFO() << s;
        QLOG_INFO() << "1.1.8";
        s = op->cppDef();
        QLOG_INFO() << s;
        QLOG_INFO() << "1.1.81";
        if (s.isEmpty())
            s = CppSettings::operationDef();
        QLOG_INFO() << "1.1.9";
        if ((index = s.indexOf("${type} ")) != -1)
            s.remove(index, 8);
        QLOG_INFO() << "1.1.10";
        op->set_CppDef(s);
    }
}
开发者ID:gilbertoca,项目名称:douml,代码行数:45,代码来源:UmlClass.cpp


示例2: generate

void UmlJunctionPseudoState::generate(UmlClass * machine, UmlClass * anystate, UmlState * state) {
  // create an operation because a priori shared
  if (_oper.isEmpty())
    _oper.sprintf("_junction%d", ++_rank);

  UmlClass * cl = state->assocClass();
  UmlOperation * junction;
  
  if (((junction = (UmlOperation *) cl->getChild(anOperation, _oper)) == 0) &&
      ((junction = UmlBaseOperation::create(cl, _oper)) == 0)) {
    UmlCom::trace("Error : cannot create operation '" + _oper 
		  + "' in class '" + cl->name() + "'<br>");
    throw 0;
  }

  junction->defaultDef();
  junction->setComment("implement a junction, through an operation because shared, internal");
  junction->setType("void", "${type}");
  junction->addParam(0, InputOutputDirection, "stm", machine);
  junction->setParams("${t0} & ${p0}");
  
  Q3CString body;
  const Q3PtrVector<UmlItem> ch = children();
  Q3PtrList<UmlTransition> trs;
  unsigned index;
  
  for (index = 0; index != ch.count(); index += 1)
    if (ch[index]->kind() == aTransition)
      // theo mandatory
      trs.append((UmlTransition *) ch[index]);
    
  UmlTransition::generate(trs, machine, anystate, state, body, "  ", FALSE);
  
  junction->set_CppBody(body);
}
开发者ID:SciBoy,项目名称:douml,代码行数:35,代码来源:UmlJunctionPseudoState.cpp


示例3: addAssign

void UmlClass::addAssign(bool cte)
{
    TRACE_FUNCTION;
    UmlOperation * op = UmlOperation::create(this, "operator=");

    if (op == 0)
        UmlCom::trace("can't add assignment contructor");
    else {
        // add 'source' parameter

        UmlParameter param;

        param.name = "source";
        param.dir = (cte) ? InputDirection : InputOutputDirection;
        param.type.type = this;

        op->addParameter(0, param);

        // set return type, add the parameter profile

        UmlTypeSpec t;

        t.type = this;

        op->set_ReturnType(t);

        QByteArray p = (cte) ? "const ${t0} & ${p0}" : "${t0} & ${p0}";
        QByteArray s;
        int index;

        s = op->cppDecl();

        if (s.isEmpty())
            s = CppSettings::operationDecl();

        if ((index = s.indexOf("${(}")) != -1)
            s.insert(index + 4, (const char *)p); //[rageek] cast because QByteArray

        if ((index = s.indexOf("${type}")) != -1)
            s.insert(index + 7, " &");

        op->set_CppDecl(s);

        s = op->cppDef();

        if (s.isEmpty())
            s = CppSettings::operationDef();

        if ((index = s.indexOf("${(}")) != -1)
            s.insert(index + 4, (const char *)p); //[rageek] cast because QByteArray

        if ((index = s.indexOf("${type}")) != -1)
            s.insert(index + 7, " &");

        op->set_CppDef(s);
    }
}
开发者ID:gilbertoca,项目名称:douml,代码行数:57,代码来源:UmlClass.cpp


示例4: name

void UmlClass::addCopy(bool cte)
{
    TRACE_FUNCTION;
    UmlOperation * op = UmlOperation::create(this, name());

    if (op == 0)
        UmlCom::trace("can't add copy contructor");
    else {
        // to see that it is a copy constructor
        op->set_Stereotype("copy");

        // add 'source' parameter

        UmlParameter param;

        param.name = "source";
        param.dir = (cte) ? InputDirection : InputOutputDirection;
        param.type.type = this;

        op->addParameter(0, param);

        // add the parameter profile, and
        // remove the useless "${type} " mainly to remove the space

        QByteArray p = (cte) ? "const ${t0} & ${p0}" : "${t0} & ${p0}";
        QByteArray s;
        int index;

        s = op->cppDecl();

        if (s.isEmpty())
            s = CppSettings::operationDecl();

        if ((index = s.indexOf("${(}")) != -1)
            s.insert(index + 4, (const char *)p); //[rageek] cast because QByteArray

        if ((index = s.indexOf("${type} ")) != -1)
            s.remove(index, 8);

        op->set_CppDecl(s);

        s = op->cppDef();

        if (s.isEmpty())
            s = CppSettings::operationDef();

        if ((index = s.indexOf("${(}")) != -1)
            s.insert(index + 4, (const char *)p); //[rageek] cast because QByteArray

        if ((index = s.indexOf("${type} ")) != -1)
            s.remove(index, 8);

        op->set_CppDef(s);
    }
}
开发者ID:gilbertoca,项目名称:douml,代码行数:55,代码来源:UmlClass.cpp


示例5: children

void UmlClass::add_inherited_opers(Vector * ops)
{
    if (inherited_opers == 0) {
        const QVector<UmlItem*> ch = children();

        inherited_opers = new Vector;

        for (int i = 0; i != ch.size(); i += 1) {
            switch (ch[i]->kind()) {
            case aRelation: {
                UmlRelation * rel = (UmlRelation *) ch[i];
                aRelationKind k = rel->relationKind();

                if ((k == aGeneralisation) || (k == aRealization))
                    rel->roleType()->add_inherited_opers(inherited_opers);
            }
            break;

            case anOperation: {
                UmlOperation * op = (UmlOperation *) ch[i];

                if ((op->visibility() == PublicVisibility) &&
                    (op->name()[0] != '~') &&
                    (op->name() != name()))
                    inherited_opers->addElement(op);
            }

            default:
                break;
            }
        }
    }

    if (ops != 0)
        for (unsigned i = 0; i != inherited_opers->size(); i += 1)
            if (! ops->contains(inherited_opers->elementAt(i)))
                ops->addElement(inherited_opers->elementAt(i));

    unload(TRUE, FALSE);
}
开发者ID:DoUML,项目名称:douml,代码行数:40,代码来源:UmlClass.cpp


示例6: switch

UmlOperation * UmlOperation::already_exist(Class * container, const Q3CString & name,
        Q3ValueList<UmlParameter> & params)
{
    const Q3PtrVector<UmlItem> & ch = container->get_uml()->UmlItem::children();
    UmlItem ** v = ch.data();
    UmlItem ** const vsup = v + ch.size();
    Q3PtrList<UmlOperation> opers;

    for (; v != vsup; v += 1)
        if (((*v)->kind() == anOperation) &&
                ((*v)->name() == name) &&
                ((UmlOperation *) *v)->is_useless())
            opers.append((UmlOperation *) *v);

    switch (opers.count()) {
    case 0:
        return 0;
    case 1:
        // suppose it is this one
        // even don't know if it is placed later in file
        return opers.getFirst();
    default:
        break;
    }

    UmlOperation * op;
    Q3PtrList<UmlOperation> same_names;

    // search for operation having the same params name and number
    for (op = opers.first(); op != 0; op = opers.next()) {
        Q3ValueList<UmlParameter> ps = op->params();
        Q3ValueList<UmlParameter>::ConstIterator it1;
        Q3ValueList<UmlParameter>::ConstIterator it2;
        bool same_type = TRUE;
        bool same_name = TRUE;

        for (it1 = params.begin(), it2 = ps.begin();
                (it1 != params.end()) && (it2 != ps.end());
                ++it1, ++it2) {
            const UmlParameter & p1 = *it1;
            const UmlParameter & p2 = *it2;

            if (p1.name != p2.name) {
                same_name = FALSE;
                break;
            }

            if (!p1.type.equal(p2.type))
                same_type = FALSE;
        }

        if (same_name && (it1 == params.end()) && (it2 == ps.end())) {
            if (same_type)
                // perhaps several has the same number of param
                // and same param names and type because of []
                // not managed here, suppose the right is this one
                return op;
            same_names.append(op);
        }
    }

    if (same_names.count() == 1) {
        // only one having the same number of param
        // and same param names (type changed)
        // suppose this one
        return same_names.getFirst();
    }

    // suppose not find
    return 0;
}
开发者ID:,项目名称:,代码行数:71,代码来源:


示例7: strtol

UmlOperation *  UmlOperation::already_exist_from_id(Class * container, Q3CString & body)
{
    const char * BodyPrefix = "// Bouml preserved body begin ";
    const char * BodyPostfix = "// Bouml preserved body end ";
    const int BodyPrefixLength = 30;
    const int BodyPostfixLength = 28;

    int index = body.find(BodyPrefix);

    if (index != -1) {
        const char * b1 = ((const char *) body) + index + BodyPrefixLength;
        char * b2;
        long id = strtol(b1, &b2, 16);

        if (b2 != (b1 + 8)) {
            QString err = "<font color =\"red\"> Error in " + Lex::filename() +
                          " before line " + QString::number(Lex::line_number()) +
                          " : invalid preserve body identifier</font><br>";

            UmlCom::trace(err);
            throw 0;
        }

        if (*b2 == '\r')
            b2 += 1;
        if (*b2 == '\n')
            b2 += 1;
        else {
            QString err = "<font color =\"red\"> Error in " + Lex::filename() +
                          " before line " + QString::number(Lex::line_number()) +
                          " : invalid preserve body block, end of line expected</font><br>";

            UmlCom::trace(err);
            throw 0;
        }

        const char * e;

        if (((e = strstr(b2, BodyPostfix)) == 0) ||
                (strncmp(e + BodyPostfixLength, b1, 8) != 0)) {
            QString err = "<font color =\"red\"> Error in " + Lex::filename() +
                          " before line " + QString::number(Lex::line_number()) +
                          " : invalid preserve body block, wrong balanced</font><br>";

            UmlCom::trace(err);
            throw 0;
        }

        while ((e != b2) && (e[-1] != '\n'))
            e -= 1;

        body = body.mid(b2 - (const char *) body, e - b2);

        UmlOperation * op = (UmlOperation *) UmlBaseItem::from_id((unsigned) id, anOperation);

        if (op != 0) {
            if (!op->is_useless()) {
                QString err = "<font color =\"red\"> Error in " + Lex::filename() +
                              " before line " + QString::number(Lex::line_number()) +
                              " : preserve body block identifier used twice</font><br>";

                UmlCom::trace(err);
                throw 0;
            }

            if ((op->parent() == container->get_uml()) &&
                    // currently get/set are removed then recreated
                    (op->getOf() == 0) &&
                    (op->setOf() == 0))
                return op;
        }
    }

    return 0;
}
开发者ID:,项目名称:,代码行数:75,代码来源:


示例8: QLOG_INFO

bool UmlOperation::new_one(Class * container, const Q3CString & name,
                           const Q3ValueList<FormalParameterList> & tmplts,
                           const Q3CString & oper_templ,
                           UmlTypeSpec & type, Q3CString str_actuals,
                           UmlClass * first_actual_class, Q3CString type_def,
                           aVisibility visibility,
                           bool finalp, bool abstractp, bool staticp,
                           bool nativep, bool strictfp, bool synchronizedp,
                           const Q3CString & array, Q3CString comment,
                           Q3CString description, Q3CString annotation
#ifdef ROUNDTRIP
                           , bool roundtrip, Q3PtrList<UmlItem> & expected_order
#endif
                          )
{
    // the "(" was read

#ifdef TRACE
    QLOG_INFO() <<"OPERATION '" << name << "'\n";
#endif

    UmlClass * cl = container->get_uml();
    UmlOperation * op;
#ifdef ROUNDTRIP
    bool may_roundtrip = roundtrip &&
                         (!container->from_libp() ||	(visibility != PrivateVisibility));
    UmlTypeSpec return_type;
    Q3ValueList<UmlParameter> params;
    Q3ValueList<UmlTypeSpec> exceptions;
    Q3CString body;

    if (may_roundtrip)
#else
    if (
# ifdef REVERSE
        container->from_libp() &&
# endif
        (visibility == PrivateVisibility))
#endif
        op = 0;
    else {
        op = UmlBaseOperation::create(cl, name);

        if (op == 0) {
            JavaCatWindow::trace(Q3CString("<font face=helvetica><b>cannot add operation <i>")
                                 + name + "</i> in <i>" + cl->name()
                                 + "</i></b></font><br>");
            return FALSE;
        }

#ifndef ROUNDTRIP
# if defined(REVERSE)
        Statistic::one_operation_more();
# endif
#endif
    }

    Q3CString def;

#ifdef ROUNDTRIP
    if (may_roundtrip || (op != 0)) {
#else
    if (op != 0) {
        op->set_Visibility(visibility);
        if (staticp) op->set_isClassMember(TRUE);
        if (abstractp) op->set_isAbstract(TRUE);
        if (finalp) op->set_isJavaFinal(TRUE);
        if (synchronizedp) op->set_isJavaSynchronized(TRUE);
        if (! annotation.isEmpty()) op->set_JavaAnnotations(annotation);
#endif

        def = JavaSettings::operationDef();

        int index;

        if (((index = def.find("${(}")) == -1) ||
                ((index = def.find("${)}", index + 4)) == -1) ||
                ((index = def.find("${throws}", index + 4)) == -1) ||
                (def.find("${body}", index + 9) == -1) ||
                ((index = def.find("${type}")) == -1)) {
            // use a definition where ${body] is not indented
            def = "  ${comment}${@}${visibility}${final}${static}${abstract}${synchronized}${type} ${name}${(}${)}${throws}${staticnl}{\n${body}}\n";
            index = def.find("${type}");
        }

        if (!array.isEmpty())
            def.insert(index + 7, (const char *)array);

        if (nativep) {
            def.insert(index, "native ");
            index += 7;

            // no body
            int index2 = def.find("${throws}", index+7);

            if (index2 != -1) {
                def.resize(index2 + 12);
                def[index2 + 9] = ';';
                def[index2 + 10] = '\n';
            }
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


示例9: triggerName

void UmlTransition::generate(UmlClass * machine, UmlClass * anystate, UmlState * state)
{
    if (_already_managed)
        return;

    Q3CString s = triggerName();

    // group transitions having the same trigger
    const Q3PtrVector<UmlItem> ch = parent()->children();
    unsigned index = ch.findRef(this);
    Q3PtrList<UmlTransition> trs;
    UmlTransition * tr_no_guard = 0;

    if (cppGuard().isEmpty())
        tr_no_guard = this;
    else
        trs.append(this);

    while (++index != ch.count()) {
        if ((ch[index]->kind() == aTransition) &&
            (((UmlTransition *) ch[index])->triggerName() == s)) {
            if (!((UmlTransition *) ch[index])->cppGuard().isEmpty())
                trs.append((UmlTransition *) ch[index]);
            else if (tr_no_guard != 0) {
                UmlCom::trace("Error : several transitions from '" + parent()->name()
                              + "' don't have guard");
                throw 0;
            }
            else
                tr_no_guard = (UmlTransition *) ch[index];

            ((UmlTransition *) ch[index])->_already_managed = TRUE;
        }
    }

    if (tr_no_guard != 0)
        // place it at end
        trs.append(tr_no_guard);

    // made the trigger

    UmlOperation * trg = state->assocClass()->trigger(s, machine, anystate);
    Q3CString body;

    if (s == "create") {
        // manage entry
        if (!state->cppEntryBehavior().isEmpty())
            body = "  _doentry(stm);\n";
    }

    if (!state->cppDoActivity().isEmpty())
        // state do activity before each event except create
        body += "  _do(stm);\n";

    bool completion = (s == "_completion");

    if (!completion && state->isLeaf() && state->hasCompletion())
        // manage completion
        body += "  if (_completion(stm)) return;\n";

    UmlTransition::generate(trs, machine, anystate, state,
                            body, "  ", completion);

    trg->set_CppBody(body);
}
开发者ID:bleakxanadu,项目名称:douml,代码行数:65,代码来源:UmlTransition.cpp


示例10: define

void UmlState::html(Q3CString pfix, unsigned int rank, unsigned int level) {
  define();

  chapter((parent()->kind() == aClassView)
	  ? "StateMachine" : "State",
	  pfix, rank, "state", level);

  Q3CString s = description();
  
  if (!s.isEmpty()) {
    fw.write("<p>");
    writeq(description());
    fw.write("<br /></p>");
  }

  UmlState * ref = reference();
  
  if (ref != 0) {
    fw.write("<p>References ");
    ref->write();
    fw.write("</p>");
  }
  else {
    if (isActive())
      fw.write("<p>Active state</p>\n");
    
    UmlOperation * beh = specification();
    
    if (beh != 0) {
      fw.write("<p>Implements ");
      beh->write();
      fw.write("</p>");
    }
    
    Q3CString scpp, sjava;
    
    s = entryBehavior();
    scpp = cppEntryBehavior();
    sjava = javaEntryBehavior();
    
    if (!s.isEmpty() || !scpp.isEmpty() || !sjava.isEmpty()) {
      fw.write("<p>Entry Behavior :</p><ul>");
      
      if (!s.isEmpty()) {
	fw.write("<li>OCL : <pre>\n");
	writeq(s);
	fw.write("</pre></li>");
      }
      
      if (!scpp.isEmpty()) {
	fw.write("<li>C++ : <pre>\n");
	writeq(scpp);
	fw.write("</pre></li>");
      }
      
      if (!sjava.isEmpty()) {
	fw.write("<li>Java : <pre>\n");
	writeq(sjava);
	fw.write("</pre></li>");
      }
      
      fw.write("</ul>");
    }
    
    s = exitBehavior();
    scpp = cppExitBehavior();
    sjava = javaExitBehavior();
    
    if (!s.isEmpty() || !scpp.isEmpty() || !sjava.isEmpty()) {
      fw.write("<p>Exit Behavior :</p><ul>");
      
      if (!s.isEmpty()) {
	fw.write("<li>OCL : <pre>\n");
	writeq(s);
	fw.write("</pre></li>");
      }
      
      if (!scpp.isEmpty()) {
	fw.write("<li>C++ : <pre>\n");
	writeq(scpp);
	fw.write("</pre></li>");
      }
      
      if (!sjava.isEmpty()) {
	fw.write("<li>Java : <pre>\n");
	writeq(sjava);
	fw.write("</pre></li>");
      }
      
      fw.write("</ul>");
    }
    
    s = doActivity();
    scpp = cppDoActivity();
    sjava = javaDoActivity();
    
    if (!s.isEmpty() || !scpp.isEmpty() || !sjava.isEmpty()) {
      fw.write("<p>Do activity :</p><ul>");
      
      if (!s.isEmpty()) {
//.........这里部分代码省略.........
开发者ID:SciBoy,项目名称:douml,代码行数:101,代码来源:UmlState.cpp


示例11: read_file

void UmlOperation::roundtrip(const char * path, aLanguage who)
{
    char * s = read_file(path);

    if (s != 0) {
        char * p1 = s;
        char * p2;
        WrapperStr(UmlOperation::*get_body)();
        bool (UmlOperation::*set_body)(const char * s);
        bool (UmlOperation::*set_contextualbodyindent)(bool v);
        const char * prefix;
        const char * postfix;

        switch (who) {
        case cppLanguage:
            get_body = &UmlOperation::cppBody;
            set_body = &UmlOperation::set_CppBody;
            set_contextualbodyindent = &UmlOperation::set_CppContextualBodyIndent;
            prefix = BodyPrefix;
            postfix = BodyPostfix;
            break;

        case javaLanguage:
            get_body = &UmlOperation::javaBody;
            set_body = &UmlOperation::set_JavaBody;
            set_contextualbodyindent = &UmlOperation::set_JavaContextualBodyIndent;
            prefix = BodyPrefix;
            postfix = BodyPostfix;
            break;

        case phpLanguage:
            get_body = &UmlOperation::phpBody;
            set_body = &UmlOperation::set_PhpBody;
            set_contextualbodyindent = &UmlOperation::set_PhpContextualBodyIndent;
            prefix = BodyPrefix;
            postfix = BodyPostfix;
            break;

        default:
            // python
            get_body = &UmlOperation::pythonBody;
            set_body = &UmlOperation::set_PythonBody;
            set_contextualbodyindent = &UmlOperation::set_PythonContextualBodyIndent;
            prefix = BodyPythonPrefix;
            postfix = BodyPythonPostfix;
        }

        while ((p2 = strstr(p1, prefix)) != 0) {
            p2 += BodyPrefixLength;

            char * body;
            long id = strtol(p2, &body, 16);

            if (body != (p2 + 8)) {
                UmlCom::trace(WrapperStr("<font color =\"red\"> Error in ") + path +
                              linenumber(s, p2 - BodyPrefixLength) +
                              " : invalid preserve body identifier</font><br>");
                UmlCom::bye(n_errors() + 1);
                UmlCom::fatal_error("read_bodies 1");
            }

            if (*body == '\r')
                body += 1;

            if (*body == '\n')
                body += 1;
            else {
                UmlCom::trace(WrapperStr("<font  color =\"red\"> Error in ") + path +
                              linenumber(s, p2 - BodyPrefixLength) +
                              " : invalid preserve body block, end of line expected</font><br>");
                UmlCom::bye(n_errors() + 1);
                UmlCom::fatal_error("read_bodies 2");
            }

            UmlOperation * op = (UmlOperation *)
                                UmlBaseItem::from_id((unsigned) id, anOperation);

            if (op == 0) {
                QString n("%1");
                n.arg(QString::number((unsigned) id));
                UmlCom::trace(WrapperStr("<font  color =\"red\"> Error in ") + path +
                              linenumber(s, p2 - BodyPrefixLength) +
                              " : invalid operation id " + n + "</font><br>");
                UmlCom::bye(n_errors() + 1);
                UmlCom::fatal_error("read_bodies 3");
                return;
            }

            if (((p1 = strstr(body, postfix)) == 0) ||
                (strncmp(p1 + BodyPostfixLength, p2, 8) != 0)) {
                UmlCom::trace(WrapperStr("<font  color =\"red\"> Error in ") + path +
                              linenumber(s, p2 - BodyPrefixLength) +
                              " : invalid preserve body block, wrong balanced</font><br>");
                UmlCom::bye(n_errors() + 1);
                UmlCom::fatal_error("read_bodies 4");
            }

            p2 = p1;

            while ((p2 != body) && (p2[-1] != '\n'))
//.........这里部分代码省略.........
开发者ID:harmegnies,项目名称:douml,代码行数:101,代码来源:UmlOperation.cpp


示例12: while

void UmlOperation::import(File & f, UmlClass * parent)
{
    QByteArray s;

    if (f.read(s) != STRING)
        f.syntaxError(s, "operations's name");

    QByteArray id;
    QByteArray ste;
    QByteArray doc;
    QHash<QByteArray, QByteArray*> prop;
    QByteArray s2;
    int k;

    do {
        k = f.readDefinitionBeginning(s2, id, ste, doc, prop);
    }
    while (id.isEmpty());

    UmlOperation * x;

    if (scanning) {
        QByteArray name;

        if (s.left(8) != "operator")
            name = (s.at(0) == '~')
                   ? ("~" + legalName(s.mid(1)))
                   : legalName(s);
        else
            name = s;

        if ((x = UmlBaseOperation::create(parent, name)) == 0) {
            UmlCom::trace("<br>cannot create operation '" + s + "' in " +
                          parent->fullName());
            throw 0;
        }

        newItem(x, id);

        if (!ste.isEmpty()) {
            bool managed = FALSE;
            QStringList l = QString(ste).split(",");

            for (QStringList::Iterator it = l.begin();
                 it != l.end();
                 ++it) {
                if ((*it) == "const") {
                    managed = TRUE;
                    x->set_isCppConst(TRUE);
                }
                else if ((*it) == "abstract") {
                    managed = TRUE;
                    x->set_isAbstract(TRUE);
                    x->set_isCppVirtual(TRUE);
                }
                else if ((*it) == "virtual") {
                    managed = TRUE;
                    x->set_isCppVirtual(TRUE);
                }
                else if ((*it) == "static") {
                    managed = TRUE;
                    x->set_isClassMember(TRUE);
                }
            }

            if (!managed)
                x->set_Stereotype(ste);
        }

        if (!doc.isEmpty())
            x->set_Description(doc);
    }
    else if ((x = (UmlOperation *) findItem(id, anOperation)) == 0) {
        UmlCom::trace("<br>unknown operation '" + s + "' in " +
                      parent->fullName());
        throw 0;
    }
    else {
        switch (((UmlClass *) x->parent())->language()) {
        case Cplusplus:
        case AnsiCplusplus:
        case VCplusplus:
            x->cplusplus(prop);
            break;

        case Oracle8:
            x->oracle8(prop);
            break;

        case Corba:
            x->corba(prop);
            break;

        case Java:
            x->java(prop);
            break;

        default:
            break;
        }
//.........这里部分代码省略.........
开发者ID:DoUML,项目名称:douml,代码行数:101,代码来源:UmlOperation.cpp


示例13: QCString

UmlOperation * UmlOperation::cpp2Python(UmlClass * python, UmlClass * cpp,
					 const char * cppname,
					 const char * pythonname)
{
  if (pythonname == 0)
    pythonname = cppname;
  
  UmlOperation * from = cpp->get_operation(cppname);
  
  if (from == 0) {
    QCString err = QCString("cannot find operation '") + 
      cppname + QCString("' in class '") + cpp->name()
	+ QCString("'<br>\n");
    UmlCom::trace(err);
    throw 0;
  }
  
  UmlOperation * to = UmlBaseOperation::create(python, pythonname);
  
  if (to == 0) {
    QCString err = QCString("cannot create operation '") + 
      pythonname + QCString("' in class '") + python->name()
	+ QCString("'<br>\n");
    UmlCom::trace(err);
    throw 0;
  }
  
  UmlCom::trace("add operation " + python->name() + "::" + pythonname + "<br>\n");

  to->set_Description(::cpp2Python(from->description()));
  to->set_ReturnType(from->returnType());
  to->set_isClassMember(from->isClassMember());
  to->set_Visibility(from->visibility());
  to->set_CppVisibility(from->cppVisibility());
  
  const QValueList<UmlParameter> params = from->params();
  unsigned index;
  
  for (index = 0; index != params.count(); index += 1)
    to->addParameter(index, params[index]);
  
  const QValueList<UmlTypeSpec> exceptions = from->exceptions();
  
  for (index = 0; index != exceptions.count(); index += 1)
    to->addException(index, exceptions[index]);
  
  to->set_isCppVirtual(from->isCppVirtual());
  to->set_isCppConst(from->isCppConst());
  to->set_isCppInline(from->isCppInline());
  to->set_CppDecl(::cpp2Python(from->cppDecl()));
  to->set_CppDef(::cpp2Python(from->cppDef()));
  to->set_CppBody(::cpp2Python(from->cppBody()));
  
  to->set_isJavaFinal(from->isJavaFinal());
  to->set_JavaDef(from->javaDef());
  to->set_JavaBody(::cpp2Python(from->javaBody()));
  
  return to;
}
开发者ID:,项目名称:,代码行数:59,代码来源:



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ UmlPackage类代码示例发布时间:2022-05-31
下一篇:
C++ UmlItem类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap