Skip to content

Commit

Permalink
Adding RMV.de for southern/central Hesse, Germany
Browse files Browse the repository at this point in the history
Adding support for Rhein-Main-Verkehrsverbund (RMV), the transport
network serving the Frankfurt metropolitan area in southern and
central Hesse, Germany.

The implementation is actually quite simple, as RMV uses HAFAS,
inheriting and specializing the existing ParserHafasXml class.
  • Loading branch information
thfi committed Jul 29, 2016
1 parent 67b8f65 commit 9377d3c
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fahrplan2.pro
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ HEADERS += \
src/parser/parser_munich_efa.h \
src/parser/parser_salzburg_efa.h \
src/parser/parser_resrobot.h \
src/parser/parser_xmlrmvde.h \
src/parser/parser_finland_matka.h \
src/models/backends.h
SOURCES += src/main.cpp \
Expand Down Expand Up @@ -156,6 +157,7 @@ SOURCES += src/main.cpp \
src/parser/parser_munich_efa.cpp \
src/parser/parser_salzburg_efa.cpp \
src/parser/parser_resrobot.cpp \
src/parser/parser_xmlrmvde.cpp \
src/parser/parser_finland_matka.cpp \
src/models/backends.cpp

Expand Down
1 change: 1 addition & 0 deletions src/fahrplan_backend_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ QStringList FahrplanBackendManager::getParserList()
result.append(ParserXmlSbbCh::getName());
result.append(ParserXmlNri::getName());
result.append(ParserXmlVasttrafikSe::getName());
result.append(ParserXmlRMVde::getName());
result.append(ParserPTVVicGovAu::getName());
result.append(ParserSydneyEFA::getName());
result.append(ParserSFBayEFA::getName());
Expand Down
3 changes: 3 additions & 0 deletions src/fahrplan_parser_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ void FahrplanParserThread::run()
case 15:
m_parser = new ParserFinlandMatka();
break;
case 16:
m_parser = new ParserXmlRMVde();
break;
}

m_name = m_parser->name();
Expand Down
1 change: 1 addition & 0 deletions src/fahrplan_parser_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "parser/parser_salzburg_efa.h"
#include "parser/parser_resrobot.h"
#include "parser/parser_finland_matka.h"
#include "parser/parser_xmlrmvde.h"

class FahrplanParserThread : public QThread
{
Expand Down
31 changes: 31 additions & 0 deletions src/parser/parser_xmlrmvde.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "parser_xmlrmvde.h"

#include <QNetworkReply>

ParserXmlRMVde::ParserXmlRMVde(QObject *parent) :
ParserHafasXml(parent)
{
baseXmlUrl = QLatin1String("http://www.rmv.de/auskunft/bin/jp/query.exe");
baseUrl = QLatin1String("http://www.rmv.de/auskunft/bin/jp/query.exe");
}

void ParserXmlRMVde::parseStationsByName(QNetworkReply *networkReply)
{
const QString data = QString::fromUtf8(networkReply->readAll());
const StationsList result = internalParseStationsByName(data);
emit stationsResult(result);
}

QString ParserXmlRMVde::getTrainRestrictionsCodes(int trainrestrictions)
{
Q_UNUSED(trainrestrictions)
// TODO should something else get returned?
return "1111111111111111";
}

QStringList ParserXmlRMVde::getTrainRestrictions()
{
QStringList result;
result.append(tr("All"));
return result;
}
41 changes: 41 additions & 0 deletions src/parser/parser_xmlrmvde.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/****************************************************************************
**
** This file is a part of Fahrplan.
**
** 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 2 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/>.
**
****************************************************************************/

#ifndef PARSER_XMLRMVDE_H
#define PARSER_XMLRMVDE_H

#include "parser_hafasxml.h"

class ParserXmlRMVde : public ParserHafasXml
{
Q_OBJECT

public:
explicit ParserXmlRMVde(QObject *parent = 0);
static QString getName() { return QString(QLatin1String("%1 (rmv.de)")).arg(tr("Germany, Hesse")); }
virtual QString name() { return getName(); }
virtual QString shortName() { return QLatin1String("rmv.de"); }

protected:
void parseStationsByName(QNetworkReply *networkReply);
QStringList getTrainRestrictions();
QString getTrainRestrictionsCodes(int trainrestrictions);
};

#endif // PARSER_XMLRMVDE_H

0 comments on commit 9377d3c

Please sign in to comment.