-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathOriginParser.h
More file actions
75 lines (64 loc) · 2.96 KB
/
Copy pathOriginParser.h
File metadata and controls
75 lines (64 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
File : OriginParser.h
Description : Origin file parser base class
--------------------------------------------------------------------
SPDX-FileCopyrightText: 2008 Alex Kargovsky <kargovsky@yumr.phys.msu.su>
SPDX-FileCopyrightText: 2017-2024 Stefan Gerlach <stefan.gerlach@uni.kn>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef ORIGIN_PARSER_H
#define ORIGIN_PARSER_H
#include "OriginObj.h"
#include "tree.hh"
#ifdef GENERATE_CODE_FOR_LOG
# define LOG_PRINT(logfile, ...) \
{ \
fprintf(logfile, __VA_ARGS__); \
}
#else // !GENERATE_CODE_FOR_LOG
# define LOG_PRINT(logfile, ...) {};
#endif
class ORIGIN_EXPORT OriginParser
{
public:
virtual ~OriginParser() = default;
virtual bool parse() = 0;
std::vector<Origin::SpreadSheet>::difference_type
findSpreadByName(const std::string &name) const;
std::vector<Origin::Matrix>::difference_type findMatrixByName(const std::string &name) const;
std::vector<Origin::Function>::difference_type
findFunctionByName(const std::string &name) const;
std::vector<Origin::Excel>::difference_type findExcelByName(const std::string &name) const;
protected:
std::vector<Origin::SpreadColumn>::difference_type
findSpreadColumnByName(std::vector<Origin::SpreadSheet>::size_type spread,
const std::string &name) const;
std::vector<Origin::SpreadColumn>::difference_type
findExcelColumnByName(std::vector<Origin::Excel>::size_type excel,
std::vector<Origin::SpreadSheet>::size_type sheet,
const std::string &name) const;
std::pair<std::string, std::string> findDataByIndex(unsigned int index) const;
std::pair<Origin::ProjectNode::NodeType, std::string>
findObjectByIndex(unsigned int index) const;
std::pair<Origin::ProjectNode::NodeType, Origin::Window>
findWindowObjectByIndex(unsigned int index) const;
void convertSpreadToExcel(std::vector<Origin::SpreadSheet>::size_type spread);
int findColumnByName(int spread, const std::string &name);
private:
bool iequals(const std::string &, const std::string &,
const std::locale & = std::locale()) const;
public:
std::vector<Origin::SpreadColumn> datasets;
std::vector<Origin::SpreadSheet> spreadSheets;
std::vector<Origin::Matrix> matrixes;
std::vector<Origin::Excel> excels;
std::vector<Origin::Function> functions;
std::vector<Origin::Graph> graphs;
std::vector<Origin::Note> notes;
tree<Origin::ProjectNode> projectTree;
std::string resultsLog;
unsigned int windowsCount{ 0 };
unsigned int fileVersion{ 0 }, buildVersion{ 0 };
};
OriginParser *createOriginAnyParser(const std::string &fileName);
#endif // ORIGIN_PARSER_H