00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef ORIGIN_PARSER_H
00031 #define ORIGIN_PARSER_H
00032
00033 #include "OriginObj.h"
00034 #include "tree.hh"
00035
00036 #ifndef NO_LOG_FILE
00037 #define LOG_PRINT( logfile, args... )\
00038 {\
00039 int ioret = fprintf(logfile, args);\
00040 assert(ioret>0);\
00041 }
00042 #else
00043 #define LOG_PRINT( logfile, args... ) {};
00044 #endif
00045
00046 class OriginParser
00047 {
00048 public:
00049 virtual ~OriginParser() {};
00050 virtual bool parse() = 0;
00051 void setFileVersion(unsigned int version){fileVersion = version;};
00052
00053 int findSpreadByName(const string& name) const;
00054 int findMatrixByName(const string& name) const;
00055 int findFunctionByName(const string& name) const;
00056 int findExcelByName(const string& name) const;
00057
00058 protected:
00059 int findExcelColumnByName(int excel, int sheet, const string& name) const;
00060 pair<string, string> findDataByIndex(unsigned int index) const;
00061 pair<Origin::ProjectNode::NodeType, string> findObjectByIndex(unsigned int index) const;
00062 void convertSpreadToExcel(vector<Origin::SpreadSheet>::size_type spread);
00063
00064 int findColumnByName(int spread, const string& name);
00065 int findColumnByIndexAndName(int spread, unsigned int index, const string& name);
00066
00067 public:
00068 vector<Origin::SpreadSheet> speadSheets;
00069 vector<Origin::Matrix> matrices;
00070 vector<Origin::Excel> excels;
00071 vector<Origin::Function> functions;
00072 vector<Origin::Graph> graphs;
00073 vector<Origin::Note> notes;
00074 tree<Origin::ProjectNode> projectTree;
00075 string resultsLog;
00076 unsigned int windowsCount;
00077 unsigned int fileVersion;
00078 };
00079
00080 OriginParser* createOrigin410Parser(const string& fileName);
00081 OriginParser* createOrigin500Parser(const string& fileName);
00082 OriginParser* createOrigin610Parser(const string& fileName);
00083 OriginParser* createOrigin700Parser(const string& fileName);
00084 OriginParser* createOrigin750Parser(const string& fileName);
00085 OriginParser* createOrigin800Parser(const string& fileName);
00086 OriginParser* createOrigin810Parser(const string& fileName);
00087 OriginParser* createOrigin850Parser(const string& fileName);
00088
00089 #endif // ORIGIN_PARSER_H