6 #include <QCoreApplication>
7 #include <QStringBuilder>
16 using namespace swift::misc::physical_quantities;
17 using namespace swift::misc::geo;
21 namespace swift::misc::aviation
23 CAirport::CAirport(
const QString &icao) : m_icao(icao) {}
26 : m_icao(icao), m_position(position)
31 : m_descriptiveName(descriptiveName), m_icao(icao), m_position(position)
44 if (location.
isEmpty()) {
return false; }
50 if (name.
isEmpty()) {
return false; }
72 (void)QT_TRANSLATE_NOOP(
"Aviation",
"Airport");
100 case IndexLocation:
return { m_location };
101 case IndexDescriptiveName:
return { m_descriptiveName };
106 return (ICoordinateWithRelativePosition::canHandleIndex(index)) ?
107 ICoordinateWithRelativePosition::propertyByIndex(index) :
128 if (ICoordinateWithRelativePosition::canHandleIndex(index))
130 ICoordinateWithRelativePosition::setPropertyByIndex(index, variant);
148 case IndexDescriptiveName:
151 if (ICoordinateWithRelativePosition::canHandleIndex(index))
153 return ICoordinateWithRelativePosition::comparePropertyByIndex(index, compareValue);
157 Q_ASSERT_X(
false, Q_FUNC_INFO,
"Compare failed");
bool hasIsoCode() const
ISO code?
static CCountry fromDatabaseJson(const QJsonObject &json, const QString &prefix=QString())
From our database JSON format.
Non-owning reference to a CPropertyIndex with a subset of its features.
Q_REQUIRED_RESULT CPropertyIndexRef copyFrontRemoved() const
Copy with first element removed.
CastType frontCasted() const
First element casted to given type, usually the PropertIndex enum.
bool isMyself() const
Myself index, used with nesting.
Value object encapsulating information about an airpot.
void setPosition(const swift::misc::geo::CCoordinateGeodetic &position)
Set position.
bool matchesLocation(const QString &location) const
Matches location?
void setLocation(const QString &location)
Set location.
QString getLocationPlusOptionalName() const
Location plus optional name (if available and different from location)
bool isNull() const
NULL airport?
bool matchesDescriptiveName(const QString &name) const
Matches name?
static CAirport fromDatabaseJson(const QJsonObject &json, const QString &prefix=QString())
Object from JSON.
const QString & getLocation() const
Get location (e.g. "London")
void setDescriptiveName(const QString &name)
Set descriptive name.
CAirport()=default
Default constructor.
const CCountry & getCountry() const
Get the country.
void setOperating(bool operating)
Sets the value of.
QString convertToQString(bool i18n=false) const
Cast as QString.
const swift::misc::aviation::CAltitude & getElevation() const
Elevation.
int comparePropertyByIndex(CPropertyIndexRef index, const CAirport &compareValue) const
Compare by index.
void updateMissingParts(const CAirport &airport)
Update the missing parts in airport.
const QString & getDescriptiveName() const
Get descriptive name.
QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const
Property by index.
const CAirportIcaoCode & getIcao() const
Get ICAO code.
ColumnIndex
Properties by index.
bool isOperating() const
Is the airport still active?
void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant)
Set property by index.
void setCountry(const CCountry &country)
Set the country.
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.
bool isEmpty() const
Is empty?
void setKeyVersionTimestampFromDatabaseJson(const QJsonObject &json, const QString &prefix=QString())
Set key and timestamp values.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
QString toQString(bool i18n=false) const
Cast as QString.
Free functions in swift::misc.
SWIFT_MISC_EXPORT bool caseInsensitiveStringCompare(const QString &c1, const QString &c2)
Case insensitive string compare.
QString translate(const char *context, const char *sourceText, const char *disambiguation, int n)
QJsonValue value(QLatin1StringView key) const const
double toDouble(double defaultValue) const const
QString toString() const const
QString & append(QChar ch)
int compare(QLatin1StringView s1, const QString &s2, Qt::CaseSensitivity cs)
bool isEmpty() const const
QVariant fromValue(T &&value)
bool toBool() const const
QString toString() const const
#define SWIFT_DEFINE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template definition of mixins for a CValueObject subclass.