15 #ifndef BORNAGAIN_GUI_VIEW_LOADERS_QREDATALOADER_H
16 #define BORNAGAIN_GUI_VIEW_LOADERS_QREDATALOADER_H
32 QString
name()
const override;
101 std::variant<int, double>
data;
115 QVector<QPair<bool, QString>>
lines;
123 QMap<int, ErrorDefinition>
Defines class AbstractDataLoader1D.
QDataStream & operator<<(QDataStream &stream, const QREDataLoader::ImportSettings &s)
QDataStream & operator>>(QDataStream &stream, QREDataLoader::ImportSettings &s)
Abstract base class for reflectometry data loaders.
Base class for result tables of data loaders. Derive from this class and return an instance in YourDa...
Abstract base class for all data loaders (classes to import real data).
Properties widget for the QREDataLoader.
The result model of a QREDataLoader (for showing the import results in a table view).
Loader for experimental reflectometry CSV files that contain three columns with Q,...
QByteArray fileContent() const override
Returns the original file content. If not available any more (like for legacy project file import),...
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)
void guessSettings() override
Guess appropriate settings (for example the separator in a CSV file). Is called only once,...
int numLineRelatedErrors() const override
Number of errors related to a specific line. Such an error means that a particular content (line) can...
int numErrors() const override
Number of errors found while processing the content. An error means that either a particular content ...
void initWithDefaultImportSettings() override
Set import settings to defaults.
void setFileContents(const QByteArray &fileContent) override
Sets the file contents to be imported. If the file was a compressed file, then the decompressed conte...
QByteArray serialize() const override
Returns every internal setting so it can be restored completely.
void calculateFromParseResult() const
void deserialize(const QByteArray &data) override
Initialize from serialization data. If any error occurred, then a DeserializationException has to be ...
void applyImportSettings() override
Read all values from the properties UI into the internal variables.
AbstractDataLoader * clone() const override
Create a complete clone, including all internal states.
AbstractDataLoaderResultModel * createResultModel() const override
Create a table model which contains the import information like original file content,...
void datafieldFromParsingResult(RealDataItem *item) const
void populateImportSettingsWidget(QWidget *parent) override
Fills the widget on the import dialog pane. The implementation here in the base class does nothing (m...
QStringList lineUnrelatedErrors() const override
Errors not related to a particular line.
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 parseFileContent() const
void processContents() override
Process the file contents. Can be called more than once, e.g. if the import settings have changed....
friend QDataStream & operator>>(QDataStream &stream, QREDataLoader::ImportSettings &s)
Provides access to experimental data, for display and fitting. Owns an AbstractDataLoader.
UnitInFile unit
the unit of the data in the file
double factor
in case the raw data shall be multiplied
bool enabled
shall data type be used
bool operator==(const ColumnDefinition &other) const
int column
read the value from this raw column
Contains a line related error (stored in the import result). Used for showing line related errors in ...
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. Some of the contained data is only relevant for showing the results in the...
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)
bool allowValuesGreaterOne
always true for now (see ##94); could be made configurable later on
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')