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

Value object encapsulating information of a callsign. More...

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

Public Types

enum  ColumnIndex {
  IndexCallsignString = CPropertyIndexRef::GlobalIndexCCallsign , IndexCallsignStringAsSet , IndexTelephonyDesignator , IndexSuffix ,
  IndexSuffixSortOrder
}
 Indexes.
 
enum  TypeHint { NoHint , Aircraft , Atc }
 Representing what.
 
- Public Types inherited from swift::misc::CValueObject< CCallsign >
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 Member Functions

 CCallsign ()
 Default constructor.
 
 CCallsign (const QString &callsign, TypeHint hint=NoHint)
 Constructor.
 
 CCallsign (const QString &callsign, const QString &telephonyDesignator, TypeHint hint=NoHint)
 Constructor.
 
 CCallsign (const char *callsign, TypeHint hint=NoHint)
 Constructor, needed to disambiguate implicit conversion from string literal.
 
bool isEmpty () const
 Is empty?
 
bool isAtcCallsign () const
 ATC callsign. More...
 
bool isAtcAlikeCallsign () const
 ATC alike callsign. More...
 
bool isObserverCallsign () const
 Observer callsign?
 
bool isSupervisorCallsign () const
 Supervisor?
 
bool isBroadcastCallsign () const
 Pseudo callsing for broadcast messages. More...
 
void markAsBroadcastCallsign ()
 Set a human readable name as "broadcast" callsign. More...
 
void markAsWallopCallsign ()
 Set a human readable name as "wallop-channel" callsign.
 
bool isMaybeCopilotCallsign (const CCallsign &pilotCallsign) const
 Returns true if this is a co-pilot callsign of pilot. The logic is that the callsign is the same as the pilot one but with a single character as suffix. e.g Pilot logged in as DLH123, observer logged in as DLH123A.
 
const QString & asString () const
 Get callsign (normalized)
 
const QString & getStringAsSet () const
 Get callsign.
 
QString getFsdCallsignString () const
 The callsign string used with FSD.
 
bool isSameAsSet () const
 Same as set callsign?
 
const QString & getTelephonyDesignator () const
 Get callsign telephony designator (how callsign is pronounced)
 
TypeHint getTypeHint () const
 Type hint.
 
void setTypeHint (TypeHint hint)
 Type hint.
 
QString getIcaoCode () const
 Get ICAO code, if this makes sense (EDDF_TWR -> EDDF)
 
QString getAsObserverCallsignString () const
 Makes this callsign looking like an observer callsign (DAMBZ -> DAMBZ_OBS)
 
QString getSuffix () const
 Get the callsign suffix ("TWR", "ATIS" ...) if any ("_" is removed)
 
QString getFlightIndentification () const
 Flight number (e.g. DLH1234 -> 1234) if applicable.
 
QString getFlightNumber () const
 Flight number (e.g. DLH1234 -> 1234) if applicable.
 
int getFlightNumberInt () const
 Flight number as integer.
 
bool hasSuffix () const
 Suffix such as "_TWR"?
 
bool hasAtcSuffix () const
 Has an ATC suffix?
 
int getSuffixSortOrder () const
 Sort order by suffix.
 
bool equalsString (const QString &callsignString) const
 Equals callsign string?
 
bool isValid () const
 Valid callsign?
 
CIcons::IconIndex toIcon () const
 As icon, not implemented by all classes. 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 CCallsign &compareValue) const
 Compare for index. More...
 
QString convertToQString (bool i18n=false) const
 Cast as QString. More...
 
void clear ()
 Clear this callsign.
 
QString getAirlinePrefix () const
 Airline suffix (e.g. DLH1234 -> DLH) if applicable.
 
QString getAirlinePrefix (QString &flightNumber) const
 Airline suffix (e.g. DLH1234 -> DLH) if applicable.
 
QString getAirlinePrefix (QString &flightNumber, QString &flightIdentification) const
 Airline suffix (e.g. DLH1234 -> DLH) if applicable.
 
