[rkward-cvs] rkward/rkward/core rcontainerobject.cpp,1.23,1.24 rkvariable.cpp,1.27,1.28 robject.cpp,1.16,1.17 robjectlist.cpp,1.23,1.24 robjectlist.h,1.16,1.17

Thomas Friedrichsmeier tfry at users.sourceforge.net
Thu Sep 29 16:02:53 UTC 2005


Update of /cvsroot/rkward/rkward/rkward/core
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6449/rkward/core

Modified Files:
	rcontainerobject.cpp rkvariable.cpp robject.cpp 
	robjectlist.cpp robjectlist.h 
Log Message:
Code cleanups, focus: replacing "" with QString::null / QString.isEmpty (). Fix credits

Index: robjectlist.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/core/robjectlist.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** robjectlist.h	3 May 2005 20:56:14 -0000	1.16
--- robjectlist.h	29 Sep 2005 16:02:50 -0000	1.17
***************
*** 49,53 ****
  	void createFromR (RContainerObject *parent, const QString &cname);
  	
! 	QString getFullName () { return ""; };
  	QString makeChildName (const QString &short_child_name) { return short_child_name; };
  	/** reimplemented from RContainerObject: do nothing. The object-list has no meta data. */
--- 49,53 ----
  	void createFromR (RContainerObject *parent, const QString &cname);
  	
! 	QString getFullName () { return QString::null; };
  	QString makeChildName (const QString &short_child_name) { return short_child_name; };
  	/** reimplemented from RContainerObject: do nothing. The object-list has no meta data. */

Index: robjectlist.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/core/robjectlist.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** robjectlist.cpp	20 Sep 2004 17:42:41 -0000	1.23
--- robjectlist.cpp	29 Sep 2005 16:02:50 -0000	1.24
***************
*** 38,42 ****
  #include "../debug.h"
  
! RObjectList::RObjectList () : RContainerObject (0, "") {
  	RK_TRACE (OBJECTS);
  	update_timer = new QTimer (this);
--- 38,42 ----
  #include "../debug.h"
  
! RObjectList::RObjectList () : RContainerObject (0, QString::null) {
  	RK_TRACE (OBJECTS);
  	update_timer = new QTimer (this);
***************
*** 124,128 ****
  	update_chain = RKGlobals::rInterface ()->startChain (0);
  
! 	RCommand *command = new RCommand ("ls (all.names=TRUE)", RCommand::App | RCommand::Sync | RCommand::GetStringVector, "", this, UPDATE_LIST_COMMAND);
  	RKGlobals::rInterface ()->issueCommand (command, update_chain);
  }
--- 124,128 ----
  	update_chain = RKGlobals::rInterface ()->startChain (0);
  
! 	RCommand *command = new RCommand ("ls (all.names=TRUE)", RCommand::App | RCommand::Sync | RCommand::GetStringVector, QString::null, this, UPDATE_LIST_COMMAND);
  	RKGlobals::rInterface ()->issueCommand (command, update_chain);
  }
***************
*** 136,140 ****
  	QString fullname = parent->makeChildName (cname);
  	
! 	RCommand *command = new RCommand (".rk.get.type (" + fullname + ")", RCommand::App | RCommand::Sync | RCommand::GetIntVector, "", this, CHILD_GET_TYPE_COMMAND);
  	pending_objects.insert (command, obj);
  	RKGlobals::rInterface ()->issueCommand (command, update_chain);
--- 136,140 ----
  	QString fullname = parent->makeChildName (cname);
  	
! 	RCommand *command = new RCommand (".rk.get.type (" + fullname + ")", RCommand::App | RCommand::Sync | RCommand::GetIntVector, QString::null, this, CHILD_GET_TYPE_COMMAND);
  	pending_objects.insert (command, obj);
  	RKGlobals::rInterface ()->issueCommand (command, update_chain);

Index: rkvariable.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/core/rkvariable.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** rkvariable.cpp	3 May 2005 20:56:14 -0000	1.27
--- rkvariable.cpp	29 Sep 2005 16:02:50 -0000	1.28
***************
*** 109,113 ****
  
  // TODO: move classification / type mismatch-checking to RObject
! 	RCommand *command = new RCommand (".rk.classify (" + getFullName () + ")", RCommand::App | RCommand::Sync | RCommand::GetIntVector, "", this, CLASSIFY_COMMAND);
  	RKGlobals::rInterface ()->issueCommand (command, RKGlobals::rObjectList()->getUpdateCommandChain ());
  }
--- 109,113 ----
  
  // TODO: move classification / type mismatch-checking to RObject
