swift
Public Types | Public Member Functions | Static Public Member Functions | List of all members
swift::misc::aviation::CAirlineIcaoCode Class Reference

Value object for ICAO classification. More...

Inheritance diagram for swift::misc::aviation::CAirlineIcaoCode:
[legend]

Public Types

enum  ColumnIndex {
  IndexAirlineDesignator = CPropertyIndexRef::GlobalIndexCAirlineIcaoCode , IndexIataCode , IndexAirlineName , IndexAirlineCountryIso ,
  IndexAirlineCountry , IndexTelephonyDesignator , IndexGroupId , IndexGroupName ,
  IndexGroupDesignator , IndexIsVirtualAirline , IndexIsOperating , IndexIsMilitary ,
  IndexDesignatorNameCountry
}
 Properties by index.
 
- Public Types inherited from swift::misc::CValueObject< CAirlineIcaoCode >
using base_type = CEmpty
 Base class.
 
- Public Types inherited from swift::misc::CEmpty
using base_type = CEmpty
 Base class is alias of itself.
 
- Public Types inherited from swift::misc::mixin::Index< Derived >
enum  ColumnIndex { IndexPixmap = 10 , IndexIcon , IndexString }
 Base class enums.
 
- Public Types inherited from swift::misc::db::IDatastoreObjectWithIntegerKey
enum  ColumnIndex {
  IndexDbIntegerKey = CPropertyIndexRef::GlobalIndexIDatastoreInteger , IndexDbKeyAsString , IndexIsLoadedFromDb , IndexDatabaseIcon ,
  IndexVersion , IndexEndMarker
}
 Property index. More...
 
- Public Types inherited from swift::misc::ITimestampBased
enum  ColumnIndex {
  IndexUtcTimestamp = CPropertyIndexRef::GlobalIndexITimestampBased , IndexUtcTimestampFormattedYmdhms , IndexUtcTimestampFormattedYmdhmsz , IndexUtcTimestampFormattedMdhms ,
  IndexUtcTimestampFormattedMdhmsz , IndexUtcTimestampFormattedDhms , IndexUtcTimestampFormattedHms , IndexUtcTimestampFormattedHm ,
  IndexMSecsSinceEpoch
}
 Properties by index.
 

Public Member Functions

 CAirlineIcaoCode ()=default
 Default constructor.
 
 CAirlineIcaoCode (const QString &airlineDesignator)
 Constructor.
 
 CAirlineIcaoCode (const QString &airlineDesignator, const QString &airlineName, const CCountry &country, const QString &telephony, bool virtualAirline, bool operating)
 Constructor.
 
const QString & getDesignator () const
 Get airline, e.g. "DLH".
 
QString getVDesignator () const
 Get airline, e.g. "DLH", but "VMVA" for virtual airlines.
 
QString getVDesignatorDbKey () const
 Get VDesignator plus key.
 
void setDesignator (const QString &icaoDesignator)
 Set airline, e.g. "DLH".
 
const QString & getIataCode () const
 IATA code.
 
void setIataCode (const QString &iataCode)
 Set IATA code.
 
const QString & getCountryIso () const
 Get country, e.g. "FR".
 
const CCountrygetCountry () const
 Get country, e.g. "FRANCE".
 
QString getDesignatorDbKey () const
 Designator and DB key.
 
QString getDesignatorNameCountry () const
 Combined string designator, name, country.
 
void setCountry (const CCountry &country)
 Set country.
 
const QString & getName () const
 Get name, e.g. "Lufthansa".
 
QString getSimplifiedName () const
 Get a simplified upper case name for searching by removing all characters except A-Z. More...
 
QString getNameWithKey () const
 Name plus key, e.g. "Lufthansa (3421)".
 
void setName (const QString &name)
 Set name.
 
const QString & getTelephonyDesignator () const
 Telephony designator such as "Speedbird".
 
void setTelephonyDesignator (const QString &telephony)
 Telephony designator such as "Speedbird".
 
const QString & getGroupDesignator () const
 Group designator.
 
void setGroupDesignator (const QString &designator)
 Group designator.
 
const QString & getGroupName () const
 Group name.
 
void setGroupName (const QString &name)
 Group name.
 
int getGroupId () const
 Group id.
 
void setGroupId (int id)
 Group id.
 
bool hasGroupMembership () const
 Are we a member of a group?
 
bool isVirtualAirline () const
 Virtual airline.
 
void setVirtualAirline (bool va)
 Virtual airline.
 
bool isOperating () const
 Operating?
 
