mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Ref T658, matching script web services wrapper
This commit is contained in:
committed by
Mat Sutcliffe
parent
6eb6cea9ad
commit
891d75598e
@@ -692,6 +692,11 @@ namespace BlackCore
|
||||
return CAircraftIcaoCode();
|
||||
}
|
||||
|
||||
int CWebDataServices::getAircraftIcaoCodesForDesignatorCount(const QString &designator) const
|
||||
{
|
||||
return this->getAircraftIcaoCodesForDesignator(designator).size();
|
||||
}
|
||||
|
||||
QSet<QString> CWebDataServices::getAircraftDesignatorsForAirline(const CAirlineIcaoCode &airline) const
|
||||
{
|
||||
if (!airline.hasValidDesignator()) { return QSet<QString>(); }
|
||||
@@ -948,6 +953,11 @@ namespace BlackCore
|
||||
return CAirlineIcaoCodeList();
|
||||
}
|
||||
|
||||
int CWebDataServices::getAirlineIcaoCodesForDesignatorCount(const QString &designator) const
|
||||
{
|
||||
return this->getAirlineIcaoCodesForDesignator(designator).size();
|
||||
}
|
||||
|
||||
void CWebDataServices::gracefulShutdown()
|
||||
{
|
||||
if (m_shuttingDown) { return; }
|
||||
|
||||
@@ -8,33 +8,33 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKCORE_WEB_DATASERVICES_H
|
||||
#define BLACKCORE_WEB_DATASERVICES_H
|
||||
#ifndef BLACKCORE_WEBDATASERVICES_H
|
||||
#define BLACKCORE_WEBDATASERVICES_H
|
||||
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
#include "blackcore/webreaderflags.h"
|
||||
#include "blackcore/db/databasereader.h"
|
||||
#include "blackcore/webreaderflags.h"
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
#include "blackmisc/simulation/aircraftmodel.h"
|
||||
#include "blackmisc/simulation/distributorlist.h"
|
||||
#include "blackmisc/simulation/distributor.h"
|
||||
#include "blackmisc/aviation/aircrafticaocodelist.h"
|
||||
#include "blackmisc/aviation/airlineicaocodelist.h"
|
||||
#include "blackmisc/aviation/airportlist.h"
|
||||
#include "blackmisc/aviation/airporticaocode.h"
|
||||
#include "blackmisc/aviation/atcstationlist.h"
|
||||
#include "blackmisc/aviation/liverylist.h"
|
||||
#include "blackmisc/countrylist.h"
|
||||
#include "blackmisc/network/ecosystemprovider.h"
|
||||
#include "blackmisc/network/serverlist.h"
|
||||
#include "blackmisc/network/urllist.h"
|
||||
#include "blackmisc/network/userlist.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
#include "blackmisc/network/voicecapabilities.h"
|
||||
#include "blackmisc/restricted.h"
|
||||
#include "blackmisc/simulation/aircraftmodel.h"
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
#include "blackmisc/simulation/distributor.h"
|
||||
#include "blackmisc/simulation/distributorlist.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
#include "blackmisc/weather/metar.h"
|
||||
#include "blackmisc/weather/metarlist.h"
|
||||
#include "blackmisc/weather/metar.h"
|
||||
#include "blackmisc/restricted.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
#include "blackmisc/countrylist.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QList>
|
||||
@@ -257,6 +257,10 @@ namespace BlackCore
|
||||
//! \threadsafe
|
||||
BlackMisc::Aviation::CAircraftIcaoCode getAircraftIcaoCodeForDesignator(const QString &designator) const;
|
||||
|
||||
//! ICAO code for designator count
|
||||
//! \threadsafe
|
||||
int getAircraftIcaoCodesForDesignatorCount(const QString &designator) const;
|
||||
|
||||
//! Aircraft ICAO designators for airline
|
||||
//! \threadsafe
|
||||
QSet<QString> getAircraftDesignatorsForAirline(const BlackMisc::Aviation::CAirlineIcaoCode &airline) const;
|
||||
@@ -317,10 +321,14 @@ namespace BlackCore
|
||||
//! \threadsafe
|
||||
int getAirlineIcaoCodesCount() const;
|
||||
|
||||
//! ICAO codes for designator
|
||||
//! Airline ICAO codes for designator
|
||||
//! \threadsafe
|
||||
BlackMisc::Aviation::CAirlineIcaoCodeList getAirlineIcaoCodesForDesignator(const QString &designator) const;
|
||||
|
||||
//! Airline ICAO codes for designator count
|
||||
//! \threadsafe
|
||||
int getAirlineIcaoCodesForDesignatorCount(const QString &designator) const;
|
||||
|
||||
//! ICAO code for id
|
||||
//! \threadsafe
|
||||
BlackMisc::Aviation::CAirlineIcaoCode getAirlineIcaoCodeForDbKey(int id) const;
|
||||
|
||||
34
src/blackcore/webdataservicesms.cpp
Normal file
34
src/blackcore/webdataservicesms.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/* Copyright (C) 2019
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated,
|
||||
* or distributed except according to the terms contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "webdataservicesms.h"
|
||||
#include "blackcore/webdataservices.h"
|
||||
#include "blackcore/application.h"
|
||||
#include "blackmisc/aviation/aircrafticaocodelist.h"
|
||||
|
||||
using namespace BlackMisc::Aviation;
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
int MSWebServices::countAircraftIcaoCodesForDesignator(const QString &designator) const
|
||||
{
|
||||
if (!checkApp()) { return 0; }
|
||||
return sApp->getWebDataServices()->getAircraftIcaoCodesForDesignatorCount(designator);
|
||||
}
|
||||
|
||||
int MSWebServices::countAirlineIcaoCodesForDesignator(const QString &designator) const
|
||||
{
|
||||
if (!checkApp()) { return 0; }
|
||||
return sApp->getWebDataServices()->getAirlineIcaoCodesForDesignatorCount(designator);
|
||||
}
|
||||
|
||||
bool MSWebServices::checkApp()
|
||||
{
|
||||
return (sApp && !sApp->isShuttingDown() && sApp->getWebDataServices());
|
||||
}
|
||||
} // ns
|
||||
44
src/blackcore/webdataservicesms.h
Normal file
44
src/blackcore/webdataservicesms.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/* Copyright (C) 2019
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated,
|
||||
* or distributed except according to the terms contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKCORE_WEBDATASERVICES_MATCHINGSCRIPT_H
|
||||
#define BLACKCORE_WEBDATASERVICES_MATCHINGSCRIPT_H
|
||||
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
/*!
|
||||
* Encapsulates reading data from web sources
|
||||
*/
|
||||
|
||||
//! Access to database
|
||||
class BLACKCORE_EXPORT MSWebServices : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Ctor
|
||||
Q_INVOKABLE MSWebServices() {}
|
||||
|
||||
//! Functions calling the web services @{
|
||||
Q_INVOKABLE int countAircraftIcaoCodesForDesignator(const QString &designator) const;
|
||||
Q_INVOKABLE int countAirlineIcaoCodesForDesignator(const QString &designator) const;
|
||||
//! @}
|
||||
|
||||
private:
|
||||
//! sApp available?
|
||||
static bool checkApp();
|
||||
};
|
||||
} // namespace
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user