[rkward-cvs] SF.net SVN: rkward:[3458] trunk/rkward/rkward/core

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Mar 1 17:36:43 UTC 2011


Revision: 3458
          http://rkward.svn.sourceforge.net/rkward/?rev=3458&view=rev
Author:   tfry
Date:     2011-03-01 17:36:43 +0000 (Tue, 01 Mar 2011)

Log Message:
-----------
Remove some unused code.

Modified Paths:
--------------
    trunk/rkward/rkward/core/rcontainerobject.cpp
    trunk/rkward/rkward/core/rcontainerobject.h
    trunk/rkward/rkward/core/robjectlist.cpp

Modified: trunk/rkward/rkward/core/rcontainerobject.cpp
===================================================================
--- trunk/rkward/rkward/core/rcontainerobject.cpp	2011-02-23 12:02:16 UTC (rev 3457)
+++ trunk/rkward/rkward/core/rcontainerobject.cpp	2011-03-01 17:36:43 UTC (rev 3458)
@@ -211,24 +211,6 @@
 	return childmap.size ();
 }
 
-// KDE4: do we need this? Can't we return the RObjectMap?
-RObject **RContainerObject::children () const {
-	RK_TRACE (OBJECTS);
-	RObject **ret = new RObject *[childmap.size ()];
-
-	for (int i = childmap.size () - 1; i >= 0; --i) {
-		ret[i] = childmap[i];
-	}
-	return ret;
-}
-
-void RContainerObject::writeChildMetaData (RCommandChain *chain) {
-	RK_TRACE (OBJECTS);
-	for (int i = childmap.size () - 1; i >= 0; --i) {
-		childmap[i]->writeMetaData (chain);
-	}
-}
-
 RObject *RContainerObject::findChildByName (const QString &name) const {
 	RK_TRACE (OBJECTS);
 
@@ -417,23 +399,6 @@
 	return ("rk.rename.in.container (" + getFullName () + ", \"" + object->getShortName () + "\", \"" + new_name + "\")");
 }
 
-bool RContainerObject::isParentOf (RObject *object, bool recursive) const {
-	RK_TRACE (OBJECTS);
-
-	for (int i = childmap.size () - 1; i >= 0; --i) {
-		RObject *child = childmap[i];
-		if (child == object) {
-			return true;
-		} else if (recursive && child->isContainer ()) {
-			if (static_cast<RContainerObject *>(child)->isParentOf (object, true)) {
-				return true;
-			}
-		}
-	}
-	
-	return false;
-}
-
 QString RContainerObject::validizeName (const QString &child_name, bool unique) const {
 	RK_TRACE (OBJECTS);
 	RK_ASSERT (isType (GlobalEnv) || isInGlobalEnv ());

Modified: trunk/rkward/rkward/core/rcontainerobject.h
===================================================================
--- trunk/rkward/rkward/core/rcontainerobject.h	2011-02-23 12:02:16 UTC (rev 3457)
+++ trunk/rkward/rkward/core/rcontainerobject.h	2011-03-01 17:36:43 UTC (rev 3458)
@@ -35,8 +35,6 @@
 
 	~RContainerObject ();
 
-	void writeChildMetaData (RCommandChain *chain);
-
 	/** update the given child with the given data. Since the child may be mismatching, and may need to be recreated, returns a pointer to the child (old or new) */
 	RObject *updateChildStructure (RObject *child, RData *new_data, bool just_created=false);
 	RObject *createChildFromStructure (RData *child_data, const QString &child_name, int position);
@@ -45,8 +43,8 @@
 	bool updateStructure (RData *new_data);
 
 	int numChildren () const;
-// KDE 4: TODO: do we need this? Can't we just return a copy of the objectma?
-	RObject **children () const;
+	/** returns true, if there are no children in this container. Note: of course the object list may not be up to date! */
+	bool isEmpty () const { return childmap.isEmpty (); };
 
 	/** like findObject (), but does not recurse, i.e. only direct children */
 	RObject *findChildByName (const QString &name) const;
@@ -54,16 +52,12 @@
 	RObject *findChildByIndex (int position) const;
 	/** return the index of the given child, or -1 if there is no such child */
 	int getIndexOf (RObject *child) const;
-	bool isParentOf (RObject *object, bool recursive=false) const;
 	
 	/** creates a new child. Right now only RKVariables (false, false), or data.frames (true, true), or unspecified containers (true, false) can be created.
 	API will likely change. The child is NOT created in the workspace. That's your resonsibility. All this function returns is a new RObject* of the given
 	type and with the name (if necessary) changed to a legal value. TODO: checking for and changing illegal names is not yet implemented */
 	RObject *createPendingChild (const QString &name, int position=-1, bool container=false, bool data_frame=false);
 
-	/** returns true, if there are no children in this container. Note: of course the object list may not be up to date! */
-	bool isEmpty () const { return childmap.isEmpty (); };
-
 	/** given child_name, constructs a name which is as close as possible to the orginial but valid (i.e. not already in use, not contaning illegal characters */
 	QString validizeName (const QString &child_name, bool unique=true) const;
 

Modified: trunk/rkward/rkward/core/robjectlist.cpp
===================================================================
--- trunk/rkward/rkward/core/robjectlist.cpp	2011-02-23 12:02:16 UTC (rev 3457)
+++ trunk/rkward/rkward/core/robjectlist.cpp	2011-03-01 17:36:43 UTC (rev 3458)
@@ -315,7 +315,7 @@
 	RObjectList *list = getObjectList ();
 	RK_ASSERT (list);
 
-	RK_ASSERT (list->numChildren ());
+	RK_ASSERT (!list->isEmpty ());
 	REnvironmentObject *envobj = static_cast<REnvironmentObject*> (list->childmap[0]);
 	RK_ASSERT (envobj);
 	RK_ASSERT (envobj->isType (RObject::GlobalEnv));


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list