void setOperating (bool operating)
 Operating airline?
 
bool isMilitary () const
 Military, air force or such?
 
void setMilitary (bool military)
 Military, air force or such?
 
bool hasValidCountry () const
 Country?
 
bool hasValidDesignator () const
 Airline designator available?
 
bool hasIataCode () const
 IATA code?
 
bool matchesDesignator (const QString &designator) const
 Matches designator string?
 
bool matchesVDesignator (const QString &designator) const
 Matches v-designator string?
 
bool matchesIataCode (const QString &iata) const
 Matches IATA code?
 
bool matchesDesignatorOrIataCode (const QString &candidate) const
 Matches IATA code or designator?
 
bool matchesVDesignatorOrIataCode (const QString &candidate) const
 Matches IATA code or v-designator?
 
bool matchesTelephonyDesignator (const QString &candidate) const
 Matches telephony designator (aka callsign, not to be confused with CCallsign)
 
bool matchesNamesOrTelephonyDesignator (const QString &candidate) const
 Relaxed check by name or telephony designator (aka callsign, not to be confused with CCallsign)
 
bool isContainedInSimplifiedName (const QString &candidate) const
 Does simplified name contain the candidate.
 
bool hasTelephonyDesignator () const
 Telephony designator?
 
bool hasName () const
 Has (airline) name?
 
bool hasSimplifiedName () const
 Has simplified airline name?
 
bool hasCompleteData () const
 Complete data.
 
QString getCombinedStringWithKey () const
 Comined string with key.
 
CAirlineIcaoCode thisOrCallsignCode (const CCallsign &callsign) const
 What is better, the callsign airline code or this code. Return the better one.
 
CIcons::IconIndex toIcon () const
 As icon, not implemented by all classes. More...
 
QString convertToQString (bool i18n=false) const
 Cast as QString. More...
 
QVariant propertyByIndex (CPropertyIndexRef index) const
 Property by index. More...
 
void setPropertyByIndex (CPropertyIndexRef index, const QVariant &variant)
 Set property by index. More...
 
int comparePropertyByIndex (CPropertyIndexRef index, const CAirlineIcaoCode &compareValue) const
 Compare for index. More...
 
CStatusMessageList validate () const
 Validate data.
 
void updateMissingParts (const CAirlineIcaoCode &otherIcaoCode)
 Update missing parts.
 
QString asHtmlSummary () const
 As a brief HTML summary (e.g. used in tooltips)
 
int calculateScore (const CAirlineIcaoCode &otherCode, CStatusMessageList *log=nullptr) const
 Score against other code 0..100.
 
bool isNull () const
 Null ICAO?
 
- Public Member Functions inherited from swift::misc::mixin::MetaType< Derived >
int getMetaTypeId () const
 Returns the Qt meta type ID of this object. More...
 
QString getClassName () const
 Class name.
 
bool isA (int metaTypeId) const
 Returns true if this object is an instance of the class with the given meta type ID, or one of its subclasses.
 
- Public Member Functions inherited from swift::misc::mixin::DBusByMetaClass< Derived, Tags >
void marshallToDbus (QDBusArgument &arg, Tags...) const
 Marshall without begin/endStructure, for when composed within another object.
 
void unmarshallFromDbus (const QDBusArgument &arg, Tags...)
 Unmarshall without begin/endStructure, for when composed within another object.
 
- Public Member Functions inherited from swift::misc::mixin::DataStreamByMetaClass< Derived >
void marshalToDataStream (QDataStream &stream) const
 Marshal a value to a QDataStream.
 
void unmarshalFromDataStream (QDataStream &stream)
 Unmarshal a value from a QDataStream.
 
- Public Member Functions inherited from swift::misc::mixin::JsonByMetaClass< Derived >
QJsonObject toJson () const
 Cast to JSON object.
 
QString toJsonString (QJsonDocument::JsonFormat format=QJsonDocument::Indented) const
 Convenience function JSON as string.
 
void convertFromJson (const QJsonObject &json)
 Assign from JSON object.
 
void convertFromJson (const QString &jsonString, bool acceptCacheFormat=false)
 Assign from JSON object string.
 
- Public Member Functions inherited from swift::misc::mixin::String< Derived >
QString toQString (bool i18n=false) const
 Cast as QString.
 
std::string toStdString (bool i18n=false) const
 To std string.
 
QString stringForStreaming () const
 String for streaming operators.
 
