Esempio n. 1
0
void UmlRelation::write(FileOut & out, bool inside) {
  switch (relationKind()) {
  case aGeneralisation:
    if (inside)
      write_generalization(out);
    break;
  case aRealization:
    if (inside)
      parent()->memo_relation(this);
    else
      write_realization(out);
    break;
  case aDependency:
    if (inside)
      parent()->memo_relation(this);
    else
      write_dependency(out);
    break;
  default:
    // don't generate them for actors
    {
      UmlItem * p = parent();
      
      if (p->stereotype() == "actor")
	return;
      do {
	p = p->parent();
      } while (p->kind() == aClass);
      
      UmlItem * op = roleType();
      
      if (op->stereotype() == "actor")
	return;
      do {
	op = op->parent();
      } while (op->kind() == aClass);
      
      if ((p->kind() == aClassView) && (op->kind() == aClassView)) {
	if (inside)
	  write_relation_as_attribute(out);
	else
	  // note : it is the first side
	  write_relation(out);
      }
    }
    break;
  }
}
Esempio n. 2
0
void UmlRelation::search_class_assoc() {
  if (side(TRUE) != this)
    return;
    
  switch (relationKind()) {
  case aGeneralisation:
  case aRealization:
  case aDependency:
    break;
  default:
    {
      UmlTypeSpec a = association();
      
      if (a.type != 0) {
	// not generated for actors
	UmlItem * p = parent();
	
	if (p->stereotype() != "actor") {
	  do {
	    p = p->parent();
	  } while (p->kind() == aClass);
	  if (p->kind() == aClassView)
	    _assoc_class = a.type->set_assoc(this);
	}
      }
    }
  }
}
Esempio n. 3
0
void UmlArtifact::write(FileOut & out)
{
    const char * k = (_uml_20) ? "ownedMember" : "packagedElement";

    out.indent();
    out << "<" << k << " xmi:type=\"uml:Artifact\"";
    out.id(this);
    out << " name=\"";
    out.quote((const char *)name()); //[jasa] ambiguous call
    out << "\">\n";
    out.indent(+1);

    write_description_properties(out);

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

    for (i = 0; i != n; i += 1) {
        UmlItem * x = ch[i];

        if ((x->kind() == aNcRelation) &&
            (x->stereotype() == "manifest") &&
            (((UmlNcRelation *) x)->relationKind() == aDependency))
            write_manifest(out, ((UmlNcRelation *) x)->target(), "dependency", ++rank);
        else
            ch[i]->write(out);
    }

    if (stereotype() == "source") {
        const Q3PtrVector<UmlClass> & cls = associatedClasses();

        n = cls.size();

        for (i = 0; i != n; i += 1)
            write_manifest(out, cls[i], "source", ++rank);
    }
    else {
        const Q3PtrVector<UmlArtifact> & arts = associatedArtifacts();

        n = arts.size();

        for (i = 0; i != n; i += 1)
            write_manifest(out, arts[i], 0, ++rank);
    }

    out.indent(-1);
    out.indent();
    out << "</" << k << ">\n";

    unload();

}
Esempio n. 4
0
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());
  }
}
Esempio n. 5
0
void UmlClass::uml2cpp(bool rec) {
  if (isCppExternal())
    set_CppDecl(CppSettings::externalClassDecl());
  else {
    QCString st = CppSettings::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_CppDecl(CppSettings::enumDecl());
    else if (st == "union")
      set_CppDecl(CppSettings::unionDecl());
    else if (st == "struct")
      set_CppDecl(CppSettings::structDecl());
    else if (st == "typedef")
      set_CppDecl(CppSettings::typedefDecl());
    else if (st == "ignored") {
      set_CppDecl("");
      return;
    }
    else
      set_CppDecl(CppSettings::classDecl());
    
    if (rec) {
      const QVector<UmlItem> ch = children();
      unsigned n = ch.size();
      
      for (unsigned i = 0; i != n; i += 1)
	ch[i]->uml2cpp(rec);
    }
    
    if (parent()->kind() == aClassView) {
      // not nested
      UmlArtifact * art = artifact();
			 
      art->set_CppSource(CppSettings::sourceContent());
      art->set_CppHeader(CppSettings::headerContent());
    }
  }
}
Esempio n. 6
0
void UmlClass::uml2idl(bool rec) {
  if (isIdlExternal())
    set_IdlDecl(IdlSettings::externalClassDecl());
  else {
    QCString st = IdlSettings::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 == "struct")
      set_IdlDecl(IdlSettings::structDecl());
    else if (st == "union")
      set_IdlDecl(IdlSettings::unionDecl());
    else if (st == "enum")
      set_IdlDecl(IdlSettings::enumDecl());
    else if (st == "exception")
      set_IdlDecl(IdlSettings::exceptionDecl());
    else if (st == "typedef")
      set_IdlDecl(IdlSettings::typedefDecl());
    else if (st == "interface")
      set_IdlDecl(IdlSettings::interfaceDecl());
    else if (st == "ignored") {
      set_IdlDecl("");
      return;
    }
    else
      set_IdlDecl(IdlSettings::valuetypeDecl());
    
    if (rec) {
      const QVector<UmlItem> ch = children();
      unsigned n = ch.size();
      
      for (unsigned i = 0; i != n; i += 1)
	ch[i]->uml2idl(rec);
    }
    
    if (parent()->kind() == aClassView)
      // not nested
      artifact()->set_IdlSource(IdlSettings::sourceContent());
  }
}
Esempio n. 7
0
void UmlClass::uml2php(bool rec) {
  if (isPhpExternal())
    set_PhpDecl(PhpSettings::externalClassDecl());
  else {
    QCString st = PhpSettings::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_PhpDecl(PhpSettings::enumDecl());
    else if (st == "interface")
      set_PhpDecl(PhpSettings::interfaceDecl());
    else if (st == "ignored") {
      set_PhpDecl("");
      return;
    }
    else
      set_PhpDecl(PhpSettings::classDecl());
    
    if (rec) {
      const QVector<UmlItem> ch = children();
      unsigned n = ch.size();
      
      for (unsigned i = 0; i != n; i += 1)
	ch[i]->uml2php(rec);
    }
    
    if (parent()->kind() == aClassView)
      // not nested
      artifact()->set_PhpSource(PhpSettings::sourceContent());
  }
}