Index: /gsdl/trunk/lib/dbclass.cpp
===================================================================
--- /gsdl/trunk/lib/dbclass.cpp	(revision 15597)
+++ /gsdl/trunk/lib/dbclass.cpp	(revision 15598)
@@ -25,5 +25,142 @@
 
 #include "dbclass.h"
+#include "OIDtools.h"
 
 
 dbclass::~dbclass() {}
+
+
+// replaces the .fc, .lc, .pr, .rt, .ns and .ps syntax (first child, 
+// last child, parent, root, next sibling, previous sibling) 
+// it expects child, parent, etc. to exist if syntax has been used
+// so you should test before using
+text_t dbclass::translate_OID (const text_t &inOID, infodbclass &info)
+{
+  if (inOID.size() < 4) return inOID;
+  if (findchar (inOID.begin(), inOID.end(), '.') == inOID.end()) return inOID;
+
+  text_t OID = inOID;
+  text_tarray tailarray;
+  text_t tail = substr (OID.end()-3, OID.end());
+  if (tail == ".rt") {
+    get_top (inOID, OID);
+    return OID;
+  }
+  while (tail == ".fc" || tail == ".lc" || tail == ".pr" || 
+	 tail == ".ns" || tail == ".ps") {
+    tailarray.push_back(tail);
+    OID.erase (OID.end()-3, OID.end());
+    tail = substr (OID.end()-3, OID.end());
+    if (tail == ".rt") {
+      get_top (inOID, OID);
+      return OID;
+    }
+  }
+
+  if (tailarray.empty()) return inOID;
+  text_tarray::const_iterator begin = tailarray.begin();
+  text_tarray::const_iterator here = tailarray.end() - 1;
+
+  while (here >= begin) {
+
+    if (*here == ".fc")
+      get_first_child (OID, info);
+    else if (*here == ".lc")
+      get_last_child (OID, info);
+    else if (*here == ".pr")
+      OID = get_parent (OID);
+    else if (*here == ".ns")
+      get_next_sibling (OID, info);
+    else if (*here == ".ps")
+      get_previous_sibling (OID, info);
+    
+    if (here == begin)
+      break;
+    --here;
+  }
+
+  return OID;
+}
+
+
+void dbclass::get_first_child (text_t &OID, infodbclass &info)
+{
+  text_t firstchild;
+  if (getinfo (OID, info)) {
+    text_t &contains = info["contains"];
+    if (!contains.empty()) {
+      text_t parent = OID;
+      getdelimitstr (contains.begin(), contains.end(), ';', firstchild);
+      if (firstchild.empty()) OID = contains;
+      else OID = firstchild;
+      if (*(OID.begin()) == '"') translate_parent (OID, parent);
+    }
+  }
+}
+
+
+void dbclass::get_last_child (text_t &OID, infodbclass &info)
+{
+  text_tarray children;
+  if (getinfo (OID, info)) {
+    text_t &contains = info["contains"];
+    if (!contains.empty()) {
+      text_t parent = OID;
+      splitchar (contains.begin(), contains.end(), ';', children);
+      OID = children.back();
+      if (*(OID.begin()) == '"') translate_parent (OID, parent);
+    }
+  }
+}
+
+  
+void dbclass::get_next_sibling (text_t &OID, infodbclass &info)
+{
+  text_tarray siblings;
+  text_t parent = get_parent (OID);
+	     
+  if (getinfo (parent, info)) {
+    text_t &contains = info["contains"];
+    if (!contains.empty()) {
+      splitchar (contains.begin(), contains.end(), ';', siblings);
+      text_tarray::const_iterator here = siblings.begin();
+      text_tarray::const_iterator end = siblings.end();
+      text_t shrunk_OID = OID;
+      shrink_parent (shrunk_OID);
+      while (here != end) {
+	if (*here == shrunk_OID && (here+1 != end)) {
+	  OID = *(here+1);
+	  if (*(OID.begin()) == '"') translate_parent (OID, parent);
+	  break;
+	}
+	++here;
+      }
+    }
+  }
+}
+
+
+void dbclass::get_previous_sibling (text_t &OID, infodbclass &info)
+{
+  text_tarray siblings;
+  text_t parent = get_parent (OID);
+
+  if (getinfo (parent, info)) {
+    text_t &contains = info["contains"];
+    if (!contains.empty()) {
+      splitchar (contains.begin(), contains.end(), ';', siblings);
+      text_tarray::const_iterator here = siblings.begin();
+      text_tarray::const_iterator end = siblings.end();
+      text_t shrunk_OID = OID;
+      shrink_parent (shrunk_OID);
+      while (here != end) {
+	if (*here == shrunk_OID && (here != siblings.begin())) {
+	  OID = *(here-1);
+	  if (*(OID.begin()) == '"') translate_parent (OID, parent);
+	  break;
+	}
+	++here;
+      }
+    }
+  }
+}
Index: /gsdl/trunk/lib/dbclass.h
===================================================================
--- /gsdl/trunk/lib/dbclass.h	(revision 15597)
+++ /gsdl/trunk/lib/dbclass.h	(revision 15598)
@@ -69,9 +69,4 @@
   virtual bool setinfo(const text_t &key, const infodbclass &info) = 0;
 
