void UmlOpaqueAction::importIt(FileIn & in, Token & token, UmlItem * where)
{
    where = where->container(anOpaqueAction, token, in);

    if (where != 0) {
        WrapperStr s = token.valueOf("name");
        UmlOpaqueAction * a = create(where, s);

        if (a == 0)
            in.error("cannot create opaque action '"
                     + s + "' in '" + where->name() + "'");

        a->addItem(token.xmiId(), in);

        if (! token.closed()) {
            WrapperStr k = token.what();
            const char * kstr = k;

            while (in.read(), !token.close(kstr)) {
                if (token.what() == "body")
                    a->set_Behavior(in.body("body"));
                else
                    a->import(in, token);
            }
        }
    }
}
Пример #2
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);
  }
}
void UmlAccessVariableValueAction::import_it(FileIn & in, Token & token)
{
    WrapperStr s = token.valueOf("variable");

    if (! s.isEmpty())
        setVariable(s);

    if (! token.closed()) {
        WrapperStr k = token.what();
        const char * kstr = k;

        while (in.read(), !token.close(kstr)) {
            s = token.what();

            if (s == "variable") {
                setVariable(token.xmiIdref());

                if (! token.closed())
                    in.finish("variable");
            }
            else
                import(in, token);
        }
    }
}
Пример #4
0
void UmlCallBehaviorAction::importIt(FileIn & in, Token & token, UmlItem * where)
{
  where = where->container(aCallBehaviorAction, token, in);
    
  if (where != 0) {
    Q3CString s = token.valueOf("name");
    UmlCallBehaviorAction * a = create(where, s);
    
    if (a == 0)
      in.error("cannot create call behavior action '"
	       + s + "' in '" + where->name() + "'");
    
    a->addItem(token.xmiId(), in);
    
    if (!(s=token.valueOf("behavior")).isEmpty())
      a->setBehavior(s);
    
    if (! token.closed()) {
      Q3CString k = token.what();
      const char * kstr = k;
      
      while (in.read(), !token.close(kstr)) {
	s = token.what();
	
	if (s == "behavior") {
	  a->setBehavior(token.xmiIdref());
	  if (! token.closed())
	    in.finish("behavior");
	}
	else
	  a->import(in, token);
      }
    }
  }
}
Пример #5
0
WrapperStr UmlItem::readComment(FileIn & in, Token & token)
{
    in.bypassedId(token);

    WrapperStr doc = token.valueOf("body");

    if (! token.closed()) {
        WrapperStr k = token.what();
        const char * kstr = k;

        while (in.read(), !token.close(kstr)) {
            if (token.what() == "body") {
                if (! doc.isEmpty())
                    doc += "\n";

                doc += in.body("body");
            }
            else if (! token.closed())
                in.finish(token.what());
        }
    }

    return doc;

}
Пример #6
0
void Manifestation::import(FileIn & in, Token & token, UmlArtifact * artifact)
{
    WrapperStr s;
    WrapperStr name;
    WrapperStr utilized;

    name = token.valueOf("name");

    if (!(s = token.valueOf("utilizedelement")).isEmpty())
        utilized = s;
    else if (!(s = token.valueOf("client")).isEmpty())
        utilized = s;

    if (! token.closed()) {
        WrapperStr k = token.what();
        const char * kstr = k;

        while (in.read(), !token.close(kstr)) {
            s = token.what();

            if (s == "utilizedelement")
                utilized = token.xmiIdref();
            else if ((s == "client") && s.isEmpty())
                utilized = token.xmiIdref();

            if (! token.closed())
                in.finish(s);
        }
    }

    if (utilized.isEmpty())
        in.warning("'utilizedElement' and 'client' missing in Manifestation");
    else
        All.append(Manifestation(name, artifact, utilized));
}
Пример #7
0
WrapperStr UmlItem::readConstraint(FileIn & in, Token & token)
{
    WrapperStr constraint;

    if (! token.closed()) {
        WrapperStr k = token.what();
        const char * kstr = k;

        while (in.read(), !token.close(kstr)) {
            WrapperStr s = token.what();

            if ((s == "specification") && (token.xmiType() == "uml:OpaqueExpression")) {
                constraint = token.valueOf("body");

                if (! token.closed()) {
                    while (in.read(), !token.close("specification")) {
                        s = token.what();

                        if (s == "body")
                            constraint = in.body("body");
                        else if (! token.closed())
                            in.finish(s);
                    }
                }
            }
            else
                in.bypass(token);
        }
    }

    return constraint;
}
Пример #8
0
void UmlItem::importOpaqueDef(FileIn & in, Token & token, UmlItem *)
{
    WrapperStr id = token.xmiId();
    QMap<QString, WrapperStr>::ConstIterator iter = OpaqueDefs.find(id);

    if (iter != OpaqueDefs.end())
        in.error("xmi:id '" + id + "' used twice");

    WrapperStr s = token.valueOf("body");

    if (!s.isNull()) {
        OpaqueDefs.insert(id, s);

        if (! token.closed())
            in.finish(token.what());
    }
    else if (! token.closed()) {
        WrapperStr k = token.what();
        const char * kstr = k;

        while (in.read(), !token.close(kstr)) {
            s = token.what();

            if (s == "body")
                OpaqueDefs.insert(id, in.body("body"));
            else if (! token.closed())
                in.finish(s);
        }
    }
}
Пример #9
0
void UmlActivity::readCondition(FileIn & in, Token & token)
{
    if (! token.closed()) {
        WrapperStr k = token.what();
        const char * kstr = k;

        while (in.read(), !token.close(kstr)) {
            WrapperStr s = token.what();

            if (s == "specification") {
                WrapperStr v = token.valueOf("body");

                if (v.isNull())
                    v = token.valueOf("value");	// UMODEL

                if (! v.isEmpty()) {
                    if (k[1] == 'r')
                        set_PreCondition(v);
                    else
                        set_PostCondition(v);
                }
            }

            if (! token.closed())
                in.finish(s);
        }
    }
}
Пример #10
0
void ClassInstance::Slot::importIt(FileIn & in, Token & token) {
  featureId = token.valueOf("definingfeature");
  valueId = token.valueOf("value");
    
  if (! token.closed()) {
    QCString k = token.what();
    const char * kstr = k;
    
    while (in.read(), !token.close(kstr)) {
      QCString s = token.what();
      
      if (s == "featureid")
	featureId = token.xmiIdref();
      else if (s == "value") {
	value = token.valueOf("value");
	if (value.isEmpty())
	  value = token.valueOf("body");
      }
      
      if (! token.closed())
	in.finish(s);
    }
  }

  if (featureId.isEmpty())
    in.warning("'definingFeature' is missing");

}
Пример #11
0
// Загружает INI-структуру из файла. При возникновении ошибки возвращает false
// file - файл для загрузки
bool IniFile::Load(const String& file, int charset)
{
    FileIn in;
    if (!in.Open(file)) return false;
    bool r = Load(in, charset);
    in.Close();
    return r;
}
Пример #12
0
void UmlActivityObject::import_it(FileIn & in, Token & token)
{
    if (token.valueOf("iscontroltype") == "true")
        set_IsControlType(TRUE);

    WrapperStr s;

    if (!(s = token.valueOf("ordering")).isEmpty())
        setOrdering(s, in);

    if (!(s = token.valueOf("selection")).isEmpty())
        setSelection(s);

    if (!(s = token.valueOf("instate")).isEmpty())
        setInState(s);

    if (!(s = token.valueOf("type")).isEmpty())
        setType(s);

    if (! token.closed()) {
        WrapperStr k = token.what();
        const char * kstr = k;

        while (in.read(), !token.close(kstr)) {
            s = token.what();

            if (s == "selection") {
                setSelection(token.xmiIdref());

                if (! token.closed())
                    in.finish(s);
            }
            else if (s == "instate") {
                setInState(token.xmiIdref());

                if (! token.closed())
                    in.finish(s);
            }
            else if (s == "type") {
                setType(token);

                if (! token.closed())
                    in.finish(s);
            }
            else if (s == "lowervalue")
                importMultiplicity(in, token, FALSE);
            else if (s == "uppervalue")
                importMultiplicity(in, token, TRUE);
            else if (s == "upperbound") {
                if (! token.closed())
                    in.finish(s);
            }
            else
                UmlItem::import(in, token);
        }
    }
}
Пример #13
0
void UmlActivityParameter::readParameter(FileIn & in, Token & token) {
  QCString s;

  s = token.valueOf("direction");
  if ((s == "in") || (s == "pk_in"))
    set_Direction(InputDirection);
  else if ((s == "out") || (s == "pk_out"))
    set_Direction(OutputDirection);
  else if ((s == "inout") || (s == "pk_inout"))
    set_Direction(InputOutputDirection);
  else if ((s == "return") || (s == "pk_return"))
    set_Direction(ReturnDirection);
  else if (! s.isEmpty())
    in.warning("wrong direction");

  if (!(s = token.valueOf("effect")).isEmpty())
    setEffect(s, in);
  if (token.valueOf("isunique") == "true")
    set_IsUnique(TRUE);
  if (token.valueOf("isexception") == "true")
    set_IsException(TRUE);
  if (token.valueOf("isstream") == "true")
    set_IsStream(TRUE);
  if (!(s = token.valueOf("type")).isEmpty())
    setType(s);

  if (!token.closed()) {
    QCString k = token.what();
    const char * kstr = k;
      
    while (in.read(), !token.close(kstr)) {
      s = token.what();
	
      if (s == "type") {
	setType(token);
	if (! token.closed())
	  in.finish(s);
      }
      else if (s == "lowervalue")
	importMultiplicity(in, token, FALSE);
      else if (s == "uppervalue")
	importMultiplicity(in, token, TRUE);
      else if (s == "defaultvalue") {
	set_DefaultValue(token.valueOf("value"));
	if (! token.closed())
	  in.finish(s);
      }
      else if (s == "upperbound") {
	if (! token.closed())
	  in.finish(s);
      }
      else
	UmlItem::import(in, token);
    }
  }
}
Пример #14
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);

}
void UmlReduceAction::importIt(FileIn & in, Token & token, UmlItem * where)
{
    where = where->container(aReduceAction, token, in);

    if (where != 0) {
        WrapperStr s = token.valueOf("name");
        UmlReduceAction * a = create(where, s);

        if (a == 0)
            in.error("cannot create reduce action '"
                     + s + "' in '" + where->name() + "'");

        a->addItem(token.xmiId(), in);

        if (token.valueOf("isordered") == "true")
            a->set_isOrdered(TRUE);

        s = token.valueOf("reducer");

        if (! token.closed()) {
            WrapperStr k = token.what();
            const char * kstr = k;

            while (in.read(), !token.close(kstr)) {
                if (token.what() == "reducer") {
                    s = token.xmiIdref();

                    if (! token.closed())
                        in.finish(token.what());
                }
                else
                    a->import(in, token);
            }
        }

        if (!s.isEmpty()) {
            QMap<QString, UmlItem *>::Iterator it = All.find(s);

            if (it == All.end())
                Unresolved::addRef(a, s);
            else {
                switch ((*it)->kind()) {
                case anActivity:
                case aState:
                    a->set_Reducer(*it);
                    break;

                default:
                    break;
                }
            }
        }
    }
}
Пример #16
0
void UmlClass::readFormal(FileIn & in, Token & token)
{
    if (! token.closed()) {
        signatures[token.xmiId()] = this;

        WrapperStr k = token.what();
        const char * kstr = k;
        unsigned int rank = 0;

        while (in.read(), !token.close(kstr)) {
            WrapperStr s = token.what();

            if (s == "parameter") {
                // useless
                if (! token.closed())
                    in.finish(token.what());
            }
            else if ((s == "ownedparameter") &&
                     (token.xmiType() == "uml:ClassifierTemplateParameter")) {
                WrapperStr idparam = token.xmiId();
                WrapperStr pname = token.valueOf("name");	// at least for VP
                WrapperStr value;

                if (! token.closed()) {
                    while (in.read(), !token.close("ownedparameter")) {
                        s = token.what();

                        if ((s == "ownedparameteredelement") ||
                            (s == "ownedelement")) {
                            s = token.valueOf("name");

                            if (! s.isEmpty())
                                pname = s;
                        }
                        else if (s == "defaultvalue")
                            value = token.valueOf("value");

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

                if (! pname.isEmpty()) {
                    UmlFormalParameter f(pname, value);

                    addFormal(rank++, f);
                    formalsId.append(idparam);
                }
            }
            else if (! token.closed())
                in.finish(token.what());
        }
    }
}
Пример #17
0
void UmlItem::importExtension(FileIn & in, Token & token, UmlItem * where)
{
    if (! token.closed()) {
        WrapperStr s = token.valueOf("extender");

        if (s.isNull())
            s = token.valueOf("xmi:extender");

        if (s == "Bouml") {
            WrapperStr k = token.what();
            const char * kstr = k;

            while (in.read(), !token.close(kstr)) {
                s = token.what();

                if (s == "taggedvalue")
                    // is closed
                    where->set_PropertyValue(token.valueOf("tag"), token.valueOf("value"));
                else if (s == "stereotype")
                    where->set_Stereotype(token.valueOf("name"));

                if (! token.closed())
                    in.finish(token.what());
            }
        }
        else if (s == "Visual Paradigm for UML") {
            WrapperStr k = token.what();
            const char * kstr = k;

            while (in.read(), !token.close(kstr)) {
                s = token.what();

                if (s == "appliedstereotype") {
                    s = token.valueOf("xmi:value");

                    if (s.right(3) == "_id") {
                        s = s.mid(s.find("_") + 1);
                        s = s.left(s.length() - 3).lower();
                    }

                    where->set_Stereotype(s);
                }

                if (! token.closed())
                    in.finish(token.what());
            }
        }
        else
            in.finish(token.what());
    }
}
Пример #18
0
void LoadProp(FileIn& in, VectorMap<String, String>& prop)
{
	while(!in.IsEof()) {
		String ln = in.GetLine();
		CParser p(ln);
		if(p.Char(';'))
			break;
		if(p.IsId()) {
			String& d = prop.GetAdd(p.ReadId());
			p.SkipSpaces();
			d = p.GetPtr();
		}
	}
}
Пример #19
0
void PatchDiff::Copy(FileIn& in, FileIn& oin, int& l, int ln, int n)
{
	if(ln < l)
		throw CParser::Error("");
	while(l < ln) {
		if(oin.IsEof())
			throw CParser::Error("");
		extfile << oin.GetLine() << "\r\n";
		l++;
	}
	l += n;
	while(n--)
		oin.GetLine();
}
void UmlAcceptCallAction::importIt(FileIn & in, Token & token, UmlItem * where)
{
    where = where->container(anAcceptCallAction, token, in);

    if (where != 0) {
        WrapperStr s = token.valueOf("name");
        UmlAcceptCallAction * a = create(where, s);

        if (a == 0)
            in.error("cannot create accept call action '"
                     + s + "' in '" + where->name() + "'");

        a->addItem(token.xmiId(), in);

        if (!(s = token.valueOf("trigger")).isEmpty()) {
            WrapperStr tr = Trigger::get(s);

            if (!tr.isNull())
                a->set_Trigger(tr);
            else
                Unresolved::addRef(a, s);
        }

        if (! token.closed()) {
            WrapperStr k = token.what();
            const char * kstr = k;

            while (in.read(), !token.close(kstr)) {
                if (token.what() == "trigger") {
                    WrapperStr tr_name;
                    WrapperStr tr_ref;

                    Trigger::add(in, token, tr_name, tr_ref);

                    if (!tr_name.isNull())
                        a->set_Trigger(tr_name);
                    else
                        Unresolved::addRef(a, tr_ref);
                }
                else if (token.what() == "isunmarshall") {
                    // not memorized : always true
                    if (! token.closed())
                        in.finish(token.what());
                }
                else
                    a->import(in, token);
            }
        }
    }
}
Пример #21
0
void UmlActivityPartition::importIt(FileIn & in, Token & token, UmlItem * where)
{
  where = where->container(aPartition, token, in);
    
  if (where != 0) {
    Q3CString s = token.valueOf("name");
    UmlActivityPartition * r = create(where, s);
    
    if (r == 0)
      in.error("cannot create activity partition '"
	       + s + "' in '" + where->name() + "'");
    
    r->addItem(token.xmiId(), in);
    
    if (token.valueOf("isdimension") == "true")
      r->set_isDimension(TRUE);
    
    if (token.valueOf("isexternal") == "true")
      r->set_isExternal(TRUE);
    
    Q3CString idref = token.valueOf("represents");
  
    if (! token.closed()) {
      Q3CString k = token.what();
      const char * kstr = k;
      
      while (in.read(), !token.close(kstr)) {
	s = token.what();
	
	if (s == "variable") {
	  idref = token.xmiIdref();
	  if (! token.closed())
	    in.finish("variable");
	}
	else
	  r->UmlItem::import(in, token);
      }
    }
    
    if (! idref.isEmpty()) {
      QMap<Q3CString, UmlItem *>::Iterator it = All.find(idref);
      
      if (it == All.end())
	Unresolved::addRef(r, idref);
      else
	r->set_Represents(*it);
    }
  }
}
Пример #22
0
void UmlAcceptEventAction::importIt(FileIn & in, Token & token, UmlItem * where)
{
  where = where->container(anAcceptEventAction, token, in);
    
  if (where != 0) {
    Q3CString s = token.valueOf("name");
    UmlAcceptEventAction * a = create(where, s);
    
    if (a == 0)
      in.error("cannot create accept event action '"
	       + s + "' in '" + where->name() + "'");
    
    a->addItem(token.xmiId(), in);
    
    if (token.valueOf("isunmarshall") == "true")
      a->set_isUnmarshall(TRUE);
    
    if (!(s = token.valueOf("trigger")).isEmpty()) {
      Q3CString tr = Trigger::get(s);
      
      if (!tr.isNull())
	a->set_Trigger(tr);
      else
	Unresolved::addRef(a, s);
    }
    
    if (! token.closed()) {
      Q3CString k = token.what();
      const char * kstr = k;
      
      while (in.read(), !token.close(kstr)) {
	if (token.what() == "trigger") {
	  Q3CString tr_name;
	  Q3CString tr_ref;
	  
	  Trigger::add(in, token, tr_name, tr_ref);
      
	  if (!tr_name.isNull())
	    a->set_Trigger(tr_name);
	  else
	    Unresolved::addRef(a, tr_ref);
	}
	else
	  a->import(in, token);
      }
    }
  }
}
Пример #23
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);
    }
}
Пример #24
0
void UmlComponent::manageInterface(Token & token, FileIn & in) {
  QCString idref = token.valueOf("supplier");
  
  QMap<QCString, UmlItem *>::Iterator it = All.find(idref);
  int c = ((const char *) token.what())[0];
  
  if (it != All.end()) {
    if ((*it)->kind() == aClass) {
      if (c == 'i') {
	// provided
	QVector<UmlClass> provided = providedClasses();
	unsigned sz = provided.size();
	
	provided.resize(sz + 1);
	provided.insert(sz, (UmlClass *) *it);
	set_AssociatedClasses(realizingClasses(), provided, requiredClasses());
      }
      else {
	// realization
	QVector<UmlClass> realizing = realizingClasses();
	unsigned sz = realizing.size();
	
	realizing.resize(sz + 1);
	realizing.insert(sz, (UmlClass *) *it);
	set_AssociatedClasses(realizing, providedClasses(), requiredClasses());
      }
    }
  }
  else
    UnresolvedWithContext::add(this, idref, c);
    
  if (! token.closed())
    in.finish(token.what());
}
Пример #25
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());

}
Пример #26
0
void Trigger::importIt(FileIn & in, Token & token, UmlItem *)
{
  All.insert(token.xmiId(), token.valueOf("name"));
      
  if (! token.closed())
    in.finish(token.what());
}
Пример #27
0
void UmlActivity::readParameterNode(FileIn & in, Token & token)
{
    // the parameter node may already exist because of a
    // ActivityParameter definition, search for it
    UmlActivityParameter * param = 0;
    WrapperStr s = token.valueOf("name");
    const Q3PtrVector<UmlItem> ch = children();
    unsigned int n = ch.size();
    int i;

    for (i = 0; i != (int) n; i += 1) {
        UmlActivityParameter * p = dynamic_cast<UmlActivityParameter *>(ch[i]);

        if ((p != 0) && (p->name() == s)) {
            param = p;
            break;
        }
    }

    if (param == 0) {
        param = UmlActivityParameter::create(this, s);

        if (param == 0)
            in.error("cannot create activity parameter node '"
                     + s + "' in '" + name() + "'");

        param->addItem(token.xmiId(), in);
    }

    param->readParameterNode(in, token);

}
Пример #28
0
void UmlItem::incoming(FileIn & in, Token & token, UmlItem * where)
{
    Incomings.insert(token.xmiIdref(), where);

    if (! token.closed())
        in.finish(token.what());
}
Пример #29
0
void UmlActivityObject::importIt(FileIn & in, Token & token, UmlItem * where)
{
  where = where->container(anActivityObject, token, in);
    
  if (where != 0) {
    QCString s = token.valueOf("name");
    UmlActivityObject * a = create(where, s);
    
    if (a == 0)
      in.error("cannot create activity object '"
	       + s + "' in '" + where->name() + "'");
    
    a->addItem(token.xmiId(), in);
    
    QCString ste;
    
    s = token.xmiType();
    switch (((const char *) s)[0]) {
    case 'D':
      ste = "datastore";
      break;
    case 'C':
      ste = "centralBuffer";
      break;
    default:
      break;
    }
    
    a->import_it(in, token);
    
    if (! ste.isNull())
      a->set_Stereotype(ste);
  }

}
Пример #30
0
void UmlItem::importDependency(FileIn & in, Token & token, UmlItem * where)
{
    WrapperStr client = token.valueOf("client");
    WrapperStr supplier = token.valueOf("supplier");
    WrapperStr label = token.valueOf("name");
    WrapperStr constraint;
    int kind = (token.xmiType() == "uml:Usage") ? 3 : 1;

    if (! token.closed()) {
        WrapperStr k = token.what();
        const char * kstr = k;

        while (in.read(), !token.close(kstr)) {
            WrapperStr s = token.what();

            if (s == "client")
                client = token.xmiIdref();
            else if (s == "supplier")
                supplier = token.xmiIdref();
            else if (s == "ownedrule") {
                constraint = UmlItem::readConstraint(in, token);
                continue;
            }

            if (! token.closed())
                in.finish(s);
        }
    }

    if (client.isEmpty())
        in.warning("'client' is missing");
    else {
        if (supplier.isEmpty())
            // Borland Together 2006 for Eclipse
            supplier = where->id();

        QMap<QString, UmlItem *>::ConstIterator from = All.find(client);
        QMap<QString, UmlItem *>::ConstIterator to = All.find(supplier);

        if ((from != All.end()) && (to != All.end()))
            (*from)->generalizeDependRealize(*to, in, kind, label, constraint);
        else
            UnresolvedRelation::add(kind, client, supplier, label, constraint);
    }
}