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

Proposed by Markos Zaharioudakis
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 11010
Merged at revision: 11189
Proposed branch: lp:~zorba-coders/zorba/markos-scratch
Merge into: lp:zorba
Diff against target: 2618 lines (+584/-519)
13 files modified
src/runtime/durations_dates_times/DurationsDatesTimesImpl.cpp (+41/-4)
src/runtime/nodes/node_position_impl.cpp (+0/-2)
src/store/api/item.h (+49/-27)
src/store/naive/atomic_items.cpp (+32/-57)
src/store/naive/atomic_items.h (+281/-235)
src/store/naive/item.cpp (+6/-57)
src/store/naive/json_items.h (+1/-1)
src/store/naive/pul_primitives.cpp (+11/-6)
src/store/naive/simple_index.cpp (+2/-2)
src/store/naive/simple_item_factory.cpp (+129/-116)
src/types/casting.cpp (+12/-12)
test/rbkt/ExpQueryResults/zorba/updates/joel.xml.res (+2/-0)
test/rbkt/Queries/zorba/updates/joel.xq (+18/-0)
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+143395@code.launchpad.net

Commit message

Fixed bug when inserting consecutive text nodes in an xml tree (fix provided by Joel de Poter) + storing the schema type code inside the atomic items themselves.

Description of the change

Fixed bug when inserting consecutive text nodes in an xml tree (fix provided by Joel de Poter) + storing the schema type code inside the atomic items themselves.

To post a comment you must log in.
11009. By Markos Zaharioudakis

store the shema type code inside the atomic item itself + fixed bug found by joel when inserting consecutive text nodes in an xml tree

11010. By Markos Zaharioudakis

