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
=== modified file 'include/zorba/typeident.h'
--- include/zorba/typeident.h 2013-09-26 20:20:24 +0000
+++ include/zorba/typeident.h 2013-09-27 09:23:49 +0000
@@ -85,13 +85,18 @@
85 static SequenceType createItemType(Quantifier q = QUANT_ONE);85 static SequenceType createItemType(Quantifier q = QUANT_ONE);
8686
87 /**87 /**
88 * \brief Create an AtomicOrUnion type with quantifier88 * \brief Create a generalized atomic type (see
89 * http://www.w3.org/TR/xquery-30/#dt-generalized-atomic-type ) with quantifier
89 *90 *
90 * An AtomicOrUnion type is specified simply as a QName, which may identify91 * A generalized atomic type is specified simply as a QName, which may identify
91 * an XMLSchema builtin atomic type or a user-defined atomic or union type.92 * an XMLSchema builtin atomic type or a user-defined atomic or pure union type.
92 * In the case of user-defined types, the QName must be among the in-scope93 * In the case of user-defined types, the QName must be among the in-scope
93 * type names of a given static context. Otherwise, for builtin types, the94 * type names of a given static context. Otherwise, for builtin types, the
94 * given sctx may be NULL.95 * given sctx may be NULL.
96 *
97 * If the given QName (uri and local name pair) does not specify a generalized
98 * atomic type among the in-scope type names of a given static context, an
99 * invalid SequenceType is returned.
95 */100 */
96 static SequenceType createAtomicOrUnionType(101 static SequenceType createAtomicOrUnionType(
97 const StaticContext_t& sctx,102 const StaticContext_t& sctx,
@@ -128,12 +133,18 @@
128 bool nillable,133 bool nillable,
129 Quantifier quant = QUANT_ONE);134 Quantifier quant = QUANT_ONE);
130135
136 /**
137 *
138 */
131 static SequenceType createSchemaElementType(139 static SequenceType createSchemaElementType(
132 const StaticContext_t& sctx,140 const StaticContext_t& sctx,
133 const String& uri,141 const String& uri,
134 const String& localName,142 const String& localName,
135 Quantifier quant = QUANT_ONE);143 Quantifier quant = QUANT_ONE);
136 144
145 /**
146 *
147 */
137 static SequenceType createAttributeType(148 static SequenceType createAttributeType(
138 const StaticContext_t& sctx,149 const StaticContext_t& sctx,
139 const String& nodeUri,150 const String& nodeUri,
@@ -142,29 +153,59 @@
142 const String& contentTypeLocalName,153 const String& contentTypeLocalName,
143 Quantifier quant = QUANT_ONE);154 Quantifier quant = QUANT_ONE);
144155
156 /**
157 *
158 */
145 static SequenceType createSchemaAttributeType(159 static SequenceType createSchemaAttributeType(
146 const StaticContext_t& sctx,160 const StaticContext_t& sctx,
147 const String& uri,161 const String& uri,
148 const String& localName,162 const String& localName,
149 Quantifier quant = QUANT_ONE);163 Quantifier quant = QUANT_ONE);
150 164
165 /**
166 *
167 */
151 static SequenceType createPIType(Quantifier q = QUANT_ONE);168 static SequenceType createPIType(Quantifier q = QUANT_ONE);
152169
170 /**
171 *
172 */
153 static SequenceType createTextType(Quantifier q = QUANT_ONE);173 static SequenceType createTextType(Quantifier q = QUANT_ONE);
154174
175 /**
176 *
177 */
155 static SequenceType createCommentType(Quantifier q = QUANT_ONE);178 static SequenceType createCommentType(Quantifier q = QUANT_ONE);
156179
180 /**
181 *
182 */
157 static SequenceType createNamespaceType(Quantifier q = QUANT_ONE);183 static SequenceType createNamespaceType(Quantifier q = QUANT_ONE);
158184
185 /**
186 *
187 */
159 static SequenceType createJSONItemType(Quantifier q = QUANT_ONE);188 static SequenceType createJSONItemType(Quantifier q = QUANT_ONE);
160189
190 /**
191 *
192 */
161 static SequenceType createJSONObjectType(Quantifier q = QUANT_ONE);193 static SequenceType createJSONObjectType(Quantifier q = QUANT_ONE);
162194
195 /**
196 *
197 */
163 static SequenceType createJSONArrayType(Quantifier q = QUANT_ONE);198 static SequenceType createJSONArrayType(Quantifier q = QUANT_ONE);
164199
165 public:200 public:
201 /**
202 * Constructor for an invalid (NULL) type.
203 */
166 SequenceType();204 SequenceType();
167205
206 /**
207 * Copy constructor
208 */
168 SequenceType(const SequenceType& other);209 SequenceType(const SequenceType& other);
169210
170 /**211 /**
@@ -173,7 +214,7 @@
173 ~SequenceType();214 ~SequenceType();
174215
175 /**216 /**
176 *217 * Returns true if this a valid (non-NULL) type; otherwise, returns false.
177 */218 */
178 bool isValid() const;219 bool isValid() const;
179220
@@ -188,29 +229,32 @@
188 Quantifier getQuantifier() const;229 Quantifier getQuantifier() const;
189230
190 /**231 /**
191 * If this is an atomic or union type, this method returns the URI of232 * If this is a generalized atomic type, this method returns the URI of
192 * the type name. For other kinds of types, an empty string is returned.233 * the type name. For other kinds of types, an empty string is returned.
193 */234 */
194 String getTypeUri() const;235 String getTypeUri() const;
195236
196 /**237 /**
197 * If this is an atomic or union type, this method returns the local part of238 * If this is a generalized atomic type, this method returns the local part of
198 * the type name. For other kinds of types, an empty string is returned.239 * the type name. For other kinds of types, an empty string is returned.
199 */240 */
200 String getTypeLocalName() const;241 String getTypeLocalName() const;
201242
202 /**243 /**
203 * If this is an element() or attribute() type that contains a NodeName,244 * If this is an element() or attribute() type that contains a NodeName,
204 * this method returns the URI of that NodeName. In all other cases, an245 * this method returns the URI of that NodeName. If this is a schema-element(N)
205 * empty string is returned.246 * or schema-attribute(N) type, the method returns the URI of N. In all other
247 * cases, an empty string is returned.
206 */248 */
207 String getNodeUri() const;249 String getNodeUri() const;
208250
209 /**251 /**
210 * If this is an element() or attribute() type that contains a NodeName,252 * If this is an element() or attribute() type that contains a NodeName,
211 * this method returns the URI of that NodeName. If this is a 253 * this method returns the local part of that NodeName. If this is a
212 * processing-instruction() that contains a TargetName, that TargetName is254 * schema-element(N) or schema-attribute(N) type, the method returns the
213 * returned. In all other cases, an empty string is returned.255 * local part of N. If this is a processing-instruction() that contains a
256 * TargetName, that TargetName is returned. In all other cases, an empty
257 * string is returned.
214 */258 */
215 String getNodeLocalName() const;259 String getNodeLocalName() const;
216260
217261
=== modified file 'src/api/sequencetype.cpp'
--- src/api/sequencetype.cpp 2013-09-26 20:20:24 +0000
+++ src/api/sequencetype.cpp 2013-09-27 09:23:49 +0000
@@ -150,7 +150,10 @@
150150
151 xqtref_t type = tm->create_named_type(qname, quant, QueryLoc::null, false);151 xqtref_t type = tm->create_named_type(qname, quant, QueryLoc::null, false);
152152
153 return Unmarshaller::createSequenceType(type.getp());153 if (type->isGenAtomicAny())
154 return Unmarshaller::createSequenceType(type.getp());
155
156 return Unmarshaller::createSequenceType(NULL);
154}157}
155158
156159
@@ -711,6 +714,24 @@
711}714}
712715
713716
717bool SequenceType::isWildcard() const
718{
719 if (theType->type_kind() == XQType::NODE_TYPE_KIND)
720 {
721 const NodeXQType* nt = static_cast<const NodeXQType*>(theType);
722
723 store::StoreConsts::NodeKind nodeKind = nt->get_node_kind();
724
725 if (nt->get_node_name() == NULL &&
726 (nodeKind == store::StoreConsts::elementNode ||
727 nodeKind == store::StoreConsts::attributeNode))
728 return true;
729 }
730
731 return false;
732}
733
734
714SequenceType SequenceType::getContentType() const735SequenceType SequenceType::getContentType() const
715{736{
716 switch (theType->type_kind())737 switch (theType->type_kind())
@@ -735,6 +756,7 @@
735 }756 }
736}757}
737758
759
738String SequenceType::getContentTypeUri() const760String SequenceType::getContentTypeUri() const
739{761{
740 switch (theType->type_kind())762 switch (theType->type_kind())
@@ -789,24 +811,6 @@
789}811}
790812
791813
792bool SequenceType::isWildcard() const
793{
794 if (theType->type_kind() == XQType::NODE_TYPE_KIND)
795 {
796 const NodeXQType* nt = static_cast<const NodeXQType*>(theType);
797
798 store::StoreConsts::NodeKind nodeKind = nt->get_node_kind();
799
800 if (nt->get_node_name() == NULL &&
801 (nodeKind == store::StoreConsts::elementNode ||
802 nodeKind == store::StoreConsts::attributeNode))
803 return true;
804 }
805
806 return false;
807}
808
809
810bool SequenceType::isSchemaTest() const814bool SequenceType::isSchemaTest() const
811{815{
812 if (theType->type_kind() == XQType::NODE_TYPE_KIND)816 if (theType->type_kind() == XQType::NODE_TYPE_KIND)
813817
=== modified file 'src/types/typeimpl.cpp'
--- src/types/typeimpl.cpp 2013-09-23 09:11:02 +0000
+++ src/types/typeimpl.cpp 2013-09-27 09:23:49 +0000
@@ -316,7 +316,8 @@
316316
317317
318/*******************************************************************************318/*******************************************************************************
319 Returns true if the ItemType of the given sequence type is an atomic type.319 Returns true if the ItemType of the given sequence type is a generalized atomic
320 type.
320********************************************************************************/321********************************************************************************/
321bool XQType::isGenAtomicAny() const322bool XQType::isGenAtomicAny() const
322{323{

Subscribers

People subscribed via source and target branches