QStateMachine: remove left-over method.

This method was probably there in older versions of the specification,
but it is no longer used now. The only caller was in
QStateMachinePrivate::setError, which has been changed to use the newer
methods.

Change-Id: Ic4961990d8d2c902676e63193d3f30ef427e6f0c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
bb10
Erik Verbruggen 2015-07-14 11:06:40 +02:00 committed by Erik Verbruggen
parent d348d40473
commit 795476c41a
2 changed files with 5 additions and 68 deletions

View File

@ -1041,69 +1041,6 @@ void QStateMachinePrivate::enterStates(QEvent *event, const QList<QAbstractState
// qDebug() << "configuration:" << configuration.toList();
}
void QStateMachinePrivate::addStatesToEnter(QAbstractState *s, QState *root,
QSet<QAbstractState*> &statesToEnter,
QSet<QAbstractState*> &statesForDefaultEntry)
{
if (QHistoryState *h = toHistoryState(s)) {
QList<QAbstractState*> hconf = QHistoryStatePrivate::get(h)->configuration;
if (!hconf.isEmpty()) {
for (int k = 0; k < hconf.size(); ++k) {
QAbstractState *s0 = hconf.at(k);
addStatesToEnter(s0, root, statesToEnter, statesForDefaultEntry);
}
#ifdef QSTATEMACHINE_DEBUG
qDebug() << q_func() << ": restoring"
<< ((QHistoryStatePrivate::get(h)->historyType == QHistoryState::DeepHistory) ? "deep" : "shallow")
<< "history from" << s << ':' << hconf;
#endif
} else {
QList<QAbstractState*> hlst;
if (QHistoryStatePrivate::get(h)->defaultState)
hlst.append(QHistoryStatePrivate::get(h)->defaultState);
if (hlst.isEmpty()) {
setError(QStateMachine::NoDefaultStateInHistoryStateError, h);
} else {
for (int k = 0; k < hlst.size(); ++k) {
QAbstractState *s0 = hlst.at(k);
addStatesToEnter(s0, root, statesToEnter, statesForDefaultEntry);
}
#ifdef QSTATEMACHINE_DEBUG
qDebug() << q_func() << ": initial history targets for" << s << ':' << hlst;
#endif
}
}
} else {
if (s == rootState()) {
// Error has already been set by exitStates().
Q_ASSERT(error != QStateMachine::NoError);
return;
}
statesToEnter.insert(s);
if (isParallel(s)) {
QState *grp = toStandardState(s);
QList<QAbstractState*> lst = QStatePrivate::get(grp)->childStates();
for (int i = 0; i < lst.size(); ++i) {
QAbstractState *child = lst.at(i);
addStatesToEnter(child, grp, statesToEnter, statesForDefaultEntry);
}
} else if (isCompound(s)) {
statesForDefaultEntry.insert(s);
QState *grp = toStandardState(s);
QAbstractState *initial = grp->initialState();
if (initial != 0) {
Q_ASSERT(initial->machine() == q_func());
addStatesToEnter(initial, grp, statesToEnter, statesForDefaultEntry);
} else {
setError(QStateMachine::NoInitialStateError, grp);
return;
}
}
addAncestorStatesToEnter(s, root, statesToEnter, statesForDefaultEntry);
}
}
/* The algorithm as described in http://www.w3.org/TR/2014/WD-scxml-20140529/ has a bug. See
* QTBUG-44963 for details. The algorithm here is as described in
* http://www.w3.org/Voice/2013/scxml-irp/SCXML.htm as of Friday March 13, 2015.
@ -1545,8 +1482,11 @@ void QStateMachinePrivate::setError(QStateMachine::Error errorCode, QAbstractSta
#ifdef QSTATEMACHINE_DEBUG
qDebug() << q << ": entering error state" << currentErrorState << "from" << currentContext;
#endif
QState *lca = findLCA(QList<QAbstractState*>() << currentErrorState << currentContext);
addStatesToEnter(currentErrorState, lca, pendingErrorStates, pendingErrorStatesForDefaultEntry);
pendingErrorStates.insert(currentErrorState);
addDescendantStatesToEnter(currentErrorState, pendingErrorStates, pendingErrorStatesForDefaultEntry);
addAncestorStatesToEnter(currentErrorState, rootState(), pendingErrorStates, pendingErrorStatesForDefaultEntry);
foreach (QAbstractState *s, configuration)
pendingErrorStates.remove(s);
} else {
qWarning("Unrecoverable error detected in running state machine: %s",
qPrintable(errorString));

View File

@ -155,9 +155,6 @@ public:
void addDescendantStatesToEnter(QAbstractState *state,
QSet<QAbstractState*> &statesToEnter,
QSet<QAbstractState*> &statesForDefaultEntry);
void addStatesToEnter(QAbstractState *s, QState *root,
QSet<QAbstractState*> &statesToEnter,
QSet<QAbstractState*> &statesForDefaultEntry);
void addAncestorStatesToEnter(QAbstractState *s, QAbstractState *ancestor,
QSet<QAbstractState*> &statesToEnter,
QSet<QAbstractState*> &statesForDefaultEntry);