示例#1
0
void UmlClass::gen_html(QCString pfix, unsigned int rank, unsigned int level) {
  UmlCom::message(name());
  
  QCString s;
 
  s = description();
  
  if (isActive())
    fw.write("<p>Active class</p>\n");
    
  if (!s.isEmpty()) {
    fw.write("<p>");
    if (! javaDecl().isEmpty())
      gen_java_decl(s, TRUE);
    else if (! phpDecl().isEmpty())
      gen_php_decl(s, TRUE);
    else if (! pythonDecl().isEmpty())
      gen_python_decl(s, TRUE);
    else
      gen_cpp_decl(s, TRUE);
    fw.write("<br /></p>\n");
  }

  if (!cppDecl().isEmpty() ||
      !javaDecl().isEmpty() ||
      !phpDecl().isEmpty() ||
      !pythonDecl().isEmpty()) {
    fw.write("<p>Declaration :</p><ul>\n");
    
    s = cppDecl();
    
    if (!s.isEmpty()) {
      fw.write("<li>C++ : ");
      gen_cpp_decl(s, FALSE);
      fw.write("</li>");
    }
    
    s = javaDecl();
    
    if (!s.isEmpty()) {
      fw.write("<li>Java : ");
      gen_java_decl(s, FALSE);
      fw.write("</li>");
    }
    
    s = phpDecl();
    
    if (!s.isEmpty()) {
      fw.write("<li>Php : ");
      gen_php_decl(s, FALSE);
      fw.write("</li>");
    }
    
    s = pythonDecl();
    
    if (!s.isEmpty()) {
      fw.write("<li>Python : ");
      gen_python_decl(s, FALSE);
      fw.write("</li>");
    }
    
    fw.write("</ul>");
  }
  
  if (subClasses.size() != 0) {
    sort(subClasses);
    fw.write("<p>Directly inherited by : ");
    
    for (unsigned i = 0; i != subClasses.size(); i += 1) {
      subClasses.elementAt(i)->write();
      fw.write(' ');
    }
    fw.write("</p>\n");    
  }
  
  write_dependencies();

  annotation_constraint();
  
  bool p = FALSE;
  UmlItem * x;
  
  if ((x = associatedArtifact()) != 0) {
    p = TRUE;
    fw.write("<p>Artifact : ");
    x->write();
  }

  const QVector<UmlComponent> comps = associatedComponents();
  
  if (comps.size() != 0) {
    if (p) 
      fw.write(", Component(s) :");
    else {
      p = TRUE;
      fw.write("<p>Component(s) :");
    }
    
    for (unsigned i = 0; i != comps.size(); i += 1) {
      fw.write(' ');
      comps[i]->write();
    }
  }

  if ((x = associatedDiagram()) != 0) {
    if (p) 
      fw.write(", Diagram : ");
    else {
      p = TRUE;
      fw.write("<p>Diagram : ");
    }
    x->write();
  }

  if (p)
    fw.write("</p>\n");
  
  if (parent()->kind() == aClass) {
    fw.write("<p>nested in ");
    parent()->write();
    fw.write("</p>\n");
  }

  write_properties();

  //

  const QVector<UmlItem> ch = children();
  
  if (ch.size() != 0) {
    if (stereotype() == "enum_pattern") {
      p = FALSE;
            
      for (unsigned i = 0; i != ch.size(); i += 1) {
	if (ch[i]->kind() == anAttribute) {
	  if (!p) {
	    p = TRUE;
	    fw.write("<div class=\"sub\">\n<p>Items :</p><ul>\n");
	  }
	  fw.write("<li>");
	  writeq(ch[i]->name());
	  fw.write("</li>\n");
	}
      }
      if (p)
	fw.write("</ul>\n</div>\n");
    }
    else {
      fw.write("<div class=\"sub\">\n");
      
      if (stereotype() == "enum") {
	unsigned i;
	
	p = FALSE;
	
	for (i = 0; i != ch.size(); i += 1) {
	  if ((ch[i]->kind() == anAttribute) &&
	      (ch[i]->stereotype() != "attribute")) {
	    if (!p) {
	      p = TRUE;
	      fw.write("<p>Items :</p><ul>\n");
	    }
	    fw.write("<li>");
	    writeq(ch[i]->name());
	    fw.write("</li>\n");
	  }
	}
	if (p)
	  fw.write("</ul>\n");
	
	s = "";
	for (i = 0; i != ch.size(); i += 1)
	  if ((ch[i]->kind() != anAttribute) ||
	      (ch[i]->stereotype() == "attribute"))
	    ch[i]->html(s, 0, 0);
      }
      else if (flat)
	write_children(pfix, rank, level);
      else {
	// non flat
	s = "";
	for (unsigned i = 0; i != ch.size(); i += 1)
	  ch[i]->html(s, 0, 0);
      }
      
      fw.write("</div>\n");
    }
  }

  sort(*inherited_opers);
  bool already = FALSE;
  
  for (unsigned i = 0; i != inherited_opers->size(); i += 1) {
    if (already)
      fw.write(", ");
    else {
      already = TRUE;
      fw.write("<p>All public operations : ");
    }
    inherited_opers->elementAt(i)->write();
    fw.write(' ');
  }
  if (already)
    fw.write("</p>\n");
}
示例#2
0
void UmlOperation::html(QByteArray, unsigned int, unsigned int)
{
    define();

    fw.write("<table><tr><td><div class=\"element\">Operation <b>");
    writeq(name());
    fw.write("</b></div></td></tr></table>");

    QByteArray s = description();

    if (! s.isEmpty()) {
        fw.write("<p>");

        if (! javaDecl().isEmpty())
            gen_java_decl(s, TRUE);
        else if (! phpDecl().isEmpty())
            gen_php_decl(s, TRUE);
        else if (! pythonDecl().isEmpty())
            gen_python_decl(s, TRUE);
        else
            gen_cpp_decl(s, TRUE);

        fw.write("<br /></p>");
    }

    fw.write("<p>Declaration :</p><ul>");

    fw.write("<li>Uml : ");
    gen_uml_decl();
    fw.write("</li>");

    s = cppDecl();

    if (!s.isEmpty()) {
        fw.write("<li>C++ : ");
        gen_cpp_decl(s, FALSE);
        fw.write("</li>");
    }

    s = javaDecl();

    if (!s.isEmpty()) {
        fw.write("<li>Java : ");
        gen_java_decl(s, FALSE);
        fw.write("</li>");
    }

    s = phpDecl();

    if (!s.isEmpty()) {
        fw.write("<li>Php : ");
        gen_php_decl(s, FALSE);
        fw.write("</li>");
    }

    s = pythonDecl();

    if (!s.isEmpty()) {
        fw.write("<li>Python : ");
        gen_python_decl(s, FALSE);
        fw.write("</li>");
    }

    fw.write("</ul>");

    annotation_constraint();
    write_properties();

    unload(FALSE, FALSE);
}
示例#3
0
void UmlRelation::html(QByteArray, unsigned int, unsigned int)
{
    bool extension;

    switch (relationKind()) {
    case aGeneralisation:
    case aRealization:
    case aDependency:
        return;

    case aDirectionalAssociation:
        extension = (parent()->stereotype() == "stereotype") &&
                    (roleType()->stereotype() == "metaclass");
        break;

    default:
        extension = FALSE;
    }

    define();

    if (extension)
        fw.write("<table><tr><td><div class=\"element\">Extension</div></td></tr></table>");
    else {
        fw.write("<table><tr><td><div class=\"element\">Relation <b>");
        writeq(name());
        fw.write("</b></div></td></tr></table>");
    }

    QByteArray s = description();

    if (!s.isEmpty()) {
        fw.write("<p>");

        if (! javaDecl().isEmpty())
            gen_java_decl(s, TRUE);
        else if (! phpDecl().isEmpty())
            gen_php_decl(s, TRUE);
        else if (! pythonDecl().isEmpty())
            gen_python_decl(s);
        else
            gen_cpp_decl(s, TRUE);

        fw.write("<br /></p>");
    }

    if (extension) {
        fw.write("<p>Extend ");
        roleType()->write();
        fw.write("</p>");
    }
    else {
        fw.write("<p>Declaration :</p><ul>");

        fw.write("<li>Uml : ");
        gen_uml_decl();
        fw.write("</li>");

        s = cppDecl();

        if (!s.isEmpty()) {
            fw.write("<li>C++ : ");
            gen_cpp_decl(s, FALSE);
            fw.write("</li>");
        }

        s = javaDecl();

        if (!s.isEmpty()) {
            fw.write("<li>Java : ");
            gen_java_decl(s, FALSE);
            fw.write("</li>");
        }

        s = phpDecl();

        if (!s.isEmpty()) {
            fw.write("<li>Php : ");
            gen_php_decl(s, FALSE);
            fw.write("</li>");
        }

        s = pythonDecl();

        if (!s.isEmpty()) {
            fw.write("<li>Python : ");
            gen_python_decl(s);
            fw.write("</li>");
        }

        fw.write("</ul>");
    }

    annotation_constraint();
    write_properties();

    unload(FALSE, FALSE);
}