bool AtomicValue::evaluateEBV(const QExplicitlySharedDataPointer<DynamicContext> &context) const { context->error(QtXmlPatterns::tr("A value of type %1 cannot have an " "Effective Boolean Value.") .arg(formatType(context->namePool(), type())), ReportContext::FORG0006, QSourceLocation()); return false; /* Silence GCC warning. */ }
Item DurationNumericMathematician::calculate(const Item &o1, const Operator op, const Item &o2, const QExplicitlySharedDataPointer<DynamicContext> &context) const { Q_ASSERT(op == Div || op == Multiply); const AbstractDuration::Ptr duration(o1.as<AbstractDuration>()); const xsDouble dbl = o2.as<Numeric>()->toDouble(); switch(op) { case Div: { if(qIsInf(dbl)) return duration->fromValue(0); else if(qIsNaN(dbl)) { context->error(QtXmlPatterns::tr( "Dividing a value of type %1 by %2 (not-a-number) " "is not allowed.") .arg(formatType(context->namePool(), duration->type())) .arg(formatData("NaN")), ReportContext::FOCA0005, this); return Item(); } else if(Double::isEqual(dbl, 0)) { context->error(QtXmlPatterns::tr( "Dividing a value of type %1 by %2 or %3 (plus or " "minus zero) is not allowed.") .arg(formatType(context->namePool(), duration->type())) .arg(formatData("-0")) .arg(formatData("0")), ReportContext::FODT0002, this); return Item(); } return duration->fromValue(static_cast<AbstractDuration::Value>(duration->value() / dbl)); } case Multiply: { if(Double::isEqual(dbl, 0)) return duration->fromValue(0); else if(qIsNaN(dbl)) { context->error(QtXmlPatterns::tr( "Dividing a value of type %1 by %2 (not-a-number) " "is not allowed.") .arg(formatType(context->namePool(), duration->type())) .arg(formatData("NaN")), ReportContext::FOCA0005, this); return Item(); } else if(qIsInf(dbl)) { context->error(QtXmlPatterns::tr( "Multiplication of a value of type %1 by %2 or %3 " "(plus or minus infinity) is not allowed.") .arg(formatType(context->namePool(), duration->type())) .arg(formatData("-INF")) .arg(formatData("INF")), ReportContext::FODT0002, this); return Item(); } return duration->fromValue(static_cast<AbstractDuration::Value>(duration->value() * dbl)); } default: { Q_ASSERT(false); return Item(); /* Silence warning. */ } } }
Item StringToHexBinaryCaster::castFrom(const Item &from, const QExplicitlySharedDataPointer<DynamicContext> &context) const { return HexBinary::fromLexical(context->namePool(), from.stringValue()); }