[rkward-cvs] SF.net SVN: rkward: [2184] branches/KDE4_port/rkward/core

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Nov 7 19:31:57 UTC 2007


Revision: 2184
          http://rkward.svn.sourceforge.net/rkward/?rev=2184&view=rev
Author:   tfry
Date:     2007-11-07 11:31:56 -0800 (Wed, 07 Nov 2007)

Log Message:
-----------
constness and warnings

Modified Paths:
--------------
    branches/KDE4_port/rkward/core/rcontainerobject.cpp
    branches/KDE4_port/rkward/core/rkvariable.cpp
    branches/KDE4_port/rkward/core/rkvariable.h

Modified: branches/KDE4_port/rkward/core/rcontainerobject.cpp
===================================================================
--- branches/KDE4_port/rkward/core/rcontainerobject.cpp	2007-11-07 18:11:02 UTC (rev 2183)
+++ branches/KDE4_port/rkward/core/rcontainerobject.cpp	2007-11-07 19:31:56 UTC (rev 2184)
@@ -298,6 +298,8 @@
 RObject *RContainerObject::createNewChild (const QString &name, int position, RKEditor *creator, bool container, bool data_frame) {
 	RK_TRACE (OBJECTS);
 
+#warning rename to createPendingChild, also in RObjectList
+#warning TODO validize name
 	RObject *ret;
 	if (container) {
 		ret = new RContainerObject (this, name);
@@ -313,7 +315,7 @@
 	if ((position < 0) || (position > childmap.size ())) position = childmap.size ();
 
 	RKGlobals::tracker ()->addObject (ret, this, position, creator);
-#warning TODO shouldn't we create the object in R, here?
+#warning TODO should we create the object in R, here?
 
 	return ret;
 }

Modified: branches/KDE4_port/rkward/core/rkvariable.cpp
===================================================================
--- branches/KDE4_port/rkward/core/rkvariable.cpp	2007-11-07 18:11:02 UTC (rev 2183)
+++ branches/KDE4_port/rkward/core/rkvariable.cpp	2007-11-07 19:31:56 UTC (rev 2184)
@@ -2,7 +2,7 @@
                           rkvariable  -  description
                              -------------------
     begin                : Thu Aug 12 2004
-    copyright            : (C) 2004 by Thomas Friedrichsmeier
+    copyright            : (C) 2004, 2007 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -466,7 +466,7 @@
 	}
 }
 
