当前位置: 首页>>代码示例>>C++>>正文


C++ UmlRelation::relationKind方法代码示例

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


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

示例1: gen_python_decl

void UmlClass::gen_python_decl(QByteArray s, bool descr)
{
    QByteArray st = PythonSettings::classStereotype(stereotype());

    if (st == "ignored")
        return;

    const char * p = bypass_comment(s);

    while (*p != 0) {
        if (!strncmp(p, "${comment}", 10))
            p += 10;
        else if (!strncmp(p, "${description}", 14))
            p += 14;
        else if (!strncmp(p, "${docstring}", 12))
            p += 12;
        else if (!strncmp(p, "${name}", 7)) {
            p += 7;
            writeq(name());
        }
        else if (!strncmp(p, "${inherit}", 10)) {
            p += 10;

            const QVector<UmlItem*> ch = children();
            bool inh = FALSE;

            for (int i = 0; i != ch.size(); i += 1) {
                if (ch[i]->kind() == aRelation) {
                    UmlRelation * rel = (UmlRelation *) ch[i];
                    aRelationKind k = rel->relationKind();

                    if (((k == aGeneralisation) || (k == aRealization)) &&
                        !rel->pythonDecl().isEmpty()) {
                        if (inh)
                            fw.write(", ");
                        else  {
                            inh = TRUE;
                            fw.write('(');
                        }

                        rel->roleType()->write();
                    }
                }
            }

            if (inh)
                fw.write(')');
            else if (isPython_2_2())
                fw.write("(object)");

            break;
        }
        else if (!descr && ((*p == '\r') || (*p == '\n') || (*p == ':')))
            break;
        else if (*p == '@')
            manage_alias(p);
        else
            writeq(*p++);
    }
}
开发者ID:DoUML,项目名称:douml,代码行数:60,代码来源:UmlClass.cpp

示例2: memo_ref

void UmlClass::memo_ref() {
  classes.addElement(this);
  UmlItem::memo_ref();
  
  const QVector<UmlItem> ch = children();
  
  if (inherited_opers == 0)
    add_inherited_opers(0);
	
  for (unsigned i = 0; i != ch.size(); i += 1) {
    if (ch[i]->kind() == aRelation) {
      UmlRelation * rel = (UmlRelation *) ch[i];
      aRelationKind k = rel->relationKind();
      
      if ((k == aGeneralisation) || (k == aRealization))
	rel->roleType()->subClasses.addElement(this);
    }
  }

  unload(TRUE, FALSE);
}
开发者ID:gregsmirnov,项目名称:bouml,代码行数:21,代码来源:UmlClass.cpp

示例3: add_inherited_opers

void UmlClass::add_inherited_opers(Vector * ops)
{
    if (inherited_opers == 0) {
        const QVector<UmlItem*> ch = children();

        inherited_opers = new Vector;

        for (int i = 0; i != ch.size(); i += 1) {
            switch (ch[i]->kind()) {
            case aRelation: {
                UmlRelation * rel = (UmlRelation *) ch[i];
                aRelationKind k = rel->relationKind();

                if ((k == aGeneralisation) || (k == aRealization))
                    rel->roleType()->add_inherited_opers(inherited_opers);
            }
            break;

            case anOperation: {
                UmlOperation * op = (UmlOperation *) ch[i];

                if ((op->visibility() == PublicVisibility) &&
                    (op->name()[0] != '~') &&
                    (op->name() != name()))
                    inherited_opers->addElement(op);
            }

            default:
                break;
            }
        }
    }

    if (ops != 0)
        for (unsigned i = 0; i != inherited_opers->size(); i += 1)
            if (! ops->contains(inherited_opers->elementAt(i)))
                ops->addElement(inherited_opers->elementAt(i));

    unload(TRUE, FALSE);
}
开发者ID:DoUML,项目名称:douml,代码行数:40,代码来源:UmlClass.cpp

示例4: gen_php_decl

