summaryrefslogtreecommitdiffstats
path: root/src/xmlpatterns/functions
diff options
context:
space:
mode:
Diffstat (limited to 'src/xmlpatterns/functions')
-rw-r--r--src/xmlpatterns/functions/qcomparingaggregator.cpp5
-rw-r--r--src/xmlpatterns/functions/qpatternplatform.cpp23
-rw-r--r--src/xmlpatterns/functions/qpatternplatform_p.h18
-rw-r--r--src/xmlpatterns/functions/qsequencefns_p.h11
-rw-r--r--src/xmlpatterns/functions/qsequencegeneratingfns.cpp13
5 files changed, 39 insertions, 31 deletions
diff --git a/src/xmlpatterns/functions/qcomparingaggregator.cpp b/src/xmlpatterns/functions/qcomparingaggregator.cpp
index bec8dea..4fbb070 100644
--- a/src/xmlpatterns/functions/qcomparingaggregator.cpp
+++ b/src/xmlpatterns/functions/qcomparingaggregator.cpp
@@ -203,8 +203,9 @@ ComparingAggregator<oper, result>::typeCheck(const StaticContext::Ptr &context,
if(!m_operands.first()->staticType()->cardinality().allowsMany())
return m_operands.first();
-
- prepareComparison(fetchComparator(t1, t1, context));
+
+ // explicit scope needed in RVCT
+ ComparingAggregator<oper, result>::prepareComparison(fetchComparator(t1, t1, context));
return me;
}
diff --git a/src/xmlpatterns/functions/qpatternplatform.cpp b/src/xmlpatterns/functions/qpatternplatform.cpp
index 87cbec9..8241a5e 100644
--- a/src/xmlpatterns/functions/qpatternplatform.cpp
+++ b/src/xmlpatterns/functions/qpatternplatform.cpp
@@ -168,16 +168,23 @@ void PatternPlatform::applyFlags(const Flags flags, QRegExp &patternP)
// TODO Apply the other flags, like 'x'.
}
+QRegExp PatternPlatform::parsePattern(const QString &pattern,
+ const ReportContext::Ptr &context) const
+{
+ return parsePattern(pattern, context, this);
+}
+
QRegExp PatternPlatform::parsePattern(const QString &patternP,
- const DynamicContext::Ptr &context) const
+ const ReportContext::Ptr &context,
+ const SourceLocationReflection *const location)
{
if(patternP == QLatin1String("(.)\\3") ||
patternP == QLatin1String("\\3") ||
patternP == QLatin1String("(.)\\2"))
{
context->error(QLatin1String("We don't want to hang infinitely on K2-MatchesFunc-9, "
- "10 and 11. See Trolltech task 148505."),
- ReportContext::FOER0000, this);
+ "10 and 11."),
+ ReportContext::FOER0000, location);
return QRegExp();
}
@@ -189,14 +196,8 @@ QRegExp PatternPlatform::parsePattern(const QString &patternP,
* QChar::category(). */
rewrittenPattern.replace(QLatin1String("[\\i-[:]]"), QLatin1String("[a-zA-Z_]"));
rewrittenPattern.replace(QLatin1String("[\\c-[:]]"), QLatin1String("[a-zA-Z0-9_\\-\\.]"));
- rewrittenPattern.replace(QLatin1String("\\i"), QLatin1String("[a-zA-Z:_]"));
- rewrittenPattern.replace(QLatin1String("\\c"), QLatin1String("[a-zA-Z0-9:_\\-\\.]"));
- rewrittenPattern.replace(QLatin1String("\\p{L}"), QLatin1String("[a-zA-Z]"));
- rewrittenPattern.replace(QLatin1String("\\p{Lu}"), QLatin1String("[A-Z]"));
- rewrittenPattern.replace(QLatin1String("\\p{Ll}"), QLatin1String("[a-z]"));
- rewrittenPattern.replace(QLatin1String("\\p{Nd}"), QLatin1String("[0-9]"));
- QRegExp retval(rewrittenPattern);
+ QRegExp retval(rewrittenPattern, Qt::CaseSensitive, QRegExp::W3CXmlSchema11);
if(retval.isValid())
return retval;
@@ -204,7 +205,7 @@ QRegExp PatternPlatform::parsePattern(const QString &patternP,
{
context->error(QtXmlPatterns::tr("%1 is an invalid regular expression pattern: %2")
.arg(formatExpression(patternP), retval.errorString()),
- ReportContext::FORX0002, this);
+ ReportContext::FORX0002, location);
return QRegExp();
}
}
diff --git a/src/xmlpatterns/functions/qpatternplatform_p.h b/src/xmlpatterns/functions/qpatternplatform_p.h
index 89318ea..52d12d7 100644
--- a/src/xmlpatterns/functions/qpatternplatform_p.h
+++ b/src/xmlpatterns/functions/qpatternplatform_p.h
@@ -122,6 +122,14 @@ namespace QPatternist
*/
inline int captureCount() const;
+ /**
+ * @short Parses pattern
+ */
+ static QRegExp parsePattern(const QString &pattern,
+ const ReportContext::Ptr &context,
+ const SourceLocationReflection *const location);
+
+
protected:
/**
* @short This constructor is protected, because this class is supposed to be sub-classed.
@@ -146,14 +154,18 @@ namespace QPatternist
};
typedef QFlags<PreCompiledPart> PreCompiledParts;
+ /**
+ * @short Calls the public parsePattern() function and passes in @c
+ * this as the location.
+ */
+ inline QRegExp parsePattern(const QString &pattern,
+ const ReportContext::Ptr &context) const;
+
Q_DISABLE_COPY(PatternPlatform)
Flags parseFlags(const QString &flags,
const DynamicContext::Ptr &context) const;
- QRegExp parsePattern(const QString &pattern,
- const DynamicContext::Ptr &context) const;
-
static void applyFlags(const Flags flags, QRegExp &pattern);
/**
diff --git a/src/xmlpatterns/functions/qsequencefns_p.h b/src/xmlpatterns/functions/qsequencefns_p.h
index 77aa102..f16462f 100644
--- a/src/xmlpatterns/functions/qsequencefns_p.h
+++ b/src/xmlpatterns/functions/qsequencefns_p.h
@@ -146,13 +146,20 @@ namespace QPatternist
*/
virtual Expression::Ptr compress(const StaticContext::Ptr &context)
{
- Q_ASSERT(Id == IDExistsFN || Id == IDEmptyFN);
+ // RVCT doesn't like using template parameter in trinary operator when the trinary operator result is
+ // passed directly into another constructor.
+ bool tempAssert = (Id == IDExistsFN || Id == IDEmptyFN);
+ Q_ASSERT(tempAssert);
+
const Expression::Ptr me(FunctionCall::compress(context));
if(me != this)
return me;
- const Cardinality myCard((Id == IDExistsFN) ? Cardinality::oneOrMore() : Cardinality::empty());
+ // RVCT doesn't like using template parameter in trinary operator when the trinary operator result is
+ // passed directly into another constructor.
+ Expression::ID tempId = Id;
+ const Cardinality myCard((tempId == IDExistsFN) ? Cardinality::oneOrMore() : Cardinality::empty());
const Cardinality card(m_operands.first()->staticType()->cardinality());
if(myCard.isMatch(card))
diff --git a/src/xmlpatterns/functions/qsequencegeneratingfns.cpp b/src/xmlpatterns/functions/qsequencegeneratingfns.cpp
index d760128..9760bdb 100644
--- a/src/xmlpatterns/functions/qsequencegeneratingfns.cpp
+++ b/src/xmlpatterns/functions/qsequencegeneratingfns.cpp
@@ -69,19 +69,6 @@ Item IdFN::mapToItem(const QString &id,
}
/**
- * @short Helper class for StringSplitter
- *
- * Needed by the QAbstractXmlForwardIterator sub-class.
- *
- * @relates StringSplitter
- */
-template<>
-bool qIsForwardIteratorEnd(const QString &unit)
-{
- return unit.isNull();
-}
-
-/**
* @short Helper class for IdFN.
*
* StringSplitter takes an Iterator which delivers strings of this kind: