Qt 4.8
qatomiccomparatorlocators.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtXmlPatterns module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "qatomiccomparators_p.h"
43 
45 
47 
48 using namespace QPatternist;
49 
55 /* --------------------------------------------------------------- */
56 #define addVisitor(owner, type, comp, validOps) \
57 AtomicTypeVisitorResult::Ptr \
58 owner##ComparatorLocator::visit(const type *, \
59  const qint16 op, \
60  const SourceLocationReflection *const) const \
61 { \
62  /* Note the extra paranteses around validOps. */ \
63  if(((validOps) & AtomicComparator::Operator(op)) == op) \
64  return AtomicTypeVisitorResult::Ptr(new comp()); \
65  else \
66  return AtomicTypeVisitorResult::Ptr(); \
67 }
68 /* --------------------------------------------------------------- */
69 #define visitorForDouble(owner, type) \
70 AtomicTypeVisitorResult::Ptr \
71 owner##ComparatorLocator::visit(const type *, \
72  const qint16 op, \
73  const SourceLocationReflection *const) const \
74 { \
75  if(((AtomicComparator::OperatorNotEqual | \
76  AtomicComparator::OperatorGreaterOrEqual | \
77  AtomicComparator::OperatorLessOrEqual) & AtomicComparator::Operator(op)) == op) \
78  return AtomicTypeVisitorResult::Ptr(new AbstractFloatComparator()); \
79  else if(op == AtomicComparator::OperatorLessThanNaNLeast) \
80  return AtomicTypeVisitorResult::Ptr(new AbstractFloatSortComparator<AtomicComparator::OperatorLessThanNaNLeast>()); \
81  else if(op == AtomicComparator::OperatorLessThanNaNGreatest) \
82  return AtomicTypeVisitorResult::Ptr(new AbstractFloatSortComparator<AtomicComparator::OperatorLessThanNaNGreatest>()); \
83  else \
84  return AtomicTypeVisitorResult::Ptr(); \
85 }
86 /* --------------------------------------------------------------- */
87 
88 /* ----------- xs:string, xs:anyURI, xs:untypedAtomic ----------- */
93 addVisitor(String, AnyURIType, StringComparator,
95 /* --------------------------------------------------------------- */
96 
97 /* ------------------------- xs:hexBinary ------------------------ */
99  AtomicComparator::OperatorEqual |
100  AtomicComparator::OperatorNotEqual)
101 /* --------------------------------------------------------------- */
102 
103 /* ----------------------- xs:base64Binary ----------------------- */
104 addVisitor(Base64Binary, Base64BinaryType, BinaryDataComparator,
105  AtomicComparator::OperatorEqual |
106  AtomicComparator::OperatorNotEqual)
107 /* --------------------------------------------------------------- */
108 
109 /* -------------------------- xs:boolean ------------------------- */
112 /* --------------------------------------------------------------- */
113 
114 /* -------------------------- xs:double -------------------------- */
119 /* --------------------------------------------------------------- */
120 
121 /* --------------------------- xs:float -------------------------- */
126 /* --------------------------------------------------------------- */
127 
128 /* -------------------------- xs:decimal ------------------------- */
130 visitorForDouble(Decimal, FloatType)
133 addVisitor(Decimal, IntegerType, DecimalComparator,
135 /* --------------------------------------------------------------- */
136 
137 /* ------------------------- xs:integer -------------------------- */
139 visitorForDouble(Integer, FloatType)
140 addVisitor(Integer, DecimalType, DecimalComparator,
142 addVisitor(Integer, IntegerType, IntegerComparator,
144 /* --------------------------------------------------------------- */
145 
146 /* -------------------------- xs:QName --------------------------- */
148  AtomicComparator::OperatorEqual |
149  AtomicComparator::OperatorNotEqual)
150 /* --------------------------------------------------------------- */
151 
152 /* -------------------------- xs:gYear --------------------------- */
154  AtomicComparator::OperatorEqual |
155  AtomicComparator::OperatorNotEqual)
156 /* --------------------------------------------------------------- */
157 
158 /* -------------------------- xs:gDay ---------------------------- */
159 addVisitor(GDay, GDayType, AbstractDateTimeComparator,
160  AtomicComparator::OperatorEqual |
161  AtomicComparator::OperatorNotEqual)
162 /* --------------------------------------------------------------- */
163 
164 /* -------------------------- xs:gMonth -------------------------- */
165 addVisitor(GMonth, GMonthType, AbstractDateTimeComparator,
166  AtomicComparator::OperatorEqual |
167  AtomicComparator::OperatorNotEqual)
168 /* --------------------------------------------------------------- */
169 
170 /* ------------------------ xs:gYearMonth ------------------------ */
171 addVisitor(GYearMonth, GYearMonthType, AbstractDateTimeComparator,
172  AtomicComparator::OperatorEqual |
173  AtomicComparator::OperatorNotEqual)
174 /* --------------------------------------------------------------- */
175 
176 /* ------------------------ xs:gMonthDay ------------------------- */
177 addVisitor(GMonthDay, GMonthDayType, AbstractDateTimeComparator,
178  AtomicComparator::OperatorEqual |
179  AtomicComparator::OperatorNotEqual)
180 /* --------------------------------------------------------------- */
181 
182 /* ------------------------ xs:dateTime -------------------------- */
183 addVisitor(DateTime, DateTimeType, AbstractDateTimeComparator,
185 /* --------------------------------------------------------------- */
186 
187 /* -------------------------- xs:time ---------------------------- */
188 addVisitor(SchemaTime, SchemaTimeType, AbstractDateTimeComparator,
190 /* --------------------------------------------------------------- */
191 
192 /* -------------------------- xs:date ---------------------------- */
193 addVisitor(Date, DateType, AbstractDateTimeComparator,
195 /* --------------------------------------------------------------- */
196 
197 /* ------------------------ xs:duration -------------------------- */
199  AtomicComparator::OperatorEqual |
200  AtomicComparator::OperatorNotEqual)
201 addVisitor(Duration, DurationType, AbstractDurationComparator,
202  AtomicComparator::OperatorEqual |
203  AtomicComparator::OperatorNotEqual)
204 addVisitor(Duration, YearMonthDurationType, AbstractDurationComparator,
205  AtomicComparator::OperatorEqual |
206  AtomicComparator::OperatorNotEqual)
207 /* --------------------------------------------------------------- */
208 
209 /* ------------------ xs:dayTimeDuration ------------------------ */
210 addVisitor(DayTimeDuration, DayTimeDurationType, AbstractDurationComparator,
212 addVisitor(DayTimeDuration, DurationType, AbstractDurationComparator,
213  AtomicComparator::OperatorEqual |
214  AtomicComparator::OperatorNotEqual)
215 addVisitor(DayTimeDuration, YearMonthDurationType, AbstractDurationComparator,
216  AtomicComparator::OperatorEqual |
217  AtomicComparator::OperatorNotEqual)
218 /* --------------------------------------------------------------- */
219 
220 /* ------------------- xs:yearMonthDuration --------------------- */
221 addVisitor(YearMonthDuration, DayTimeDurationType, AbstractDurationComparator,
222  AtomicComparator::OperatorEqual |
223  AtomicComparator::OperatorNotEqual)
224 addVisitor(YearMonthDuration, DurationType, AbstractDurationComparator,
225  AtomicComparator::OperatorEqual |
226  AtomicComparator::OperatorNotEqual)
227 addVisitor(YearMonthDuration, YearMonthDurationType, AbstractDurationComparator,
229 /* --------------------------------------------------------------- */
230 #undef addVisitor
231 
Performs case sensitive string comparison between xs:anyUri, xs:string, and xs:untypedAtomic.
Base template class for Float and Double classes.
Implements the type xs:gDay.
Implements the type xs:yearMonthDuration.
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
Implements the value instance of the xs:gYearMonth type.
Definition: qgmonthday_p.h:69
Compares xs:decimal values.
static const AtomicComparator::Operators AllCompOperators(AtomicComparator::OperatorNotEqual|AtomicComparator::OperatorGreaterOrEqual|AtomicComparator::OperatorLessOrEqual|AtomicComparator::OperatorLessThanNaNLeast|AtomicComparator::OperatorLessThanNaNGreatest)
Compares xs:base64Binary and xs:hexBinary values.
Implements the type xs:float.
Implements the value instance of the xs:gYearMonth type.
Definition: qgyearmonth_p.h:69
Implements the type xs:time.
Implements the type xs:integer.
Implements the type xs:untypedAtomic.
Implements the type xs:double.
Implements the value instance of the xs:time type.
Definition: qschematime_p.h:72
Base class for classes responsible of comparing two atomic values.
Implements the value instance of the xs:hexBinary type.
Definition: qhexbinary_p.h:74
Implements the type xs:dateTime.
Compares xs:QName values.
Implements the type xs:dayTimeDuration.
Compares sub-classes of AbstractDuration.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
Compares xs:boolean values.
The namespace for the internal API of QtXmlPatterns.
Implements the value instance of the xs:gMonth type.
Definition: qgmonth_p.h:69
Compares xs:integer values.
#define addVisitor(owner, type, comp, validOps)
Implements the type xs:anyURI.
Implements the type xs:gYearMonth.
Implements the type xs:date.
Implements the value instance of the xs:gYear type.
Definition: qgyear_p.h:69
Implements the value instance of the xs:boolean type.
Definition: qboolean_p.h:69
Implements the value instance of the xs:dayTimeDuration type.
Implements the type xs:decimal.
Implements the type xs:base64Binary.
Implements the value instance of the xs:date type.
Definition: qdate_p.h:69
Implements the type xs:gMonthDay.
Implements the type xs:boolean.
Implements the value instance of the xs:duration type.
Definition: qduration_p.h:69
Implements the value instance of the xs:yearMonthDuration type.
Implements the value instance of the xs:decimal type.
Definition: qdecimal_p.h:76
Implements the value instance of the xs:integer type.
Definition: qinteger_p.h:70
Implements the type xs:hexBinary.
Implements the value instance of the xs:dateTime type.
#define visitorForDouble(owner, type)
Contains AtomicComparatorLocator sub-classes that finds classes which can compare atomic values...
The QFlags class provides a type-safe way of storing OR-combinations of enum values.
Definition: qglobal.h:2313
Compares sub-classes of AbstractDateTime.
Implements the value instance of the xs:base64Binary type.
Implements the type xs:duration.
Implements the value instance of the xs:gDay type.
Definition: qgday_p.h:69
Implements the type xs:gYear.
Implements the type xs:QName.
Implements the type xs:gMonth.
Contains all the classes implementing comparisons between atomic values.