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


C++ Q3PtrList::getFirst方法代码示例

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


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

示例1: check_inherit

// check inheritance
QString BrowserNode::check_inherit(const BrowserNode * new_parent) const {
  Q3PtrList<BrowserNode> all_parents;
  Q3PtrList<BrowserNode> notyet = parents();

  if (notyet.findRef(new_parent) != -1)
    return TR("already generalize / realize");
  
  notyet.append(new_parent);
  
  do {
    BrowserNode * cl = notyet.getFirst();
    
    notyet.removeFirst();
    if (cl == this)
      return TR("can't have circular generalization / realization");
    if (all_parents.findRef(cl) == -1) {
      all_parents.append(cl);
      
      Q3PtrList<BrowserNode> grand_parents = cl->parents();
      
      for (cl = grand_parents.first(); cl; cl = grand_parents.next())
	if (notyet.findRef(cl) == -1)
	  notyet.append(cl);
    }
  } while (! notyet.isEmpty());
  
  return 0;
}
开发者ID:SciBoy,项目名称:douml,代码行数:29,代码来源:BrowserNode.cpp

示例2: generate

void UmlTransition::generate(Q3PtrList<UmlTransition> trs, UmlClass * machine, UmlClass * anystate, UmlState * state, Q3CString & body, Q3CString indent, bool completion)
{
    UmlTransition * tr;
    bool guard = FALSE;

    for (tr = trs.first(); tr != 0; tr = trs.next()) {
        body += indent;

        if (!tr->cppGuard().isEmpty()) {
            // manage guard
            body += ((tr == trs.getFirst()) ? "if (" : "else if (")
                    + tr->cppGuard() + ") {\n";
            guard = TRUE;
        }
        else
            // no gard : it is the last transition, may be the first
            body += ((tr == trs.getFirst()) ? "{\n" : "else {\n");

        // the target state
        UmlItem * tg = tr->target();
        bool self_external = (state == tg) && tr->isExternal();

        while (tg->kind() != aState)
            tg = tg->parent();

        // the parent common to the current and the target state
        UmlState * common = state;

        if (self_external) {
            // execute exit behavior
            if (!state->cppExitBehavior().isEmpty())
                body += indent + "  _doexit(stm);\n";
        }
        else {
            bool fromExit =
                // the exit behavior is made entering in the exit point
                (tr->parent()->kind() == anExitPointPseudoState);

            // compute common parent and manage exit behavior
            if (tr->target()->kind() != aTerminatePseudoState) {
                while (!((UmlState *) tg)->inside(common)) {
                    if (!fromExit && !common->cppExitBehavior().isEmpty())
                        body += indent + "  stm" + common->path() + "._doexit(stm);\n";

                    fromExit = FALSE;

                    switch (common->parent()->kind()) {
                    case aState:
                        common = (UmlState *) common->parent();
                        break;

                    case aRegion:
                        common = (UmlState *) common->parent()->parent();
                        break;

                    default:
                        UmlCom::trace("Error : transition from '" + state->name()
                                      + "' goes outside the state machine");
                        throw 0;
                    }
                }
            }
        }

        // manage transition activity
        if (!tr->cppActivity().isEmpty())
            body += "#ifdef VERBOSE_STATE_MACHINE\n" + indent +
                    "  puts(\"DEBUG : execute activity of transition " + tr->name() +
                    "\");\n#endif\n" + tr->cppActivity();

        // manage entry behavior
        if (self_external) {
            if (state->needCreate())
                body += indent + "  create(stm);\n";
        }
        else if (tr->target()->kind() != aTerminatePseudoState) {
            if (tg != common) {
                Q3CString enter;
                UmlState * tg_parent;

                // the enter behavior of the target state will be managed
                // generating a call to create
                for (tg_parent = (UmlState *) tg->parent();
                     tg_parent != common;
                     tg_parent = (UmlState *) tg_parent->parent())
                    if (!tg_parent->cppEntryBehavior().isEmpty())
                        enter.insert(0,
                                     (const char *)(indent + "  stm" + tg_parent->path() + "._doentry(stm);\n")); //[rageek] ambiguous

                if (!enter.isEmpty())
                    body += enter;
            }

            // set the current state if needed
            if (tg != state)
                body += indent + "  stm._set_currentState(stm"
                        + ((UmlState *) tg)->path() + ");\n#ifdef VERBOSE_STATE_MACHINE\n" +
                        indent + "  puts(\"DEBUG : current state is now " + ((UmlState *) tg)->prettyPath() +
                        "\");\n#endif\n";
        }
//.........这里部分代码省略.........
开发者ID:bleakxanadu,项目名称:douml,代码行数:101,代码来源:UmlTransition.cpp


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