KPublicTransport

requestcontext.cpp
1/*
2 SPDX-FileCopyrightText: 2019 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "requestcontext_p.h"
8
9using namespace KPublicTransport;
10
11RequestContext::RequestContext() = default;
12RequestContext::~RequestContext() = default;
13
14bool RequestContext::operator==(const RequestContext &other) const
15{
16 return backend == other.backend
17 && type == other.type
18 && dateTime == other.dateTime
19 && backendData == other.backendData;
20}
21
22bool RequestContext::operator<(const AbstractBackend *other) const
23{
24 return backend < other;
25}
26
27void RequestContext::purgeLoops(std::vector<RequestContext> &contexts, const std::vector<RequestContext> &baseContexts)
28{
29 for (auto it = contexts.begin(); it != contexts.end();) {
30 const auto baseIt = std::lower_bound(baseContexts.begin(), baseContexts.end(), (*it).backend);
31 if (baseIt != baseContexts.end() && (*baseIt) == (*it)) {
32 it = contexts.erase(it);
33 } else {
34 ++it;
35 }
36 }
37}
Query operations and data types for accessing realtime public transport information from online servi...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:52 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.