liborigin ..
/builddir/build/BUILD/liborigin-3.0.1/OriginAnyParser.h
Go to the documentation of this file.
1/*
2 * OriginAnyParser.h
3 *
4 * Copyright 2017 Miquel Garriga <gbmiquel@gmail.com>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * Parser for all versions. Based mainly on Origin750Parser.h
20 */
21#ifndef ORIGIN_ANY_PARSER_H
22#define ORIGIN_ANY_PARSER_H
23
24#include "OriginParser.h"
25#include "endianfstream.hh"
26#include <string>
27#include <cmath> // for floor()
28
29using namespace std;
30using namespace Origin;
31
33{
34public:
35 explicit OriginAnyParser(const string& fileName);
36 bool parse() override;
37
38protected:
39 unsigned int readObjectSize();
40 string readObjectAsString(unsigned int);
41 void readFileVersion();
42 void readGlobalHeader();
43 bool readDataSetElement();
44 bool readWindowElement();
45 bool readLayerElement();
46 unsigned int readAnnotationList();
48 bool readCurveElement();
50 bool readAxisParameterElement(unsigned int);
52 bool readNoteElement();
53 void readProjectTree();
54 unsigned int readFolderTree(tree<ProjectNode>::iterator, unsigned int);
55 void readProjectLeaf(tree<ProjectNode>::iterator);
56 void readAttachmentList();
57 bool getColumnInfoAndData(const string&, unsigned int, const string&, unsigned int);
58 void getMatrixValues(const string&, unsigned int, short, char, char, vector<Origin::Matrix>::difference_type);
59 void getWindowProperties(Origin::Window&, const string&, unsigned int);
60 void getLayerProperties(const string&, unsigned int);
61 Origin::Color getColor(const string&);
62 void getAnnotationProperties(const string&, unsigned int, const string&, unsigned int, const string&, unsigned int, const string&, unsigned int);
63 void getCurveProperties(const string&, unsigned int, const string&, unsigned int);
64 void getAxisBreakProperties(const string&, unsigned int);
65 void getAxisParameterProperties(const string&, unsigned int, int);
66 void getNoteProperties(const string&, unsigned int, const string&, unsigned int, const string&, unsigned int);
67 void getColorMap(ColorMap&, const string&, unsigned int);
68 void getZcolorsMap(ColorMap&, const string&, unsigned int);
69 void getProjectLeafProperties(tree<ProjectNode>::iterator, const string&, unsigned int);
70 void getProjectFolderProperties(tree<ProjectNode>::iterator, const string&, unsigned int);
71 void outputProjectTree(std::ostream &);
72
73 inline time_t doubleToPosixTime(double jdt)
74 {
75 /* 2440587.5 is julian date for the unixtime epoch */
76 return (time_t) floor((jdt - 2440587) * 86400. + 0.5);
77 }
78
79 iendianfstream file;
80 FILE *logfile;
81
82 streamsize d_file_size;
83 streamoff curpos;
84 unsigned int objectIndex, parseError;
85 vector<Origin::SpreadSheet>::difference_type ispread;
86 vector<Origin::Matrix>::difference_type imatrix;
87 vector<Origin::Excel>::difference_type iexcel;
89};
90
91#endif // ORIGIN_ANY_PARSER_H
Definition: OriginAnyParser.h:33
void getProjectLeafProperties(tree< ProjectNode >::iterator, const string &, unsigned int)
Definition: OriginAnyParser.cpp:2953
iendianfstream file
Definition: OriginAnyParser.h:79
bool readAxisParameterElement(unsigned int)
Definition: OriginAnyParser.cpp:635
vector< Origin::Excel >::difference_type iexcel
Definition: OriginAnyParser.h:87
streamsize d_file_size
Definition: OriginAnyParser.h:82
void getCurveProperties(const string &, unsigned int, const string &, unsigned int)
Definition: OriginAnyParser.cpp:1927
void getZcolorsMap(ColorMap &, const string &, unsigned int)
Definition: OriginAnyParser.cpp:2882
unsigned int readObjectSize()
Definition: OriginAnyParser.cpp:181
streamoff curpos
Definition: OriginAnyParser.h:83
Origin::Color getColor(const string &)
Definition: OriginAnyParser.cpp:1439
bool readAnnotationElement()
Definition: OriginAnyParser.cpp:487
void getLayerProperties(const string &, unsigned int)
Definition: OriginAnyParser.cpp:1347
void getWindowProperties(Origin::Window &, const string &, unsigned int)
Definition: OriginAnyParser.cpp:1252
bool readParameterElement()
Definition: OriginAnyParser.cpp:660
unsigned int readAnnotationList()
Definition: OriginAnyParser.cpp:476
vector< Origin::Matrix >::difference_type imatrix
Definition: OriginAnyParser.h:86
unsigned int readFolderTree(tree< ProjectNode >::iterator, unsigned int)
Definition: OriginAnyParser.cpp:768
bool readDataSetElement()
Definition: OriginAnyParser.cpp:274
void getProjectFolderProperties(tree< ProjectNode >::iterator, const string &, unsigned int)
Definition: OriginAnyParser.cpp:2978
void getColorMap(ColorMap &, const string &, unsigned int)
Definition: OriginAnyParser.cpp:2823
void getAxisParameterProperties(const string &, unsigned int, int)
Definition: OriginAnyParser.cpp:2521
int ilayer
Definition: OriginAnyParser.h:88
void getAnnotationProperties(const string &, unsigned int, const string &, unsigned int, const string &, unsigned int, const string &, unsigned int)
Definition: OriginAnyParser.cpp:1493
bool readNoteElement()
Definition: OriginAnyParser.cpp:690
void outputProjectTree(std::ostream &)
Definition: OriginAnyParser.cpp:2994
void getAxisBreakProperties(const string &, unsigned int)
Definition: OriginAnyParser.cpp:2476
void readFileVersion()
Definition: OriginAnyParser.cpp:218
void getNoteProperties(const string &, unsigned int, const string &, unsigned int, const string &, unsigned int)
Definition: OriginAnyParser.cpp:2748
bool getColumnInfoAndData(const string &, unsigned int, const string &, unsigned int)
Definition: OriginAnyParser.cpp:956
FILE * logfile
Definition: OriginAnyParser.h:80
void readAttachmentList()
Definition: OriginAnyParser.cpp:862
void readGlobalHeader()
Definition: OriginAnyParser.cpp:236
unsigned int parseError
Definition: OriginAnyParser.h:84
vector< Origin::SpreadSheet >::difference_type ispread
Definition: OriginAnyParser.h:85
unsigned int objectIndex
Definition: OriginAnyParser.h:84
bool readLayerElement()
Definition: OriginAnyParser.cpp:389
bool readCurveElement()
Definition: OriginAnyParser.cpp:570
bool parse() override
Definition: OriginAnyParser.cpp:54
bool readAxisBreakElement()
Definition: OriginAnyParser.cpp:610
bool readWindowElement()
Definition: OriginAnyParser.cpp:328
int igraph
Definition: OriginAnyParser.h:88
string readObjectAsString(unsigned int)
Definition: OriginAnyParser.cpp:196
void readProjectTree()
Definition: OriginAnyParser.cpp:734
OriginAnyParser(const string &fileName)
Definition: OriginAnyParser.cpp:40
void readProjectLeaf(tree< ProjectNode >::iterator)
Definition: OriginAnyParser.cpp:839
void getMatrixValues(const string &, unsigned int, short, char, char, vector< Origin::Matrix >::difference_type)
Definition: OriginAnyParser.cpp:1167
time_t doubleToPosixTime(double jdt)
Definition: OriginAnyParser.h:73
Definition: OriginParser.h:42
Definition: OriginObj.h:44
Definition: OriginObj.h:143
Definition: OriginObj.h:78
Definition: OriginObj.h:149