File indexing completed on 2024-05-12 03:47:42

0001 /*
0002     File            : AbstractDataSource.cpp
0003     Project         : LabPlot
0004     Description     : Abstract interface for data sources
0005     --------------------------------------------------------------------
0006     SPDX-FileCopyrightText: 2009-2023 Alexander Semke <alexander.semke@web.de>
0007     SPDX-FileCopyrightText: 2015 Stefan Gerlach <stefan.gerlach@uni.kn>
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 #include "AbstractDataSource.h"
0011 #include "backend/core/column/Column.h"
0012 #include "backend/matrix/Matrix.h"
0013 #include "backend/spreadsheet/Spreadsheet.h"
0014 
0015 /*!
0016 \class AbstractDataSource
0017 \brief Interface for the data sources.
0018 
0019 \ingroup datasources
0020 */
0021 
0022 AbstractDataSource::AbstractDataSource(const QString& name, AspectType type)
0023     : AbstractPart(name, type) {
0024 }
0025 
0026 void AbstractDataSource::clear() {
0027     const auto& columns = children<Column>();
0028     for (auto* column : columns) {
0029         column->setUndoAware(false);
0030         column->setSuppressDataChangedSignal(true);
0031         column->clear();
0032         column->setUndoAware(true);
0033         column->setSuppressDataChangedSignal(false);
0034         column->setChanged();
0035     }
0036 }