liborigin  2.0.0
Origin750Parser.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : Origin750Parser.h
3  --------------------------------------------------------------------
4  Copyright : (C) 2007-2008 Alex Kargovsky, Stefan Gerlach,
5  Ion Vasilief
6  Email (use @ for *) : kargovsky*yumr.phys.msu.su, ion_vasilief*yahoo.fr
7  Description : Origin 7.5 file parser class
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 
30 
31 #ifndef ORIGIN_750_PARSER_H
32 #define ORIGIN_750_PARSER_H
33 
34 #include "OriginParser.h"
35 #include "endianfstream.hh"
36 #include <string>
37 #include <cmath> // for floor()
38 
39 using namespace std;
40 using namespace Origin;
41 
43 {
44 public:
45  Origin750Parser(const string& fileName);
46  bool parse();
47 
48 protected:
49  void readSpreadInfo();
50  void readExcelInfo();
51  void readMatrixInfo();
52  void readGraphInfo();
53  unsigned int readGraphAxisInfo(GraphAxis& axis);
54  void readGraphGridInfo(GraphGrid& grid);
55  void readGraphAxisBreakInfo(GraphAxisBreak& axis_break);
56  void readGraphAxisFormatInfo(GraphAxisFormat& format);
57  void readGraphAxisTickLabelsInfo(GraphAxisTick& tick);
58  void readGraphAxisPrefixSuffixInfo(const string& sec_name, unsigned int size, GraphLayer& layer);
59  void readProjectTree();
60  virtual void readProjectTreeFolder(tree<ProjectNode>::iterator parent);
61  void readWindowProperties(Window& window, unsigned int size);
62  virtual void readColorMap(ColorMap& colorMap);
63  void skipLine();
64  inline double stringToDouble(const string& s)
65  {
66  string s1 = s;
67  size_t pos = s.find(",");
68  if (pos != string::npos)
69  s1.replace(pos, 1, ".");
70  return strtod(s1.c_str(), NULL);
71  }
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.5) * 86400. + 0.5);
77  }
78 
79  unsigned int objectIndex;
81  FILE *logfile;
82 
83  unsigned int d_file_size;
84  unsigned int d_colormap_offset;
85  unsigned int d_start_offset;
86 };
87 
88 #endif // ORIGIN_750_PARSER_H
double stringToDouble(const string &s)
Definition: Origin750Parser.h:64
Definition: OriginObj.h:503
Definition: OriginObj.h:540
Definition: OriginObj.h:483
Definition: endianfstream.hh:35
Definition: OriginObj.h:654
Definition: endianfstream.hh:37
unsigned int d_file_size
Definition: Origin750Parser.h:83
Definition: OriginObj.h:511
Definition: OriginObj.h:526
FILE * logfile
Definition: Origin750Parser.h:81
iendianfstream file
Definition: Origin750Parser.h:80
unsigned int d_start_offset
Definition: Origin750Parser.h:85
time_t doubleToPosixTime(double jdt)
Definition: Origin750Parser.h:73
Definition: OriginObj.h:124
Definition: OriginParser.h:45
unsigned int d_colormap_offset
Definition: Origin750Parser.h:84
Definition: OriginObj.h:118
Definition: Origin750Parser.h:42
Depth-first iterator, first accessing the node, then its children.
Definition: tree.hh:161
unsigned int objectIndex
Definition: Origin750Parser.h:79
Definition: OriginObj.h:43