[Pkg-osm-commits] [SCM] monav branch, master, updated. debian/0.3-3-3-g5696af0

David Paleino dapal at debian.org
Wed Jun 22 19:50:44 UTC 2011


The following commit has been merged in the master branch:
commit 3cff042e2a3e992367e90844c2f93b86c0b86fc2
Author: David Paleino <dapal at debian.org>
Date:   Wed Jun 22 21:25:02 2011 +0200

    Backported GPSd interface implementation from upstream's bugtracker (06-implement_gpsd_interface.patch)

diff --git a/debian/changelog b/debian/changelog
index 45b7514..772fc79 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,10 @@
 monav (0.3-4) UNRELEASED; urgency=low
 
   * Drop -march=native from the compilation (Closes: #626671)
+  * Backported GPSd interface implementation from upstream's
+    bugtracker (06-implement_gpsd_interface.patch)
 
- -- David Paleino <dapal at debian.org>  Sat, 14 May 2011 16:03:46 +0200
+ -- David Paleino <dapal at debian.org>  Wed, 22 Jun 2011 21:20:31 +0200
 
 monav (0.3-3) unstable; urgency=low
 
diff --git a/debian/copyright b/debian/copyright
index 06e3819..5e7bc96 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -9,6 +9,15 @@ Files: client/fullscreenexitbutton.h
 Copyright: © 2009, Nokia Corporation and/or its subsidiary(-ies) <qt-info at nokia.com>
 License: LGPL-2.1 + Nokia Qt LGPL Exception 1.1
 
+Files: client/gpsdpositioninfosource.{cpp,h}
+Author: Till Harbaum <till at harbaum.org>
+License: PD
+
+Files: client/json.{cpp,h}
+Copyright: © 2010, Eeli Reilin <eeli at nilier.org>
+ © 2010, Mikko Ahonen <mikko.j.ahonen at jyu.fi>
+License: MIT
+
 Files: client/logger.{cpp,h}
 Copyright: © 2010, Christoph Eckert <ce at christeck.de>
 License: GPL-3+
@@ -132,3 +141,22 @@ License: LGPL-3+
 X-Comment: on Debian systems, the complete text of the GNU Lesser
  General Public License version 3 can be found in
  "/usr/share/common-licenses/LGPL-3".
+
+License: MIT
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ .
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
diff --git a/debian/patches/06-implement_gpsd_interface.patch b/debian/patches/06-implement_gpsd_interface.patch
new file mode 100644
index 0000000..b39dde2
--- /dev/null
+++ b/debian/patches/06-implement_gpsd_interface.patch
@@ -0,0 +1,882 @@
+From: bedlore at gmail.com
+Subject: implement GPSd interface in MoNav
+Origin: upstream, http://code.google.com/p/monav/issues/detail?id=39
+Forwarded: not-needed
+
+---
+ client/client.pro                 |    4 
+ client/gpsdpositioninfosource.cpp |  176 +++++++++++++++
+ client/gpsdpositioninfosource.h   |   46 ++++
+ client/json.cpp                   |  433 ++++++++++++++++++++++++++++++++++++++
+ client/json.h                     |  161 ++++++++++++++
+ client/routinglogic.cpp           |    4 
+ 6 files changed, 824 insertions(+)
+
+--- monav.orig/client/client.pro
++++ monav/client/client.pro
+@@ -27,6 +27,8 @@ SOURCES += main.cpp \
+     placechooser.cpp \
+     globalsettings.cpp \
+     streetchooser.cpp \
++    gpsdpositioninfosource.cpp \
++    json.cpp \
+     worldmapchooser.cpp
+ 
+ HEADERS += \
+@@ -57,6 +59,8 @@ HEADERS += \
+     placechooser.h \
+     globalsettings.h \
+     streetchooser.h \
++    json.h \
++    gpsdpositioninfosource.h \
+     worldmapchooser.h
+ 
+ FORMS += \
+--- monav.orig/client/routinglogic.cpp
++++ monav/client/routinglogic.cpp
+@@ -22,6 +22,7 @@ along with MoNav.  If not, see <http://w
+ #include "mapdata.h"
+ #include "utils/qthelpers.h"
+ #include "logger.h"
++#include "gpsdpositioninfosource.h"
+ 
+ #include <QtDebug>
+ #include <QSettings>
+@@ -66,6 +67,9 @@ RoutingLogic::RoutingLogic() :
+ 
+ #ifndef NOQTMOBILE
+ 	d->gpsSource = QGeoPositionInfoSource::createDefaultSource( this );
++	if ( d->gpsSource == NULL )
++		d->gpsSource = new GpsdPositionInfoSource( this );
++
+ 	if ( d->gpsSource == NULL ) {
+ 		qDebug() << "No GPS Sensor found! GPS Updates are not available";
+ 	} else {
+--- /dev/null
++++ monav/client/gpsdpositioninfosource.cpp
+@@ -0,0 +1,176 @@
++/****************************************************************************
++** GpsdPositionInfoSource
++** (c) 2011 by Till Harbaum <till at harbaum.org>
++** This code is public domain, do what you want with it
++****************************************************************************/
++
++// Based infos from:
++// http://gpsd.berlios.de/client-howto.html
++// http://doc.qt.nokia.com/qtmobility-1.0-tp/qgeopositioninfosource.html
++
++#include <QDebug>
++#include <QByteArray>
++#include <QStringList>
++#include <math.h>
++
++#include "gpsdpositioninfosource.h"
++#include "json.h"
++
++#ifndef NAN
++#define NAN (0.0/0.0)
++#endif
++
++qreal GpsdPositionInfoSource::getReal(const QMap<QString, QVariant> &map, const QString &name) {
++  // make sure that key exists
++  if(!map.contains(name)) return NAN;
++
++  QVariant variant = map.value(name);
++
++  // make sure value is variant of correkt type
++  if(QVariant::String != variant.type())
++    return NAN;
++
++  // extract string and convert to float
++  return variant.toString().toFloat();
++}
++
++void GpsdPositionInfoSource::setAttribute(QGeoPositionInfo &info,
++  QGeoPositionInfo::Attribute attr, const QMap<QString, QVariant> &map, const QString &name) {
++
++  qreal value = getReal(map, name);
++  if(!isnan(value)) info.setAttribute(attr, value);
++}
++
++void GpsdPositionInfoSource::parse(const QString &str) {
++  bool ok;
++
++  // feed reply into json parser
++
++  // json is a QString containing the data to convert
++  QVariant result = Json::parse(str, ok);
++  if(!ok) {
++    qDebug() << __FUNCTION__ << "Json deconding failed.";
++    return;
++  }
++
++  // we expect a qvariantmap
++  if(QVariant::Map != result.type()) {
++    qDebug() << __FUNCTION__ << "Unexpected result type:" << result.type();
++    return;
++  }
++
++  QMap<QString, QVariant> map = result.toMap();
++
++  // extract reply class
++  QString classStr = map.value("class").toString();
++
++  if(!classStr.compare("VERSION")) {
++    qDebug() << "Connected to GPSD:";
++    qDebug() << "Release:" << map.value("release").toString();
++    qDebug() << "Revision:" << map.value("rev").toString();
++    qDebug() << "Protocol version:" <<
++      map.value("proto_major").toString() + "." +
++      map.value("proto_minor").toString();
++
++  } else if(!classStr.compare("TPV")) {
++    // TPV is the most interesting string for us
++    m_lastKnown = QGeoPositionInfo();
++
++    int mode = map.value("mode").toInt();
++    if(mode > 0) {
++      QGeoCoordinate coo(getReal(map, "lat"), getReal(map, "lon"));
++      if(mode == 3)
++	coo.setAltitude(getReal(map, "alt"));
++
++      m_lastKnown.setCoordinate(coo);
++    }
++
++    setAttribute(m_lastKnown, QGeoPositionInfo::Direction, map, "track");
++    setAttribute(m_lastKnown, QGeoPositionInfo::VerticalSpeed, map, "climb");
++    setAttribute(m_lastKnown, QGeoPositionInfo::GroundSpeed, map, "speed");
++    setAttribute(m_lastKnown, QGeoPositionInfo::VerticalAccuracy, map, "epv");
++
++    // horizontal error in lat or long
++    qreal epx = getReal(map, "epx");
++    qreal epy = getReal(map, "epy");
++
++    if(!isnan(epx) && !isnan(epy))
++      m_lastKnown.setAttribute(QGeoPositionInfo::HorizontalAccuracy, epx>epy?epx:epy);
++
++    QDateTime time;
++    time.setTime_t(getReal(map, "time"));
++    m_lastKnown.setTimestamp(time);
++
++    emit positionUpdated( m_lastKnown );
++  }
++}
++
++void GpsdPositionInfoSource::readData() {
++
++  // split reply into seperate strings at newline
++  QStringList data = QString::fromUtf8(m_tcpSocket->readAll()).split('\n');
++
++  for(int i=0;i<data.size();i++)
++    if(!data[i].trimmed().isEmpty())
++      parse(data[i].trimmed());
++}
++
++void GpsdPositionInfoSource::displayError(QAbstractSocket::SocketError) {
++  qDebug() << __FUNCTION__ << "Error: " << m_tcpSocket->errorString();
++}
++
++GpsdPositionInfoSource::GpsdPositionInfoSource(QObject *parent)
++  : QGeoPositionInfoSource(parent) {
++  qDebug() << __FUNCTION__;
++
++  // connect to gpsd
++  m_tcpSocket = new QTcpSocket(this);
++
++  connect(m_tcpSocket, SIGNAL(readyRead()), this, SLOT(readData()));
++  connect(m_tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)),
++	  this, SLOT(displayError(QAbstractSocket::SocketError)));
++
++  m_tcpSocket->connectToHost("localhost", 2947);
++}
++
++GpsdPositionInfoSource::~GpsdPositionInfoSource() {
++  qDebug() << __FUNCTION__;
++
++  m_tcpSocket->close();
++}
++
++void GpsdPositionInfoSource::setUpdateInterval(int msec) {
++  int interval = msec;
++  if (interval != 0)
++    interval = qMax(msec, minimumUpdateInterval());
++  QGeoPositionInfoSource::setUpdateInterval(interval);
++}
++
++void GpsdPositionInfoSource::startUpdates() {
++  // request info from gpsd
++  QString request = "?WATCH={\"enable\":true,\"json\":true}";
++  m_tcpSocket->write(request.toUtf8());
++}
++
++void GpsdPositionInfoSource::stopUpdates() {
++  // ask gpsd to stop sending data
++  QString request = "?WATCH={\"enable\":false}";
++  m_tcpSocket->write(request.toUtf8());
++}
++
++void GpsdPositionInfoSource::requestUpdate(int) {
++  emit positionUpdated( m_lastKnown );
++}
++
++QGeoPositionInfo GpsdPositionInfoSource::lastKnownPosition(bool) const {
++  // the bool value does not matter since we only use satellite positioning
++  return m_lastKnown;
++}
++
++QGeoPositionInfoSource::PositioningMethods GpsdPositionInfoSource::supportedPositioningMethods() const {
++  return SatellitePositioningMethods;
++}
++
++int GpsdPositionInfoSource::minimumUpdateInterval() const {
++  return 1000;
++}
+--- /dev/null
++++ monav/client/gpsdpositioninfosource.h
+@@ -0,0 +1,46 @@
++/****************************************************************************
++** GpsdPositionInfoSource
++** (c) 2011 by Till Harbaum <till at harbaum.org>
++** This code is public domain, do what you want with it
++****************************************************************************/
++
++#ifndef GPSDPOSITIONINFOSOURCE_H
++#define GPSDPOSITIONINFOSOURCE_H
++
++#include <QObject>
++#include <QTcpSocket>
++#include <QGeoPositionInfoSource>
++
++QTM_USE_NAMESPACE
++
++class GpsdPositionInfoSource : public QGeoPositionInfoSource {
++    Q_OBJECT
++
++ public:
++  GpsdPositionInfoSource(QObject *parent = 0);
++  ~GpsdPositionInfoSource();
++
++  void setUpdateInterval(int msec);
++
++  QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const;
++  PositioningMethods supportedPositioningMethods() const;
++  int minimumUpdateInterval() const;
++
++ public slots:
++  void startUpdates();
++  void stopUpdates();
++  void requestUpdate(int timeout = 0);
++
++ private slots:
++  void readData();
++  void displayError(QAbstractSocket::SocketError);
++
++ private:
++  qreal getReal(const QMap<QString, QVariant> &, const QString &);
++  void setAttribute(QGeoPositionInfo &, QGeoPositionInfo::Attribute, const QMap<QString, QVariant> &, const QString &);
++  void parse(const QString &);
++  QTcpSocket *m_tcpSocket;
++  QGeoPositionInfo m_lastKnown;
++};
++
++#endif
+--- /dev/null
++++ monav/client/json.cpp
+@@ -0,0 +1,433 @@
++
++/**
++ * \file json.cpp
++ *
++ * \author Eeli Reilin <eeli at nilier.org>,
++ *         Mikko Ahonen <mikko.j.ahonen at jyu.fi>
++ * \version 0.1
++ * \date 8/25/2010
++ *
++ * licensed under the MIT/X11 license
++ * (http://nilier.blogspot.com/2010/08/json-parser-class-for-qt.html)
++ *
++ */
++
++#include <QDebug>
++
++#include "json.h"
++
++/**
++ * parse
++ */
++QVariant Json::parse(const QString &json)
++{
++	bool success = true;
++	return Json::parse(json, success);
++}
++
++/**
++ * parse
++ */
++QVariant Json::parse(const QString &json, bool &success)
++{
++	success = true;
++
++	//Return an empty QVariant if the JSON data is either null or empty
++	if(!json.isNull() || !json.isEmpty())
++	{
++		QString data = json;
++		//We'll start from index 0
++		int index = 0;
++
++		//Parse the first value
++		QVariant value = Json::parseValue(data, index, success);
++
++		//Return the parsed value
++		return value;
++	}
++	else
++	{
++		//Return the empty QVariant
++		return QVariant();
++	}
++}
++
++/**
++ * parseValue
++ */
++QVariant Json::parseValue(const QString &json, int &index, bool &success)
++{
++	//Determine what kind of data we should parse by
++	//checking out the upcoming token
++	switch(Json::lookAhead(json, index))
++	{
++		case JsonTokenString:
++			return Json::parseString(json, index, success);
++		case JsonTokenNumber:
++			return Json::parseNumber(json, index);
++		case JsonTokenCurlyOpen:
++			return Json::parseObject(json, index, success);
++		case JsonTokenSquaredOpen:
++			return Json::parseArray(json, index, success);
++		case JsonTokenTrue:
++			Json::nextToken(json, index);
++			return QVariant(true);
++		case JsonTokenFalse:
++			Json::nextToken(json, index);
++			return QVariant(false);
++		case JsonTokenNull:
++			Json::nextToken(json, index);
++			return QVariant();
++		case JsonTokenNone:
++			break;
++	}
++
++	//If there were no tokens, flag the failure and return an empty QVariant
++	success = false;
++	return QVariant();
++}
++
++/**
++ * parseObject
++ */
++QVariant Json::parseObject(const QString &json, int &index, bool &success)
++{
++	QVariantMap map;
++	int token;
++
++	//Get rid of the whitespace and increment index
++	Json::nextToken(json, index);
++
++	//Loop through all of the key/value pairs of the object
++	bool done = false;
++	while(!done)
++	{
++		//Get the upcoming token
++		token = Json::lookAhead(json, index);
++
++		if(token == JsonTokenNone)
++		{
++			 success = false;
++			 return QVariantMap();
++		}
++		else if(token == JsonTokenComma)
++		{
++			Json::nextToken(json, index);
++		}
++		else if(token == JsonTokenCurlyClose)
++		{
++			Json::nextToken(json, index);
++			return map;
++		}
++		else
++		{
++			//Parse the key/value pair's name
++			QString name = Json::parseString(json, index, success).toString();
++
++			if(!success)
++			{
++				return QVariantMap();
++			}
++
++			//Get the next token
++			token = Json::nextToken(json, index);
++
++			//If the next token is not a colon, flag the failure
++			//return an empty QVariant
++			if(token != JsonTokenColon)
++			{
++				success = false;
++				return QVariant(QVariantMap());
++			}
++
++			//Parse the key/value pair's value
++			QVariant value = Json::parseValue(json, index, success);
++
++			if(!success)
++			{
++				return QVariantMap();
++			}
++
++			//Assign the value to the key in the map
++			map[name] = value;
++		}
++	}
++
++	//Return the map successfully
++	return QVariant(map);
++}
++
++/**
++ * parseArray
++ */
++QVariant Json::parseArray(const QString &json, int &index, bool &success)
++{
++	QVariantList list;
++
++	Json::nextToken(json, index);
++
++	bool done = false;
++	while(!done)
++	{
++		int token = Json::lookAhead(json, index);
++
++		if(token == JsonTokenNone)
++		{
++			success = false;
++			return QVariantList();
++		}
++		else if(token == JsonTokenComma)
++		{
++			Json::nextToken(json, index);
++		}
++		else if(token == JsonTokenSquaredClose)
++		{
++			Json::nextToken(json, index);
++			break;
++		}
++		else
++		{
++			QVariant value = Json::parseValue(json, index, success);
++
++			if(!success)
++			{
++				return QVariantList();
++			}
++
++			list.push_back(value);
++		}
++	}
++
++	return QVariant(list);
++}
++
++/**
++ * parseString
++ */
++QVariant Json::parseString(const QString &json, int &index, bool &success)
++{
++	QString s;
++	QChar c;
++
++	Json::eatWhitespace(json, index);
++
++	c = json[index++];
++
++	bool complete = false;
++	while(!complete)
++	{
++		if(index == json.size())
++		{
++			break;
++		}
++
++		c = json[index++];
++
++		if(c == '\"')
++		{
++			complete = true;
++			break;
++		}
++		else if(c == '\\')
++		{
++			if(index == json.size())
++			{
++				break;
++			}
++
++			c = json[index++];
++
++			if(c == '\"')
++			{
++				s.append('\"');
++			}
++			else if(c == '\\')
++			{
++				s.append('\\');
++			}
++			else if(c == '/')
++			{
++				s.append('/');
++			}
++			else if(c == 'b')
++			{
++				s.append('\b');
++			}
++			else if(c == 'f')
++			{
++				s.append('\f');
++			}
++			else if(c == 'n')
++			{
++				s.append('\n');
++			}
++			else if(c == 'r')
++			{
++				s.append('\r');
++			}
++			else if(c == 't')
++			{
++				s.append('\t');
++			}
++			else if(c == 'u')
++			{
++				int remainingLength = json.size() - index;
++
++				if(remainingLength >= 4)
++				{
++					QString unicodeStr = json.mid(index, 4);
++
++					int symbol = unicodeStr.toInt(0, 16);
++
++					s.append(QChar(symbol));
++
++					index += 4;
++				}
++				else
++				{
++					break;
++				}
++			}
++		}
++		else
++		{
++			s.append(c);
++		}
++	}
++
++	if(!complete)
++	{
++		success = false;
++		return QVariant();
++	}
++
++	return QVariant(s);
++}
++
++/**
++ * parseNumber
++ */
++QVariant Json::parseNumber(const QString &json, int &index)
++{
++	Json::eatWhitespace(json, index);
++
++	int lastIndex = Json::lastIndexOfNumber(json, index);
++	int charLength = (lastIndex - index) + 1;
++	QString numberStr;
++
++	numberStr = json.mid(index, charLength);
++
++	index = lastIndex + 1;
++
++	return QVariant(numberStr);
++}
++
++/**
++ * lastIndexOfNumber
++ */
++int Json::lastIndexOfNumber(const QString &json, int index)
++{
++	int lastIndex;
++
++	for(lastIndex = index; lastIndex < json.size(); lastIndex++)
++	{
++		if(QString("0123456789+-.eE").indexOf(json[lastIndex]) == -1)
++		{
++			break;
++		}
++	}
++
++	return lastIndex -1;
++}
++
++/**
++ * eatWhitespace
++ */
++void Json::eatWhitespace(const QString &json, int &index)
++{
++	for(; index < json.size(); index++)
++	{
++		if(QString(" \t\n\r").indexOf(json[index]) == -1)
++		{
++			break;
++		}
++	}
++}
++
++/**
++ * lookAhead
++ */
++int Json::lookAhead(const QString &json, int index)
++{
++	int saveIndex = index;
++	return Json::nextToken(json, saveIndex);
++}
++
++/**
++ * nextToken
++ */
++int Json::nextToken(const QString &json, int &index)
++{
++	Json::eatWhitespace(json, index);
++
++	if(index == json.size())
++	{
++		return JsonTokenNone;
++	}
++
++	QChar c = json[index];
++	index++;
++	switch(c.toAscii())
++	{
++		case '{': return JsonTokenCurlyOpen;
++		case '}': return JsonTokenCurlyClose;
++		case '[': return JsonTokenSquaredOpen;
++		case ']': return JsonTokenSquaredClose;
++		case ',': return JsonTokenComma;
++		case '"': return JsonTokenString;
++		case '0': case '1': case '2': case '3': case '4':
++		case '5': case '6': case '7': case '8': case '9':
++		case '-': return JsonTokenNumber;
++		case ':': return JsonTokenColon;
++	}
++
++	index--;
++
++	int remainingLength = json.size() - index;
++
++	//True
++	if(remainingLength >= 4)
++	{
++		if (json[index] == 't' && json[index + 1] == 'r' &&
++			json[index + 2] == 'u' && json[index + 3] == 'e')
++		{
++			index += 4;
++			return JsonTokenTrue;
++		}
++	}
++
++	//False
++	if (remainingLength >= 5)
++	{
++		if (json[index] == 'f' && json[index + 1] == 'a' &&
++			json[index + 2] == 'l' && json[index + 3] == 's' &&
++			json[index + 4] == 'e')
++		{
++			index += 5;
++			return JsonTokenFalse;
++		}
++	}
++
++	//Null
++	if (remainingLength >= 4)
++	{
++		if (json[index] == 'n' && json[index + 1] == 'u' &&
++			json[index + 2] == 'l' && json[index + 3] == 'l')
++		{
++			index += 4;
++			return JsonTokenNull;
++		}
++	}
++
++	return JsonTokenNone;
++}
+--- /dev/null
++++ monav/client/json.h
+@@ -0,0 +1,161 @@
++/**
++ * \file json.h
++ *
++ * \author Eeli Reilin <eeli at nilier.org>,
++ *         Mikko Ahonen <mikko.j.ahonen at jyu.fi>
++ * \version 0.1
++ * \date 8/25/2010
++ *
++ * licensed under the MIT/X11 license
++ * (http://nilier.blogspot.com/2010/08/json-parser-class-for-qt.html)
++ *
++ */
++
++#ifndef JSON_H
++#define JSON_H
++
++#include <QVariant>
++#include <QString>
++
++/**
++ * \enum JsonToken
++ */
++enum JsonToken
++{
++	JsonTokenNone = 0,
++	JsonTokenCurlyOpen = 1,
++	JsonTokenCurlyClose = 2,
++	JsonTokenSquaredOpen = 3,
++	JsonTokenSquaredClose = 4,
++	JsonTokenColon = 5,
++	JsonTokenComma = 6,
++	JsonTokenString = 7,
++	JsonTokenNumber = 8,
++	JsonTokenTrue = 9,
++	JsonTokenFalse = 10,
++	JsonTokenNull = 11
++};
++
++/**
++ * \class Json
++ * \brief A JSON data parser
++ *
++ * Json parses a JSON data into a QVariant hierarchy.
++ */
++class Json
++{
++	public:
++		/**
++		 * Parse a JSON string
++		 *
++		 * \param json The JSON data
++		 */
++		static QVariant parse(const QString &json);
++
++		/**
++		 * Parse a JSON string
++		 *
++		 * \param json The JSON data
++		 * \param success The success of the parsing
++		 */
++		static QVariant parse(const QString &json, bool &success);
++
++	private:
++		/**
++		 * Parses a value starting from index
++		 *
++		 * \param json The JSON data
++		 * \param index The start index
++		 * \param success The success of the parse process
++		 *
++		 * \return QVariant The parsed value
++		 */
++		static QVariant parseValue(const QString &json, int &index,
++								   bool &success);
++
++		/**
++		 * Parses an object starting from index
++		 *
++		 * \param json The JSON data
++		 * \param index The start index
++		 * \param success The success of the object parse
++		 *
++		 * \return QVariant The parsed object map
++		 */
++		static QVariant parseObject(const QString &json, int &index,
++									   bool &success);
++
++		/**
++		 * Parses an array starting from index
++		 *
++		 * \param json The JSON data
++		 * \param index The starting index
++		 * \param success The success of the array parse
++		 *
++		 * \return QVariant The parsed variant array
++		 */
++		static QVariant parseArray(const QString &json, int &index,
++									   bool &success);
++
++		/**
++		 * Parses a string starting from index
++		 *
++		 * \param json The JSON data
++		 * \param index The starting index
++		 * \param success The success of the string parse
++		 *
++		 * \return QVariant The parsed string
++		 */
++		static QVariant parseString(const QString &json, int &index,
++									bool &success);
++
++		/**
++		 * Parses a number starting from index
++		 *
++		 * \param json The JSON data
++		 * \param index The starting index
++		 *
++		 * \return QVariant The parsed number
++		 */
++		static QVariant parseNumber(const QString &json, int &index);
++
++		/**
++		 * Get the last index of a number starting from index
++		 *
++		 * \param json The JSON data
++		 * \param index The starting index
++		 *
++		 * \return The last index of the number
++		 */
++		static int lastIndexOfNumber(const QString &json, int index);
++
++		/**
++		 * Skip unwanted whitespace symbols starting from index
++		 *
++		 * \param json The JSON data
++		 * \param index The start index
++		 */
++		static void eatWhitespace(const QString &json, int &index);
++
++		/**
++		 * Check what token lies ahead
++		 *
++		 * \param json The JSON data
++		 * \param index The starting index
++		 *
++		 * \return int The upcoming token
++		 */
++		static int lookAhead(const QString &json, int index);
++
++		/**
++		 * Get the next JSON token
++		 *
++		 * \param json The JSON data
++		 * \param index The starting index
++		 *
++		 * \return int The next JSON token
++		 */
++		static int nextToken(const QString &json, int &index);
++};
++
++#endif //JSON_H
diff --git a/debian/patches/series b/debian/patches/series
index e3db94b..fb1f079 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@
 03-dont_embed_resources.patch
 04-fix_typos.patch
 05-drop_marchnative.patch
+06-implement_gpsd_interface.patch

-- 
fast navigation system featuring exact routing



More information about the Pkg-osm-commits mailing list