File indexing completed on 2024-04-21 14:47:33

0001 /***************************************************************************
0002     File                 : OriginFile.h
0003     --------------------------------------------------------------------
0004     Copyright            : (C) 2005-2007 Stefan Gerlach
0005                            (C) 2007-2008 Alex Kargovsky, Ion Vasilief
0006     Email (use @ for *)  : kargovsky*yumr.phys.msu.su, ion_vasilief*yahoo.fr
0007     Description          : Origin file import class
0008 
0009  ***************************************************************************/
0010 
0011 /***************************************************************************
0012  *                                                                         *
0013  *  This program is free software; you can redistribute it and/or modify   *
0014  *  it under the terms of the GNU General Public License as published by   *
0015  *  the Free Software Foundation; either version 2 of the License, or      *
0016  *  (at your option) any later version.                                    *
0017  *                                                                         *
0018  *  This program is distributed in the hope that it will be useful,        *
0019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
0020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
0021  *  GNU General Public License for more details.                           *
0022  *                                                                         *
0023  *   You should have received a copy of the GNU General Public License     *
0024  *   along with this program; if not, write to the Free Software           *
0025  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
0026  *   Boston, MA  02110-1301  USA                                           *
0027  *                                                                         *
0028  ***************************************************************************/
0029 
0030 #ifndef ORIGIN_FILE_H
0031 #define ORIGIN_FILE_H
0032 
0033 #include "OriginObj.h"
0034 #include "OriginParser.h"
0035 #include <memory>
0036 
0037 using namespace std;
0038 
0039 class OriginFile
0040 {
0041 public:
0042     explicit OriginFile(const string& fileName);
0043 
0044     bool parse();                                                                       //!< parse Origin file
0045     double version() const;                                                             //!< get version of Origin file
0046 
0047     vector<Origin::SpreadColumn>::size_type datasetCount() const;                       //!< get number of datasets
0048     Origin::SpreadColumn& dataset(vector<Origin::SpreadColumn>::size_type ds) const;    //!< get dataset ds
0049 
0050     vector<Origin::SpreadSheet>::size_type spreadCount() const;                         //!< get number of spreadsheets
0051     Origin::SpreadSheet& spread(vector<Origin::SpreadSheet>::size_type s) const;        //!< get spreadsheet s
0052 
0053     vector<Origin::Matrix>::size_type matrixCount() const;                              //!< get number of matrices
0054     Origin::Matrix& matrix(vector<Origin::Matrix>::size_type m) const;                  //!< get matrix m
0055 
0056     vector<Origin::Function>::size_type functionCount() const;                          //!< get number of functions
0057     vector<Origin::Function>::difference_type functionIndex(const string& name) const;  //!< get index (or -1) of function named name
0058     Origin::Function& function(vector<Origin::Function>::size_type f) const;            //!< get function f
0059 
0060     vector<Origin::Graph>::size_type graphCount() const;                                //!< get number of graphs
0061     Origin::Graph& graph(vector<Origin::Graph>::size_type g) const;                     //!< get graph g
0062 
0063     vector<Origin::Note>::size_type noteCount() const;                                  //!< get number of notes
0064     Origin::Note& note(vector<Origin::Note>::size_type n) const;                        //!< get note n
0065 
0066     vector<Origin::Excel>::size_type excelCount() const;                                //!< get number of excels
0067     Origin::Excel& excel(vector<Origin::Excel>::size_type e) const;                     //!< get excel e
0068 
0069     const tree<Origin::ProjectNode>* project() const;                                   //!< get project tree
0070     string resultsLogString() const;                                                    //!< get Results Log
0071 
0072 private:
0073     unsigned int fileVersion, buildVersion, ioError;
0074     unique_ptr<OriginParser> parser;
0075 };
0076 
0077 string liboriginVersionString();
0078 unsigned int liboriginVersion();
0079 unsigned int liboriginVersionMajor();
0080 unsigned int liboriginVersionMinor();
0081 unsigned int liboriginVersionBugfix();
0082 
0083 #endif // ORIGIN_FILE_H