-QString RKVariable::getText (int row, bool pretty) {
+QString RKVariable::getText (int row, bool pretty) const {
 	if (row >= getLength ()) {
 		RK_ASSERT (false);
 		return (*unknown_char);
@@ -503,7 +503,7 @@
 	}
 }
 
-QString RKVariable::getRText (int row) {
+QString RKVariable::getRText (int row) const {
 	RK_TRACE (OBJECTS);
 	
 	Status cell_state = cellStatus (row);
@@ -573,7 +573,7 @@
 	cellChanged (row);
 }
 
-QString RKVariable::getLabeled (int row) {
+QString RKVariable::getLabeled (int row) const {
 	if (data->value_labels) {
 		QString otext = getText (row);
 		if (data->value_labels->contains (otext)) {
@@ -583,7 +583,7 @@
 	return getText (row);
 }
 
-double *RKVariable::getNumeric (int from_row, int to_row) {
+double *RKVariable::getNumeric (int from_row, int to_row) const {
 	RK_TRACE (OBJECTS);
 	if (to_row >= getLength ()) {
 		RK_ASSERT (false);
@@ -638,7 +638,7 @@
 	cellsChanged (from_row, to_row);
 }
 
-QString *RKVariable::getCharacter (int from_row, int to_row) {
+QString *RKVariable::getCharacter (int from_row, int to_row) const {
 	RK_TRACE (OBJECTS);
 	if (to_row >= getLength ()) {
 		RK_ASSERT (false);
@@ -694,7 +694,7 @@
 	}
 }
 
-RKVariable::Status RKVariable::cellStatus (int row) {
+RKVariable::Status RKVariable::cellStatus (int row) const {
 	if (data->cell_states[row] == RKVarEditData::Unknown) return ValueUnknown;
 	if (data->cell_states[row] & RKVarEditData::NA) return ValueUnused;
 	if (data->cell_states[row] & RKVarEditData::Invalid) return ValueInvalid;
@@ -796,7 +796,7 @@
 	}
 }
 
-RObject::ValueLabels *RKVariable::getValueLabels () {
+RObject::ValueLabels *RKVariable::getValueLabels () const {
 	RK_ASSERT (data);
 	return (data->value_labels);
 }
@@ -835,7 +835,7 @@
 	// TODO: find out whether the object is valid after the operation and update accordingly!
 }
 
-void RKVariable::writeValueLabels (RCommandChain *chain) {
+void RKVariable::writeValueLabels (RCommandChain *chain) const {
 	RK_TRACE (OBJECTS);
 	RK_ASSERT (data);
 	
@@ -856,7 +856,7 @@
 	}
 }
 
-QString RKVariable::getValueLabelString () {
+QString RKVariable::getValueLabelString () const {
 	RK_TRACE (OBJECTS);
 	RK_ASSERT (data);
 
@@ -896,7 +896,7 @@
 	setValueLabels (new_labels);
 }
 
-RKVariable::FormattingOptions *RKVariable::getFormattingOptions () {
+RKVariable::FormattingOptions *RKVariable::getFormattingOptions () const {
 	RK_TRACE (OBJECTS);
 	RK_ASSERT (data);
 
@@ -942,7 +942,7 @@
 	RKGlobals::tracker ()->objectDataChanged (this, set);
 }
 
-QString RKVariable::getFormattingOptionsString () {
+QString RKVariable::getFormattingOptionsString () const {
 	RK_TRACE (OBJECTS);
 	RK_ASSERT (data);
 
@@ -956,9 +956,9 @@
 	setFormattingOptions (parseFormattingOptionsString (string));
 }
 
+// static
 RKVariable::FormattingOptions *RKVariable::parseFormattingOptionsString (const QString &string) {
 	RK_TRACE (OBJECTS);
-	RK_ASSERT (data);
 
 	FormattingOptions *formatting_options = new FormattingOptions;
 	formatting_options->alignment = FormattingOptions::AlignDefault;
@@ -1008,8 +1008,7 @@
 	}
 }
 
-/** returns alignment to use for this variable */
-RKVariable::CellAlign RKVariable::getAlignment () {
+RKVariable::CellAlign RKVariable::getAlignment () const {
 	RK_ASSERT (data);
 	
 	if (data->formatting_options && (data->formatting_options->alignment != FormattingOptions::AlignDefault)) {

Modified: branches/KDE4_port/rkward/core/rkvariable.h
===================================================================
--- branches/KDE4_port/rkward/core/rkvariable.h	2007-11-07 18:11:02 UTC (rev 2183)
+++ branches/KDE4_port/rkward/core/rkvariable.h	2007-11-07 19:31:56 UTC (rev 2184)
@@ -2,7 +2,7 @@
                           rkvariable  -  description
                              -------------------
     begin                : Thu Aug 12 2004
-    copyright            : (C) 2004 by Thomas Friedrichsmeier
+    copyright            : (C) 2004, 2007 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -62,24 +62,24 @@
 	
 /** get the value at the given row in text-form - regardless of the storage mode.
 @param pretty: get the text in pretty form, e.g. rounding numbers to a certain number of digits, replacing numeric values with value labels if available, etc. Formatting is done according to the meta-information stored in the RObject and global user preferences */
-	QString getText (int row, bool pretty=false);
+	QString getText (int row, bool pretty=false) const;
 /** get the value at the given row in text-form suitable for submission to R. I.e. strings are quoted, numbers are not, empty values are returned as NA */
-	QString getRText (int row);
+	QString getRText (int row) const;
 /** set the value at the given row in text-form. Will try to convert the given string to the internal storage format if possible. */
 	void setText (int row, const QString &text);
 
 /** get a copy of the numeric values of rows starting from from_index, going to to_index. Do not use this before making sure that the rStorage () is really
 numeric!  TODO: unused  */
-	double *getNumeric (int from_row, int to_row);
+	double *getNumeric (int from_row, int to_row) const;
 /** set numeric values in the given range. Assumes you provide enough values for the range. If internalStorage is String, all values will be converted to strings, so you should use this function only, if you know you are dealing with a numeric object */
 	void setNumeric (int from_row, int to_row, double *data);
 /** like getNumeric, but returns values as an array of QString*s. TODO: unused */
-	QString *getCharacter (int from_row, int to_row);
+	QString *getCharacter (int from_row, int to_row) const;
 /** like setNumeric, but sets chars. If internalStorage () is numeric, attempts to convert the given strings to numbers. I.e. the function behaves essentially like setText (), but operates on a range of cells. */
 	void setCharacter (int from_row, int to_row, QString *data);
 	
 /** returns the current status of the given cell */
-	Status cellStatus (int row);
+	Status cellStatus (int row) const;
 
 /** sets the status of the given range of cells to Unknown (the entire row if from_row and to_row are -1). Usually you call this, when you are about to update the given data-range, but haven't fetched the data for that, yet. The unknown-flag is cleared for the cells, as soon as data is written to those cells. The effect is that the cells will not be editable until the data was updated. */
 	void setUnknown (int from_row=-1, int to_row=-1);
@@ -96,11 +96,11 @@
 	void setLength (int len);
 
 /** returns the map of value labels for this variable or 0 if no labels/levels are assigned. Does _not_ return a copy, but the real thing. Do not delete! */
-	ValueLabels *getValueLabels ();
+	ValueLabels *getValueLabels () const;
 /** assigns a new map of labels. Also takes care of syncing with the backend. Ownership of the ValueLabels is transferred to the variable. Use setValueLabels (0) to remove all labels */
 	void setValueLabels (ValueLabels *labels);
 /** get value labels as string (for display) */
-	QString getValueLabelString ();
+	QString getValueLabelString () const;
 /** set value labels from string (for paste operations) */
 	void setValueLabelString (const QString &string);
 
@@ -118,18 +118,18 @@
 	};
 
 /** returns the formatting options, or 0 if no options specified (i.e. all set to default). Does _not_ return a copy, but the real thing. Do not delete! */
-	FormattingOptions *getFormattingOptions ();
+	FormattingOptions *getFormattingOptions () const;
 /** assigns new formatting options. Ownership of the FormattingOptions -struct is transferred to the variable. Use setFormatting (0) to remove all options */
 	void setFormattingOptions (FormattingOptions *formatting_options);
 /** get formatting options as a string (for display) */
-	QString getFormattingOptionsString ();
+	QString getFormattingOptionsString () const;
 /** parse formatting options from the given string */
 	void setFormattingOptionsString (const QString &string);
 
 /** This enum describes the alignment of text inside a table cell */
 	enum CellAlign { AlignCellLeft=0, AlignCellRight=1 };
 /** returns alignment to use for this variable */
-	CellAlign getAlignment ();
+	CellAlign getAlignment () const;
 
 /// an empty char
 	static QString *na_char;
@@ -188,11 +188,11 @@
 	void writeData (int from_row, int to_row, RCommandChain *chain=0);
 	void writeInvalidField (int row, RCommandChain *chain=0);
 /** writes the values labels to the backend */
-	void writeValueLabels (RCommandChain *chain);
+	void writeValueLabels (RCommandChain *chain) const;
 /** creates/parses formatting options from the stored meta-property string. See also: getFormattingOptions () */
-	FormattingOptions *parseFormattingOptionsString (const QString &string);
+	static FormattingOptions *parseFormattingOptionsString (const QString &string);
 /** tries to match a value-label to the value in the given cell. Returns the label, or - if there is no label - the original value in textual representation */
-	QString getLabeled (int row);
+	QString getLabeled (int row) const;
 
 /** allocate edit data (cells initialized to NAs) */
 	void allocateEditData ();


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