コード例 #1
0
ファイル: UmlClass.cpp プロジェクト: SciBoy/douml
void UmlClass::java(Q3Dict<Q3CString> & prop) {
  if (!scanning) {
    Q3CString d = (stereotype() == "interface") 
      ? JavaSettings::interfaceDecl()
      : JavaSettings::classDecl();
    
    Q3CString * v;
    
    if ((v = prop.find("Java/Final")) != 0) {
      if (*v == "TRUE")
	set_isJavaFinal(TRUE);
      prop.remove("Java/Final");
    }
    
    if ((v = prop.find("Java/Strictfp")) != 0) {
      if (*v == "TRUE") {
	int index;
	
	if ((index = d.find("${public}")) != -1)
	  d.insert((unsigned) index + 9, "strictfp ");
	else if ((index = d.find("${visibility}")) != -1)
	  d.insert((unsigned) index + 13, "strictfp ");
      }
      prop.remove("Java/Strictfp");
    }
    
    set_JavaDecl(d);
  }
}
コード例 #2
0
ファイル: UmlRelation.cpp プロジェクト: SciBoy/douml
void UmlRelation::java(UmlRelation::Role * role) {
  Q3CString * v;
    
  if ((v = role->prop.find("Java/Final")) != 0) {
    if (*v == "TRUE")
      set_isReadOnly(TRUE);
    role->prop.remove("Java/Final");
  }

  if ((v = role->prop.find("Java/Transient")) != 0) {
    if (*v == "TRUE")
      set_isJavaTransient(TRUE);
    role->prop.remove("Java/Transient");
  }

  if ((v = role->prop.find("Java/Volatile")) != 0) {
    if (*v == "TRUE")
      set_isVolatile(TRUE);
    role->prop.remove("Java/Volatile");
  }

  role->prop.remove("Java/IsNavigable");

  set_JavaDecl(JavaSettings::relationDecl(role->cardinality));
}
コード例 #3
0
void UmlRelation::uml2java(bool) {
  switch (relationKind()) {
  case aGeneralisation:
  case aRealization:
    set_JavaDecl("${type}");
    break;
  case aDependency:
    break;
  default:
    {
      QCString st = JavaSettings::classStereotype(parent()->stereotype());
      
      set_JavaDecl(((st == "enum") || (st == "ignored"))
		   ? QCString("")
		   : JavaSettings::relationDecl(multiplicity()));
    }
  }
}
コード例 #4
0
ファイル: UmlOperation.cpp プロジェクト: 02JanDal/douml
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();
            }
        }
    }
}
コード例 #5
0
ファイル: UmlRelation.cpp プロジェクト: DoUML/douml
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();
            }
        }
    }
}
コード例 #6
0
ファイル: UmlClass.cpp プロジェクト: gregsmirnov/bouml
void UmlClass::uml2java(bool rec) {
  if (isJavaExternal())
    set_JavaDecl(JavaSettings::externalClassDecl());
  else {
    QCString st = JavaSettings::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_pattern")
      set_JavaDecl(JavaSettings::enumPatternDecl());
    else if (st == "enum")
      set_JavaDecl(JavaSettings::enumDecl());
    else if (st == "interface")
      set_JavaDecl(JavaSettings::interfaceDecl());
    else if (st == "@interface") {
      QCString s = JavaSettings::interfaceDecl();
      int index = s.find("interface");
      
      if (index != -1)
	s.insert(index, '@');
      set_JavaDecl(s);
    }
    else if (st == "ignored") {
      set_JavaDecl("");
      return;
    }
    else
      set_JavaDecl(JavaSettings::classDecl());
    
    if (rec) {
      const QVector<UmlItem> ch = children();
      unsigned n = ch.size();
      
      for (unsigned i = 0; i != n; i += 1)
	ch[i]->uml2java(rec);
    }
    
    if (parent()->kind() == aClassView)
      // not nested
      artifact()->set_JavaSource(JavaSettings::sourceContent());
  }
}
コード例 #7
0
bool UmlBaseOperation::set_JavaDef(const char * s)
{
    return set_JavaDecl(s);
}
コード例 #8
0
ファイル: UmlOperation.cpp プロジェクト: DoUML/douml
void UmlOperation::importParameters(File & f)
{
    QByteArray s;
    unsigned rank = 0;
    const char * sep = "";
    QByteArray doc = description();

    for (;;) {
        switch (f.read(s)) {
        case ')':
            if (doc != description())
                set_Description(doc);

            return;

        case '(':
            // a parameter
            break;

        default:
            f.syntaxError(s);
        }

        f.read("object");
        f.read("Parameter");

        UmlParameter p;
        QByteArray ti;

        ti = QString("${t%1}").arg(rank).toLatin1();

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

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

        for (;;) {
            k = f.readDefinitionBeginning(s, id, ste, p_doc, prop);

            if (k == ')')
                break;

            if (s == "type") {
                if (f.read(s) != STRING)
                    f.syntaxError(s, "parameter type");

                switch (((UmlClass *) parent())->language()) {
                case Corba:
                    if (strncmp(s,  "in ", 3) == 0) {
                        p.dir = InputDirection;
                        s = s.mid(3);
                    }
                    else if (strncmp(s,  "out ", 4) == 0) {
                        p.dir = OutputDirection;
                        s = s.mid(4);
                    }
                    else if (strncmp(s,  "inout ", 6) == 0) {
                        p.dir = InputOutputDirection;
                        s = s.mid(6);
                    }
                    else {
                        QByteArray err =
                            "<br>'" + s + "' : wrong parameter direction, in " + f.context();

                        UmlCom::trace(err);
                        p.dir = InputOutputDirection;
                    }

                    break;

                default:
                    // !!!!!!!!!!!!!
                    p.dir = InputOutputDirection;
                }

                p.type.explicit_type = s;
            }
            else if (s == "quidu") {
                if (f.read(s) != STRING)
                    f.syntaxError(s, "wrong quidu");

                if (UmlClass::replaceType(p.type, s, ti))
                    ti = s;
            }
            else
                f.skipNextForm();
        }

        QByteArray d;
        int index;

        switch (((UmlClass *) parent())->language()) {
        case Cplusplus:
        case AnsiCplusplus:
        case VCplusplus:
            s= QString("%1%2 ${p%3}").arg(sep).arg((const char *) ti).arg(rank).toLatin1();

            if ((index = (d = cppDecl()).indexOf("${)}")) != -1)
                //set_CppDecl(d.insert(index, s));//[jasa] original line
                set_CppDecl(d.insert(index, (const char *)s)); //[jasa] fix ambiguous call

            if ((index = (d = cppDef()).indexOf("${)}")) != -1)
                set_CppDef(d.insert(index, (const char *)s)); //[jasa] fix ambiguous call

            break;

        case Oracle8:
            break;

        case Corba:
            if ((index = (d = idlDecl()).indexOf("${)}")) != -1) {
                s = QString("%1${d%2} %3 ${p%4}").arg(
                          sep).arg(rank).arg((const char *) ti).arg(rank).toLatin1();
                set_IdlDecl(d.insert(index, (const char *)s)); //[jasa] fix ambiguous call
            }

            break;

        case Java:
            if ((index = (d = javaDecl()).indexOf("${)}")) != -1) {
                s = QString("%s%s ${p%u}").arg( sep).arg( (const char *) ti).arg( rank).toLatin1();
                set_JavaDecl(d.insert(index, (const char *)s)); //[jasa]
            }

            break;

        default:
            break;
        }

        addParameter(rank++, p);
        sep = ", ";
    }
}
コード例 #9
0
ファイル: UmlOperation.cpp プロジェクト: DoUML/douml
void UmlOperation::import(File & f)
{
    if (scanning) {
        f.skipBlock();
        return;
    }

    QByteArray s;
    UmlTypeSpec t;

    for (;;) {
        switch (f.read(s)) {
        case -1:
            f.eof();
            throw 0;

        case ')':
            set_ReturnType(t);
            return;

        case ATOM:
            break;

        default:
            f.syntaxError(s);
        }

        // atom
        if (s == "parameters") {
            f.read("(");
            f.read("list");
            f.read("Parameters");
            importParameters(f);
        }
        else if (s == "result") {
            if (f.read(s) != STRING)
                f.syntaxError(s, "return type");

            t.explicit_type = s;
        }
        else if (s == "quidu") {
            if (f.read(s) != STRING)
                f.syntaxError(s, "wrong quidu");

            if (UmlClass::replaceType(t, s, "${type}")) {
                switch (((UmlClass *) parent())->language()) {
                case Cplusplus:
                case AnsiCplusplus:
                case VCplusplus:
                    set_CppDecl(replace(cppDecl(), "${type}", s));
                    set_CppDef(replace(cppDef(), "${type}", s));
                    break;

                case Oracle8:
                    break;

                case Corba:
                    set_IdlDecl(replace(idlDecl(), "${type}", s));
                    break;

                case Java:
                    set_JavaDecl(replace(javaDecl(), "${type}", s));
                    break;

                default:
                    break;
                }
            }
        }
        else if (s == "exceptions")
            importExceptions(f);
        else if (s == "opExportControl")
            set_Visibility(f.readVisibility());
        else
            f.skipNextForm();
    }

}