Ghislain Fourny has proposed merging 
lp:~zorba-coders/zorba/structural-any-uri-lazy into lp:zorba.

Requested reviews:
  Markos Zaharioudakis (markos-za)
  Matthias Brantner (matthias-brantner)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/structural-any-uri-lazy/+merge/104918

Made URI computation lazy in StructuralAnyUri.
-- 
https://code.launchpad.net/~zorba-coders/zorba/structural-any-uri-lazy/+merge/104918
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/store/naive/atomic_items.cpp'
--- src/store/naive/atomic_items.cpp	2012-05-04 14:32:28 +0000
+++ src/store/naive/atomic_items.cpp	2012-05-07 14:27:20 +0000
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 #include "stdafx.h"
+#include "atomic_items.h"
+
 #include <limits.h>
 
 #include <zorba/internal/unique_ptr.h>
@@ -38,7 +40,6 @@
 #include "store_defs.h"
 #include "item_iterator.h"
 #include "node_items.h"
-#include "atomic_items.h"
 #include "ordpath.h"
 #include "tree_id.h"
 
@@ -72,6 +73,18 @@
 
 
 /*******************************************************************************
+
+********************************************************************************/
+AnyUriTypeCode AtomicItem::getAnyUriTypeCode() const
+{
+  throw ZORBA_EXCEPTION(
+    zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
+    ERROR_PARAMS( __FUNCTION__, typeid(*this).name() )
+  );
+}
+
+
+/*******************************************************************************
   For numeric items or the untyped item: convert this item to a long item,
   if possible, i.e., if the conversion is going to be lossless.
 ********************************************************************************/
@@ -1082,7 +1095,6 @@
 ********************************************************************************/
 
 StructuralAnyUriItem::StructuralAnyUriItem(
-    zstring& encoded,
     ulong collectionId,
     const TreeId& treeId, 
     store::StoreConsts::NodeKind nodeKind,
@@ -1091,17 +1103,18 @@
   theCollectionId(collectionId),
   theTreeId(treeId),
   theNodeKind(nodeKind),
-  theOrdPath(ordPath)
-{
-  theValue.take(encoded);
-}
-
-
-StructuralAnyUriItem::StructuralAnyUriItem(zstring& value)
-{
-  theValue.take(value);
-
-  std::istringstream input(theValue.str());
+  theOrdPath(ordPath),
+  theEncodedValue("")
+{}
+
+StructuralAnyUriItem::StructuralAnyUriItem(const zstring& value)
+{
+  if (value == "")
+    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI,
+                          ERROR_PARAMS(theEncodedValue));
+
+  theEncodedValue = value;
+  std::istringstream input(theEncodedValue.str());
 
   ulong prefixlen = (ulong)strlen("zorba:");
 
@@ -1111,51 +1124,64 @@
   input >> prefix;
 
   if (!input.good())
-    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS(theValue));
+    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI,
+                          ERROR_PARAMS(theEncodedValue));
 
   if (prefix != "zorba:")
-    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS(theValue));
+    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI,
+                          ERROR_PARAMS(theEncodedValue));
 
   input >> theCollectionId;
 
   if (!input.good())
-    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS(theValue));
+    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI,
+                          ERROR_PARAMS(theEncodedValue));
   
   char period;
   input >> period;
   if (!input.good())
-    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS(theValue));
+    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI,
+                          ERROR_PARAMS(theEncodedValue));
   if (period != '.')
-    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS(theValue));
+    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI,
+                          ERROR_PARAMS(theEncodedValue));
     
 
   input >> theTreeId;
   if (!input.good())
-    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS(theValue));
+    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI,
+                          ERROR_PARAMS(theEncodedValue));
   
   input >> period;
   if (!input.good())
-    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS(theValue));
+    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI,
+                          ERROR_PARAMS(theEncodedValue));
   if (period != '.')
-    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS(theValue));
+    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI,
+                          ERROR_PARAMS(theEncodedValue));
 
   int lNodeKind;
   input >> lNodeKind;
   theNodeKind = static_cast<store::StoreConsts::NodeKind>(lNodeKind);
   if (!input.good())
