mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
refs #787, utility functions for shared files
* entity to shared file, shared file for DB Info * CUrl path function * removed redundant code in CDbInfo::getEntity() and fixed CEntityFlags::singleEntityByName
This commit is contained in:
@@ -144,12 +144,13 @@ namespace BlackMisc
|
||||
|
||||
CEntityFlags::Entity CEntityFlags::singleEntityByName(const QString &name)
|
||||
{
|
||||
// order here is crucial
|
||||
if (name.contains("model", Qt::CaseInsensitive)) { return ModelEntity; }
|
||||
if (name.contains("aircraft", Qt::CaseInsensitive)) { return AircraftIcaoEntity; }
|
||||
if (name.contains("airline", Qt::CaseInsensitive)) { return AirlineIcaoEntity; }
|
||||
if (name.contains("airport", Qt::CaseInsensitive)) { return AirportEntity; }
|
||||
if (name.contains("distributor", Qt::CaseInsensitive)) { return DistributorEntity; }
|
||||
if (name.contains("countr", Qt::CaseInsensitive)) { return CountryEntity; }
|
||||
if (name.contains("model", Qt::CaseInsensitive)) { return ModelEntity; }
|
||||
if (name.contains("liver", Qt::CaseInsensitive)) { return LiveryEntity; }
|
||||
return NoEntity;
|
||||
}
|
||||
|
||||
@@ -161,6 +161,11 @@ namespace BlackMisc
|
||||
return url;
|
||||
}
|
||||
|
||||
bool CUrl::pathEndsWith(const QString ending, Qt::CaseSensitivity cs) const
|
||||
{
|
||||
return m_path.endsWith(ending, cs);
|
||||
}
|
||||
|
||||
CUrl CUrl::withAppendedQuery(const QString &query) const
|
||||
{
|
||||
if (query.isEmpty()) { return *this; }
|
||||
|
||||
@@ -133,6 +133,9 @@ namespace BlackMisc
|
||||
//! Switch protocol
|
||||
CUrl withSwitchedScheme(const QString &protocol, int port) const;
|
||||
|
||||
//! Path ending with?
|
||||
bool pathEndsWith(const QString ending, Qt::CaseSensitivity cs = Qt::CaseInsensitive) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user