1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00
GPXSee/src/parser.h

42 lines
1.1 KiB
C
Raw Normal View History

2015-10-05 01:43:48 +02:00
#ifndef PARSER_H
#define PARSER_H
#include <QXmlStreamReader>
#include <QVector>
#include <QList>
#include "trackpoint.h"
#include "waypoint.h"
2015-10-05 01:43:48 +02:00
class Parser
{
public:
2016-02-19 21:42:54 +01:00
Parser(QList<QVector<Trackpoint> > &tracks, QList<Waypoint> &waypoints)
: _tracks(tracks), _waypoints(waypoints) {_track = 0;}
bool loadFile(QIODevice *device);
QString errorString() const {return _reader.errorString();}
int errorLine() const {return _reader.lineNumber();}
2015-10-05 01:43:48 +02:00
private:
bool parse();
void gpx();
void track();
void trackPoints();
void extensions();
void trackPointData();
void wayPointData();
void handleWayPointAttributes(const QXmlStreamAttributes &attr);
void handleWayPointData(QStringRef element, const QString &value);
void handleTrekPointAttributes(const QXmlStreamAttributes &attr);
void handleTrekPointData(QStringRef element, const QString &value);
void handleExtensionData(QStringRef element, const QString &value);
2015-10-05 01:43:48 +02:00
QXmlStreamReader _reader;
2016-02-19 21:42:54 +01:00
QList<QVector<Trackpoint> > &_tracks;
QList<Waypoint> &_waypoints;
QVector<Trackpoint> *_track;
2015-10-05 01:43:48 +02:00
};
#endif // PARSER_H