Exemplo n.º 1
0
void UmlClass::write_formals(FileOut & out) {
  QValueList<UmlFormalParameter> formal_params = formals();
    
  if (!formal_params.isEmpty()) {
    out.indent();
    out << "<ownedTemplateSignature xmi:type=\"uml:";
    if (!_uml_20)
      out << "Redefinable";
    out << "TemplateSignature\"";
    out.id_prefix(this, "FORMALS_");
    out << ">\n";
    out.indent(+1);

    int rank;
    QValueList<UmlFormalParameter>::ConstIterator iter;

    for (iter = formal_params.begin(), rank = 0;
	 iter != formal_params.end();
	 ++iter, rank += 1)
      (*iter).write(out, this, rank, _uml_20);

    out.indent(-1);
    out.indent();
    out << "</ownedTemplateSignature>\n";
  }
}
Exemplo n.º 2
0
void UmlOperation::write_uml_params(FileOut & out)
{
    const Q3ValueList<UmlParameter> p = params();
    Q3ValueList<UmlParameter>::ConstIterator it;

    for (it = p.begin(); it != p.end(); ++it) {
        out.indent();
        out << "<ownedParameter xmi:type=\"uml:Parameter\" name=\"" << (*it).name
            << "\" xmi:id=\"BOUML_op_param_"
            << ++param_id << "\" direction=\"";

        if (_pk_prefix)
            out << "pk_";

        switch ((*it).dir) {
        case InputOutputDirection:
            out << "inout\">\n";
            break;

        case OutputDirection:
            out << "out\">\n";
            break;

        default:
            out << "in\">\n";
        }

        out.indent(+1);
        UmlItem::write_type(out, (*it).type);
        out.indent(-1);

        out.indent();
        out << "</ownedParameter>\n";
    }
}
Exemplo n.º 3
0
void UmlTransition::write_in(FileOut & out)
{
    out.indent();
    out << "<incoming";
    out.idref(this);
    out << "/>\n";
}
Exemplo n.º 4
0
void UmlRelation::write_relation(FileOut & out) {
  // note : it is the first side
 
  if (_assoc_class != 0)
    // generated in the association class
    return;
    
  const char * k = (_uml_20) ? "ownedElement" : "packagedElement";

  out.indent();
  out << '<' << k << " xmi:type=\"uml:Association\"";
  out.id_prefix(this, "ASSOC_");
  
  Q3CString s = name();
  int i1 = s.find("(");
  int i2 = s.findRev(")");
  
  if ((i1 != -1) && (i2 != -1) && (i2 > i1) && (s[i1+1] != '<')  && (s[i2-1] != '>')) {
    s = s.mid(i1 + 1, i2 - i1 - 1);
    
    if (!s.isEmpty()) {
      out << " name=\"";
      out.quote((const char*)s);//[jasa] ambiguous call
      out << '"';
    }
  }
  write_visibility(out);
  out << ">\n";
  
  write_ends(out);
  
  out.indent();
  out << "</" << k << ">\n";

}
Exemplo n.º 5
0
void UmlOpaqueAction::write(FileOut & out) {
  write_begin(out, "OpaqueAction");
  write_end(out, TRUE);
  
  Q3CString body;
  
  switch(_lang) {
  case Uml:
    body = behavior();
    break;
  case Cpp:
    body = cppBehavior();
    break;
  default:
    // Java
    body = javaBehavior();
  }

  if (!body.isEmpty()) {
    out.indent();
    out << "<body>";
    out.quote(body);
    out << "</body>\n";
  }

  write_close(out);

}
Exemplo n.º 6
0
void UmlAcceptEventAction::write(FileOut & out) {
  write_begin(out, "AcceptEventAction");
  
  if (isUnmarshall())
    out << " isUnmarshall=\"true\"";
  
  Q3CString trig;
  
  switch (_lang) {
  case Uml:
    trig = trigger();
    break;
  case Cpp:
    trig = cppTrigger();
    break;
  default:
    // java
    trig = javaTrigger();
  }

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

}
Exemplo n.º 7
0
void UmlRelation::write_extension(FileOut & out) {
  if ((side(TRUE) == this) && 
      (parent()->stereotype() == "stereotype") &&
      (roleType()->stereotype() == "metaclass")) {
    const char * k = (_uml_20) ? "ownedMember" : "packagedElement";
    
    out.indent();
    out << "<" << k << " xmi:type=\"uml:Extension\" name=\"A_";
    out.quote((const char*)roleType()->name());//[jasa] ambiguous call
    out  << '_';
    out.quote((const char*)parent()->name());//[jasa] ambiguous call
    out << '"';
    out.id_prefix(this, "EXT_");
    out.ref(this, "memberEnd", "BASE_");
    out << ">\n";
    out.indent();
    out << "\t<ownedEnd xmi:type=\"uml:ExtensionEnd\" name=\"extension_";
    out.quote((const char*)parent()->name());//[jasa] ambiguous call
    out << '"';
    out.id_prefix(this, "EXTEND_");
    out.ref(this, "type");
    out << " aggregation=\"composite\"/>\n";
    out.indent();
    out << "</" << k << ">\n";
  }

  unload();
}
Exemplo n.º 8
0
void UmlReplyAction::write(FileOut & out) {
  write_begin(out, "ReplyAction");
  
  Q3CString trig;
  
  switch (_lang) {
  case Uml:
    trig = replyToCall();
    break;
  case Cpp:
    trig = cppReplyToCall();
    break;
  default:
    // java
    trig = javaReplyToCall();
  }

  if (! trig.isEmpty()) {
    out.ref(this, "replyToCall", "TRIGGER_");
    write_end(out);
    
    out.indent();
    out << "<trigger xmi:type=\"uml:Trigger\"";
    out.id_prefix(this, "TRIGGER_");
    out << " name=\"";
    out.quote(trig);
    out << "\"/>\n";
  }
  else
    write_end(out);
}
Exemplo n.º 9
0
void UmlItem::write_multiplicity(FileOut & out, WrapperStr s, UmlItem * who)
{
    if (!s.isEmpty()) {
        WrapperStr min;
        WrapperStr max;
        int index = s.find("..");

        if (index != -1) {
            min = s.left(index).stripWhiteSpace();
            max = s.mid(index + 2).stripWhiteSpace();
        }
        else
            min = max = s.stripWhiteSpace();

        out.indent();
        out << "<lowerValue xmi:type=\"uml:LiteralString\"";
        out.id_prefix(who, "MULTIPLICITY_L_");
        out << " value=\"" << min.operator QString() << "\"/>\n";

        out.indent();
        out << "<upperValue xmi:type=\"uml:LiteralString\"";
        out.id_prefix(who, "MULTIPLICITY_U_");
        out << " value=\"" << max.operator QString() << "\"/>\n";
    }
}
Exemplo n.º 10
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);
}
Exemplo n.º 11
0
void UmlActivityAction::write_close(FileOut & out) {
  out.indent(-1);
  out.indent();
  out << ((parent()->kind() == anActivity) ? "</node>\n" : "</containedNode>\n");
    
  unload();
}
Exemplo n.º 12
0
void UmlOperation::write_cpp_java_params(FileOut & out, QCString decl) {
  int index1 = decl.find("${(}");
    
  if (index1 == -1)
    return;
    
  int index2 = decl.find("${)}", index1 + 4);
    
  if (index2 == -1)
    return;
    
  decl = decl.mid(index1 + 4, index2 - index1 - 4);
    
  index1 = 0;
    
  const QValueList<UmlParameter> p = params();
  QCString sparam;
  QCString kname;
  QCString ktype;
  int rank;
    
  if ((name() == "unload") && (parent()->name() == "UmlBasePackage"))
    rank = 123;
    
  while (get_param(decl, index1, sparam, kname, ktype, rank)) {
    if (rank < (int) p.count()) {
      const UmlParameter & pa = p[rank];
      
      out.indent();
      out << "<UML:Parameter name=\"" << pa.name
	<< "\" xmi.id=\"BOUML_op_param_"
	  << ++param_id << "\" kind =\"";
      switch (pa.dir) {
      case InputOutputDirection: out << "inout\">\n"; break;
      case OutputDirection: out << "out\">\n"; break;
      default: out << "in\">\n";
      }
      
      UmlTypeSpec t = pa.type;
      
      if ((t.type != 0) ||
	  !(t.explicit_type = (_lang == Cpp)
	    ? CppSettings::type(t.explicit_type)
	    : JavaSettings::type(t.explicit_type)).isEmpty()) {
	out.indent();
	out << "\t<UML:Parameter.type>\n";
	out.indent();
	out << "\t\t<UML:DataType";
	write_type(out, t, sparam, kname, ktype);
	out << "/>\n";
	out.indent();
	out << "\t</UML:Parameter.type>\n";
      }
      
      out.indent();
      out << "</UML:Parameter>\n";
    }
  }
}
Exemplo n.º 13
0
void UmlNcRelation::write_generalization(FileOut & out)
{
    out.indent();
    out << "<generalization xmi:type=\"uml:Generalization\"";
    out.id(this);
    out.ref(target(), "general");
    out << "/>\n";
}
Exemplo n.º 14
0
void UmlClassMember::write_annotation(FileOut & out) {
    if (_lang == Java) {
        Q3CString a = javaAnnotations();

        if (!a.isEmpty()) {
            switch (_taggedvalue_mode) {
            case 1:
                out.indent();
                out << "<UML:ModelElement.taggedValue>\n";
                out.indent();
                out << "\t<UML:TaggedValue tag=\"annotations\" value=\"";
                out.quote(a);
                out << "\"/>\n";
                out.indent();
                out << "</UML:ModelElement.taggedValue>\n";
                break;
            case 2:
                out.indent();
                out << "<UML:ModelElement.taggedValue>\n";
                out.indent();
                out << "\t<UML:TaggedValue.tag>annotations</UML:TaggedValue.tag>\n";
                out.indent();
                out << "\t<UML:TaggedValue.value>";
                out.quote(a);
                out << "</UML:TaggedValue.value>\n";
                out.indent();
                out << "</UML:ModelElement.taggedValue>\n";
            }
        }
    }
}
Exemplo n.º 15
0
void UmlItem::write_stereotyped(FileOut & out)
{
    QMap<QString, Q3PtrList<UmlItem> >::Iterator it;

    for (it = _stereotypes.begin(); it != _stereotypes.end(); ++it) {
        const char * st = it.key();
        UmlClass * cl = UmlClass::findStereotype(it.key(), TRUE);

        if (cl != 0) {
            Q3ValueList<WrapperStr> extended;

            cl->get_extended(extended);

            Q3PtrList<UmlItem> & l = it.data();
            UmlItem * elt;

            for (elt = l.first(); elt != 0; elt = l.next()) {
                out << "\t<" << st;
                out.id_prefix(elt, "STELT_");

                const Q3Dict<WrapperStr> props = elt->properties();
                Q3DictIterator<WrapperStr> itp(props);

                while (itp.current()) {
                    QString k = itp.currentKey();

                    if (k.contains(':') == 2) {
                        out << " ";
                        out.quote((const char *)k.mid(k.findRev(':') + 1)); //[jasa] ambiguous call
                        out << "=\"";
                        out.quote((const char *)*itp.current());
                        out << '"';
                    }

                    ++itp;
                }

                Q3ValueList<WrapperStr>::Iterator iter_extended;

                for (iter_extended = extended.begin();
                        iter_extended != extended.end();
                        ++iter_extended) {
                    WrapperStr vr = "base_" + *iter_extended;

                    out.ref(elt, vr);
                }

                out << "/>\n";

                elt->unload();
            }
        }
    }

}
Exemplo n.º 16
0
void UmlActivityAction::write_end(FileOut & out, bool dontclose) {
  out << ">\n";
  out.indent(+1);
  
  Q3CString s = constraint();
  
  if (! s.isEmpty()) {
    out.indent();
    out << "<ownedRule xmi:type=\"uml:Constraint\"";
    out.id_prefix(this, "CONSTRAINT_");
    out.ref(this, "constrainedElement");
    out << ">\n";
    out.indent();
    out << "\t<specification xmi:type=\"uml:OpaqueExpression\"";
    out.id_prefix(this, "CSPEC_");
    out << ">\n";
    out.indent();
    out << "\t\t<body>";
    out.quote(s);
    out << "</body>\n";
    out.indent();
    out << "\t</specification>\n";
    out.indent();
    out << "</ownedRule>\n";
  }
  
  write_description_properties(out);

  switch (_lang) {
  case Uml:
    write_condition(out, preCondition(), TRUE);
    write_condition(out, postCondition(), FALSE);
    break;
  case Cpp:
    write_condition(out, cppPreCondition(), TRUE);
    write_condition(out, cppPostCondition(), FALSE);
    break;
  default:
    // java
    write_condition(out, javaPreCondition(), TRUE);
    write_condition(out, javaPostCondition(), FALSE);
  }

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

  write_incoming_flows(out);
  
  if (!dontclose)
    write_close(out);
}
Exemplo n.º 17
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 << '"';
  }
}
Exemplo n.º 18
0
void UmlClass::write(FileOut & out)
{
    if (! _written) {
        _written = TRUE;

        // parent already written

        out.indent();
        out << "<UML:Classifier.feature>\n";
        out.indent(+1);
    }
}
Exemplo n.º 19
0
void UmlActivityNode::write_incoming_flows(FileOut & out) {
  Q3PtrListIterator<UmlFlow> it(_incoming_flows);
  
  while (it.current() != 0) {
    out.indent();
    out << "<incoming";
    out.idref(it.current());
    out << "/>\n";
    ++it;
  }

}
Exemplo n.º 20
0
void UmlRelation::write_ends(FileOut & out) {
  // note : it is the first side
 
  out.indent();
  out << "\t<memberEnd";
  out.idref(this);
  out << "/>\n";
  
  UmlRelation * other = side(FALSE);
  
  out.indent();
  if (other != 0) {
    out << "\t<memberEnd";
    out.idref(other);
    out << "/>\n";
  }
  else {
    out << "\t<ownedEnd xmi:type=\"uml:Property\"";
    out.id_prefix(this, "REVERSE_");
    if (_assoc_class != 0)
      out.ref(_assoc_class, "association");
    else
      out.ref(this, "association", "ASSOC_");
    out << " visibility=\"" << ((_vis_prefix) ? "vis_private\"" : "private\"");
    out.ref(parent(), "type");
    out << " aggregation=\"";
    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 << "\" isNavigable=\"false\"/>\n";

    out.indent();
    out << "\t<memberEnd ";
    out.idref_prefix(this, "REVERSE_");
    out << "/>\n";
  }

}
Exemplo n.º 21
0
void UmlClassMember::write_type(FileOut & out, const UmlTypeSpec & t, Q3CString s, const char * k_name, const char * k_type)
{
    s = s.simplifyWhiteSpace();

    int index;

    // remove k_name and all after it except []
    if (k_name && *k_name && ((index = s.find(k_name, 0)) != -1)) {//[rageek] Removed CS=FALSE - rethink this, case sensitive
        //remove name
        s.remove(index, strlen(k_name));

        for (;;) {
            if (s[index] == ' ')
                s.remove(index, 1);

            if (s[index] != '[')
                break;

            index += 1;

            int index2;

            if ((index2 = s.find(index, ']')) == -1)
                break;

            index = index2 + 1;
        }

        s.resize(index);
    }
    else if ((index = s.find('=')) != -1) {
        s.resize(index);
        s = s.simplifyWhiteSpace();
    }

    if (k_type && *k_type && ((index = s.find(k_type)) == -1))
        out.idref_datatype(s);
    else if (s != k_type) {
        // have modifiers
        if (t.type != 0) {
            s.replace(index, strlen(k_type), t.type->name());
            out.idref(s, t.type);
        }
        else
            out.idref_datatype(s.replace(index, strlen(k_type), t.explicit_type));
    }
    else if (t.type != 0)
        out.idref(t.type);
    else
        out.idref_datatype(t.explicit_type);
}
Exemplo n.º 22
0
void UmlArtifact::write_manifest(FileOut & out, UmlItem * x, const char * name, unsigned rank)
{
    out.indent();
    out << "<manifestation xmi:type=\"uml:Manifestation\"";
    out.id_prefix(this, "MANIFESTATION", rank);
    out.ref(this, "client");
    out.ref(x, "supplier");
    out.ref(x, "utilizedElement");

    if (name != 0)
        out << " name=\"" << name << '"';

    out << "/>\n";
}
Exemplo n.º 23
0
void UmlTransition::write(FileOut & out)
{
    UmlStateItem * x = dynamic_cast<UmlStateItem *>(parent()->parent());

    if (x == 0)
        x = dynamic_cast<UmlStateItem *>(parent());

    x->memo_trans(this);

    out.indent();
    out << "<outgoing";
    out.idref(this);
    out << "/>\n";
}
Exemplo n.º 24
0
void UmlActivityObject::write_in_state(FileOut & out) {
  QCString s = inState();
  
  if (!s.isEmpty()) {
    UmlState * st = UmlState::find(s);

    if (st != 0)
      out.ref(st, "inState");
    else {
      // not legal but ...
      out << " inState=\"";
      out.quote(s);
      out << '"';
    }
  }
}
Exemplo n.º 25
0
void UmlCallOperationAction::write(FileOut & out) {
  write_begin(out, "CallOperationAction");
  write_end(out, TRUE);
  
  UmlOperation * op = operation();
  
  if (op != 0) {
    out.indent();
    out << "<operation";
    out.idref(op);
    out << "/>\n";
  }

  write_close(out);

}
Exemplo n.º 26
0
void UmlCallBehaviorAction::write(FileOut & out) {
  write_begin(out, "CallBehaviorAction");
  write_end(out, TRUE);
  
  UmlItem * b = behavior();
  
  if (b != 0) {
    out.indent();
    out << "<behavior";
    out.idref(b);
    out << "/>\n";
  }

  write_close(out);

}
Exemplo n.º 27
0
void UmlItem::ref(FileOut & out)
{
    // theorically not called
    out << "<UML:???kind=" << kind() << "??? ";
    out.idref(this);
    out << "/>";
}
Exemplo n.º 28
0
void UmlStateAction::write(FileOut & out)
{
    out.indent();
    out << "<!-- how to export a state action ? -->\n";

    _incoming_trans.clear(); // !
    unload();
}
Exemplo n.º 29
0
void UmlOperation::write_return_type(FileOut & out, QCString decl) {
  const UmlTypeSpec & t = returnType();
  static int return_rank = 0;
  
  if ((t.type != 0) || !t.explicit_type.isEmpty()) {
    out.indent();
    out << "<UML:Parameter name=\"return\" xmi.id=\"BOUML_return_"
        << ++return_rank << "\" kind=\"return\">\n";
    out.indent();
    out << "\t<UML:Parameter.type>\n";
    out.indent();
    out << "\t\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_returntype(out, decl);
      break;
    default: // java
      write_java_returntype(out, decl);
    }
    out << "/>\n";
    out.indent();
    out << "\t</UML:Parameter.type>\n";
    out.indent();
    out << "</UML:Parameter>\n";
  }
}
Exemplo n.º 30
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();
}