liborigin2: /build/liborigin2/src/liborigin2/Origin750Parser.h Source File

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
40 class Origin750Parser : public OriginParser
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;
84 iendianfstream file;
85 FILE *logfile;
86
87 unsigned int d_colormap_offset;
88 };
89
90 #endif // ORIGIN_750_PARSER_H
Origin750Parser::stringToDouble
double stringToDouble(const string &s)
Definition: Origin750Parser.h:68
Origin::GraphGrid
Definition: OriginObj.h:524
Origin::GraphAxis
Definition: OriginObj.h:562
endianfstream.hh
Origin::GraphAxisBreak
Definition: OriginObj.h:504
std
Definition: endianfstream.hh:35
Origin::GraphLayer
Definition: OriginObj.h:679
std::iendianfstream
Definition: endianfstream.hh:37
Origin::GraphAxisFormat
Definition: OriginObj.h:532
Origin::GraphAxisTick
Definition: OriginObj.h:548
Origin750Parser::logfile
FILE * logfile
Definition: Origin750Parser.h:85
Origin750Parser::file
iendianfstream file
Definition: Origin750Parser.h:84
OriginParser.h
Origin750Parser::doubleToPosixTime
time_t doubleToPosixTime(double jdt)
Definition: Origin750Parser.h:77
Origin::Window
Definition: OriginObj.h:127
OriginParser
Definition: OriginParser.h:46
Origin750Parser::d_colormap_offset
unsigned int d_colormap_offset
Definition: Origin750Parser.h:87
Origin::ColorMap
Definition: OriginObj.h:121
Origin750Parser
Definition: Origin750Parser.h:40
tree::pre_order_iterator
Depth-first iterator, first accessing the node, then its children.
Definition: tree.hh:122
Origin750Parser::objectIndex
unsigned int objectIndex
Definition: Origin750Parser.h:83
Origin
Definition: OriginObj.h:46