Пример #1
0
void ClassData::send_uml_def(ToolCom * com, BrowserNode * bn,
                             const QString & comment)
{
    int api = com->api_format(true);

    BasicData::send_uml_def(com, bn, comment);
    com->write_bool(FALSE);	// class member

    if (api >= 13)
        com->write_bool(FALSE);	// volatile

    com->write_char(((api >= 23) ||
                     (uml_visibility != UmlPackageVisibility))
                    ? uml_visibility : UmlPublic);

    if (api >= 30)
        com->write_string(constraint);

    com->write_bool(is_abstract);

    if (stereotype == "typedef") {
        BrowserNodeList inh;

        browser_node->children(inh, UmlGeneralisation, UmlRealize);

        if (inh.count() != 0)
            // first inheritance is taken in all cases
            ((RelationData *) inh.at(0)->get_data())->get_end_class()->write_id(com);
        else if (base_type.type != 0)
            base_type.type->write_id(com);
        else if (!base_type.explicit_type.isEmpty()) {
            com->write_id(0);
            com->write_string(base_type.explicit_type);
        }
        else {
            // no base_type, try with a dependency
            browser_node->children(inh, UmlDependency);

            if (inh.count() != 0)
                ((RelationData *) inh.at(0)->get_data())->get_end_class()->write_id(com);
            else {
                com->write_id(0);
                com->write_string("");
            }
        }
    }

    if (api >= 48)
        com->write_bool(is_active);
}
Пример #2
0
QString type(const QString & t, const QStringList & types,
             BrowserNodeList & nodes)
{
    int rank = types.findIndex(t);

    return (rank != -1)
           ? QString(((BrowserClass *) nodes.at(rank))->get_name())
           : t;
}
Пример #3
0
AType the_type(const QString & t, const QStringList & types,
               BrowserNodeList & nodes)
{
    AType result;
    int rank = types.findIndex(t);

    if (rank != -1)
        result.type = ((BrowserClass *) nodes.at(rank));
    else
        result.explicit_type = t;

    return result;
}
Пример #4
0
void AttributeData::set_type(const QString &value)
{
    QStringList list;
    BrowserNodeList nodes;
    BrowserClass::instances(nodes);
    nodes.full_names(list);

    AType t;
    if (!value.isEmpty())
    {
        int rank = list.indexOf(value);

        if (rank != -1)
            t.type = (BrowserClass *) nodes.at(rank);
        else
            t.explicit_type = value;
    }
    set_type(t);
}
Пример #5
0
bool BrowserNode::enter_child_name(QString & r, const QString & msg, UmlCode type,
				   BrowserNodeList & nodes,
				   BrowserNode ** old, bool allow_spaces,
				   bool allow_empty, bool existing) {
  
  if (existing && nodes.isEmpty()) {
    msg_warning(TR("Error"), TR("nothing available"));
    return FALSE;
  }
  
  QStringList list;
  
  nodes.full_names(list);
  list.prepend(QString::null);
  
  *old = 0;
  
  for (;;) {
    BooL ok = FALSE;
    
    r = (list.count() == 1)
      ? MyInputDialog::getText("Uml", msg, QString::null, ok)
      : MyInputDialog::getText("Uml", msg, list, QString::null, existing, ok);
    
    if (! ok)
      return FALSE;
    
    if (!r.isEmpty()) {
      int index = list.findIndex(r);
      
      if (index != -1) {
	*old = nodes.at(index - 1);
	return TRUE;
      }
    }
    if (wrong_child_name(r, type, allow_spaces, allow_empty))
      msg_critical(TR("Error"), r + "\n\n" + TR("illegal name or already used"));
    else
      return TRUE;
  }
}