16 namespace swift::misc::aviation
28 return other == (*this);
33 const QString code = icaoCode.trimmed().toUpper();
35 if (
containsChar(code, [](QChar c) {
return !c.isLetterOrNumber(); })) {
return {}; }
47 return (
containsChar(icaoCode, [](QChar c) {
return c.isDigit(); }));
52 if (index.
isMyself()) {
return QVariant::fromValue(*
this); }
69 return m_icaoCode.compare(compareValue.
getIcaoCode(), Qt::CaseInsensitive);
76 if (strict) {
return l == 4; }
77 return l >= 3 && l <= 6;
Non-owning reference to a CPropertyIndex with a subset of its features.
bool isMyself() const
Myself index, used with nesting.
Value object encapsulating information of airport ICAO data.
int comparePropertyByIndex(CPropertyIndexRef index, const CAirportIcaoCode &compareValue) const
Compare for index.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
static bool containsNumbers(const QString &icaoCode)
Containing numbers (normally indicator for small airfield/strip)
bool hasValidIcaoCode(bool strict) const
Has valid code?
static bool isValidIcaoDesignator(const QString &icaoCode, bool strict)
Valid ICAO designator.
QString getIcaoCode() const
Get ICAO code.
bool equalsString(const QString &icaoCode) const
Equals callsign string?
QString convertToQString(bool i18n=false) const
Cast as QString.
static QString unifyAirportCode(const QString &icaoCode)
Unify code.
static bool validCodeLength(int l, bool strict)
Valid code lenght.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
bool containsChar(const QString &s, F predicate)
True if any character in the string matches the given predicate.
#define SWIFT_DEFINE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template definition of mixins for a CValueObject subclass.