KPublicTransport

requestcontext.cpp
1 /*
2  SPDX-FileCopyrightText: 2019 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "requestcontext_p.h"
8 
9 using namespace KPublicTransport;
10 
11 RequestContext::RequestContext() = default;
12 RequestContext::~RequestContext() = default;
13 
14 bool 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 
22 bool RequestContext::operator<(const AbstractBackend *other) const
23 {
24  return backend < other;
25 }
26 
27 void 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...
Definition: attribution.cpp:16
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 23 2021 23:05:21 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.