示例#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);
}
示例#2
0
void UmlClassView::write(FileOut & out)
{
    if (_gen_views) {
        out.indent();
        out << ((_uml_20) ? "<ownedMember" : "<packagedElement")
            << " xmi:type=\"uml:Package\"";
        out.id(this);
        out << " name =\"class view ";
        out.quote(name());
        out << "\">\n";
        out.indent(+1);
        write_description_properties(out);
    }

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

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

    if (_gen_views) {
        while (! _relations.isEmpty())
            _relations.takeAt(0)->write(out, FALSE);

        out.indent(-1);
        out.indent();
        out << ((_uml_20) ? "</ownedMember>\n" : "</packagedElement>\n");
    }
}
示例#3
0
文件: UmlNode.cpp 项目: DoUML/douml
void UmlNode::write(FileOut & out)
{
    const char * k = (_uml_20) ? "ownedMember" : "packagedElement";

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

    write_description_properties(out);

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

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

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

    unload();
}
示例#4
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;
}
示例#5
0
void UmlNcRelation::write(FileOut & out)
{
    if ((relationKind() == aDependency) &&
            (parent()->kind() == anUseCase) &&
            (target()->kind() == anUseCase)) {
        const char * t;
        const char * r;

        if (stereotype() == "include") {
            t = "Include";
            r = "addition";
        }
        else if (stereotype() == "extend") {
            t = "Extend";
            r = "extendedCase";
        }
        else {
            write(out, TRUE);
            return;
        }

        out.indent();
        out << "<" << stereotype() << " xmi:type=\"uml:" << t << "\"";
        out.id(this);
        out.ref(target(), r);
        out << ">\n";
        out.indent(+1);
        write_description_properties(out);
        out.indent(-1);
        out.indent();
        out << "</" << stereotype() << ">\n";
    }
    else
        write(out, TRUE);
}
示例#6
0
void UmlActivityPartition::write(FileOut & out) {
  const char * p = (parent()->kind() == aPartition)
    ? "subpartition" : "group";
  
  out.indent();
  out << "<" << p << " xmi:type=\"uml:ActivityPartition\" name=\"";
  out.quote((const char*)name());//[jasa] ambiguous call
  out << '"';
  out.id(this);
  if (isDimension())
    out << " isDimension=\"true\"";
  if (isExternal())
    out << " isExternal=\"true\"";
  if (represents() != 0)
    out.ref(represents(), "represents");
  out << ">\n";
  out.indent(+1);
  
  write_description_properties(out); 
  
  const Q3PtrVector<UmlItem> ch = children();
  unsigned n = ch.size();
  
  for (unsigned i = 0; i != n; i += 1)
    ch[i]->write(out);
  
  out.indent(-1);
  out.indent();
  out << "</" << p << ">\n";

  unload();
}
示例#7
0
void UmlRegion::write(FileOut & out) {
  out.indent(); 
  out << "<region xmi:type=\"uml:Region\"";
  out.id(this); 
  out << " name=\"";
  out.quote(name());
  out << "\">\n";
  out.indent(+1); 
  
  write_description_properties(out); 
     
  const QVector<UmlItem> ch = children(); 
  unsigned n = ch.size();
  unsigned i;
  
  for (i = 0; i != n; i += 1)
    ch[i]->write(out);
    
#if 0
  // to bypass Eclipse's bug this is done by the parent state
  while (! _trans.isEmpty())
    _trans.take(0)->write_it(out);
#endif

  out.indent(-1); 
  out.indent(); 
  out << "</region>\n"; 
    
  unload(); 
}
示例#8
0
void UmlPseudoState::write(FileOut & out) {
  out.indent();
  out << "<subvertex xmi:type=\"uml:Pseudostate\"";
  out.id(this);
  if (! name().isEmpty()) {
    out << " name=\"";
    out.quote(name());
    out << '"';
  }
  out << " kind=\"" << sKind() << "\">\n";

  out.indent(+1);
  
  write_description_properties(out); 
     
  while (! _incoming_trans.isEmpty())
    _incoming_trans.take(0)->write_in(out);
  
  const QVector<UmlItem> ch = children(); 
  unsigned n = ch.size();
  unsigned i;
     
  for (i = 0; i != n; i += 1)
    ch[i]->write(out);

  out.indent(-1);
  out.indent();
  out << "</subvertex>\n";
    
  unload(); 
}
示例#9
0
void UmlNcRelation::write_generalization(FileOut & out)
{
    out.indent();
    out << "<generalization xmi:type=\"uml:Generalization\"";
    out.id(this);
    out.ref(target(), "general");
    out << "/>\n";
}
示例#10
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();

}
示例#11
0
void UmlActivityAction::write_begin(FileOut & out, Q3CString k) {
  out.indent();
  out << ((parent()->kind() == anActivity) ? "<node" : "<containedNode")
    << " xmi:type=\"uml:" << k << '"';
  out.id(this);
  if (!name().isEmpty()){
    out << " name=\"";
    out.quote(name());
    out << '"';
  }
}
示例#12
0
void UmlActivityParameter::write(FileOut & out) {
  // write parameter def

  out.indent();
  out << "<ownedParameter name=\"";
  out.quote(name());
  out << '"';
  out.id(this);
  write_dir(out);
  write_effect(out);
  write_flags(out);
  out << ">\n";
  
  out.indent(+1);
  
  write_description_properties(out);
  write_multiplicity(out, multiplicity(), this);
  write_default_value(out, defaultValue(), this);
  UmlItem::write_type(out, type());
  
  out.indent(-1);

  out.indent();
  out << "</ownedParameter>\n";

  //write parameter node
  out.indent();
  out << "<node xmi:type=\"uml:ActivityParameterNode\" name =\"";
  out.quote(name());
  out << '"';
  out.id_prefix(this, "PARAMETER_NODE_");
  if (isControlType())
    out << " isControlType=\"true\"";
  write_ordering(out);
  write_selection(out);
  write_in_state(out);
  out << ">\n";
  out.indent(+1);

  UmlItem::write_type(out, type());

  const Q3PtrVector<UmlItem> ch = children();
  unsigned n = ch.size();
  
  for (unsigned i = 0; i != n; i += 1)
    ch[i]->write(out);

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

  unload();
}
示例#13
0
void UmlActivityObject::write(FileOut & out)
{
    const char * k = (parent()->kind() == anActivity)
                     ? "node" : "containedNode";

    out.indent();
    out << '<' << k << " xmi:type=\"uml:";

    WrapperStr st = stereotype();

    if (st == "datastore")
        out << "DataStoreNode";
    else if (st == "centralBuffer")
        out << "CentralBufferNode";
    else
        out << "ObjectNode";

    out << "\" name=\"";
    out.quote(name());
    out << '"';
    out.id(this);

    if (isControlType())
        out << " isControlType=\"true\"";

    write_ordering(out);
    write_selection(out);
    write_in_state(out);
    out << ">\n";

    out.indent(+1);

    write_description_properties(out);
    write_multiplicity(out, multiplicity(), this);
    UmlItem::write_type(out, type());

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

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

    write_incoming_flows(out);

    out.indent(-1);

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

    unload();
}
示例#14
0
void UmlRelation::write_generalization(FileOut & out) {
  out.indent();
  out << "<generalization xmi:type=\"uml:Generalization\"";
  out.id(this);
  out.ref(roleType(), "general");
  if (!constraint().isEmpty()) {
    out << ">\n";
    out.indent(+1);
    write_constraint(out);
    out.indent(-1);
    out.indent();
    out << "</generalization>\n";
  }
  else
    out << "/>\n";
}
示例#15
0
void UmlRelation::write_dependency(FileOut & out) {
  const char * k = (_uml_20) ? "ownedElement" : "packagedElement";

  out.indent();
  out << '<' << k << " xmi:type=\"uml:Dependency\"";
  out.id(this);
  out.ref(parent(), "client");
  out.ref(roleType(), "supplier");
  out << ">\n";
  out.indent(+1); 
  write_constraint(out);
  write_description_properties(out);
  out.indent(-1);
  out.indent();
  out << "</" << k << ">\n";
}
示例#16
0
void UmlNcRelation::write_dependency(FileOut & out)
{
    const char * k = (_uml_20) ? "ownedElement" : "packagedElement";

    out.indent();
    out << '<' << k <<
        (((parent()->kind() == anArtifact) && (stereotype() == "manifest"))
         ?  " xmi:type=\"uml:Manifestation\"" : " xmi:type=\"uml:Dependency\"");
    out.id(this);
    out.ref(parent(), "client");
    out.ref(target(), "supplier");
    out << ">\n";
    out.indent(+1);
    write_description_properties(out);
    out.indent(-1);
    out.indent();
    out << "</" << k << ">\n";
}
示例#17
0
void UmlEntryPointPseudoState::write(FileOut & out) {
  UmlEntryPointPseudoState * ref = reference();
  
  out.indent();
  if (ref != 0)
    out << "<connection";
  else
    out << "<subvertex xmi:type=\"uml:Pseudostate\"";
  out.id(this);
  if (! name().isEmpty()) {
    out << " name=\"";
    out.quote(name());
    out << '"';
  }
  if (ref != 0) {
    out.ref(ref, "entry");
    out << ">\n";
  }
  else
    out << " kind=\"entryPoint\">\n";

  out.indent(+1);
  
  write_description_properties(out); 
     
  while (! _incoming_trans.isEmpty())
    _incoming_trans.take(0)->write_in(out);
  
  const QVector<UmlItem> ch = children(); 
  unsigned n = ch.size();
  unsigned i;
     
  for (i = 0; i != n; i += 1)
    ch[i]->write(out);

  out.indent(-1);
  out.indent();
  if (ref != 0)
    out << "</connection>\n";
  else
    out << "</subvertex>\n";
    
  unload(); 
}
示例#18
0
void UmlFinalState::write(FileOut & out)
{
    out.indent();
    out << "<subvertex xmi:type=\"uml:FinalState\"";
    out.id(this);
    out << " name=\"Final\">\n";
    out.indent(+1);

    write_description_properties(out);

    while (! _incoming_trans.isEmpty())
        _incoming_trans.take(0)->write_in(out);

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

    unload();
}
示例#19
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); 
    }
  } 
 
}
示例#20
0
void UmlInterruptibleActivityRegion::write(FileOut & out) {
  out.indent();
  out << "<group xmi:type=\"uml:InterruptibleActivityRegion\"";
  out.id(this);
  out << ">\n";
  out.indent(+1);
  
  write_description_properties(out); 
  
  const QVector<UmlItem> ch = children();
  unsigned n = ch.size();
  
  for (unsigned i = 0; i != n; i += 1)
    ch[i]->write(out);

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

  unload();
}
示例#21
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;
}
示例#22
0
void UmlComponent::write(FileOut & out)
{
    const char * k = (parent()->kind() == anUseCase)
                     ? "ownedUseCase"
                     : ((_uml_20) ? "ownedMember" : "packagedElement");

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

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

    for (index = 0; index != n; index += 1)
        ch[index]->write(out);

    // provided

    const QVector< UmlClass* > & prov = providedClasses();

    n = prov.size();

    for (index = 0; index != n; index += 1) {
        UmlClass * cl = prov[index];

        out.indent();
        out << "<interfaceRealization xmi:type=\"uml:InterfaceRealization\"";
        out.id_prefix(this, "PROV_", index);
        out.ref(cl, "supplier");
        out.ref(this, "client");
        out.ref(cl, "contract");
        out << "/>\n";
    }

    // realizing

    const QVector< UmlClass* > & rea = realizingClasses();

    n = rea.size();

    for (index = 0; index != n; index += 1) {
        UmlClass * cl = rea[index];

        out.indent();
        out << "<realization xmi:type=\"uml:ComponentRealization\"";
        out.id_prefix(this, "REA_", index);
        out.ref(cl, "supplier");
        out.ref(this, "client");
        out.ref(cl, "realizingClassifier");
        out << "/>\n";
    }

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

    // required

    const QVector< UmlClass* > & req = requiredClasses();

    n = req.size();

    for (index = 0; index != n; index += 1) {
        UmlClass * cl = req[index];

        out.indent();
        out << "<" << k << " xmi:type=\"uml:Usage\"";
        out.id_prefix(this, "REQ_", index);
        out.ref(cl, "supplier");
        out.ref(this, "client");
        out << "/>\n";
    }

    unload();

}
示例#23
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;
}
示例#24
0
void UmlRelation::write_relation_as_attribute(FileOut & out) {
  UmlRelation * first = side(TRUE);
  Q3CString s;  
  UmlClass * base;

  if ((first->parent()->stereotype() == "stereotype") &&
      (first->roleType()->stereotype() == "metaclass")) {
    if (this != first)
      return;
    
    base = first->roleType();
    s = "base_" + base->name();
  }
  else {
    base = 0;
      
    switch (_lang) {
    case Uml:
      s = roleName();
      break;
    case Cpp:
      if (cppDecl().isEmpty())
	return;
      s = true_name(roleName(), cppDecl());
      break;
    default: // Java
      if (javaDecl().isEmpty())
	return;
      s = true_name(roleName(), javaDecl());
    }
  }
  
  out.indent();
  out << "<ownedAttribute xmi:type=\"uml:Property\" name=\"" << s << '"';
  out.id(this);
  
  if (base != 0)
    out.ref(first, "association", "EXT_");
  else {
    write_visibility(out);
    write_scope(out);
    if (isReadOnly())
      out << " isReadOnly=\"true\"";
    if (isDerived()) {
      out << " isDerived=\"true\"";
      if (isDerivedUnion())
	out << " isDerivedUnion=\"true\"";
    }
    if (isOrdered())
      out << " isOrdered=\"true\"";
    if (isUnique())
      out << " isUnique=\"true\"";
  
    if (first->_assoc_class != 0)
      out.ref(first->_assoc_class, "association");
    else
      out.ref(first, "association", "ASSOC_");
  
    out << " aggregation=\"";
    if (this == first) {
      parent()->memo_relation(this);
      if (_gen_eclipse) {
	switch (relationKind()) {
	case anAggregation:
	case aDirectionalAggregation:
	  out << "shared";
	  break;
	case anAggregationByValue:
	case aDirectionalAggregationByValue:
	  out << "composite";
	  break;
	default:
	  out << "none";
	}
      }
      else
	out << "none";
    }
    else if (_gen_eclipse)
      out << "none";
    else {
      switch (relationKind()) {
      case anAggregation:
      case aDirectionalAggregation:
	out << "shared";
	break;
      case anAggregationByValue:
      case aDirectionalAggregationByValue:
	out << "composite";
	break;
      default:
	out << "none";
      }
    }
    out << '"';
  }
  
  out << ">\n";
  out.indent(+1);
  
  out.indent();
  out << "<type xmi:type=\"uml:Class\"";
  if (base != 0) {
    if (! base->propertyValue("metaclassPath", s))
      s = (_uml_20) ? "http://schema.omg.org/spec/UML/2.0/uml.xml"
		    : "http://schema.omg.org/spec/UML/2.1/uml.xml";
    out << " href=\"" << s << '#' << base->name() << '"';
  }
  else
    out.idref(roleType());
  out << "/>\n";
  write_multiplicity(out, multiplicity(), this);
  write_default_value(out, defaultValue(), this);
  write_constraint(out);
  write_annotation(out);
  write_description_properties(out);
  
  out.indent(-1);
  out.indent();
  out << "</ownedAttribute>\n";

  unload();
}
示例#25
0
void UmlTransition::write_it(FileOut & out)
{
    out.indent();
    out << "<transition xmi:type=\"uml:Transition\"";
    out.id(this);

    if (!name().isEmpty() && (name() != "<transition>")) {
        out << " name=\"";
        out.quote(name());
        out << '"';
    }

    out.ref(parent(), "source");
    out.ref(target(), "target");

    if (parent() == target())
        out << " kind=\"" << ((isExternal()) ? "external" : "internal") << '"';

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

    WrapperStr trig;
    WrapperStr grd;
    WrapperStr effect;

    switch (_lang) {
    case Uml:
        trig = trigger();
        grd = guard();
        effect = activity();
        break;

    case Cpp:
        trig = cppTrigger();
        grd = cppGuard();
        effect = cppActivity();
        break;

    default: // Java
        trig = javaTrigger();
        grd = javaGuard();
        effect = javaActivity();
        break;
    }

    if (! trig.isEmpty()) {
        out.indent();
        out << "<trigger xmi:type=\"uml:Trigger\"";
        out.id_prefix(this, "TRIGGER_");
        out << " name=\"";
        out.quote(trig);
        out << "\"/>\n";
    }

    if (! grd.isEmpty()) {
        out.indent();
        out << "<guard xmi:type=\"uml:Constraint\"";
        out.id_prefix(this, "GUARD_");
        out << ">\n";
        out.indent();
        out << "\t<specification xmi:type=\"uml:OpaqueExpression\"";
        out.id_prefix(this, "GUARD_EXPR_");
        out << ">\n";
        out.indent();
        out << "\t\t<body>";
        out.quote(grd);
        out << "</body>\n";
        out.indent();
        out << "\t</specification>\n";
        out.indent();
        out << "</guard>\n";
    }

    if (! effect.isEmpty()) {
        out.indent();
        out << "<effect xmi:type=\"uml:Activity\"";
        out.id_prefix(this, "EFFECT_");
        out << ">\n";
        out.indent();
        out << "\t<body>";
        out.quote(effect);
        out << "</body>\n";
        out.indent();
        out << "</effect>\n";
    }

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

    unload();
}
示例#26
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;
}
示例#27
0
void UmlState::write(FileOut & out) {
  anItemKind pkind = parent()->kind();
  bool mach = (pkind != aState) && (pkind != aRegion);
  UmlState * ref = reference();
  const char * k;
  
  if (mach) {
    k = (_uml_20) ? "ownedMember" : "packagedElement";
    memo_incoming_trans();
  }
  else
    k = "subvertex";
  
  out.indent(); 
  out << "<" << k << " xmi:type=\"uml:"
    << ((mach || (stereotype() == "machine")) ? "StateMachine" : "State")
    << '"';
  out.id(this); 
  out << " name=\"";
  out.quote(name());
  out << '"';
  if (ref != 0)
    out.ref(ref, "submachine");
  else {
    if (specification() != 0)
      out.ref(specification(), "specification");
    if (isActive())
      out << " isActive=\"true\"";
  }
  out << ">\n";
  out.indent(+1); 
  
  write_description_properties(out); 
  
  if (ref == 0) {
    QCString doentry;
    QCString doactivity;
    QCString doexit;
    
    switch (_lang) {
    case Uml:
      doentry = entryBehavior();
      doactivity = doActivity();
      doexit = exitBehavior();
      break;
    case Cpp:
      doentry = cppEntryBehavior();
      doactivity = cppDoActivity();
      doexit = cppExitBehavior();
      break;
    default: // Java
      doentry = javaEntryBehavior();
      doactivity = javaDoActivity();
      doexit = javaExitBehavior();
      break;
    }
    
    if (! doentry.isEmpty()) {
      out.indent();
      out << "<entry xmi:type=\"uml:Activity\"";
      out.id_prefix(this, "ENTRY_");
      out << ">\n";
      out.indent();
      out << "\t<body>";
      out.quote(doentry);
      out << "</body>\n";
      out.indent();
      out << "</entry>\n";
    }
    
    if (! doactivity.isEmpty()) {
      out.indent();
      out << "<doActivity xmi:type=\"uml:Activity\"";
      out.id_prefix(this, "DOACTIVITY_");
      out << ">\n";
      out.indent();
      out << "\t<body>";
      out.quote(doactivity);
      out << "</body>\n";
      out.indent();
      out << "</doActivity>\n";
    }
    
    if (! doexit.isEmpty()) {
      out.indent();
      out << "<exit xmi:type=\"uml:Activity\"";
      out.id_prefix(this, "EXIT_");
      out << ">\n";
      out.indent();
      out << "\t<body>";
      out.quote(doexit);
      out << "</body>\n";
      out.indent();
      out << "</exit>\n";
    }
  }
  
  while (! _incoming_trans.isEmpty())
    _incoming_trans.take(0)->write_in(out);
  
  const QVector<UmlItem> ch = children(); 
  unsigned n = ch.size();
  unsigned i;
  bool need_region = FALSE;
     
  for (i = 0; i != n; i += 1) {
    if (ch[i]->kind() != aRegion) {
      need_region = TRUE;
      break;
    }
  }

  if (need_region) {
    if (ref == 0) {
      out.indent();
      out << "<region xmi:type=\"uml:Region\"";
      out.id_prefix(this, "IMPLICIT_REGION_");
      out << " name=\"Bouml_Implicit_Region\">\n";
      out.indent(+1);
    }
    
    for (i = 0; i != n; i += 1)
      if (ch[i]->kind() != aRegion)
	ch[i]->write(out);
    
#if 0
    // to bypass Eclipse's bug
    while (! _trans.isEmpty())
      _trans.take(0)->write_it(out);
#endif
    
    if (ref == 0) {
      out.indent(-1);
      out.indent();
      out << "</region>\n";
    }
  }

  if (ref == 0) {
    for (i = 0; i != n; i += 1)
      if (ch[i]->kind() == aRegion)
	ch[i]->write(out);
  }
       
#if 1
    // to bypass Eclipse's bug
    while (! _trans.isEmpty())
      _trans.take(0)->write_it(out);
#endif
    
  out.indent(-1); 
  out.indent(); 
  out << "</" << k << ">\n"; 
    
  unload(); 
}
示例#28
0
void UmlClass::write(FileOut & out) {
  QCString st = stereotype();
  
  if (st == "metaclass")
    return;
  
  bool is_actor = (st == "actor");
  bool is_enum = (st == "enum");
  bool is_stereotype =
    (st == "stereotype") && 
    (parent()->parent()->kind() == aPackage) &&
    (parent()->parent()->stereotype() == "profile");
  
  if (!is_actor) {
    switch (_lang) {
    case Cpp:
      if (cppDecl().isEmpty())
	return;
      break;
    case Java:
      if (javaDecl().isEmpty())
	return;
    default:
      break;
    }
  }

  const char * k = (parent()->kind() == aClass)
    ? "nestedClassifier"
    : ((!_uml_20)
       ? "packagedElement"
       : ((is_stereotype) ? "ownedStereotype" : "ownedMember"));
  bool is_assoc_class = (_assoc != 0);
  
  out.indent();
  out << "<" << k << " xmi:type=\"uml:"
    << ((is_actor) 
	? "Actor"
	: ((is_assoc_class)
	   ? "AssociationClass"
	   : ((st == "interface")
	      ? "Interface" 
	      : ((is_enum)
		 ?"Enumeration"
		 : ((is_stereotype) ? "Stereotype" : "Class")))))
    << "\" name=\"";
  out.quote(name());
  out << '"';
  out.id(this);
  write_visibility(out);
  if (isAbstract())
    out << " isAbstract=\"true\"";
  if (isActive())
    out << " isActive=\"true\"";
  out << ">\n";
  
  if (is_assoc_class)
    _assoc->write_ends(out);
    
  out.indent(+1);
  
  write_constraint(out);
  write_annotation(out);
  write_description_properties(out);
  
  if (_gen_extension && (st == "typedef")) {
    const UmlTypeSpec & base = baseType();
    
    if ((base.type != 0) || !base.explicit_type.isEmpty()) {
      out.indent();
      out << "<xmi:Extension extender=\"Bouml\">\n";
      out.indent();
      out << "\t<typedef>\n";
      out.indent(+2);
      UmlItem::write_type(out, base, "base");
      out.indent(-2);
      out.indent();
      out << "\t</typedef>\n";
      out.indent();
      out << "</xmi:Extension>\n";
    }
  }
  
  write_formals(out);
  write_actuals(out);
  
  const QVector<UmlItem> ch = children();
  unsigned n = ch.size();
  unsigned i;
  
  for (i = 0; i != n; i += 1)
    ch[i]->write(out);
  
  if (is_stereotype) {
    QCString path;
    
    if (propertyValue("stereotypeIconPath", path) && !path.isEmpty()) {
      out.indent();
      out << "<icon xmi:type=\"uml:Image\"";
      out.id_prefix(this, "Icon_");
      out << " location=\"" << path << "\"/>\n";
    }
  }
  
  out.indent(-1);
  out.indent();
  out << "</" << k << ">\n";
  
  if (is_stereotype)
    for (i = 0; i != n; i += 1)
      if (ch[i]->kind() == aRelation)
	((UmlRelation *) ch[i])->write_extension(out);
  
  unload();
}
示例#29
0
void UmlOperation::write(FileOut & out)
{
    WrapperStr decl;

    switch (_lang) {
    case Uml:
        out.indent();
        out << "<ownedOperation xmi:type=\"uml:Operation\" name=\"";
        out.quote((const char *)name()); //[jasa] ambiguous call
        break;

    case Cpp:
        decl = cppDecl();

        if (decl.isEmpty())
            return;

        remove_comments(decl);
        out.indent();
        out << "<ownedOperation xmi:type=\"uml:Operation\" name=\"";
        out.quote((const char *)true_name(name(), cppDecl())); //[jasa] ambiguous call
        break;

    default: // Java
        decl = javaDecl();

        if (decl.isEmpty())
            return;

        remove_comments(decl);
        out.indent();
        out << "<ownedOperation xmi:type=\"uml:Operation\" name=\"";
        out.quote((const char *)true_name(name(), javaDecl())); //[jasa] ambiguous call
        break;
    }

    out << '"';
    out.id(this);

    write_visibility(out);
    write_scope(out);

    if ((_lang == Cpp) && isCppConst())
        out << " isQuery=\"true\"";

    out << " isAbstract=\""
        << ((isAbstract()) ? "true" : "false")
        << "\">\n";

    out.indent(+1);

    write_constraint(out);
    write_annotation(out);
    write_description_properties(out);
    write_exceptions(out);
    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 << "</ownedOperation>\n";

    unload();
}