- Public Member Functions inherited from swift::misc::mixin::Index< Derived >
CPropertyIndexList apply (const CPropertyIndexVariantMap &indexMap, bool skipEqualValues=false)
 Update by variant map. More...
 
void setPropertyByIndex (CPropertyIndexRef index, const QVariant &variant)
 Set property by index.
 
QVariant propertyByIndex (CPropertyIndexRef index) const
 Property by index.
 
int comparePropertyByIndex (CPropertyIndexRef index, const Derived &compareValue) const
 Compare for index.
 
bool equalsPropertyByIndex (const QVariant &compareValue, CPropertyIndexRef index) const
 Is given variant equal to value of property index?
 
- Public Member Functions inherited from swift::misc::mixin::Icon< Derived, IconIndex >
CIcons::IconIndex toIcon () const
 As icon, not implemented by all classes.
 
- Public Member Functions inherited from swift::misc::db::IDatastoreObjectWithIntegerKey
int getDbKey () const
 Get DB key.
 
QString getDbKeyAsString () const
 DB key as string.
 
QJsonValue getDbKeyAsJsonValue () const
 Key as JSON value, or null.
 
QString getDbKeyAsStringInParentheses (const QString &prefix={}) const
 Db key in parentheses, e.g. "(3)".
 
void setDbKey (int key)
 Set the DB key.
 
void setDbKey (const QString &key)
 DB key passed as string.
 
bool hasValidDbKey () const
 Has valid DB key.
 
bool isDbEqual (const IDatastoreObjectWithIntegerKey &other) const
 Same DB key and hence equal.
 
bool isLoadedFromDb () const
 Loaded from DB. More...
 
bool matchesDbKeyState (db::DbKeyStateFilter filter) const
 Matches filter?
 
const CIcontoDatabaseIcon () const
 Database icon if this has valid key, otherwise empty.
 
- Public Member Functions inherited from swift::misc::db::IDatastoreObject
const QString & getVersion () const
 Version info.
 
QVersionNumber getQVersion () const
 Version as QVersion.
 
bool hasVersion () const
 Having a version?s.
 
void setVersion (const QString &version)
 Version info.
 
- Public Member Functions inherited from swift::misc::ITimestampBased
QDateTime getUtcTimestamp () const
 Get timestamp.
 
qint64 getMSecsSinceEpoch () const
 Timestamp as ms value.
 
qint64 getTimeDifferenceMs (qint64 compareTime) const
 Time difference in ms.
 
qint64 getTimeDifferenceAbsMs (qint64 compareTime) const
 Time difference in ms.
 
qint64 getTimeDifferenceToNowMs () const
 Time difference to now.
 
qint64 getTimeDifferenceMs (const ITimestampBased &compare) const
 Time difference in ms.
 
qint64 getAbsTimeDifferenceMs (qint64 compareTime) const
 Time difference in ms.
 
qint64 getAbsTimeDifferenceMs (const ITimestampBased &compare) const
 Time difference in ms.
 
void setTimestampToNull ()
 Set to null.
 
void setMSecsSinceEpoch (qint64 mSecsSinceEpoch)
 Timestamp as ms value.
 
void setByYearMonthDayHourMinute (const QString &yyyyMMddhhmmss)
 Set by value such as "20141003231045".
 
void setUtcTimestamp (const QDateTime &timestamp)
 Set timestamp.
 
bool isNewerThan (const ITimestampBased &otherTimestampObj) const
 Is this newer than other?
 
bool isNewerThan (qint64 mSecsSinceEpoch) const
 Is newer than epoch value?
 
bool isOlderThan (const ITimestampBased &otherTimestampObj) const
 Is this older than other?
 
bool isOlderThan (qint64 mSecsSinceEpoch) const
 Is this older than other?
 
bool isOlderThanNowMinusOffset (int offsetMs) const
 Older than now-offset.
 
bool isSame (const ITimestampBased &otherTimestampObj) const
 Same timestamp.
 
qint64 msecsTo (const ITimestampBased &otherTimestampObj) const
 Time difference.
 
qint64 absMsecsTo (const ITimestampBased &otherTimestampObj) const
 Time difference.
 
qint64 msecsToNow () const
 Milliseconds to now.
 
void setCurrentUtcTime ()
 Set the current time as timestamp.
 
void addMsecs (qint64 ms)
 Add the given number of milliseconds to the timestamp.
 
QString getFormattedUtcTimestampHms () const
 As hh:mm:ss.
 
QString getFormattedUtcTimestampHmsz () const
 As hh:mm:ss.zzz.
 
QString getFormattedUtcTimestampHm () const
 As hh:mm.
 
