1
0
mirror of git://projects.qi-hardware.com/nanomap.git synced 2025-01-23 05:31:06 +02:00
nanomap/monav/unicodetournamenttrie/unicodetournamenttrieclient.h
Niels f1a2430393 Revert "first try to fix building with OpenWRT toolchain that does not include QtCore and QtGui in the include path"
This reverts commit da88ec21cdbda458d04368292008126c3ebe5715.

This was not the right solution
2010-11-17 22:05:12 +01:00

80 lines
2.3 KiB
C++

/*
Copyright 2010 Christian Vetter veaac.fdirct@gmail.com
This file is part of MoNav.
MoNav is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
MoNav is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with MoNav. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UNICODETOURNAMENTTRIECLIENT_H
#define UNICODETOURNAMENTTRIECLIENT_H
#include <QObject>
#include <QtPlugin>
#include <QFile>
#include "interfaces/iaddresslookup.h"
#include "trie.h"
class UnicodeTournamentTrieClient : public QObject, public IAddressLookup
{
Q_OBJECT
Q_INTERFACES( IAddressLookup )
public:
explicit UnicodeTournamentTrieClient();
~UnicodeTournamentTrieClient();
virtual QString GetName();
virtual void SetInputDirectory( const QString& dir );
virtual void ShowSettings();
virtual bool LoadData();
virtual bool GetPlaceSuggestions( const QString& input, int amount, QStringList* suggestions, QStringList* inputSuggestions );
virtual bool GetStreetSuggestions( const QString& input, int amount, QStringList* suggestions, QStringList* inputSuggestions );
virtual bool SelectPlace( int placeID );
virtual bool GetPlaceData( QString input, QVector< int >* placeIDs, QVector< UnsignedCoordinate >* placeCoordinates );
virtual bool GetStreetData( QString input, QVector< int >* segmentLength, QVector< UnsignedCoordinate >* coordinates );
signals:
public slots:
protected:
struct Suggestion {
unsigned importance;
unsigned index;
QString prefix;
bool operator<( const Suggestion& right ) const {
return importance > right.importance;
}
};
void unload();
bool find( const char* trie, unsigned* resultNode, QString* missingPrefix, QString prefix );
int getSuggestion( const char* trie, QStringList* resultNames, unsigned node, int count, const QString prefix );
QString directory;
QFile* trieFile;
QFile* subTrieFile;
QFile* dataFile;
const char* trieData;
const char* subTrieData;
int placeID;
};
#endif // UNICODETOURNAMENTTRIECLIENT_H