liborigin2: /build/liborigin2/src/liborigin2/OriginParser.h Source File

liborigin2 29/08/2011

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

/build/liborigin2/src/liborigin2/OriginParser.h
Go to the documentation of this file.
1 /***************************************************************************
2 File : OriginParser.h
3 --------------------------------------------------------------------
4 Copyright : (C) 2009 - 2011 Ion Vasilief
5 (C) 2008 Alex Kargovsky
6 Email (use @ for *) : ion_vasilief*yahoo.fr
7 Description : Origin file parser base class
8
9 ***************************************************************************/
10
11 /***************************************************************************
12 * *
13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. *
17 * *
18 * This program is distributed in the hope that it will be useful, *
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21 * GNU General Public License for more details. *
22 * *
23 * You should have received a copy of the GNU General Public License *
24 * along with this program; if not, write to the Free Software *
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26 * Boston, MA 02110-1301 USA *
27 * *
28 ***************************************************************************/
29
30 #ifndef ORIGIN_PARSER_H
31 #define ORIGIN_PARSER_H
32
33 #include "OriginObj.h"
34 #include "tree.hh"
35
36 #ifndef NO_LOG_FILE
37 #define LOG_PRINT( logfile, args... )\
38 {\
39 int ioret = fprintf(logfile, args);\
40 assert(ioret>0);\
41 }
42 #else
43 #define LOG_PRINT( logfile, args... ) {};
44 #endif
45
46 class OriginParser
47 {
48 public:
49 virtual ~OriginParser() {};
50 virtual bool parse() = 0;
51 void setFileVersion(unsigned int version){fileVersion = version;};
52
53 int findSpreadByName(const string& name) const;
54 int findMatrixByName(const string& name) const;
55 int findFunctionByName(const string& name) const;
56 int findExcelByName(const string& name) const;
57
58 protected:
59 int findExcelColumnByName(int excel, int 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 int findColumnByIndexAndName(int spread, unsigned int index, const string& name);
66
67 public:
68 vector<Origin::SpreadSheet> speadSheets;
69 vector<Origin::Matrix> matrices;
70 vector<Origin::Excel> excels;
71 vector<Origin::Function> functions;
72 vector<Origin::Graph> graphs;
73 vector<Origin::Note> notes;
74 tree<Origin::ProjectNode> projectTree;
75 string resultsLog;
76 unsigned int windowsCount;
77 unsigned int fileVersion;
78 };
79
80 OriginParser* createOrigin410Parser(const string& fileName);
81 OriginParser* createOrigin500Parser(const string& fileName);
82 OriginParser* createOrigin610Parser(const string& fileName);
83 OriginParser* createOrigin700Parser(const string& fileName);
84 OriginParser* createOrigin750Parser(const string& fileName);
85 OriginParser* createOrigin800Parser(const string& fileName);
86 OriginParser* createOrigin810Parser(const string& fileName);
87 OriginParser* createOrigin850Parser(const string& fileName);
88
89 #endif // ORIGIN_PARSER_H
OriginParser::speadSheets
vector< Origin::SpreadSheet > speadSheets
Definition: OriginParser.h:68
tree.hh
OriginParser::windowsCount
unsigned int windowsCount
Definition: OriginParser.h:76
OriginParser::functions
vector< Origin::Function > functions
Definition: OriginParser.h:71
OriginParser::findColumnByName
int findColumnByName(int spread, const string &name)
Definition: OriginParser.cpp:184
OriginObj.h
OriginParser::~OriginParser
virtual ~OriginParser()
Definition: OriginParser.h:49
OriginParser::setFileVersion
void setFileVersion(unsigned int version)
Definition: OriginParser.h:51
createOrigin810Parser
OriginParser * createOrigin810Parser(const string &fileName)
Definition: Origin810Parser.cpp:157
OriginParser::findDataByIndex
pair< string, string > findDataByIndex(unsigned int index) const
Definition: OriginParser.cpp:86
OriginParser::findExcelColumnByName
int findExcelColumnByName(int excel, int sheet, const string &name) const
Definition: OriginParser.cpp:55
OriginParser::parse
virtual bool parse()=0
OriginParser::fileVersion
unsigned int fileVersion
Definition: OriginParser.h:77
OriginParser::findMatrixByName
int findMatrixByName(const string &name) const
Definition: OriginParser.cpp:66
OriginParser::notes
vector< Origin::Note > notes
Definition: OriginParser.h:73
OriginParser::findFunctionByName
int findFunctionByName(const string &name) const
Definition: OriginParser.cpp:76
createOrigin800Parser
OriginParser * createOrigin800Parser(const string &fileName)
Definition: Origin800Parser.cpp:915
createOrigin410Parser
OriginParser * createOrigin410Parser(const string &fileName)
Definition: Origin410Parser.cpp:34
OriginParser::resultsLog
string resultsLog
Definition: OriginParser.h:75
createOrigin500Parser
OriginParser * createOrigin500Parser(const string &fileName)
Definition: Origin500Parser.cpp:34
createOrigin750Parser
OriginParser * createOrigin750Parser(const string &fileName)
Definition: Origin750Parser.cpp:2666
tree< Origin::ProjectNode >
OriginParser
Definition: OriginParser.h:46
OriginParser::findExcelByName
int findExcelByName(const string &name) const
Definition: OriginParser.cpp:45
OriginParser::findObjectByIndex
pair< Origin::ProjectNode::NodeType, string > findObjectByIndex(unsigned int index) const
Definition: OriginParser.cpp:128
OriginParser::matrices
vector< Origin::Matrix > matrices
Definition: OriginParser.h:69
OriginParser::projectTree
tree< Origin::ProjectNode > projectTree
Definition: OriginParser.h:74
createOrigin850Parser
OriginParser * createOrigin850Parser(const string &fileName)
Definition: Origin850Parser.cpp:35
createOrigin700Parser
OriginParser * createOrigin700Parser(const string &fileName)
Definition: Origin700Parser.cpp:1246
OriginParser::graphs
vector< Origin::Graph > graphs
Definition: OriginParser.h:72
OriginParser::convertSpreadToExcel
void convertSpreadToExcel(vector< Origin::SpreadSheet >::size_type spread)
Definition: OriginParser.cpp:161
OriginParser::findColumnByIndexAndName
int findColumnByIndexAndName(int spread, unsigned int index, const string &name)
Definition: OriginParser.cpp:202
createOrigin610Parser
OriginParser * createOrigin610Parser(const string &fileName)
Definition: Origin610Parser.cpp:1560
OriginParser::findSpreadByName
int findSpreadByName(const string &name) const
Definition: OriginParser.cpp:35
OriginParser::excels
vector< Origin::Excel > excels
Definition: OriginParser.h:70