Merge lp:~zorba-coders/zorba/markos-scratch into lp:zorba

Proposed by Markos Zaharioudakis
Status: Merged
Merged at revision: 11642
Proposed branch: lp:~zorba-coders/zorba/markos-scratch
Merge into: lp:zorba
Diff against target: 241 lines (+80/-31)
3 files modified
include/zorba/typeident.h (+55/-11)
src/api/sequencetype.cpp (+23/-19)
src/types/typeimpl.cpp (+2/-1)
To merge this branch: bzr merge lp:~zorba-coders/zorba/markos-scratch
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Review via email: mp+188000@code.launchpad.net

Commit message

Added/fixed some comments for SequenceType.

Description of the change

Added/fixed some comments for SequenceType.

To post a comment you must log in.
Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/188000

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue succeeded - proposal merged!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/zorba/typeident.h'
2--- include/zorba/typeident.h 2013-09-26 20:20:24 +0000
3+++ include/zorba/typeident.h 2013-09-27 09:23:49 +0000
4@@ -85,13 +85,18 @@
5 static SequenceType createItemType(Quantifier q = QUANT_ONE);
6
7 /**
8- * \brief Create an AtomicOrUnion type with quantifier
9+ * \brief Create a generalized atomic type (see
10+ * http://www.w3.org/TR/xquery-30/#dt-generalized-atomic-type ) with quantifier
11 *
12- * An AtomicOrUnion type is specified simply as a QName, which may identify
13- * an XMLSchema builtin atomic type or a user-defined atomic or union type.
14+ * A generalized atomic type is specified simply as a QName, which may identify
15+ * an XMLSchema builtin atomic type or a user-defined atomic or pure union type.
16 * In the case of user-defined types, the QName must be among the in-scope
17 * type names of a given static context. Otherwise, for builtin types, the
18 * given sctx may be NULL.
19+ *
20+ * If the given QName (uri and local name pair) does not specify a generalized
21+ * atomic type among the in-scope type names of a given static context, an
22+ * invalid SequenceType is returned.
23 */
24 static SequenceType createAtomicOrUnionType(
25 const StaticContext_t& sctx,
26@@ -128,12 +133,18 @@
27 bool nillable,
28 Quantifier quant = QUANT_ONE);
29
30+ /**
31+ *
32+ */
33 static SequenceType createSchemaElementType(
34 const StaticContext_t& sctx,
35 const String& uri,
36 const String& localName,
37 Quantifier quant = QUANT_ONE);
38
39+ /**
40+ *
41+ */
42 static SequenceType createAttributeType(
43 const StaticContext_t& sctx,
44 const String& nodeUri,
45@@ -142,29 +153,59 @@
46 const String& contentTypeLocalName,
47 Quantifier quant = QUANT_ONE);
48
49+ /**
50+ *
51+ */
52 static SequenceType createSchemaAttributeType(
53 const StaticContext_t& sctx,
54 const String& uri,
55 const String& localName,
56 Quantifier quant = QUANT_ONE);
57
58+ /**
59+ *
60+ */
61 static SequenceType createPIType(Quantifier q = QUANT_ONE);
62
63+ /**
64+ *
65+ */
66 static SequenceType createTextType(Quantifier q = QUANT_ONE);
67
68+ /**
69+ *
70+ */
71 static SequenceType createCommentType(Quantifier q = QUANT_ONE);
72
73+ /**
74+ *
75+ */
76 static SequenceType createNamespaceType(Quantifier q = QUANT_ONE);
77
78+ /**
79+ *
80+ */
81 static SequenceType createJSONItemType(Quantifier q = QUANT_ONE);
82
83+ /**
84+ *
85+ */
86 static SequenceType createJSONObjectType(Quantifier q = QUANT_ONE);
87
88+ /**
89+ *
90+ */
91 static SequenceType createJSONArrayType(Quantifier q = QUANT_ONE);
92
93 public:
94+ /**
95+ * Constructor for an invalid (NULL) type.
96+ */
97 SequenceType();
98
99+ /**
100+ * Copy constructor
101+ */
102 SequenceType(const SequenceType& other);
103
104 /**
105@@ -173,7 +214,7 @@
106 ~SequenceType();
107
108 /**
109- *
110+ * Returns true if this a valid (non-NULL) type; otherwise, returns false.
111 */
112 bool isValid() const;
113
114@@ -188,29 +229,32 @@
115 Quantifier getQuantifier() const;
116
117 /**
118- * If this is an atomic or union type, this method returns the URI of
119+ * If this is a generalized atomic type, this method returns the URI of
120 * the type name. For other kinds of types, an empty string is returned.
121 */
122 String getTypeUri() const;
123
124 /**
125- * If this is an atomic or union type, this method returns the local part of
126+ * If this is a generalized atomic type, this method returns the local part of
127 * the type name. For other kinds of types, an empty string is returned.
128 */
129 String getTypeLocalName() const;
130
131 /**
132 * If this is an element() or attribute() type that contains a NodeName,
133- * this method returns the URI of that NodeName. In all other cases, an
134- * empty string is returned.
135+ * this method returns the URI of that NodeName. If this is a schema-element(N)
136+ * or schema-attribute(N) type, the method returns the URI of N. In all other
137+ * cases, an empty string is returned.
138 */
139 String getNodeUri() const;
140
141 /**
142 * If this is an element() or attribute() type that contains a NodeName,
143- * this method returns the URI of that NodeName. If this is a
144- * processing-instruction() that contains a TargetName, that TargetName is
145- * returned. In all other cases, an empty string is returned.
146+ * this method returns the local part of that NodeName. If this is a
147+ * schema-element(N) or schema-attribute(N) type, the method returns the
148+ * local part of N. If this is a processing-instruction() that contains a
149+ * TargetName, that TargetName is returned. In all other cases, an empty
150+ * string is returned.
151 */
152 String getNodeLocalName() const;
153
154
155=== modified file 'src/api/sequencetype.cpp'
156--- src/api/sequencetype.cpp 2013-09-26 20:20:24 +0000
157+++ src/api/sequencetype.cpp 2013-09-27 09:23:49 +0000
158@@ -150,7 +150,10 @@
159
160 xqtref_t type = tm->create_named_type(qname, quant, QueryLoc::null, false);
161
162- return Unmarshaller::createSequenceType(type.getp());
163+ if (type->isGenAtomicAny())
164+ return Unmarshaller::createSequenceType(type.getp());
165+
166+ return Unmarshaller::createSequenceType(NULL);
167 }
168
169
170@@ -711,6 +714,24 @@
171 }
172
173
174+bool SequenceType::isWildcard() const
175+{
176+ if (theType->type_kind() == XQType::NODE_TYPE_KIND)
177+ {
178+ const NodeXQType* nt = static_cast<const NodeXQType*>(theType);
179+
180+ store::StoreConsts::NodeKind nodeKind = nt->get_node_kind();
181+
182+ if (nt->get_node_name() == NULL &&
183+ (nodeKind == store::StoreConsts::elementNode ||
184+ nodeKind == store::StoreConsts::attributeNode))
185+ return true;
186+ }
187+
188+ return false;
189+}
190+
191+
192 SequenceType SequenceType::getContentType() const
193 {
194 switch (theType->type_kind())
195@@ -735,6 +756,7 @@
196 }
197 }
198
199+
200 String SequenceType::getContentTypeUri() const
201 {
202 switch (theType->type_kind())
203@@ -789,24 +811,6 @@
204 }
205
206
207-bool SequenceType::isWildcard() const
208-{
209- if (theType->type_kind() == XQType::NODE_TYPE_KIND)
210- {
211- const NodeXQType* nt = static_cast<const NodeXQType*>(theType);
212-
213- store::StoreConsts::NodeKind nodeKind = nt->get_node_kind();
214-
215- if (nt->get_node_name() == NULL &&
216- (nodeKind == store::StoreConsts::elementNode ||
217- nodeKind == store::StoreConsts::attributeNode))
218- return true;
219- }
220-
221- return false;
222-}
223-
224-
225 bool SequenceType::isSchemaTest() const
226 {
227 if (theType->type_kind() == XQType::NODE_TYPE_KIND)
228
229=== modified file 'src/types/typeimpl.cpp'
230--- src/types/typeimpl.cpp 2013-09-23 09:11:02 +0000
231+++ src/types/typeimpl.cpp 2013-09-27 09:23:49 +0000
232@@ -316,7 +316,8 @@
233
234
235 /*******************************************************************************
236- Returns true if the ItemType of the given sequence type is an atomic type.
237+ Returns true if the ItemType of the given sequence type is a generalized atomic
238+ type.
239 ********************************************************************************/
240 bool XQType::isGenAtomicAny() const
241 {

Subscribers

People subscribed via source and target branches