-    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS(theValue));
+    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI,
+                          ERROR_PARAMS(theEncodedValue));
   if (lNodeKind <= 0 || lNodeKind > 6)
-    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS(theValue));
+    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI,
+                           ERROR_PARAMS(theEncodedValue));
 
   input >> period;
   if (period != '.')
-    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS(theValue));
+    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI,
+                          ERROR_PARAMS(theEncodedValue));
   if (!input.good())
-    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS(theValue));
+    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI,
+                          ERROR_PARAMS(theEncodedValue));
     
   input >> prefix;
   if (!input.eof())
-    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS(theValue));
+    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI,
+                          ERROR_PARAMS(theEncodedValue));
 
   try 
   {
@@ -1163,22 +1189,122 @@
   }
   catch(...) 
   {
-    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS(theValue));
-  }
-  // = OrdPath(reinterpret_cast<const unsigned char*>(prefix.c_str()), prefix.size());
-}
-
+    throw ZORBA_EXCEPTION(zerr::ZAPI0028_INVALID_NODE_URI, ERROR_PARAMS(theEncodedValue));
+  }
+}
+
+store::Item* StructuralAnyUriItem::getType() const
+{
+  return GET_STORE().theSchemaTypeNames[store::XS_ANY_URI];
+}
+
+
+uint32_t StructuralAnyUriItem::hash(long timezone, const XQPCollator* aCollation) const
+{
+  return hashfun::h32(theEncodedValue.data(), (uint32_t)theEncodedValue.size());
+}
+
+void StructuralAnyUriItem::encode() const
+{
+  ZORBA_FATAL(theNodeKind,"Unexpected node kind");
+  std::ostringstream stream;
+  stream   << "zorba:"
+           << theCollectionId << "."
+           << theTreeId << "."
+           << static_cast<int>(theNodeKind) << "."
+           << theOrdPath.serialize();
+  zorba::zstring lValue = stream.str();
+  theEncodedValue.take(lValue);
+}
+
+
+zstring StructuralAnyUriItem::show() const
+{
+  zstring res("xs:anyURI(");
+  res += getString();
+  res += ")";
+  return res;
+}
+ 
+bool StructuralAnyUriItem::equals(
+        const store::Item* item,
+        long timezone,
+        const XQPCollator* aCollation) const
+{
+  const StructuralAnyUriItem* lOther =
+      dynamic_cast<const StructuralAnyUriItem*>(item);
+  return (lOther &&
+      lOther->theCollectionId == theCollectionId &&
+      lOther->theTreeId == theTreeId &&
+      lOther->theNodeKind == theNodeKind &&
+      lOther->theOrdPath == theOrdPath);
+}
+ 
+long StructuralAnyUriItem::compare(
+      const Item* other,
+      long timezone,
+      const XQPCollator* aCollation) const
+{
+  const StructuralAnyUriItem* lOther =
+      dynamic_cast<const StructuralAnyUriItem*>(other);
+  assert(lOther);
+  if (theCollectionId < lOther->theCollectionId)
+  {
+    return -1;
+  }
+  if (theCollectionId > lOther->theCollectionId)
+  {
+    return 1;
+  }
+  if (theTreeId < lOther->theTreeId)
+  {
+    return -1;
+  }
+  if (theTreeId > lOther->theTreeId)
+  {
+    return 1;
+  }
+  if (theNodeKind < lOther->theNodeKind)
+  {
+    return -1;
+  }
+  if (theNodeKind > lOther->theNodeKind)
+  {
+    return 1;
+  }
+  if (theOrdPath < lOther->theOrdPath)
+  {
+    return -1;
+  }
+  if (theOrdPath > lOther->theOrdPath)
+  {
+    return 1;
+  }
+  return 0;
+}
+ 
+zstring StructuralAnyUriItem::getStringValue() const {
+  return getString();
+}
+ 
+void StructuralAnyUriItem::getStringValue2(zstring& val) const {
+  val = getString();
+}
+ 
+void StructuralAnyUriItem::appendStringValue(zstring& buf) const {
+  buf += getString();
+}
 
 bool StructuralAnyUriItem::isAncestor(const store::Item_t& aOther) const
 {
   // Is the "other" an ancestor of "this"?
 
-  AnyUriItem* lOtherUriP = static_cast<AnyUriItem *>(aOther.getp());
+  AtomicItem* lOtherUriP = static_cast<AtomicItem *>(aOther.getp());
 
   if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
   {
     store::Item_t lOtherUri;
-    zstring tmp = lOtherUriP->theValue;
+    zstring tmp = lOtherUriP->getString();
     GET_FACTORY().createStructuralAnyURI(lOtherUri, tmp);
     return isAncestor(lOtherUri);
   }
@@ -1198,12 +1324,12 @@
 {
   // Is the "other" a following sibling of "this"?
 
-  AnyUriItem* lOtherUriP = static_cast<AnyUriItem *>(aOther.getp());
+  AtomicItem* lOtherUriP = static_cast<AtomicItem *>(aOther.getp());
 
   if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
   {
     store::Item_t lOtherUri;
-    zstring tmp = lOtherUriP->theValue;
+    zstring tmp = lOtherUriP->getString();
     GET_FACTORY().createStructuralAnyURI(lOtherUri, tmp);
     return isFollowingSibling(lOtherUri);
   }
@@ -1225,12 +1351,12 @@
 {
   // Is the "other" a following node of "this"?
 
-  AnyUriItem* lOtherUriP = static_cast<AnyUriItem *>(aOther.getp());
+  AtomicItem* lOtherUriP = static_cast<AtomicItem *>(aOther.getp());
 
   if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
   {
     store::Item_t lOtherUri;
-    zstring tmp = lOtherUriP->theValue;
+    zstring tmp = lOtherUriP->getString();
     GET_FACTORY().createStructuralAnyURI(lOtherUri, tmp);
     return isFollowing(lOtherUri);
   }
@@ -1250,12 +1376,12 @@
 {
   // Is the "other" a descendant of "this"?
 
-  AnyUriItem* lOtherUriP = static_cast<AnyUriItem *>(aOther.getp());
+  AtomicItem* lOtherUriP = static_cast<AtomicItem *>(aOther.getp());
 
   if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
   {
     store::Item_t lOtherUri;
-    zstring tmp = lOtherUriP->theValue;
+    zstring tmp = lOtherUriP->getString();
     GET_FACTORY().createStructuralAnyURI(lOtherUri, tmp);
     return isDescendant(lOtherUri);
   }
@@ -1275,12 +1401,12 @@
 {
   // Is the "other" in the subtree rooted at "this"?
 
-  AnyUriItem* lOtherUriP = static_cast<AnyUriItem *>(aOther.getp());
+  AtomicItem* lOtherUriP = static_cast<AtomicItem *>(aOther.getp());
 
   if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
   {
     store::Item_t lOtherUri;
-    zstring tmp = lOtherUriP->theValue;
+    zstring tmp = lOtherUriP->getString();
     GET_FACTORY().createStructuralAnyURI(lOtherUri, tmp);
     return isInSubtreeOf(lOtherUri);
   }
@@ -1299,12 +1425,12 @@
 {
   // Is the "other" a preceding sibling of "this"?
 
-  AnyUriItem* lOtherUriP = static_cast<AnyUriItem *>(aOther.getp());
+  AtomicItem* lOtherUriP = static_cast<AtomicItem *>(aOther.getp());
 
   if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
   {
     store::Item_t lOtherUri;
-    zstring tmp = lOtherUriP->theValue;
+    zstring tmp = lOtherUriP->getString();
     GET_FACTORY().createStructuralAnyURI(lOtherUri, tmp);
     return isPrecedingSibling(lOtherUri);
   }
@@ -1325,12 +1451,12 @@
 {
   // Is the "other" a preceding node of "this"?
 
-  AnyUriItem* lOtherUriP = static_cast<AnyUriItem *>(aOther.getp());
+  AtomicItem* lOtherUriP = static_cast<AtomicItem *>(aOther.getp());
 
   if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
   {
     store::Item_t lOtherUri;
-    zstring tmp = lOtherUriP->theValue;
+    zstring tmp = lOtherUriP->getString();
     GET_FACTORY().createStructuralAnyURI(lOtherUri, tmp);
     return isPreceding(lOtherUri);
   }
@@ -1349,12 +1475,12 @@
 {
   // Is the "other" a child of "this"?
 
-  AnyUriItem* lOtherUriP = static_cast<AnyUriItem *>(aOther.getp());
+  AtomicItem* lOtherUriP = static_cast<AtomicItem *>(aOther.getp());
 
   if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
   {
     store::Item_t lOtherUri;
-    zstring tmp = lOtherUriP->theValue;
+    zstring tmp = lOtherUriP->getString();
     GET_FACTORY().createStructuralAnyURI(lOtherUri, tmp);
     return isChild(lOtherUri);
   }
@@ -1374,12 +1500,12 @@
 {
   // Is the "other" an attribute of "this"?
 
-  AnyUriItem* lOtherUriP = static_cast<AnyUriItem *>(aOther.getp());
+  AtomicItem* lOtherUriP = static_cast<AtomicItem *>(aOther.getp());
 
   if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
   {
     store::Item_t lOtherUri;
-    zstring tmp = lOtherUriP->theValue;
+    zstring tmp = lOtherUriP->getString();
     GET_FACTORY().createStructuralAnyURI(lOtherUri, tmp);
     return isAttribute(lOtherUri);
   }
@@ -1404,7 +1530,7 @@
   if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
   {
     store::Item_t lOtherUri;
-    zstring tmp = lOtherUriP->theValue;
+    zstring tmp = lOtherUriP->getString();
     GET_FACTORY().createStructuralAnyURI(lOtherUri, tmp);
     return isParent(lOtherUri);
   }
@@ -1421,12 +1547,12 @@
 
 bool StructuralAnyUriItem::isPrecedingInDocumentOrder(const store::Item_t& aOther) const
 {
-  AnyUriItem* lOtherUriP = static_cast<AnyUriItem *>(aOther.getp());
+  AtomicItem* lOtherUriP = static_cast<AtomicItem *>(aOther.getp());
 
   if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
   {
     store::Item_t lOtherUri;
-    zstring tmp = lOtherUriP->theValue;
+    zstring tmp = lOtherUriP->getString();
     GET_FACTORY().createStructuralAnyURI(lOtherUri, tmp);
     return isPrecedingInDocumentOrder(lOtherUri);
   }
@@ -1446,12 +1572,12 @@
 
 bool StructuralAnyUriItem::isFollowingInDocumentOrder(const store::Item_t& aOther) const
 {
-  AnyUriItem* lOtherUriP = static_cast<AnyUriItem *>(aOther.getp());
+  AtomicItem* lOtherUriP = static_cast<AtomicItem *>(aOther.getp());
 
   if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
   {
     store::Item_t lOtherUri;
-    zstring tmp = lOtherUriP->theValue;
+    zstring tmp = lOtherUriP->getString();
     GET_FACTORY().createStructuralAnyURI(lOtherUri, tmp);
     return isFollowingInDocumentOrder(lOtherUri);
   }
@@ -1520,7 +1646,7 @@
   if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
   {
     store::Item_t lOtherUri;
-    zstring tmp = lOtherUriP->theValue;
+    zstring tmp = lOtherUriP->getString();
     GET_FACTORY().createStructuralAnyURI(lOtherUri, tmp);
     return isSibling(lOtherUri);
   }
@@ -1554,7 +1680,7 @@
   if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
   {
     store::Item_t lOtherUri;
-    zstring tmp = lOtherUriP->theValue;
+    zstring tmp = lOtherUriP->getString();
     GET_FACTORY().createStructuralAnyURI(lOtherUri, tmp);
     return inSameTree(lOtherUri);
   }
@@ -1580,7 +1706,7 @@
   if (lOtherUriP->getAnyUriTypeCode() != STRUCTURAL_INFORMATION_ANY_URI)
   {
     store::Item_t lOtherUri;
-    zstring tmp = lOtherUriP->theValue;
+    zstring tmp = lOtherUriP->getString();
     GET_FACTORY().createStructuralAnyURI(lOtherUri, tmp);
     return inSameCollection(lOtherUri);
   }

=== modified file 'src/store/naive/atomic_items.h'
--- src/store/naive/atomic_items.h	2012-05-03 12:31:51 +0000
+++ src/store/naive/atomic_items.h	2012-05-07 14:27:20 +0000
@@ -82,6 +82,8 @@
 
   void getTypedValue(store::Item_t& val, store::Iterator_t& iter) const;
 
+  virtual AnyUriTypeCode getAnyUriTypeCode() const;
+
   bool castToLong(store::Item_t& result) const;
 
   void coerceToDouble(store::Item_t& result, bool force, bool& lossy) const;
@@ -578,7 +580,6 @@
 class AnyUriItem : public AtomicItem
 {
   friend class BasicItemFactory;
-  friend class StructuralAnyUriItem;
 
 protected:
   zstring theValue;
@@ -702,102 +703,148 @@
 /*******************************************************************************
   class StructuralAnyUriItem
 ********************************************************************************/
-class StructuralAnyUriItem : public AnyUriItem
+class StructuralAnyUriItem : public AtomicItem
 {
-  friend class BasicItemFactory;
-
 protected:
   ulong                        theCollectionId;
   TreeId                       theTreeId;
   store::StoreConsts::NodeKind theNodeKind;
   OrdPath                      theOrdPath;
+   
+  // The value is computed lazily when needed.
+  // The empty string is used if it has not been computed yet.
+  mutable zstring              theEncodedValue;
 
-protected:
+public:
   virtual AnyUriTypeCode getAnyUriTypeCode() const 
   {
     return STRUCTURAL_INFORMATION_ANY_URI;
   }
-
-  StructuralAnyUriItem(zstring& value);
+  
+  store::SchemaTypeCode getTypeCode() const
+  {
+    return store::XS_ANY_URI;
+  }
+
+  store::Item* getType() const;
+
+  uint32_t hash(long timezone = 0, const XQPCollator* aCollation = 0) const;
+
+  bool equals(
+        const store::Item* item,
+        long timezone = 0,
+        const XQPCollator* aCollation = 0) const;
+
+  long compare(
+        const Item* other,
+        long timezone = 0,
+        const XQPCollator* aCollation = 0) const;
+
+  // A structural URI is never empty.
+  bool getEBV() const { return true; }
+
+  zstring getStringValue() const;
+
+  void getStringValue2(zstring& val) const;
+
+  void appendStringValue(zstring& buf) const;
+
+  const zstring& getString() const
+  {
+    if (theEncodedValue == "")
+    {
+      encode();
+    }
+    return theEncodedValue;
+  }
+
+  zstring show() const;
+
+  bool
+  isAncestor(const store::Item_t&) const;
+
+  bool
+  isFollowingSibling(const store::Item_t&) const;
+
+  bool
+  isFollowing(const store::Item_t&) const;
+
+  bool
+  isInSubtreeOf(const store::Item_t&) const;
+
+  bool
+  isDescendant(const store::Item_t&) const;
+
+  bool
+  isPrecedingSibling(const store::Item_t&) const;
+
+  bool
+  isPreceding(const store::Item_t&) const;
+
+  bool
+  isChild(const store::Item_t&) const;
+
+  bool
+  isAttribute(const store::Item_t&) const;
+
+  bool
+  isParent(const store::Item_t&) const;
+
+  bool
+  isPrecedingInDocumentOrder(const store::Item_t&) const;
+
+  bool
+  isFollowingInDocumentOrder(const store::Item_t&) const;
+
+  store::Item_t
+  getLevel() const;
+
+  bool
+  isAttribute() const;
+
+  bool
+  isComment() const;
+
+  bool
+  isDocument() const;
+
+  bool
+  isElement() const;
+
+  bool
+  isProcessingInstruction() const;
+
+  bool
+  isText() const;
+
+  bool
+  isSibling(const store::Item_t&) const;
+
+  bool
+  inSameTree(const store::Item_t&) const;
+
+  bool
+  inCollection() const;
+
+  bool
+  inSameCollection(const store::Item_t&) const;
+  
+private:
+  // Forces computation of the value.
+  void encode() const;
+ 
+protected:
+  friend class BasicItemFactory;
+
+  StructuralAnyUriItem(const zstring& value);
 
   StructuralAnyUriItem(
-      zstring& value,
       ulong collectionId,
       const TreeId& treeId,
       store::StoreConsts::NodeKind nodeKind,
       const OrdPath& ordPath);
 
-  StructuralAnyUriItem() {}
-
-public:
-  bool
-  isAncestor(const store::Item_t&) const;
-
-  bool
-  isFollowingSibling(const store::Item_t&) const;
-
-  bool
-  isFollowing(const store::Item_t&) const;
-
-  bool
-  isInSubtreeOf(const store::Item_t&) const;
-
-  bool
-  isDescendant(const store::Item_t&) const;
-
-  bool
-  isPrecedingSibling(const store::Item_t&) const;
-
-  bool
-  isPreceding(const store::Item_t&) const;
-
-  bool
-  isChild(const store::Item_t&) const;
-
-  bool
-  isAttribute(const store::Item_t&) const;
-
-  bool
-  isParent(const store::Item_t&) const;
-
-  bool
-  isPrecedingInDocumentOrder(const store::Item_t&) const;
-
-  bool
-  isFollowingInDocumentOrder(const store::Item_t&) const;
-
-  store::Item_t
-  getLevel() const;
-
-  bool
-  isAttribute() const;
-
-  bool
-  isComment() const;
-
-  bool
-  isDocument() const;
-
-  bool
-  isElement() const;
-
-  bool
-  isProcessingInstruction() const;
-
-  bool
-  isText() const;
-
-  bool
-  isSibling(const store::Item_t&) const;
-
-  bool
-  inSameTree(const store::Item_t&) const;
-
-  bool
-  inCollection() const;
-
-  bool
-  inSameCollection(const store::Item_t&) const;
+  StructuralAnyUriItem() : theEncodedValue("") {}
 };
 
 

=== modified file 'src/store/naive/simple_item_factory.cpp'
--- src/store/naive/simple_item_factory.cpp	2012-05-03 12:31:51 +0000
+++ src/store/naive/simple_item_factory.cpp	2012-05-07 14:27:20 +0000
@@ -111,7 +111,9 @@
 }
 
 
-bool BasicItemFactory::createStructuralAnyURI(store::Item_t& result, zstring& value)
+bool BasicItemFactory::createStructuralAnyURI(
+    store::Item_t& result,
+    const zstring& value)
 {
   result =  new StructuralAnyUriItem(value);
   return true;
@@ -126,16 +128,7 @@
     const OrdPath& ordPath)
 {
   ZORBA_FATAL(nodeKind,"Unexpected node kind");
-  std::ostringstream stream;
-  stream   << "zorba:"
-           << collectionId << "."
-           << treeId << "."
-           << static_cast<int>(nodeKind) << "."
-           << ordPath.serialize();
-  zstring uri = stream.str();
-
-  theUriPool->insert(uri);
-  result = new StructuralAnyUriItem(uri, collectionId, treeId, nodeKind, ordPath);
+  result = new StructuralAnyUriItem(collectionId, treeId, nodeKind, ordPath);
   return true;
 }
 

=== modified file 'src/store/naive/simple_item_factory.h'
--- src/store/naive/simple_item_factory.h	2012-05-03 12:31:51 +0000
+++ src/store/naive/simple_item_factory.h	2012-05-07 14:27:20 +0000
@@ -87,7 +87,7 @@
 
   bool createAnyURI(store::Item_t& result, const char* value);
 
-  bool createStructuralAnyURI(store::Item_t& result, zstring& value);
+  bool createStructuralAnyURI(store::Item_t& result, const zstring& value);
 
   bool createStructuralAnyURI(
       store::Item_t& result,

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to