Commit 3ad04a31 authored by Volker Krause's avatar Volker Krause

API symmetry with the other xReply classes

parent dfcba74c
......@@ -117,13 +117,18 @@ JourneyRequest JourneyReply::request() const
return d->request;
}
std::vector<Journey> JourneyReply::journeys() const
const std::vector<Journey>& JourneyReply::result() const
{
Q_D(const JourneyReply);
// TODO avoid the copy here
return d->journeys;
}
std::vector<Journey>&& JourneyReply::takeResult()
{
Q_D(JourneyReply);
return std::move(d->journeys);
}
void JourneyReply::addResult(std::vector<Journey> &&res)
{
Q_D(JourneyReply);
......
......@@ -38,8 +38,10 @@ public:
/** The request this is the reply for. */
JourneyRequest request() const;
/** Returns the found journeys. */
std::vector<Journey> journeys() const;
/** Returns the retrieved journeys. */
const std::vector<Journey>& result() const;
/** Returns the retrieved journeys for moving elsewhere. */
std::vector<Journey>&& takeResult();
private:
friend class Manager;
......
......@@ -67,7 +67,7 @@ public:
emit loadingChanged();
if (reply->error() == JourneyReply::NoError) {
const auto res = reply->journeys();
const auto res = reply->result();
QVariantList l;
l.reserve(res.size());
std::transform(res.begin(), res.end(), std::back_inserter(l), [](const auto &journey) { return QVariant::fromValue(journey); });
......
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