KPublicTransport

polylinedecoder.cpp
1/*
2 SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "polylinedecoder_p.h"
8
9using namespace KPublicTransport;
10
11int32_t PolylineDecoderBase::readNextIntNonDifferential()
12{
13 int32_t result = 0;
14 int shift = 0;
15 char c = 0;
16 do {
17 if (canReadMore()) {
18 c = *m_it;
19 ++m_it;
20 c -= 63;
21 result |= (c & 0b11111) << shift;
22 shift += 5;
23 } else {
24 return std::numeric_limits<int32_t>::max();
25 }
26 } while (c >= 0x20);
27
28 if (result & 1) {
29 result = ~result;
30 }
31 result >>= 1;
32 return result;
33}
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 Fri Nov 29 2024 11:57:19 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.