• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ UmlItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中UmlItem的典型用法代码示例。如果您正苦于以下问题:C++ UmlItem类的具体用法?C++ UmlItem怎么用?C++ UmlItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了UmlItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: search_rel

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;
    }
}
开发者ID:jeremysalwen,项目名称:douml,代码行数:35,代码来源:UmlRelation.cpp


示例2: search_attr

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;
}
开发者ID:ErickCastellanos,项目名称:douml,代码行数:32,代码来源:UmlAttribute.cpp


示例3: switch

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);
	}
      }
    }
  }
}
开发者ID:SciBoy,项目名称:douml,代码行数:28,代码来源:UmlRelation.cpp


示例4: sort

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

}
开发者ID:gilbertoca,项目名称:douml,代码行数:30,代码来源:UmlOperation.cpp


示例5: associatedArtifact

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);
  }
}
开发者ID:,项目名称:,代码行数:29,代码来源:


示例6: generalizeDependRealize

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);
    }
}
开发者ID:daniel7solis,项目名称:douml,代码行数:29,代码来源:UmlClass.cpp


示例7: add_init

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);
}
开发者ID:ErickCastellanos,项目名称:douml,代码行数:32,代码来源:UmlExtraClassMember.cpp


示例8: parent

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;
}
开发者ID:daniel7solis,项目名称:douml,代码行数:33,代码来源:UmlClass.cpp


示例9: key_

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);
}
开发者ID:javrillon,项目名称:douml,代码行数:33,代码来源:UmlItem.cpp


示例10: it

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;
}
开发者ID:ErickCastellanos,项目名称:douml,代码行数:28,代码来源:UmlClass.cpp


示例11: key

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++;
}
开发者ID:SciBoy,项目名称:douml,代码行数:35,代码来源:UmlItem.cpp


示例12: if

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;
}
开发者ID:SciBoy,项目名称:douml,代码行数:29,代码来源:UmlAttribute.cpp


示例13: while

UmlPackage * UmlArtifact::package() {
  UmlItem * parent = this->parent();
  
  while (parent->kind() != aPackage)
    parent = parent->parent();
  
  return (UmlPackage *) parent;
}
开发者ID:SciBoy,项目名称:douml,代码行数:8,代码来源:UmlArtifact.cpp


示例14: main

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;
}
开发者ID:,项目名称:,代码行数:56,代码来源:


示例15: write_stereotyped

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

}
开发者ID:vresnev,项目名称:douml,代码行数:55,代码来源:UmlItem.cpp


示例16: if

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);

}
开发者ID:bleakxanadu,项目名称:douml,代码行数:55,代码来源:UmlPackage.cpp


示例17: write_description_properties

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();

}
开发者ID:02JanDal,项目名称:douml,代码行数:54,代码来源:UmlArtifact.cpp


示例18: set_JavaDecl

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());
  }
}
开发者ID:gregsmirnov,项目名称:bouml,代码行数:51,代码来源:UmlClass.cpp


示例19: findStereotype

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;
}
开发者ID:daniel7solis,项目名称:douml,代码行数:49,代码来源:UmlClass.cpp


示例20: set_IdlDecl

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());
  }
}
开发者ID:gregsmirnov,项目名称:bouml,代码行数:49,代码来源:UmlClass.cpp



注:本文中的UmlItem类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ UmlOperation类代码示例发布时间:2022-05-31
下一篇:
C++ UmlClass类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap