liborigin  ..
/home/abuild/rpmbuild/BUILD/liborigin-3.0.2/OriginAnyParser.h
Go to the documentation of this file.
1 /*
2  OriginAnyParser.h
3 
4  SPDX-FileCopyrightText: 2017 Miquel Garriga <gbmiquel@gmail.com>
5 
6  SPDX-License-Identifier: GPL-3.0-or-later
7 
8  Parser for all versions. Based mainly on Origin750Parser.h
9 */
10 #ifndef ORIGIN_ANY_PARSER_H
11 #define ORIGIN_ANY_PARSER_H
12 
13 #include "OriginParser.h"
14 #include "endianfstream.hh"
15 
16 #include <string>
17 #include <cmath> // for floor()
18 
19 using namespace Origin;
20 using namespace endianfstream;
21 
23 {
24 public:
25  explicit OriginAnyParser(const std::string &fileName);
26  bool parse() override;
27 
28 protected:
29  unsigned int readObjectSize();
30  std::string readObjectAsString(unsigned int);
31  void readFileVersion();
32  void readGlobalHeader();
33  bool readDataSetElement();
34  bool readWindowElement();
35  bool readLayerElement();
36  unsigned int readAnnotationList();
37  bool readAnnotationElement();
38  bool readCurveElement();
39  bool readAxisBreakElement();
40  bool readAxisParameterElement(unsigned int);
41  bool readParameterElement();
42  bool readNoteElement();
43  void readProjectTree();
44  unsigned int readFolderTree(tree<ProjectNode>::iterator, unsigned int);
45  void readProjectLeaf(tree<ProjectNode>::iterator);
46  void readAttachmentList();
47  bool getColumnInfoAndData(const std::string &, unsigned int, const std::string &, unsigned int);
48  void getMatrixValues(const std::string &, unsigned int, short, char, char,
49  std::vector<Origin::Matrix>::difference_type);
50  void getWindowProperties(Origin::Window &, const std::string &, unsigned int);
51  void getLayerProperties(const std::string &, unsigned int);
52  Origin::Color getColor(const std::string &);
53  void getAnnotationProperties(const std::string &, unsigned int, const std::string &,
54  unsigned int, const std::string &, unsigned int,
55  const std::string &, unsigned int);
56  void getCurveProperties(const std::string &, unsigned int, const std::string &, unsigned int);
57  void getAxisBreakProperties(const std::string &, unsigned int);
58  void getAxisParameterProperties(const std::string &, unsigned int, int);
59  void getNoteProperties(const std::string &, unsigned int, const std::string &, unsigned int,
60  const std::string &, unsigned int);
61  void getColorMap(ColorMap &, const std::string &, unsigned int);
62  void getZcolorsMap(ColorMap &, const std::string &, unsigned int);
63  void getProjectLeafProperties(tree<ProjectNode>::iterator, const std::string &, unsigned int);
64  void getProjectFolderProperties(tree<ProjectNode>::iterator, const std::string &, unsigned int);
65  void outputProjectTree(std::ostream &);
66 
67  inline time_t doubleToPosixTime(double jdt)
68  {
69  /* 2440587.5 is julian date for the unixtime epoch */
70  return (time_t)floor((jdt - 2440587) * 86400. + 0.5);
71  }
72 
73  iendianfstream file;
74  FILE *logfile;
75 
76  std::streamsize d_file_size;
77  std::streamoff curpos;
78  unsigned int objectIndex, parseError;
79  std::vector<Origin::SpreadSheet>::difference_type ispread;
80  std::vector<Origin::Matrix>::difference_type imatrix;
81  std::vector<Origin::Excel>::difference_type iexcel;
82  int igraph, ilayer;
83 };
84 
85 #endif // ORIGIN_ANY_PARSER_H
#define ORIGIN_EXPORT
Definition: OriginObj.h:26
std::streamsize d_file_size
Definition: OriginAnyParser.h:76
std::vector< Origin::Matrix >::difference_type imatrix
Definition: OriginAnyParser.h:80
unsigned int parseError
Definition: OriginAnyParser.h:78
std::streamoff curpos
Definition: OriginAnyParser.h:77
iendianfstream file
Definition: OriginAnyParser.h:73
std::vector< Origin::SpreadSheet >::difference_type ispread
Definition: OriginAnyParser.h:79
Definition: OriginObj.h:144
int ilayer
Definition: OriginAnyParser.h:82
Definition: OriginObj.h:232
Definition: OriginParser.h:25
time_t doubleToPosixTime(double jdt)
Definition: OriginAnyParser.h:67
Definition: OriginObj.h:226
FILE * logfile
Definition: OriginAnyParser.h:74
Definition: OriginAnyParser.h:22
std::vector< Origin::Excel >::difference_type iexcel
Definition: OriginAnyParser.h:81
Definition: OriginObj.h:31