QString getFormattedUtcTimestampDhms () const
 As dd HH mm ss.
 
QString getFormattedUtcTimestampMdhms () const
 As MM dd HH mm ss.
 
QString getFormattedUtcTimestampMdhmsz () const
 As MM dd HH mm ss.zzz.
 
QString getFormattedUtcTimestampYmdhms () const
 As yyyy MM dd HH mm ss.
 
QString getFormattedUtcTimestampYmdhmsz () const
 As yyyy MM dd HH mm ss.zzz.
 
bool hasValidTimestamp () const
 Valid timestamp?
 

Static Public Member Functions

static const CAirlineIcaoCodenull ()
 NULL object.
 
static bool isValidAirlineDesignator (const QString &airline)
 Valid designator?
 
static bool isValidIataCode (const QString &iataCode)
 Valid IATA code?
 
static QSet< QString > specialValidDesignators ()
 Some special valid designator which do not fit standard rule (e.g. 3-letter code)
 
static QString normalizeDesignator (const QString &candidate)
 Normalize string as airline designator.
 
static CStatusMessage logMessage (const CAirlineIcaoCode &icaoCode, const QString &message, const QStringList &extraCategories={}, CStatusMessage::StatusSeverity s=CStatusMessage::SeverityInfo)
 Specialized log message for matching / reverse lookup. More...
 
static void addLogDetailsToList (CStatusMessageList *log, const CAirlineIcaoCode &icao, const QString &message, const QStringList &extraCategories={}, CStatusMessage::StatusSeverity s=CStatusMessage::SeverityInfo)
 Specialized log for matching / reverse lookup. More...
 
static CAirlineIcaoCode fromDatabaseJson (const QJsonObject &json, const QString &prefix=QString())
 From our DB JSON.
 
static const QSet< int > & iconIds ()
 The airline icon names (name only, not path)
 
- Static Public Member Functions inherited from swift::misc::mixin::MetaType< Derived >
static void registerMetadata ()
 Register metadata.
 
- Static Public Member Functions inherited from swift::misc::mixin::JsonByMetaClass< Derived >
template<class DerivedObj = Derived>
static DerivedObj fromJson (const QJsonObject &json)
 Get object from QJsonObject.
 
template<class DerivedObj = Derived>
static DerivedObj fromJson (const QString &jsonString, bool acceptCacheJson=false)
 Get object from JSON string.
 
template<class DerivedObj = Derived>
static DerivedObj fromJsonNoThrow (const QString &jsonString, bool acceptCacheJson, bool &success, QString &errMsg)
 Get object from JSON string.
 
- Static Public Member Functions inherited from swift::misc::db::IDatastoreObjectWithIntegerKey
static int invalidDbKey ()
 Invalid key.
 
static int stringToDbKey (const QString &candidate)
 Convert string to DB key.
 
static const CPropertyIndexkeyIndex ()
 The key index.
 
- Static Public Member Functions inherited from swift::misc::ITimestampBased
static bool isAnyTimestampIndex (int index)
 Any of the timestamp indexes.
 
static bool canHandleIndex (CPropertyIndexRef index)
 Can given index be handled.
 

Additional Inherited Members

- Protected Member Functions inherited from swift::misc::CValueObject< CAirlineIcaoCode >
 CValueObject ()=default
 Default constructor.
 
 CValueObject (const CValueObject &)=default
 Copy constructor.
 
CValueObjectoperator= (const CValueObject &)=default
 Copy assignment operator.
 
 ~CValueObject ()=default
 Destructor.
 
 CEmpty ()=default
 Inheriting constructors.
 
 CEmpty (const CEmpty &)=default
 Inheriting constructors.
 
- Protected Member Functions inherited from swift::misc::CEmpty
 CEmpty ()=default
 Protected default constructor.
 
 CEmpty (const CEmpty &)=default
 Protected copy constructor.
 
CEmptyoperator= (const CEmpty &)=default
 Protected copy assignment operator.
 
 ~CEmpty ()=default
 Non-virtual protected destructor.
 
- Protected Member Functions inherited from swift::misc::db::IDatastoreObjectWithIntegerKey
 IDatastoreObjectWithIntegerKey ()
 Constructor.
 
 IDatastoreObjectWithIntegerKey (int key)
 Constructor.
 
void setKeyVersionTimestampFromDatabaseJson (const QJsonObject &json, const QString &prefix=QString())
 Set key and timestamp values.
 
QVariant propertyByIndex (swift::misc::CPropertyIndexRef index) const
 Property by index. More...
 