- 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.
 

Static Public Member Functions

static int suffixToSortOrder (const QString &suffix)
 Index for ATC suffix, if unknown int max value.
 
static bool isValidAircraftCallsign (const QString &callsign)
 Valid callsign?
 
static bool isValidAircraftCallsign (const CCallsign &callsign)
 Valid callsign?
 
static bool isValidAtcCallsign (const QString &callsign)
 Valid callsign?
 
static bool isValidAtcCallsign (const CCallsign &callsign)
 Valid callsign?
 
static QString unifyCallsign (const QString &callsign, TypeHint hint=NoHint)
 Unify the callsign by removing illegal characters.
 
static const QStringList & atcCallsignSuffixes ()
 List of real ATC suffixes (e.g. TWR);.
 
static const QStringList & atcAlikeCallsignSuffixes ()
 List of real ("TWR") and treated like ATC suffixes (e.g. OBS);.
 
static bool looksLikeAtcCallsign (const QString &callsign)
 Does this look like an ATC callsign.
 
static const CIconatcSuffixToIcon (const QString &suffix)
 Suffix to icon.
 
static const CIconconvertToIcon (const CCallsign &callsign)
 Representing icon.
 
static CStatusMessage logMessage (const CCallsign &callsign, 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 CCallsign &callsign, const QString &message, const QStringList &extraCategories={}, CStatusMessage::StatusSeverity s=CStatusMessage::SeverityInfo)
 Specialized log for matching / reverse lookup. More...
 
static void registerMetadata ()
 Register metadata.
 
- 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.
 

Additional Inherited Members

- Protected Member Functions inherited from swift::misc::CValueObject< CCallsign >
 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.
 

Detailed Description

Value object encapsulating information of a callsign.

Definition at line 29 of file callsign.h.

Member Function Documentation

◆ addLogDetailsToList()

void swift::misc::aviation::CCallsign::addLogDetailsToList ( CStatusMessageList log,
const CCallsign callsign,
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 110 of file callsign.cpp.

◆ comparePropertyByIndex()

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

Compare for index.

Definition at line 341 of file callsign.cpp.

◆ convertToQString()

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

Cast as QString.

Definition at line 39 of file callsign.cpp.

◆ isAtcAlikeCallsign()

bool swift::misc::aviation::CCallsign::isAtcAlikeCallsign ( ) const

ATC alike callsign.

See also
atcAlikeCallsignSuffixes()

Definition at line 194 of file callsign.cpp.

◆ isAtcCallsign()

bool swift::misc::aviation::CCallsign::isAtcCallsign ( ) const

ATC callsign.

See also
atcCallsignSuffixes()

Definition at line 139 of file callsign.cpp.

◆ isBroadcastCallsign()

bool swift::misc::aviation::CCallsign::isBroadcastCallsign ( ) const

Pseudo callsing for broadcast messages.

Remarks
hack, workaround for VATSIM using "*" as callsign for text messages

Definition at line 152 of file callsign.cpp.

◆ logMessage()

CStatusMessage swift::misc::aviation::CCallsign::logMessage ( const CCallsign callsign,
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 100 of file callsign.cpp.

◆ markAsBroadcastCallsign()

void swift::misc::aviation::CCallsign::markAsBroadcastCallsign ( )

Set a human readable name as "broadcast" callsign.

Remarks
hack, workaround for VATSIM using "*" as callsign for text messages

Definition at line 157 of file callsign.cpp.

◆ propertyByIndex()

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

Property by index.

Definition at line 310 of file callsign.cpp.

◆ setPropertyByIndex()

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

Set property by index.

Definition at line 324 of file callsign.cpp.

◆ toIcon()

CIcons::IconIndex swift::misc::aviation::CCallsign::toIcon ( ) const
inline

As icon, not implemented by all classes.

Definition at line 157 of file callsign.h.


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