本文整理汇总了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);
}