diff options
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | .qmake.conf | 2 | ||||
-rw-r--r-- | src/xmlpatterns/api/qabstractxmlnodemodel.cpp | 14 | ||||
-rw-r--r-- | src/xmlpatterns/api/qabstractxmlreceiver.cpp | 2 | ||||
-rw-r--r-- | src/xmlpatterns/api/qxmlquery.cpp | 4 | ||||
-rw-r--r-- | src/xmlpatterns/doc/src/xquery-introduction.qdoc | 2 | ||||
-rw-r--r-- | src/xmlpatterns/expr/qorderby.cpp | 24 | ||||
-rw-r--r-- | src/xmlpatterns/parser/qtokenlookup.cpp | 10 | ||||
-rw-r--r-- | src/xmlpatterns/schema/qxsdschemahelper.cpp | 19 | ||||
-rw-r--r-- | src/xmlpatterns/schema/qxsdschemaresolver.cpp | 2 | ||||
m--------- | tests/auto/3rdparty/testsuites | 0 | ||||
-rw-r--r-- | tests/auto/xmlpatterns/tst_xmlpatterns.cpp | 14 | ||||
-rw-r--r-- | tests/auto/xmlpatternsdiagnosticsts/tst_xmlpatternsdiagnosticsts.cpp | 1 | ||||
-rw-r--r-- | tests/auto/xmlpatternsxqts/tst_suitetest.h | 4 | ||||
-rw-r--r-- | tests/auto/xmlpatternsxqts/tst_xmlpatternsxqts.cpp | 3 | ||||
-rw-r--r-- | tools/xmlpatterns/main.cpp | 2 |
16 files changed, 57 insertions, 49 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..4867a36 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "testsuites"] + path = tests/auto/3rdparty/testsuites + url = ../qtxmlpatterns-testsuites.git diff --git a/.qmake.conf b/.qmake.conf index 58db72c..fc13c75 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -2,4 +2,4 @@ load(qt_build_config) CONFIG += qt_example_installs CONFIG += warning_clean -MODULE_VERSION = 5.5.1 +MODULE_VERSION = 5.6.0 diff --git a/src/xmlpatterns/api/qabstractxmlnodemodel.cpp b/src/xmlpatterns/api/qabstractxmlnodemodel.cpp index 1a24dcc..f419eb5 100644 --- a/src/xmlpatterns/api/qabstractxmlnodemodel.cpp +++ b/src/xmlpatterns/api/qabstractxmlnodemodel.cpp @@ -441,9 +441,6 @@ namespace QPatternist class MergeIterator { public: - inline MergeIterator() - { - } inline QXmlNodeModelIndexIteratorPointer @@ -452,12 +449,9 @@ namespace QPatternist { return it; } - - private: - Q_DISABLE_COPY(MergeIterator) }; - static const MergeIterator mergeIterator; + static const MergeIterator mergeIterator = {}; /** * One might wonder, why not use makeVectorIterator() directly on a QVector @@ -483,8 +477,9 @@ namespace QPatternist virtual QAbstractXmlForwardIterator<QXmlNodeModelIndexIteratorPointer>::Ptr copy() const { ItVector result; - - for(int i = 0; i < m_list.count(); ++i) + const int count = m_list.count(); + result.reserve(count); + for (int i = 0; i < count; ++i) result.append(m_list.at(i)->copy()); return Ptr(new IteratorVector(result)); @@ -501,6 +496,7 @@ static inline QXmlNodeModelIndexIteratorPointer mergeIterators(const QXmlNodeMod const QXmlNodeModelIndexIteratorPointer &it2) { QVector<QXmlNodeModelIndexIteratorPointer> iterators; + iterators.reserve(2); iterators.append(makeSingletonIterator(node)); iterators.append(it2); diff --git a/src/xmlpatterns/api/qabstractxmlreceiver.cpp b/src/xmlpatterns/api/qabstractxmlreceiver.cpp index ed5ce2d..3f5b443 100644 --- a/src/xmlpatterns/api/qabstractxmlreceiver.cpp +++ b/src/xmlpatterns/api/qabstractxmlreceiver.cpp @@ -340,7 +340,7 @@ allow null QUrls. This callback is called when a namespace binding is in scope of an element. A namespace is defined by a URI. In the \l {QXmlName} \a name, the value of \l {QXmlName::namespaceUri()} is that URI. The - value of \l {QXmlName::prefix()} is the prefix that the URI is bound + value of \l {QXmlName::prefix}() is the prefix that the URI is bound to. The local name is insignificant and can be an arbitrary value. */ diff --git a/src/xmlpatterns/api/qxmlquery.cpp b/src/xmlpatterns/api/qxmlquery.cpp index dd8faae..718b9c8 100644 --- a/src/xmlpatterns/api/qxmlquery.cpp +++ b/src/xmlpatterns/api/qxmlquery.cpp @@ -1100,7 +1100,7 @@ void QXmlQuery::setInitialTemplateName(const QXmlName &name) \overload Sets the name of the initial template to \a localName, which must be - a valid \l{QXmlName::localName()} {local name}. The initial template + a valid \l{QXmlName::localName}{local name}. The initial template is the one the processor calls first, instead of attempting to match a template to the context node (if any). If an initial template is not set, the standard order of template invocation will be used. @@ -1109,7 +1109,7 @@ void QXmlQuery::setInitialTemplateName(const QXmlName &name) stylesheets. The name becomes part of the compiled stylesheet. Therefore, this function must be called before calling setQuery(). - If \a localName is not a valid \l{QXmlName::localName()} {local + If \a localName is not a valid \l{QXmlName::localName} {local name}, the effect is undefined. If the stylesheet has no template named \a localName, the processor will use the standard order of template invocation. diff --git a/src/xmlpatterns/doc/src/xquery-introduction.qdoc b/src/xmlpatterns/doc/src/xquery-introduction.qdoc index 6117424..49458ac 100644 --- a/src/xmlpatterns/doc/src/xquery-introduction.qdoc +++ b/src/xmlpatterns/doc/src/xquery-introduction.qdoc @@ -31,7 +31,7 @@ \pagekeywords XPath XQuery \startpage XQuery -\target XQuery-introduction +\keyword XQuery-introduction XQuery is a language for querying XML data or non-XML data that can be modeled as XML. XQuery is specified by the \l{http://www.w3.org}{W3C}. diff --git a/src/xmlpatterns/expr/qorderby.cpp b/src/xmlpatterns/expr/qorderby.cpp index ba6bcb2..7dbf320 100644 --- a/src/xmlpatterns/expr/qorderby.cpp +++ b/src/xmlpatterns/expr/qorderby.cpp @@ -44,6 +44,7 @@ #include "qorderby_p.h" #include <algorithm> +#include <functional> QT_BEGIN_NAMESPACE @@ -72,11 +73,17 @@ void OrderBy::OrderSpec::prepare(const Expression::Ptr &source, * @short Functor used by Qt's qSort() and qStableSort(). Used for FLWOR's * <tt>order by</tt> expression. * - * This must be in the global namespace, since it is specializing qLess(), which - * is in the global namespace. Hence it can't be in QPatternist. + * This must be in the std namespace, since it is specializing std::less(), which + * is in the std namespace. Hence it can't be in QPatternist. */ + +QT_END_NAMESPACE + +QT_USE_NAMESPACE + +namespace std { template<> -class qLess<Item::List> +struct less<Item::List> { private: @@ -87,9 +94,9 @@ private: } public: - inline qLess(const OrderBy::OrderSpec::Vector &orderspecs, - const DynamicContext::Ptr &context) : m_orderSpecs(orderspecs) - , m_context(context) + inline less(const OrderBy::OrderSpec::Vector &orderspecs, + const DynamicContext::Ptr &context) : m_orderSpecs(orderspecs) + , m_context(context) { Q_ASSERT(!m_orderSpecs.isEmpty()); Q_ASSERT(context); @@ -158,6 +165,9 @@ private: const OrderBy::OrderSpec::Vector & m_orderSpecs; const DynamicContext::Ptr & m_context; }; +} // namespace std + +QT_BEGIN_NAMESPACE Item::Iterator::Ptr OrderBy::mapToSequence(const Item &i, const DynamicContext::Ptr &) const @@ -169,7 +179,7 @@ Item::Iterator::Ptr OrderBy::evaluateSequence(const DynamicContext::Ptr &context { Item::List tuples(m_operand->evaluateSequence(context)->toList()); - const qLess<Item::List> sorter(m_orderSpecs, context); + const std::less<Item::List> sorter(m_orderSpecs, context); Q_ASSERT(m_stability == StableOrder || m_stability == UnstableOrder); diff --git a/src/xmlpatterns/parser/qtokenlookup.cpp b/src/xmlpatterns/parser/qtokenlookup.cpp index 42ccff3..f92ebe4 100644 --- a/src/xmlpatterns/parser/qtokenlookup.cpp +++ b/src/xmlpatterns/parser/qtokenlookup.cpp @@ -91,7 +91,7 @@ public: }; inline unsigned int -TokenLookup::hash (register const char *str, register unsigned int len) +TokenLookup::hash (const char *str, unsigned int len) { static const unsigned char asso_values[] = { @@ -122,7 +122,7 @@ TokenLookup::hash (register const char *str, register unsigned int len) 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230 }; - register int hval = len; + int hval = len; switch (hval) { @@ -138,7 +138,7 @@ TokenLookup::hash (register const char *str, register unsigned int len) } const struct TokenMap * -TokenLookup::value (register const char *str, register unsigned int len) +TokenLookup::value (const char *str, unsigned int len) { enum { @@ -416,11 +416,11 @@ TokenLookup::value (register const char *str, register unsigned int len) if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { - register int key = hash (str, len); + int key = hash (str, len); if (key <= MAX_HASH_VALUE && key >= 0) { - register const char *s = wordlist[key].name; + const char *s = wordlist[key].name; if (*str == *s && !strcmp (str + 1, s + 1)) return &wordlist[key]; diff --git a/src/xmlpatterns/schema/qxsdschemahelper.cpp b/src/xmlpatterns/schema/qxsdschemahelper.cpp index b0fbf31..8a8314d 100644 --- a/src/xmlpatterns/schema/qxsdschemahelper.cpp +++ b/src/xmlpatterns/schema/qxsdschemahelper.cpp @@ -150,19 +150,6 @@ bool XsdSchemaHelper::wildcardAllowsExpandedName(const QXmlName &name, const Xsd return true; } -// small helper function that should be available in Qt 4.6 -template<class T> -static inline bool containsSet(const QSet<T> &super, const QSet<T> &sub) -{ - QSetIterator<T> it(sub); - while (it.hasNext()) { - if (!super.contains(it.next())) - return false; - } - - return true; -} - bool XsdSchemaHelper::isWildcardSubset(const XsdWildcard::Ptr &wildcard, const XsdWildcard::Ptr &otherWildcard) { // @see http://www.w3.org/TR/xmlschema11-1/#cos-ns-subset @@ -178,19 +165,19 @@ bool XsdSchemaHelper::isWildcardSubset(const XsdWildcard::Ptr &wildcard, const X // 2 if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration) && (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration)) { - if (containsSet<QString>(otherConstraint->namespaces(), constraint->namespaces())) + if (otherConstraint->namespaces().contains(constraint->namespaces())) return true; } // 3 if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Enumeration) && (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Not)) { - if (constraint->namespaces().intersect(otherConstraint->namespaces()).isEmpty()) + if (!constraint->namespaces().intersects(otherConstraint->namespaces())) return true; } // 4 if ((constraint->variety() == XsdWildcard::NamespaceConstraint::Not) && (otherConstraint->variety() == XsdWildcard::NamespaceConstraint::Not)) { - if (containsSet<QString>(constraint->namespaces(), otherConstraint->namespaces())) + if (constraint->namespaces().contains(otherConstraint->namespaces())) return true; } diff --git a/src/xmlpatterns/schema/qxsdschemaresolver.cpp b/src/xmlpatterns/schema/qxsdschemaresolver.cpp index 469a239..14109d6 100644 --- a/src/xmlpatterns/schema/qxsdschemaresolver.cpp +++ b/src/xmlpatterns/schema/qxsdschemaresolver.cpp @@ -1413,7 +1413,7 @@ bool isValidWildcardRestriction(const XsdWildcard::Ptr &wildcard, const XsdWildc } if (baseWildcard->namespaceConstraint()->variety() == XsdWildcard::NamespaceConstraint::Not && wildcard->namespaceConstraint()->variety() == XsdWildcard::NamespaceConstraint::Enumeration) { - if (!baseWildcard->namespaceConstraint()->namespaces().intersect(wildcard->namespaceConstraint()->namespaces()).isEmpty()) + if (baseWildcard->namespaceConstraint()->namespaces().intersects(wildcard->namespaceConstraint()->namespaces())) return false; } if (baseWildcard->namespaceConstraint()->variety() == XsdWildcard::NamespaceConstraint::Enumeration && diff --git a/tests/auto/3rdparty/testsuites b/tests/auto/3rdparty/testsuites new file mode 160000 +Subproject ddfcd98e8d3f78d696bb25ddcaacc3e3cba51e7 diff --git a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp index 7c18bf6..e207a33 100644 --- a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp +++ b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp @@ -117,6 +117,17 @@ void tst_XmlPatterns::initTestCase() #endif // QT_NO_PROCESS } +#ifndef QT_NO_PROCESS +static QByteArray msgProcessError(const char *what, const QProcess &process) +{ + QString result = QLatin1String(what) + QLatin1Char(' ') + + QDir::toNativeSeparators(process.program()) + + QLatin1Char(' ') + process.arguments().join(QLatin1Char(' ')) + + QLatin1String(": ") + process.errorString(); + return result.toLocal8Bit(); +} +#endif // !QT_NO_PROCESS + void tst_XmlPatterns::xquerySupport() { if (QTest::currentDataTag() == QByteArray("Load query via FTP") @@ -143,9 +154,10 @@ void tst_XmlPatterns::xquerySupport() process.setWorkingDirectory(inputFile(cwd)); process.start(m_command, arguments); + QVERIFY2(process.waitForStarted(), msgProcessError("Failed to start", process).constData()); + QVERIFY2(process.waitForFinished(), msgProcessError("Timeout running", process).constData()); QCOMPARE(process.exitStatus(), QProcess::NormalExit); - QVERIFY(process.waitForFinished()); if(process.exitCode() != expectedExitCode) QTextStream(stderr) << "stderr:" << process.readAllStandardError(); diff --git a/tests/auto/xmlpatternsdiagnosticsts/tst_xmlpatternsdiagnosticsts.cpp b/tests/auto/xmlpatternsdiagnosticsts/tst_xmlpatternsdiagnosticsts.cpp index f42d18e..2895893 100644 --- a/tests/auto/xmlpatternsdiagnosticsts/tst_xmlpatternsdiagnosticsts.cpp +++ b/tests/auto/xmlpatternsdiagnosticsts/tst_xmlpatternsdiagnosticsts.cpp @@ -55,6 +55,7 @@ protected: tst_XmlPatternsDiagnosticsTS::tst_XmlPatternsDiagnosticsTS() : tst_SuiteTest(tst_SuiteTest::XQuerySuite, true) { + m_existingBaseline = QFINDTESTDATA("Baseline.xml"); } void tst_XmlPatternsDiagnosticsTS::catalogPath(QString &write) const diff --git a/tests/auto/xmlpatternsxqts/tst_suitetest.h b/tests/auto/xmlpatternsxqts/tst_suitetest.h index 741e636..c21b7d3 100644 --- a/tests/auto/xmlpatternsxqts/tst_suitetest.h +++ b/tests/auto/xmlpatternsxqts/tst_suitetest.h @@ -83,12 +83,12 @@ private Q_SLOTS: void runTestSuite() const; void checkTestSuiteResult() const; -private: +protected: /** * An absolute path to the catalog. */ QString m_catalogPath; - const QString m_existingBaseline; + QString m_existingBaseline; const QString m_candidateBaseline; const bool m_abortRun; const SuiteType m_suiteType; diff --git a/tests/auto/xmlpatternsxqts/tst_xmlpatternsxqts.cpp b/tests/auto/xmlpatternsxqts/tst_xmlpatternsxqts.cpp index 8a49e81..1acad24 100644 --- a/tests/auto/xmlpatternsxqts/tst_xmlpatternsxqts.cpp +++ b/tests/auto/xmlpatternsxqts/tst_xmlpatternsxqts.cpp @@ -59,9 +59,8 @@ void tst_XmlPatternsXQTS::catalogPath(QString &write) const if(dontRun()) QSKIP("This test takes too long time to run on the majority of platforms."); - write = QFINDTESTDATA("TESTSUITE/XQTSCatalog.xml"); + write = QFINDTESTDATA("../3rdparty/testsuites/XQTS/XQTSCatalog.xml"); return; - } QTEST_MAIN(tst_XmlPatternsXQTS) diff --git a/tools/xmlpatterns/main.cpp b/tools/xmlpatterns/main.cpp index 0c8140c..00d41b3 100644 --- a/tools/xmlpatterns/main.cpp +++ b/tools/xmlpatterns/main.cpp @@ -52,7 +52,7 @@ #include "qapplicationargument_p.h" #include "qapplicationargumentparser_p.h" -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) && (!defined(_WIN32_WCE) || _WIN32_WCE >= 0x800) /* Needed for opening stdout with _fdopen & friends. io.h seems to not be * needed on MinGW though. */ #include <io.h> |