7 #include <QStringBuilder>
19 : IDatastoreObjectWithStringKey(iso.trimmed().toUpper()), m_name(name.trimmed())
21 this->setSimplifiedNameIfNotSame();
33 return CIcons::StandardIconEmpty;
46 m_iso3 = (code.
length() == 3) ? code :
"";
61 if (m_name.
isEmpty()) {
return s; }
62 return u
" (" % m_name % u
')';
68 return m_name % u
" - " %
m_dbKey;
74 this->setSimplifiedNameIfNotSame();
120 return (IDatastoreObjectWithStringKey::canHandleIndex(index)) ?
121 IDatastoreObjectWithStringKey::propertyByIndex(index) :
143 IDatastoreObjectWithStringKey::canHandleIndex(index) ?
144 IDatastoreObjectWithStringKey::setPropertyByIndex(index, variant) :
153 if (IDatastoreObjectWithStringKey::canHandleIndex(index))
155 return IDatastoreObjectWithStringKey::comparePropertyByIndex(index, compareValue);
195 void CCountry::setSimplifiedNameIfNotSame()
198 m_simplifiedName = m_name == simplified ?
"" : simplified;
QString getCombinedStringIsoName() const
Combined string ISO/name.
const QString & getName() const
Country name.
const QString & getIso3Code() const
Get 3 letter iso code.
CCountry()=default
Constructor.
const QString & getAlias1() const
Alias 1.
bool isValid() const
Valid?
bool hasIso3Code() const
ISO 3 letter code?
bool hasIsoCode() const
ISO code?
bool matchesCountryName(const QString &name) const
Matches country name.
int comparePropertyByIndex(CPropertyIndexRef index, const CCountry &compareValue) const
Compare for index.
void setName(const QString &countryName)
Set country name.
void setIsoCode(const QString &iso)
Country ISO code (US, DE, GB, PL)
const QString & getIsoCode() const
DB ISO code.
void setIso3Code(const QString &iso)
Country ISO code (USA, DEU, GBR, POL)
static bool isValidIsoCode(const QString &isoCode)
Valid country iso code.
QString getCombinedStringNameIso() const
Combined string name/ISO.
bool matchesAlias(const QString &alias) const
Matches alias.
CIcons::IconIndex toIcon() const
Representing icon.
QString convertToQString(bool i18n=false) const
Cast as QString.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
void setAlias1(const QString &alias)
Alias 1.
ColumnIndex
Properties by index.
bool isHistoric() const
Historic / non-existing country (e.g. Soviet Union)
const QString & getAlias2() const
Alias 2.
static CCountry fromDatabaseJson(const QJsonObject &json, const QString &prefix=QString())
From our database JSON format.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
void setAlias2(const QString &alias)
Alias 2.
void setHistoric(bool historic)
Historic country?
IconIndex
Index for each icon, allows to send them via DBus, efficiently store them, etc.
Non-owning reference to a CPropertyIndex with a subset of its features.
CastType frontCasted() const
First element casted to given type, usually the PropertIndex enum.
bool isMyself() const
Myself index, used with nesting.
void setLoadedFromDb(bool loaded)
Mark as loaded from DB.
static bool existsKey(const QJsonObject &json, const QString &prefix=QString())
Is a key available?
const QString & getDbKey() const
Get DB key.
void setKeyVersionTimestampFromDatabaseJson(const QJsonObject &json, const QString &prefix=QString())
Set key and timestamp values.
int comparePropertyByIndex(CPropertyIndexRef index, const Derived &compareValue) const
Compare for index.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
Free functions in swift::misc.
SWIFT_MISC_EXPORT bool caseInsensitiveStringCompare(const QString &c1, const QString &c2)
Case insensitive string compare.
SWIFT_MISC_EXPORT QString simplifyAccents(const QString &candidate)
Remove accents / diacritic marks from a string.
SWIFT_MISC_EXPORT bool stringToBool(const QString &boolString)
Convert string to bool.
QJsonValue value(QLatin1StringView key) const const
QString toString() const const
int compare(QLatin1StringView s1, const QString &s2, Qt::CaseSensitivity cs)
bool contains(QChar ch, Qt::CaseSensitivity cs) const const
bool isEmpty() const const
qsizetype length() const const
QString toUpper() const const
QString trimmed() 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.