48 template <AtomicComparator::Operator oper, AtomicComparator::ComparisonResult result>
52 const Item &newVal)
const 60 if(!(BuiltinTypes::numeric->xdtTypeMatches(to) && BuiltinTypes::numeric->xdtTypeMatches(tn)))
73 template <AtomicComparator::Operator oper, AtomicComparator::ComparisonResult result>
96 if(BuiltinTypes::xsUntypedAtomic->xdtTypeMatches(t1))
98 next =
cast(next, context);
109 comp = fetchComparator(largest.type(), t1, context);
118 if(comp->compare(next, operatorID(), largest) == result)
120 largest = applyNumericPromotion(largest, next, next);
129 return CommonValues::DoubleNaN;
135 return CommonValues::DoubleNaN;
139 largest =
it->next();
145 return CommonValues::DoubleNaN;
146 else if(BuiltinTypes::xsUntypedAtomic->xdtTypeMatches(tf))
149 cast(largest, context);
150 return CommonValues::DoubleNaN;
152 else if(!BuiltinTypes::numeric->xdtTypeMatches(tf))
157 largest =
it->next();
160 return CommonValues::FloatNaN;
163 largest = applyNumericPromotion(largest, next, largest);
167 template <AtomicComparator::Operator oper, AtomicComparator::ComparisonResult result>
172 Q_ASSERT(oper == AtomicComparator::OperatorGreaterThan ||
173 oper == AtomicComparator::OperatorLessThan);
176 ItemType::Ptr t1(m_operands.first()->staticType()->itemType());
178 if(*CommonSequenceTypes::Empty == *t1)
181 BuiltinTypes::numeric->xdtTypeMatches(t1))
183 else if(BuiltinTypes::xsUntypedAtomic->xdtTypeMatches(t1))
187 t1 = m_operands.first()->staticType()->itemType();
189 else if(!BuiltinTypes::xsString->xdtTypeMatches(t1) &&
194 !BuiltinTypes::xsDateTime->xdtTypeMatches(t1) &&
195 !BuiltinTypes::xsYearMonthDuration->xdtTypeMatches(t1))
197 context->error(QtXmlPatterns::tr(
"The first argument to %1 cannot be of type %2.")
199 .arg(
formatType(context->namePool(), m_operands.first()->staticType())),
200 ReportContext::FORG0006,
this);
204 if(!m_operands.first()->staticType()->cardinality().allowsMany())
205 return m_operands.first();
#define it(className, varName)
virtual xsFloat toDecimal() const =0
xsAnyAtomicType numeric xsDuration xsAnyAtomicType xsTime
QString formatType(const NamePool::Ptr &np, const T &type)
Formats ItemType and SequenceType.
static Expression::Ptr create(Expression *const expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
Item toItem(const QExplicitlySharedDataPointer< T > atomicValue)
static QString formatFunction(const NamePool::Ptr &np, const FunctionSignature::Ptr &func)
Formats FunctionSignature.
xsAnyAtomicType numeric xsDuration xsDate
Base class for the implementations of the fn:min() and fn:max() function.
QExplicitlySharedDataPointer< ItemType > type() const
Returns the ItemType this Item is of.
The Item is the most basic of all visual items in QML.
Represents an item in the XPath 2.0 Data Model.
Base class for all numeric values.
virtual xsDouble toDouble() const =0
Casts every item in a sequence obtained from evaluating an Expression, to a requested atomic type...
xsAnyAtomicType numeric xsDayTimeDuration