! 	RCommand *command = new RCommand (".rk.classify (" + getFullName () + ")", RCommand::App | RCommand::Sync | RCommand::GetIntVector, QString::null, this, CLASSIFY_COMMAND);
  	RKGlobals::rInterface ()->issueCommand (command, RKGlobals::rObjectList()->getUpdateCommandChain ());
  }
***************
*** 143,147 ****
  		// classifiy command was successful. now get further information.
  		// TODO: actually, classify already contains dim (). Simplify!
! 		RCommand *command = new RCommand ("length (" + getFullName () + ")", RCommand::App | RCommand::Sync | RCommand::GetIntVector, "", this, UPDATE_DIM_COMMAND);
  		RKGlobals::rInterface ()->issueCommand (command, RKGlobals::rObjectList()->getUpdateCommandChain ());
  		
--- 143,147 ----
  		// classifiy command was successful. now get further information.
  		// TODO: actually, classify already contains dim (). Simplify!
! 		RCommand *command = new RCommand ("length (" + getFullName () + ")", RCommand::App | RCommand::Sync | RCommand::GetIntVector, QString::null, this, UPDATE_DIM_COMMAND);
  		RKGlobals::rInterface ()->issueCommand (command, RKGlobals::rObjectList()->getUpdateCommandChain ());
  		
***************
*** 160,164 ****
  		if (new_var_type != var_type) RKGlobals::tracker ()->objectMetaChanged (this);
  
! 		RCommand *ncommand = new RCommand ("class (" + getFullName () + ")", RCommand::App | RCommand::Sync | RCommand::GetStringVector, "", this, UPDATE_CLASS_COMMAND);
  		RKGlobals::rInterface ()->issueCommand (ncommand, RKGlobals::rObjectList()->getUpdateCommandChain ());
  
--- 160,164 ----
  		if (new_var_type != var_type) RKGlobals::tracker ()->objectMetaChanged (this);
  
! 		RCommand *ncommand = new RCommand ("class (" + getFullName () + ")", RCommand::App | RCommand::Sync | RCommand::GetStringVector, QString::null, this, UPDATE_CLASS_COMMAND);
  		RKGlobals::rInterface ()->issueCommand (ncommand, RKGlobals::rObjectList()->getUpdateCommandChain ());
  
***************
*** 166,170 ****
  		RK_ASSERT (command->intVectorLength () == 2);
  		if (!(command->getIntVector ()[1])) {
! 			RKGlobals::rInterface ()->issueCommand ("levels (" + getFullName () + ")", RCommand::App | RCommand::Sync | RCommand::GetStringVector, "", this, GET_FACTOR_LEVELS_COMMAND);
  			if (getVarType () == Unknown) {
  				var_type = Factor;
--- 166,170 ----
  		RK_ASSERT (command->intVectorLength () == 2);
  		if (!(command->getIntVector ()[1])) {
! 			RKGlobals::rInterface ()->issueCommand ("levels (" + getFullName () + ")", RCommand::App | RCommand::Sync | RCommand::GetStringVector, QString::null, this, GET_FACTOR_LEVELS_COMMAND);
  			if (getVarType () == Unknown) {
  				var_type = Factor;
***************
*** 183,187 ****
  			}
  		}
! 		RKGlobals::rInterface ()->issueCommand (getFullName (), command_type, "", this, GET_DATA_COMMAND);
  	} else if (command->getFlags () == GET_DATA_COMMAND) {
  		RK_ASSERT (myData ());
--- 183,187 ----
  			}
  		}
! 		RKGlobals::rInterface ()->issueCommand (getFullName (), command_type, QString::null, this, GET_DATA_COMMAND);
  	} else if (command->getFlags () == GET_DATA_COMMAND) {
  		RK_ASSERT (myData ());
***************
*** 315,319 ****
  		}
  	} else {
! 		RKGlobals::rInterface ()->issueCommand ("c (is.numeric (" + getFullName () + "), is.null (levels (" + getFullName () + ")))", RCommand::App | RCommand::Sync | RCommand::GetIntVector, "", this, GET_STORAGE_MODE_COMMAND);
  		myData ()->formatting_options = parseFormattingOptionsString (getMetaProperty ("format"));
  	}
--- 315,319 ----
  		}
  	} else {
! 		RKGlobals::rInterface ()->issueCommand ("c (is.numeric (" + getFullName () + "), is.null (levels (" + getFullName () + ")))", RCommand::App | RCommand::Sync | RCommand::GetIntVector, QString::null, this, GET_STORAGE_MODE_COMMAND);
  		myData ()->formatting_options = parseFormattingOptionsString (getMetaProperty ("format"));
  	}
