KPublicTransport

polylinedecoder.cpp
1 /*
2  SPDX-FileCopyrightText: 2021 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "polylinedecoder_p.h"
8 
9 using namespace KPublicTransport;
10 
11 int32_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...
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.