7 #include <QRegularExpression>
22 return IDatastoreObjectList::findByKey(isoCode);
41 if (c.getName() == cn) {
return c; }
45 return countries.
front();
52 for (
const CCountry &country : (*
this))
54 if (country.matchesAlias(a)) {
return country; }
62 for (
const CCountry &country : (*
this))
64 const QString s = country.getCombinedStringIsoName();
75 for (
const CCountry &country : (*
this))
77 const QString s = country.getCombinedStringNameIso();
88 for (
const CCountry &country : (*
this))
90 const QString s = country.getName();
101 for (
const CCountry &country : (*
this))
103 const QString s = country.getIsoCode();
104 if (s.
length() != 2) {
continue; }
114 for (
const CCountry &country : (*
this))
116 const QString s = country.getIso3Code();
117 if (s.
length() != 3) {
continue; }
bool matchesCountryName(const QString &name) const
Matches country name.
static bool isValidIsoCode(const QString &isoCode)
Valid country iso code.
static CCountry fromDatabaseJson(const QJsonObject &json, const QString &prefix=QString())
From our database JSON format.
Value object encapsulating a list of countries.
static CCountryList fromDatabaseJson(const QJsonArray &array)
From our database JSON format.
CCountry findFirstByAlias(const QString &alias) const
Find first by alias.
CCountry findBestMatchByCountryName(const QString &candidate) const
Find "best match" by country.
QStringList toIso3List(bool sorted=false) const
All ISO 3 codes.
CCountry findByIsoCode(const QString &isoCode) const
Find by ISO code.
QStringList toIsoNameList(bool sorted=false) const
ISO/name string list.
CCountryList()
Default constructor.
QStringList toNameList(bool sorted=false) const
Name string list.
QStringList toIsoList(bool sorted=false) const
All ISO codes.
QStringList toNameIsoList(bool sorted=false) const
Name/ISO string list.
size_type size() const
Returns number of elements in the sequence.
const_reference frontOrDefault() const
Access the first element, or a default-initialized value if the sequence is empty.
CSequence findBy(Predicate p) const
Return a copy containing only those elements for which a given predicate returns true.
Q_REQUIRED_RESULT CSequence sorted(Predicate p) const
Return a copy sorted by a given comparator predicate.
void push_back(const T &value)
Appends an element at the end of the sequence.
reference front()
Access the first element.
bool isEmpty() const
Synonym for empty.
Free functions in swift::misc.
void append(QList< T > &&value)
QString captured(QAnyStringView name) const const
bool hasMatch() const const
bool isEmpty() const const
qsizetype length() const const
bool startsWith(QChar c, Qt::CaseSensitivity cs) const const
QString toUpper() const const
QString trimmed() const const
void sort(Qt::CaseSensitivity cs)
#define SWIFT_DEFINE_SEQUENCE_MIXINS(Namespace, T, List)
Explicit template definition of mixins for a CSequence subclass.