-  // replaces the .c, .p, .n, .l syntax (child, parent, next, previous) 
-  // it expects child, parent, etc. to exist if syntax has been used
-  // so you should test before using
-  virtual text_t translate_OID(const text_t &OID, infodbclass &info) = 0;
-
   // getfirstkey and getnextkey are used for traversing the database
   // no insertions or deletions should be carried out while traversing
@@ -83,6 +78,16 @@
   virtual void deletekey(const text_t &key) = 0;
 
+  // replaces the .c, .p, .n, .l syntax (child, parent, next, previous) 
+  // it expects child, parent, etc. to exist if syntax has been used
+  // so you should test before using
+  text_t translate_OID(const text_t &OID, infodbclass &info);
+
 protected:
   ostream *logout;
+
+  void get_first_child (text_t &OID, infodbclass &info);
+  void get_last_child (text_t &OID, infodbclass &info);
+  void get_next_sibling (text_t &OID, infodbclass &info);
+  void get_previous_sibling (text_t &OID, infodbclass &info);
 };
 
Index: /gsdl/trunk/lib/gdbmclass.cpp
===================================================================
--- /gsdl/trunk/lib/gdbmclass.cpp	(revision 15597)
+++ /gsdl/trunk/lib/gdbmclass.cpp	(revision 15598)
@@ -285,140 +285,4 @@
 
 
-// replaces the .fc, .lc, .pr, .rt, .ns and .ps syntax (first child, 
-// last child, parent, root, next sibling, previous sibling) 
-// it expects child, parent, etc. to exist if syntax has been used
-// so you should test before using
-text_t gdbmclass::translate_OID (const text_t &inOID, infodbclass &info)
-{
-  if (inOID.size() < 4) return inOID;
-  if (findchar (inOID.begin(), inOID.end(), '.') == inOID.end()) return inOID;
-
-  text_t OID = inOID;
-  text_tarray tailarray;
-  text_t tail = substr (OID.end()-3, OID.end());
-  if (tail == ".rt") {
-    get_top (inOID, OID);
-    return OID;
-  }
-  while (tail == ".fc" || tail == ".lc" || tail == ".pr" || 
-	 tail == ".ns" || tail == ".ps") {
-    tailarray.push_back(tail);
-    OID.erase (OID.end()-3, OID.end());
-    tail = substr (OID.end()-3, OID.end());
-    if (tail == ".rt") {
-      get_top (inOID, OID);
-      return OID;
-    }
-  }
-
-  if (tailarray.empty()) return inOID;
-  text_tarray::const_iterator begin = tailarray.begin();
-  text_tarray::const_iterator here = tailarray.end() - 1;
-
-  while (here >= begin) {
-
-    if (*here == ".fc")
-      get_first_child (OID, info);
-    else if (*here == ".lc")
-      get_last_child (OID, info);
-    else if (*here == ".pr")
-      OID = get_parent (OID);
-    else if (*here == ".ns")
-      get_next_sibling (OID, info);
-    else if (*here == ".ps")
-      get_previous_sibling (OID, info);
-    
-    if (here == begin)
-      break;
-    --here;
-  }
-
-  return OID;
-}
-
-
-void gdbmclass::get_first_child (text_t &OID, infodbclass &info)
-{
-  text_t firstchild;
-  if (getinfo (OID, info)) {
-    text_t &contains = info["contains"];
-    if (!contains.empty()) {
-      text_t parent = OID;
-      getdelimitstr (contains.begin(), contains.end(), ';', firstchild);
-      if (firstchild.empty()) OID = contains;
-      else OID = firstchild;
-      if (*(OID.begin()) == '"') translate_parent (OID, parent);
-    }
-  }
-}
-
-
-void gdbmclass::get_last_child (text_t &OID, infodbclass &info)
-{
-  text_tarray children;
-  if (getinfo (OID, info)) {
-    text_t &contains = info["contains"];
-    if (!contains.empty()) {
-      text_t parent = OID;
-      splitchar (contains.begin(), contains.end(), ';', children);
-      OID = children.back();
-      if (*(OID.begin()) == '"') translate_parent (OID, parent);
-    }
-  }
-}
-
-  
-void gdbmclass::get_next_sibling (text_t &OID, infodbclass &info)
-{
-  text_tarray siblings;
-  text_t parent = get_parent (OID);
-	     
-  if (getinfo (parent, info)) {
-    text_t &contains = info["contains"];
-    if (!contains.empty()) {
-      splitchar (contains.begin(), contains.end(), ';', siblings);
-      text_tarray::const_iterator here = siblings.begin();
-      text_tarray::const_iterator end = siblings.end();
-      text_t shrunk_OID = OID;
-      shrink_parent (shrunk_OID);
-      while (here != end) {
-	if (*here == shrunk_OID && (here+1 != end)) {
-	  OID = *(here+1);
-	  if (*(OID.begin()) == '"') translate_parent (OID, parent);
-	  break;
-	}
-	++here;
-      }
-    }
-  }
-}
-
-
-void gdbmclass::get_previous_sibling (text_t &OID, infodbclass &info)
-{
-  text_tarray siblings;
-  text_t parent = get_parent (OID);
-
-  if (getinfo (parent, info)) {
-    text_t &contains = info["contains"];
-    if (!contains.empty()) {
-      splitchar (contains.begin(), contains.end(), ';', siblings);
-      text_tarray::const_iterator here = siblings.begin();
-      text_tarray::const_iterator end = siblings.end();
-      text_t shrunk_OID = OID;
-      shrink_parent (shrunk_OID);
-      while (here != end) {
-	if (*here == shrunk_OID && (here != siblings.begin())) {
-	  OID = *(here-1);
-	  if (*(OID.begin()) == '"') translate_parent (OID, parent);
-	  break;
-	}
-	++here;
-      }
-    }
-  }
-}
-
-
 // returns true on success
 bool gdbmclass::getinfo (const text_t& key, infodbclass &info)
Index: /gsdl/trunk/lib/gdbmclass.h
===================================================================
--- /gsdl/trunk/lib/gdbmclass.h	(revision 15597)
+++ /gsdl/trunk/lib/gdbmclass.h	(revision 15598)
@@ -60,9 +60,4 @@
   void closedatabase ();
 
-  // replaces the .c, .p, .n, .l syntax (child, parent, next, previous) 
-  // it expects child, parent, etc. to exist if syntax has been used
-  // so you should test before using
-  text_t translate_OID (const text_t &OID, infodbclass &info);
-
   // returns true on success
   bool getinfo (const text_t& key, infodbclass &info);
@@ -92,10 +87,4 @@
   GDBM_FILE gdbmfile;
 
-  void get_first_child (text_t &OID, infodbclass &info);
-  void get_last_child (text_t &OID, infodbclass &info);
-  void get_next_sibling (text_t &OID, infodbclass &info);
-  void get_previous_sibling (text_t &OID, infodbclass &info);
-
-
   // returns true on success
   bool getinfoline (text_t::iterator &here, text_t::iterator end, 