***************
*** 374,378 ****
  	writeMetaData (chain);
  	if (getVarType () == Factor) {
! 		RKGlobals::rInterface ()->issueCommand ("rk.restore.factor (" + getFullName () + ")", RCommand::App | RCommand::Sync, "", 0, 0, chain);
  	}
  }
--- 374,378 ----
  	writeMetaData (chain);
  	if (getVarType () == Factor) {
! 		RKGlobals::rInterface ()->issueCommand ("rk.restore.factor (" + getFullName () + ")", RCommand::App | RCommand::Sync, QString::null, 0, 0, chain);
  	}
  }
***************
*** 384,388 ****
  	// TODO: try to sync in correct storage mode
  	if (from_row == to_row) {
! 		RKGlobals::rInterface ()->issueCommand (getFullName () + "[" + QString::number (from_row+1) + "] <- " + getRText (from_row), RCommand::App | RCommand::Sync, "", 0,0, chain);
  	} else {
  		QString data_string = "c (";
--- 384,388 ----
  	// TODO: try to sync in correct storage mode
  	if (from_row == to_row) {
! 		RKGlobals::rInterface ()->issueCommand (getFullName () + "[" + QString::number (from_row+1) + "] <- " + getRText (from_row), RCommand::App | RCommand::Sync, QString::null, 0,0, chain);
  	} else {
  		QString data_string = "c (";
***************
*** 395,399 ****
  		}
  		data_string.append (")");
! 		RKGlobals::rInterface ()->issueCommand (getFullName () + "[" + QString::number (from_row + 1) + ":" + QString::number (to_row + 1) + "] <- " + data_string, RCommand::App | RCommand::Sync, "", 0,0, chain);
  	}
  
--- 395,399 ----
  		}
  		data_string.append (")");
! 		RKGlobals::rInterface ()->issueCommand (getFullName () + "[" + QString::number (from_row + 1) + ":" + QString::number (to_row + 1) + "] <- " + data_string, RCommand::App | RCommand::Sync, QString::null, 0,0, chain);
  	}
  
***************
*** 815,821 ****
  		level_string.append (")");
  		// using attr (..., "levels) instead of levels (...) in order to bypass checking
! 		RKGlobals::rInterface ()->issueCommand ("attr (" + getFullName () + ", \"levels\") <- " + level_string, RCommand::App | RCommand::Sync, "", 0, 0, chain);
  	} else {
! 		RKGlobals::rInterface ()->issueCommand ("attr (" + getFullName () + ", \"levels\") <- NULL", RCommand::App | RCommand::Sync, "", 0, 0, chain);
  	}
  }
--- 815,821 ----
  		level_string.append (")");
  		// using attr (..., "levels) instead of levels (...) in order to bypass checking
! 		RKGlobals::rInterface ()->issueCommand ("attr (" + getFullName () + ", \"levels\") <- " + level_string, RCommand::App | RCommand::Sync, QString::null, 0, 0, chain);
  	} else {
! 		RKGlobals::rInterface ()->issueCommand ("attr (" + getFullName () + ", \"levels\") <- NULL", RCommand::App | RCommand::Sync, QString::null, 0, 0, chain);
  	}
  }
***************
*** 837,841 ****
  		return level_string;
  	} else {
! 		return "";
  	}
  }
--- 837,841 ----
  		return level_string;
  	} else {
! 		return QString::null;
  	}
  }
***************
*** 879,883 ****
  
  	if (!formatting_options) {
! 		setMetaProperty ("format", "");
  	} else {
  		QString format_string;
--- 879,883 ----
  
  	if (!formatting_options) {
! 		setMetaProperty ("format", QString::null);
  	} else {
  		QString format_string;

Index: rcontainerobject.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/core/rcontainerobject.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** rcontainerobject.cpp	28 Apr 2005 21:23:10 -0000	1.23
--- rcontainerobject.cpp	29 Sep 2005 16:02:50 -0000	1.24
***************
*** 53,57 ****
  
  // TODO: move classification / type mismatch-checking to RObject
! 	RCommand *command = new RCommand (".rk.classify (" + getFullName () + ")", RCommand::App | RCommand::Sync | RCommand::GetIntVector, "", this, CLASSIFY_COMMAND);
  	RKGlobals::rInterface ()->issueCommand (command, RKGlobals::rObjectList()->getUpdateCommandChain ());
  }
--- 53,57 ----
  
  // TODO: move classification / type mismatch-checking to RObject
! 	RCommand *command = new RCommand (".rk.classify (" + getFullName () + ")", RCommand::App | RCommand::Sync | RCommand::GetIntVector, QString::null, this, CLASSIFY_COMMAND);
  	RKGlobals::rInterface ()->issueCommand (command, RKGlobals::rObjectList()->getUpdateCommandChain ());
  }
