BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
parserinterface.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file gui2/dataloader/parserinterface.h
6 //! @brief Defines class CLASS?
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2020
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI2_DATALOADER_PARSERINTERFACE_H
16 #define BORNAGAIN_GUI2_DATALOADER_PARSERINTERFACE_H
17 
18 #include "darefl_export.h"
19 #include <string>
20 #include <vector>
21 
22 namespace gui2 {
23 
24 //! Interface for all classes capable of parsing ASCII data into multicolumn presentation.
25 
26 class DAREFLCORE_EXPORT ParserInterface { // #import Here is where the data gets parsed
27 public:
28  virtual ~ParserInterface() = default;
29 
30  //! Parse data representing content of ASCII file.
31  virtual void process(const std::vector<std::string>& raw_data) = 0;
32 
33  //! Returns total number of lines in raw data.
34  virtual size_t totalLineCount() const = 0;
35 
36  //! Returns original line.
37  virtual std::string getLine(size_t index) const = 0;
38 
39  //! Returns parsed text for given line index. If line was skipped during parsing, returns empty
40  //! vector.
41  virtual std::vector<std::string> parseResults(size_t index) const = 0;
42 
43  //! Returns 2D vector representing parsed text. Skipped lines are not present.
44  virtual std::vector<std::vector<std::string>> parsedData() const = 0;
45 };
46 
47 } // namespace gui2
48 
49 #endif // BORNAGAIN_GUI2_DATALOADER_PARSERINTERFACE_H
Interface for all classes capable of parsing ASCII data into multicolumn presentation.
virtual std::vector< std::string > parseResults(size_t index) const =0
Returns parsed text for given line index.
virtual std::string getLine(size_t index) const =0
Returns original line.
virtual void process(const std::vector< std::string > &raw_data)=0
Parse data representing content of ASCII file.
virtual std::vector< std::vector< std::string > > parsedData() const =0
Returns 2D vector representing parsed text. Skipped lines are not present.
virtual ~ParserInterface()=default
virtual size_t totalLineCount() const =0
Returns total number of lines in raw data.
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.
Definition: app_constants.h:20