liborigin 2.0.0

/tmp/slackdce/slackrepo.5NA6jZ/build_liborigin/liborigin/OriginParser.h
Go to the documentation of this file.
1/***************************************************************************
2 File : OriginParser.h
3 --------------------------------------------------------------------
4 Copyright : (C) 2008 Alex Kargovsky
5 Email (use @ for *) : kargovsky*yumr.phys.msu.su
6 Description : Origin file parser base class
7
8 ***************************************************************************/
9
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 * This program is distributed in the hope that it will be useful, *
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
20 * GNU General Public License for more details. *
21 * *
22 * You should have received a copy of the GNU General Public License *
23 * along with this program; if not, write to the Free Software *
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
25 * Boston, MA 02110-1301 USA *
26 * *
27 ***************************************************************************/
28
29#ifndef ORIGIN_PARSER_H
30#define ORIGIN_PARSER_H
31
32#include "OriginObj.h"
33#include "tree.hh"
34
35#ifndef NO_CODE_GENERATION_FOR_LOG
36#define LOG_PRINT( logfile, args... ) \
37{ \
38 int ioret= fprintf(logfile, args); \
39 assert(ioret>0); \
40}
41#else // !NO_CODE_GENERATION_FOR_LOG
42#define LOG_PRINT( logfile, args... ) {};
43#endif // NO_CODE_GENERATION_FOR_LOG
44
45 class OriginParser
46{
47 public:
48 virtual ~OriginParser() {};
49 virtual bool parse() = 0;
50 void setFileVersion(unsigned int version){fileVersion = version;};
51
52 vector<Origin::SpreadSheet>::difference_type findSpreadByName(const string& name) const;
53 vector<Origin::Matrix>::difference_type findMatrixByName(const string& name) const;
54 vector<Origin::Function>::difference_type findFunctionByName(const string& name) const;
55 vector<Origin::Excel>::difference_type findExcelByName(const string& name) const;
56
57 protected:
58 vector<Origin::SpreadColumn>::difference_type findSpreadColumnByName(vector<Origin::SpreadSheet>::size_type spread, const string& name) const;
59 vector<Origin::SpreadColumn>::difference_type findExcelColumnByName(vector<Origin::Excel>::size_type excel, vector<Origin::SpreadSheet>::size_type sheet, const string& name) const;
60 pair<string, string> findDataByIndex(unsigned int index) const;
61 pair<Origin::ProjectNode::NodeType, string> findObjectByIndex(unsigned int index) const;
62 void convertSpreadToExcel(vector<Origin::SpreadSheet>::size_type spread);
63
64 int findColumnByName(int spread, const string& name);
65
66 public:
67 vector<Origin::SpreadSheet> speadSheets;
68 vector<Origin::Matrix> matrixes;
69 vector<Origin::Excel> excels;
70 vector<Origin::Function> functions;
71 vector<Origin::Graph> graphs;
72 vector<Origin::Note> notes;
73 tree<Origin::ProjectNode> projectTree;
74 string resultsLog;
75 unsigned int windowsCount;
76 unsigned int fileVersion;
77};
78
79 OriginParser* createOriginDefaultParser(const string& fileName);
80 OriginParser* createOrigin600Parser(const string& fileName);
81 OriginParser* createOrigin610Parser(const string& fileName);
82 OriginParser* createOrigin700Parser(const string& fileName);
83 OriginParser* createOrigin750Parser(const string& fileName);
84 OriginParser* createOrigin800Parser(const string& fileName);
85 OriginParser* createOrigin810Parser(const string& fileName);
86
87#endif // ORIGIN_PARSER_H
OriginObj.h
createOrigin810Parser
OriginParser * createOrigin810Parser(const string &fileName)
Definition: Origin810Parser.cpp:148
createOrigin600Parser
OriginParser * createOrigin600Parser(const string &fileName)
Definition: Origin600Parser.cpp:37
createOrigin800Parser
OriginParser * createOrigin800Parser(const string &fileName)
Definition: Origin800Parser.cpp:2004
createOrigin750Parser
OriginParser * createOrigin750Parser(const string &fileName)
Definition: Origin750Parser.cpp:2489
createOriginDefaultParser
OriginParser * createOriginDefaultParser(const string &fileName)
Definition: OriginDefaultParser.cpp:469
createOrigin700Parser
OriginParser * createOrigin700Parser(const string &fileName)
Definition: Origin700Parser.cpp:1448
createOrigin610Parser
OriginParser * createOrigin610Parser(const string &fileName)
Definition: Origin610Parser.cpp:1871
OriginParser
Definition: OriginParser.h:46
OriginParser::findExcelByName
vector< Origin::Excel >::difference_type findExcelByName(const string &name) const
Definition: OriginParser.cpp:46
OriginParser::findMatrixByName
vector< Origin::Matrix >::difference_type findMatrixByName(const string &name) const
Definition: OriginParser.cpp:73
OriginParser::notes
vector< Origin::Note > notes
Definition: OriginParser.h:72
OriginParser::findObjectByIndex
pair< Origin::ProjectNode::NodeType, string > findObjectByIndex(unsigned int index) const
Definition: OriginParser.cpp:129
OriginParser::findSpreadColumnByName
vector< Origin::SpreadColumn >::difference_type findSpreadColumnByName(vector< Origin::SpreadSheet >::size_type spread, const string &name) const
Definition: OriginParser.cpp:55
OriginParser::graphs
vector< Origin::Graph > graphs
Definition: OriginParser.h:71
OriginParser::parse
virtual bool parse()=0
OriginParser::~OriginParser
virtual ~OriginParser()
Definition: OriginParser.h:48
OriginParser::fileVersion
unsigned int fileVersion
Definition: OriginParser.h:76
OriginParser::setFileVersion
void setFileVersion(unsigned int version)
Definition: OriginParser.h:50
OriginParser::findExcelColumnByName
vector< Origin::SpreadColumn >::difference_type findExcelColumnByName(vector< Origin::Excel >::size_type excel, vector< Origin::SpreadSheet >::size_type sheet, const string &name) const
Definition: OriginParser.cpp:64
OriginParser::resultsLog
string resultsLog
Definition: OriginParser.h:74
OriginParser::speadSheets
vector< Origin::SpreadSheet > speadSheets
Definition: OriginParser.h:67
OriginParser::windowsCount
unsigned int windowsCount
Definition: OriginParser.h:75
OriginParser::findSpreadByName
vector< Origin::SpreadSheet >::difference_type findSpreadByName(const string &name) const
Definition: OriginParser.cpp:37
OriginParser::matrixes
vector< Origin::Matrix > matrixes
Definition: OriginParser.h:68
OriginParser::projectTree
tree< Origin::ProjectNode > projectTree
Definition: OriginParser.h:73
OriginParser::excels
vector< Origin::Excel > excels
Definition: OriginParser.h:69
OriginParser::functions
vector< Origin::Function > functions
Definition: OriginParser.h:70
OriginParser::findFunctionByName
vector< Origin::Function >::difference_type findFunctionByName(const string &name) const
Definition: OriginParser.cpp:82
OriginParser::findColumnByName
int findColumnByName(int spread, const string &name)
Definition: OriginParser.cpp:186
OriginParser::findDataByIndex
pair< string, string > findDataByIndex(unsigned int index) const
Definition: OriginParser.cpp:91
OriginParser::convertSpreadToExcel
void convertSpreadToExcel(vector< Origin::SpreadSheet >::size_type spread)
Definition: OriginParser.cpp:162
tree< Origin::ProjectNode >
tree.hh