source: subversion/applications/editors/osm-editor/qt3/GPXParser2.h @ 16590

Last change on this file since 16590 was 1158, checked in by nick, 13 years ago

moved current version to qt3 directory in preparation for qt4

File size: 2.2 KB
Line 
1#ifndef GPXPARSER_H
2#define GPXPARSER_H
3
4/*
5    Copyright (C) 2006 Nick Whitelegg, Hogweed Software, nick@hogweed.org
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU Lesser General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU Lesser General Public License for more details.
16
17    You should have received a copy of the GNU Lesser General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
20
21 */
22
23// 19/03/05 convert to using the Qt XML parser. This might be seen to have
24// reusability issues but:
25//
26// a) Try as I might I could not get libxml++ to compile on Windows/MinGW.
27// Gave all sorts of weird linker errors that even posting to the libxml++
28// mailing list could not solve....
29//
30// b) The new Qt4 is modularising its components, so it will be possible to
31// link the XML bit only in a non GUI application
32//
33// c) Qt4 will be GPL for Windows, hence no issues on that platform.
34//
35// GPX parser
36// Returns a list of FreemapComponents, ready for Freemap software.
37// Licence LGPL
38
39#include <qxml.h>
40#include "Components2.h"
41
42namespace OpenStreetMap
43{
44
45class GPXParser2 : public QXmlDefaultHandler
46{
47private:
48        bool inDoc, inWpt, inTrk, inName, inTrkpt, 
49                inType,  inTime;
50        Components2* components;
51        QString curName, curType; 
52        double curLat, curLong;
53        QString curTimestamp; // 10/04/05 timestamp now string
54
55
56public:
57        bool startDocument();
58        bool endDocument();
59        bool startElement(const QString& , const QString&, const QString&,     
60                                                                        const QXmlAttributes&);
61        bool endElement(const QString&,const QString&, const QString&);
62        bool characters(const QString& characters);
63
64
65       
66        GPXParser2();
67        Components2* getComponents() const { return components; }
68
69        // it's the recipient of the components' responsibility to delete them!
70        ~GPXParser2() {} 
71};
72
73}
74
75#endif
Note: See TracBrowser for help on using the repository browser.