48 template <
typename TSubClass,
bool issueError,
49 AtomicComparator::ComparisonType comparisonType, ReportContext::ErrorCode errorCode>
50 bool ComparisonPlatform<TSubClass, issueError, comparisonType, errorCode>::
51 flexibleCompare(
const Item &it1,
57 return compare(it1, it2, m_comparator, operatorID());
64 return cp ?
compare(it1, it2, cp, operatorID()) :
false;
68 template <
typename TSubClass,
bool issueError,
82 comp = fetchComparator(it1.
type(),
87 Q_ASSERT_X(operatorID() == AtomicComparator::OperatorLessThanNaNLeast || operatorID() == AtomicComparator::OperatorLessThanNaNGreatest,
88 Q_FUNC_INFO,
"Only OperatorLessThan is currently supported for this function.");
89 return comp->compare(it1, operatorID(), it2);
92 template <
typename TSubClass,
bool issueError,
106 case AtomicComparator::OperatorEqual:
107 return comp->equals(oand1, oand2);
108 case AtomicComparator::OperatorNotEqual:
109 return !comp->equals(oand1, oand2);
110 case AtomicComparator::OperatorLessThanNaNLeast:
111 case AtomicComparator::OperatorLessThanNaNGreatest:
113 case AtomicComparator::OperatorLessThan:
115 case AtomicComparator::OperatorGreaterThan:
116 return comp->compare(oand1, op, oand2) == AtomicComparator::GreaterThan;
117 case AtomicComparator::OperatorLessOrEqual:
122 case(AtomicComparator::OperatorGreaterOrEqual):
134 template <
typename TSubClass,
bool issueError,
146 *BuiltinTypes::item == *t1 ||
147 *BuiltinTypes::item == *t2 ||
148 *BuiltinTypes::numeric == *t1 ||
149 *BuiltinTypes::numeric == *t2 ||
150 *CommonSequenceTypes::Empty == *t1 ||
151 *CommonSequenceTypes::Empty == *t2)
161 (static_cast<const AtomicType *>(t1.
data())->comparatorLocator());
167 context->error(QtXmlPatterns::tr(
"No comparisons can be done involving the type %1.")
169 errorCode,
static_cast<const TSubClass *
>(
this)->actualReflection());
175 static_cast<const TSubClass *
>(
this)->actualReflection()));
181 context->error(QtXmlPatterns::tr(
"Operator %1 is not available between atomic values of type %2 and %3.")
182 .arg(
formatKeyword(AtomicComparator::displayName(operatorID(),
186 errorCode,
static_cast<const TSubClass *
>(
this)->actualReflection());
192 template <
typename TSubClass,
bool issueError,
static QString formatKeyword(const VariableDeclaration::Ptr &var, const NamePool::Ptr &np)
Formats var appropriately for display.
QString formatType(const NamePool::Ptr &np, const T &type)
Formats ItemType and SequenceType.
T * data() const
Returns a pointer to the shared data object.
static bool compare(const QVariant::Private *a, const QVariant::Private *b)
Compares a to b.
QExplicitlySharedDataPointer< ItemType > type() const
Returns the ItemType this Item is of.
#define Q_ASSERT_X(cond, where, what)
Represents an item in the XPath 2.0 Data Model.