Beispiel #1
0
static UmlRelation * search_rel(Class * container, const WrapperStr & name,
                                UmlClass * dest, const WrapperStr & st)
{
    UmlItem * x = container->get_uml()->search_for_att_rel(name);

    if (x == 0)
        return 0;
    else if (x->kind() == anAttribute) {
        ((UmlAttribute *) x)->deleteIt();
        return 0;
    }
    else {
        UmlRelation * r1 = ((UmlRelation *) x)->side(TRUE);
        UmlRelation * r2 = (r1 != x)
                           ? ((UmlRelation *) x)
                           : ((UmlRelation *) x)->side(FALSE);

        if ((((UmlRelation *) x)->roleType() == dest) &&
            ((r2 == 0) ||
             st.isEmpty() ||
             (((UmlRelation *) x)->stereotype() == st) ||
             (((x == r1) ? r2 : r1)->javaDecl().find("${stereotype}") == -1)))
            return (UmlRelation *) x;

        // rel target or new stereotype not compatible with other side
        if (x != r1)
            r1->set_unidir();
        else if (r2 == 0)
            r1->deleteIt();
        else
            r2->set_unidir();

        return 0;
    }
}
static UmlAttribute * search_attr(Class * container, const WrapperStr & name)
{
    UmlItem * x = container->get_uml()->search_for_att_rel(name);

    if (x == 0)
        return 0;
    else if (x->kind() == anAttribute)
        return (UmlAttribute *) x;

    switch (((UmlRelation *) x)->relationKind()) {
    case aDirectionalAssociation:
    case aDirectionalAggregation:
    case aDirectionalAggregationByValue:
        x->deleteIt();
        break;

    case anAssociation:
    case anAggregation:
    case anAggregationByValue:
        if (x == ((UmlRelation *) x)->side(TRUE))
            ((UmlRelation *) x)->side(FALSE)->set_unidir();
        else
            ((UmlRelation *) x)->set_unidir();

        break;

    default:
        break;
    }

    return 0;
}
Beispiel #3
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);
	}
      }
    }
  }
}
Beispiel #4
0
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();
    }

}
Beispiel #5
0
void UmlClass::import(QTextOStream & f, const QCString & indent) {
  QCString s;
  
  if (!isJavaExternal()) {
    UmlArtifact * cp = associatedArtifact();
    UmlPackage * pack = (UmlPackage *)
      ((cp != 0) ? (UmlItem *) cp : (UmlItem *) this)->package();
    
    if ((s = pack->javaPackage()).isEmpty())
      return;
    
    QCString s2 = name();
    UmlItem * p = this;
    
    while ((p = p->parent())->kind() == aClass)
      s2 = p->name() + dot + s2;
    
    s += dot + s2;
  }
  else if ((s = package()->javaPackage()).isEmpty())
    return;
  else
    s += dot + name();
  
  if (! UmlArtifact::generated_one()->is_imported(s)) {
    f << indent << "import " << s << ";\n";
    UmlArtifact::generated_one()->imported(s);
  }
}
Beispiel #6
0
void UmlClass::generalizeDependRealize(UmlItem * target, FileIn & in, int context, WrapperStr label, WrapperStr constraint)
{
    static const struct {
        aRelationKind rk;
        const char * err;
    } r[] = {
        { aGeneralisation, "cannot create generalization from '" },
        { aDependency, "cannot create dependency from '" },
        { aRealization, "cannot create realization from '" },
        { aDependency, "cannot create usage from '" },
        { aDependency, "cannot create import from '" }
    };
    UmlItem * rel;

    if (target->kind() == aClass)
        rel = UmlRelation::create(r[context].rk, this, (UmlClass *) target);
    else
        rel = UmlNcRelation::create(r[context].rk, this, target);

    if (rel == 0)
        in.warning(r[context].err + name() + "' to '" + target->name() + "'");
    else {
        if (! label.isEmpty())
            rel->set_Name(label);

        if (! constraint.isEmpty() && (target->kind() == aClass))
            ((UmlRelation *) rel)->set_Constraint(constraint);
    }
}
void UmlExtraClassMember::add_init(UmlClass * cl, WrapperStr def, bool roundtrip,
                                   QList<UmlItem *> & expected_order)
{
    if (roundtrip) {
        const QVector<UmlItem*> & ch = cl->children();
        UmlItem *const* v = ch.data();
        UmlItem *const*  vsup = v + ch.size();
        UmlItem * x;

        for (; v != vsup; v += 1) {
            if (((x = *v)->kind() == anExtraClassMember) &&
                ((UmlExtraClassMember *) x)->is_useless() &&
                (x->name() == "initialization")) {
                expected_order.append(x);

                if (neq(((UmlExtraClassMember *) x)->javaDecl(), def)) {
                    ((UmlExtraClassMember *) x)->set_JavaDecl(def);
                    cl->get_class()->set_updated();
                }

                ((UmlExtraClassMember *) x)->set_usefull();
                return;
            }
        }
    }

    UmlExtraClassMember * x =
        UmlExtraClassMember::create(cl, "initialization");

    x->set_JavaDecl(def);
    expected_order.append(x);
}
Beispiel #8
0
UmlClass * UmlClass::addMetaclass(WrapperStr mclname, const char * mclpath)
{
    UmlPackage * pack = (UmlPackage *) parent()->parent();	// is a package
    const Q3PtrVector<UmlItem> ch = pack->children();
    unsigned n = ch.size();
    UmlClass * r = 0;

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

        if ((x->kind() == aClassView) &&
            !strncmp(x->name(), "meta classes", 12) &&
            ((r = UmlClass::create(x, mclname)) != 0))
            break;
    }

    if (r == 0) {
        WrapperStr s = "meta classes";
        UmlItem * v = 0;

        while ((v = UmlClassView::create(pack, s)) == 0)
            s += "_";

        r = UmlClass::create(v, mclname);
    }

    r->set_Stereotype("metaclass");

    if (mclpath != 0)
        r->set_PropertyValue("metaclassPath", mclpath);

    return r;
}
Beispiel #9
0
void UmlItem::manage_alias(const char *& p, QTextStream & ts)
{
    // p starts by '@'
    const char * pclosed;

    if ((p[1] == '{') && ((pclosed = strchr(p + 2, '}')) != 0)) {
        QByteArray key_(p + 2, pclosed - p - 1);
        WrapperStr key = key_;
        WrapperStr value;
        UmlItem * node = this;

        do {
            if (node->propertyValue(key, value))
                break;

            node = node->parent();
        }
        while (node != 0);

        if (node != 0)
            // find, insert the value
            ts << value;
        else
            // not find, insert the key
            ts << "@{" << key << '}';

        // bypass the key
        p += strlen(key) + 3;
    }
    else
        // bypass '$'
        ts << toLocale(p);
}
Beispiel #10
0
UmlItem * UmlClass::search_for_att_rel(const WrapperStr & name)
{
    const QVector<UmlItem*> & ch = UmlItem::children();

    QVectorIterator<UmlItem*> it(ch);
    while(it.hasNext())
    {
        UmlItem* item = it.next();
        switch (item->kind()) {
        case anAttribute:
            if (item->name() == name)
                return item;

            break;

        case aRelation:
            if (((UmlRelation *) item)->roleName() == name)
                return item;

            break;

        default:
            break;
        }
    }

    return 0;
}
Beispiel #11
0
void UmlItem::manage_alias(const char *& p, QTextOStream & ts,
			   Q3CString indent, BooL & indent_needed) {
  if (indent_needed) {
    indent_needed = FALSE;
    ts << indent;
  }
  
  // p starts by '@'
  const char * pclosed;
  
  if ((p[1] == '{') && ((pclosed = strchr(p + 2, '}')) != 0)) {
    Q3CString key(p + 2, pclosed - p - 1);
    Q3CString value;
    UmlItem * node = this;

    do {
      if (node->propertyValue(key, value))
	break;
      node = node->parent();
    } while (node != 0);
    
    if (node != 0)
      // find, insert the value
      ts << value;
    else
      // not find, insert the key
      ts << "@{" << key << '}';

    // bypass the key
    p += strlen(key) + 3;
  }
  else
    // bypass '$'
    ts << *p++;
}
Beispiel #12
0
UmlAttribute * UmlAttribute::search_attr(UmlClass * cl, const Q3CString & name)
{
  UmlItem * x = cl->search_for_att_rel(name);
  
  if (x == 0)
    return 0;
  else if (x->kind() == anAttribute)
    return (UmlAttribute *) x;
  
  switch (((UmlRelation *) x)->relationKind()) {
  case aDirectionalAssociation:
  case aDirectionalAggregation:
  case aDirectionalAggregationByValue:
    x->deleteIt();
    break;
  case anAssociation:
  case anAggregation:
  case anAggregationByValue:
    if (x == ((UmlRelation *) x)->side(TRUE))
      ((UmlRelation *) x)->side(FALSE)->set_unidir();
    else
      ((UmlRelation *) x)->set_unidir();
    break;
  default:
    break;
  }

  return 0;
}
Beispiel #13
0
UmlPackage * UmlArtifact::package() {
  UmlItem * parent = this->parent();
  
  while (parent->kind() != aPackage)
    parent = parent->parent();
  
  return (UmlPackage *) parent;
}
Beispiel #14
0
int main(int argc, char ** argv)
{
  if (argc != 2)
      return 0;
  
  if (UmlCom::connect(QCString(argv[1]).toUInt())) {
    try {
      //UmlCom::with_ack(FALSE);
      UmlCom::trace("<b>C++ reverse</b> release 2.15<br>");
      UmlCom::traceAutoRaise(FALSE);
      
      UmlItem * item = UmlCom::targetItem();
      
      if (item->kind() != aPackage)
	UmlCom::trace("<font face=helvetica><b>must be applied on a <i>package</i></b></font><br><hr><br>");
      else {
	char * argv = 0;
	int argc = 0;
	QApplication * app = new QApplication(argc, &argv);
				 
	Package::init((UmlPackage *) item, app);
	
	QCString f;
	
	if (UmlPackage::getProject()->propertyValue("#file", f))
	  Lex::defines(f);
	
	// add c++ catalog like java ?
	
	int n;
	
	Package::scan_dirs(n);
	
	if (n != 0) {
	  CppSettings::set_UseDefaults(TRUE);
	  Package::send_dirs(n, TRUE);
	  Statistic::produce();
	}
      }
    }
    catch (...) {
    }
    
    try {
      // socket may be already closed
      UmlCom::message("");
      UmlCom::showTrace();
      UmlCom::bye(0);	// application must not be deleted
    }
    catch (...) {
    }
  }
  
  UmlCom::close();
  return 0;
}
Beispiel #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();
            }
        }
    }

}
Beispiel #16
0
void UmlPackage::applyStereotype(FileIn & in, Token & token)
{
    WrapperStr prof_st;
    Q3ValueList<WrapperStr> base_v;
    WrapperStr s;

    if (UmlClass::isAppliedStereotype(token, prof_st, base_v)) {
        WrapperStr s;
        Q3ValueList<WrapperStr>::Iterator it_ext;

        for (it_ext = base_v.begin(); it_ext != base_v.end(); ++it_ext) {
            WrapperStr s2;

            if (token.valueOf(*it_ext, s2)) {
                if (s.isEmpty())
                    s = s2;
                else if (s != s2)
                    in.warning("doesn't refer to the same element ('" + s + "' != '" + s2 + "')");
            }
        }

        if (s.isEmpty())
            in.warning("value of 'base_...' is missing");
        else {
            UmlItem * elt = All[s];

            if (elt == 0) {
                if (!FileIn::isBypassedId(s))
                    in.warning("unknown reference '" + s + "'");
            }
            else {
                elt->set_Stereotype(prof_st);
                elt->UmlItem::applyStereotype();	// set properties

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

                while (it.current()) {
                    WrapperStr k = it.currentKey().latin1();

                    if (token.valueOf(k.mid(k.findRev(':') + 1).lower(), s))
                        elt->set_PropertyValue(k, s);

                    ++it;
                }
            }
        }

        if (! token.closed())
            in.finish(token.what());
    }
    else
        in.bypass(token);

}
Beispiel #17
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();

}
Beispiel #18
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());
  }
}
Beispiel #19
0
bool UmlClass::isAppliedStereotype(Token & tk, WrapperStr & prof_st, Q3ValueList<WrapperStr> & base_v)
{
    static Q3Dict<WrapperStr> stereotypes;
    static Q3Dict<Q3ValueList<WrapperStr> > bases;

    WrapperStr s = tk.what();
    WrapperStr * st = stereotypes[s];

    if (st != 0) {
        prof_st = *st;
        base_v = *bases[s];
        return TRUE;
    }

    base_v.clear();

    if (tk.xmiType().isEmpty() && (getFct(tk) == 0))  {
        int index = s.find(':');

        if ((index != -1) &&
            ((index != 3) || ((s.left(3) != "uml") && (s.left(3) != "xmi")))) {
            UmlClass * cl = findStereotype(s, FALSE);

            if (cl != 0) {
                const Q3PtrVector<UmlItem> ch = cl->children();
                unsigned n = ch.size();

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

                    if ((x->kind() == aRelation) &&
                        (((UmlRelation *) x)->relationKind() == aDirectionalAssociation) &&
                        (((UmlRelation *) x)->roleType()->stereotype() == "metaclass"))
                        base_v.append("base_" + ((UmlRelation *) x)->roleType()->name().lower());
                }

                if (base_v.isEmpty())
                    base_v.append("base_element");

                prof_st = cl->parent()->parent()->name() + ":" + cl->name();
                stereotypes.insert(s, new WrapperStr(prof_st));
                bases.insert(s, new Q3ValueList<WrapperStr>(base_v));
                return TRUE;
            }
        }
    }

    return FALSE;
}
Beispiel #20
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());
  }
}
Beispiel #21
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());
    }
  }
}
Beispiel #22
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;
  }
}
Beispiel #23
0
UmlExtraClassMember *
UmlClass::search_for_extra(const WrapperStr & name, const WrapperStr & decl)
{
    const QVector<UmlItem*> & ch = UmlItem::children();
    QVectorIterator<UmlItem*> it(ch);
    while(it.hasNext())
    {
        UmlItem* item = it.next();
        if ((item->kind() == anExtraClassMember) &&
            (item->name() == name) &&
            !neq(((UmlExtraClassMember *) item)->cppDecl(), decl))
            return (UmlExtraClassMember *) item;
    }

    return 0;
}
Beispiel #24
0
void UmlClass::write(QTextOStream & f) {
  if (isJavaExternal()) {
    QCString s = javaDecl().stripWhiteSpace();
    int index;
      
    if ((index = s.find("${name}")) != -1)
      s.replace(index, 7, name());
    else if ((index = s.find("${Name}")) != -1)
      s.replace(index, 7, capitalize(name()));
    else if ((index = s.find("${NAME}")) != -1)
      s.replace(index, 7, name().upper());
    else if ((index = s.find("${nAME}")) != -1)
      s.replace(index, 7, name().lower());
    
    f << s;
  }
  else {
    UmlClass * toplevel = this;
    UmlItem * p;
    QCString s2;
    
    while ((p = toplevel->parent())->kind() == aClass) {
      toplevel = (UmlClass *) p;
      s2 = dot + p->name() + s2;
    }
    
    UmlArtifact * cp = toplevel->associatedArtifact();
    UmlPackage * pack = (UmlPackage *)
      ((cp != 0) ? (UmlItem *) cp : (UmlItem *) toplevel)->package();
    
    if (pack != UmlArtifact::generation_package()) {
      QCString s = pack->javaPackage();

      if (! s.isEmpty() && (s != "java.lang") && (s.left(10) != "java.lang.")) {
	s += s2;
	
	if (JavaSettings::isForcePackagePrefixGeneration() ||
	    !UmlArtifact::generated_one()->is_imported(s, name()))
	  f << s << '.';
      }
    }
    else if (! s2.isEmpty())
      f << s2.mid(1) << '.';
    
    f << name();
  }
}
Beispiel #25
0
void UmlArtifact::solveManifestation(WrapperStr s, WrapperStr idref)
{
    QMap<WrapperStr, UmlItem *>::Iterator it = All.find(idref);

    if (it == All.end()) {
        if (!FileIn::isBypassedId(idref))
            UmlCom::trace("manifestation : unknown utilized element reference '" + idref + "'<br>");

        return;
    }

    UmlItem * target = *it;

    if (!FromBouml || (s != "dependency")) {
        switch (target->kind()) {
        case aClass:
            if (s != "source")
                break;
            else if (stereotype().isEmpty())
                set_Stereotype("source");
            else if (stereotype() != "source")
                break;

            addAssociatedClass((UmlClass *) target);
            return;

        case anArtifact:
            if (!FromBouml)
                break;

            addAssociatedArtifact((UmlArtifact *) target);
            return;

        default:
            break;
        }
    }

    UmlNcRelation * rel = UmlNcRelation::create(aDependency, this, target);

    if (rel == 0)
        UmlCom::trace("cannot create manifestation from '" + name() +
                      "' to '" + target->name() + "'");
    else
        rel->set_Stereotype("manifest");
}
Beispiel #26
0
void UmlUseCase::solve(int context, Q3CString idref) {
  QMap<Q3CString, UmlItem *>::Iterator it = All.find(idref);
      
  if (it == All.end()) {
    if (!FileIn::isBypassedId(idref))
      UmlCom::trace("extend/include : unknown use case reference '" + idref + "'<br>");
  }
  else if ((*it)->kind() != anUseCase)
    UmlCom::trace("'" + idref + "' is not a use case<br>");
  else {
    UmlItem * rel = UmlNcRelation::create(aDependency, this, *it);
    
    if (rel == 0)
      UmlCom::trace("cannot create dependency from '" + name() + "' to '" + (*it)->name() + "'");
    else
      rel->set_Stereotype((context) ? "extend" : "include ");
  }
}
Beispiel #27
0
void UmlClass::get_extended(QValueList<QCString> & r) {
  r.clear();
  
  const QVector<UmlItem> ch = children();
  unsigned n = ch.size();
  unsigned i;
  
  for (i = 0; i != n; i += 1) {
    UmlItem * x = ch[i];
    
    if ((x->kind() == aRelation) &&
	(((UmlRelation *) x)->relationKind() == aDirectionalAssociation) &&
	(((UmlRelation *) x)->roleType()->stereotype() == "metaclass"))
      r.append(((UmlRelation *) x)->roleType()->name());
  }
  
  if (r.isEmpty())
    r.append("Element");
}
Beispiel #28
0
void UmlPackage::subArtifacts(QList<UmlArtifact *> &l, QByteArray name, QByteArray deplview_name)
{
    UmlDeploymentView * deplview;

    foreach (deplview, _deplviews){
        if (deplview->baseName() == deplview_name) {
            const QVector<UmlItem*> ch = deplview->children();
            int i;

            for (i = 0; i != ch.size(); i += 1) {
                UmlItem * it = ch[i];

                if ((it->kind() == anArtifact) && (it->name() == name))
                    l.append((UmlArtifact *) it);
            }
        }
    }

}
Beispiel #29
0
void UmlClass::set_under_construction(bool y, bool rec)
{
    if (y) {
        if (rec) {
            UmlItem * it = this;

            do {
                UnderConstruction.append((UmlClass *) it);
            }
            while ((it = it->parent())->kind() == aClass);
        }
        else
            UnderConstruction.append(this);
    }
    else if (rec)
        UnderConstruction.clear();
    else
        UnderConstruction.removeOne(this);
}
Beispiel #30
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());
  }
}