void UmlClass::gen_php_decl(QCString s, bool descr) {
  QCString st = PhpSettings::classStereotype(stereotype());
  
  if (st == "ignored")
    return;
    
  const char * p = bypass_comment(s);
  UmlRelation * extend = 0;

  while (*p != 0) {
    if (!strncmp(p, "${comment}", 10))
      p += 10;
    else if (!strncmp(p, "${description}", 14))
      p += 14;
    else if (!strncmp(p, "${visibility}", 13)) {
      p += 13;
      UmlItem::write(visibility(), phpLanguage);
      fw.write(' ');
    }
    else if (!strncmp(p, "${final}", 8)) {
      p += 8;
      if (isPhpFinal())
	fw.write("final ");
    }
    else if (!strncmp(p, "${abstract}", 11)) {
      p += 11;
      if (isAbstract())
	fw.write("abstract ");
    }
    else if (!strncmp(p, "${name}", 7)) {
      p += 7;
      writeq(name());
      generics();
    }
    else if (!strncmp(p, "${extends}", 10)) {
      p += 10;

      const QVector<UmlItem> ch = children();

      for (unsigned i = 0; i != ch.size(); i += 1) {
	if (ch[i]->kind() == aRelation) {
	  UmlRelation * rel = (UmlRelation *) ch[i];
	  aRelationKind k = rel->relationKind();
	  
	  if (((k == aGeneralisation) ||
	       (k == aRealization)) &&
	      (!rel->phpDecl().isEmpty()) &&
	      ((st == "interface") ||
	       (PhpSettings::classStereotype(rel->roleType()->stereotype()) != "interface"))) {
	    extend = rel;
	    fw.write(" extends ");
	    rel->roleType()->write();
	    break;
	  }
	}
      }
    }
    else if (!strncmp(p, "${implements}", 13)) {
      p += 13;

      const QVector<UmlItem> ch = children();
      const char * sep = " implements ";

      for (unsigned i = 0; i != ch.size(); i += 1) {
	if (ch[i]->kind() == aRelation) {
	  UmlRelation * rel = (UmlRelation *) ch[i];
	  aRelationKind k = rel->relationKind();
	  
	  if ((rel != extend) &&
	      ((k == aGeneralisation) ||
	       (k == aRealization)) &&
	      (!rel->phpDecl().isEmpty())) {
	    fw.write(sep);
	    sep = ", ";
	    rel->roleType()->write();
	  }
	}
      }
    }
    else if (*p == '\r')
      p += 1;
    else if (*p == '\n') {
      if (descr) {
	fw.write("<br />");
	p += 1;
      }
      else {
	fw.write(' ');
	
	do
	  p += 1;
	while ((*p != 0) && (*p <= ' '));
      }
    }
    else if ((*p == '{') || (*p == ';')) {
      if (descr)
	fw.write(*p++);
      else
	break;
    }
//.........这里部分代码省略.........
开发者ID:gregsmirnov,项目名称:bouml,代码行数:101,代码来源:UmlClass.cpp

示例5: gen_cpp_decl

void UmlClass::gen_cpp_decl(QCString s, bool descr) {
  const char * p = (descr)
    ? (const char *) s
    : (const char *) bypass_comment(s);

  while (*p) {
    if (!strncmp(p, "${comment}", 10))
      p += 10;
    else if (!strncmp(p, "${description}", 14))
      p += 14;
    else if (!strncmp(p, "${type}", 7)) {
      p += 7;
      bool find = FALSE;

      if (baseType().type != 0) {
	UmlClass * mother = baseType().type;
	const QVector<UmlItem> ch = children();
	
	for (unsigned i = 0; i != ch.size(); i += 1) {
	  if (ch[i]->kind() == aRelation) {
	    UmlRelation * rel = (UmlRelation *) ch[i];
	    aRelationKind k = rel->relationKind();
	    
	    if (((k == aGeneralisation) ||
		 (k == aRealization)) &&
		(rel->roleType() == mother)) {
	      rel->roleType()->write();
	      generate(actuals(), mother, TRUE);
	      find = TRUE;
	      break;
	    }
	  }
	}
      }
      if (! find)
	UmlItem::write(baseType(), cppLanguage);
    }
    else if (!strncmp(p, "${template}", 11)) {
      p += 11;
      generate(formals());
    }
    else if (!strncmp(p, "${name}", 7)) {
      p += 7;
      writeq(name());
    }
    else if (!strncmp(p, "${inherit}", 10)) {
      p += 10;

      const QVector<UmlItem> ch = children();
      const char * sep = " : ";

      for (unsigned i = 0; i != ch.size(); i += 1) {
	if (ch[i]->kind() == aRelation) {
	  UmlRelation * rel = (UmlRelation *) ch[i];
	  aRelationKind k = rel->relationKind();
	  
	  if (((k == aGeneralisation) ||
	       (k == aRealization)) &&
	      !rel->cppDecl().isEmpty()) {
	    fw.write(sep);
	    // UmlItem::write else G++ call UmlClass::write(QCString) !
	    UmlItem::write((rel->cppVisibility() == DefaultVisibility)
		           ? rel->visibility() : rel->cppVisibility(),
			   cppLanguage);
	    fw.write((rel->cppVirtualInheritance()) ? " virtual " : " ");
	    rel->roleType()->write();
	    generate(actuals(), rel->roleType(), TRUE);
	    sep = ", ";
	  }
	}
      }
    }
    else if (*p == '{') {
      if (descr)
	fw.write(*p++);
      else
	break;
    }
    else if (*p == '\r')
      p += 1;
    else if (*p == '\n') {
      if (descr) {
	fw.write("<br />");
	p += 1;
      }
      else {
	fw.write(' ');
	
	do
	  p += 1;
	while ((*p != 0) && (*p <= ' '));
      }
    }
    else if (*p == '@')
      manage_alias(p);
    else
      writeq(*p++);
  }

}
开发者ID:gregsmirnov,项目名称:bouml,代码行数:100,代码来源:UmlClass.cpp

示例6: gen_java_decl

void UmlClass::gen_java_decl(QByteArray s, bool descr)
{
    const char * p = bypass_comment(s);
    UmlRelation * extend = 0;

    while (*p != 0) {
        if (!strncmp(p, "${comment}", 10))
            p += 10;
        else if (!strncmp(p, "${description}", 14))
            p += 14;
        else if (!strncmp(p, "${public}", 9)) {
            p += 9;

            if (isJavaPublic())
                fw.write("public ");
        }
        else if (!strncmp(p, "${visibility}", 13)) {
            p += 13;
            UmlItem::write(visibility(), javaLanguage);
            fw.write(' ');
        }
        else if (!strncmp(p, "${final}", 8)) {
            p += 8;

            if (isJavaFinal())
                fw.write("final ");
        }
        else if (!strncmp(p, "${abstract}", 11)) {
            p += 11;

            if (isAbstract())
                fw.write("abstract ");
        }
        else if (!strncmp(p, "${name}", 7)) {
            p += 7;
            writeq(name());
            generics();
        }
        else if (!strncmp(p, "${extends}", 10)) {
            p += 10;

            const QVector<UmlItem*> ch = children();

            for (int i = 0; i != ch.size(); i += 1) {
                if (ch[i]->kind() == aRelation) {
                    UmlRelation * rel = (UmlRelation *) ch[i];
                    aRelationKind k = rel->relationKind();

                    if (((k == aGeneralisation) ||
                         (k == aRealization)) &&
                        (!rel->javaDecl().isEmpty()) &&
                        ((JavaSettings::classStereotype(stereotype()) == "interface") ||
                         (JavaSettings::classStereotype(rel->roleType()->stereotype()) != "interface"))) {
                        extend = rel;
                        fw.write(" extends ");
                        rel->roleType()->write();
                        generate(actuals(), rel->roleType(), FALSE);
                        break;
                    }
                }
            }
        }
        else if (!strncmp(p, "${implements}", 13)) {
            p += 13;

            const QVector<UmlItem*> ch = children();
            const char * sep = " implements ";

            for (int i = 0; i != ch.size(); i += 1) {
                if (ch[i]->kind() == aRelation) {
                    UmlRelation * rel = (UmlRelation *) ch[i];
                    aRelationKind k = rel->relationKind();

                    if ((rel != extend) &&
                        ((k == aGeneralisation) ||
                         (k == aRealization)) &&
                        (!rel->javaDecl().isEmpty())) {
                        fw.write(sep);
                        sep = ", ";
                        rel->roleType()->write();
                        generate(actuals(), rel->roleType(), FALSE);
                    }
                }
            }
        }
        else if (!strncmp(p, "${@}", 4))
            p += 4;
        else if (*p == '\r')
            p += 1;
        else if (*p == '\n') {
            if (descr) {
                fw.write("<br />");
                p += 1;
            }
            else {
                fw.write(' ');

                do
                    p += 1;

//.........这里部分代码省略.........
开发者ID:DoUML,项目名称:douml,代码行数:101,代码来源:UmlClass.cpp


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