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

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

moved current version to qt3 directory in preparation for qt4

File size: 1.9 KB
Line 
1#ifndef OSMPARSER_H
2#define OSMPARSER_H
3
4/*
5    Copyright (C) 2005 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#include <qxml.h>
24#include "Components2.h"
25#include "RouteMetaDataHandler.h"
26#include "NodeMetaDataHandler.h"
27
28#include <map>
29
30namespace OpenStreetMap
31{
32
33class OSMParser2 : public QXmlDefaultHandler
34{
35private:
36        bool inDoc, inNode, inSegment, inWay, inArea;
37        Components2* components;
38        std::map<int,Node*> readNodes;
39        std::map<int,Segment*> readSegments;
40        QString curName, curType, curRef;
41        int curID;
42        RouteMetaData metaData;
43        Way *curWay;
44        NodeMetaDataHandler nodeHandler;
45
46public:
47        bool startDocument();
48        bool endDocument();
49        bool startElement(const QString& , const QString&, const QString&,     
50                                                                        const QXmlAttributes&);
51        bool endElement(const QString&, const QString&,
52                                                        const QString& element);
53
54       
55        OSMParser2();
56        Components2* getComponents() const { return components; }
57
58        // it's the recipient of the components' responsibility to delete them!
59        ~OSMParser2() {} 
60        static void readSegTags(const QString &key, const QString& value,
61                                                        RouteMetaData&);
62        void readNodeTags(const QString& key, const QString& value,
63                                                                        QString& name,QString &type);
64};
65
66}
67
68#endif
Note: See TracBrowser for help on using the repository browser.