1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** Contact: Qt Software Information ([email protected])
|
---|
5 | **
|
---|
6 | ** This file is part of the QtXmlPatterns module of the Qt Toolkit.
|
---|
7 | **
|
---|
8 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
9 | ** Commercial Usage
|
---|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
11 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
12 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
13 | ** a written agreement between you and Nokia.
|
---|
14 | **
|
---|
15 | ** GNU Lesser General Public License Usage
|
---|
16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
17 | ** General Public License version 2.1 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
19 | ** packaging of this file. Please review the following information to
|
---|
20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
22 | **
|
---|
23 | ** In addition, as a special exception, Nokia gives you certain
|
---|
24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
---|
25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
---|
26 | ** package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you are unsure which license is appropriate for your use, please
|
---|
37 | ** contact the sales department at [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | #include "qanyuri_p.h"
|
---|
43 | #include "qatomizer_p.h"
|
---|
44 | #include "qbuiltintypes_p.h"
|
---|
45 | #include "qcardinalityverifier_p.h"
|
---|
46 | #include "qcommonsequencetypes_p.h"
|
---|
47 | #include "qcommonvalues_p.h"
|
---|
48 | #include "qemptysequence_p.h"
|
---|
49 | #include "qcommonnamespaces_p.h"
|
---|
50 | #include "qxmlname.h"
|
---|
51 | #include "qatomicstring_p.h"
|
---|
52 |
|
---|
53 | /* Functions */
|
---|
54 | #include "qaccessorfns_p.h"
|
---|
55 | #include "qaggregatefns_p.h"
|
---|
56 | #include "qassemblestringfns_p.h"
|
---|
57 | #include "qbooleanfns_p.h"
|
---|
58 | #include "qcomparestringfns_p.h"
|
---|
59 | #include "qcomparingaggregator_p.h"
|
---|
60 | #include "qcontextfns_p.h"
|
---|
61 | #include "qdatetimefn_p.h"
|
---|
62 | #include "qdatetimefns_p.h"
|
---|
63 | #include "qdeepequalfn_p.h"
|
---|
64 | #include "qerrorfn_p.h"
|
---|
65 | #include "qnodefns_p.h"
|
---|
66 | #include "qnumericfns_p.h"
|
---|
67 | #include "qpatternmatchingfns_p.h"
|
---|
68 | #include "qqnamefns_p.h"
|
---|
69 | #include "qresolveurifn_p.h"
|
---|
70 | #include "qsequencefns_p.h"
|
---|
71 | #include "qsequencegeneratingfns_p.h"
|
---|
72 | #include "qstringvaluefns_p.h"
|
---|
73 | #include "qsubstringfns_p.h"
|
---|
74 | #include "qtimezonefns_p.h"
|
---|
75 | #include "qtracefn_p.h"
|
---|
76 |
|
---|
77 | #include "qxpath20corefunctions_p.h"
|
---|
78 |
|
---|
79 | QT_BEGIN_NAMESPACE
|
---|
80 |
|
---|
81 | using namespace QPatternist;
|
---|
82 |
|
---|
83 | Expression::Ptr XPath20CoreFunctions::retrieveExpression(const QXmlName name,
|
---|
84 | const Expression::List &args,
|
---|
85 | const FunctionSignature::Ptr &sign) const
|
---|
86 | {
|
---|
87 | Q_ASSERT(sign);
|
---|
88 |
|
---|
89 | Expression::Ptr fn;
|
---|
90 | #define testFN(ln, cname) else if(name.localName() == StandardLocalNames::ln) fn = Expression::Ptr(new cname())
|
---|
91 |
|
---|
92 | if(false) /* Dummy for the macro handling. Will be optimized away anyway. */
|
---|
93 | return Expression::Ptr();
|
---|
94 | /* Alphabetic order. */
|
---|
95 | testFN(QName, QNameFN);
|
---|
96 | testFN(abs, AbsFN);
|
---|
97 | testFN(adjust_date_to_timezone, AdjustDateToTimezoneFN);
|
---|
98 | testFN(adjust_dateTime_to_timezone, AdjustDateTimeToTimezoneFN);
|
---|
99 | testFN(adjust_time_to_timezone, AdjustTimeToTimezoneFN);
|
---|
100 | testFN(avg, AvgFN);
|
---|
101 | testFN(base_uri, BaseURIFN);
|
---|
102 | testFN(codepoint_equal, CodepointEqualFN);
|
---|
103 | testFN(codepoints_to_string, CodepointsToStringFN);
|
---|
104 | testFN(collection, CollectionFN);
|
---|
105 | testFN(compare, CompareFN);
|
---|
106 | testFN(current_date, CurrentDateFN);
|
---|
107 | testFN(current_dateTime, CurrentDateTimeFN);
|
---|
108 | testFN(current_time, CurrentTimeFN);
|
---|
109 | testFN(dateTime, DateTimeFN);
|
---|
110 | testFN(day_from_date, DayFromAbstractDateTimeFN);
|
---|
111 | testFN(day_from_dateTime, DayFromAbstractDateTimeFN);
|
---|
112 | testFN(days_from_duration, DaysFromDurationFN);
|
---|
113 | testFN(deep_equal, DeepEqualFN);
|
---|
114 | testFN(default_collation, DefaultCollationFN);
|
---|
115 | testFN(distinct_values, DistinctValuesFN);
|
---|
116 | testFN(doc, DocFN);
|
---|
117 | testFN(doc_available, DocAvailableFN);
|
---|
118 | testFN(document_uri, DocumentURIFN);
|
---|
119 | testFN(empty, Existence<Expression::IDEmptyFN>);
|
---|
120 | testFN(encode_for_uri, EncodeForURIFN);
|
---|
121 | testFN(ends_with, EndsWithFN);
|
---|
122 | testFN(error, ErrorFN);
|
---|
123 | testFN(escape_html_uri, EscapeHtmlURIFN);
|
---|
124 | testFN(exists, Existence<Expression::IDExistsFN>);
|
---|
125 | testFN(hours_from_dateTime, HoursFromAbstractDateTimeFN);
|
---|
126 | testFN(hours_from_duration, HoursFromDurationFN);
|
---|
127 | testFN(hours_from_time, HoursFromAbstractDateTimeFN);
|
---|
128 | testFN(idref, IdrefFN);
|
---|
129 | testFN(implicit_timezone, ImplicitTimezoneFN);
|
---|
130 | testFN(in_scope_prefixes, InScopePrefixesFN);
|
---|
131 | testFN(index_of, IndexOfFN);
|
---|
132 | testFN(insert_before, InsertBeforeFN);
|
---|
133 | testFN(iri_to_uri, IriToURIFN);
|
---|
134 | testFN(local_name_from_QName, LocalNameFromQNameFN);
|
---|
135 | testFN(lower_case, LowerCaseFN);
|
---|
136 | testFN(matches, MatchesFN);
|
---|
137 | testFN(max, MaxFN);
|
---|
138 | testFN(min, MinFN);
|
---|
139 | testFN(minutes_from_dateTime, MinutesFromAbstractDateTimeFN);
|
---|
140 | testFN(minutes_from_duration, MinutesFromDurationFN);
|
---|
141 | testFN(minutes_from_time, MinutesFromAbstractDateTimeFN);
|
---|
142 | testFN(month_from_date, MonthFromAbstractDateTimeFN);
|
---|
143 | testFN(month_from_dateTime, MonthFromAbstractDateTimeFN);
|
---|
144 | testFN(months_from_duration, MonthsFromDurationFN);
|
---|
145 | testFN(namespace_uri_for_prefix, NamespaceURIForPrefixFN);
|
---|
146 | testFN(namespace_uri_from_QName, NamespaceURIFromQNameFN);
|
---|
147 | testFN(nilled, NilledFN);
|
---|
148 | testFN(node_name, NodeNameFN);
|
---|
149 | testFN(normalize_unicode, NormalizeUnicodeFN);
|
---|
150 | testFN(prefix_from_QName, PrefixFromQNameFN);
|
---|
151 | testFN(remove, RemoveFN);
|
---|
152 | testFN(replace, ReplaceFN);
|
---|
153 | testFN(resolve_QName, ResolveQNameFN);
|
---|
154 | testFN(resolve_uri, ResolveURIFN);
|
---|
155 | testFN(generic_string_join, StringJoinFN);
|
---|
156 | testFN(reverse, ReverseFN);
|
---|
157 | testFN(root, RootFN);
|
---|
158 | testFN(round_half_to_even, RoundHalfToEvenFN);
|
---|
159 | testFN(seconds_from_dateTime, SecondsFromAbstractDateTimeFN);
|
---|
160 | testFN(seconds_from_duration, SecondsFromDurationFN);
|
---|
161 | testFN(seconds_from_time, SecondsFromAbstractDateTimeFN);
|
---|
162 | testFN(static_base_uri, StaticBaseURIFN);
|
---|
163 | testFN(string_join, StringJoinFN);
|
---|
164 | testFN(string_to_codepoints, StringToCodepointsFN);
|
---|
165 | testFN(subsequence, SubsequenceFN);
|
---|
166 | testFN(timezone_from_date, TimezoneFromAbstractDateTimeFN);
|
---|
167 | testFN(timezone_from_dateTime, TimezoneFromAbstractDateTimeFN);
|
---|
168 | testFN(timezone_from_time, TimezoneFromAbstractDateTimeFN);
|
---|
169 | testFN(tokenize, TokenizeFN);
|
---|
170 | testFN(trace, TraceFN);
|
---|
171 | testFN(upper_case, UpperCaseFN);
|
---|
172 | testFN(year_from_date, YearFromAbstractDateTimeFN);
|
---|
173 | testFN(year_from_dateTime, YearFromAbstractDateTimeFN);
|
---|
174 | testFN(years_from_duration, YearsFromDurationFN);
|
---|
175 | #undef testFN
|
---|
|
---|