File indexing completed on 2024-05-12 03:47:01

0001 /*
0002     File                 : OriginFile.h
0003     Description          : Origin file import class
0004     --------------------------------------------------------------------
0005     SPDX-FileCopyrightText: 2005-2007 Stefan Gerlach
0006     SPDX-FileCopyrightText: 2007-2008 Alex Kargovsky <kargovsky*yumr.phys.msu.su>
0007     SPDX-FileCopyrightText: 2007-2008 Ion Vasilief <ion_vasilief*yahoo.fr>
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 
0011 #ifndef ORIGIN_FILE_H
0012 #define ORIGIN_FILE_H
0013 
0014 #include "OriginObj.h"
0015 #include "OriginParser.h"
0016 
0017 #include <memory>
0018 
0019 class ORIGIN_EXPORT OriginFile
0020 {
0021 public:
0022     explicit OriginFile(const std::string &fileName);
0023 
0024     bool parse(); //!< parse Origin file
0025     double version() const; //!< get version of Origin file
0026 
0027     std::vector<Origin::SpreadColumn>::size_type datasetCount() const; //!< get number of datasets
0028     Origin::SpreadColumn &
0029     dataset(std::vector<Origin::SpreadColumn>::size_type ds) const; //!< get dataset ds
0030 
0031     std::vector<Origin::SpreadSheet>::size_type spreadCount() const; //!< get number of spreadsheets
0032     Origin::SpreadSheet &
0033     spread(std::vector<Origin::SpreadSheet>::size_type s) const; //!< get spreadsheet s
0034 
0035     std::vector<Origin::Matrix>::size_type matrixCount() const; //!< get number of matrices
0036     Origin::Matrix &matrix(std::vector<Origin::Matrix>::size_type m) const; //!< get matrix m
0037 
0038     std::vector<Origin::Function>::size_type functionCount() const; //!< get number of functions
0039     std::vector<Origin::Function>::difference_type
0040     functionIndex(const std::string &name) const; //!< get index (or -1) of function named name
0041     Origin::Function &
0042     function(std::vector<Origin::Function>::size_type f) const; //!< get function f
0043 
0044     std::vector<Origin::Graph>::size_type graphCount() const; //!< get number of graphs
0045     Origin::Graph &graph(std::vector<Origin::Graph>::size_type g) const; //!< get graph g
0046 
0047     std::vector<Origin::Note>::size_type noteCount() const; //!< get number of notes
0048     Origin::Note &note(std::vector<Origin::Note>::size_type n) const; //!< get note n
0049 
0050     std::vector<Origin::Excel>::size_type excelCount() const; //!< get number of excels
0051     Origin::Excel &excel(std::vector<Origin::Excel>::size_type e) const; //!< get excel e
0052 
0053     const tree<Origin::ProjectNode> *project() const; //!< get project tree
0054     std::string resultsLogString() const; //!< get Results Log
0055 
0056 private:
0057     unsigned int fileVersion, buildVersion, ioError;
0058     std::unique_ptr<OriginParser> parser;
0059 };
0060 
0061 std::string ORIGIN_EXPORT liboriginVersionString();
0062 unsigned int ORIGIN_EXPORT liboriginVersion();
0063 unsigned int ORIGIN_EXPORT liboriginVersionMajor();
0064 unsigned int ORIGIN_EXPORT liboriginVersionMinor();
0065 unsigned int ORIGIN_EXPORT liboriginVersionBugfix();
0066 
0067 #endif // ORIGIN_FILE_H