void setPropertyByIndex (swift::misc::CPropertyIndexRef index, const QVariant &variant)
 Set property by index. More...
 
int comparePropertyByIndex (CPropertyIndexRef index, const IDatastoreObjectWithIntegerKey &compareValue) const
 Compare for index. More...
 
- Protected Member Functions inherited from swift::misc::db::IDatastoreObject
void setTimestampVersionFromDatabaseJson (const QJsonObject &json, const QString &prefix=QString())
 Set versionn and timestamp values.
 
- Protected Member Functions inherited from swift::misc::ITimestampBased
 ITimestampBased ()
 Constructor.
 
 ITimestampBased (qint64 msSincePoch)
 Constructor.
 
 ITimestampBased (const QDateTime &timestamp)
 Constructor.
 
QVariant propertyByIndex (CPropertyIndexRef index) const
 Property by index. More...
 
void setPropertyByIndex (CPropertyIndexRef index, const QVariant &variant)
 Set property by index. More...
 
int comparePropertyByIndex (CPropertyIndexRef index, const ITimestampBased &compareValue) const
 Compare for index. More...
 
void updateMissingParts (const ITimestampBased &other)
 Update missing parts.
 
- Static Protected Member Functions inherited from swift::misc::db::IDatastoreObjectWithIntegerKey
static bool existsKey (const QJsonObject &json, const QString &prefix=QString())
 Is a key available?
 
static bool canHandleIndex (swift::misc::CPropertyIndexRef index)
 Can given index be handled?
 
- Protected Attributes inherited from swift::misc::db::IDatastoreObjectWithIntegerKey
int m_dbKey = -1
 key
 
- Protected Attributes inherited from swift::misc::db::IDatastoreObject
QString m_version
 version info
 
- Protected Attributes inherited from swift::misc::ITimestampBased
qint64 m_timestampMSecsSinceEpoch = -1
 timestamp value
 

Detailed Description

Value object for ICAO classification.

Definition at line 30 of file airlineicaocode.h.

Member Function Documentation

◆ addLogDetailsToList()

void swift::misc::aviation::CAirlineIcaoCode::addLogDetailsToList ( CStatusMessageList log,
const CAirlineIcaoCode icao,
const QString &  message,
const QStringList &  extraCategories = {},
CStatusMessage::StatusSeverity  s = CStatusMessage::SeverityInfo 
)
static

Specialized log for matching / reverse lookup.

Remarks
This function is thread safe.

Definition at line 317 of file airlineicaocode.cpp.

◆ comparePropertyByIndex()

int swift::misc::aviation::CAirlineIcaoCode::comparePropertyByIndex ( CPropertyIndexRef  index,
const CAirlineIcaoCode compareValue 
) const

Compare for index.

Definition at line 230 of file airlineicaocode.cpp.

◆ convertToQString()

QString swift::misc::aviation::CAirlineIcaoCode::convertToQString ( bool  i18n = false) const

Cast as QString.

Definition at line 164 of file airlineicaocode.cpp.

◆ getSimplifiedName()

QString swift::misc::aviation::CAirlineIcaoCode::getSimplifiedName ( ) const

Get a simplified upper case name for searching by removing all characters except A-Z.

Definition at line 81 of file airlineicaocode.cpp.

◆ logMessage()

CStatusMessage swift::misc::aviation::CAirlineIcaoCode::logMessage ( const CAirlineIcaoCode icaoCode,
const QString &  message,
const QStringList &  extraCategories = {},
CStatusMessage::StatusSeverity  s = CStatusMessage::SeverityInfo 
)
static

Specialized log message for matching / reverse lookup.

Remarks
This function is thread safe.

Definition at line 306 of file airlineicaocode.cpp.

◆ propertyByIndex()

QVariant swift::misc::aviation::CAirlineIcaoCode::propertyByIndex ( CPropertyIndexRef  index) const

Property by index.

Definition at line 173 of file airlineicaocode.cpp.

◆ setPropertyByIndex()

void swift::misc::aviation::CAirlineIcaoCode::setPropertyByIndex ( CPropertyIndexRef  index,
const QVariant &  variant 
)

Set property by index.

Definition at line 200 of file airlineicaocode.cpp.

◆ toIcon()

CIcons::IconIndex swift::misc::aviation::CAirlineIcaoCode::toIcon ( ) const

As icon, not implemented by all classes.

Definition at line 153 of file airlineicaocode.cpp.


The documentation for this class was generated from the following files: