コード例 #1
0
ファイル: UmlOperation.cpp プロジェクト: gilbertoca/douml
void UmlOperation::generate_index()
{
    unsigned n = opers.size();

    if (n != 0) {
        sort(opers);

        start_file("public_operations", "Public Operations Index", TRUE);

        fw.write("<table>\n");
        fw.write("<tr bgcolor=\"#f0f0f0\"><td align=\"center\"><b>Operation</b></td><td align=\"center\"><b>Class</b></td><td align=\"center\"><b>Description</b></td></tr>\n");

        for (unsigned i = 0; i != n; i += 1) {
            UmlItem * op = opers.elementAt(i);

            fw.write("<tr bgcolor=\"#f0f0f0\"><td>");
            op->write();
            fw.write("</td><td>");
            op->parent()->write();
            fw.write("</td><td>");
            writeq(op->description());
            fw.write("</td></tr>\n");
        }

        fw.write("</table>\n");

        end_file();
    }

}
コード例 #2
0
ファイル: UmlClass.cpp プロジェクト: gregsmirnov/bouml
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");
}