Subversion Repositories public

Rev

Rev 225 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
224 andreas 1
/***************************************************************************
232 andreas 2
 *   Copyright (C) 2007 - 2009 by Andreas Theofilu                         *
224 andreas 3
 *   andreas@theosys.at                                                    *
4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation version 3 of the License.                *
8
 *                                                                         *
9
 *   This program is distributed in the hope that it will be useful,       *
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12
 *   GNU General Public License for more details.                          *
13
 *                                                                         *
14
 *   You should have received a copy of the GNU General Public License     *
15
 *   along with this program; if not, write to the                         *
16
 *   Free Software Foundation, Inc.,                                       *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18
 ***************************************************************************/
19
 
20
#ifndef _IMPORT_H
21
#define _IMPORT_H
22
 
23
#include <qfile.h>
24
#include <qstring.h>
232 andreas 25
#include <QXmlReader>
224 andreas 26
 
27
#include "garmin.h"
28
#include "disassemble.h"
29
 
30
#define eMax 7
31
 
32
#define FLD_FIRST	1
225 andreas 33
#define FLD_LAST	30
224 andreas 34
#define CON_FIRST	100
225 andreas 35
#define CON_LAST	121
36
#define ATT_FIRST	200
37
#define ATT_LAST	200
224 andreas 38
#define ERR_FIRST	500
39
#define ERR_LAST	507
40
 
41
#define ERR_OK			500
42
#define ERR_NOFILE		501
43
#define ERR_TAGS		502
44
#define ERR_ALLOCGMN		503
45
#define ERR_ALLOCLAP		504
46
#define ERR_ALLOCPOINT		505
47
#define ERR_ALLOCRUN		506
48
#define ERR_ALLOCLIST		507
49
 
50
typedef struct
51
{
52
	int id;
53
	QString name;
54
} KEYS;
55
 
56
extern KEYS keys[];
57
 
58
class gmn_import : public QXmlDefaultHandler
59
{
60
	public:
61
	   gmn_import () { Initialize(); };
62
	   gmn_import (const QFile &qfile);
63
	   ~gmn_import () { if (qfstat) file.close(); };
64
 
65
	   void Initialize ();
66
	   void setFile (const QFile &qfile);
67
	   void setFile (const QString &sfile);
68
	   void setDisassemble (disassemble *dis) { ds = dis; };
69
 
70
	   int import ();
71
	   garmin_data *getGarminData() { if (gmn) return gmn; else return 0; };
72
 
73
	   QString getError (int err);
74
	   QString getError ();
75
 
76
	   bool startDocument ();
77
	   bool startElement (const QString&, const QString&, const QString& , const QXmlAttributes&);
78
	   bool endElement (const QString&, const QString&, const QString&);
79
	   bool characters (const QString&);
80
 
81
	protected:
82
	   unsigned int garmin_time (const QString&);
83
	   QString getKey (int pos);
84
 
85
	private:
86
	   disassemble *ds;
87
	   QFile file;
88
	   bool qfstat, qfopen;
89
	   int __error;
90
	   int indent, tpos, lpos, oldLPos;
225 andreas 91
	   int tk, first_tpos;
92
	   bool history, fakeLap;
224 andreas 93
	   QString con, subCon;
94
	   garmin_data *gmn, *gmn_lap, *gmn_track;
95
	   garmin_list *list, *list_lap, *list_track;
225 andreas 96
	   D1015 lap, *plap;
224 andreas 97
	   D1009 run, *prun;
98
	   D304 point;
99
 
100
};
101
 
102
#endif