summaryrefslogtreecommitdiff
path: root/src/xmlpatterns/schema/qxsdstatemachine_tpl_p.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-09-04 16:55:29 +0200
committerMarc Mutz <marc.mutz@kdab.com>2016-09-20 17:19:31 +0000
commitb1b57225dbc8733935697e1895631969e9a95376 (patch)
tree0a7f40c74bd90e83f6600ed361f7ace81b4e6f86 /src/xmlpatterns/schema/qxsdstatemachine_tpl_p.h
parentdba42c925db368aa958c38c6a3481f18a57bd71f (diff)
downloadqtxmlpatterns-b1b57225dbc8733935697e1895631969e9a95376.tar.gz
Eradicate Java-style loops (II): QSetIterator -> C++11 ranged for
Java-style iterators are slower than STL-style ones, so they should not be used in library code. Replaced them with C++11 ranged for loops, adding qAsConst() as needed. Change-Id: I21b59daceafc62b94ebba56bfef1f050988b9c9f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/xmlpatterns/schema/qxsdstatemachine_tpl_p.h')
-rw-r--r--src/xmlpatterns/schema/qxsdstatemachine_tpl_p.h12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/xmlpatterns/schema/qxsdstatemachine_tpl_p.h b/src/xmlpatterns/schema/qxsdstatemachine_tpl_p.h
index 91424a8..b989584 100644
--- a/src/xmlpatterns/schema/qxsdstatemachine_tpl_p.h
+++ b/src/xmlpatterns/schema/qxsdstatemachine_tpl_p.h
@@ -320,11 +320,9 @@ typename XsdStateMachine<TransitionType>::StateId XsdStateMachine<TransitionType
// state, in that case our new DFA state will be a
// Start or End state as well
StateType type = InternalState;
- QSetIterator<StateId> it(nfaState);
bool hasStartState = false;
bool hasEndState = false;
- while (it.hasNext()) {
- const StateId state = it.next();
+ for (const StateId state : qAsConst(nfaState)) {
if (m_states.value(state) == EndState) {
hasEndState = true;
} else if (m_states.value(state) == StartState) {
@@ -390,12 +388,8 @@ XsdStateMachine<TransitionType> XsdStateMachine<TransitionType>::toDFA() const
// the 'states' set
QList<TransitionType> input;
- {
- QSetIterator<StateId> it(states);
- while (it.hasNext()) {
- input << m_transitions.value(it.next()).keys();
- }
- }
+ for (const StateId state : states)
+ input << m_transitions.value(state).keys();
// get the state in DFA that corresponds to the 'states' set in the NFA
const StateId dfaBegin = dfaStateForNfaState(states, table, dfa);