15 #ifndef GUI_COREGUI_DATALOADERS_QREDATALOADER_H
16 #define GUI_COREGUI_DATALOADERS_QREDATALOADER_H
30 virtual QString
name()
const override;
35 virtual QByteArray
serialize()
const override;
36 virtual void deserialize(
const QByteArray& data)
override;
98 std::variant<int, double>
data;
112 QVector<QPair<bool, QString>>
lines;
120 QMap<int, ErrorDefinition>
Defines class AbstractDataLoader1D.
QDataStream & operator>>(QDataStream &stream, QREDataLoader::ImportSettings &s)
Base class for data loaders for 1D import.
Base class for result tables of data loaders.
Base class for all data loaders (classes which can import real data)
std::ostream & operator<<(std::ostream &os, const BasicVector3D< T > &a)
Output to stream.
Properties widget for the QREDataLoader.
The result model of a QREDataLoader (for showing the import results in a table view).
Real data loader for Q/R/E reflectometry CSV files.
virtual QByteArray fileContent() const override
Returns the original file content.
virtual QString persistentClassName() const override
A name which can be used for save/load purposes (which will not change ever more)
friend QDataStream & operator<<(QDataStream &stream, const QREDataLoader::ImportSettings &s)
virtual void guessSettings() override
Guess appropriate settings (for example the separator in a CSV file).
virtual int numLineRelatedErrors() const override
Number of errors related to a specific line.
virtual int numErrors() const override
Number of errors found while processing the content.
virtual void initWithDefaultImportSettings() override
Set import settings to defaults.
virtual void setFileContents(const QByteArray &fileContent) override
Sets the file contents to be imported.
virtual QByteArray serialize() const override
Returns every internal setting so it can be restored completely.
void calculateFromParseResult() const
virtual void deserialize(const QByteArray &data) override
Initialize from serialization data.
virtual void applyImportSettings() override
Read all values from the properties UI into the internal variables.
virtual AbstractDataLoader * clone() const override
Create a complete clone, including all internal states.
virtual AbstractDataLoaderResultModel * createResultModel() const override
Create a table model which contains the import information like original file content,...
virtual void populateImportSettingsWidget(QWidget *parent) override
Fills the widget on the import dialog pane.
virtual QStringList lineUnrelatedErrors() const override
Errors not related to a particular line.
virtual QString name() const override
The name shown in the format selection combo.
QPointer< QREDataLoaderProperties > m_propertiesWidget
struct QREDataLoader::ImportSettings m_importSettings
ImportResult m_importResult
void createOutputDataFromParsingResult(RealDataItem *item) const
void parseFileContent() const
virtual void processContents() override
Process the file contents.
friend QDataStream & operator>>(QDataStream &stream, QREDataLoader::ImportSettings &s)
The RealDataItem class represents intensity data imported from file and intended for fitting.
bool operator==(const ColumnDefinition &other) const
Contains a line related error (stored in the import result).
std::variant< int, double > data
Additional data; meaning depends on the error type (see implementation of toString() for more informa...
@ columnDoesNotContainValidNumber
ErrorDefinition(Type t=none, int d=0)
QString toString() const
Human readable error text.
Result of the file import.
QVector< double > rValues
index is 0-based line number
int maxColumnCount
max found columns in raw data
QString error
error unrelated to lines
void addError(int line, ErrorDefinition::Type type, int data=0)
void clearCalculatedValues()
int validCalculatedLines
number of valid resulting data rows
QVector< QVector< double > > rawValues
index is 0-based line number
QMap< int, ErrorDefinition > calculationErrors
calculation error per line; line is 0-based
QVector< double > eValues
index is 0-based line number
QString errorText(int line) const
ImportSettings importSettings
Settings used for the import.
QVector< double > qValues
index is 0-based line number
QVector< QPair< bool, QString > > lines
bool describes whether line is skipped index is 0-based line number
Settings for importing the file.
QString separator
column separator
QByteArray serialize() const
void deserialize(const QByteArray &data)
QMap< DataType, ColumnDefinition > columnDefinitions
QString headerPrefix
prefix denoting header line
bool operator!=(const ImportSettings &other) const
QString linesToSkip
pattern denoting line to skip (i.e. '1,10-12,42')