Beispiel #1
0
void UmlRelation::uml2Python(bool)
{
    bool composition = FALSE;

    switch (relationKind()) {
    case aGeneralisation:
    case aRealization:
    case aDependency:
        set_PythonDecl("${type}");
        break;

    case anAggregationByValue:
    case aDirectionalAggregationByValue:
        composition = TRUE;

        // no break
    default: {
        Q3CString st = PythonSettings::classStereotype(parent()->stereotype());

        if ((st == "enum") || (st == "ignored"))
            set_PythonDecl("");
        else
            set_PythonDecl(PythonSettings::relationDecl(composition, multiplicity()));
    }
    }
}
Beispiel #2
0
void UmlOperation::change(Context & ctx)
{
    if (ctx.onOperation() && ctx.match_stereotype(stereotype())) {
        if (ctx.cpp()) {
            const Q3CString & c = cppDecl();

            if (!c.isEmpty() && ctx.match(c)) {
                if (!set_CppDecl(ctx.replace(c)))
                    ctx.err();
            }

            const Q3CString & f = cppDef();

            if (!f.isEmpty() && ctx.match(f)) {
                if (!set_CppDef(ctx.replace(f)))
                    ctx.err();
            }
        }

        if (ctx.java()) {
            const Q3CString & c = javaDecl();

            if (!c.isEmpty() && ctx.match(c)) {
                if (!set_JavaDecl(ctx.replace(c)))
                    ctx.err();
            }
        }

        if (ctx.php()) {
            const Q3CString & c = phpDecl();

            if (!c.isEmpty() && ctx.match(c)) {
                if (!set_PhpDecl(ctx.replace(c)))
                    ctx.err();
            }
        }

        if (ctx.python()) {
            const Q3CString & c = pythonDecl();

            if (!c.isEmpty() && ctx.match(c)) {
                if (!set_PythonDecl(ctx.replace(c)))
                    ctx.err();
            }
        }

        if (ctx.idl()) {
            const Q3CString & c = idlDecl();

            if (!c.isEmpty() && ctx.match(c)) {
                if (!set_IdlDecl(ctx.replace(c)))
                    ctx.err();
            }
        }
    }
}
Beispiel #3
0
void UmlClass::uml2python(bool rec) {
  if (isPythonExternal())
    set_PythonDecl(PythonSettings::externalClassDecl());
  else {
    QCString st = PythonSettings::classStereotype(stereotype());
    UmlItem * pack = parent()->parent();
    
    while (pack->kind() != aPackage)
      pack = pack->parent();
    
    if ((st == "stereotype") ||
	(st == "metaclass") ||
	(pack->stereotype() == "profile")) {
      set_CppDecl("");
      return;
    }
    
    
    if (st == "enum")
      set_PythonDecl(PythonSettings::enumDecl());
    else if (st == "ignored") {
      set_PythonDecl("");
      return;
    }
    else
      set_PythonDecl(PythonSettings::classDecl());
    
    if (rec) {
      const QVector<UmlItem> ch = children();
      unsigned n = ch.size();
      
      for (unsigned i = 0; i != n; i += 1)
	ch[i]->uml2python(rec);
    }
    
    if (parent()->kind() == aClassView)
      // not nested
      artifact()->set_PythonSource(PythonSettings::sourceContent());
  }
}
Beispiel #4
0
void UmlRelation::change(Context & ctx)
{
    if (ctx.onRelation() && ctx.match_stereotype(stereotype())) {
        if (ctx.cpp()) {
            const QByteArray & c = cppDecl();

            if (!c.isEmpty() && ctx.match(c)) {
                if (!set_CppDecl(ctx.replace(c)))
                    ctx.err();
            }
        }

        if (ctx.java()) {
            const QByteArray & c = javaDecl();

            if (!c.isEmpty() && ctx.match(c)) {
                if (!set_JavaDecl(ctx.replace(c)))
                    ctx.err();
            }
        }

        if (ctx.php()) {
            const QByteArray & c = phpDecl();

            if (!c.isEmpty() && ctx.match(c)) {
                if (!set_PhpDecl(ctx.replace(c)))
                    ctx.err();
            }
        }

        if (ctx.python()) {
            const QByteArray & c = pythonDecl();

            if (!c.isEmpty() && ctx.match(c)) {
                if (!set_PythonDecl(ctx.replace(c)))
                    ctx.err();
            }
        }

        if (ctx.idl()) {
            const QByteArray & c = idlDecl();

            if (!c.isEmpty() && ctx.match(c)) {
                if (!set_IdlDecl(ctx.replace(c)))
                    ctx.err();
            }
        }
    }
}
bool UmlBaseOperation::set_PythonDef(const char * s)
{
    return set_PythonDecl(s);
}