liborigin 2.0.0

/tmp/slackdce/slackrepo.5NA6jZ/build_liborigin/liborigin/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
42 class Origin750Parser : public OriginParser
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;
80 iendianfstream file;
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
OriginParser.h
Origin750Parser
Definition: Origin750Parser.h:43
Origin750Parser::logfile
FILE * logfile
Definition: Origin750Parser.h:81
Origin750Parser::parse
bool parse()
Definition: Origin750Parser.cpp:42
Origin750Parser::d_file_size
unsigned int d_file_size
Definition: Origin750Parser.h:83
Origin750Parser::readGraphAxisPrefixSuffixInfo
void readGraphAxisPrefixSuffixInfo(const string &sec_name, unsigned int size, GraphLayer &layer)
Definition: Origin750Parser.cpp:2438
Origin750Parser::d_start_offset
unsigned int d_start_offset
Definition: Origin750Parser.h:85
Origin750Parser::readProjectTreeFolder
virtual void readProjectTreeFolder(tree< ProjectNode >::iterator parent)
Definition: Origin750Parser.cpp:2262
Origin750Parser::file
iendianfstream file
Definition: Origin750Parser.h:80
Origin750Parser::readSpreadInfo
void readSpreadInfo()
Definition: Origin750Parser.cpp:576
Origin750Parser::readGraphAxisInfo
unsigned int readGraphAxisInfo(GraphAxis &axis)
Definition: Origin750Parser.cpp:2203
Origin750Parser::d_colormap_offset
unsigned int d_colormap_offset
Definition: Origin750Parser.h:84
Origin750Parser::readGraphGridInfo
void readGraphGridInfo(GraphGrid &grid)
Definition: Origin750Parser.cpp:2031
Origin750Parser::doubleToPosixTime
time_t doubleToPosixTime(double jdt)
Definition: Origin750Parser.h:73
Origin750Parser::objectIndex
unsigned int objectIndex
Definition: Origin750Parser.h:79
Origin750Parser::stringToDouble
double stringToDouble(const string &s)
Definition: Origin750Parser.h:64
Origin750Parser::readWindowProperties
void readWindowProperties(Window &window, unsigned int size)
Definition: Origin750Parser.cpp:2329
Origin750Parser::readGraphInfo
void readGraphInfo()
Definition: Origin750Parser.cpp:1174
Origin750Parser::readGraphAxisTickLabelsInfo
void readGraphAxisTickLabelsInfo(GraphAxisTick &tick)
Definition: Origin750Parser.cpp:2117
Origin750Parser::skipLine
void skipLine()
Definition: Origin750Parser.cpp:2475
Origin750Parser::Origin750Parser
Origin750Parser(const string &fileName)
Definition: Origin750Parser.cpp:34
Origin750Parser::readGraphAxisFormatInfo
void readGraphAxisFormatInfo(GraphAxisFormat &format)
Definition: Origin750Parser.cpp:2075
Origin750Parser::readProjectTree
void readProjectTree()
Definition: Origin750Parser.cpp:2241
Origin750Parser::readGraphAxisBreakInfo
void readGraphAxisBreakInfo(GraphAxisBreak &axis_break)
Definition: Origin750Parser.cpp:2053
Origin750Parser::readExcelInfo
void readExcelInfo()
Definition: Origin750Parser.cpp:792
Origin750Parser::readMatrixInfo
void readMatrixInfo()
Definition: Origin750Parser.cpp:1013
Origin750Parser::readColorMap
virtual void readColorMap(ColorMap &colorMap)
Definition: Origin750Parser.cpp:2398
OriginParser
Definition: OriginParser.h:46
std::iendianfstream
Definition: endianfstream.hh:38
tree::pre_order_iterator
Depth-first iterator, first accessing the node, then its children.
Definition: tree.hh:161
endianfstream.hh
Origin
Definition: OriginObj.h:44
std
Definition: endianfstream.hh:36
Origin::ColorMap
Definition: OriginObj.h:119
Origin::GraphAxisBreak
Definition: OriginObj.h:484
Origin::GraphAxisFormat
Definition: OriginObj.h:512
Origin::GraphAxisTick
Definition: OriginObj.h:527
Origin::GraphAxis
Definition: OriginObj.h:541
Origin::GraphGrid
Definition: OriginObj.h:504
Origin::GraphLayer
Definition: OriginObj.h:655
Origin::Window
Definition: OriginObj.h:125