forked from Saluev/python-liborigin2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOriginAnyParser.h
87 lines (79 loc) · 3.03 KB
/
OriginAnyParser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
* OriginAnyParser.h
*
* Copyright 2017 Miquel Garriga <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Parser for all versions. Based mainly on Origin750Parser.h
*/
#ifndef ORIGIN_ANY_PARSER_H
#define ORIGIN_ANY_PARSER_H
#include "OriginParser.h"
#include "endianfstream.hh"
#include <string>
#include <cmath> // for floor()
using namespace std;
using namespace Origin;
class OriginAnyParser : public OriginParser
{
public:
OriginAnyParser(const string& fileName);
bool parse(ProgressCallback callback = NULL, void *user_data = NULL);
protected:
unsigned int readObjectSize();
string readObjectAsString(unsigned int);
void readFileVersion();
void readGlobalHeader();
bool readDataSetElement();
bool readWindowElement();
bool readLayerElement();
unsigned int readAnnotationList();
bool readAnnotationElement();
bool readCurveElement();
bool readAxisBreakElement();
bool readAxisParameterElement(unsigned int);
bool readParameterElement();
bool readNoteElement();
void readProjectTree();
unsigned int readFolderTree(tree<ProjectNode>::iterator, unsigned int);
void readProjectLeaf(tree<ProjectNode>::iterator);
void readAttachmentList();
bool getColumnInfoAndData(string, unsigned int, string, unsigned int);
void getMatrixValues(string, unsigned int, short, char, char, int);
void getWindowProperties(Origin::Window&, string, unsigned int);
void getLayerProperties(string, unsigned int);
Origin::Color getColor(string);
void getAnnotationProperties(string, unsigned int, string, unsigned int, string, unsigned int, string, unsigned int);
void getCurveProperties(string, unsigned int, string, unsigned int);
void getAxisBreakProperties(string, unsigned int);
void getAxisParameterProperties(string, unsigned int, int);
void getNoteProperties(string, unsigned int, string, unsigned int, string, unsigned int);
void getColorMap(ColorMap&, string, unsigned int);
void getZcolorsMap(ColorMap&, string, unsigned int);
void getProjectLeafProperties(tree<ProjectNode>::iterator, string, unsigned int);
void getProjectFolderProperties(tree<ProjectNode>::iterator, string, unsigned int);
void outputProjectTree();
inline time_t doubleToPosixTime(double jdt)
{
/* 2440587.5 is julian date for the unixtime epoch */
return (time_t) floor((jdt - 2440587) * 86400. + 0.5);
}
iendianfstream file;
FILE *logfile;
unsigned int d_file_size, objectIndex;
int ispread, imatrix, iexcel, igraph;
int ilayer;
};
#endif // ORIGIN_ANY_PARSER_H