Re: [Zorba-coders] [Merge] lp:~28msec/zorba/get-descendant-node-by-ordpath into lp:zorba

2012-03-13 Thread Ghislain Fourny
Hi Markos, thanks, these two were updated as well before triggering the merge.
-- 
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


[Zorba-coders] [Merge] lp:~28msec/zorba/get-descendant-node-by-ordpath into lp:zorba

2012-03-13 Thread Zorba Build Bot
The proposal to merge lp:~28msec/zorba/get-descendant-node-by-ordpath into 
lp:zorba has been updated.

Status: Approved = Needs review

For more details, see:
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
-- 
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


Re: [Zorba-coders] [Merge] lp:~28msec/zorba/get-descendant-node-by-ordpath into lp:zorba

2012-03-13 Thread Zorba Build Bot
There are additional revisions which have not been approved in review. Please 
seek review and approval of these new revisions.
-- 
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


[Zorba-coders] [Merge] lp:~28msec/zorba/get-descendant-node-by-ordpath into lp:zorba

2012-03-13 Thread Zorba Build Bot
Validation queue job get-descendant-node-by-ordpath-2012-03-13T11-52-05.311Z is 
finished. The final status was:

All tests succeeded!
-- 
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


[Zorba-coders] [Merge] lp:~28msec/zorba/get-descendant-node-by-ordpath into lp:zorba

2012-03-13 Thread noreply
The proposal to merge lp:~28msec/zorba/get-descendant-node-by-ordpath into 
lp:zorba has been updated.

Status: Approved = Merged

For more details, see:
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
-- 
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


Re: [Zorba-coders] [Merge] lp:~28msec/zorba/get-descendant-node-by-ordpath into lp:zorba

2012-03-12 Thread Ghislain Fourny
Thanks Markos for these useful comments. The new revision addresses all three 
of them.

-- 
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


Re: [Zorba-coders] [Merge] lp:~28msec/zorba/get-descendant-node-by-ordpath into lp:zorba

2012-03-12 Thread Markos Zaharioudakis
Review: Approve

The numAttrs and numChildren local vars should also be csize instead of ulong, 
but I approve anyway.

-- 
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


Re: [Zorba-coders] [Merge] lp:~28msec/zorba/get-descendant-node-by-ordpath into lp:zorba

2012-03-07 Thread Markos Zaharioudakis
Within the for loop:

for (i = 0; i  numAttrs; i++)

in the case of (pos == OrdPath::DESCENDANT) the function should return false, 
no? 

Also, please use csize (instead of ulong) for storing the size of vectors and 
for iterating over vectors.

Also, in for loops, do ++i instead of i++. It's a very tiny optimization, but 
it doesn't cost anything so why let it pass

-- 
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


[Zorba-coders] [Merge] lp:~28msec/zorba/get-descendant-node-by-ordpath into lp:zorba

2012-03-05 Thread Ghislain Fourny
Ghislain Fourny has proposed merging 
lp:~28msec/zorba/get-descendant-node-by-ordpath into lp:zorba.

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

For more details, see:
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902

Introduced function OrdPathNode::getDescendantNodeByOrdPath (from Sausalito).
-- 
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/store/naive/node_items.cpp'
--- src/store/naive/node_items.cpp	2012-03-02 13:50:06 +
+++ src/store/naive/node_items.cpp	2012-03-05 14:06:21 +
@@ -1052,6 +1052,118 @@
   }
 }
 