***************
*** 98,105 ****
  			if (hasMetaObject ()) getMetaData (RKGlobals::rObjectList()->getUpdateCommandChain ());
  
! 			RCommand *command = new RCommand ("class (" + getFullName () + ")", RCommand::App | RCommand::Sync | RCommand::GetStringVector, "", this, UPDATE_CLASS_COMMAND);
  			RKGlobals::rInterface ()->issueCommand (command, RKGlobals::rObjectList()->getUpdateCommandChain ());
  
! 			command = new RCommand ("names (" + getFullName () + ")", RCommand::App | RCommand::Sync | RCommand::GetStringVector, "", this, UPDATE_CHILD_LIST_COMMAND);
  			RKGlobals::rInterface ()->issueCommand (command, RKGlobals::rObjectList()->getUpdateCommandChain ());
  		}
--- 98,105 ----
  			if (hasMetaObject ()) getMetaData (RKGlobals::rObjectList()->getUpdateCommandChain ());
  
! 			RCommand *command = new RCommand ("class (" + getFullName () + ")", RCommand::App | RCommand::Sync | RCommand::GetStringVector, QString::null, this, UPDATE_CLASS_COMMAND);
  			RKGlobals::rInterface ()->issueCommand (command, RKGlobals::rObjectList()->getUpdateCommandChain ());
  
! 			command = new RCommand ("names (" + getFullName () + ")", RCommand::App | RCommand::Sync | RCommand::GetStringVector, QString::null, this, UPDATE_CHILD_LIST_COMMAND);
  			RKGlobals::rInterface ()->issueCommand (command, RKGlobals::rObjectList()->getUpdateCommandChain ());
  		}
***************
*** 308,314 ****
  	ret = ret.replace (QRegExp ("[^a-zA-Z0-9]"), ".");
  	ret = ret.replace (QRegExp ("^\\.*[0-9]+"), ".");
! 	if (ret == "") ret = "var";
  	int i=-1;
! 	QString postfix = "";
  	while (childmap.contains (ret + postfix)) {
  		postfix.setNum (++i);
--- 308,314 ----
  	ret = ret.replace (QRegExp ("[^a-zA-Z0-9]"), ".");
  	ret = ret.replace (QRegExp ("^\\.*[0-9]+"), ".");
! 	if (ret.isEmpty ()) ret = "var";
  	int i=-1;
! 	QString postfix;
  	while (childmap.contains (ret + postfix)) {
  		postfix.setNum (++i);

Index: robject.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/core/robject.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** robject.cpp	19 Sep 2004 17:33:19 -0000	1.16
--- robject.cpp	29 Sep 2005 16:02:50 -0000	1.17
***************
*** 69,73 ****
  		}
  	}
! 	return "";
  }
  
--- 69,73 ----
  		}
  	}
! 	return QString::null;
  }
  
***************
*** 90,94 ****
  void RObject::setMetaProperty (const QString &id, const QString &value, bool sync) {
  	RK_TRACE (OBJECTS);
! 	if (value == "") {
  		if (meta_map) {
  			meta_map->remove (id);
--- 90,94 ----
  void RObject::setMetaProperty (const QString &id, const QString &value, bool sync) {
  	RK_TRACE (OBJECTS);
! 	if (value.isEmpty ()) {
  		if (meta_map) {
  			meta_map->remove (id);
***************
*** 124,128 ****
  void RObject::getMetaData (RCommandChain *chain) {
  	RK_TRACE (OBJECTS);
! 	RCommand *command = new RCommand (".rk.get.meta (" + getFullName () + ")", RCommand::App | RCommand::Sync | RCommand::GetStringVector, "", this, GET_META_COMMAND);
  	RKGlobals::rInterface ()->issueCommand (command, chain);
  }
--- 124,128 ----
  void RObject::getMetaData (RCommandChain *chain) {
  	RK_TRACE (OBJECTS);
! 	RCommand *command = new RCommand (".rk.get.meta (" + getFullName () + ")", RCommand::App | RCommand::Sync | RCommand::GetStringVector, QString::null, this, GET_META_COMMAND);
  	RKGlobals::rInterface ()->issueCommand (command, chain);
  }





More information about the rkward-tracker mailing list