From 890fbc5c6a271d345ec5a47501c4ae716a96fe44 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Tue, 27 Oct 2009 10:58:28 +0100 Subject: Compile on Symbian winscw. Patch by Martin Jones. Malformed in codepaster so was manually applied. Builds with public 5th SDK. The compiler workaround was documented. Reviewed-by: Frans Englich --- src/xmlpatterns/schema/qxsdstatemachine.cpp | 64 -------------------------- src/xmlpatterns/schema/qxsdstatemachine_p.h | 69 +++++++++++++++++++++++++++-- 2 files changed, 66 insertions(+), 67 deletions(-) diff --git a/src/xmlpatterns/schema/qxsdstatemachine.cpp b/src/xmlpatterns/schema/qxsdstatemachine.cpp index 85bc752..8a43411 100644 --- a/src/xmlpatterns/schema/qxsdstatemachine.cpp +++ b/src/xmlpatterns/schema/qxsdstatemachine.cpp @@ -335,64 +335,6 @@ typename XsdStateMachine::StateId XsdStateMachine -QSet::StateId> XsdStateMachine::epsilonClosure(const QSet &input) const -{ - // every state can reach itself by epsilon transition, so include the input states - // in the result as well - QSet result = input; - - // add the input states to the list of to be processed states - QList workStates = input.toList(); - while (!workStates.isEmpty()) { // while there are states to be processed left... - - // dequeue one state from list - const StateId state = workStates.takeFirst(); - - // get the list of states that can be reached by the epsilon transition - // from the current 'state' - const QVector targetStates = m_epsilonTransitions.value(state); - for (int i = 0; i < targetStates.count(); ++i) { - // if we have this target state not in our result set yet... - if (!result.contains(targetStates.at(i))) { - // ... add it to the result set - result.insert(targetStates.at(i)); - - // add the target state to the list of to be processed states as well, - // as we want to have the epsilon transitions not only for the first - // level of following states - workStates.append(targetStates.at(i)); - } - } - } - - return result; -} - -template -QSet::StateId> XsdStateMachine::move(const QSet &states, TransitionType input) const -{ - QSet result; - - QSetIterator it(states); - while (it.hasNext()) { // iterate over all given states - const StateId state = it.next(); - - // get the transition table for the current state - const QHash > transitions = m_transitions.value(state); - - // get the target states for the given input - const QVector targetStates = transitions.value(input); - - // add all target states to the result - for (int i = 0; i < targetStates.size(); ++i) - result.insert(targetStates.at(i)); - } - - return result; -} - template XsdStateMachine XsdStateMachine::toDFA() const { @@ -469,9 +411,3 @@ QHash::StateId, typename XsdStateMachin { return m_states; } - -template -QHash::StateId, QHash::StateId> > > XsdStateMachine::transitions() const -{ - return m_transitions; -} diff --git a/src/xmlpatterns/schema/qxsdstatemachine_p.h b/src/xmlpatterns/schema/qxsdstatemachine_p.h index e671499..294eb50 100644 --- a/src/xmlpatterns/schema/qxsdstatemachine_p.h +++ b/src/xmlpatterns/schema/qxsdstatemachine_p.h @@ -204,8 +204,14 @@ namespace QPatternist /** * Returns the information of all transitions of the state machine. + * + * The implementation is inlined in order to workaround a compiler + * bug on Symbian/winscw. */ - QHash > > transitions() const; + QHash > > transitions() const + { + return m_transitions; + } private: /** @@ -217,14 +223,71 @@ namespace QPatternist /** * Returns the set of all states that can be reached from the set of @p input states * by the epsilon transition. + * + * The implementation is inlined in order to workaround a compiler + * bug on Symbian/winscw. */ - QSet epsilonClosure(const QSet &input) const; + QSet epsilonClosure(const QSet &input) const + { + // every state can reach itself by epsilon transition, so include the input states + // in the result as well + QSet result = input; + + // add the input states to the list of to be processed states + QList workStates = input.toList(); + while (!workStates.isEmpty()) { // while there are states to be processed left... + + // dequeue one state from list + const StateId state = workStates.takeFirst(); + + // get the list of states that can be reached by the epsilon transition + // from the current 'state' + const QVector targetStates = m_epsilonTransitions.value(state); + for (int i = 0; i < targetStates.count(); ++i) { + // if we have this target state not in our result set yet... + if (!result.contains(targetStates.at(i))) { + // ... add it to the result set + result.insert(targetStates.at(i)); + + // add the target state to the list of to be processed states as well, + // as we want to have the epsilon transitions not only for the first + // level of following states + workStates.append(targetStates.at(i)); + } + } + } + + return result; + } /** * Returns the set of all states that can be reached from the set of given @p states * by the given @p input. + * + * The implementation is inlined in order to workaround a compiler + * bug on Symbian/winscw. */ - QSet move(const QSet &states, TransitionType input) const; + QSet move(const QSet &states, TransitionType input) const + { + QSet result; + + QSetIterator it(states); + while (it.hasNext()) { // iterate over all given states + const StateId state = it.next(); + + // get the transition table for the current state + const QHash > transitions = m_transitions.value(state); + + // get the target states for the given input + const QVector targetStates = transitions.value(input); + + // add all target states to the result + for (int i = 0; i < targetStates.size(); ++i) + result.insert(targetStates.at(i)); + } + + return result; + } NamePool::Ptr m_namePool; QHash m_states; -- cgit v0.12