+/***
+
+/
+bool
+OrdPathNode::getDescendantNodeByOrdPath(
+const OrdPath aOrdPath,
+store::Item_t aResult,
+bool aAttribute) const
+{
+#ifdef TEXT_ORDPATH
+  if (getOrdPath() == aOrdPath)
+  {
+aResult = this;
+return true;
+  }
+#else
+  if (getNodeKind() == store::StoreConsts::textNode)
+  {
+aResult = NULL;
+return false;
+  }
+  else if (getOrdPath() == aOrdPath)
+  {
+aResult = this;
+return true;
+  }
+#endif
+
+  const XmlNode* parent = static_castconst XmlNode*(this);
+  while (1)
+  {
+ulong i;
+
+if (parent-getNodeKind() != store::StoreConsts::documentNode 
+parent-getNodeKind() != store::StoreConsts::elementNode)
+{
+  aResult = NULL;
+  return false;
+}
+
+if (aAttribute  parent-getNodeKind() == store::StoreConsts::elementNode)
+{
+  const ElementNode* elemParent = reinterpret_castconst ElementNode*(parent);
+
+  ulong numAttrs = elemParent-numAttrs();
+  for (i = 0; i  numAttrs; i++)
+  {
+AttributeNode* child = elemParent-getAttr(i);
+
+OrdPath::RelativePosition pos =  child-getOrdPath().getRelativePosition(aOrdPath);
+
+if (pos == OrdPath::SELF)
+{
+  aResult = child;
+  return true;
+}
+else if (pos == OrdPath::DESCENDANT)
+{
+  parent = child;
+  break;
+}
+else if (pos != OrdPath::FOLLOWING)
+{
+  aResult = NULL;
+  return false;
+}
+  }
+}
+
+const InternalNode* this2 = reinterpret_castconst InternalNode*(parent);
+
+ulong numChildren = this2-numChildren();
+for (i = 0; i  numChildren; i++)
+{
+#ifdef TEXT_ORDPATH
+  OrdPathNode* child = static_castOrdPathNode*(this2-getChild(i));
+#else
+  XmlNode* c = this2-getChild(i);
+
+  if (c-getNodeKind() == store::StoreConsts::textNode)
+continue;
+
+  OrdPathNode* child = static_castOrdPathNode*(c);
+#endif
+
+  OrdPath::RelativePosition pos =  child-getOrdPath().getRelativePosition(aOrdPath);
+
+  if (pos == OrdPath::SELF)
+  {
+aResult = child;
+return true;
+  }
+  else if (pos == OrdPath::DESCENDANT)
+  {
+parent = child;
+break;
+  }
+  else if (pos != OrdPath::FOLLOWING)
+  {
+aResult = NULL;
+return false;
+  }
+}
+
+if (i == numChildren)
+{
+  aResult = NULL;
+  return false;
+}
+  }
+}
+
 
 /***
   Return true if aOther is an ancestore of this.

=== modified file 'src/store/naive/node_items.h'
--- src/store/naive/node_items.h	2012-03-02 13:50:06 +
+++ src/store/naive/node_items.h	2012-03-05 14:06:21 +
@@ -664,6 +664,15 @@
 csize pos,
 store::StoreConsts::NodeKind nodeKind);
 
+  // Looks for a descendant node with the ordpath aOrdPath and puts it into the
+  // aResult variable. aAttribute specifies whether to look for an attribute or
+  // not.
+  bool
+  getDescendantNodeByOrdPath(
+  const OrdPath aOrdPath,
+  store::Item_t aResult,
+  bool aAttribute = false) const;
+
   virtual bool
   isAncestor(const store::Item_t) const;
 

-- 
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


[Zorba-coders] [Merge] lp:~28msec/zorba/get-descendant-node-by-ordpath into lp:zorba

2012-03-05 Thread Ghislain Fourny
The proposal to merge lp:~28msec/zorba/get-descendant-node-by-ordpath into 
lp:zorba has been updated.

Status: Needs review = Approved

For more details, see:
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
-- 
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


[Zorba-coders] [Merge] lp:~28msec/zorba/get-descendant-node-by-ordpath into lp:zorba

2012-03-05 Thread Zorba Build Bot
Validation queue starting for merge proposal.
Log at: 
http://zorbatest.lambda.nu:8080/remotequeue/get-descendant-node-by-ordpath-2012-03-05T14-33-05.571Z/log.html
-- 
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


[Zorba-coders] [Merge] lp:~28msec/zorba/get-descendant-node-by-ordpath into lp:zorba

2012-03-05 Thread Zorba Build Bot
Validation queue job get-descendant-node-by-ordpath-2012-03-05T14-33-05.571Z is 
finished. The final status was:

All tests succeeded!
-- 
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


Re: [Zorba-coders] [Merge] lp:~28msec/zorba/get-descendant-node-by-ordpath into lp:zorba

2012-03-05 Thread Zorba Build Bot
Voting does not meet specified criteria. Required: Approve  1, Disapprove  1. 
Got: 3 Pending.
-- 
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


[Zorba-coders] [Merge] lp:~28msec/zorba/get-descendant-node-by-ordpath into lp:zorba

2012-03-05 Thread Zorba Build Bot
The proposal to merge lp:~28msec/zorba/get-descendant-node-by-ordpath into 
lp:zorba has been updated.

Status: Approved = Needs review

For more details, see:
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
-- 
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


Re: [Zorba-coders] [Merge] lp:~28msec/zorba/get-descendant-node-by-ordpath into lp:zorba

2012-03-05 Thread Matthias Brantner
Review: Approve


-- 
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


[Zorba-coders] [Merge] lp:~28msec/zorba/get-descendant-node-by-ordpath into lp:zorba

2012-03-05 Thread Zorba Build Bot
Validation queue job get-descendant-node-by-ordpath-2012-03-05T20-26-03.63Z is 
finished. The final status was:

All tests succeeded!
-- 
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


Re: [Zorba-coders] [Merge] lp:~28msec/zorba/get-descendant-node-by-ordpath into lp:zorba

2012-03-05 Thread Zorba Build Bot
Voting does not meet specified criteria. Required: Approve  1, Disapprove  1. 
Got: 1 Approve, 2 Pending.
-- 
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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


[Zorba-coders] [Merge] lp:~28msec/zorba/get-descendant-node-by-ordpath into lp:zorba

2012-03-05 Thread Zorba Build Bot
The proposal to merge lp:~28msec/zorba/get-descendant-node-by-ordpath into 
lp:zorba has been updated.

Status: Approved = Needs review

For more details, see:
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
-- 
https://code.launchpad.net/~28msec/zorba/get-descendant-node-by-ordpath/+merge/95902
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
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