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 #include "qebvtype_p.h"
41 #include "qgenericsequencetype_p.h"
42 #include "qnonetype_p.h"
43 
44 #include "qcommonsequencetypes_p.h"
45 
46 /* To avoid the static initialization fiasco, we put the builtin types in this compilation unit, since
47  * the sequence types depends on them. */
48 #include "qbuiltintypes.cpp"
49 
50 QT_BEGIN_NAMESPACE
51 
52 using namespace QPatternist;
53 
54 // STATIC DATA
55 #define st(var, type, card)                                             \
56 const SequenceType::Ptr                                                 \
57 CommonSequenceTypes::var(new GenericSequenceType(BuiltinTypes::type,    \
58                                                  Cardinality::card()))
59 
60 /* Alphabetically. */
61 st(ExactlyOneAnyURI,                xsAnyURI,               exactlyOne);
62 st(ExactlyOneAtomicType,            xsAnyAtomicType,        exactlyOne);
63 st(ExactlyOneAttribute,             attribute,              exactlyOne);
64 st(ExactlyOneBase64Binary,          xsBase64Binary,         exactlyOne);
65 st(ExactlyOneBoolean,               xsBoolean,              exactlyOne);
66 st(ExactlyOneComment,               comment,                exactlyOne);
67 st(ExactlyOneDateTime,              xsDateTime,             exactlyOne);
68 st(ExactlyOneDate,                  xsDate,                 exactlyOne);
69 st(ExactlyOneDayTimeDuration,       xsDayTimeDuration,      exactlyOne);
70 st(ExactlyOneDecimal,               xsDecimal,              exactlyOne);
71 st(ExactlyOneDocumentNode,          document,               exactlyOne);
72 st(OneOrMoreDocumentNodes,          document,               oneOrMore);
73 st(ExactlyOneDouble,                xsDouble,               exactlyOne);
74 st(ExactlyOneDuration,              xsDuration,             exactlyOne);
75 st(ExactlyOneElement,               element,                exactlyOne);
76 st(ExactlyOneFloat,                 xsFloat,                exactlyOne);
77 st(ExactlyOneGDay,                  xsGDay,                 exactlyOne);
78 st(ExactlyOneGMonthDay,             xsGMonthDay,            exactlyOne);
79 st(ExactlyOneGMonth,                xsGMonth,               exactlyOne);
80 st(ExactlyOneGYearMonth,            xsGYearMonth,           exactlyOne);
81 st(ExactlyOneGYear,                 xsGYear,                exactlyOne);
82 st(ExactlyOneHexBinary,             xsHexBinary,            exactlyOne);
83 st(ExactlyOneInteger,               xsInteger,              exactlyOne);
84 st(ExactlyOneItem,                  item,                   exactlyOne);
85 st(ExactlyOneNCName,                xsNCName,               exactlyOne);
86 st(ExactlyOneNode,                  node,                   exactlyOne);
87 st(ExactlyOneNumeric,               numeric,                exactlyOne);
88 st(ExactlyOneProcessingInstruction, pi,                     exactlyOne);
89 st(ExactlyOneQName,                 xsQName,                exactlyOne);
90 st(ExactlyOneString,                xsString,               exactlyOne);
91 st(ExactlyOneTextNode,              text,                   exactlyOne);
92 st(ExactlyOneTime,                  xsTime,                 exactlyOne);
93 st(ExactlyOneUntypedAtomic,         xsUntypedAtomic,        exactlyOne);
94 st(ExactlyOneYearMonthDuration,     xsYearMonthDuration,    exactlyOne);
95 st(OneOrMoreItems,                  item,                   oneOrMore);
96 st(ZeroOrMoreAtomicTypes,           xsAnyAtomicType,        zeroOrMore);
97 st(ZeroOrMoreElements,              element,                zeroOrMore);
98 st(ZeroOrMoreIntegers,              xsInteger,              zeroOrMore);
99 st(ZeroOrMoreItems,                 item,                   zeroOrMore);
100 st(ZeroOrMoreNodes,                 node,                   zeroOrMore);
101 st(ZeroOrMoreStrings,               xsString,               zeroOrMore);
102 st(ZeroOrOneAnyURI,                 xsAnyURI,               zeroOrOne);
103 st(ZeroOrOneAtomicType,             xsAnyAtomicType,        zeroOrOne);
104 st(ZeroOrOneBoolean,                xsBoolean,              zeroOrOne);
105 st(ZeroOrOneDateTime,               xsDateTime,             zeroOrOne);
106 st(ZeroOrOneDate,                   xsDate,                 zeroOrOne);
107 st(ZeroOrOneDayTimeDuration,        xsDayTimeDuration,      zeroOrOne);
108 st(ZeroOrOneDecimal,                xsDecimal,              zeroOrOne);
109 st(ZeroOrOneDocumentNode,           document,               zeroOrOne);
110 st(ZeroOrOneDuration,               xsDuration,             zeroOrOne);
111 st(ZeroOrOneInteger,                xsInteger,              zeroOrOne);
112 st(ZeroOrOneItem,                   item,                   zeroOrOne);
113 st(ZeroOrOneNCName,                 xsNCName,               zeroOrOne);
114 st(ZeroOrOneNode,                   node,                   zeroOrOne);
115 st(ZeroOrOneNumeric,                numeric,                zeroOrOne);
116 st(ZeroOrOneQName,                  xsQName,                zeroOrOne);
117 st(ZeroOrOneString,                 xsString,               zeroOrOne);
118 st(ZeroOrOneTextNode,               text,                   zeroOrOne);
119 st(ZeroOrOneTime,                   xsTime,                 zeroOrOne);
120 st(ZeroOrOneYearMonthDuration,      xsYearMonthDuration,    zeroOrOne);
121 
122 #undef st
123 
124 /* Special cases. */
125 const EmptySequenceType::Ptr    CommonSequenceTypes::Empty  (new EmptySequenceType());
126 const NoneType::Ptr             CommonSequenceTypes::None   (new NoneType());
127 const SequenceType::Ptr         CommonSequenceTypes::EBV    (new EBVType());
128 
129 
130 QT_END_NAMESPACE
131