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


C++ QVector::findRef方法代码示例

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


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

示例1: generate

void UmlTransition::generate(UmlClass * machine, UmlClass * anystate, UmlState * state) {
  if (_already_managed)
    return;
    
  QCString s = triggerName();
  
  // group transitions having the same trigger
  const QVector<UmlItem> ch = parent()->children();
  unsigned index = ch.findRef(this);
  QList<UmlTransition> trs;
  UmlTransition * tr_no_guard = 0;
  
  if (cppGuard().isEmpty())
    tr_no_guard = this;
  else
    trs.append(this);
  
  while (++index != ch.count()) {
    if ((ch[index]->kind() == aTransition) &&
	(((UmlTransition *) ch[index])->triggerName() == s)) {
      if (!((UmlTransition *) ch[index])->cppGuard().isEmpty())
	trs.append((UmlTransition *) ch[index]);
      else if (tr_no_guard != 0) {
	UmlCom::trace("Error : several transitions from '" + parent()->name()
		      + "' don't have guard");
	throw 0;
      }
      else
	tr_no_guard = (UmlTransition *) ch[index];
      
      ((UmlTransition *) ch[index])->_already_managed = TRUE;
    }
  }

  if (tr_no_guard != 0)
    // place it at end
    trs.append(tr_no_guard);
    
  // made the trigger

  UmlOperation * trg = state->assocClass()->trigger(s, machine, anystate);
  QCString body;
  
  if (s == "create") {
    // manage entry
    if (!state->cppEntryBehavior().isEmpty())
      body = "  _doentry(stm);\n";
  }

  if (!state->cppDoActivity().isEmpty())
    // state do activity before each event except create
    body += "  _do(stm);\n";
    
  bool completion = (s == "_completion");

  if (!completion && state->isLeaf() && state->hasCompletion())
    // manage completion
    body += "  if (_completion(stm)) return;\n";
    
  UmlTransition::generate(trs, machine, anystate, state,
			  body, "  ", completion);
  
  trg->set_CppBody(body);
}
开发者ID:gregsmirnov,项目名称:bouml,代码行数:64,代码来源:UmlTransition.cpp


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