BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
UserDefinedDataLoader1D.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/DataLoaders/UserDefinedDataLoader1D.h
6 //! @brief Defines class UserDefinedDataLoader1D
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2021
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef GUI_COREGUI_DATALOADERS_USERDEFINEDDATALOADER1D_H
16 #define GUI_COREGUI_DATALOADERS_USERDEFINEDDATALOADER1D_H
17 
19 
20 //! A user defined data loader. This is a thin wrapper around the real loader implementation,
21 //! storing the relevant settings to make it user definable (namely name and import settings).
22 
24 public:
25  UserDefinedDataLoader1D(AbstractDataLoader1D* wrappedLoader, const QString& name,
26  const QByteArray& defaultProperties);
27 
28  virtual QString name() const override;
29  virtual void populateImportSettingsWidget(QWidget* parent) override;
30  virtual void initWithDefaultImportSettings() override;
31  virtual QString persistentClassName() const override;
32  virtual QByteArray serialize() const override;
33  virtual void deserialize(const QByteArray& data) override;
34  virtual AbstractDataLoader* clone() const override;
35  virtual void setFileContents(const QByteArray& fileContent) override;
36  virtual void guessSettings() override;
37  virtual void processContents() override;
38 
39  // #baUserDefLoaders ++ implement all overloads!
40 private:
41  QString m_name;
43  QByteArray m_defaultProperties;
44 };
45 
46 #endif // GUI_COREGUI_DATALOADERS_USERDEFINEDDATALOADER1D_H
Defines class AbstractDataLoader1D.
Base class for data loaders for 1D import.
Base class for all data loaders (classes which can import real data)
virtual QByteArray fileContent() const
Returns the original file content.
A user defined data loader.
virtual void populateImportSettingsWidget(QWidget *parent) override
Fills the widget on the import dialog pane.
virtual AbstractDataLoader * clone() const override
Create a complete clone, including all internal states.
UserDefinedDataLoader1D(AbstractDataLoader1D *wrappedLoader, const QString &name, const QByteArray &defaultProperties)
virtual void guessSettings() override
Guess appropriate settings (for example the separator in a CSV file).
virtual QString persistentClassName() const override
A name which can be used for save/load purposes (which will not change ever more)
virtual void deserialize(const QByteArray &data) override
Initialize from serialization data.
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.
AbstractDataLoader1D * m_wrappedLoader
virtual void processContents() override
Process the file contents.
virtual void initWithDefaultImportSettings() override
Set import settings to defaults.
virtual QString name() const override
The name shown in the format selection combo.