KPublicTransport

rentalvehicleutil.cpp
1/*
2 SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "rentalvehicleutil_p.h"
8#include "rentalvehicle.h"
9
10using namespace KPublicTransport;
11
12RentalVehicleNetwork RentalVehicleUtil::merge(const RentalVehicleNetwork &lhs, const RentalVehicleNetwork &rhs)
13{
14 // TODO
15 return lhs.isValid() ? lhs : rhs;
16}
17
18RentalVehicleStation RentalVehicleUtil::merge(const RentalVehicleStation &lhs, const RentalVehicleStation &rhs)
19{
20 auto s = lhs;
21 s.setNetwork(RentalVehicleUtil::merge(lhs.network(), rhs.network()));
22 s.setCapacity(std::max(lhs.capacity(), rhs.capacity()));
23 s.setAvailableVehicles(std::max(lhs.availableVehicles(), rhs.availableVehicles()));
24 return s;
25}
26
27RentalVehicle RentalVehicleUtil::merge(const RentalVehicle &lhs, const RentalVehicle &rhs)
28{
29 auto v = lhs;
30 v.setNetwork(RentalVehicleUtil::merge(lhs.network(), rhs.network()));
31 v.setType(std::max(lhs.type(), rhs.type()));
32 return v;
33}
A vehicle sharing system/network.
bool isValid
Not an empty/default constructed object.
Additional information for a vehicle renting station, attached to Location objects.
KPublicTransport::RentalVehicleNetwork network
Sharing network operator.
int capacity
Number of dock positions at this station.
int availableVehicles
Number of available (rentable) vehicles at this station.
void setCapacity(RentalVehicle::VehicleType type, int capacity)
Set the capacity for a specific vehicle type.
An individual rental vehicle used on a JourneySection, ie.
KPublicTransport::RentalVehicleNetwork network
Sharing network operator.
VehicleType type
Vehicle type.
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.