labplot  2.8.2
About: LabPlot is an application for plotting and analysis of 2D and 3D functions and data. It is a complete rewrite of LabPlot1 and lacks in the first release a lot of features available in the predecessor. On the other hand, the GUI and the usability is more superior.
  Fossies Dox: labplot-2.8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

AbstractColumn.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  File : AbstractColumn.cpp
3  Project : LabPlot
4  Description : Interface definition for data with column logic
5  --------------------------------------------------------------------
6  Copyright : (C) 2007,2008 Tilman Benkert (thzs@gmx.net)
7  Copyright : (C) 2017-2020 Stefan Gerlach (stefan.gerlach@uni.kn)
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 
35 
36 #include <QDateTime>
37 #include <QIcon>
38 #include <KLocalizedString>
39 
40 /**
41  * \class AbstractColumn
42  * \brief Interface definition for data with column logic
43  *
44  * This is an abstract base class for column-based data,
45  * i.e. mathematically a vector or technically a 1D array or list.
46  * It only defines the interface but has no data members itself.
47  *
48  * Classes derived from this are typically table columns or outputs
49  * of filters which can be chained between table columns and plots.
50  * From the point of view of the plot functions there will be no difference
51  * between a table column and a filter output since both use this interface.
52  *
53  * Classes derived from this will either store a
54  * vector with entries of one certain data type, e.g. double, QString,
55  * QDateTime, or generate such values on demand. To determine the data
56  * type of a class derived from this, use the columnMode() function.
57  * AbstractColumn defines all access functions for all supported data
58  * types but only those corresponding to the return value of columnMode()
59  * will return a meaningful value. Calling functions not belonging to
60  * the data type of the column is safe, but will do nothing (writing
61  * function) or return some default value (reading functions).
62  *
63  * This class also defines all signals which indicate a data change.
64  * Any class whose output values are subject to change over time must emit
65  * the according signals. These signals notify any object working with the
66  * column before and after a change of the column.
67  * In some cases it will be necessary for a class using
68  * the column to connect aboutToBeDestroyed(), to react
69  * to a column's deletion, e.g. a filter's reaction to a
70  * table deletion.
71  *
72  * All writing functions have a "do nothing" standard implementation to
73  * make deriving a read-only class very easy without bothering about the
74  * writing interface.
75  */
76 
77 /**
78  * \brief Ctor
79  *
80  * \param name the column name (= aspect name)
81  */
83  : AbstractAspect(name, type), d( new AbstractColumnPrivate(this) ) {
84 }
85 
87  emit aboutToBeDestroyed(this);
88  delete d;
89 }
90 
92  static const QStringList dates{"yyyy-MM-dd", "yyyy/MM/dd", "dd/MM/yyyy",
93  "dd/MM/yy", "dd.MM.yyyy", "dd.MM.yy", "MM/yyyy", "dd.MM.", "yyyyMMdd"};
94 
95  return dates;
96 }
97 
99  static const QStringList times{"hh", "hh ap", "hh:mm", "hh:mm ap",
100  "hh:mm:ss", "hh:mm:ss.zzz", "hh:mm:ss:zzz", "mm:ss.zzz", "hhmmss"};
101 
102  return times;
103 }
104 
106  // any combination of date and times
107  QStringList dateTimes = dateFormats();
108  for (const auto& t : timeFormats())
109  dateTimes << t;
110  for (const auto& d : dateFormats())
111  for (const auto& t : timeFormats())
112  dateTimes << d + ' ' + t;
113 
114  return dateTimes;
115 }
116 
117 /**
118  * \brief Convenience method for mode-dependent icon
119  */
121  switch (mode) {
122  case ColumnMode::Numeric:
123  case ColumnMode::Integer:
124  case ColumnMode::BigInt:
125  break;
126  case ColumnMode::Text:
127  return QIcon::fromTheme("draw-text");
129  case ColumnMode::Month:
130  case ColumnMode::Day:
131  return QIcon::fromTheme("chronometer");
132  }
133 
134  return QIcon::fromTheme("x-shape-text");
135 }
136 
137 /**
138  * \fn bool AbstractColumn::isReadOnly() const
139  * \brief Return whether the object is read-only
140  */
141 
142 /**
143  * \fn AbstractColumn::ColumnMode AbstractColumn::columnMode() const
144  * \brief Return the column mode
145  *
146  * This function is most used by tables but can also be used
147  * by plots. The column mode specifies how to interpret
148  * the values in the column additional to the data type.
149  */
150 
151 /**
152  * \brief Set the column mode
153  *
154  * This sets the column mode and, if
155  * necessary, converts it to another datatype.
156  */
158 
159 /**
160  * \brief Copy another column of the same type
161  *
162  * This function will return false if the data type
163  * of 'other' is not the same as the type of 'this'.
164  * Use a filter to convert a column to another type.
165  */
167  Q_UNUSED(other)
168  return false;
169 }
170 
171 /**
172  * \brief Copies part of another column of the same type
173  *
174  * This function will return false if the data type
175  * of 'other' is not the same as the type of 'this'.
176  * \param source pointer to the column to copy
177  * \param source_start first row to copy in the column to copy
178  * \param destination_start first row to copy in
179  * \param num_rows the number of rows to copy
180  */
181 bool AbstractColumn::copy(const AbstractColumn *source, int source_start, int destination_start, int num_rows) {
182  Q_UNUSED(source)
183  Q_UNUSED(source_start)
184  Q_UNUSED(destination_start)
185  Q_UNUSED(num_rows)
186  return false;
187 }
188 
189 /**
190  * \fn int AbstractColumn::rowCount() const
191  * \brief Return the data vector size
192  */
193 
194 /**
195  * \fn int AbstractColumn::availableRowCount() const
196  * \brief Return the number of available data rows
197  */
198 
199 /**
200  * \brief Insert some empty (or initialized with invalid values) rows
201  */
202 void AbstractColumn::insertRows(int before, int count) {
203  beginMacro( i18np("%1: insert 1 row", "%1: insert %2 rows", name(), count) );
204  exec(new SignallingUndoCommand("pre-signal", this, "rowsAboutToBeInserted", "rowsRemoved",
205  Q_ARG(const AbstractColumn*,this), Q_ARG(int,before), Q_ARG(int,count)));
206 
207  handleRowInsertion(before, count);
208 
209  exec(new SignallingUndoCommand("post-signal", this, "rowsInserted", "rowsAboutToBeRemoved",
210  Q_ARG(const AbstractColumn*,this), Q_ARG(int,before), Q_ARG(int,count)));
211  endMacro();
212 }
213 
214 void AbstractColumn::handleRowInsertion(int before, int count) {
215  exec(new AbstractColumnInsertRowsCmd(this, before, count));
216 }
217 
218 /**
219  * \brief Remove 'count' rows starting from row 'first'
220  */
221 void AbstractColumn::removeRows(int first, int count) {
222  beginMacro( i18np("%1: remove 1 row", "%1: remove %2 rows", name(), count) );
223  exec(new SignallingUndoCommand("change signal", this, "rowsAboutToBeRemoved", "rowsInserted",
224  Q_ARG(const AbstractColumn*,this), Q_ARG(int,first), Q_ARG(int,count)));
225 
226  handleRowRemoval(first, count);
227 
228  exec(new SignallingUndoCommand("change signal", this, "rowsRemoved", "rowsAboutToBeInserted",
229  Q_ARG(const AbstractColumn*,this), Q_ARG(int,first), Q_ARG(int,count)));
230  endMacro();
231 }
232 
233 void AbstractColumn::handleRowRemoval(int first, int count) {
234  exec(new AbstractColumnRemoveRowsCmd(this, first, count));
235 }
236 
237 /**
238  * \fn AbstractColumn::PlotDesignation AbstractColumn::plotDesignation() const
239  * \brief Return the column plot designation
240  */
241 
242 /**
243  * \brief Set the column plot designation
244  */
246  Q_UNUSED(pd)
247 }
248 
250  const auto mode = columnMode();
252 }
253 
255  const auto mode = columnMode();
257 }
258 
259 /**
260  * \brief Clear the whole column
261  */
263 
264 /**
265  * \brief Convenience method for mode-independent testing of validity
266  */
267 bool AbstractColumn::isValid(int row) const {
268  switch (columnMode()) {
269  case ColumnMode::Numeric:
270  return !(std::isnan(valueAt(row)) || std::isinf(valueAt(row)));
271  case ColumnMode::Integer: // there is no invalid integer
272  case ColumnMode::BigInt:
273  return true;
274  case ColumnMode::Text:
275  return !textAt(row).isNull();
277  case ColumnMode::Month:
278  case ColumnMode::Day:
279  return dateTimeAt(row).isValid();
280  }
281 
282  return false;
283 }
284 
285 ////////////////////////////////////////////////////////////////////////////////////////////////////
286 //! \name IntervalAttribute related functions
287 //@{
288 ////////////////////////////////////////////////////////////////////////////////////////////////////
289 
290 /**
291  * \brief Return whether a certain row is masked
292  */
293 bool AbstractColumn::isMasked(int row) const {
294  return d->m_masking.isSet(row);
295 }
296 
297 /**
298  * \brief Return whether a certain interval of rows is fully masked
299  */
301  return d->m_masking.isSet(i);
302 }
303 
304 /**
305  * \brief Return all intervals of masked rows
306  */
308  return d->m_masking.intervals();
309 }
310 
311 /**
312  * \brief Clear all masking information
313  */
316  "maskingAboutToChange", "maskingChanged", Q_ARG(const AbstractColumn*,this));
317 }
318 
319 /**
320  * \brief Set an interval masked
321  *
322  * \param i the interval
323  * \param mask true: mask, false: unmask
324  */
325 void AbstractColumn::setMasked(const Interval<int>& i, bool mask) {
326  exec(new AbstractColumnSetMaskedCmd(d, i, mask),
327  "maskingAboutToChange", "maskingChanged", Q_ARG(const AbstractColumn*,this));
328 }
329 
330 /**
331  * \brief Overloaded function for convenience
332  */
333 void AbstractColumn::setMasked(int row, bool mask) {
334  setMasked(Interval<int>(row,row), mask);
335 }
336 
337 ////////////////////////////////////////////////////////////////////////////////////////////////////
338 //@}
339 ////////////////////////////////////////////////////////////////////////////////////////////////////
340 
341 ////////////////////////////////////////////////////////////////////////////////////////////////////
342 //! \name Formula related functions
343 //@{
344 ////////////////////////////////////////////////////////////////////////////////////////////////////
345 
346 /**
347  * \brief Return the formula associated with row 'row'
348  */
349 QString AbstractColumn::formula(int row) const {
350  Q_UNUSED(row);
351  return QString();
352 }
353 
354 /**
355  * \brief Return the intervals that have associated formulas
356  *
357  * This can be used to make a list of formulas with their intervals.
358  * Here is some example code:
359  *
360  * \code
361  * QStringList list;
362  * QVector< Interval<int> > intervals = my_column.formulaIntervals();
363  * foreach(Interval<int> interval, intervals)
364  * list << QString(interval.toString() + ": " + my_column.formula(interval.start()));
365  * \endcode
366  */
368  return QVector< Interval<int> >();
369 }
370 
371 /**
372  * \brief Set a formula string for an interval of rows
373  */
374 void AbstractColumn::setFormula(const Interval<int>& i, const QString& formula) {
375  Q_UNUSED(i) Q_UNUSED(formula)
376 }
377 
378 /**
379  * \brief Overloaded function for convenience
380  */
381 void AbstractColumn::setFormula(int row, const QString& formula) {
382  Q_UNUSED(row) Q_UNUSED(formula)
383 }
384 
385 /**
386  * \brief Clear all formulas
387  */
389 
390 ////////////////////////////////////////////////////////////////////////////////////////////////////
391 //@}
392 ////////////////////////////////////////////////////////////////////////////////////////////////////
393 
394 ////////////////////////////////////////////////////////////////////////////////////////////////////
395 //! \name type specific functions
396 //@{
397 ////////////////////////////////////////////////////////////////////////////////////////////////////
398 
399 /**
400  * \brief Return the content of row 'row'.
401  *
402  * Use this only when columnMode() is Text
403  */
404 QString AbstractColumn::textAt(int row) const {
405  Q_UNUSED(row);
406  return QString();
407 }
408 
409 /**
410  * \brief Set the content of row 'row'
411  *
412  * Use this only when columnMode() is Text
413  */
414 void AbstractColumn::setTextAt(int row, const QString& new_value) {
415  Q_UNUSED(row) Q_UNUSED(new_value)
416 }
417 
418 /**
419  * \brief Replace a range of values
420  *
421  * Use this only when columnMode() is Text
422  */
423 void AbstractColumn::replaceTexts(int first, const QVector<QString>& new_values) {
424  Q_UNUSED(first) Q_UNUSED(new_values)
425 };
426 
427 /**
428  * \brief Return the date part of row 'row'
429  *
430  * Use this only when columnMode() is DateTime, Month or Day
431  */
432 QDate AbstractColumn::dateAt(int row) const {
433  Q_UNUSED(row);
434  return QDate{};
435 }
436 
437 /**
438  * \brief Set the content of row 'row'
439  *
440  * Use this only when columnMode() is DateTime, Month or Day
441  */
442 void AbstractColumn::setDateAt(int row, QDate new_value) {
443  Q_UNUSED(row) Q_UNUSED(new_value)
444 };
445 
446 /**
447  * \brief Return the time part of row 'row'
448  *
449  * Use this only when columnMode() is DateTime, Month or Day
450  */
451 QTime AbstractColumn::timeAt(int row) const {
452  Q_UNUSED(row);
453  return QTime{};
454 }
455 
456 /**
457  * \brief Set the content of row 'row'
458  *
459  * Use this only when columnMode() is DateTime, Month or Day
460  */
461 void AbstractColumn::setTimeAt(int row, QTime new_value) {
462  Q_UNUSED(row) Q_UNUSED(new_value)
463 }
464 
465 /**
466  * \brief Return the QDateTime in row 'row'
467  *
468  * Use this only when columnMode() is DateTime, Month or Day
469  */
470 QDateTime AbstractColumn::dateTimeAt(int row) const {
471  Q_UNUSED(row);
472  return QDateTime();
473 }
474 
475 /**
476  * \brief Set the content of row 'row'
477  *
478  * Use this only when columnMode() is DateTime, Month or Day
479  */
480 void AbstractColumn::setDateTimeAt(int row, const QDateTime& new_value) {
481  Q_UNUSED(row) Q_UNUSED(new_value)
482 };
483 
484 /**
485  * \brief Replace a range of values
486  *
487  * Use this only when columnMode() is DateTime, Month or Day
488  */
489 void AbstractColumn::replaceDateTimes(int first, const QVector<QDateTime>& new_values) {
490  Q_UNUSED(first) Q_UNUSED(new_values)
491 };
492 
493 /**
494  * \brief Return the double value in row 'row'
495  *
496  * Use this only when columnMode() is Numeric
497  */
498 double AbstractColumn::valueAt(int row) const {
499  Q_UNUSED(row);
500  return NAN;
501 }
502 
503 /**
504  * \brief Set the content of row 'row'
505  *
506  * Use this only when columnMode() is Numeric
507  */
508 void AbstractColumn::setValueAt(int row, const double new_value) {
509  Q_UNUSED(row) Q_UNUSED(new_value)
510 };
511 
512 /**
513  * \brief Replace a range of values
514  *
515  * Use this only when columnMode() is Numeric
516  */
517 void AbstractColumn::replaceValues(int first, const QVector<double>& new_values) {
518  Q_UNUSED(first) Q_UNUSED(new_values)
519 }
520 
521 /**
522  * \brief Return the integer value in row 'row'
523  *
524  * Use this only when columnMode() is Integer
525  */
526 int AbstractColumn::integerAt(int row) const {
527  Q_UNUSED(row);
528  return 42;
529 }
530 
531 /**
532  * \brief Set the content of row 'row'
533  *
534  * Use this only when columnMode() is Integer
535  */
536 void AbstractColumn::setIntegerAt(int row, const int new_value) {
537  Q_UNUSED(row) Q_UNUSED(new_value)
538 };
539 
540 /**
541  * \brief Replace a range of values
542  *
543  * Use this only when columnMode() is Integer
544  */
545 void AbstractColumn::replaceInteger(int first, const QVector<int>& new_values) {
546  Q_UNUSED(first) Q_UNUSED(new_values)
547 }
548 
549 /**
550  * \brief Return the bigint value in row 'row'
551  *
552  * Use this only when columnMode() is BigInt
553  */
554 qint64 AbstractColumn::bigIntAt(int row) const {
555  Q_UNUSED(row);
556  return 42;
557 }
558 
559 /**
560  * \brief Set the content of row 'row'
561  *
562  * Use this only when columnMode() is BigInt
563  */
564 void AbstractColumn::setBigIntAt(int row, const qint64 new_value) {
565  Q_UNUSED(row) Q_UNUSED(new_value)
566 };
567 
568 /**
569  * \brief Replace a range of values
570  *
571  * Use this only when columnMode() is BigInt
572  */
573 void AbstractColumn::replaceBigInt(int first, const QVector<qint64>& new_values) {
574  Q_UNUSED(first) Q_UNUSED(new_values)
575 }
576 
577 /**
578  * Returns the properties hold by this column (no, constant, monotonic increasing, monotonic decreasing,...)
579  * Is used in XYCurve to improve the search velocity for the y value for a specific x value
580  */
583 }
584 
585 /**********************************************************************/
586 double AbstractColumn::minimum(int count) const {
587  Q_UNUSED(count);
588  return -INFINITY;
589 }
590 
591 double AbstractColumn::minimum(int startIndex, int endIndex) const {
592  Q_UNUSED(startIndex);
593  Q_UNUSED(endIndex);
594  return -INFINITY;
595 }
596 
597 double AbstractColumn::maximum(int count) const {
598  Q_UNUSED(count);
599  return INFINITY;
600 }
601 
602 double AbstractColumn::maximum(int startIndex, int endIndex) const {
603  Q_UNUSED(startIndex);
604  Q_UNUSED(endIndex);
605  return INFINITY;
606 }
607 
608 bool AbstractColumn::indicesMinMax(double v1, double v2, int& start, int& end) const {
609  Q_UNUSED(v1)
610  Q_UNUSED(v2)
611  Q_UNUSED(start)
612  Q_UNUSED(end)
613  return false;
614 }
615 
616 int AbstractColumn::indexForValue(double x) const {
617  Q_UNUSED(x)
618  return 0;
619 }
620 
621 ////////////////////////////////////////////////////////////////////////////////////////////////////
622 //@}
623 ////////////////////////////////////////////////////////////////////////////////////////////////////
624 
625 /**
626  * \fn void AbstractColumn::plotDesignationAboutToChange(const AbstractColumn *source)
627  * \brief Column plot designation will be changed
628  *
629  * 'source' is always the this pointer of the column that
630  * emitted this signal. This way it's easier to use
631  * one handler for lots of columns.
632  */
633 
634 /**
635  * \fn void AbstractColumn::plotDesignationChanged(const AbstractColumn *source)
636  * \brief Column plot designation changed
637  *
638  * 'source' is always the this pointer of the column that
639  * emitted this signal. This way it's easier to use
640  * one handler for lots of columns.
641  */
642 
643 /**
644  * \fn void AbstractColumn::modeAboutToChange(const AbstractColumn *source)
645  * \brief Column mode (possibly also the data type) will be changed
646  *
647  * 'source' is always the this pointer of the column that
648  * emitted this signal. This way it's easier to use
649  * one handler for lots of columns.
650  */
651 
652 /**
653  * \fn void AbstractColumn::modeChanged(const AbstractColumn *source)
654  * \brief Column mode (possibly also the data type) changed
655  *
656  * 'source' is always the this pointer of the column that
657  * emitted this signal. This way it's easier to use
658  * one handler for lots of columns.
659  */
660 
661 /**
662  * \fn void AbstractColumn::dataAboutToChange(const AbstractColumn *source)
663  * \brief Data of the column will be changed
664  *
665  * 'source' is always the this pointer of the column that
666  * emitted this signal. This way it's easier to use
667  * one handler for lots of columns.
668  */
669 
670 /**
671  * \fn void AbstractColumn::dataChanged(const AbstractColumn *source)
672  * \brief Data of the column has changed
673  *
674  * Important: When data has changed also the number
675  * of rows in the column may have changed without
676  * any other signal emission.
677  * 'source' is always the this pointer of the column that
678  * emitted this signal. This way it's easier to use
679  * one handler for lots of columns.
680  */
681 
682 /**
683  * \fn void AbstractColumn::rowsAboutToBeInserted(const AbstractColumn *source, int before, int count)
684  * \brief Rows will be inserted
685  *
686  * \param source the column that emitted the signal
687  * \param before the row to insert before
688  * \param count the number of rows to be inserted
689  */
690 
691 /**
692  * \fn void AbstractColumn::rowsInserted(const AbstractColumn *source, int before, int count)
693  * \brief Rows have been inserted
694  *
695  * \param source the column that emitted the signal
696  * \param before the row to insert before
697  * \param count the number of rows to be inserted
698  */
699 
700 /**
701  * \fn void AbstractColumn::rowsAboutToBeRemoved(const AbstractColumn *source, int first, int count)
702  * \brief Rows will be deleted
703  *
704  * \param source the column that emitted the signal
705  * \param first the first row to be deleted
706  * \param count the number of rows to be deleted
707  */
708 
709 /**
710  * \fn void AbstractColumn::rowsRemoved(const AbstractColumn *source, int first, int count)
711  * \brief Rows have been deleted
712  *
713  * \param source the column that emitted the signal
714  * \param first the first row that was deleted
715  * \param count the number of deleted rows
716  */
717 
718 /**
719  * \fn void AbstractColumn::maskingAboutToChange(const AbstractColumn *source)
720  * \brief Rows are about to be masked or unmasked
721  */
722 
723 /**
724  * \fn void AbstractColumn::maskingChanged(const AbstractColumn *source)
725  * \brief Rows have been masked or unmasked
726  */
727 
728 /**
729  * \fn void AbstractColumn::aboutToBeDestroyed(const AbstractColumn *source)
730  * \brief Emitted shortl before this column is deleted
731  *
732  * \param source the object emitting this signal
733  *
734  * This is needed by AbstractFilter.
735  */
736 
737 /**
738  * \brief Read XML mask element
739  */
741  Q_ASSERT(reader->isStartElement() && reader->name() == "mask");
742 
743  bool ok1, ok2;
744  int start, end;
745  start = reader->readAttributeInt("start_row", &ok1);
746  end = reader->readAttributeInt("end_row", &ok2);
747  if (!ok1 || !ok2) {
748  reader->raiseError(i18n("invalid or missing start or end row"));
749  return false;
750  }
751  setMasked(Interval<int>(start,end));
752  if (!reader->skipToEndElement()) return false;
753 
754  return true;
755 }
756 
757 /**
758  * \brief Write XML mask element
759  */
760 void AbstractColumn::XmlWriteMask(QXmlStreamWriter *writer) const {
761  for (const auto& interval : maskedIntervals()) {
762  writer->writeStartElement("mask");
763  writer->writeAttribute("start_row", QString::number(interval.start()));
764  writer->writeAttribute("end_row", QString::number(interval.end()));
765  writer->writeEndElement();
766  }
767 }
AspectType
Base class of all persistent objects in a Project.
QString name() const
void beginMacro(const QString &text)
Begin an undo stack macro (series of commands)
void exec(QUndoCommand *)
Execute the given command, pushing it on the undoStack() if available.
void endMacro()
End the current undo stack macro.
Private data class of AbstractColumn.
IntervalAttribute< bool > m_masking
Interface definition for data with column logic.
virtual void setFormula(const Interval< int > &i, const QString &formula)
Set a formula string for an interval of rows.
void insertRows(int before, int count)
Insert some empty (or initialized with invalid values) rows.
virtual void setTextAt(int row, const QString &new_value)
Set the content of row 'row'.
QVector< Interval< int > > maskedIntervals() const
Return all intervals of masked rows.
virtual void setTimeAt(int row, QTime new_value)
Set the content of row 'row'.
static QIcon iconForMode(ColumnMode mode)
Convenience method for mode-dependent icon.
bool isPlottable() const
virtual void setIntegerAt(int row, int new_value)
Set the content of row 'row'.
static QStringList timeFormats()
friend class AbstractColumnInsertRowsCmd
virtual double valueAt(int row) const
Return the double value in row 'row'.
AbstractColumnPrivate * d
virtual Properties properties() const
~AbstractColumn() override
bool isNumeric() const
virtual QString formula(int row) const
Return the formula associated with row 'row'.
virtual void setDateTimeAt(int row, const QDateTime &new_value)
Set the content of row 'row'.
virtual void replaceTexts(int first, const QVector< QString > &new_values)
Replace a range of values.
bool isMasked(int row) const
Return whether a certain row is masked.
AbstractColumn(const QString &name, AspectType type)
Ctor.
static QStringList dateFormats()
virtual void handleRowInsertion(int before, int count)
virtual void setDateAt(int row, QDate new_value)
Set the content of row 'row'.
virtual int indexForValue(double x) const
void removeRows(int first, int count)
Remove 'count' rows starting from row 'first'.
virtual QString textAt(int row) const
Return the content of row 'row'.
virtual void handleRowRemoval(int first, int count)
void setMasked(const Interval< int > &i, bool mask=true)
Set an interval masked.
friend class AbstractColumnRemoveRowsCmd
virtual QDate dateAt(int row) const
Return the date part of row 'row'.
virtual void replaceInteger(int first, const QVector< int > &new_values)
Replace a range of values.
virtual void setColumnMode(AbstractColumn::ColumnMode)
Set the column mode.
virtual void replaceBigInt(int first, const QVector< qint64 > &new_values)
Replace a range of values.
virtual void setPlotDesignation(AbstractColumn::PlotDesignation)
Set the column plot designation.
virtual void clearFormulas()
Clear all formulas.
virtual double maximum(int count=0) const
virtual void replaceValues(int first, const QVector< double > &new_values)
Replace a range of values.
virtual double minimum(int count=0) const
virtual QVector< Interval< int > > formulaIntervals() const
Return the intervals that have associated formulas.
virtual void setBigIntAt(int row, qint64 new_value)
Set the content of row 'row'.
virtual QDateTime dateTimeAt(int row) const
Return the QDateTime in row 'row'.
virtual qint64 bigIntAt(int row) const
Return the bigint value in row 'row'.
void XmlWriteMask(QXmlStreamWriter *) const
Write XML mask element.
virtual void replaceDateTimes(int first, const QVector< QDateTime > &new_values)
Replace a range of values.
bool isValid(int row) const
Convenience method for mode-independent testing of validity.
virtual void clear()
Clear the whole column.
friend class AbstractColumnSetMaskedCmd
virtual int integerAt(int row) const
Return the integer value in row 'row'.
virtual ColumnMode columnMode() const =0
Return the column mode.
bool XmlReadMask(XmlStreamReader *)
Read XML mask element.
friend class AbstractColumnClearMasksCmd
void clearMasks()
Clear all masking information.
virtual bool copy(const AbstractColumn *source)
Copy another column of the same type.
static QStringList dateTimeFormats()
virtual QTime timeAt(int row) const
Return the time part of row 'row'.
virtual bool indicesMinMax(double v1, double v2, int &start, int &end) const
void aboutToBeDestroyed(const AbstractColumn *source)
Emitted shortl before this column is deleted.
virtual void setValueAt(int row, double new_value)
Set the content of row 'row'.
QVector< Interval< int > > intervals() const
bool isSet(int row) const
Auxiliary class for interval based data.
Definition: Interval.h:212
An undo command calling a method/signal/slot on a QObject on redo/undo.
XML stream parser that supports errors as well as warnings. This class also adds line and column numb...
int readAttributeInt(const QString &name, bool *ok)
void raiseError(const QString &)
#define i18n(m)
Definition: nsl_common.h:38