コード例 #1
0
ファイル: UmlPackage.cpp プロジェクト: bleakxanadu/douml
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);

}
コード例 #2
0
ファイル: UmlClass.cpp プロジェクト: daniel7solis/douml
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);
    }
}
コード例 #3
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");

}
コード例 #4
0
ファイル: Manifestation.cpp プロジェクト: bleakxanadu/douml
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));
}
コード例 #5
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);
    }
  }
}
コード例 #6
0
void UmlActivityObject::setOrdering(QCString s, FileIn & in) {
 if (s == "unordered")
   set_Ordering(unordered);
 else if (s == "ordered")
   set_Ordering(ordered);
 else if (s == "LIFO")
   set_Ordering(lifo);
 else if (s == "FIFO")
   set_Ordering(fifo);
 else if (! s.isEmpty())
   in.warning("wrong ordering '" + s + "'");
}
コード例 #7
0
void UmlActivityParameter::setEffect(QCString s, FileIn & in) {
  if (s == "create")
    set_Effect(createEffect);
  else if (s == "read")
    set_Effect(readEffect);
  else if (s == "update")
    set_Effect(updateEffect);
  else if (s == "delete")
    set_Effect(deleteEffect);
  else
    in.warning("illegal effect '" + s + "'");
}
コード例 #8
0
ファイル: UmlItem.cpp プロジェクト: daniel7solis/douml
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);
    }
}
コード例 #9
0
ファイル: UmlItem.cpp プロジェクト: daniel7solis/douml
void UmlItem::importGeneralization(FileIn & in, Token & token, UmlItem * where)
{
    WrapperStr id = token.valueOf("general");
    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 == "general") {
                id = token.xmiIdref();

                if (id.isEmpty() && !(id = token.valueOf("href")).isEmpty()) {
                    int index = id.find('#');

                    if (index != -1)
                        id = id.mid(index + 1);
                }
            }
            else if (s == "ownedrule") {
                constraint = UmlItem::readConstraint(in, token);
                continue;
            }

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

    if (!id.isEmpty()) {
        QMap<QString, UmlItem *>::ConstIterator iter = All.find(id);

        if (iter != All.end())
            where->generalizeDependRealize(*iter, in, 0, "", constraint);
        else
            Unresolved::addGeneralization(where, id, constraint);
    }
    else
        in.warning("'general' is missing");
}
コード例 #10
0
ファイル: UmlUseCase.cpp プロジェクト: SciBoy/douml
void UmlUseCase::importExtendInclude(FileIn & in, Token & token, UmlItem * where)
{
  if (where->kind() == anUseCase) {
    bool extend = (token.what() == "extend");
    Q3CString other = token.valueOf((extend) ? "extendedcase" : "addition");
    
    if (other.isEmpty())
      in.warning((extend) ? "extendedCase is missing" : "addition is missing");
    else {
      QMap<Q3CString, UmlItem *>::Iterator it = All.find(other);
      
      if (it != All.end())
	where->solve(extend, other);
      else
	UnresolvedWithContext::add(where, other, extend);
    }
  }

  if (! token.closed())
    in.finish(token.what());
}
コード例 #11
0
void ClassInstance::importIt(FileIn & in, Token & token, UmlItem * where)
{
  where = where->container(aClassInstance, token, in);	// can't be null
  
  ClassInstance * cli = new ClassInstance;

  cli->id = token.xmiId();
  cli->name = token.valueOf("name");
  cli->classifierId = token.valueOf("classifier");
  cli->where = where;
    
  if (! token.closed()) {
    QCString k = token.what();
    const char * kstr = k;
    
    while (in.read(), !token.close(kstr)) {
      QCString s = token.what();
      
      if (s == "classifier")
	cli->classifierId = token.xmiIdref();
      else if (s == "slot") {
	cli->bindings.append(Slot());
	
	cli->bindings.last().importIt(in, token);
      }
      else if (! token.closed())
	in.finish(s);
    }
  }

  if (cli->classifierId.isEmpty()) {
    in.warning("classifier missing for class instance '" + cli->id + "', bypass it");
    delete cli;
  }
  else
    All.append(cli);

}
コード例 #12
0
ファイル: UmlPackage.cpp プロジェクト: bleakxanadu/douml
void UmlPackage::importIt(FileIn & in, Token & token, UmlItem * where)
{
    while (where->kind() != aPackage)
        where = where->parent();

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

    if (s.isEmpty()) {
        static unsigned n = 0;

        s.sprintf("anonymous %u", ++n);
    }

    UmlPackage * pack = create((UmlPackage *) where, s);

    if (pack == 0)
        in.error("cannot create package '" + s + "' in '" + where->name() + "'");

    bool profile =
        (token.what() == "uml:profile") || (token.xmiType() == "uml:Profile");

    if (profile) {
        pack->set_Stereotype("profile");
        pack->set_PropertyValue("xmiId", token.xmiId());
        NumberOf -= 1;
        NumberOfProfile += 1;

        if (!(s = token.valueOf("metamodelreference")).isEmpty())
            pack->set_PropertyValue("metamodelReference", s);

        if (!(s = token.valueOf("metaclassreference")).isEmpty())
            pack->set_PropertyValue("metaclassReference", s);
    }

    s = token.xmiId();

    if (!s.isEmpty()) {
        pack->addItem(s, in);

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

            if (profile) {
                while (in.read(), !token.close(kstr)) {
                    if ((token.what() == "packagedelement") &&
                        (token.xmiType() == "uml:Extension")) {
                        if (! token.closed())
                            in.finish(token.what());
                    }
                    else if (token.what() == "packageimport")
                        pack->packageImport(in, token);
                    else
                        pack->UmlItem::import(in, token);
                }

                updateProfiles();
            }
            else
                while (in.read(), !token.close(kstr))
                    pack->UmlItem::import(in, token);
        }
    }
    else if (! token.valueOf("href", s))
        in.error("xmi:id is missing"); // doesn't return
    else {
        in.warning("bypass external package " + s);

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

    pack->unload(TRUE, FALSE);
}