mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
Ref T215, utility functions
* CServer * ICAO List
This commit is contained in:
@@ -185,6 +185,12 @@ namespace BlackMisc
|
||||
return codes.front();
|
||||
}
|
||||
|
||||
bool CAircraftIcaoCodeList::containsDesignator(const QString &designator) const
|
||||
{
|
||||
if (designator.isEmpty()) { return false; }
|
||||
return this->contains(&CAircraftIcaoCode::getDesignator, designator);
|
||||
}
|
||||
|
||||
void CAircraftIcaoCodeList::sortByRank()
|
||||
{
|
||||
this->sortBy(&CAircraftIcaoCode::getRank);
|
||||
|
||||
@@ -95,6 +95,9 @@ namespace BlackMisc
|
||||
//! Find by designator, then best match by rank
|
||||
CAircraftIcaoCode findFirstByDesignatorAndRank(const QString &designator) const;
|
||||
|
||||
//! Contains designator?
|
||||
bool containsDesignator(const QString &designator) const;
|
||||
|
||||
//! Best selection by given pattern, also searches IATA and family information
|
||||
CAircraftIcaoCode smartAircraftIcaoSelector(const CAircraftIcaoCode &icaoPattern) const;
|
||||
|
||||
|
||||
@@ -152,6 +152,11 @@ namespace BlackMisc
|
||||
return m_timestampMSecsSinceEpoch >= 0;
|
||||
}
|
||||
|
||||
bool CServer::isNull() const
|
||||
{
|
||||
return this->hasUnspecifiedServerType() && !this->hasName() && m_port < 0;
|
||||
}
|
||||
|
||||
CStatusMessageList CServer::validate() const
|
||||
{
|
||||
static const CLogCategoryList cats(CLogCategoryList(this).join({ CLogCategory::validation()}));
|
||||
|
||||
@@ -101,6 +101,9 @@ namespace BlackMisc
|
||||
//! Get name
|
||||
const QString &getName() const { return m_name; }
|
||||
|
||||
//! Has name?
|
||||
bool hasName() const { return !m_name.isEmpty(); }
|
||||
|
||||
//! Set name
|
||||
void setName(const QString &name) { m_name = name.trimmed(); }
|
||||
|
||||
@@ -176,6 +179,9 @@ namespace BlackMisc
|
||||
//! Is connected?
|
||||
bool isConnected() const;
|
||||
|
||||
//! NULL?
|
||||
bool isNull() const;
|
||||
|
||||
//! Validate, provide details about issues
|
||||
CStatusMessageList validate() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user