Commit e354c250 authored by Volker Krause's avatar Volker Krause
Browse files

Allow parseTripPartialRoute to return more than one section

This will be needed for parsing transfer sections, which EFA attaches to
a preceding PT partial route element.
parent c30b4218
......@@ -295,9 +295,10 @@ struct {
{ 100, JourneySection::Walking },
};
JourneySection EfaXmlParser::parseTripPartialRoute(ScopedXmlStreamReader &&reader) const
std::vector<JourneySection> EfaXmlParser::parseTripPartialRoute(ScopedXmlStreamReader &&reader) const
{
JourneySection section;
std::vector<JourneySection> result = { JourneySection() };
auto &section = result[0];
if (reader.attributes().value(QLatin1String("type")) == QLatin1String("IT")) {
section.setMode(JourneySection::Walking);
}
......@@ -358,7 +359,7 @@ JourneySection EfaXmlParser::parseTripPartialRoute(ScopedXmlStreamReader &&reade
}
}
return section;
return result;
}
Journey EfaXmlParser::parseTripRoute(ScopedXmlStreamReader &&reader) const
......@@ -368,7 +369,8 @@ Journey EfaXmlParser::parseTripRoute(ScopedXmlStreamReader &&reader) const
while (reader.readNextElement()) {
if (reader.name() == QLatin1String("itdPartialRoute")) {
sections.push_back(parseTripPartialRoute(reader.subReader()));
auto sec = parseTripPartialRoute(reader.subReader());
std::move(sec.begin(), sec.end(), std::back_inserter(sections));
}
}
......
......@@ -37,7 +37,7 @@ private:
Stopover parsePartialTripIntermediateStop(ScopedXmlStreamReader &&reader) const;
std::vector<Stopover> parsePartialTripStopSequence(ScopedXmlStreamReader &&reader) const;
JourneySection parseTripPartialRoute(ScopedXmlStreamReader &&reader) const;
std::vector<JourneySection> parseTripPartialRoute(ScopedXmlStreamReader &&reader) const;
Journey parseTripRoute(ScopedXmlStreamReader &&reader) const;
QStringList parseInfoLink(ScopedXmlStreamReader &&reader) const;
Path parsePathCoordinates(ScopedXmlStreamReader &&reader) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment