← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/replace-node-cleanup into lp:zorba

 

Ghislain Fourny has proposed merging lp:~zorba-coders/zorba/replace-node-cleanup into lp:zorba.

Commit message:
Removed useless code I forgot to clean up in the dml:edit branch.

Requested reviews:
  Chris Hillery (ceejatec)
  Matthias Brantner (matthias-brantner)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/replace-node-cleanup/+merge/140161

Removed useless code I forgot to clean up in the dml:edit branch.
-- 
https://code.launchpad.net/~zorba-coders/zorba/replace-node-cleanup/+merge/140161
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/store/naive/collection.h'
--- src/store/naive/collection.h	2012-12-05 14:51:50 +0000
+++ src/store/naive/collection.h	2012-12-17 10:33:25 +0000
@@ -90,10 +90,6 @@
 
   virtual void removeAll() = 0;
   
-  virtual bool replaceNode(
-      store::Item* target,
-      store::Item* content) = 0;
-
   virtual void adjustTreePositions() = 0;
 
   /***************************** ID Management ********************************/

=== modified file 'src/store/naive/simple_collection.cpp'
--- src/store/naive/simple_collection.cpp	2012-12-05 14:51:50 +0000
+++ src/store/naive/simple_collection.cpp	2012-12-17 10:33:25 +0000
@@ -444,97 +444,6 @@
   }
 }
 
-/*******************************************************************************
- * Substitues content for target.
-********************************************************************************/
-bool SimpleCollection::replaceNode(store::Item* target, store::Item* content)
-{
-  XmlNode* lTargetNode = NULL;
-  XmlNode* lContentNode = NULL;
-#ifdef ZORBA_WITH_JSON
-  json::JSONItem* lTargetJSONItem = NULL;
-  json::JSONItem* lContentJSONItem = NULL;
-#endif
-
-  if (target->isNode())
-  {
-    lTargetNode = static_cast<XmlNode*>(target);
-  }
-#ifdef ZORBA_WITH_JSON
-  else if (target->isJSONItem())
-  {
-    lTargetJSONItem = static_cast<json::JSONItem*>(target);
-  }
-  else
-  {
-    throw ZORBA_EXCEPTION(zerr::ZSTR0013_COLLECTION_ITEM_MUST_BE_STRUCTURED,
-    ERROR_PARAMS(getName()->getStringValue()));
-  }
-#else
-  else
-  {
-    throw ZORBA_EXCEPTION(zerr::ZSTR0012_COLLECTION_ITEM_MUST_BE_A_NODE,
-    ERROR_PARAMS(getName()->getStringValue()));
-  }
-#endif
-
-  if (content->isNode())
-  {
-    lContentNode = static_cast<XmlNode*>(content);
-  }
-#ifdef ZORBA_WITH_JSON
-  else if (content->isJSONItem())
-  {
-    lContentJSONItem = static_cast<json::JSONItem*>(content);
-  }
-  else
-  {
-    throw ZORBA_EXCEPTION(zerr::ZSTR0013_COLLECTION_ITEM_MUST_BE_STRUCTURED,
-    ERROR_PARAMS(getName()->getStringValue()));
-  }
-#else
-  else
-  {
-    throw ZORBA_EXCEPTION(zerr::ZSTR0012_COLLECTION_ITEM_MUST_BE_A_NODE,
-    ERROR_PARAMS(getName()->getStringValue()));
-  }
-#endif
-
-  SYNC_CODE(AutoLatch lock(theLatch, Latch::WRITE);)
-
-  xs_integer position;
-  bool found = findNode(target, position);
-
-  if (found)
-  {
-    ZORBA_ASSERT(target->getCollection() == this);
-
-    xs_integer const &zero = xs_integer::zero();
-
-#ifdef ZORBA_WITH_JSON
-    if (lTargetJSONItem)
-      lTargetJSONItem->detachFromCollection();
-    else
-#endif
-      lTargetNode->setCollection(NULL, zero);
-
-    csize pos = to_xs_unsignedInt(position);
-    theXmlTrees[pos] = content;
-
-#ifdef ZORBA_WITH_JSON
-  if (lContentJSONItem)
-    lContentJSONItem->attachToCollection(this, createTreeId());
-  else
-#endif
-    lContentNode->setCollection(this, position);
-    return true;
-  }
-  else
-  {
-    return false;
-  }
-}
-
 
 /*******************************************************************************
  * Remove all the nodes from the collection

=== modified file 'src/store/naive/simple_collection.h'
--- src/store/naive/simple_collection.h	2012-12-05 14:51:50 +0000
+++ src/store/naive/simple_collection.h	2012-12-17 10:33:25 +0000
@@ -131,10 +131,6 @@
 
   xs_integer removeNodes(xs_integer position, xs_integer num);
 
-  bool replaceNode(
-      store::Item* target,
-      store::Item* content);
-  
   bool findNode(const store::Item* node, xs_integer& position) const;
 
   store::Item_t nodeAt(xs_integer position);


Follow ups