Qt 4.8
qatomicmathematicianlocators.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 
45 
47 
48 using namespace QPatternist;
49 
50 #define implMathVisit(ownerClass, visitor, mather, validOps) \
51 AtomicTypeVisitorResult::Ptr \
52 ownerClass##MathematicianLocator::visit(const visitor *, const qint16 op, \
53  const SourceLocationReflection *const r) const \
54 { \
55  Q_UNUSED(r) \
56  /* Note the extra paranteses around validOps. */ \
57  if(((validOps) & AtomicMathematician::Operator(op)) == op) \
58  return AtomicTypeVisitorResult::Ptr(new mather()); \
59  else \
60  return AtomicTypeVisitorResult::Ptr(); \
61 }
62 
63 #define implReportingMathVisit(ownerClass, visitor, mather, validOps) \
64 AtomicTypeVisitorResult::Ptr \
65 ownerClass##MathematicianLocator::visit(const visitor *, const qint16 op, \
66  const SourceLocationReflection *const r) const \
67 { \
68  /* Note the extra paranteses around validOps. */ \
69  if(((validOps) & AtomicMathematician::Operator(op)) == op) \
70  return AtomicTypeVisitorResult::Ptr(new mather(r)); \
71  else \
72  return AtomicTypeVisitorResult::Ptr(); \
73 }
74 
75 #define implRevReportingMathVisit(ownerClass, visitor, mather, validOps) \
76 AtomicTypeVisitorResult::Ptr \
77 ownerClass##MathematicianLocator::visit(const visitor *, const qint16 op, \
78  const SourceLocationReflection *const r) const \
79 { \
80  /* Note the extra paranteses around validOps. */ \
81  if(((validOps) & AtomicMathematician::Operator(op)) == op) \
82  return AtomicTypeVisitorResult::Ptr(new OperandSwitcherMathematician( \
83  AtomicMathematician::Ptr(new mather(r)))); \
84  else \
85  return AtomicTypeVisitorResult::Ptr(); \
86 }
87 
94 
97 
101 
104 
107 implReportingMathVisit(Double, FloatType, DoubleMathematician, AllMathOperators)
110 implRevReportingMathVisit(Double, DayTimeDurationType, DurationNumericMathematician, AtomicMathematician::Multiply)
111 
113 implReportingMathVisit(Float, DoubleType, DoubleMathematician, AllMathOperators)
114 implReportingMathVisit(Float, FloatType, FloatMathematician, AllMathOperators)
115 implReportingMathVisit(Float, IntegerType, FloatMathematician, AllMathOperators)
116 implRevReportingMathVisit(Float, YearMonthDurationType, DurationNumericMathematician, AtomicMathematician::Multiply)
117 implRevReportingMathVisit(Float, DayTimeDurationType, DurationNumericMathematician, AtomicMathematician::Multiply)
118 
120 implReportingMathVisit(Decimal, DoubleType, DoubleMathematician, AllMathOperators)
121 implReportingMathVisit(Decimal, FloatType, FloatMathematician, AllMathOperators)
122 implReportingMathVisit(Decimal, IntegerType, DecimalMathematician, AllMathOperators)
123 implRevReportingMathVisit(Decimal, YearMonthDurationType, DurationNumericMathematician, AtomicMathematician::Multiply)
124 implRevReportingMathVisit(Decimal, DayTimeDurationType, DurationNumericMathematician, AtomicMathematician::Multiply)
125 
126 implReportingMathVisit(Integer, DecimalType, DecimalMathematician, AllMathOperators)
127 implReportingMathVisit(Integer, DoubleType, DoubleMathematician, AllMathOperators)
128 implReportingMathVisit(Integer, FloatType, FloatMathematician, AllMathOperators)
130 implRevReportingMathVisit(Integer, YearMonthDurationType, DurationNumericMathematician, AtomicMathematician::Multiply)
131 implRevReportingMathVisit(Integer, DayTimeDurationType, DurationNumericMathematician, AtomicMathematician::Multiply)
132 
134 implRevReportingMathVisit(DayTimeDuration, DateType, DateTimeDurationMathematician, AtomicMathematician::Add)
135 implMathVisit(DayTimeDuration, DayTimeDurationType, DurationDurationMathematician, DurationOps)
136 implReportingMathVisit(DayTimeDuration, DecimalType, DurationNumericMathematician, DivMultiply)
137 implReportingMathVisit(DayTimeDuration, DoubleType, DurationNumericMathematician, DivMultiply)
138 implReportingMathVisit(DayTimeDuration, FloatType, DurationNumericMathematician, DivMultiply)
139 implReportingMathVisit(DayTimeDuration, IntegerType, DurationNumericMathematician, DivMultiply)
140 implRevReportingMathVisit(DayTimeDuration, SchemaTimeType, DateTimeDurationMathematician, AtomicMathematician::Add)
141 
142 implRevReportingMathVisit(YearMonthDuration, DateTimeType, DateTimeDurationMathematician, AtomicMathematician::Add)
143 implRevReportingMathVisit(YearMonthDuration, DateType, DateTimeDurationMathematician, AtomicMathematician::Add)
144 implReportingMathVisit(YearMonthDuration, DecimalType, DurationNumericMathematician, DivMultiply)
145 implReportingMathVisit(YearMonthDuration, DoubleType, DurationNumericMathematician, DivMultiply)
146 implReportingMathVisit(YearMonthDuration, FloatType, DurationNumericMathematician, DivMultiply)
147 implReportingMathVisit(YearMonthDuration, IntegerType, DurationNumericMathematician, DivMultiply)
148 implMathVisit(YearMonthDuration, YearMonthDurationType, DurationDurationMathematician, DurationOps)
149 
151  AtomicMathematician::Substract)
152 implReportingMathVisit(Date, YearMonthDurationType, DateTimeDurationMathematician, DTOps)
153 implReportingMathVisit(Date, DayTimeDurationType, DateTimeDurationMathematician, DTOps)
154 
155 implMathVisit(SchemaTime, SchemaTimeType, AbstractDateTimeMathematician,
156  AtomicMathematician::Substract)
157 implReportingMathVisit(SchemaTime, DayTimeDurationType, DateTimeDurationMathematician, DTOps)
158 
159 implMathVisit(DateTime, DateTimeType, AbstractDateTimeMathematician,
160  AtomicMathematician::Substract)
161 implReportingMathVisit(DateTime, YearMonthDurationType, DateTimeDurationMathematician, DTOps)
162 implReportingMathVisit(DateTime, DayTimeDurationType, DateTimeDurationMathematician, DTOps)
163 
164 #undef implMathVisit
165 #undef implReportingMathVisit
166 #undef implRevReportingMathVisit
167 
Base template class for Float and Double classes.
#define implReportingMathVisit(ownerClass, visitor, mather, validOps)
Implements the type xs:yearMonthDuration.
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
static const AtomicMathematician::Operators DTOps(AtomicMathematician::Substract|AtomicMathematician::Add)
Implements the type xs:float.
Implements the type xs:time.
Implements the type xs:integer.
Implements the type xs:double.
Implements the value instance of the xs:time type.
Definition: qschematime_p.h:72
static const AtomicMathematician::Operators DivMultiply(AtomicMathematician::Multiply|AtomicMathematician::Div)
Performs division or multiplication between either DayTimeDuration or YearMonthDuration and Double va...
Implements the type xs:dateTime.
#define implRevReportingMathVisit(ownerClass, visitor, mather, validOps)
Performs arithmetics between two AbstractDateTime values.
Implements the type xs:dayTimeDuration.
Performs arithmetics between Integer values.
static const AtomicMathematician::Operators AllMathOperators(AtomicMathematician::Add|AtomicMathematician::Div|AtomicMathematician::IDiv|AtomicMathematician::Mod|AtomicMathematician::Multiply|AtomicMathematician::Substract)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The namespace for the internal API of QtXmlPatterns.
Implements the type xs:date.
Contains classes performing arithemetic operations between atomic values, such as subtracting two dat...
Implements the value instance of the xs:dayTimeDuration type.
Implements the type xs:decimal.
Performs arithmetics between AbstractFloat values (Float and Double classes).
Implements the value instance of the xs:date type.
Definition: qdate_p.h:69
Performs arithmetics between an AbstractDateTime value and an AbstractDuration value.
Implements the value instance of the xs:yearMonthDuration type.
Implements the value instance of the xs:decimal type.
Definition: qdecimal_p.h:76
Performs arithmetics between DayTimeDuration and DayTimeDuration, or YearMonthDuration and YearMonthD...
Implements the value instance of the xs:integer type.
Definition: qinteger_p.h:70
Implements the value instance of the xs:dateTime type.
The QFlags class provides a type-safe way of storing OR-combinations of enum values.
Definition: qglobal.h:2313
#define implMathVisit(ownerClass, visitor, mather, validOps)
Base class for classes that performs arithmetic operations between atomic values. ...
static const AtomicMathematician::Operators DurationOps(AtomicMathematician::Div|AtomicMathematician::Substract|AtomicMathematician::Add)
Contains AtomicMathematicianLocator sub-classes that finds classes which can perform arithmetics betw...