-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcsvparser.h
107 lines (80 loc) · 2.91 KB
/
csvparser.h
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/************************************************************************
MeOS - Orienteering Software
Copyright (C) 2009-2015 Melin Software HB
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Melin Software HB - [email protected] - www.melin.nu
Stigbergsvägen 7, SE-75242 UPPSALA, Sweden
************************************************************************/
// csvparser.h: interface for the csvparser class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_CSVPARSER_H__FD04656A_1D2A_4E6C_BE23_BD66052E276E__INCLUDED_)
#define AFX_CSVPARSER_H__FD04656A_1D2A_4E6C_BE23_BD66052E276E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <vector>
#include <map>
class oEvent;
struct SICard;
struct PunchInfo {
int code;
int card;
int time;
char date[28];
};
struct TeamLineup {
struct TeamMember {
string name;
string club;
int cardNo;
string course;
string cls;
};
string teamName;
string teamClass;
string teamClub;
vector<TeamMember> members;
};
class csvparser
{
protected:
ofstream fout;
ifstream fin;
int LineNumber;
string ErrorMessage;
// Returns true if a SI-manager line is identified
bool checkSimanLine(const oEvent &oe, const vector<char *> &sp, SICard &cards);
public:
void parse(const string &file, list< vector<string> > &dataOutput);
void importTeamLineup(const string &file,
const map<string, int> &classNameToNumber,
vector<TeamLineup> &teams);
bool openOutput(const char *file);
bool closeOutput();
bool OutputRow(vector<string> &out);
bool OutputRow(const string &row);
int nimport;
bool ImportOCAD_CSV(oEvent &event, const char *file, bool addClasses);
bool ImportOS_CSV(oEvent &event, const char *file);
bool ImportRAID(oEvent &event, const char *file);
bool importPunches(const oEvent &oe, const char *file,
vector<PunchInfo> &punches);
bool importCards(const oEvent &oe, const char *file,
vector<SICard> &punches);
int split(char *line, vector<char *> &split);
bool ImportOE_CSV(oEvent &event, const char *file);
int iscsv(const char *file);
csvparser();
virtual ~csvparser();
};
#endif // !defined(AFX_CSVPARSER_H__FD04656A_1D2A_4E6C_BE23_BD66052E276E__INCLUDED_)