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 
29 using namespace std;
30 using namespace Origin;
31 
33 {
34 public:
35  explicit OriginAnyParser(const string& fileName);
36  bool parse() override;
37 
38 protected:
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();
47  bool readAnnotationElement();
48  bool readCurveElement();
49  bool readAxisBreakElement();
50  bool readAxisParameterElement(unsigned int);
51  bool readParameterElement();
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;
88  int igraph, ilayer;
89 };
90 
91 #endif // ORIGIN_ANY_PARSER_H
Definition: OriginAnyParser.h:33
iendianfstream file
Definition: OriginAnyParser.h:79
vector< Origin::Excel >::difference_type iexcel
Definition: OriginAnyParser.h:87
streamsize d_file_size
Definition: OriginAnyParser.h:82
streamoff curpos
Definition: OriginAnyParser.h:83
vector< Origin::Matrix >::difference_type imatrix
Definition: OriginAnyParser.h:86
FILE * logfile
Definition: OriginAnyParser.h:80
vector< Origin::SpreadSheet >::difference_type ispread
Definition: OriginAnyParser.h:85
unsigned int objectIndex
Definition: OriginAnyParser.h:84
int igraph
Definition: OriginAnyParser.h:88
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