| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 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 The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/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 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | // |
| 41 | // W A R N I N G |
| 42 | // ------------- |
| 43 | // |
| 44 | // This file is not part of the Qt API. It exists purely as an |
| 45 | // implementation detail. This header file may change from version to |
| 46 | // version without notice, or even be removed. |
| 47 | // |
| 48 | // We mean it. |
| 49 | |
| 50 | #ifndef Patternist_ContextFNs_H |
| 51 | #define Patternist_ContextFNs_H |
| 52 | |
| 53 | #include <private/qfunctioncall_p.h> |
| 54 | |
| 55 | /** |
| 56 | * @file |
| 57 | * @short Contains classes implementing the functions found in |
| 58 | * <a href="http://www.w3.org/TR/xpath-functions/#context">XQuery 1.0 and |
| 59 | * XPath 2.0 Functions and Operators, 16 Context Functions</a>. |
| 60 | * |
| 61 | * @ingroup Patternist_functions |
| 62 | */ |
| 63 | |
| 64 | QT_BEGIN_NAMESPACE |
| 65 | |
| 66 | namespace QPatternist |
| 67 | { |
| 68 | /** |
| 69 | * @short Implements the function <tt>fn:position()</tt>. |
| 70 | * |
| 71 | * @see <a href="http://www.w3.org/TR/xpath-functions/#func-position">XQuery 1.0 |
| 72 | * and XPath 2.0 Functions and Operators, 16.1 fn:position</a> |
| 73 | * @ingroup Patternist_functions |
| 74 | * @author Frans Englich <frans.englich@nokia.com> |
| 75 | */ |
| 76 | class PositionFN : public FunctionCall |
| 77 | { |
| 78 | public: |
| 79 | virtual Item evaluateSingleton(const DynamicContext::Ptr &context) const; |
| 80 | }; |
| 81 | |
| 82 | /** |
| 83 | * @short Implements the function <tt>fn:last()</tt>. |
| 84 | * |
| 85 | * @see <a href="http://www.w3.org/TR/xpath-functions/#func-last">XQuery 1.0 |
| 86 | * and XPath 2.0 Functions and Operators, 16.2 fn:last</a> |
| 87 | * @ingroup Patternist_functions |
| 88 | * @author Frans Englich <frans.englich@nokia.com> |
| 89 | */ |
| 90 | class LastFN : public FunctionCall |
| 91 | { |
| 92 | public: |
| 93 | virtual Item evaluateSingleton(const DynamicContext::Ptr &context) const; |
| 94 | }; |
| 95 | |
| 96 | /** |
| 97 | * @short Implements the function <tt>fn:implicit-timezone()</tt>. |
| 98 | * |
| 99 | * @see <a href="http://www.w3.org/TR/xpath-functions/#func-implicit-timezone">XQuery 1.0 |
| 100 | * and XPath 2.0 Functions and Operators, 16.6 fn:implicit-timezone</a> |
| 101 | * @ingroup Patternist_functions |
| 102 | * @author Frans Englich <frans.englich@nokia.com> |
| 103 | */ |
| 104 | class ImplicitTimezoneFN : public FunctionCall |
| 105 | { |
| 106 | public: |
| 107 | virtual Item evaluateSingleton(const DynamicContext::Ptr &context) const; |
| 108 | }; |
| 109 | |
| 110 | /** |
| 111 | * @short Implements the function <tt>fn:current-dateTime()</tt>. |
| 112 | * |
| 113 | * @see <a href="http://www.w3.org/TR/xpath-functions/#func-current-dateTime">XQuery 1.0 |
| 114 | * and XPath 2.0 Functions and Operators, 16.3 fn:current-dateTime</a> |
| 115 | * @ingroup Patternist_functions |
| 116 | * @author Frans Englich <frans.englich@nokia.com> |
| 117 | */ |
| 118 | class CurrentDateTimeFN : public FunctionCall |
| 119 | { |
| 120 | public: |
| 121 | virtual Item evaluateSingleton(const DynamicContext::Ptr &context) const; |
| 122 | }; |
| 123 | |
| 124 | /** |
| 125 | * @short Implements the function <tt>fn:current-date()</tt>. |
| 126 | * |
| 127 | * @see <a href="http://www.w3.org/TR/xpath-functions/#func-current-date">XQuery 1.0 |
| 128 | * and XPath 2.0 Functions and Operators, 16.4 fn:current-date</a> |
| 129 | * @ingroup Patternist_functions |
| 130 | * @author Frans Englich <frans.englich@nokia.com> |
| 131 | */ |
| 132 | class CurrentDateFN : public FunctionCall |
| 133 | { |
| 134 | public: |
| 135 | virtual Item evaluateSingleton(const DynamicContext::Ptr &context) const; |
| 136 | }; |
| 137 | |
| 138 | /** |
| 139 | * @short Implements the function <tt>fn:current-time()</tt>. |
| 140 | * |
| 141 | * @see <a href="http://www.w3.org/TR/xpath-functions/#func-current-time">XQuery 1.0 |
| 142 | * and XPath 2.0 Functions and Operators, 16.5 fn:current-date</a> |
| 143 | * @ingroup Patternist_functions |
| 144 | * @author Frans Englich <frans.englich@nokia.com> |
| 145 | */ |
| 146 | class CurrentTimeFN : public FunctionCall |
| 147 | { |
| 148 | public: |
| 149 | virtual Item evaluateSingleton(const DynamicContext::Ptr &context) const; |
| 150 | }; |
| 151 | |
| 152 | /** |
| 153 | * @short Implements the function <tt>fn:default-collation()</tt>. |
| 154 | * |
| 155 | * This is done by rewriting to StaticContext::defaultCollation() at the typeCheck() stage. |
| 156 | * |
| 157 | * @see <a href="http://www.w3.org/TR/xpath-functions/#func-default-collation">XQuery 1.0 |
| 158 | * and XPath 2.0 Functions and Operators, 16.7 fn:default-collation</a> |
| 159 | * @ingroup Patternist_functions |
| 160 | * @author Frans Englich <frans.englich@nokia.com> |
| 161 | */ |
| 162 | class DefaultCollationFN : public FunctionCall |
| 163 | { |
| 164 | public: |
| 165 | virtual Expression::Ptr typeCheck(const StaticContext::Ptr &context, |
| 166 | const SequenceType::Ptr &reqType); |
| 167 | }; |
| 168 | |
| 169 | /** |
| 170 | * @short Implements the function <tt>fn:static-base-uri()</tt>. |
| 171 | * |
| 172 | * This is done by rewriting to StaticContext::baseURI() at the typeCheck() stage. |
| 173 | * |
| 174 | * @see <a href="http://www.w3.org/TR/xpath-functions/#func-static-base-uri">XQuery 1.0 |
| 175 | * and XPath 2.0 Functions and Operators, 16.8 fn:static-base-uri</a> |
| 176 | * @ingroup Patternist_functions |
| 177 | * @author Frans Englich <frans.englich@nokia.com> |
| 178 | */ |
| 179 | class StaticBaseURIFN : public FunctionCall |
| 180 | { |
| 181 | public: |
| 182 | virtual Expression::Ptr typeCheck(const StaticContext::Ptr &context, |
| 183 | const SequenceType::Ptr &reqType); |
| 184 | }; |
| 185 | } |
| 186 | |
| 187 | QT_END_NAMESPACE |
| 188 | |
| 189 | #endif |
| 190 | |