1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation ([email protected])
|
---|
6 | **
|
---|
7 | ** This file is part of the QtXmlPatterns module of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
10 | ** Commercial Usage
|
---|
11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
14 | ** a written agreement between you and Nokia.
|
---|
15 | **
|
---|
16 | ** GNU Lesser General Public License Usage
|
---|
17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
18 | ** General Public License version 2.1 as published by the Free Software
|
---|
19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
20 | ** packaging of this file. Please review the following information to
|
---|
21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
23 | **
|
---|
24 | ** In addition, as a special exception, Nokia gives you certain additional
|
---|
25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
---|
26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this 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 have questions regarding the use of this file, please contact
|
---|
37 | ** Nokia at [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | #include "qxsdschemachecker_p.h"
|
---|
43 |
|
---|
44 | QT_BEGIN_NAMESPACE
|
---|
45 |
|
---|
46 | using namespace QPatternist;
|
---|
47 |
|
---|
48 | void XsdSchemaChecker::setupAllowedAtomicFacets()
|
---|
49 | {
|
---|
50 | // string
|
---|
51 | {
|
---|
52 | QSet<XsdFacet::Type> facets;
|
---|
53 | facets << XsdFacet::Length
|
---|
54 | << XsdFacet::MinimumLength
|
---|
55 | << XsdFacet::MaximumLength
|
---|
56 | << XsdFacet::Pattern
|
---|
57 | << XsdFacet::Enumeration
|
---|
58 | << XsdFacet::WhiteSpace
|
---|
59 | << XsdFacet::Assertion;
|
---|
60 |
|
---|
61 | m_allowedAtomicFacets.insert(BuiltinTypes::xsString->name(m_namePool), facets);
|
---|
62 | }
|
---|
63 |
|
---|
64 | // boolean
|
---|
65 | {
|
---|
66 | QSet<XsdFacet::Type> facets;
|
---|
67 | facets << XsdFacet::Pattern
|
---|
68 | << XsdFacet::WhiteSpace
|
---|
69 | << XsdFacet::Assertion;
|
---|
70 |
|
---|
71 | m_allowedAtomicFacets.insert(BuiltinTypes::xsBoolean->name(m_namePool), facets);
|
---|
72 | }
|
---|
73 |
|
---|
74 | // float
|
---|
75 | {
|
---|
76 | QSet<XsdFacet::Type> facets;
|
---|
77 | facets << XsdFacet::Pattern
|
---|
78 | << XsdFacet::Enumeration
|
---|
79 | << XsdFacet::WhiteSpace
|
---|
80 | << XsdFacet::MaximumInclusive
|
---|
81 | << XsdFacet::MaximumExclusive
|
---|
82 | << XsdFacet::MinimumInclusive
|
---|
83 | << XsdFacet::MinimumExclusive
|
---|
84 | << XsdFacet::Assertion;
|
---|
85 |
|
---|
86 | m_allowedAtomicFacets.insert(BuiltinTypes::xsFloat->name(m_namePool), facets);
|
---|
87 | }
|
---|
88 |
|
---|
89 | // double
|
---|
90 | {
|
---|
91 | QSet<XsdFacet::Type> facets;
|
---|
92 | facets << XsdFacet::Pattern
|
---|
93 | << XsdFacet::Enumeration
|
---|
94 | << XsdFacet::WhiteSpace
|
---|
95 | << XsdFacet::MaximumInclusive
|
---|
96 | << XsdFacet::MaximumExclusive
|
---|
97 | << XsdFacet::MinimumInclusive
|
---|
98 | << XsdFacet::MinimumExclusive
|
---|
99 | << XsdFacet::Assertion;
|
---|
100 |
|
---|
101 | m_allowedAtomicFacets.insert(BuiltinTypes::xsDouble->name(m_namePool), facets);
|
---|
102 | }
|
---|
103 |
|
---|
104 | // decimal
|
---|
105 | {
|
---|
106 | QSet<XsdFacet::Type> facets;
|
---|
107 | facets << XsdFacet::TotalDigits
|
---|
108 | << XsdFacet::FractionDigits
|
---|
109 | << XsdFacet::Pattern
|
---|
110 | << XsdFacet::Enumeration
|
---|
111 | << XsdFacet::WhiteSpace
|
---|
112 | << XsdFacet::MaximumInclusive
|
---|
113 | << XsdFacet::MaximumExclusive
|
---|
114 | << XsdFacet::MinimumInclusive
|
---|
115 | << XsdFacet::MinimumExclusive
|
---|
116 | << XsdFacet::Assertion;
|
---|
117 |
|
---|
118 | m_allowedAtomicFacets.insert(BuiltinTypes::xsDecimal->name(m_namePool), facets);
|
---|
119 | }
|
---|
120 |
|
---|
121 | // duration
|
---|
122 | {
|
---|
123 | QSet<XsdFacet::Type> facets;
|
---|
124 | facets << XsdFacet::Pattern
|
---|
125 | << XsdFacet::Enumeration
|
---|
126 | << XsdFacet::WhiteSpace
|
---|
127 | << XsdFacet::MaximumInclusive
|
---|
128 | << XsdFacet::MaximumExclusive
|
---|
129 | << XsdFacet::MinimumInclusive
|
---|
130 | << XsdFacet::MinimumExclusive
|
---|
131 | << XsdFacet::Assertion;
|
---|
132 |
|
---|
133 | m_allowedAtomicFacets.insert(BuiltinTypes::xsDuration->name(m_namePool), facets);
|
---|
134 | }
|
---|
135 |
|
---|
136 | // dateTime
|
---|
137 | {
|
---|
138 | QSet<XsdFacet::Type> facets;
|
---|
139 | facets << XsdFacet::Pattern
|
---|
140 | << XsdFacet::Enumeration
|
---|
141 | << XsdFacet::WhiteSpace
|
---|
142 | << XsdFacet::MaximumInclusive
|
---|
143 | << XsdFacet::MaximumExclusive
|
---|
144 | << XsdFacet::MinimumInclusive
|
---|
145 | << XsdFacet::MinimumExclusive
|
---|
146 | << XsdFacet::Assertion;
|
---|
147 |
|
---|
148 | m_allowedAtomicFacets.insert(BuiltinTypes::xsDateTime->name(m_namePool), facets);
|
---|
149 | }
|
---|
150 |
|
---|
151 | // time
|
---|
152 | {
|
---|
153 | QSet<XsdFacet::Type> facets;
|
---|
154 | facets << XsdFacet::Pattern
|
---|
155 | << XsdFacet::Enumeration
|
---|
156 | << XsdFacet::WhiteSpace
|
---|
157 | << XsdFacet::MaximumInclusive
|
---|
158 | << XsdFacet::MaximumExclusive
|
---|
159 | << XsdFacet::MinimumInclusive
|
---|
160 | << XsdFacet::MinimumExclusive
|
---|
161 | << XsdFacet::Assertion;
|
---|
162 |
|
---|
163 | m_allowedAtomicFacets.insert(BuiltinTypes::xsTime->name(m_namePool), facets);
|
---|
164 | }
|
---|
165 |
|
---|
166 | // date
|
---|
167 | {
|
---|
168 | QSet<XsdFacet::Type> facets;
|
---|
169 | facets << XsdFacet::Pattern
|
---|
170 | << XsdFacet::Enumeration
|
---|
171 | << XsdFacet::WhiteSpace
|
---|
172 | << XsdFacet::MaximumInclusive
|
---|
173 | << XsdFacet::MaximumExclusive
|
---|
174 | << XsdFacet::MinimumInclusive
|
---|
175 | << XsdFacet::MinimumExclusive
|
---|
176 | << XsdFacet::Assertion;
|
---|
177 |
|
---|
178 | m_allowedAtomicFacets.insert(BuiltinTypes::xsDate->name(m_namePool), facets);
|
---|
179 | }
|
---|
180 |
|
---|
181 | // gYearMonth
|
---|
182 | {
|
---|
183 | QSet<XsdFacet::Type> facets;
|
---|
184 | facets << XsdFacet::Pattern
|
---|
185 | << XsdFacet::Enumeration
|
---|
186 | << XsdFacet::WhiteSpace
|
---|
187 | << XsdFacet::MaximumInclusive
|
---|
188 | << XsdFacet::MaximumExclusive
|
---|
189 | << XsdFacet::MinimumInclusive
|
---|
190 | << XsdFacet::MinimumExclusive
|
---|
191 | << XsdFacet::Assertion;
|
---|
192 |
|
---|
193 | m_allowedAtomicFacets.insert(BuiltinTypes::xsGYearMonth->name(m_namePool), facets);
|
---|
194 | }
|
---|
195 |
|
---|
196 | // gYear
|
---|
197 | {
|
---|
198 | QSet<XsdFacet::Type> facets;
|
---|
199 | facets << XsdFacet::Pattern
|
---|
200 | << XsdFacet::Enumeration
|
---|
201 | << XsdFacet::WhiteSpace
|
---|
202 | << XsdFacet::MaximumInclusive
|
---|
203 | << XsdFacet::MaximumExclusive
|
---|
204 | << XsdFacet::MinimumInclusive
|
---|
205 | << XsdFacet::MinimumExclusive
|
---|
206 | << XsdFacet::Assertion;
|
---|
207 |
|
---|
208 | m_allowedAtomicFacets.insert(BuiltinTypes::xsGYear->name(m_namePool), facets);
|
---|
209 | }
|
---|
210 |
|
---|
211 | // gMonthDay
|
---|
212 | {
|
---|
213 | QSet<XsdFacet::Type> facets;
|
---|
214 | facets << XsdFacet::Pattern
|
---|
215 | << XsdFacet::Enumeration
|
---|
216 | << XsdFacet::WhiteSpace
|
---|
217 | << XsdFacet::MaximumInclusive
|
---|
218 | << XsdFacet::MaximumExclusive
|
---|
219 | << XsdFacet::MinimumInclusive
|
---|
220 | << XsdFacet::MinimumExclusive
|
---|
221 | << XsdFacet::Assertion;
|
---|
222 |
|
---|
223 | m_allowedAtomicFacets.insert(BuiltinTypes::xsGMonthDay->name(m_namePool), facets);
|
---|
224 | }
|
---|
225 |
|
---|
226 | // gDay
|
---|
227 | {
|
---|
228 | QSet<XsdFacet::Type> facets;
|
---|
229 | facets << XsdFacet::Pattern
|
---|
230 | << XsdFacet::Enumeration
|
---|
231 | << XsdFacet::WhiteSpace
|
---|
232 | << XsdFacet::MaximumInclusive
|
---|
233 | << XsdFacet::MaximumExclusive
|
---|
234 | << XsdFacet::MinimumInclusive
|
---|
235 | << XsdFacet::MinimumExclusive
|
---|
236 | << XsdFacet::Assertion;
|
---|
237 |
|
---|
238 | m_allowedAtomicFacets.insert(BuiltinTypes::xsGDay->name(m_namePool), facets);
|
---|
239 | }
|
---|
240 |
|
---|
241 | // gMonth
|
---|
242 | {
|
---|
243 | QSet<XsdFacet::Type> facets;
|
---|
244 | facets << XsdFacet::Pattern
|
---|
245 | << XsdFacet::Enumeration
|
---|
246 | << XsdFacet::WhiteSpace
|
---|
247 | << XsdFacet::MaximumInclusive
|
---|
248 | << XsdFacet::MaximumExclusive
|
---|
249 | << XsdFacet::MinimumInclusive
|
---|
250 | << XsdFacet::MinimumExclusive
|
---|
251 | << XsdFacet::Assertion;
|
---|
252 |
|
---|
253 | m_allowedAtomicFacets.insert(BuiltinTypes::xsGMonth->name(m_namePool), facets);
|
---|
254 | }
|
---|
255 |
|
---|
256 | // hexBinary
|
---|
257 | {
|
---|
258 | QSet<XsdFacet::Type> facets;
|
---|
259 | facets << XsdFacet::Length
|
---|
260 | << XsdFacet::MinimumLength
|
---|
261 | << XsdFacet::MaximumLength
|
---|
262 | << XsdFacet::Pattern
|
---|
263 | << XsdFacet::Enumeration
|
---|
264 | << XsdFacet::WhiteSpace
|
---|
265 | << XsdFacet::Assertion;
|
---|
266 |
|
---|
267 | m_allowedAtomicFacets.insert(BuiltinTypes::xsHexBinary->name(m_namePool), facets);
|
---|
268 | }
|
---|
269 |
|
---|
270 | // base64Binary
|
---|
271 | {
|
---|
272 | QSet<XsdFacet::Type> facets;
|
---|
273 | facets << XsdFacet::Length
|
---|
274 | << XsdFacet::MinimumLength
|
---|
275 | << XsdFacet::MaximumLength
|
---|
276 | << XsdFacet::Pattern
|
---|
277 | << XsdFacet::Enumeration
|
---|
278 | << XsdFacet::WhiteSpace
|
---|
279 | << XsdFacet::Assertion;
|
---|
280 |
|
---|
281 | m_allowedAtomicFacets.insert(BuiltinTypes::xsBase64Binary->name(m_namePool), facets);
|
---|
282 | }
|
---|
283 |
|
---|
284 | // anyURI
|
---|
285 | {
|
---|
286 | QSet<XsdFacet::Type> facets;
|
---|
287 | facets << XsdFacet::Length
|
---|
288 | << XsdFacet::MinimumLength
|
---|
289 | << XsdFacet::MaximumLength
|
---|
290 | << XsdFacet::Pattern
|
---|
291 | << XsdFacet::Enumeration
|
---|
292 | << XsdFacet::WhiteSpace
|
---|
293 | << XsdFacet::Assertion;
|
---|
294 |
|
---|
295 | m_allowedAtomicFacets.insert(BuiltinTypes::xsAnyURI->name(m_namePool), facets);
|
---|
296 | }
|
---|
297 |
|
---|
298 | // QName
|
---|
299 | {
|
---|
300 | QSet<XsdFacet::Type> facets;
|
---|
301 | facets << XsdFacet::Length
|
---|
302 | << XsdFacet::MinimumLength
|
---|
303 | << XsdFacet::MaximumLength
|
---|
304 | << XsdFacet::Pattern
|
---|
305 | << XsdFacet::Enumeration
|
---|
306 | << XsdFacet::WhiteSpace
|
---|
307 | << XsdFacet::Assertion;
|
---|
308 |
|
---|
309 | m_allowedAtomicFacets.insert(BuiltinTypes::xsQName->name(m_namePool), facets);
|
---|
310 | }
|
---|
311 |
|
---|
312 | // NOTATION
|
---|
313 | {
|
---|
314 | QSet<XsdFacet::Type> facets;
|
---|
315 | facets << XsdFacet::Length
|
---|
316 | << XsdFacet::MinimumLength
|
---|
317 | << XsdFacet::MaximumLength
|
---|
318 | << XsdFacet::Pattern
|
---|
319 | << XsdFacet::Enumeration
|
---|
320 | << XsdFacet::WhiteSpace
|
---|
321 | << XsdFacet::Assertion;
|
---|
322 |
|
---|
323 | m_allowedAtomicFacets.insert(BuiltinTypes::xsNOTATION->name(m_namePool), facets);
|
---|
324 | }
|
---|
325 | }
|
---|
326 |
|
---|
327 | QT_END_NAMESPACE
|
---|