Beispiel #1
0
void UmlClass::write_actor(FileOut & out)
{
    out.indent();
    out << "<UML:Actor name=\"" << name() << '"';
    out.id(this);
    out << " visibility=\"public\" isAbstract=\""
        << ((isAbstract()) ? "true" : "false")
        << "\" isActive=\"false\" >\n";
    out.indent(+1);

    if (stereotype() != "actor")
        write_stereotype(out);

    write_description_properties(out);
    out.indent(-1);
    out.indent();
    out << "</UML:Actor>\n";

    const QVector<UmlItem*> ch = children();
    unsigned n = ch.size();

    for (unsigned i = 0; i != n; i += 1)
        if (ch[i]->kind() == aRelation)
            ch[i]->write_if_needed(out);
}
Beispiel #2
0
bool UmlComponent::write_if_needed(FileOut & out)
{
    parent()->write(out);

    out.indent();
    out << "<UML:Component name=\"";
    out.quote(name());
    out << '"';
    out.id(this);
    out << " visibility=\"public\" isAbstract=\"false\" isActive=\"false\" >\n";
    out.indent(+1);
    write_stereotype(out);
    write_description_properties(out);
    out.indent(-1);
    out.indent();
    out << "</UML:Component>\n";

    const Q3PtrVector<UmlItem> ch = children();
    unsigned n = ch.size();

    for (unsigned i = 0; i != n; i += 1)
        ch[i]->write_if_needed(out);

    unload();

    return TRUE;
}
Beispiel #3
0
void UmlClassView::write(FileOut & out) {
  if (!_written) { 
    _written = TRUE; 
     
    parent()->write(out); 
     
    if (_gen_views) {
      out.indent(); 
      out << "<UML:Package"; 
      out.id(this); 
      out << " name =\"Class View ";
      out.quote(name());
      out << "\">\n"; 
      out.indent(+1); 
      write_stereotype(out); 
      write_description_properties(out); 
      out.indent(); 
      out << "<UML:Namespace.ownedElement>\n"; 
      out.indent(+1); 
    }
  } 
 
}
Beispiel #4
0
bool UmlOperation::write_if_needed(FileOut & out) {
  QCString decl;

  switch (_lang) {
  case Uml:
    parent()->write(out);
    out.indent();
    out << "<UML:Operation name=\"";
    out.quote(name());
    break;
  case Cpp:
    decl = cppDecl();
    
    if (decl.isEmpty())
      return FALSE;
    remove_comments(decl);
    parent()->write(out);
    out.indent();
    out << "<UML:Operation name=\"";
    out.quote(true_name(cppDecl()));
    break;
  default: // Java
    decl = javaDecl();
    
    if (decl.isEmpty())
      return FALSE;
    remove_comments(decl);    
    parent()->write(out);
    out.indent();
    out << "<UML:Operation name=\"";
    out.quote(true_name(javaDecl()));
    break;
  }
  out << '"';
  out.id(this);
  
  switch (_lang) {
  case Uml:
    write_visibility(out);
    break;
  case Cpp:
    write_visibility(out, 
		     (cppVisibility() == DefaultVisibility)
		     ? visibility() : cppVisibility());
    break;
  default: // Java
    if (javaDecl().find("${visibility}") != -1)
      write_visibility(out, visibility());
    break;
  }
  write_scope(out);
  out << " isAbstract=\""
      << ((isAbstract()) ? "true" : "false")
      << "\">\n";
  
  out.indent(+1);

  write_stereotype(out);
  write_annotation(out);
  write_description_properties(out);
  
  out.indent();
  out << "<UML:BehavioralFeature.parameter>\n";
  out.indent(+1);

  write_return_type(out, decl);

  if (_lang == Uml)
    write_uml_params(out);
  else
    write_cpp_java_params(out, decl);

  out.indent(-1);
  out.indent();
  out << "</UML:BehavioralFeature.parameter>\n";
  
  out.indent(-1);
  out.indent();
  out << "</UML:Operation>\n";

  unload();
 
  return TRUE;
}
Beispiel #5
0
bool UmlClass::write_if_needed(FileOut & out)
{
    // even if the class doen't have children
    parent()->write(out);

    if ((stereotype() == "actor") ||
        ((parent()->kind() != aClassView) &&
         (parent()->kind() != aClass)))
        // force it to be an actor
        write_actor(out);
    else {
        switch (_lang) {
        case Cpp:
            if (cppDecl().isEmpty())
                return FALSE;

            break;

        case Java:
            if (javaDecl().isEmpty())
                return FALSE;

        default:
            break;
        }

        bool interf = (stereotype() == "interface");

        out.indent();
        out << ((interf) ? "<UML:Interface name=\"" : "<UML:Class name=\"");
        out.quote(name());
        out << '"';
        out.id(this);
        out << " visibility=\"public\" isAbstract=\""
            << ((isAbstract()) ? "true" : "false")
            << "\" isActive=\"false\" >\n";
        out.indent(+1);

        if (! interf)
            write_stereotype(out);

        write_annotation(out);
        write_description_properties(out);

        const QVector<UmlItem*> ch = children();
        unsigned n = ch.size();
        bool used = FALSE;
        bool haveRel = FALSE;

        for (unsigned i = 0; i != n; i += 1) {
            switch (ch[i]->kind()) {
            case aNcRelation:
                break;

            case aRelation:
                haveRel = TRUE;
                break;

            default:
                used |= ch[i]->write_if_needed(out);
            }
        }

        if (used) {
            out.indent(-1);
            out.indent();
            out << "</UML:Classifier.feature>\n";
        }


        out.indent(-1);
        out.indent();
        out << ((interf) ? "</UML:Interface>\n" : "</UML:Class>\n");

        if (haveRel) {
            for (unsigned i = 0; i != n; i += 1)
                if (ch[i]->kind() == aRelation)
                    used |= ch[i]->write_if_needed(out);
        }
    }

    unload();

    return TRUE;
}
Beispiel #6
0
bool UmlAttribute::write_if_needed(FileOut & out)
{
    switch (_lang) {
    case Uml:
        parent()->write(out);
        out.indent();
        out << "<UML:Attribute name=\"" << name() << '"';
        break;

    case Cpp:
        if (cppDecl().isEmpty())
            return FALSE;

        parent()->write(out);
        out.indent();
        out << "<UML:Attribute name=\"" << true_name(cppDecl()) << '"';
        break;

    default: // Java
        if (javaDecl().isEmpty())
            return FALSE;

        parent()->write(out);
        out.indent();
        out << "<UML:Attribute name=\"" << true_name(javaDecl()) << '"';
        break;
    }

    out.id(this);

    switch (_lang) {
    case Uml:
        write_visibility(out);
        break;

    case Cpp:
        write_visibility(out,
                         (cppVisibility() == DefaultVisibility)
                         ? visibility() : cppVisibility());
        break;

    default: // Java
        if (javaDecl().find("${visibility}") != -1)
            write_visibility(out, visibility());

        break;
    }

    write_scope(out);
    out << ">\n";
    out.indent(+1);

    const UmlTypeSpec & t = type();

    if ((t.type != 0) || !t.explicit_type.isEmpty()) {
        out.indent();
        out << "<UML:StructuralFeature.type>\n";
        out.indent();
        out << "\t<UML:DataType";

        switch (_lang) {
        case Uml:
            if (t.type != 0)
                out.idref(t.type);
            else
                out.idref_datatype(t.explicit_type);

            break;

        case Cpp:
            write_cpp_type(out);
            break;

        default: // java
            write_java_type(out);
        }

        out << "/>\n";
        out.indent();
        out << "</UML:StructuralFeature.type>\n";
    }

    write_stereotype(out);
    write_annotation(out);
    write_description_properties(out);

    out.indent(-1);
    out.indent();
    out << "</UML:Attribute>\n";

    unload();

    return TRUE;
}