Ejemplo n.º 1
0
void UmlPackage::html(Q3CString pfix, unsigned int rank, unsigned int level) {
  define();
  
  if (stereotype() == "profile")
    chapter("Profile", pfix, rank, "profile", level);
  else
    chapter("Package", pfix, rank, "package", level);

  Q3CString s = description();
  
  if (!s.isEmpty()) {
    fw.write("<p>");
    writeq(s);
    fw.write("<br /></p>");
  }
  
  bool ul = FALSE;
  
  s = cppNamespace();
  
  if (!s.isEmpty()) {
    fw.write("<p></p><ul>\n");
    ul = TRUE;
    fw.write("<li>C++ namespace : ");
    writeq(s);
    fw.write("</li>\n");
  }

  s = javaPackage();
  
  if (!s.isEmpty()) {
    if (! ul)
      fw.write("<p></p><ul>");
    ul = TRUE;
    fw.write("<li>Java package : ");
    writeq(s);
    fw.write("</li>\n");
  }
    
  if (ul)
    fw.write("</ul>\n");
    
  write_dependencies();
    
  UmlDiagram * d = associatedDiagram();
  
  if (d != 0) {
    fw.write("<p>Diagram : ");
    d->write();
    fw.write("</p>\n");
  }

  write_properties();

  write_children(pfix, rank, level);

  unload(FALSE, FALSE);
}
Ejemplo n.º 2
0
bool UmlAttribute::new_one(Class * container, Q3CString name,
			   aVisibility visibility, bool constp,
			   bool staticp, const Q3CString & value,
			   Q3CString comment, Q3CString description)
{
#ifdef TRACE
  cout << "ATTRIBUTE '" << name << "'\n";
#endif
  
#ifndef REVERSE
  if (visibility == PrivateVisibility)
    return TRUE;
#endif
  
  if (((const char *) name)[0] == '$')
    name = name.mid(1);
  
  UmlClass * cl = container->get_uml();
  UmlAttribute * at = UmlBaseAttribute::create(cl, name);
  
  if (at == 0) {
    PhpCatWindow::trace(Q3CString("<font face=helvetica><b>cannot add attribute <i>")
			 + name + "</i> in <i>" + cl->name() 
			 + "</i></b></font><br>");  
    return FALSE;
  }
#ifdef REVERSE
  Statistic::one_attribute_more();
#endif
  
  if (!comment.isEmpty()) {
    Q3CString s = (at->phpDecl().find("${description}") != -1)
      ? description : comment;
    UmlTypeSpec t;
    int index;
    
    if (! (t.explicit_type = value_of(s, "@var", index)).isEmpty()) {
      at->set_Type(t);
      s.replace(index, t.explicit_type.length(), "${type}");
    }
    
    at->set_Description(s);
    
  }
  
  if (constp)
    at->set_isReadOnly(TRUE);
  
  if (staticp)
    at->set_isClassMember(TRUE);
  
  if (! value.isEmpty())
    at->set_DefaultValue(value);
  
  at->set_Visibility(visibility);
  
  return TRUE;
}
Ejemplo n.º 3
0
void UmlClass::addAssign(bool cte)
{
    TRACE_FUNCTION;
    UmlOperation * op = UmlOperation::create(this, "operator=");

    if (op == 0)
        UmlCom::trace("can't add assignment contructor");
    else {
        // add 'source' parameter

        UmlParameter param;

        param.name = "source";
        param.dir = (cte) ? InputDirection : InputOutputDirection;
        param.type.type = this;

        op->addParameter(0, param);

        // set return type, add the parameter profile

        UmlTypeSpec t;

        t.type = this;

        op->set_ReturnType(t);

        Q3CString p = (cte) ? "const ${t0} & ${p0}" : "${t0} & ${p0}";
        Q3CString s;
        int index;

        s = op->cppDecl();

        if (s.isEmpty())
            s = CppSettings::operationDecl();

        if ((index = s.find("${(}")) != -1)
            s.insert(index + 4, (const char *)p); //[rageek] cast because Q3CString

        if ((index = s.find("${type}")) != -1)
            s.insert(index + 7, " &");

        op->set_CppDecl(s);

        s = op->cppDef();

        if (s.isEmpty())
            s = CppSettings::operationDef();

        if ((index = s.find("${(}")) != -1)
            s.insert(index + 4, (const char *)p); //[rageek] cast because Q3CString

        if ((index = s.find("${type}")) != -1)
            s.insert(index + 7, " &");

        op->set_CppDef(s);
    }
}
Ejemplo n.º 4
0
void UmlClass::importInstantiate(File & f) {
  if (scanning) {
    f.skipNextForm();
    return;
  }

  f.read("(");
  f.read("object");
  f.read("Instantiation_Relationship");

  Q3CString id;
  Q3CString ste;
  Q3CString doc;
  Q3Dict<Q3CString> prop;
  Q3CString s2;
  int k;
  
  do {
    k = f.readDefinitionBeginning(s2, id, ste, doc, prop);
  } while (id.isEmpty());
  
  for (;;) {
    if (k == ATOM) {
      if (s2 == "quidu")
	break;
      f.skipNextForm();
      k = f.read(s2);
    }
    else
      f.syntaxError(s2);
  }
  
  if (f.read(s2) != STRING)
    f.syntaxError(s2, "quidu value");
  
  UmlClass * target = (UmlClass *) findItem(s2, aClass);
  
  if (target != 0) {
    UmlRelation * r = UmlRelation::create(aRealization, this, target);
    
    if (r == 0)
      UmlCom::trace("<br>cannot create aRealization from '" +
		    fullName() + "' to '" + target->fullName() + "'");
    else {
      newItem(r, id);
      if (!ste.isEmpty())
	r->set_Stereotype(ste);
      if (!doc.isEmpty())
	r->set_Description(doc);
      r->setProperties(prop);
    }
  }
  
  f.skipBlock();
}
Ejemplo n.º 5
0
void UmlClass::addCopy(bool cte)
{
    TRACE_FUNCTION;
    UmlOperation * op = UmlOperation::create(this, name());

    if (op == 0)
        UmlCom::trace("can't add copy contructor");
    else {
        // to see that it is a copy constructor
        op->set_Stereotype("copy");

        // add 'source' parameter

        UmlParameter param;

        param.name = "source";
        param.dir = (cte) ? InputDirection : InputOutputDirection;
        param.type.type = this;

        op->addParameter(0, param);

        // add the parameter profile, and
        // remove the useless "${type} " mainly to remove the space

        Q3CString p = (cte) ? "const ${t0} & ${p0}" : "${t0} & ${p0}";
        Q3CString s;
        int index;

        s = op->cppDecl();

        if (s.isEmpty())
            s = CppSettings::operationDecl();

        if ((index = s.find("${(}")) != -1)
            s.insert(index + 4, (const char *)p); //[rageek] cast because Q3CString

        if ((index = s.find("${type} ")) != -1)
            s.remove(index, 8);

        op->set_CppDecl(s);

        s = op->cppDef();

        if (s.isEmpty())
            s = CppSettings::operationDef();

        if ((index = s.find("${(}")) != -1)
            s.insert(index + 4, (const char *)p); //[rageek] cast because Q3CString

        if ((index = s.find("${type} ")) != -1)
            s.remove(index, 8);

        op->set_CppDef(s);
    }
}
Ejemplo n.º 6
0
void UmlItem::write_description_properties(FileOut & out) {
  if (! description().isEmpty()) {
    static int rank = 0;
    
    out.indent();
    out << "<ownedComment xmi:type=\"uml:Comment\" xmi:id=\"COMMENT_"
      << ++rank << "\" body=\"";
    out.quote((const char*)description());//[jasa] ambiguous call
    out << "\"/>\n";
  }

  Q3CString ste = stereotype();
  
  if (_gen_extension) {
    const Q3Dict<Q3CString> up = properties();    
    Q3DictIterator<Q3CString> it(up);
    
    if (it.current()) {
      out.indent();
      out << "<xmi:Extension extender=\"Bouml\">\n";
      
      if (! ste.isEmpty()) {
	out.indent();
	out << "\t<stereotype name=\"";
	out.quote((const char*)ste);//[jasa] ambiguous call
	out << "\"/>\n";
      }
      
      do {
	out.indent();
	out << "\t<taggedValue tag=\"";
	out.quote((const char*)it.currentKey());//[jasa] ambiguous call
	out << "\" value=\"";
	out.quote((const char*)*(it.current()));//[jasa] ambiguous call
	out << "\"/>\n";
	++it;
      } while (it.current());
      
      out.indent();
      out << "</xmi:Extension>\n";
    }
    else if (! ste.isEmpty()) {
      out.indent();
      out << "<xmi:Extension extender=\"Bouml\"><stereotype name=\"";
      out.quote((const char*)ste);//[jasa] ambiguous call
      out << "\"/></xmi:Extension>\n";
    }
  } 
  
  if (ste.contains(':') == 1)
    // probably a stereotype part of profile
    _stereotypes[ste].append(this);
}
Ejemplo n.º 7
0
void UmlState::importActivity(FileIn & in, Token & token) {
  Q3CString k = token.what();
  const char * kstr = k;
  Q3CString b = token.valueOf("body");
  
  if (b.isEmpty()) {
    if (! token.closed()) {
      while (in.read(), !token.close(kstr)) {
	Q3CString s = token.what();
    
	if (s == "body") {
	  b = in.body("body");
	  in.finish(k);
	  break;
	}
	else if ((s == "node") &&
		 (token.xmiType() == "uml:CallOperationAction")) {
	  s = token.valueOf("operation");
	  if (! s.isEmpty()) {
	    if (k == "entry")
	      UnresolvedWithContext::add(this, s, 0);
	    else if (k == "exit")
	      UnresolvedWithContext::add(this, s, 1);
	    else
	      UnresolvedWithContext::add(this, s, 2);
	  }
	  if (! token.closed())
	    in.finish("node");
	  in.finish(k);
	  return;
	}
	else if (! token.closed())
	  in.finish(s);
      }
    }
  }
  else if (! token.closed())
    in.finish(k);
  
  if (! b.isEmpty()) {
    if (k == "entry")
      set_EntryBehavior(b);
    else if (k == "exit")
      set_ExitBehavior(b);
    else
      set_DoActivity(b);
  }

}
Ejemplo n.º 8
0
Q3CString Lex::read_list_elt()
{
  const char * p = _context.pointer;  
  int level = 1;
  Q3CString s;
  
  while (!((s = read_word(TRUE)).isEmpty())) {
    int c = *s;
    
    if ((c == '>') || (c == ')') || (c == ']')) {
      if (--level == 0)
	break;
    }
    else if (c == ',') {
      if (level == 1)
	break;
    }
    else if ((c == '<') || (c == '(') || (c == '['))
      level += 1;
  }
  
  if (! s.isEmpty())
    unread_word();
  
  char c = *_context.pointer;
  
  *_context.pointer = 0;
  s = p;  
  *_context.pointer = c;
  
  return s.stripWhiteSpace();
}
Ejemplo n.º 9
0
void UmlActivityAction::write_condition(FileOut & out, Q3CString cond, bool pre) {
  if (! cond.isEmpty()) {
    const char * k;
    const char * K;
    const char * body;
    
    if (pre) {
      k = "pre";
      K = "PRE_";
      body = "PRE_BODY_";
    }
    else {
      k = "post";
      K = "POST_";
      body = "POST_BODY_";
    }
    
    out.indent();
    out << '<' << k << "condition xmi:type=\"uml:Constraint\"";
    out.id_prefix(this, K);
    out << ">\n";
    out.indent();
    out << "\t<specification xmi:type=\"uml:OpaqueExpression\"";
    out.id_prefix(this, body);
    out << " body=\"";
    out.quote(cond);
    out << "\"/>\n";
    out.indent();
    out << "</" << k << "condition>\n";
  }
}
Ejemplo n.º 10
0
Q3CString UmlClass::decl() {      
  Q3CString result;
  Q3CString close_template;
  UmlArtifact * cp = associatedArtifact();
  Q3CString nasp = ((UmlPackage *)
		   ((cp != 0) ? (UmlItem *) cp : (UmlItem *) this)->package())
    ->cppNamespace();
    
  if (! nasp.isEmpty()) {
    int index = 
      // bypass :: allowing ::a...
      ((nasp.at(0) == ':') && (nasp != "::")) ? 2 : 0;
    int index2 = 0;
    
    while ((index2 = nasp.find("::", index)) != -1) {
      result += "namespace " + nasp.mid(index, index2 - index) + " { ";
      close_template += " } ";
      index = index2 + 2;
    }
    result += "namespace " + nasp.mid(index) + " { ";
    close_template += " } ";
  }
  
  Q3CString template1;
  Q3CString template2;
  
  get_template_prefixes(template1, template2);
  
  if (!template1.isEmpty())
    result += template1.left(template1.length() - 1) + ' ';
  
  result += cpp_stereotype() + ' ';
  
  return result + name() + ';' + close_template + '\n';
}
Ejemplo n.º 11
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";
            }
        }
    }
}
Ejemplo n.º 12
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);

}
Ejemplo n.º 13
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);

}
Ejemplo n.º 14
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);
}
Ejemplo n.º 15
0
void UmlItem::write_multiplicity(FileOut & out, Q3CString s, UmlItem * who)
{
  if (!s.isEmpty()) {
    Q3CString min;
    Q3CString 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 << "\"/>\n";
    
    out.indent();
    out << "<upperValue xmi:type=\"uml:LiteralString\"";
    out.id_prefix(who, "MULTIPLICITY_U_");
    out << " value=\"" << max << "\"/>\n";
  }
}
Ejemplo n.º 16
0
void tst_Q3CString::isEmpty()
{
    Q3CString a;
    QVERIFY(a.isEmpty());
    Q3CString c("Not empty");
    QVERIFY(!c.isEmpty());
}
Ejemplo n.º 17
0
void write_trace_header()
{
  if (!Verbose && !TraceHeader.isEmpty()) {
    UmlCom::trace("<hr>" + TraceHeader);
    TraceHeader = "";
  }
}
Ejemplo n.º 18
0
static void manage_decorators(QTextOStream & f, const Q3CString & decorators,
			      QString indent, BooL & indent_needed)
{
  if (! decorators.isEmpty()) {
    int index = 0;
    int index2;
    
    while ((index2 = decorators.find("\n", index)) != -1){
      if (indent_needed)
	f << indent;
      else
	indent_needed = TRUE;
      f << decorators.mid(index, index2 + 1 - index);
      index = index2 + 1;
    }
    
    if (index != (int) decorators.length()) {
      if (indent_needed) {
	f << indent;
	indent_needed = FALSE;
      }
      f << decorators.mid(index);
    }
  }
}
Ejemplo n.º 19
0
void UmlArtifact::genpro() {
  UmlPackage * pack = (UmlPackage *) parent()->parent();
  
  Q3CString path;

  if (! propertyValue("genpro path", path)) {

    path = pack->cppSrcDir();
  
    if (path.isEmpty())
      path = root_dir();
    else if (QDir::isRelativePath(path)) {
      QDir d(root_dir());
      
      d.cd(path);
      path = d.absPath();
    }
  }

  if (stereotype() == "executable") {
    gen_app(path);
  }
  else
    UmlCom::trace(stereotype() + " : not managed");
}
Ejemplo n.º 20
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";

}
Ejemplo n.º 21
0
void Trigger::add(FileIn & in, Token & token, Q3CString & name, Q3CString & idref)
{
  // token is <trigger ...>
  Q3CString t = token.xmiIdref();
  
  if (! t.isEmpty()) {
    QMap<Q3CString, Q3CString>::Iterator iter = All.find(t);
    
    if (iter == All.end()) {
      idref = t;
      name = "";
    }
    else {
      name = *iter;
      idref = "";
    }
  }
  else {
    name = token.valueOf("name");
    idref = "";
    All.insert(token.xmiId(), name);
  }

  if (! token.closed())
    in.finish(token.what());

}
Ejemplo n.º 22
0
void UmlUseCase::importIt(FileIn & in, Token & token, UmlItem * where)
{
  where = where->container(anUseCase, token, in);
    
  if (where != 0) {
    Q3CString s = token.valueOf("name");
    
    if (s.isEmpty()) {
      static unsigned n = 0;
      
      s.sprintf("anonymous_usecase_%u", ++n);
    }
    
    UmlUseCase * uc = create(where, s);
    
    if (uc == 0)
      in.error("cannot create use case '" + s +
	       "' in '" + where->name() + "'");
    
    uc->addItem(token.xmiId(), in);
    
    if (! token.closed()) {
      Q3CString k = token.what();
      const char * kstr = k;
      
      while (in.read(), !token.close(kstr))
	uc->UmlItem::import(in, token);
    }

    uc->unload(TRUE, FALSE);
  }
}
Ejemplo n.º 23
0
Archivo: Lex.cpp Proyecto: SciBoy/douml
// remove first and last line in comment if non significant
Q3CString Lex::simplify_comment(Q3CString & comment)
{
  if (comment.isEmpty())
    return comment;
  
  const char * s = comment;
  const char * p = s;
  
  for (;;) {
    switch (*p) {
    case 0:
      return comment;
    case ' ':
    case '\t':
      p += 1;
      break;
    case '\n':
      comment.remove(0, p - s + 1);
      
      if (comment.isEmpty())
	return comment;
      
      s = comment;
      // no break
    default:
      p = s + comment.length() - 1;

      while (p != s) {
	switch(*p) {
	case ' ':
	case '\t':
	  p -= 1;
	  break;
	case '\n':
	  comment.resize(p - s + 1);
	  // no break
	default:
	  return comment;
	}
      }
      
      if (*p == '\n')
	comment = "";
      return comment;
    }
  }
}
Ejemplo n.º 24
0
void UmlClass::addContructor(bool expl)
{
    TRACE_FUNCTION;
    QLOG_INFO() << "1.1.1";
    UmlOperation * op = UmlOperation::create(this, name());
    QLOG_INFO() << "1.1.2";
    if (op == 0)
        UmlCom::trace("can't add contructor");
    else {
        QLOG_INFO() << "1.1.3";
        Q3CString s;
        int index;

        // remove the useless "${type} " mainly to remove the space

        s = op->cppDecl();
        QLOG_INFO() << s;
        QLOG_INFO() << "1.1.4";
        if (s.isEmpty())
            s = CppSettings::operationDecl();
        QLOG_INFO() << s;
        QLOG_INFO() << "1.1.5";
        if ((index = s.find("${type} ")) != -1)
            s.remove(index, 8);
        QLOG_INFO() << s;
        QLOG_INFO() << "1.1.6";
        if (expl && ((index = s.find("${name}")) != -1))
            s.insert(index, "explicit ");
        QLOG_INFO() << s;
        QLOG_INFO() << "1.1.7";
        op->set_CppDecl(s);
        QLOG_INFO() << s;
        QLOG_INFO() << "1.1.8";
        s = op->cppDef();
        QLOG_INFO() << s;
        QLOG_INFO() << "1.1.81";
        if (s.isEmpty())
            s = CppSettings::operationDef();
        QLOG_INFO() << "1.1.9";
        if ((index = s.find("${type} ")) != -1)
            s.remove(index, 8);
        QLOG_INFO() << "1.1.10";
        op->set_CppDef(s);
    }
}
Ejemplo n.º 25
0
void UmlClass::importIdlConstant(UmlItem * parent, const Q3CString & id, const Q3CString & s, const Q3CString & doc, Q3Dict<Q3CString> & prop)
{
  // use a class to define the constant !
  UmlClass * x;

  if ((x = UmlClass::create(parent, legalName(s))) == 0) {
    UmlCom::trace("<br>cannot create class '" + s + "' in " +
		  parent->fullName());
    throw 0;
  }

  newItem(x, id);
  x->lang = Corba;
  x->set_Stereotype("constant");
  
  if (!doc.isEmpty())
    x->set_Description(doc);

  Q3CString type;
  Q3CString value;
  Q3CString * v;
  
  if ((v = prop.find("CORBA/ImplementationType")) != 0) {
    type = *v;
    prop.remove("CORBA/ImplementationType");
  }

  if ((v = prop.find("CORBA/ConstValue")) != 0) {
    if (!v->isEmpty())
      value = " = " + *v;
    prop.remove("CORBA/ConstValue");
  }

  Q3CString d = IdlSettings::constDecl();
  int index;
  
  if ((index = d.find("${type}")) != -1)
    d.replace(index, 7, type);
    
  if ((index = d.find("${value}")) != -1)
    d.replace(index, 8, value);
  
  x->setProperties(prop);
  x->set_IdlDecl(d);
}
Ejemplo n.º 26
0
void UmlUseCase::import(File & f, UmlItem * parent)
{
    Q3CString s;

    if (f.read(s) != STRING)
        f.syntaxError(s, "use case's name");

    Q3CString id;
    Q3CString ste;
    Q3CString doc;
    Q3Dict<Q3CString> prop;
    Q3CString s2;
    int k;

    do {
        k = f.readDefinitionBeginning(s2, id, ste, doc, prop);
    }
    while (id.isEmpty());

    UmlUseCase * x;

    if (UmlItem::scanning) {
        if ((x = UmlBaseUseCase::create(parent, s)) == 0) {
            UmlCom::trace("<br>cannot create use case '" + s + "' in " +
                          parent->fullName());
            throw 0;
        }

        newItem(x, id);

        if (!doc.isEmpty())
            x->set_Description(doc);

        x->setProperties(prop);
    }
    else if ((x = (UmlUseCase *) findItem(id, anUseCase)) == 0) {
        UmlCom::trace("<br>unknown use case '" + s + "' in " +
                      parent->fullName());
        throw 0;
    }

    f.unread(k, s2);
    x->Uc::import(f);
}
Ejemplo n.º 27
0
unsigned UmlSettings::multiplicity_column(const Q3CString & mult)
{
  if (mult.isEmpty() || (mult == "1"))
    return 0;

  if ((mult == "*") || (mult.find("..") != -1))
    return 1;

  return 2;
}
Ejemplo n.º 28
0
void UmlItem::manage_docstring(const char *& p, const char *& pp, BooL & indent_needed,
			       Q3CString & indent, Q3CString & saved_indent)
{
  static Q3CString the_comment;
  
  p += 12;
  
  the_comment = description();
  
  if ((pp != 0) || // comment contains ${description} !
      the_comment.isEmpty())
    return;
    
  int index = 0;
  
  while ((index = the_comment.find("\"\"\"", index)) != -1) {
    the_comment.insert(index, "\\");
    index += 2;
  }
  
  if (!indent.isEmpty()) {
    int len = indent.length() + 1;
    
    index = 0;
    
    while ((index = the_comment.find('\n', index)) != -1) {
      the_comment.insert(index + 1, (const char*)indent);
      index += len;
    }
  }
  
  the_comment = "\"\"\"" + the_comment + "\"\"\"\n";
  
  if (indent_needed) {
    indent_needed = FALSE;
    the_comment = indent + the_comment;
  }

  pp = p;
  p = the_comment;
  saved_indent =  indent;
  indent = "";
}
Ejemplo n.º 29
0
Archivo: Lex.cpp Proyecto: SciBoy/douml
Q3CString Lex::get_description(Q3CString & co) 
{
  Q3CString result = Q3CString(context.description.toAscii().constData());
  
  context.description = QString::null;
  
  return (co.isEmpty())
    ? result
    : co += "\n" + result;
}
Ejemplo n.º 30
0
Archivo: Lex.cpp Proyecto: SciBoy/douml
Q3CString Lex::get_comments(Q3CString & co) 
{
  Q3CString result = Q3CString(context.comments.toAscii().constData());
  
  context.comments = QString::null;
  
  return (co.isEmpty())
    ? result
    : co += "\n" + result;
}