merge from trunk

Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job markos-scratch-2013-01-17T15-54-28.717Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/runtime/durations_dates_times/DurationsDatesTimesImpl.cpp'
2--- src/runtime/durations_dates_times/DurationsDatesTimesImpl.cpp 2012-11-17 01:08:54 +0000
3+++ src/runtime/durations_dates_times/DurationsDatesTimesImpl.cpp 2013-01-16 16:58:20 +0000
4@@ -112,7 +112,9 @@
5
6 // If $arg is the empty sequence, then the result is the empty sequence.
7 if (!consumeNext(item0, theChild.getp(), planState))
8+ {
9 STACK_PUSH(false, state);
10+ }
11 else
12 {
13 try
14@@ -124,10 +126,26 @@
15 {
16 throw XQUERY_EXCEPTION(err::FODT0003, ERROR_PARAMS(e.get_tz_seconds()));
17 }
18- STACK_PUSH(GENV_ITEMFACTORY->createDateTime(result, dt.get()), state);
19+
20+ if (item0->getTypeCode() == store::XS_DATETIME)
21+ {
22+ STACK_PUSH(GENV_ITEMFACTORY->createDateTime(result, dt.get()), state);
23+ }
24+ else if (item0->getTypeCode() == store::XS_DATE)
25+ {
26+ STACK_PUSH(GENV_ITEMFACTORY->createDate(result, dt.get()), state);
27+ }
28+ else if (item0->getTypeCode() == store::XS_TIME)
29+ {
30+ STACK_PUSH(GENV_ITEMFACTORY->createTime(result, dt.get()), state);
31+ }
32+ else
33+ {
34+ ZORBA_ASSERT(false);
35+ }
36 }
37
38- STACK_END (state);
39+ STACK_END(state);
40 }
41
42
43@@ -143,7 +161,9 @@
44 DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
45
46 if (!consumeNext(item0, theChild0.getp(), planState))
47+ {
48 STACK_PUSH(false, state);
49+ }
50 else
51 {
52 s1 = consumeNext(item1, theChild1.getp(), planState);
53@@ -155,12 +175,29 @@
54 {
55 throw XQUERY_EXCEPTION(err::FODT0003, ERROR_PARAMS(e.get_tz_seconds()));
56 }
57- STACK_PUSH(GENV_ITEMFACTORY->createDateTime(result, dt.get()), state);
58+
59+ if (item0->getTypeCode() == store::XS_DATETIME)
60+ {
61+ STACK_PUSH(GENV_ITEMFACTORY->createDateTime(result, dt.get()), state);
62+ }
63+ else if (item0->getTypeCode() == store::XS_DATE)
64+ {
65+ STACK_PUSH(GENV_ITEMFACTORY->createDate(result, dt.get()), state);
66+ }
67+ else if (item0->getTypeCode() == store::XS_TIME)
68+ {
69+ STACK_PUSH(GENV_ITEMFACTORY->createTime(result, dt.get()), state);
70+ }
71+ else
72+ {
73+ ZORBA_ASSERT(false);
74+ }
75 }
76
77- STACK_END (state);
78+ STACK_END(state);
79 }
80
81+
82 /**
83 *______________________________________________________________________
84 *
85
86=== modified file 'src/runtime/nodes/node_position_impl.cpp'
87--- src/runtime/nodes/node_position_impl.cpp 2012-09-19 21:16:15 +0000
88+++ src/runtime/nodes/node_position_impl.cpp 2013-01-16 16:58:20 +0000
89@@ -24,8 +24,6 @@
90 #include "store/api/iterator.h"
91 #include "store/api/item_factory.h"
92 #include "store/api/store.h"
93-#include "store/naive/atomic_items.h"
94-#include "store/naive/ordpath.h"
95
96 #include "util/string_util.h"
97 #include "util/uri_util.h"
98
99=== modified file 'src/store/api/item.h'
100--- src/store/api/item.h 2012-12-14 13:23:51 +0000
101+++ src/store/api/item.h 2013-01-16 16:58:20 +0000
102@@ -54,15 +54,15 @@
103 public:
104 enum ItemKind
105 {
106- NODE = 0x10,
107- ATOMIC = 0x21,
108- PUL = 0x41,
109- FUNCTION = 0x81,
110- LIST = 0x101,
111+ NODE = 0x0,
112+ ATOMIC = 0x1,
113+ PUL = 0x3,
114+ FUNCTION = 0x5,
115+ LIST = 0x7,
116 #ifdef ZORBA_WITH_JSON
117- JSONIQ = 0x201,
118+ JSONIQ = 0x9,
119 #endif
120- ERROR_ = 0x401
121+ ERROR_ = 0xB
122 };
123
124 protected:
125@@ -110,51 +110,73 @@
126 /**
127 * @return the kind of the item
128 */
129- ItemKind getKind() const;
130+ ItemKind getKind() const
131+ {
132+ if ((reinterpret_cast<uint64_t>(theUnion.treeRCPtr) & 0x1) == 0)
133+ return NODE;
134+
135+ return static_cast<ItemKind>(theUnion.itemKind & 0xF);
136+ }
137
138 /**
139 * @return "true" if the item is a node
140 */
141- bool
142- isNode() const;
143+ bool isNode() const
144+ {
145+ return ((reinterpret_cast<uint64_t>(theUnion.treeRCPtr) & 0x1) == 0 &&
146+ theUnion.treeRCPtr != 0);
147+ }
148
149 #ifdef ZORBA_WITH_JSON
150 /**
151 * @return "true" if the item is a JSON item
152 */
153- bool
154- isJSONItem() const;
155+ bool isJSONItem() const
156+ {
157+ return ((theUnion.itemKind & 0xF) == JSONIQ);
158+ }
159 #endif
160
161 /**
162 * @return "true" if the item is an atomic value
163 */
164- bool
165- isAtomic() const;
166+ bool isAtomic() const
167+ {
168+ return ((theUnion.itemKind & 0xF) == ATOMIC);
169+ }
170
171 /**
172 * @return "true" if the item is an list of atomic values
173 */
174- bool
175- isList() const;
176+ bool isList() const
177+ {
178+ return ((theUnion.itemKind & 0xF) == LIST);
179+ }
180
181 /**
182 * @return "true" if the item is a pending update list
183 */
184- bool
185- isPul() const;
186+ bool isPul() const
187+ {
188+ return ((theUnion.itemKind & 0xF) == PUL);
189+ }
190
191 /**
192 * @return "true" if the item is an error.
193 */
194- bool
195- isError() const;
196+ bool isError() const
197+ {
198+ return ((theUnion.itemKind & 0xF) == ERROR_);
199+ }
200
201 /**
202 * @return "true" if the item is a function.
203 */
204- bool
205- isFunction() const;
206+ bool isFunction() const
207+ {
208+ return ((theUnion.itemKind & 0xF) == FUNCTION);
209+ }
210+
211
212 /**
213 * @return a string representation of the item's kind
214@@ -176,7 +198,7 @@
215 #endif
216
217 /**
218- * @return (dynamic) XQuery type of the item
219+ * @return the qname identifying the XQuery type of the item
220 */
221 virtual Item*
222 getType() const;
223@@ -193,7 +215,7 @@
224 * @return The hash value
225 */
226 virtual uint32_t
227- hash(long timezone = 0, const XQPCollator* aCollation = 0) const;
228+ hash(long timezone = 0, const XQPCollator* collation = 0) const;
229
230 /**
231 * Compares (by value) two items for equality.
232@@ -206,7 +228,7 @@
233 * the table of http://www.w3.org/TR/xquery/#mapping.
234 */
235 virtual bool
236- equals(const Item*, long timezone = 0, const XQPCollator* aCollation = 0) const;
237+ equals(const Item*, long timezone = 0, const XQPCollator* collation = 0) const;
238
239 /**
240 * Compares (by value) two items, returning < 0 if "this" is less than "other",
241@@ -223,7 +245,7 @@
242 * or xs:float and at leat one of the items is NaN.
243 */
244 virtual long
245- compare(const Item* other, long timezone = 0, const XQPCollator* aCollation = 0) const;
246+ compare(const Item* other, long timezone = 0, const XQPCollator* collation = 0) const;
247
248 /**
249 * Computes the Effective Boolean Value for that item as specified in the
250@@ -278,7 +300,7 @@
251 /**
252 * @return The numeric code coresponding to the data type of this item.
253 */
254- virtual SchemaTypeCode getTypeCode() const;
255+ SchemaTypeCode getTypeCode() const;
256
257 /**
258 * @return If this is an atomic item with a user-defined data type UT, return
259
260=== modified file 'src/store/naive/atomic_items.cpp'
261--- src/store/naive/atomic_items.cpp 2013-01-10 19:24:23 +0000
262+++ src/store/naive/atomic_items.cpp 2013-01-16 16:58:20 +0000
263@@ -626,8 +626,13 @@
264 /*******************************************************************************
265 class QNameItem
266 ********************************************************************************/
267-QNameItem::QNameItem(const char* ns, const char* prefix, const char* local)
268+QNameItem::QNameItem(
269+ store::SchemaTypeCode t,
270+ const char* ns,
271+ const char* prefix,
272+ const char* local)
273 :
274+ AtomicItem(t),
275 theNormalizedQName(NULL),
276 theIsInPool(false)
277 {
278@@ -635,8 +640,13 @@
279 }
280
281
282-QNameItem::QNameItem(const zstring& ns, const zstring& prefix, const zstring& local)
283+QNameItem::QNameItem(
284+ store::SchemaTypeCode t,
285+ const zstring& ns,
286+ const zstring& prefix,
287+ const zstring& local)
288 :
289+ AtomicItem(t),
290 theNormalizedQName(NULL),
291 theIsInPool(false)
292 {
293@@ -802,14 +812,18 @@
294 return res;
295 }
296
297+
298 /*******************************************************************************
299 class NotationItem
300 ********************************************************************************/
301
302 NotationItem::NotationItem(
303+ store::SchemaTypeCode t,
304 const zstring& nameSpace,
305 const zstring& prefix,
306 const zstring& localName)
307+ :
308+ AtomicItem(t)
309 {
310 store::Item_t temp;
311 GET_FACTORY().createQName(temp, nameSpace, prefix, localName);
312@@ -817,7 +831,9 @@
313 }
314
315
316-NotationItem::NotationItem(store::Item* qname)
317+NotationItem::NotationItem(store::SchemaTypeCode t, store::Item* qname)
318+ :
319+ AtomicItem(t)
320 {
321 theQName = qname;
322 }
323@@ -1113,11 +1129,13 @@
324 ********************************************************************************/
325
326 StructuralAnyUriItem::StructuralAnyUriItem(
327+ store::SchemaTypeCode t,
328 ulong collectionId,
329 const TreeId& treeId,
330 store::StoreConsts::NodeKind nodeKind,
331 const OrdPath& ordPath)
332 :
333+ AtomicItem(t),
334 theCollectionId(collectionId),
335 theTreeId(treeId),
336 theNodeKind(nodeKind),
337@@ -1127,7 +1145,9 @@
338 }
339
340
341-StructuralAnyUriItem::StructuralAnyUriItem(zstring& value)
342+StructuralAnyUriItem::StructuralAnyUriItem(store::SchemaTypeCode t, zstring& value)
343+ :
344+ AtomicItem(t)
345 {
346 if (value == "")
347 throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI,
348@@ -1876,9 +1896,12 @@
349 class StreamableStringItem
350 ********************************************************************************/
351 StreamableStringItem::StreamableStringItem(
352+ store::SchemaTypeCode t,
353 std::istream& aStream,
354 StreamReleaser streamReleaser,
355- bool seekable) :
356+ bool seekable)
357+ :
358+ StringItem(t),
359 theIstream(aStream),
360 theIsMaterialized(false),
361 theIsConsumed(false),
362@@ -1889,7 +1912,10 @@
363 }
364
365 StreamableStringItem::StreamableStringItem(
366- store::Item_t& aStreamableDependent) :
367+ store::SchemaTypeCode t,
368+ store::Item_t& aStreamableDependent)
369+ :
370+ StringItem(t),
371 theIstream(aStreamableDependent->getStream()),
372 theIsMaterialized(false),
373 theIsConsumed(false),
374@@ -2251,40 +2277,6 @@
375 }
376
377
378-store::SchemaTypeCode DateTimeItem::getTypeCode() const
379-{
380- switch (theValue.getFacet())
381- {
382- case DateTime::GYEARMONTH_FACET:
383- return store::XS_GYEAR_MONTH;
384-
385- case DateTime::GYEAR_FACET:
386- return store::XS_GYEAR;
387-
388- case DateTime::GMONTH_FACET:
389- return store::XS_GMONTH;
390-
391- case DateTime::GMONTHDAY_FACET:
392- return store::XS_GMONTH_DAY;
393-
394- case DateTime::GDAY_FACET:
395- return store::XS_GDAY;
396-
397- case DateTime::DATE_FACET:
398- return store::XS_DATE;
399-
400- case DateTime::TIME_FACET:
401- return store::XS_TIME;
402-
403- case DateTime::DATETIME_FACET:
404- return store::XS_DATETIME;
405-
406- default:
407- ZORBA_ASSERT(false);
408- }
409-}
410-
411-
412 store::Item* DateTimeItem::getType() const
413 {
414 return GET_STORE().theSchemaTypeNames[getTypeCode()];
415@@ -2414,23 +2406,6 @@
416 }
417
418
419-store::SchemaTypeCode DurationItem::getTypeCode() const
420-{
421- switch (theValue.getFacet())
422- {
423- case Duration::DURATION_FACET:
424- return store::XS_DURATION;
425-
426- case Duration::DAYTIMEDURATION_FACET:
427- return store::XS_DT_DURATION;
428-
429- case Duration::YEARMONTHDURATION_FACET:
430- default:
431- return store::XS_YM_DURATION;
432- }
433-}
434-
435-
436 store::Item* DurationItem::getType() const
437 {
438 return GET_STORE().theSchemaTypeNames[getTypeCode()];
439
440=== modified file 'src/store/naive/atomic_items.h'
441--- src/store/naive/atomic_items.h 2012-10-08 12:09:36 +0000
442+++ src/store/naive/atomic_items.h 2013-01-16 16:58:20 +0000
443@@ -74,7 +74,10 @@
444 SYNC_CODE(mutable RCLock theRCLock;)
445
446 public:
447- AtomicItem() : store::Item(ATOMIC) { }
448+ AtomicItem(store::SchemaTypeCode t) : store::Item(ATOMIC)
449+ {
450+ theUnion.itemKind |= (t << 4);
451+ }
452
453 virtual ~AtomicItem() {}
454
455@@ -103,48 +106,40 @@
456 store::Item_t theTypeName;
457
458 protected:
459- UserTypedAtomicItem(
460- store::Item_t& baseItem,
461- store::Item_t& typeName)
462+ UserTypedAtomicItem(store::Item_t& baseItem, store::Item_t& typeName)
463+ :
464+ AtomicItem(baseItem->getTypeCode())
465 {
466 theBaseItem.transfer(baseItem);
467 theTypeName.transfer(typeName);
468 }
469
470- UserTypedAtomicItem() {}
471+ //UserTypedAtomicItem() {}
472
473 public:
474 store::Item* getBaseItem() const;
475
476- store::SchemaTypeCode getTypeCode() const { return theBaseItem->getTypeCode(); }
477-
478 store::Item* getType() const { return theTypeName.getp(); }
479
480- uint32_t hash(long timezone = 0, const XQPCollator* collation = 0) const
481- {
482- return theBaseItem->hash(timezone, collation);
483- }
484-
485- bool equals(
486- const store::Item* other,
487- long timezone = 0,
488- const XQPCollator* collation = 0) const
489- {
490- if (other->getBaseItem() == NULL)
491- return theBaseItem->equals(other, timezone, collation);
492- else
493- return theBaseItem->equals(other->getBaseItem(), timezone, collation);
494- }
495-
496- long compare(
497- const store::Item* other,
498- long timezone = 0,
499- const XQPCollator* collation = 0) const
500- {
501- if (other->getBaseItem() == NULL)
502- return theBaseItem->compare(other, timezone, collation);
503- else
504- return theBaseItem->compare(other->getBaseItem(), timezone, collation);
505+ uint32_t hash(long tz = 0, const XQPCollator* c = 0) const
506+ {
507+ return theBaseItem->hash(tz, c);
508+ }
509+
510+ bool equals(const store::Item* i, long tz = 0, const XQPCollator* c = 0) const
511+ {
512+ if (i->getBaseItem() == NULL)
513+ return theBaseItem->equals(i, tz, c);
514+ else
515+ return theBaseItem->equals(i->getBaseItem(), tz, c);
516+ }
517+
518+ long compare(const store::Item* i, long tz = 0, const XQPCollator* c = 0) const
519+ {
520+ if (i->getBaseItem() == NULL)
521+ return theBaseItem->compare(i, tz, c);
522+ else
523+ return theBaseItem->compare(i->getBaseItem(), tz, c);
524 }
525
526 bool getEBV() const { return theBaseItem->getEBV(); }
527@@ -269,9 +264,14 @@
528 zstring theValue;
529
530 protected:
531- UntypedAtomicItem(zstring& value) { theValue.take(value); }
532+ UntypedAtomicItem(store::SchemaTypeCode t, zstring& value)
533+ :
534+ AtomicItem(t)
535+ {
536+ theValue.take(value);
537+ }
538
539- UntypedAtomicItem() {}
540+ UntypedAtomicItem(store::SchemaTypeCode t) : AtomicItem(t) {}
541
542 public:
543 bool castToUri(store::Item_t& result) const;
544@@ -308,8 +308,6 @@
545
546 bool castToBoolean(store::Item_t& result) const;
547
548- store::SchemaTypeCode getTypeCode() const { return store::XS_UNTYPED_ATOMIC; }
549-
550 store::Item* getType() const;
551
552 uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const;
553@@ -388,17 +386,12 @@
554
555 // zorba::store::Item interface.
556
557- bool equals(
558- const store::Item* item,
559- long timezone = 0,
560- const XQPCollator* aCollation = 0) const;
561+ bool equals(const store::Item* i, long tz = 0, const XQPCollator* c = 0) const;
562
563- uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const;
564+ uint32_t hash(long tz = 0, const XQPCollator* c = 0) const;
565
566 store::Item* getType() const;
567
568- store::SchemaTypeCode getTypeCode() const { return store::XS_QNAME; }
569-
570 bool getEBV() const;
571
572 const zstring& getLocalName() const { return theLocal; }
573@@ -425,9 +418,9 @@
574 zstring show() const;
575
576 protected:
577- QNameItem()
578+ QNameItem(store::SchemaTypeCode t = store::XS_QNAME)
579 :
580- AtomicItem(),
581+ AtomicItem(t),
582 theNormalizedQName(NULL),
583 theIsInPool(true),
584 thePosition(0),
585@@ -439,9 +432,17 @@
586 // These two constructors are for building QName items outside
587 // of the pool (they point back to the normalized QName in the pool).
588 // Zorba does not use them, but extensions to the simple store may.
589- QNameItem(const char* ns, const char* prefix, const char* local);
590+ QNameItem(
591+ store::SchemaTypeCode t,
592+ const char* ns,
593+ const char* prefix,
594+ const char* local);
595
596- QNameItem(const zstring& ns, const zstring& prefix, const zstring& local);
597+ QNameItem(
598+ store::SchemaTypeCode t,
599+ const zstring& ns,
600+ const zstring& prefix,
601+ const zstring& local);
602
603 void free();
604
605@@ -538,11 +539,12 @@
606 friend class BasicItemFactory;
607
608 NotationItem(
609+ store::SchemaTypeCode t,
610 const zstring& nameSpace,
611 const zstring& prefix,
612 const zstring& localName);
613
614- NotationItem(store::Item* qname);
615+ NotationItem(store::SchemaTypeCode t, store::Item* qname);
616
617 public:
618 virtual ~NotationItem();
619@@ -567,8 +569,6 @@
620 const zstring& getLocalName() const { return theQName->getLocalName(); }
621
622 zstring show() const;
623-
624- virtual store::SchemaTypeCode getTypeCode() const { return store::XS_NOTATION; }
625 };
626
627
628@@ -583,9 +583,14 @@
629 zstring theValue;
630
631 protected:
632- AnyUriItem(zstring& value) { theValue.take(value); }
633+ AnyUriItem(store::SchemaTypeCode t, zstring& value)
634+ :
635+ AtomicItem(t)
636+ {
637+ theValue.take(value);
638+ }
639
640- AnyUriItem() {}
641+ AnyUriItem(store::SchemaTypeCode t) : AtomicItem(t) {}
642
643 public:
644 virtual AnyUriTypeCode getAnyUriTypeCode() const
645@@ -593,8 +598,6 @@
646 return NON_SPECIALIZED_ANY_URI;
647 }
648
649- store::SchemaTypeCode getTypeCode() const { return store::XS_ANY_URI; }
650-
651 store::Item* getType() const;
652
653 uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const;
654@@ -719,24 +722,13 @@
655 return STRUCTURAL_INFORMATION_ANY_URI;
656 }
657
658- store::SchemaTypeCode getTypeCode() const
659- {
660- return store::XS_ANY_URI;
661- }
662-
663 store::Item* getType() const;
664
665- uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const;
666-
667- bool equals(
668- const store::Item* item,
669- long timezone = 0,
670- const XQPCollator* aCollation = 0) const;
671-
672- long compare(
673- const Item* other,
674- long timezone = 0,
675- const XQPCollator* aCollation = 0) const;
676+ uint32_t hash(long tz = 0, const XQPCollator* c = 0) const;
677+
678+ bool equals(const store::Item* i, long tz = 0, const XQPCollator* c = 0) const;
679+
680+ long compare(const Item* i, long tz = 0, const XQPCollator* c = 0) const;
681
682 // A structural URI is never empty.
683 bool getEBV() const { return true; }
684@@ -834,15 +826,21 @@
685 protected:
686 friend class BasicItemFactory;
687
688- StructuralAnyUriItem(zstring& value);
689+ StructuralAnyUriItem(store::SchemaTypeCode t, zstring& value);
690
691 StructuralAnyUriItem(
692+ store::SchemaTypeCode t,
693 ulong collectionId,
694 const TreeId& treeId,
695 store::StoreConsts::NodeKind nodeKind,
696 const OrdPath& ordPath);
697
698- StructuralAnyUriItem() : theEncodedValue("") {}
699+ StructuralAnyUriItem()
700+ :
701+ AtomicItem(store::XS_ANY_URI),
702+ theEncodedValue("")
703+ {
704+ }
705 };
706
707
708@@ -860,14 +858,17 @@
709 zstring theValue;
710
711 protected:
712- StringItem(zstring& value) { theValue.take(value); }
713+ StringItem(store::SchemaTypeCode t, zstring& value)
714+ :
715+ AtomicItem(t)
716+ {
717+ theValue.take(value);
718+ }
719
720- StringItem() {}
721+ StringItem(store::SchemaTypeCode t) : AtomicItem(t) {}
722
723 public:
724
725- virtual store::SchemaTypeCode getTypeCode() const { return store::XS_STRING; }
726-
727 virtual store::Item* getType() const;
728
729 uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const;
730@@ -924,14 +925,14 @@
731
732 public:
733 bool equals(
734- store::Item const*,
735- long timezone = 0,
736- const XQPCollator* collator = 0 ) const;
737+ store::Item const*,
738+ long timezone = 0,
739+ const XQPCollator* collator = 0 ) const;
740
741 long compare(
742- Item const* other,
743- long timezone = 0,
744- const XQPCollator* collator = 0) const;
745+ Item const* other,
746+ long timezone = 0,
747+ const XQPCollator* collator = 0) const;
748
749 bool getEBV() const;
750
751@@ -967,12 +968,14 @@
752
753 protected:
754 StreamableStringItem(
755+ store::SchemaTypeCode t,
756 std::istream& aStream,
757 StreamReleaser streamReleaser,
758 bool seekable = false);
759
760 StreamableStringItem(
761- store::Item_t& aStreamableDependent);
762+ store::SchemaTypeCode t,
763+ store::Item_t& streamableDependent);
764
765 void materialize() const;
766 };
767@@ -986,11 +989,9 @@
768 friend class BasicItemFactory;
769
770 protected:
771- NormalizedStringItem(zstring& value) : StringItem(value) {}
772+ NormalizedStringItem(store::SchemaTypeCode t, zstring& v) : StringItem(t, v) {}
773
774 public:
775- virtual store::SchemaTypeCode getTypeCode() const { return store::XS_NORMALIZED_STRING; }
776-
777 virtual store::Item* getType() const;
778
779 virtual zstring show() const;
780@@ -1005,9 +1006,7 @@
781 friend class BasicItemFactory;
782
783 public:
784- TokenItem(zstring& value) : NormalizedStringItem(value) {}
785-
786- virtual store::SchemaTypeCode getTypeCode() const { return store::XS_TOKEN; }
787+ TokenItem(store::SchemaTypeCode t, zstring& v) : NormalizedStringItem(t, v) {}
788
789 virtual store::Item* getType() const;
790
791@@ -1023,11 +1022,9 @@
792 friend class BasicItemFactory;
793
794 protected:
795- NMTOKENItem(zstring& value) : TokenItem(value) {}
796+ NMTOKENItem(store::SchemaTypeCode t, zstring& v) : TokenItem(t, v) {}
797
798 public:
799- virtual store::SchemaTypeCode getTypeCode() const { return store::XS_NMTOKEN; }
800-
801 virtual store::Item* getType() const;
802
803 virtual zstring show() const;
804@@ -1042,11 +1039,9 @@
805 friend class BasicItemFactory;
806
807 protected:
808- LanguageItem(zstring& value) : TokenItem(value) {}
809+ LanguageItem(store::SchemaTypeCode t, zstring& v) : TokenItem(t, v) { }
810
811 public:
812- virtual store::SchemaTypeCode getTypeCode() const { return store::XS_LANGUAGE; }
813-
814 virtual store::Item* getType() const;
815
816 virtual zstring show() const;
817@@ -1061,11 +1056,9 @@
818 friend class BasicItemFactory;
819
820 protected:
821- NameItem(zstring& value) : TokenItem(value) {}
822+ NameItem(store::SchemaTypeCode t, zstring& v) : TokenItem(t, v) { }
823
824 public:
825- virtual store::SchemaTypeCode getTypeCode() const { return store::XS_NAME; }
826-
827 virtual store::Item* getType() const;
828
829 virtual zstring show() const;
830@@ -1080,11 +1073,9 @@
831 friend class BasicItemFactory;
832
833 protected:
834- NCNameItem(zstring& value) : NameItem(value) {}
835+ NCNameItem(store::SchemaTypeCode t, zstring& v) : NameItem(t, v) { }
836
837 public:
838- virtual store::SchemaTypeCode getTypeCode() const { return store::XS_NCNAME; }
839-
840 virtual store::Item* getType() const;
841
842 virtual zstring show() const;
843@@ -1099,11 +1090,9 @@
844 friend class BasicItemFactory;
845
846 protected:
847- IDItem(zstring& value) : NCNameItem(value) { }
848+ IDItem(store::SchemaTypeCode t, zstring& v) : NCNameItem(t, v) { }
849
850 public:
851- store::SchemaTypeCode getTypeCode() const { return store::XS_ID; }
852-
853 store::Item* getType() const;
854
855 virtual zstring show() const;
856@@ -1117,11 +1106,9 @@
857 friend class BasicItemFactory;
858
859 protected:
860- IDREFItem(zstring& value) : NCNameItem(value) { }
861+ IDREFItem(store::SchemaTypeCode t, zstring& v) : NCNameItem(t, v) { }
862
863 public:
864- store::SchemaTypeCode getTypeCode() const { return store::XS_IDREF; }
865-
866 store::Item* getType() const;
867
868 virtual zstring show() const;
869@@ -1135,11 +1122,9 @@
870 friend class BasicItemFactory;
871
872 protected:
873- ENTITYItem(zstring& value) : NCNameItem(value) { }
874+ ENTITYItem(store::SchemaTypeCode t, zstring& v) : NCNameItem(t, v) { }
875
876 public:
877- store::SchemaTypeCode getTypeCode() const { return store::XS_ENTITY; }
878-
879 store::Item* getType() const;
880
881 virtual zstring show() const;
882@@ -1157,9 +1142,14 @@
883 DateTime theValue;
884
885 protected:
886- DateTimeItem(const DateTime* aValue) : theValue(*aValue) { };
887+ DateTimeItem(store::SchemaTypeCode t, const DateTime* v)
888+ :
889+ AtomicItem(t),
890+ theValue(*v)
891+ {
892+ }
893
894- DateTimeItem() { };
895+ DateTimeItem(store::SchemaTypeCode t) : AtomicItem(t) { }
896
897 public:
898 const xs_dateTime& getDateTimeValue() const { return theValue; }
899@@ -1178,21 +1168,19 @@
900
901 const xs_gDay& getGDayValue() const { return theValue; }
902
903- store::SchemaTypeCode getTypeCode() const;
904-
905 store::Item* getType() const;
906
907 uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const;
908
909 bool equals(
910- const store::Item*,
911- long timezone = 0,
912- const XQPCollator* aCollation = 0) const;
913+ const store::Item*,
914+ long timezone = 0,
915+ const XQPCollator* collation = 0) const;
916
917 long compare(
918- const Item* other,
919- long timezone = 0,
920- const XQPCollator* aCollation = 0) const;
921+ const Item* other,
922+ long timezone = 0,
923+ const XQPCollator* collation = 0) const;
924
925 bool getEBV() const;
926
927@@ -1217,9 +1205,14 @@
928 Duration theValue;
929
930 protected:
931- DurationItem(const xs_duration* aValue) : theValue(*aValue) { };
932+ DurationItem(store::SchemaTypeCode t, const xs_duration* v)
933+ :
934+ AtomicItem(t),
935+ theValue(*v)
936+ {
937+ }
938
939- DurationItem() {}
940+ DurationItem(store::SchemaTypeCode t) : AtomicItem(t) {}
941
942 public:
943 const xs_duration& getDurationValue() const;
944@@ -1228,8 +1221,6 @@
945
946 const xs_yearMonthDuration& getYearMonthDurationValue() const;
947
948- store::SchemaTypeCode getTypeCode() const;
949-
950 store::Item* getType() const;
951
952 uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const
953@@ -1237,21 +1228,14 @@
954 return theValue.hash();
955 }
956
957- bool equals(
958- const store::Item* other,
959- long timezone = 0,
960- const XQPCollator* aCollation = 0) const
961+ bool equals(const store::Item* i, long tz = 0, const XQPCollator* c = 0) const
962 {
963- return theValue == other->getDurationValue();
964+ return theValue == i->getDurationValue();
965 }
966
967-
968- long compare(
969- const Item* other,
970- long timezone = 0,
971- const XQPCollator* aCollation = 0) const
972+ long compare(const Item* i, long tz = 0, const XQPCollator* c = 0) const
973 {
974- return theValue.compare(other->getDurationValue());
975+ return theValue.compare(i->getDurationValue());
976 }
977
978 bool getEBV() const;
979@@ -1277,9 +1261,14 @@
980 xs_double theValue;
981
982 protected:
983- DoubleItem(const xs_double& aValue) : theValue( aValue ) {}
984+ DoubleItem(store::SchemaTypeCode t, const xs_double& v)
985+ :
986+ AtomicItem(t),
987+ theValue(v)
988+ {
989+ }
990
991- DoubleItem() {}
992+ DoubleItem(store::SchemaTypeCode t) : AtomicItem(t) {}
993
994 public:
995 xs_double getDoubleValue() const { return theValue; }
996@@ -1288,8 +1277,6 @@
997
998 bool isPosOrNegInf() const;
999
1000- store::SchemaTypeCode getTypeCode() const { return store::XS_DOUBLE; }
1001-
1002 store::Item* getType() const;
1003
1004 uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const;
1005@@ -1336,9 +1323,14 @@
1006 xs_float theValue;
1007
1008 protected:
1009- FloatItem(const xs_float& aValue) : theValue ( aValue ) {}
1010+ FloatItem(store::SchemaTypeCode t, const xs_float& v)
1011+ :
1012+ AtomicItem(t),
1013+ theValue(v)
1014+ {
1015+ }
1016
1017- FloatItem() {}
1018+ FloatItem(store::SchemaTypeCode t) : AtomicItem(t) {}
1019
1020 public:
1021 xs_float getFloatValue() const { return theValue; }
1022@@ -1349,8 +1341,6 @@
1023
1024 bool isPosOrNegInf() const;
1025
1026- store::SchemaTypeCode getTypeCode() const { return store::XS_FLOAT; }
1027-
1028 store::Item* getType() const;
1029
1030 uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const;
1031@@ -1419,15 +1409,19 @@
1032 protected:
1033 xs_decimal theValue;
1034
1035- DecimalItem(const xs_decimal& aValue) : theValue(aValue) {}
1036+protected:
1037+ DecimalItem(store::SchemaTypeCode t, const xs_decimal& v)
1038+ :
1039+ AtomicItem(t),
1040+ theValue(v)
1041+ {
1042+ }
1043
1044- DecimalItem() {}
1045+ DecimalItem(store::SchemaTypeCode t) : AtomicItem(t) {}
1046
1047 public:
1048 xs_decimal getDecimalValue() const { return theValue; }
1049
1050- store::SchemaTypeCode getTypeCode() const { return store::XS_DECIMAL; }
1051-
1052 store::Item* getType() const;
1053
1054 uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const
1055@@ -1471,11 +1465,13 @@
1056 class IntegerItem : public AtomicItem
1057 {
1058 protected:
1059- IntegerItem() {}
1060+ IntegerItem(store::SchemaTypeCode t) : AtomicItem(t) {}
1061
1062 public:
1063 virtual xs_decimal getDecimalValue() const = 0;
1064+
1065 virtual xs_integer getIntegerValue() const = 0;
1066+
1067 virtual xs_long getLongValue() const = 0;
1068
1069 bool isNaN() const { return false; }
1070@@ -1494,9 +1490,14 @@
1071 xs_integer theValue;
1072
1073 protected:
1074- IntegerItemImpl(const xs_integer& aValue) : theValue ( aValue ) {}
1075+ IntegerItemImpl(store::SchemaTypeCode t, const xs_integer& v)
1076+ :
1077+ IntegerItem(t),
1078+ theValue(v)
1079+ {
1080+ }
1081
1082- IntegerItemImpl() {}
1083+ IntegerItemImpl(store::SchemaTypeCode t) : IntegerItem(t) {}
1084
1085 public:
1086 xs_decimal getDecimalValue() const;
1087@@ -1515,8 +1516,6 @@
1088
1089 void appendStringValue(zstring&) const;
1090
1091- store::SchemaTypeCode getTypeCode() const { return store::XS_INTEGER; }
1092-
1093 store::Item* getType() const;
1094
1095 uint32_t hash(long = 0, const XQPCollator* aCollation = 0) const;
1096@@ -1547,9 +1546,14 @@
1097 protected:
1098 xs_nonPositiveInteger theValue;
1099
1100- NonPositiveIntegerItem(const xs_integer& aValue) : theValue(aValue) {}
1101+ NonPositiveIntegerItem(store::SchemaTypeCode t, const xs_integer& v)
1102+ :
1103+ IntegerItem(t),
1104+ theValue(v)
1105+ {
1106+ }
1107
1108- NonPositiveIntegerItem() {}
1109+ NonPositiveIntegerItem(store::SchemaTypeCode t) : IntegerItem(t) {}
1110
1111 public:
1112 xs_decimal getDecimalValue() const;
1113@@ -1564,11 +1568,6 @@
1114
1115 void appendStringValue(zstring&) const;
1116
1117- virtual store::SchemaTypeCode getTypeCode() const
1118- {
1119- return store::XS_NON_POSITIVE_INTEGER;
1120- }
1121-
1122 virtual store::Item* getType() const;
1123
1124 uint32_t hash(long = 0, const XQPCollator* aCollation = 0) const;
1125@@ -1597,13 +1596,15 @@
1126 friend class BasicItemFactory;
1127
1128 protected:
1129- NegativeIntegerItem(const xs_integer& aValue) : NonPositiveIntegerItem(aValue) {}
1130+ NegativeIntegerItem(store::SchemaTypeCode t, const xs_integer& v)
1131+ :
1132+ NonPositiveIntegerItem(t, v)
1133+ {
1134+ }
1135
1136- NegativeIntegerItem() {}
1137+ NegativeIntegerItem(store::SchemaTypeCode t) : NonPositiveIntegerItem(t) {}
1138
1139 public:
1140- store::SchemaTypeCode getTypeCode() const { return store::XS_NEGATIVE_INTEGER; }
1141-
1142 store::Item* getType() const;
1143
1144 zstring show() const;
1145@@ -1620,9 +1621,14 @@
1146 protected:
1147 xs_nonNegativeInteger theValue;
1148
1149- NonNegativeIntegerItem(const xs_nonNegativeInteger& aValue) : theValue(aValue) {}
1150+ NonNegativeIntegerItem(store::SchemaTypeCode t, const xs_nonNegativeInteger& v)
1151+ :
1152+ IntegerItem(t),
1153+ theValue(v)
1154+ {
1155+ }
1156
1157- NonNegativeIntegerItem() {}
1158+ NonNegativeIntegerItem(store::SchemaTypeCode t) : IntegerItem(t) {}
1159
1160 public:
1161 xs_decimal getDecimalValue() const;
1162@@ -1639,11 +1645,6 @@
1163
1164 void appendStringValue(zstring&) const;
1165
1166- virtual store::SchemaTypeCode getTypeCode() const
1167- {
1168- return store::XS_NON_NEGATIVE_INTEGER;
1169- }
1170-
1171 virtual store::Item* getType() const;
1172
1173 uint32_t hash(long = 0, const XQPCollator* aCollation = 0) const;
1174@@ -1672,15 +1673,15 @@
1175 friend class BasicItemFactory;
1176
1177 protected:
1178- PositiveIntegerItem(const xs_positiveInteger& aValue)
1179+ PositiveIntegerItem(store::SchemaTypeCode t, const xs_positiveInteger& v)
1180 :
1181- NonNegativeIntegerItem(aValue) { }
1182+ NonNegativeIntegerItem(t, v)
1183+ {
1184+ }
1185
1186- PositiveIntegerItem() {}
1187+ PositiveIntegerItem(store::SchemaTypeCode t) : NonNegativeIntegerItem(t) {}
1188
1189 public:
1190- store::SchemaTypeCode getTypeCode() const { return store::XS_POSITIVE_INTEGER; }
1191-
1192 store::Item* getType() const;
1193
1194 zstring show() const;
1195@@ -1699,9 +1700,14 @@
1196 xs_long theValue;
1197
1198 protected:
1199- LongItem(xs_long aValue) : theValue(aValue) {}
1200+ LongItem(store::SchemaTypeCode t, xs_long v)
1201+ :
1202+ AtomicItem(t),
1203+ theValue(v)
1204+ {
1205+ }
1206
1207- LongItem() {}
1208+ LongItem(store::SchemaTypeCode t) : AtomicItem(t) {}
1209
1210 public:
1211 xs_decimal getDecimalValue() const;
1212@@ -1712,8 +1718,6 @@
1213
1214 xs_nonNegativeInteger getUnsignedIntegerValue() const;
1215
1216- store::SchemaTypeCode getTypeCode() const { return store::XS_LONG; }
1217-
1218 store::Item* getType() const;
1219
1220 uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const
1221@@ -1779,9 +1783,14 @@
1222 xs_int theValue;
1223
1224 protected:
1225- IntItem(xs_int aValue) : theValue(aValue) {}
1226+ IntItem(store::SchemaTypeCode t, xs_int v)
1227+ :
1228+ AtomicItem(t),
1229+ theValue(v)
1230+ {
1231+ }
1232
1233- IntItem() {}
1234+ IntItem(store::SchemaTypeCode t) : AtomicItem(t) {}
1235
1236 public:
1237 bool isNaN() const { return false; }
1238@@ -1794,8 +1803,6 @@
1239
1240 xs_int getIntValue() const { return theValue; }
1241
1242- store::SchemaTypeCode getTypeCode() const { return store::XS_INT; }
1243-
1244 store::Item* getType( ) const;
1245
1246 uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const
1247@@ -1859,9 +1866,14 @@
1248 xs_short theValue;
1249
1250 protected:
1251- ShortItem(xs_short aValue) : theValue(aValue) {}
1252+ ShortItem(store::SchemaTypeCode t, xs_short v)
1253+ :
1254+ AtomicItem(t),
1255+ theValue(v)
1256+ {
1257+ }
1258
1259- ShortItem() {}
1260+ ShortItem(store::SchemaTypeCode t) : AtomicItem(t) {}
1261
1262 public:
1263 xs_decimal getDecimalValue() const;
1264@@ -1874,8 +1886,6 @@
1265
1266 xs_short getShortValue() const { return theValue; }
1267
1268- store::SchemaTypeCode getTypeCode() const { return store::XS_SHORT; }
1269-
1270 store::Item* getType() const;
1271
1272 uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const
1273@@ -1941,9 +1951,14 @@
1274 xs_byte theValue;
1275
1276 protected:
1277- ByteItem(xs_byte aValue) : theValue(aValue) {}
1278+ ByteItem(store::SchemaTypeCode t, xs_byte v)
1279+ :
1280+ AtomicItem(t),
1281+ theValue(v)
1282+ {
1283+ }
1284
1285- ByteItem() {}
1286+ ByteItem(store::SchemaTypeCode t) : AtomicItem(t) {}
1287
1288 public:
1289 xs_decimal getDecimalValue() const;
1290@@ -1958,8 +1973,6 @@
1291
1292 xs_byte getByteValue() const { return theValue; }
1293
1294- store::SchemaTypeCode getTypeCode() const { return store::XS_BYTE; }
1295-
1296 store::Item* getType() const;
1297
1298 uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const
1299@@ -2025,9 +2038,14 @@
1300 xs_unsignedLong theValue;
1301
1302 protected:
1303- UnsignedLongItem(xs_unsignedLong aValue) : theValue(aValue) {}
1304+ UnsignedLongItem(store::SchemaTypeCode t, xs_unsignedLong v)
1305+ :
1306+ AtomicItem(t),
1307+ theValue(v)
1308+ {
1309+ }
1310
1311- UnsignedLongItem() {}
1312+ UnsignedLongItem(store::SchemaTypeCode t) : AtomicItem(t) {}
1313
1314 public:
1315 bool isNaN() const { return false; }
1316@@ -2040,8 +2058,6 @@
1317
1318 xs_unsignedLong getUnsignedLongValue() const { return theValue; }
1319
1320- store::SchemaTypeCode getTypeCode() const { return store::XS_UNSIGNED_LONG; }
1321-
1322 store::Item* getType() const;
1323
1324 uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const
1325@@ -2105,9 +2121,14 @@
1326 xs_unsignedInt theValue;
1327
1328 protected:
1329- UnsignedIntItem(xs_unsignedInt aValue) : theValue(aValue) {}
1330+ UnsignedIntItem(store::SchemaTypeCode t, xs_unsignedInt v)
1331+ :
1332+ AtomicItem(t),
1333+ theValue(v)
1334+ {
1335+ }
1336
1337- UnsignedIntItem() {}
1338+ UnsignedIntItem(store::SchemaTypeCode t) : AtomicItem(t) {}
1339
1340 public:
1341 bool isNaN() const { return false; }
1342@@ -2124,8 +2145,6 @@
1343
1344 xs_unsignedInt getUnsignedIntValue() const { return theValue; }
1345
1346- store::SchemaTypeCode getTypeCode() const { return store::XS_UNSIGNED_INT; }
1347-
1348 store::Item* getType() const;
1349
1350 uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const
1351@@ -2196,9 +2215,14 @@
1352 xs_unsignedShort theValue;
1353
1354 protected:
1355- UnsignedShortItem(xs_unsignedShort aValue) : theValue(aValue) {}
1356+ UnsignedShortItem(store::SchemaTypeCode t, xs_unsignedShort v)
1357+ :
1358+ AtomicItem(t),
1359+ theValue(v)
1360+ {
1361+ }
1362
1363- UnsignedShortItem() {}
1364+ UnsignedShortItem(store::SchemaTypeCode t) : AtomicItem(t) {}
1365
1366 public:
1367 xs_decimal getDecimalValue() const;
1368@@ -2217,8 +2241,6 @@
1369
1370 bool isNaN() const { return false; }
1371
1372- store::SchemaTypeCode getTypeCode() const { return store::XS_UNSIGNED_SHORT; }
1373-
1374 store::Item* getType() const;
1375
1376 uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const
1377@@ -2289,9 +2311,17 @@
1378 xs_unsignedByte theValue;
1379
1380 protected:
1381- UnsignedByteItem(xs_unsignedByte aValue) : theValue(aValue) {}
1382+ UnsignedByteItem(store::SchemaTypeCode t, xs_unsignedByte v)
1383+ :
1384+ AtomicItem(t),
1385+ theValue(v)
1386+ {}
1387
1388- UnsignedByteItem() : theValue(0) {}
1389+ UnsignedByteItem(store::SchemaTypeCode t)
1390+ :
1391+ AtomicItem(t),
1392+ theValue(0)
1393+ {}
1394
1395 public:
1396 xs_decimal getDecimalValue() const;
1397@@ -2312,8 +2342,6 @@
1398
1399 bool isNaN() const { return false; }
1400
1401- store::SchemaTypeCode getTypeCode() const { return store::XS_UNSIGNED_BYTE; }
1402-
1403 store::Item* getType() const;
1404
1405 uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const
1406@@ -2383,15 +2411,18 @@
1407 xs_boolean theValue;
1408
1409 protected:
1410- BooleanItem(xs_boolean aValue) : theValue(aValue) {}
1411+ BooleanItem(store::SchemaTypeCode t, xs_boolean v)
1412+ :
1413+ AtomicItem(t),
1414+ theValue(v)
1415+ {
1416+ }
1417
1418- BooleanItem() {}
1419+ BooleanItem(store::SchemaTypeCode t) : AtomicItem(t) {}
1420
1421 public:
1422 xs_boolean getBooleanValue() const { return theValue; }
1423
1424- store::SchemaTypeCode getTypeCode() const { return store::XS_BOOLEAN; }
1425-
1426 store::Item* getType() const;
1427
1428 uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const;
1429@@ -2435,14 +2466,24 @@
1430
1431 protected:
1432 std::vector<char> theValue;
1433- bool theIsEncoded;
1434+ bool theIsEncoded;
1435
1436 protected:
1437- Base64BinaryItem(bool aIsEncoded)
1438- : theIsEncoded(aIsEncoded) {}
1439+ Base64BinaryItem(store::SchemaTypeCode t, bool aIsEncoded)
1440+ :
1441+ AtomicItem(t),
1442+ theIsEncoded(aIsEncoded)
1443+ {
1444+ }
1445
1446- Base64BinaryItem(const char* aValue, size_t aSize, bool aIsEncoded = true)
1447- : theIsEncoded(aIsEncoded)
1448+ Base64BinaryItem(
1449+ store::SchemaTypeCode t,
1450+ const char* aValue,
1451+ size_t aSize,
1452+ bool aIsEncoded = true)
1453+ :
1454+ AtomicItem(t),
1455+ theIsEncoded(aIsEncoded)
1456 {
1457 theValue.reserve(aSize);
1458 theValue.insert(theValue.begin(), aValue, aValue + aSize);
1459@@ -2451,8 +2492,6 @@
1460 public:
1461 const char* getBase64BinaryValue(size_t& data) const;
1462
1463- store::SchemaTypeCode getTypeCode() const { return store::XS_BASE64BINARY; }
1464-
1465 store::Item* getType() const;
1466
1467 bool isEncoded() const { return theIsEncoded; }
1468@@ -2496,25 +2535,28 @@
1469 protected:
1470 std::istream & theIstream;
1471
1472- bool theIsMaterialized;
1473- bool theIsConsumed;
1474- bool theIsSeekable;
1475+ bool theIsMaterialized;
1476+ bool theIsConsumed;
1477+ bool theIsSeekable;
1478
1479 StreamReleaser theStreamReleaser;
1480
1481 protected:
1482 StreamableBase64BinaryItem(
1483+ store::SchemaTypeCode t,
1484 std::istream& aStream,
1485 StreamReleaser streamReleaser,
1486 bool seekable = false,
1487 bool is_encoded = false)
1488- : Base64BinaryItem(is_encoded),
1489- theIstream(aStream),
1490- theIsMaterialized(false),
1491- theIsConsumed(false),
1492- theIsSeekable(seekable),
1493- theStreamReleaser(streamReleaser)
1494- {}
1495+ :
1496+ Base64BinaryItem(t, is_encoded),
1497+ theIstream(aStream),
1498+ theIsMaterialized(false),
1499+ theIsConsumed(false),
1500+ theIsSeekable(seekable),
1501+ theStreamReleaser(streamReleaser)
1502+ {
1503+ }
1504
1505 void materialize() const;
1506
1507@@ -2539,8 +2581,6 @@
1508
1509 const char* getBase64BinaryValue(size_t&) const;
1510
1511- store::SchemaTypeCode getTypeCode() const { return store::XS_BASE64BINARY; }
1512-
1513 uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const;
1514
1515 zstring getStringValue() const;
1516@@ -2564,15 +2604,18 @@
1517 xs_hexBinary theValue;
1518
1519 protected:
1520- HexBinaryItem(xs_hexBinary value) : theValue(value) {}
1521+ HexBinaryItem(store::SchemaTypeCode t, xs_hexBinary v)
1522+ :
1523+ AtomicItem(t),
1524+ theValue(v)
1525+ {
1526+ }
1527
1528- HexBinaryItem() {}
1529+ HexBinaryItem(store::SchemaTypeCode t) : AtomicItem(t) {}
1530
1531 public:
1532 xs_hexBinary getHexBinaryValue() const { return theValue; }
1533
1534- store::SchemaTypeCode getTypeCode() const { return store::XS_HEXBINARY; }
1535-
1536 store::Item* getType() const;
1537
1538 uint32_t hash(long timezone = 0, const XQPCollator* coll = 0) const;
1539@@ -2616,7 +2659,10 @@
1540 ZorbaException * theError;
1541
1542 protected:
1543- ErrorItem(ZorbaException* error) : theError(error)
1544+ ErrorItem(ZorbaException* error)
1545+ :
1546+ AtomicItem(store::XS_LAST),
1547+ theError(error)
1548 {
1549 theUnion.itemKind = ERROR_;
1550 }
1551
1552=== modified file 'src/store/naive/item.cpp'
1553--- src/store/naive/item.cpp 2012-12-14 13:23:51 +0000
1554+++ src/store/naive/item.cpp 2013-01-16 16:58:20 +0000
1555@@ -225,63 +225,8 @@
1556 }
1557
1558
1559-Item::ItemKind Item::getKind() const
1560-{
1561- //if (theUnion.treeRCPtr == 0)
1562- // return UNKNOWN;
1563-
1564- if ((reinterpret_cast<uint64_t>(theUnion.treeRCPtr) & 0x1) == 0)
1565- return NODE;
1566-
1567- return static_cast<ItemKind>(theUnion.itemKind);
1568-}
1569-
1570-
1571-bool Item::isNode() const
1572-{
1573- return ((reinterpret_cast<uint64_t>(theUnion.treeRCPtr) & 0x1) == 0 &&
1574- theUnion.treeRCPtr != 0);
1575-}
1576-
1577-
1578-bool Item::isAtomic() const
1579-{
1580- return (theUnion.itemKind == ATOMIC);
1581-}
1582-
1583-
1584-bool Item::isList() const
1585-{
1586- return (theUnion.itemKind == LIST);
1587-}
1588-
1589-
1590-bool Item::isPul() const
1591-{
1592- return (theUnion.itemKind == PUL);
1593-}
1594-
1595-
1596-bool Item::isError() const
1597-{
1598- return (theUnion.itemKind == ERROR_);
1599-}
1600-
1601-
1602-bool Item::isFunction() const
1603-{
1604- return (theUnion.itemKind == FUNCTION);
1605-}
1606-
1607-
1608 #ifdef ZORBA_WITH_JSON
1609
1610-bool Item::isJSONItem() const
1611-{
1612- return (theUnion.itemKind == JSONIQ);
1613-}
1614-
1615-
1616 bool Item::isJSONObject() const
1617 {
1618 return false;
1619@@ -334,10 +279,14 @@
1620
1621 store::SchemaTypeCode Item::getTypeCode() const
1622 {
1623+ if (isAtomic())
1624+ {
1625+ return static_cast<SchemaTypeCode>(theUnion.itemKind >> 4);
1626+ }
1627+
1628 throw ZORBA_EXCEPTION(
1629 zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
1630- ERROR_PARAMS( __FUNCTION__, typeid(*this).name() )
1631- );
1632+ ERROR_PARAMS(__FUNCTION__, typeid(*this).name()));
1633 }
1634
1635
1636
1637=== modified file 'src/store/naive/json_items.h'
1638--- src/store/naive/json_items.h 2013-01-08 05:02:54 +0000
1639+++ src/store/naive/json_items.h 2013-01-16 16:58:20 +0000
1640@@ -53,7 +53,7 @@
1641 SYNC_CODE(mutable RCLock theRCLock;)
1642
1643 public:
1644- JSONNull() : AtomicItem() { }
1645+ JSONNull() : AtomicItem(store::JS_NULL) { }
1646
1647 virtual ~JSONNull() {}
1648
1649
1650=== modified file 'src/store/naive/pul_primitives.cpp'
1651--- src/store/naive/pul_primitives.cpp 2013-01-08 08:34:08 +0000
1652+++ src/store/naive/pul_primitives.cpp 2013-01-16 16:58:20 +0000
1653@@ -202,14 +202,17 @@
1654 std::size_t numChildren = children.size();
1655 theNewChildren.resize(numChildren);
1656
1657- for (std::size_t i = 0; i < numChildren; i++)
1658+ for (csize i = 0; i < numChildren; ++i)
1659 {
1660 if (i > 0 &&
1661 children[i]->getNodeKind() == store::StoreConsts::textNode &&
1662- theNewChildren[i-1]->getNodeKind() == store::StoreConsts::textNode)
1663+ theNewChildren[numNewChildren-1]->getNodeKind() == store::StoreConsts::textNode)
1664 {
1665- TextNode* node1 = reinterpret_cast<TextNode*>(theNewChildren[i-1].getp());
1666- TextNode* node2 = reinterpret_cast<TextNode*>(children[i].getp());
1667+ TextNode* node1 =
1668+ reinterpret_cast<TextNode*>(theNewChildren[numNewChildren-1].getp());
1669+
1670+ TextNode* node2 =
1671+ reinterpret_cast<TextNode*>(children[i].getp());
1672
1673 zstring newText;
1674 newText.reserve(node1->getText().size() + node2->getText().size());
1675@@ -219,13 +222,15 @@
1676 }
1677 else
1678 {
1679- theNewChildren[i].transfer(children[i]);
1680+ theNewChildren[numNewChildren].transfer(children[i]);
1681 ++numNewChildren;
1682 }
1683
1684 if (theRemoveType == false)
1685 {
1686- store::StoreConsts::NodeKind childKind = theNewChildren[i]->getNodeKind();
1687+ store::StoreConsts::NodeKind childKind =
1688+ theNewChildren[numNewChildren-1]->getNodeKind();
1689+
1690 if (childKind == store::StoreConsts::elementNode ||
1691 childKind == store::StoreConsts::textNode)
1692 theRemoveType = true;
1693
1694=== modified file 'src/store/naive/simple_index.cpp'
1695--- src/store/naive/simple_index.cpp 2012-09-19 21:16:15 +0000
1696+++ src/store/naive/simple_index.cpp 2013-01-16 16:58:20 +0000
1697@@ -117,8 +117,8 @@
1698 /*******************************************************************************
1699 TODO: proper initialization order is not guaranteed => use factory instead
1700 ********************************************************************************/
1701-store::Item_t IndexConditionImpl::theNegInf(new DecimalItem);
1702-store::Item_t IndexConditionImpl::thePosInf(new DecimalItem);
1703+store::Item_t IndexConditionImpl::theNegInf(new DecimalItem(store::XS_DECIMAL));
1704+store::Item_t IndexConditionImpl::thePosInf(new DecimalItem(store::XS_DECIMAL));
1705
1706
1707 /*******************************************************************************
1708
1709=== modified file 'src/store/naive/simple_item_factory.cpp'
1710--- src/store/naive/simple_item_factory.cpp 2012-12-28 10:24:59 +0000
1711+++ src/store/naive/simple_item_factory.cpp 2013-01-16 16:58:20 +0000
1712@@ -50,8 +50,8 @@
1713 :
1714 theUriPool(uriPool),
1715 theQNamePool(qnPool),
1716- theTrueItem(new BooleanItem(true)),
1717- theFalseItem(new BooleanItem(false))
1718+ theTrueItem(new BooleanItem(store::XS_BOOLEAN, true)),
1719+ theFalseItem(new BooleanItem(store::XS_BOOLEAN, false))
1720 #ifdef ZORBA_WITH_JSON
1721 ,theNullItem(new json::JSONNull())
1722 #endif
1723@@ -105,7 +105,7 @@
1724 {
1725 zstring str = value;
1726 theUriPool->insert(str);
1727- result = new AnyUriItem(str);
1728+ result = new AnyUriItem(store::XS_ANY_URI, str);
1729 return true;
1730 }
1731
1732@@ -114,7 +114,7 @@
1733 {
1734 zstring str;
1735 theUriPool->insertc(value, str);
1736- result = new AnyUriItem(str);
1737+ result = new AnyUriItem(store::XS_ANY_URI, str);
1738 return true;
1739 }
1740
1741@@ -123,7 +123,7 @@
1742 store::Item_t& result,
1743 zstring& value)
1744 {
1745- result = new StructuralAnyUriItem(value);
1746+ result = new StructuralAnyUriItem(store::XS_ANY_URI, value);
1747 return true;
1748 }
1749
1750@@ -136,61 +136,63 @@
1751 const OrdPath& ordPath)
1752 {
1753 ZORBA_FATAL(nodeKind,"Unexpected node kind");
1754- result = new StructuralAnyUriItem(collectionId, treeId, nodeKind, ordPath);
1755+
1756+ result = new StructuralAnyUriItem(store::XS_ANY_URI,
1757+ collectionId, treeId, nodeKind, ordPath);
1758 return true;
1759 }
1760
1761
1762 bool BasicItemFactory::createString(store::Item_t& result, zstring& value)
1763 {
1764- result = new StringItem(value);
1765+ result = new StringItem(store::XS_STRING, value);
1766 return true;
1767 }
1768
1769
1770 bool BasicItemFactory::createStreamableString(
1771 store::Item_t& result,
1772- std::istream &stream,
1773+ std::istream& stream,
1774 StreamReleaser streamReleaser,
1775 bool seekable)
1776 {
1777- result = new StreamableStringItem( stream, streamReleaser, seekable );
1778+ result = new StreamableStringItem(store::XS_STRING, stream, streamReleaser, seekable);
1779 return true;
1780 }
1781
1782 bool BasicItemFactory::createSharedStreamableString(
1783- store::Item_t &result,
1784- store::Item_t &streamable_dependent)
1785+ store::Item_t& result,
1786+ store::Item_t& streamable_dependent)
1787 {
1788- result = new StreamableStringItem( streamable_dependent );
1789+ result = new StreamableStringItem(store::XS_STRING, streamable_dependent);
1790 return true;
1791 }
1792
1793
1794 bool BasicItemFactory::createNormalizedString(store::Item_t& result, zstring& value)
1795 {
1796- result = new NormalizedStringItem(value);
1797+ result = new NormalizedStringItem(store::XS_NORMALIZED_STRING, value);
1798 return true;
1799 }
1800
1801
1802 bool BasicItemFactory::createToken(store::Item_t& result, zstring& value )
1803 {
1804- result = new TokenItem(value);
1805+ result = new TokenItem(store::XS_TOKEN, value);
1806 return true;
1807 }
1808
1809
1810 bool BasicItemFactory::createLanguage(store::Item_t& result, zstring& value )
1811 {
1812- result = new LanguageItem(value);
1813+ result = new LanguageItem(store::XS_LANGUAGE, value);
1814 return true;
1815 }
1816
1817
1818 bool BasicItemFactory::createNMTOKEN(store::Item_t& result, zstring& value )
1819 {
1820- result = new NMTOKENItem(value);
1821+ result = new NMTOKENItem(store::XS_NMTOKEN, value);
1822 return true;
1823 }
1824
1825@@ -203,10 +205,10 @@
1826
1827 //create VectorItem with all tokens
1828 std::vector<store::Item_t> typedValues;
1829- for ( unsigned int i = 0; i < atomicTextValues.size() ; i++)
1830+ for (csize i = 0; i < atomicTextValues.size(); ++i)
1831 {
1832 store::Item_t resultItem;
1833- if ( createNMTOKEN(resultItem, atomicTextValues[i]) )
1834+ if (createNMTOKEN(resultItem, atomicTextValues[i]))
1835 {
1836 typedValues.push_back(resultItem.getp());
1837 }
1838@@ -217,30 +219,30 @@
1839 }
1840
1841
1842-bool BasicItemFactory::createName(store::Item_t& result, zstring& value )
1843+bool BasicItemFactory::createName(store::Item_t& result, zstring& value)
1844 {
1845- result = new NameItem(value);
1846+ result = new NameItem(store::XS_NAME, value);
1847 return true;
1848 }
1849
1850
1851 bool BasicItemFactory::createNCName(store::Item_t& result, zstring& value )
1852 {
1853- result = new NCNameItem(value);
1854+ result = new NCNameItem(store::XS_NCNAME, value);
1855 return true;
1856 }
1857
1858
1859 bool BasicItemFactory::createID(store::Item_t& result, zstring& value )
1860 {
1861- result = new IDItem(value);
1862+ result = new IDItem(store::XS_ID, value);
1863 return true;
1864 }
1865
1866
1867 bool BasicItemFactory::createIDREF(store::Item_t& result, zstring& value)
1868 {
1869- result = new IDREFItem(value);
1870+ result = new IDREFItem(store::XS_IDREF, value);
1871 return true;
1872 }
1873
1874@@ -253,10 +255,10 @@
1875
1876 //create VectorItem with all tokens
1877 std::vector<store::Item_t> typedValues;
1878- for ( unsigned int i = 0; i < atomicTextValues.size() ; i++)
1879+ for (csize i = 0; i < atomicTextValues.size(); i++)
1880 {
1881 store::Item_t resultItem;
1882- if ( createIDREF(resultItem, atomicTextValues[i]) )
1883+ if (createIDREF(resultItem, atomicTextValues[i]))
1884 {
1885 typedValues.push_back(resultItem.getp());
1886 }
1887@@ -269,7 +271,7 @@
1888
1889 bool BasicItemFactory::createENTITY(store::Item_t& result, zstring& value )
1890 {
1891- result = new ENTITYItem(value);
1892+ result = new ENTITYItem(store::XS_ENTITY, value);
1893 return true;
1894 }
1895
1896@@ -282,10 +284,10 @@
1897
1898 //create VectorItem with all tokens
1899 std::vector<store::Item_t> typedValues;
1900- for ( unsigned int i = 0; i < atomicTextValues.size() ; i++)
1901+ for (csize i = 0; i < atomicTextValues.size(); i++)
1902 {
1903 store::Item_t resultItem;
1904- if ( createENTITY(resultItem, atomicTextValues[i]) )
1905+ if (createENTITY(resultItem, atomicTextValues[i]))
1906 {
1907 typedValues.push_back(resultItem.getp());
1908 }
1909@@ -298,7 +300,7 @@
1910
1911 bool BasicItemFactory::createUntypedAtomic(store::Item_t& result, zstring& value)
1912 {
1913- result = new UntypedAtomicItem(value);
1914+ result = new UntypedAtomicItem(store::XS_UNTYPED_ATOMIC, value);
1915 return true;
1916 }
1917
1918@@ -307,28 +309,28 @@
1919 store::Item_t& result,
1920 const xs_double& value)
1921 {
1922- result = new DoubleItem(value);
1923+ result = new DoubleItem(store::XS_DOUBLE, value);
1924 return true;
1925 }
1926
1927
1928 bool BasicItemFactory::createFloat(store::Item_t& result, const xs_float& value)
1929 {
1930- result = new FloatItem(value);
1931+ result = new FloatItem(store::XS_FLOAT, value);
1932 return true;
1933 }
1934
1935
1936 bool BasicItemFactory::createDecimal(store::Item_t& result, const xs_decimal& value)
1937 {
1938- result = new DecimalItem(value);
1939+ result = new DecimalItem(store::XS_DECIMAL, value);
1940 return true;
1941 }
1942
1943
1944 bool BasicItemFactory::createInteger(store::Item_t& result, const xs_integer& value)
1945 {
1946- result = new IntegerItemImpl( value );
1947+ result = new IntegerItemImpl(store::XS_INTEGER, value);
1948 return true;
1949 }
1950
1951@@ -338,7 +340,7 @@
1952 const xs_integer& value)
1953 {
1954 ZORBA_ASSERT(value.sign() <= 0);
1955- result = new NonPositiveIntegerItem( value );
1956+ result = new NonPositiveIntegerItem(store::XS_NON_POSITIVE_INTEGER, value);
1957 return true;
1958 }
1959
1960@@ -348,7 +350,7 @@
1961 const xs_integer& value)
1962 {
1963 ZORBA_ASSERT(value.sign() < 0);
1964- result = new NegativeIntegerItem(value);
1965+ result = new NegativeIntegerItem(store::XS_NEGATIVE_INTEGER, value);
1966 return true;
1967 }
1968
1969@@ -357,7 +359,7 @@
1970 store::Item_t& result,
1971 const xs_nonNegativeInteger& value )
1972 {
1973- result = new NonNegativeIntegerItem( value );
1974+ result = new NonNegativeIntegerItem(store::XS_NON_NEGATIVE_INTEGER, value);
1975 return true;
1976 }
1977
1978@@ -368,81 +370,85 @@
1979 const xs_positiveInteger& value)
1980 {
1981 ZORBA_ASSERT(value.sign() > 0);
1982- result = new PositiveIntegerItem( value );
1983+ result = new PositiveIntegerItem(store::XS_POSITIVE_INTEGER,value);
1984 return true;
1985 }
1986
1987
1988 bool BasicItemFactory::createLong(store::Item_t& result, xs_long value)
1989 {
1990- result = new LongItem(value);
1991+ result = new LongItem(store::XS_LONG, value);
1992 return true;
1993 }
1994
1995
1996 bool BasicItemFactory::createInt(store::Item_t& result, xs_int value)
1997 {
1998- result = new IntItem(value);
1999+ result = new IntItem(store::XS_INT, value);
2000 return true;
2001 }
2002
2003
2004 bool BasicItemFactory::createShort(store::Item_t& result, xs_short value)
2005 {
2006- result = new ShortItem(value);
2007+ result = new ShortItem(store::XS_SHORT, value);
2008 return true;
2009 }
2010
2011
2012 bool BasicItemFactory::createByte(store::Item_t& result, xs_byte value)
2013 {
2014- result = new ByteItem(value);
2015- return true;
2016-}
2017-
2018-
2019-bool BasicItemFactory::createUnsignedLong(store::Item_t& result,
2020- xs_unsignedLong value)
2021-{
2022- result = new UnsignedLongItem(value);
2023- return true;
2024-}
2025-
2026-
2027-bool BasicItemFactory::createUnsignedInt(store::Item_t& result,
2028- xs_unsignedInt value)
2029-{
2030- result = new UnsignedIntItem(value);
2031- return true;
2032-}
2033-
2034-
2035-bool BasicItemFactory::createUnsignedShort(store::Item_t& result,
2036- xs_unsignedShort value)
2037-{
2038- result = new UnsignedShortItem(value);
2039- return true;
2040-}
2041-
2042-
2043-bool BasicItemFactory::createUnsignedByte(store::Item_t& result,
2044- xs_unsignedByte value)
2045-{
2046- result = new UnsignedByteItem(value);
2047+ result = new ByteItem(store::XS_BYTE, value);
2048+ return true;
2049+}
2050+
2051+
2052+bool BasicItemFactory::createUnsignedLong(
2053+ store::Item_t& result,
2054+ xs_unsignedLong value)
2055+{
2056+ result = new UnsignedLongItem(store::XS_UNSIGNED_LONG, value);
2057+ return true;
2058+}
2059+
2060+
2061+bool BasicItemFactory::createUnsignedInt(
2062+ store::Item_t& result,
2063+ xs_unsignedInt value)
2064+{
2065+ result = new UnsignedIntItem(store::XS_UNSIGNED_INT, value);
2066+ return true;
2067+}
2068+
2069+
2070+bool BasicItemFactory::createUnsignedShort(
2071+ store::Item_t& result,
2072+ xs_unsignedShort value)
2073+{
2074+ result = new UnsignedShortItem(store::XS_UNSIGNED_SHORT, value);
2075+ return true;
2076+}
2077+
2078+
2079+bool BasicItemFactory::createUnsignedByte(
2080+ store::Item_t& result,
2081+ xs_unsignedByte value)
2082+{
2083+ result = new UnsignedByteItem(store::XS_UNSIGNED_BYTE, value);
2084 return true;
2085 }
2086
2087
2088 bool BasicItemFactory::createBoolean(store::Item_t& result, xs_boolean value)
2089 {
2090- result = value?theTrueItem:theFalseItem;
2091+ result = (value ? theTrueItem : theFalseItem);
2092 return true;
2093 }
2094
2095
2096 bool BasicItemFactory::createDateTime(store::Item_t& result, const xs_dateTime* value)
2097 {
2098- result = new DateTimeItem(value);
2099+ result = new DateTimeItem(store::XS_DATETIME, value);
2100 return true;
2101 }
2102
2103@@ -452,7 +458,7 @@
2104 const xs_date* date,
2105 const xs_time* time)
2106 {
2107- std::auto_ptr<DateTimeItem> dtin(new DateTimeItem());
2108+ std::auto_ptr<DateTimeItem> dtin(new DateTimeItem(store::XS_DATETIME));
2109 int err = DateTime::createDateTime(date, time, dtin->theValue);
2110 if (err == 0)
2111 {
2112@@ -482,7 +488,7 @@
2113
2114 if (DateTime::createDateTime(year, month, day, hour, minute, second, &tz, dt) == 0)
2115 {
2116- result = new DateTimeItem(&dt);
2117+ result = new DateTimeItem(store::XS_DATETIME, &dt);
2118 return true;
2119 }
2120 else
2121@@ -508,7 +514,7 @@
2122
2123 if (DateTime::createDateTime(year, month, day, hour, minute, second, &tz, dt) == 0)
2124 {
2125- result = new DateTimeItem(&dt);
2126+ result = new DateTimeItem(store::XS_DATETIME, &dt);
2127 return true;
2128 }
2129 else
2130@@ -528,7 +534,7 @@
2131
2132 if (DateTime::parseDateTime(str, strlen, dt) == 0)
2133 {
2134- result = new DateTimeItem(&dt);
2135+ result = new DateTimeItem(store::XS_DATETIME, &dt);
2136 return true;
2137 }
2138 else
2139@@ -553,7 +559,7 @@
2140 {
2141 const xs_date& d = date->getDateValue();
2142 const xs_time& t = time->getTimeValue();
2143- if (! createDateTime(result, &d, &t))
2144+ if (! createDateTime( result, &d, &t))
2145 throw XQUERY_EXCEPTION(err::FORG0008, ERROR_PARAMS(d, t));
2146
2147 return true;
2148@@ -563,7 +569,7 @@
2149
2150 bool BasicItemFactory::createDate(store::Item_t& result, const xs_date* value)
2151 {
2152- result = new DateTimeItem(value);
2153+ result = new DateTimeItem(store::XS_DATE, value);
2154 return true;
2155 }
2156
2157@@ -579,7 +585,7 @@
2158
2159 if (DateTime::createDate(year, month, day, &tz, dt) == 0)
2160 {
2161- result = new DateTimeItem(&dt);
2162+ result = new DateTimeItem(store::XS_DATE, &dt);
2163 return true;
2164 }
2165 else
2166@@ -599,7 +605,7 @@
2167
2168 if (DateTime::parseDate(str, strlen, dt) == 0)
2169 {
2170- result = new DateTimeItem(&dt);
2171+ result = new DateTimeItem(store::XS_DATE, &dt);
2172 return true;
2173 }
2174 else
2175@@ -612,7 +618,7 @@
2176
2177 bool BasicItemFactory::createTime(store::Item_t& result, const xs_time* value)
2178 {
2179- result = new DateTimeItem(value);
2180+ result = new DateTimeItem(store::XS_TIME, value);
2181 return true;
2182 }
2183
2184@@ -626,7 +632,7 @@
2185
2186 if (DateTime::parseTime(str, strlen, dt) == 0)
2187 {
2188- result = new DateTimeItem(&dt);
2189+ result = new DateTimeItem(store::XS_TIME, &dt);
2190 return true;
2191 }
2192 else
2193@@ -648,7 +654,7 @@
2194
2195 if( DateTime::createTime(hour, minute, second, &tz, dt) == 0 )
2196 {
2197- result = new DateTimeItem(&dt);
2198+ result = new DateTimeItem(store::XS_TIME, &dt);
2199 return true;
2200 }
2201 else
2202@@ -671,7 +677,7 @@
2203
2204 if(DateTime::createTime(hour, minute, second, &tz, dt) == 0)
2205 {
2206- result = new DateTimeItem(&dt);
2207+ result = new DateTimeItem(store::XS_TIME, &dt);
2208 return true;
2209 }
2210 else
2211@@ -684,7 +690,7 @@
2212
2213 bool BasicItemFactory::createGDay(store::Item_t& result, const xs_gDay* value)
2214 {
2215- result = new DateTimeItem(value);
2216+ result = new DateTimeItem(store::XS_GDAY, value);
2217 return true;
2218 }
2219
2220@@ -698,7 +704,7 @@
2221
2222 if (DateTime::parseGDay(str, strlen, dt) == 0)
2223 {
2224- result = new DateTimeItem(&dt);
2225+ result = new DateTimeItem(store::XS_GDAY, &dt);
2226 return true;
2227 }
2228 else
2229@@ -715,7 +721,7 @@
2230
2231 if (DateTime::createGDay(day, dt) == 0)
2232 {
2233- result = new DateTimeItem(&dt);
2234+ result = new DateTimeItem(store::XS_GDAY, &dt);
2235 return true;
2236 }
2237 else
2238@@ -728,7 +734,7 @@
2239
2240 bool BasicItemFactory::createGMonth(store::Item_t& result, const xs_gMonth* value)
2241 {
2242- result = new DateTimeItem(value);
2243+ result = new DateTimeItem(store::XS_GMONTH, value);
2244 return true;
2245 }
2246
2247@@ -742,7 +748,7 @@
2248
2249 if (DateTime::parseGMonth(str, strlen, dt) == 0)
2250 {
2251- result = new DateTimeItem(&dt);
2252+ result = new DateTimeItem(store::XS_GMONTH, &dt);
2253 return true;
2254 }
2255 else
2256@@ -759,7 +765,7 @@
2257
2258 if(DateTime::createGMonth(month, dt) == 0)
2259 {
2260- result = new DateTimeItem(&dt);
2261+ result = new DateTimeItem(store::XS_GMONTH, &dt);
2262 return true;
2263 }
2264 else
2265@@ -774,7 +780,7 @@
2266 store::Item_t& result,
2267 const xs_gMonthDay* value)
2268 {
2269- result = new DateTimeItem(value);
2270+ result = new DateTimeItem(store::XS_GMONTH_DAY, value);
2271 return true;
2272 }
2273
2274@@ -788,7 +794,7 @@
2275
2276 if (DateTime::parseGMonthDay(str, strlen, dt) == 0)
2277 {
2278- result = new DateTimeItem(&dt);
2279+ result = new DateTimeItem(store::XS_GMONTH_DAY, &dt);
2280 return true;
2281 }
2282 else
2283@@ -805,7 +811,7 @@
2284
2285 if (DateTime::createGMonthDay(month, day, dt) == 0)
2286 {
2287- result = new DateTimeItem(&dt);
2288+ result = new DateTimeItem(store::XS_GMONTH_DAY, &dt);
2289 return true;
2290 }
2291 else
2292@@ -818,7 +824,7 @@
2293
2294 bool BasicItemFactory::createGYear(store::Item_t& result, const xs_gYear* value)
2295 {
2296- result = new DateTimeItem(value);
2297+ result = new DateTimeItem(store::XS_GYEAR, value);
2298 return true;
2299 }
2300
2301@@ -832,7 +838,7 @@
2302
2303 if (DateTime::parseGYear(str, strlen, dt) == 0)
2304 {
2305- result = new DateTimeItem(&dt);
2306+ result = new DateTimeItem(store::XS_GYEAR, &dt);
2307 return true;
2308 }
2309 else
2310@@ -849,7 +855,7 @@
2311
2312 if(DateTime::createGYear(year, dt) == 0)
2313 {
2314- result = new DateTimeItem(&dt);
2315+ result = new DateTimeItem(store::XS_GYEAR, &dt);
2316 return true;
2317 }
2318 else
2319@@ -864,7 +870,7 @@
2320 store::Item_t& result,
2321 const xs_gYearMonth* value)
2322 {
2323- result = new DateTimeItem(value);
2324+ result = new DateTimeItem(store::XS_GYEAR_MONTH, value);
2325 return true;
2326 }
2327
2328@@ -878,7 +884,7 @@
2329
2330 if (DateTime::parseGYearMonth(str, strlen, dt) == 0)
2331 {
2332- result = new DateTimeItem(&dt);
2333+ result = new DateTimeItem(store::XS_GYEAR_MONTH, &dt);
2334 return true;
2335 }
2336 else
2337@@ -898,7 +904,7 @@
2338
2339 if (DateTime::createGYearMonth(year, month, dt) == 0)
2340 {
2341- result = new DateTimeItem(&dt);
2342+ result = new DateTimeItem(store::XS_GYEAR_MONTH, &dt);
2343 return true;
2344 }
2345 else
2346@@ -913,7 +919,7 @@
2347 store::Item_t& result,
2348 xs_duration* value)
2349 {
2350- result = new DurationItem(value);
2351+ result = new DurationItem(store::XS_DURATION, value);
2352 return true;
2353 }
2354
2355@@ -926,7 +932,7 @@
2356 Duration d;
2357 if (Duration::parseDuration(str, strlen, d) == 0)
2358 {
2359- result = new DurationItem(&d);
2360+ result = new DurationItem(store::XS_DURATION, &d);
2361 return true;
2362 }
2363
2364@@ -945,7 +951,7 @@
2365 double seconds)
2366 {
2367 Duration d(Duration::DURATION_FACET, years, months, days, hours, minutes, seconds);
2368- result = new DurationItem(&d);
2369+ result = new DurationItem(store::XS_DURATION, &d);
2370 return true;
2371 }
2372
2373@@ -954,7 +960,7 @@
2374 store::Item_t& result,
2375 xs_yearMonthDuration* value )
2376 {
2377- result = new DurationItem(value);
2378+ result = new DurationItem(store::XS_YM_DURATION, value);
2379 return true;
2380 }
2381
2382@@ -966,7 +972,7 @@
2383 Duration d;
2384 if (Duration::parseYearMonthDuration(str, strlen, d) == 0)
2385 {
2386- result = new DurationItem(&d);
2387+ result = new DurationItem(store::XS_YM_DURATION, &d);
2388 return true;
2389 }
2390
2391@@ -979,7 +985,7 @@
2392 store::Item_t& result,
2393 xs_dayTimeDuration* value)
2394 {
2395- result = new DurationItem(value);
2396+ result = new DurationItem(store::XS_DT_DURATION, value);
2397 return true;
2398 }
2399
2400@@ -992,7 +998,7 @@
2401 Duration d;
2402 if (Duration::parseDayTimeDuration(str, strlen, d) == 0)
2403 {
2404- result = new DurationItem(&d);
2405+ result = new DurationItem(store::XS_DT_DURATION, &d);
2406 return true;
2407 }
2408
2409@@ -1006,7 +1012,10 @@
2410 xs_base64Binary value)
2411 {
2412 const std::vector<char>& data = value.getData();
2413- result = new Base64BinaryItem(data.size()!=0?&data[0]:0, data.size(), true);
2414+ result = new Base64BinaryItem(store::XS_BASE64BINARY,
2415+ data.size() != 0 ? &data[0] : 0,
2416+ data.size(),
2417+ true);
2418 return true;
2419 }
2420
2421@@ -1016,7 +1025,7 @@
2422 size_t size,
2423 bool encoded)
2424 {
2425- result = new Base64BinaryItem(value, size, encoded);
2426+ result = new Base64BinaryItem(store::XS_BASE64BINARY, value, size, encoded);
2427 return true;
2428 }
2429
2430@@ -1028,14 +1037,18 @@
2431 bool seekable,
2432 bool encoded)
2433 {
2434- result = new StreamableBase64BinaryItem(aStream, aReleaser, seekable, encoded);
2435+ result = new StreamableBase64BinaryItem(store::XS_BASE64BINARY,
2436+ aStream,
2437+ aReleaser,
2438+ seekable,
2439+ encoded);
2440 return true;
2441 }
2442
2443
2444 bool BasicItemFactory::createHexBinary(store::Item_t& result, xs_hexBinary value)
2445 {
2446- result = new HexBinaryItem(value);
2447+ result = new HexBinaryItem(store::XS_HEXBINARY, value);
2448 return true;
2449 }
2450
2451@@ -1046,7 +1059,7 @@
2452 zstring& prefix,
2453 zstring& local)
2454 {
2455- result = new NotationItem(ns, prefix, local);
2456+ result = new NotationItem(store::XS_NOTATION, ns, prefix, local);
2457 return true;
2458 }
2459
2460@@ -1068,14 +1081,14 @@
2461 else
2462 local = str;
2463
2464- result = new NotationItem(nsuri, prefix, local);
2465+ result = new NotationItem(store::XS_NOTATION, nsuri, prefix, local);
2466 return true;
2467 }
2468
2469
2470 bool BasicItemFactory::createNOTATION(store::Item_t& result, store::Item_t& qname)
2471 {
2472- result = new NotationItem(qname);
2473+ result = new NotationItem(store::XS_NOTATION, qname);
2474 return true;
2475 }
2476
2477
2478=== modified file 'src/types/casting.cpp'
2479--- src/types/casting.cpp 2013-01-11 09:42:53 +0000
2480+++ src/types/casting.cpp 2013-01-16 16:58:20 +0000
2481@@ -1111,7 +1111,7 @@
2482 {
2483 DateTime dt;
2484 aItem->getDateTimeValue().createWithNewFacet(DateTime::DATE_FACET, dt);
2485- aFactory->createTime(result, &dt);
2486+ aFactory->createDate(result, &dt);
2487 }
2488
2489
2490@@ -1119,7 +1119,7 @@
2491 {
2492 DateTime dt;
2493 aItem->getDateTimeValue().createWithNewFacet(DateTime::GYEARMONTH_FACET, dt);
2494- aFactory->createTime(result, &dt);
2495+ aFactory->createGYearMonth(result, &dt);
2496 }
2497
2498
2499@@ -1127,7 +1127,7 @@
2500 {
2501 DateTime dt;
2502 aItem->getDateTimeValue().createWithNewFacet(DateTime::GYEAR_FACET, dt);
2503- aFactory->createTime(result, &dt);
2504+ aFactory->createGYear(result, &dt);
2505 }
2506
2507
2508@@ -1135,7 +1135,7 @@
2509 {
2510 DateTime dt;
2511 aItem->getDateTimeValue().createWithNewFacet(DateTime::GMONTHDAY_FACET, dt);
2512- aFactory->createTime(result, &dt);
2513+ aFactory->createGMonthDay(result, &dt);
2514 }
2515
2516
2517@@ -1143,7 +1143,7 @@
2518 {
2519 DateTime dt;
2520 aItem->getDateTimeValue().createWithNewFacet(DateTime::GDAY_FACET, dt);
2521- aFactory->createTime(result, &dt);
2522+ aFactory->createGDay(result, &dt);
2523 }
2524
2525
2526@@ -1151,7 +1151,7 @@
2527 {
2528 DateTime dt;
2529 aItem->getDateTimeValue().createWithNewFacet(DateTime::GMONTH_FACET, dt);
2530- aFactory->createTime(result, &dt);
2531+ aFactory->createGMonth(result, &dt);
2532 }
2533
2534
2535@@ -1187,7 +1187,7 @@
2536 {
2537 DateTime dt;
2538 aItem->getDateValue().createWithNewFacet(DateTime::DATETIME_FACET, dt);
2539- aFactory->createTime(result, &dt);
2540+ aFactory->createDateTime(result, &dt);
2541 }
2542
2543
2544@@ -1195,7 +1195,7 @@
2545 {
2546 DateTime dt;
2547 aItem->getDateValue().createWithNewFacet(DateTime::GYEARMONTH_FACET, dt);
2548- aFactory->createTime(result, &dt);
2549+ aFactory->createGYearMonth(result, &dt);
2550 }
2551
2552
2553@@ -1203,7 +1203,7 @@
2554 {
2555 DateTime dt;
2556 aItem->getDateValue().createWithNewFacet(DateTime::GYEAR_FACET, dt);
2557- aFactory->createTime(result, &dt);
2558+ aFactory->createGYear(result, &dt);
2559 }
2560
2561
2562@@ -1211,7 +1211,7 @@
2563 {
2564 DateTime dt;
2565 aItem->getDateValue().createWithNewFacet(DateTime::GMONTHDAY_FACET, dt);
2566- aFactory->createTime(result, &dt);
2567+ aFactory->createGMonthDay(result, &dt);
2568 }
2569
2570
2571@@ -1219,7 +1219,7 @@
2572 {
2573 DateTime dt;
2574 aItem->getDateValue().createWithNewFacet(DateTime::GDAY_FACET, dt);
2575- aFactory->createTime(result, &dt);
2576+ aFactory->createGDay(result, &dt);
2577 }
2578
2579
2580@@ -1227,7 +1227,7 @@
2581 {
2582 DateTime dt;
2583 aItem->getDateValue().createWithNewFacet(DateTime::GMONTH_FACET, dt);
2584- aFactory->createTime(result, &dt);
2585+ aFactory->createGMonth(result, &dt);
2586 }
2587
2588
2589
2590=== added file 'test/rbkt/ExpQueryResults/zorba/updates/joel.xml.res'
2591--- test/rbkt/ExpQueryResults/zorba/updates/joel.xml.res 1970-01-01 00:00:00 +0000
2592+++ test/rbkt/ExpQueryResults/zorba/updates/joel.xml.res 2013-01-16 16:58:20 +0000
2593@@ -0,0 +1,2 @@
2594+<?xml version="1.0" encoding="UTF-8"?>
2595+<root><a-text-node>this is some text! foo-1 foo-2 foo-3 </a-text-node><parent id="1"><child id="1"/><child id="2"/><child id="3"/></parent><parent id="2"><child id="4"/><child id="5"/></parent></root>
2596
2597=== added file 'test/rbkt/Queries/zorba/updates/joel.xq'
2598--- test/rbkt/Queries/zorba/updates/joel.xq 1970-01-01 00:00:00 +0000
2599+++ test/rbkt/Queries/zorba/updates/joel.xq 2013-01-16 16:58:20 +0000
2600@@ -0,0 +1,18 @@
2601+
2602+declare variable $d :=
2603+<root>
2604+ <a-text-node>this is some text!</a-text-node>
2605+ <parent id="1">
2606+ <child id="1"/>
2607+ <child id="2"/>
2608+ <child id="3"/>
2609+ </parent>
2610+ <parent id="2">
2611+ <child id="4"/>
2612+ <child id="5"/>
2613+ </parent>
2614+</root>;
2615+
2616+insert nodes (text { " foo-1 " } , text { " foo-2 " } , text { " foo-3 " }) after $d//text();
2617+
2618+$d

Subscribers

People subscribed via source and target branches