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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Feb 8 17:57:08 UTC 2011


Revision: 3427
          http://rkward.svn.sourceforge.net/rkward/?rev=3427&view=rev
Author:   tfry
Date:     2011-02-08 17:57:08 +0000 (Tue, 08 Feb 2011)

Log Message:
-----------
Some cleaning and commenting.

Modified Paths:
--------------
    trunk/rkward/rkward/core/rkvariable.cpp
    trunk/rkward/rkward/core/rkvariable.h

Modified: trunk/rkward/rkward/core/rkvariable.cpp
===================================================================
--- trunk/rkward/rkward/core/rkvariable.cpp	2011-02-08 16:01:04 UTC (rev 3426)
+++ trunk/rkward/rkward/core/rkvariable.cpp	2011-02-08 17:57:08 UTC (rev 3427)
@@ -2,7 +2,7 @@
                           rkvariable  -  description
                              -------------------
     begin                : Thu Aug 12 2004
-    copyright            : (C) 2004, 2007, 2008, 2010 by Thomas Friedrichsmeier
+    copyright            : (C) 2004, 2007, 2008, 2010, 2011 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -33,8 +33,8 @@
 
 #include "../debug.h"
 
-QString *RKVariable::na_char = new QString ("");
-QString *RKVariable::unknown_char = new QString ("?");
+QString RKVariable::na_char ("");
+QString RKVariable::unknown_char ("?");
 
 RKVariable::RKVariable (RContainerObject *parent, const QString &name) : RObject (parent, name) {
 	RK_TRACE (OBJECTS);
@@ -217,6 +217,10 @@
 		int old_type = type;
 		bool ret = RObject::updateType (new_data);
 		int new_type = type;
+
+		// Convert old values to the new data type.
+		// TODO: This is quite inefficient, as we will update the data from R in a second, anyway.
+		// Still it is a quick, dirty, and safe way to keep the data representation in a suitable format
 		type = old_type;		// needed to read out the old data
 		setVarType (typeToDataType (new_type), false);
 		type = new_type;
@@ -402,7 +406,7 @@
 QString RKVariable::getText (int row, bool pretty) const {
 	if (row >= getLength ()) {
 		RK_ASSERT (false);
-		return (*unknown_char);
+		return (unknown_char);
 	}
 
 	if (data->cell_states[row] & RKVarEditData::Invalid) {
@@ -411,7 +415,7 @@
 	}
 
 	if (data->cell_states[row] & RKVarEditData::NA) {
-		return (*na_char);
+		return (na_char);
 	}
 
 	if (pretty) return (getLabeled (row));

Modified: trunk/rkward/rkward/core/rkvariable.h
===================================================================
--- trunk/rkward/rkward/core/rkvariable.h	2011-02-08 16:01:04 UTC (rev 3426)
+++ trunk/rkward/rkward/core/rkvariable.h	2011-02-08 17:57:08 UTC (rev 3427)
@@ -118,9 +118,9 @@
 	CellAlign getAlignment () const;
 
 /// an empty char
-	static QString *na_char;
+	static QString na_char;
 /// an unknown value
-	static QString *unknown_char;
+	static QString unknown_char;
 
 /** creates/parses formatting options from the stored meta-property string. See also: getFormattingOptions () */
 	static FormattingOptions parseFormattingOptionsString (const QString &string);


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