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