File indexing completed on 2024-12-22 03:35:46

0001 /*
0002     File                 : MatioFilterPrivate.h
0003     Project              : LabPlot
0004     Description          : Private implementation class for MatioFilter.
0005     --------------------------------------------------------------------
0006     SPDX-FileCopyrightText: 2021 Stefan Gerlach <stefan.gerlach@uni.kn>
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 #ifndef MATIOFILTERPRIVATE_H
0011 #define MATIOFILTERPRIVATE_H
0012 
0013 #ifdef HAVE_MATIO
0014 #include <matio.h>
0015 #endif
0016 
0017 class AbstractDataSource;
0018 
0019 class MatioFilterPrivate {
0020 public:
0021     explicit MatioFilterPrivate(MatioFilter*);
0022 
0023     void parse(const QString& fileName);
0024     void readDataFromFile(const QString& fileName, AbstractDataSource* = nullptr, AbstractFileFilter::ImportMode = AbstractFileFilter::ImportMode::Replace);
0025     QVector<QStringList> readCurrentVar(const QString& fileName,
0026                                         AbstractDataSource* = nullptr,
0027                                         AbstractFileFilter::ImportMode = AbstractFileFilter::ImportMode::Replace,
0028                                         size_t lines = 0);
0029     void write(const QString& fileName, AbstractDataSource*);
0030 
0031 // helper functions
0032 #ifdef HAVE_MATIO
0033     static QString className(matio_classes classType);
0034     static QString typeName(matio_types dataType);
0035     static AbstractColumn::ColumnMode classMode(matio_classes classType);
0036     static AbstractColumn::ColumnMode typeMode(matio_types dataType);
0037 #endif
0038 
0039     size_t varCount{0};
0040     QString currentVarName;
0041     QStringList selectedVarNames;
0042     QVector<QStringList> varsInfo;
0043     int startRow{1};
0044     int endRow{-1};
0045     int startColumn{1};
0046     int endColumn{-1};
0047 
0048 private:
0049 #ifdef HAVE_MATIO
0050     mat_t* matfp{nullptr};
0051 #endif
0052 };
0053 
0054 #endif