65 return QtXmlPatterns::tr(
"Integer division (%1) by zero (%2) is undefined.")
72 return QtXmlPatterns::tr(
"Division (%1) by zero (%2) is undefined.")
79 return QtXmlPatterns::tr(
"Modulus division (%1) by zero (%2) is undefined.")
198 return duration->fromValue(0);
201 context->
error(QtXmlPatterns::tr(
202 "Dividing a value of type %1 by %2 (not-a-number) " 213 context->
error(QtXmlPatterns::tr(
214 "Dividing a value of type %1 by %2 or %3 (plus or " 215 "minus zero) is not allowed.")
225 return duration->fromValue(static_cast<AbstractDuration::Value>(duration->value() / dbl));
230 return duration->fromValue(0);
233 context->
error(QtXmlPatterns::tr(
234 "Dividing a value of type %1 by %2 (not-a-number) " 245 context->
error(QtXmlPatterns::tr(
246 "Multiplication of a value of type %1 by %2 or %3 " 247 "(plus or minus infinity) is not allowed.")
257 return duration->fromValue(static_cast<AbstractDuration::Value>(duration->value() * dbl));
280 return duration->fromValue(duration->value() - op2);
282 return duration->fromValue(duration->value() + op2);
318 const qint8 sign = (op ==
Add ? 1 : -1) * (dur->isPositive() ? 1 : -1);
321 dt = dt.addSecs(sign * (dur->seconds() + dur->minutes() * 60 + dur->hours() * 60 * 60));
322 dt = dt.addDays(sign * dur->days());
323 dt = dt.addMonths(sign * dur->months());
324 dt = dt.addYears(sign * dur->years());
329 return adt->fromValue(dt);
347 const int diff = op ==
Add ? dt1.secsTo(dt2) : dt2.secsTo(dt1);
virtual NamePool::Ptr namePool() const =0
#define QT_END_NAMESPACE
This macro expands to.
Base class for classes implementing durations.
Base class for classes implementing values related to time, date or both.
QString formatKeyword(const QString &keyword)
virtual xsFloat toDecimal() const =0
QString formatType(const NamePool::Ptr &np, const T &type)
Formats ItemType and SequenceType.
Item toItem(const QExplicitlySharedDataPointer< T > atomicValue)
The QString class provides a Unicode character string.
static Item fromValue(const xsInteger num)
static DayTimeDuration::Ptr fromSeconds(const SecondCountProperty secs, const MSecondProperty msecs=0)
static QString idivZeroInvalid()
#define QT_BEGIN_NAMESPACE
This macro expands to.
void error(const QString &message, const ReportContext::ErrorCode errorCode, const QSourceLocation &sourceLocation)
virtual Item calculate(const Item &o1, const Operator op, const Item &o2, const QExplicitlySharedDataPointer< DynamicContext > &context) const
The namespace for the internal API of QtXmlPatterns.
virtual Item calculate(const Item &o1, const Operator op, const Item &o2, const QExplicitlySharedDataPointer< DynamicContext > &context) const
static QString modZeroInvalid()
const QDateTime & toDateTime() const
virtual Item calculate(const Item &o1, const Operator op, const Item &o2, const QExplicitlySharedDataPointer< DynamicContext > &context) const
static Decimal::Ptr fromValue(const xsDecimal num)
static QString formatData(const QString &data)
virtual Item calculate(const Item &o1, const Operator op, const Item &o2, const QExplicitlySharedDataPointer< DynamicContext > &context) const
Contains classes performing arithemetic operations between atomic values, such as subtracting two dat...
Q_CORE_EXPORT bool qIsNaN(double d)
Returns true if the double {d} is not a number (NaN).
virtual Item calculate(const Item &o1, const Operator op, const Item &o2, const QExplicitlySharedDataPointer< DynamicContext > &context) const
virtual Item calculate(const Item &o1, const Operator op, const Item &o2, const QExplicitlySharedDataPointer< DynamicContext > &context) const
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
OperandSwitcherMathematician(const AtomicMathematician::Ptr &mathematician)
qint64 Value
The amount in milli seconds.
Contains functions used for formatting arguments, such as keywords and paths, in translated strings...
The QDateTime class provides date and time functions.
Represents an item in the XPath 2.0 Data Model.
static bool isEqual(const xsDouble a, const xsDouble b)
Base class for all numeric values.
static bool isRangeValid(const QDate &date, QString &message)
virtual xsInteger toInteger() const =0
static QString divZeroInvalid()
const AtomicMathematician::Ptr m_mather
virtual Item calculate(const Item &o1, const Operator op, const Item &o2, const QExplicitlySharedDataPointer< DynamicContext > &context) const
static qreal toDouble(const QChar *&str)
virtual Item calculate(const Item &operand1, const Operator op, const Item &operand2, const QExplicitlySharedDataPointer< DynamicContext > &context) const =0
Q_CORE_EXPORT bool qIsInf(double d)
Returns true if the double {d} is equivalent to infinity.