Commit fd66b6ff authored by Knut Franke's avatar Knut Franke

- Removed enum SciDAVis::ColumnDataType as well as AbstractColumn::dataType()

  and its implementations. Its information is almost identical to
  SciDAVis::ColumnMode AbstractColumn::columnMode(), the only difference being
  that TypeQDateTime corresponds to three distinct modes (DateTime, Month and
  Day).
- Added hiding of new input/output filters when changing the column mode.
parent c66860fe
......@@ -51,9 +51,9 @@
* Classes derived from this will either store a
* vector with entries of one certain data type, e.g. double, QString,
* QDateTime, or generate such values on demand. To determine the data
* type of a class derived from this, use the dataType() function.
* type of a class derived from this, use the columnMode() function.
* AbstractColumn defines all access functions for all supported data
* types but only those corresponding to the return value of dataType()
* types but only those corresponding to the return value of columnMode()
* will return a meaningful value. Calling functions not belonging to
* the data type of the column is safe, but will do nothing (writing
* function) or return some default value (reading functions).
......@@ -72,11 +72,6 @@
* writing interface.
*/
/**
* \fn SciDAVis::ColumnDataType AbstractColumn::dataType() const
* \brief Return the data type of the column
*/
/**
* \fn bool AbstractColumn::isReadOnly() const
* \brief Return whether the object is read-only
......@@ -333,7 +328,7 @@ void AbstractColumn::clearFormulas() {};
/**
* \brief Return the content of row 'row'.
*
* Use this only when dataType() is QString
* Use this only when columnMode() is Text
*/
QString AbstractColumn::textAt(int row) const {
Q_UNUSED(row);
......@@ -343,7 +338,7 @@ QString AbstractColumn::textAt(int row) const {
/**
* \brief Set the content of row 'row'
*
* Use this only when dataType() is QString
* Use this only when columnMode() is Text
*/
void AbstractColumn::setTextAt(int row, const QString& new_value) {
Q_UNUSED(row) Q_UNUSED(new_value)
......@@ -352,7 +347,7 @@ void AbstractColumn::setTextAt(int row, const QString& new_value) {
/**
* \brief Replace a range of values
*
* Use this only when dataType() is QString
* Use this only when columnMode() is Text
*/
void AbstractColumn::replaceTexts(int first, const QStringList& new_values) {
Q_UNUSED(first) Q_UNUSED(new_values)
......@@ -361,7 +356,7 @@ void AbstractColumn::replaceTexts(int first, const QStringList& new_values) {
/**
* \brief Return the date part of row 'row'
*
* Use this only when dataType() is QDateTime
* Use this only when columnMode() is DateTime, Month or Day
*/
QDate AbstractColumn::dateAt(int row) const {
Q_UNUSED(row);
......@@ -371,7 +366,7 @@ QDate AbstractColumn::dateAt(int row) const {
/**
* \brief Set the content of row 'row'
*
* Use this only when dataType() is QDateTime
* Use this only when columnMode() is DateTime, Month or Day
*/
void AbstractColumn::setDateAt(int row, const QDate& new_value) {
Q_UNUSED(row) Q_UNUSED(new_value)
......@@ -380,7 +375,7 @@ void AbstractColumn::setDateAt(int row, const QDate& new_value) {
/**
* \brief Return the time part of row 'row'
*
* Use this only when dataType() is QDateTime
* Use this only when columnMode() is DateTime, Month or Day
*/
QTime AbstractColumn::timeAt(int row) const {
Q_UNUSED(row);
......@@ -390,7 +385,7 @@ QTime AbstractColumn::timeAt(int row) const {
/**
* \brief Set the content of row 'row'
*
* Use this only when dataType() is QDateTime
* Use this only when columnMode() is DateTime, Month or Day
*/
void AbstractColumn::setTimeAt(int row, const QTime& new_value) {
Q_UNUSED(row) Q_UNUSED(new_value)
......@@ -399,7 +394,7 @@ void AbstractColumn::setTimeAt(int row, const QTime& new_value) {
/**
* \brief Return the QDateTime in row 'row'
*
* Use this only when dataType() is QDateTime
* Use this only when columnMode() is DateTime, Month or Day
*/
QDateTime AbstractColumn::dateTimeAt(int row) const {
Q_UNUSED(row);
......@@ -409,7 +404,7 @@ QDateTime AbstractColumn::dateTimeAt(int row) const {
/**
* \brief Set the content of row 'row'
*
* Use this only when dataType() is QDateTime
* Use this only when columnMode() is DateTime, Month or Day
*/
void AbstractColumn::setDateTimeAt(int row, const QDateTime& new_value) {
Q_UNUSED(row) Q_UNUSED(new_value)
......@@ -418,7 +413,7 @@ void AbstractColumn::setDateTimeAt(int row, const QDateTime& new_value) {
/**
* \brief Replace a range of values
*
* Use this only when dataType() is QDateTime
* Use this only when columnMode() is DateTime, Month or Day
*/
void AbstractColumn::replaceDateTimes(int first, const QList<QDateTime>& new_values) {
Q_UNUSED(first) Q_UNUSED(new_values)
......@@ -427,7 +422,7 @@ void AbstractColumn::replaceDateTimes(int first, const QList<QDateTime>& new_val
/**
* \brief Return the double value in row 'row'
*
* Use this only when dataType() is double
* Use this only when columnMode() is Numeric
*/
double AbstractColumn::valueAt(int row) const {
Q_UNUSED(row);
......@@ -437,7 +432,7 @@ double AbstractColumn::valueAt(int row) const {
/**
* \brief Set the content of row 'row'
*
* Use this only when dataType() is double
* Use this only when columnMode() is Numeric
*/
void AbstractColumn::setValueAt(int row, double new_value) {
Q_UNUSED(row) Q_UNUSED(new_value)
......@@ -446,7 +441,7 @@ void AbstractColumn::setValueAt(int row, double new_value) {
/**
* \brief Replace a range of values
*
* Use this only when dataType() is double
* Use this only when columnMode() is Numeric
*/
void AbstractColumn::replaceValues(int first, const QVector<double>& new_values) {
Q_UNUSED(first) Q_UNUSED(new_values)
......
......@@ -50,7 +50,6 @@ class AbstractColumn : public AbstractAspect
AbstractColumn(const QString& name) : AbstractAspect(name) {}
virtual ~AbstractColumn() { aboutToBeDestroyed(this);}
virtual SciDAVis::ColumnDataType dataType() const = 0;
virtual bool isReadOnly() const { return true; };
virtual SciDAVis::ColumnMode columnMode() const = 0;
virtual void setColumnMode(SciDAVis::ColumnMode mode);
......
......@@ -66,7 +66,6 @@ class ResultsColumn : public AbstractColumn
public:
ResultsColumn(AbstractFit * owner) : AbstractColumn(tr("value")), m_owner(owner) {}
virtual SciDAVis::ColumnDataType dataType() const { return SciDAVis::TypeDouble; }
virtual SciDAVis::ColumnMode columnMode() const { return SciDAVis::Numeric; }
virtual int rowCount() const { return m_owner->numParameters(); }
virtual SciDAVis::PlotDesignation plotDesignation() const { return SciDAVis::Y; }
......@@ -85,7 +84,6 @@ class ErrorsColumn : public AbstractColumn
public:
ErrorsColumn(AbstractFit * owner) : AbstractColumn(tr("error")), m_owner(owner) {}
virtual SciDAVis::ColumnDataType dataType() const { return SciDAVis::TypeDouble; }
virtual SciDAVis::ColumnMode columnMode() const { return SciDAVis::Numeric; }
virtual int rowCount() const { return m_owner->numParameters(); }
virtual SciDAVis::PlotDesignation plotDesignation() const { return SciDAVis::Y; }
......@@ -104,7 +102,6 @@ class NamesColumn : public AbstractColumn
public:
NamesColumn(AbstractFit * owner) : AbstractColumn(tr("error")), m_owner(owner) {}
virtual SciDAVis::ColumnDataType dataType() const { return SciDAVis::TypeQString; }
virtual SciDAVis::ColumnMode columnMode() const { return SciDAVis::Text; }
virtual int rowCount() const { return m_owner->numParameters(); }
virtual SciDAVis::PlotDesignation plotDesignation() const { return SciDAVis::Y; }
......@@ -123,7 +120,6 @@ class DescriptionsColumn : public AbstractColumn
public:
DescriptionsColumn(AbstractFit * owner) : AbstractColumn(tr("error")), m_owner(owner) {}
virtual SciDAVis::ColumnDataType dataType() const { return SciDAVis::TypeQString; }
virtual SciDAVis::ColumnMode columnMode() const { return SciDAVis::Text; }
virtual int rowCount() const { return m_owner->numParameters(); }
virtual SciDAVis::PlotDesignation plotDesignation() const { return SciDAVis::Y; }
......
......@@ -66,10 +66,10 @@
* 03 {
* 04 protected:
* 05 virtual bool inputAcceptable(int, AbstractColumn *source) {
* 06 return (source->dataType() == SciDAVis::TypeDouble);
* 06 return (source->columnMode() == SciDAVis::Numeric);
* 07 }
* 08 public:
* 09 virtual SciDAVis::ColumnDataType dataType() const { return SciDAVis::TypeDouble; }
* 09 virtual SciDAVis::ColumnMode columnMode() const { return SciDAVis::Numeric; }
* 10
* 11 virtual double valueAt(int row) const {
* 12 if (!m_inputs.value(0)) return 0.0;
......@@ -82,7 +82,7 @@
* This filter reads an input value (line 13) and returns its square (line 14).
* Reimplementing inputAcceptable() makes sure that the data source really is of type
* double (lines 5 to 7). Otherwise, the source will be rejected by AbstractFilter::input().
* The output type is repoted by reimplementing dataType() (line 09).
* The output type is reported by reimplementing columnMode() (line 09).
* Before you actually use m_inputs.value(0), make sure that the input port has
* been connected to a data source (line 12).
* Otherwise line 13 would result in a crash. That's it, we've already written a
......@@ -110,10 +110,10 @@
* 03 {
* 04 protected:
* 05 virtual bool inputAcceptable(int, AbstractColumn *source) {
* 06 return (source->dataType() == SciDAVis::TypeDouble);
* 06 return (source->columnMode() == SciDAVis::Numeric);
* 07 }
* 08 public:
* 09 virtual SciDAVis::ColumnDataType dataType() const { return SciDAVis::TypeDouble; }
* 09 virtual SciDAVis::ColumnMode columnMode() const { return SciDAVis::Numeric; }
* \endcode
* Even rows (including row 0) get dropped, odd rows are renumbered:
* \code
......@@ -158,16 +158,6 @@ SciDAVis::PlotDesignation AbstractSimpleFilter::plotDesignation() const {
SciDAVis::noDesignation;
}
/**
* \brief Return the data type of the input
*/
SciDAVis::ColumnDataType AbstractSimpleFilter::dataType() const {
// calling this function while m_input is empty is a sign of very bad code
// nevertheless it will return some rather meaningless value to
// avoid crashes
return m_inputs.value(0) ? m_inputs.at(0)->dataType() : SciDAVis::TypeQString;
}
/**
* \brief Return the column mode
*
......@@ -185,7 +175,7 @@ SciDAVis::ColumnMode AbstractSimpleFilter::columnMode() const {
/**
* \brief Return the content of row 'row'.
*
* Use this only when dataType() is QString
* Use this only when columnMode() is Text
*/
QString AbstractSimpleFilter::textAt(int row) const {
return m_inputs.value(0) ? m_inputs.at(0)->textAt(row) : QString();
......@@ -194,7 +184,7 @@ QString AbstractSimpleFilter::textAt(int row) const {
/**
* \brief Return the date part of row 'row'
*
* Use this only when dataType() is QDateTime
* Use this only when columnMode() is DateTime, Month or Day
*/
QDate AbstractSimpleFilter::dateAt(int row) const {
return m_inputs.value(0) ? m_inputs.at(0)->dateAt(row) : QDate();
......@@ -203,7 +193,7 @@ QDate AbstractSimpleFilter::dateAt(int row) const {
/**
* \brief Return the time part of row 'row'
*
* Use this only when dataType() is QDateTime
* Use this only when columnMode() is DateTime, Month or Day
*/
QTime AbstractSimpleFilter::timeAt(int row) const {
return m_inputs.value(0) ? m_inputs.at(0)->timeAt(row) : QTime();
......@@ -212,7 +202,7 @@ QTime AbstractSimpleFilter::timeAt(int row) const {
/**
* \brief Set the content of row 'row'
*
* Use this only when dataType() is QDateTime
* Use this only when columnMode() is DateTime, Month or Day
*/
QDateTime AbstractSimpleFilter::dateTimeAt(int row) const {
return m_inputs.value(0) ? m_inputs.at(0)->dateTimeAt(row) : QDateTime();
......@@ -221,7 +211,7 @@ QDateTime AbstractSimpleFilter::dateTimeAt(int row) const {
/**
* \brief Return the double value in row 'row'
*
* Use this only when dataType() is double
* Use this only when columnMode() is Numeric
*/
double AbstractSimpleFilter::valueAt(int row) const {
return m_inputs.value(0) ? m_inputs.at(0)->valueAt(row) : 0.0;
......@@ -486,10 +476,6 @@ bool AbstractSimpleFilter::load(XmlStreamReader * reader)
//! \class SimpleFilterColumn
////////////////////////////////////////////////////////////////////////////////////////////////////
SciDAVis::ColumnDataType SimpleFilterColumn::dataType() const {
return m_owner->dataType();
}
SciDAVis::ColumnMode SimpleFilterColumn::columnMode() const {
return m_owner->columnMode();
}
......
......@@ -48,7 +48,6 @@ class AbstractSimpleFilter : public AbstractFilter
virtual AbstractColumn* output(int port);
virtual const AbstractColumn * output(int port) const;
virtual SciDAVis::PlotDesignation plotDesignation() const;
virtual SciDAVis::ColumnDataType dataType() const;
virtual SciDAVis::ColumnMode columnMode() const;
virtual QString textAt(int row) const;
virtual QDate dateAt(int row) const;
......@@ -99,7 +98,6 @@ class SimpleFilterColumn : public AbstractColumn
public:
SimpleFilterColumn(AbstractSimpleFilter *owner) : AbstractColumn(owner->name()), m_owner(owner) {}
virtual SciDAVis::ColumnDataType dataType() const;
virtual SciDAVis::ColumnMode columnMode() const;
virtual int rowCount() const { return m_owner->rowCount(); }
virtual SciDAVis::PlotDesignation plotDesignation() const { return m_owner->plotDesignation(); }
......
......@@ -81,8 +81,7 @@ Column::Column(const QString& name, SciDAVis::ColumnMode mode)
Column::Column(const QString& name, QVector<double> data, IntervalAttribute<bool> validity)
: AbstractColumn(name)
{
m_column_private = new Private(this, SciDAVis::TypeDouble,
SciDAVis::Numeric, new QVector<double>(data), validity);
m_column_private = new Private(this, SciDAVis::Numeric, new QVector<double>(data), validity);
init();
}
......@@ -96,8 +95,7 @@ Column::Column(const QString& name, QVector<double> data, IntervalAttribute<bool
Column::Column(const QString& name, QStringList data, IntervalAttribute<bool> validity)
: AbstractColumn(name)
{
m_column_private = new Private(this, SciDAVis::TypeQString,
SciDAVis::Text, new QStringList(data), validity);
m_column_private = new Private(this, SciDAVis::Text, new QStringList(data), validity);
init();
}
......@@ -111,8 +109,7 @@ Column::Column(const QString& name, QStringList data, IntervalAttribute<bool> va
Column::Column(const QString& name, QList<QDateTime> data, IntervalAttribute<bool> validity)
: AbstractColumn(name)
{
m_column_private = new Private(this, SciDAVis::TypeQDateTime,
SciDAVis::DateTime, new QList<QDateTime>(data), validity);
m_column_private = new Private(this, SciDAVis::DateTime, new QList<QDateTime>(data), validity);
init();
}
......@@ -179,7 +176,7 @@ void Column::setColumnMode(SciDAVis::ColumnMode mode)
bool Column::copy(const AbstractColumn * other)
{
Q_CHECK_PTR(other);
if(other->dataType() != dataType()) return false;
if(other->columnMode() != columnMode()) return false;
exec(new ColumnFullCopyCmd(m_column_private, other));
return true;
}
......@@ -198,7 +195,7 @@ bool Column::copy(const AbstractColumn * other)
bool Column::copy(const AbstractColumn * source, int source_start, int dest_start, int num_rows)
{
Q_CHECK_PTR(source);
if(source->dataType() != dataType()) return false;
if(source->columnMode() != columnMode()) return false;
exec(new ColumnPartialCopyCmd(m_column_private, source, source_start, dest_start, num_rows));
return true;
}
......@@ -362,7 +359,7 @@ void Column::clearFormulas()
/**
* \brief Set the content of row 'row'
*
* Use this only when dataType() is QString
* Use this only when columnMode() is Text
*/
void Column::setTextAt(int row, const QString& new_value)
{
......@@ -372,7 +369,7 @@ void Column::setTextAt(int row, const QString& new_value)
/**
* \brief Replace a range of values
*
* Use this only when dataType() is QString
* Use this only when columnMode() is Text
*/
void Column::replaceTexts(int first, const QStringList& new_values)
{
......@@ -383,7 +380,7 @@ void Column::replaceTexts(int first, const QStringList& new_values)
/**
* \brief Set the content of row 'row'
*
* Use this only when dataType() is QDateTime
* Use this only when columnMode() is DateTime, Month or Day
*/
void Column::setDateAt(int row, const QDate& new_value)
{
......@@ -393,7 +390,7 @@ void Column::setDateAt(int row, const QDate& new_value)
/**
* \brief Set the content of row 'row'
*
* Use this only when dataType() is QDateTime
* Use this only when columnMode() is DateTime, Month or Day
*/
void Column::setTimeAt(int row,const QTime& new_value)
{
......@@ -403,7 +400,7 @@ void Column::setTimeAt(int row,const QTime& new_value)
/**
* \brief Set the content of row 'row'
*
* Use this only when dataType() is QDateTime
* Use this only when columnMode() is DateTime, Month or Day
*/
void Column::setDateTimeAt(int row, const QDateTime& new_value)
{
......@@ -413,7 +410,7 @@ void Column::setDateTimeAt(int row, const QDateTime& new_value)
/**
* \brief Replace a range of values
*
* Use this only when dataType() is QDateTime
* Use this only when columnMode() is DateTime, Month or Day
*/
void Column::replaceDateTimes(int first, const QList<QDateTime>& new_values)
{
......@@ -424,7 +421,7 @@ void Column::replaceDateTimes(int first, const QList<QDateTime>& new_values)
/**
* \brief Set the content of row 'row'
*
* Use this only when dataType() is double
* Use this only when columnMode() is Numeric
*/
void Column::setValueAt(int row, double new_value)
{
......@@ -434,7 +431,7 @@ void Column::setValueAt(int row, double new_value)
/**
* \brief Replace a range of values
*
* Use this only when dataType() is double
* Use this only when columnMode() is Numeric
*/
void Column::replaceValues(int first, const QVector<double>& new_values)
{
......@@ -445,7 +442,7 @@ void Column::replaceValues(int first, const QVector<double>& new_values)
/**
* \brief Return the content of row 'row'.
*
* Use this only when dataType() is QString
* Use this only when columnMode() is Text
*/
QString Column::textAt(int row) const
{
......@@ -455,7 +452,7 @@ QString Column::textAt(int row) const
/**
* \brief Return the date part of row 'row'
*
* Use this only when dataType() is QDateTime
* Use this only when columnMode() is DateTime, Month or Day
*/
QDate Column::dateAt(int row) const
{
......@@ -465,7 +462,7 @@ QDate Column::dateAt(int row) const
/**
* \brief Return the time part of row 'row'
*
* Use this only when dataType() is QDateTime
* Use this only when columnMode() is DateTime, Month or Day
*/
QTime Column::timeAt(int row) const
{
......@@ -475,7 +472,7 @@ QTime Column::timeAt(int row) const
/**
* \brief Return the QDateTime in row 'row'
*
* Use this only when dataType() is QDateTime
* Use this only when columnMode() is DateTime, Month or Day
*/
QDateTime Column::dateTimeAt(int row) const
{
......@@ -499,13 +496,14 @@ double Column::valueAt(int row) const
*/
QIcon Column::icon() const
{
switch(dataType())
{
case SciDAVis::TypeDouble:
switch(columnMode()) {
case SciDAVis::Numeric:
return QIcon(QPixmap(":/numerictype.png"));
case SciDAVis::TypeQString:
case SciDAVis::Text:
return QIcon(QPixmap(":/texttype.png"));
case SciDAVis::TypeQDateTime:
case SciDAVis::DateTime:
case SciDAVis::Month:
case SciDAVis::Day:
return QIcon(QPixmap(":/datetype.png"));
}
return QIcon();
......@@ -523,7 +521,6 @@ void Column::save(QXmlStreamWriter * writer) const
{
writer->writeStartElement("column");
writeBasicAttributes(writer);
writer->writeAttribute("type", SciDAVis::enumValueToString(dataType(), "ColumnDataType"));
writer->writeAttribute("mode", SciDAVis::enumValueToString(columnMode(), "ColumnMode"));
writer->writeAttribute("plot_designation", SciDAVis::enumValueToString(plotDesignation(), "PlotDesignation"));
writer->writeAttribute("width", QString::number(width()));
......@@ -552,24 +549,21 @@ void Column::save(QXmlStreamWriter * writer) const
writer->writeEndElement();
}
int i;
switch(dataType())
{
case SciDAVis::TypeDouble:
switch(columnMode()) {
case SciDAVis::Numeric:
for(i=0; i<rowCount(); i++)
{
writer->writeStartElement("row");
writer->writeAttribute("type", SciDAVis::enumValueToString(dataType(), "ColumnDataType"));
writer->writeAttribute("index", QString::number(i));
writer->writeAttribute("invalid", isInvalid(i) ? "yes" : "no");
writer->writeCharacters(QString::number(valueAt(i), 'e', 16));
writer->writeEndElement();
}
break;
case SciDAVis::TypeQString:
case SciDAVis::Text:
for(i=0; i<rowCount(); i++)
{
writer->writeStartElement("row");
writer->writeAttribute("type", SciDAVis::enumValueToString(dataType(), "ColumnDataType"));
writer->writeAttribute("index", QString::number(i));
writer->writeAttribute("invalid", isInvalid(i) ? "yes" : "no");
writer->writeCharacters(textAt(i));
......@@ -577,11 +571,12 @@ void Column::save(QXmlStreamWriter * writer) const
}
break;
case SciDAVis::TypeQDateTime:
case SciDAVis::DateTime:
case SciDAVis::Month:
case SciDAVis::Day:
for(i=0; i<rowCount(); i++)
{
writer->writeStartElement("row");
writer->writeAttribute("type", SciDAVis::enumValueToString(dataType(), "ColumnDataType"));
writer->writeAttribute("index", QString::number(i));
writer->writeAttribute("invalid", isInvalid(i) ? "yes" : "no");
#if QT_VERSION < 0x040400 // avoid a bug in Qt < 4.4
......@@ -616,19 +611,6 @@ bool Column::load(XmlStreamReader * reader)
QXmlStreamAttributes attribs = reader->attributes();
QString str;
// read type
str = attribs.value(reader->namespaceUri().toString(), "type").toString();
if(str.isEmpty())
{
reader->raiseError(tr("column type missing"));
return false;
}
int type_code = SciDAVis::enumStringToValue(str, "ColumnDataType");
if(type_code == -1)
{
reader->raiseError(tr("column type invalid"));
return false;
}
// read mode
str = attribs.value(reader->namespaceUri().toString(), "mode").toString();
if(str.isEmpty())
......@@ -643,11 +625,6 @@ bool Column::load(XmlStreamReader * reader)
return false;
}
setColumnMode((SciDAVis::ColumnMode)mode_code);
if(type_code != int(dataType()))
{
reader->raiseError(tr("column type or mode invalid"));
return false;
}
// read plot designation
str = attribs.value(reader->namespaceUri().toString(), "plot_designation").toString();
int pd_code = SciDAVis::enumStringToValue(str, "PlotDesignation");
......@@ -790,22 +767,12 @@ bool Column::XmlReadRow(XmlStreamReader * reader)
Q_ASSERT(reader->isStartElement() && reader->name() == "row");
QString str;
int type_code;
QXmlStreamAttributes attribs = reader->attributes();
// verfiy type
str = attribs.value(reader->namespaceUri().toString(), "type").toString();
type_code = SciDAVis::enumStringToValue(str, "ColumnDataType");
if(str.isEmpty() || type_code == -1 || type_code != int(dataType()))
{
reader->raiseError(tr("invalid or missing row type"));
return false;
}
bool ok;
int index = reader->readAttributeInt("index", &ok);
if(!ok)
{
if(!ok) {
reader->raiseError(tr("invalid or missing row index"));
return false;
}
......@@ -814,24 +781,24 @@ bool Column::XmlReadRow(XmlStreamReader * reader)
if(str == "yes") setInvalid(index);
str = reader->readElementText();
switch(dataType())
{
case SciDAVis::TypeDouble:
switch(columnMode()) {
case SciDAVis::Numeric:
{
double value = str.toDouble(&ok);
if(!ok)
{
if(!ok) {
reader->raiseError(tr("invalid row value"));
return false;
}
setValueAt(index, value);
break;
}
case SciDAVis::TypeQString:
case SciDAVis::Text:
setTextAt(index, str);
break;
case SciDAVis::TypeQDateTime:
case SciDAVis::DateTime:
case SciDAVis::Month:
case SciDAVis::Day:
QDateTime date_time = QDateTime::fromString(str,"yyyy-dd-MM hh:mm:ss:zzz");
setDateTimeAt(index, date_time);
break;
......@@ -844,14 +811,6 @@ bool Column::XmlReadRow(XmlStreamReader * reader)
//@}
////////////////////////////////////////////////////////////////////////////////
/**
* \brief Return the data type of the column
*/
SciDAVis::ColumnDataType Column::dataType() const
{
return m_column_private->dataType();
}
/**
* \brief Return whether the object is read-only
*/
......