KHolidays

holidayregion.cpp
1/*
2 This file is part of the kholidays library.
3
4 SPDX-FileCopyrightText: 2001 Cornelius Schumacher <schumacher@kde.org>
5 SPDX-FileCopyrightText: 2004-2020 Allen Winter <winter@kde.org>
6 SPDX-FileCopyrightText: 2008 David Jarvie <djarvie@kde.org>
7 SPDX-FileCopyrightText: 2010 John Layt <john@layt.net>
8
9 SPDX-License-Identifier: LGPL-2.0-or-later
10*/
11
12#include "holidayregion.h"
13
14#include <QCoreApplication>
15#include <QDirIterator>
16#include <QFile>
17#include <QFileInfo>
18#include <QLocale>
19#include <QSharedData>
20#include <QStandardPaths>
21
22#include "holiday_p.h"
23#include "parsers/plan2/holidayparserdriverplan_p.h"
24
25using namespace KHolidays;
26
27static void initResources()
28{
29 static bool initDone = false;
30 if (!initDone) {
31 Q_INIT_RESOURCE(holidays);
32 initDone = true;
33 }
34}
35
36static QStringList allHolidayFiles(const QString &location = QString())
37{
38 initResources();
39 QStringList dirs{QStringLiteral(":/org.kde.kholidays/plan2")};
41 QStringLiteral("kf5/libkholidays/plan2"),
43 QStringList files;
44 for (const QString &dir : std::as_const(dirs)) {
45 QDirIterator it(dir, QStringList() << QStringLiteral("holiday_") + location + '*');
46 while (it.hasNext()) {
47 files.push_back(it.next());
48 }
49 }
50 return files;
51}
52
53namespace KHolidays
54{
55class HolidayRegionPrivate : public QSharedData
56{
57public:
58 explicit HolidayRegionPrivate(const QString &regionCode)
59 : mDriver(nullptr)
60 , mRegionCode(regionCode)
61 {
62 if (!mRegionCode.isEmpty()) {
63 auto file = QStandardPaths::locate(QStandardPaths::GenericDataLocation, //
64 QLatin1String("kf5/libkholidays/plan2/holiday_") + mRegionCode);
65 if (!file.isEmpty()) {
66 mHolidayFile.setFile(file);
67 } else {
68 initResources();
69 file = QStringLiteral(":/org.kde.kholidays/plan2/holiday_") + mRegionCode;
70 if (QFile::exists(file)) {
71 mHolidayFile.setFile(file);
72 }
73 }
74 }
75
76 init();
77 }
78
79 explicit HolidayRegionPrivate(const QFileInfo &regionFile)
80 : mDriver(nullptr)
81 , mHolidayFile(regionFile)
82 {
83 init();
84 }
85
86 ~HolidayRegionPrivate()
87 {
88 delete mDriver;
89 }
90
91 void init()
92 {
93 if (mHolidayFile.exists()) {
94 mDriver = new HolidayParserDriverPlan(mHolidayFile.absoluteFilePath());
95 if (mDriver) {
96 if (mRegionCode.isEmpty()) {
97 if (mHolidayFile.fileName().startsWith(QLatin1String("holiday_"))) {
98 mRegionCode = mHolidayFile.fileName().mid(8);
99 } else {
100 mRegionCode = mHolidayFile.fileName();
101 }
102 }
103
104 } else {
105 mRegionCode.clear();
106 }
107 } else {
108 mRegionCode.clear();
109 }
110 }
111
112 HolidayParserDriver *mDriver; // The parser driver for the holiday file
113 QString mRegionCode; // region code of holiday region
114 QFileInfo mHolidayFile; // file containing holiday data, or null
115};
116}
117
119 : d(new HolidayRegionPrivate(regionCode))
120{
121}
122
124 : d(new HolidayRegionPrivate(regionFile))
125{
126}
127
131
134
136{
137 const QStringList files = allHolidayFiles();
138
139 QStringList regionCodesList;
140 regionCodesList.reserve(files.count());
141 for (const QString &filename : files) {
142 regionCodesList.append(filename.mid(filename.lastIndexOf(QLatin1String("holiday_")) + 8));
143 }
144
145 std::sort(regionCodesList.begin(), regionCodesList.end());
146 return regionCodesList;
147}
148
150{
151 return d->mRegionCode;
152}
153
155{
156 return d->mDriver->fileCountryCode();
157}
158
160{
162 if (temp.isValid()) {
163 return temp.countryCode();
164 } else {
165 return QString();
166 }
167}
168
170{
171 return d->mDriver->fileLanguageCode();
172}
173
175{
177 if (temp.isValid()) {
178 return temp.languageCode();
179 } else {
180 return QString();
181 }
182}
183
185{
186 QString tempName = d->mDriver->fileName();
187
188 if (tempName.isEmpty()) {
189 QStringList countryParts = countryCode().toLower().split(QLatin1Char('-'));
190 const QString &country = countryParts.at(0);
191 QString regionName;
192 QString typeName;
193
194 if (country != QLatin1String("xx")) {
195 if (countryParts.count() == 2) {
196 // Temporary measure to get regions translated, only those files that already exist
197 // In 4.6 hope to have isocodes project integration for translations via KLocale
198 const QString &subdivision = countryParts.at(1);
199 if (country == QLatin1String("ca") && subdivision == QLatin1String("qc")) {
200 regionName = QCoreApplication::translate("HolidayRegion", "Quebec", "Canadian region");
201 } else if (country == QLatin1String("de")) {
202 if (subdivision == QLatin1String("by")) {
203 regionName = QCoreApplication::translate("HolidayRegion", "Germany, Bavaria", "German region");
204 } else if (subdivision == QLatin1String("bb")) {
205 regionName = QCoreApplication::translate("HolidayRegion", "Germany, Brandenburg", "German region");
206 } else if (subdivision == QLatin1String("be")) {
207 regionName = QCoreApplication::translate("HolidayRegion", "Germany, Berlin", "German region");
208 } else if (subdivision == QLatin1String("bw")) {
209 regionName = QCoreApplication::translate("HolidayRegion", "Germany, Baden-Wuerttemberg", "German region");
210 } else if (subdivision == QLatin1String("he")) {
211 regionName = QCoreApplication::translate("HolidayRegion", "Germany, Hesse", "German region");
212 } else if (subdivision == QLatin1String("mv")) {
213 regionName = QCoreApplication::translate("HolidayRegion", "Germany, Mecklenburg-Hither Pomerania", "German region");
214 } else if (subdivision == QLatin1String("ni")) {
215 regionName = QCoreApplication::translate("HolidayRegion", "Germany, Lower Saxony", "German region");
216 } else if (subdivision == QLatin1String("nw")) {
217 regionName = QCoreApplication::translate("HolidayRegion", "Germany, North Rhine-Westphalia", "German region");
218 } else if (subdivision == QLatin1String("rp")) {
219 regionName = QCoreApplication::translate("HolidayRegion", "Germany, Rhineland-Palatinate", "German region");
220 } else if (subdivision == QLatin1String("sh")) {
221 regionName = QCoreApplication::translate("HolidayRegion", "Germany, Schleswig-Holstein", "German region");
222 } else if (subdivision == QLatin1String("sl")) {
223 regionName = QCoreApplication::translate("HolidayRegion", "Germany, Saarland", "German region");
224 } else if (subdivision == QLatin1String("sn")) {
225 regionName = QCoreApplication::translate("HolidayRegion", "Germany, Saxony", "German region");
226 } else if (subdivision == QLatin1String("st")) {
227 regionName = QCoreApplication::translate("HolidayRegion", "Germany, Saxony-Anhalt", "German region");
228 } else if (subdivision == QLatin1String("th")) {
229 regionName = QCoreApplication::translate("HolidayRegion", "Germany, Thuringia", "German region");
230 }
231 } else if (country == QLatin1String("es") && subdivision == QLatin1String("ct")) {
232 regionName = QCoreApplication::translate("HolidayRegion", "Catalonia", "Spanish region");
233 } else if (country == QLatin1String("gb") && subdivision == QLatin1String("eaw")) {
234 regionName = QCoreApplication::translate("HolidayRegion", "England and Wales", "UK Region");
235 } else if (country == QLatin1String("gb") && subdivision == QLatin1String("eng")) {
236 regionName = QCoreApplication::translate("HolidayRegion", "England", "UK Region");
237 } else if (country == QLatin1String("gb") && subdivision == QLatin1String("wls")) {
238 regionName = QCoreApplication::translate("HolidayRegion", "Wales", "UK Region");
239 } else if (country == QLatin1String("gb") && subdivision == QLatin1String("sct")) {
240 regionName = QCoreApplication::translate("HolidayRegion", "Scotland", "UK Region");
241 } else if (country == QLatin1String("gb") && subdivision == QLatin1String("nir")) {
242 regionName = QCoreApplication::translate("HolidayRegion", "Northern Ireland", "UK Region");
243 } else if (country == QLatin1String("it") && subdivision == QLatin1String("bz")) {
244 regionName = QCoreApplication::translate("HolidayRegion", "South Tyrol", "Italian Region");
245 } else if (country == QLatin1String("au") && subdivision == QLatin1String("nsw")) {
246 regionName = QCoreApplication::translate("HolidayRegion", "New South Wales");
247 } else if (country == QLatin1String("au") && subdivision == QLatin1String("qld")) {
248 regionName = QCoreApplication::translate("HolidayRegion", "Queensland", "Australian Region");
249 } else if (country == QLatin1String("au") && subdivision == QLatin1String("vic")) {
250 regionName = QCoreApplication::translate("HolidayRegion", "Victoria", "Australian Region");
251 } else if (country == QLatin1String("au") && subdivision == QLatin1String("sa")) {
252 regionName = QCoreApplication::translate("HolidayRegion", "South Australia", "Australian Region");
253 } else if (country == QLatin1String("au") && subdivision == QLatin1String("nt")) {
254 regionName = QCoreApplication::translate("HolidayRegion", "Northern Territory", "Australian Region");
255 } else if (country == QLatin1String("au") && subdivision == QLatin1String("act")) {
256 regionName = QCoreApplication::translate("HolidayRegion", "Australian Capital Territory", "Australian Region");
257 } else if (country == QLatin1String("au") && subdivision == QLatin1String("wa")) {
258 regionName = QCoreApplication::translate("HolidayRegion", "Western Australia", "Australian Region");
259 } else if (country == QLatin1String("au") && subdivision == QLatin1String("tas")) {
260 regionName = QCoreApplication::translate("HolidayRegion", "Tasmania", "Australian Region");
261 } else if (country == QLatin1String("ba") && subdivision == QLatin1String("srp")) {
262 regionName = QCoreApplication::translate("HolidayRegion", "Republic of Srpska", "Bosnian and Herzegovinian Region");
263 } else {
264 // TODO Note this does not give the current QLocale translation!
265 regionName = QLocale::territoryToString(QLocale::codeToTerritory(country)) + QLatin1String(" (") + subdivision + QLatin1Char(')');
266 }
267 } else {
268 // TODO Note this does not give the current QLocale translation!
270 }
271 }
272
273 // Cheat on type for now, take direct from region code until API is introduced in SC 4.6
274 QStringList regionParts = regionCode().toLower().split(QLatin1Char('_'));
275 if (regionParts.count() == 3) {
276 const QString &type = regionParts.at(2);
277 // Will create lots more in 4.6
278 // Religious types, just simple for now
279 if (type == QLatin1String("public")) {
280 typeName = QCoreApplication::translate("HolidayRegion", "Public", "Holiday type");
281 } else if (type == QLatin1String("civil")) {
282 typeName = QCoreApplication::translate("HolidayRegion", "Civil", "Holiday type");
283 } else if (type == QLatin1String("religious")) {
284 typeName = QCoreApplication::translate("HolidayRegion", "Religious", "Holiday type");
285 } else if (type == QLatin1String("government")) {
286 typeName = QCoreApplication::translate("HolidayRegion", "Government", "Holiday type");
287 } else if (type == QLatin1String("financial")) {
288 typeName = QCoreApplication::translate("HolidayRegion", "Financial", "Holiday type");
289 } else if (type == QLatin1String("cultural")) {
290 typeName = QCoreApplication::translate("HolidayRegion", "Cultural", "Holiday type");
291 } else if (type == QLatin1String("commemorative")) {
292 typeName = QCoreApplication::translate("HolidayRegion", "Commemorative", "Holiday type");
293 } else if (type == QLatin1String("historical")) {
294 typeName = QCoreApplication::translate("HolidayRegion", "Historical", "Holiday type");
295 } else if (type == QLatin1String("school")) {
296 typeName = QCoreApplication::translate("HolidayRegion", "School", "Holiday type");
297 } else if (type == QLatin1String("seasonal")) {
298 typeName = QCoreApplication::translate("HolidayRegion", "Seasonal", "Holiday type");
299 } else if (type == QLatin1String("nameday")) {
300 typeName = QCoreApplication::translate("HolidayRegion", "Name Days", "Holiday type");
301 } else if (type == QLatin1String("personal")) {
302 typeName = QCoreApplication::translate("HolidayRegion", "Personal", "Holiday type");
303 } else if (type == QLatin1String("christian")) {
304 typeName = QCoreApplication::translate("HolidayRegion", "Christian", "Holiday type");
305 } else if (type == QLatin1String("anglican")) {
306 typeName = QCoreApplication::translate("HolidayRegion", "Anglican", "Holiday type");
307 } else if (type == QLatin1String("catholic")) {
308 typeName = QCoreApplication::translate("HolidayRegion", "Catholic", "Holiday type");
309 } else if (type == QLatin1String("protestant")) {
310 typeName = QCoreApplication::translate("HolidayRegion", "Protestant", "Holiday type");
311 } else if (type == QLatin1String("orthodox")) {
312 typeName = QCoreApplication::translate("HolidayRegion", "Orthodox", "Holiday type");
313 } else if (type == QLatin1String("jewish")) {
314 typeName = QCoreApplication::translate("HolidayRegion", "Jewish", "Holiday type");
315 } else if (type == QLatin1String("jewish-orthodox")) {
316 typeName = QCoreApplication::translate("HolidayRegion", "Jewish Orthodox", "Holiday type");
317 } else if (type == QLatin1String("jewish-conservative")) {
318 typeName = QCoreApplication::translate("HolidayRegion", "Jewish Conservative", "Holiday type");
319 } else if (type == QLatin1String("jewish-reform")) {
320 typeName = QCoreApplication::translate("HolidayRegion", "Jewish Reform", "Holiday type");
321 } else if (type == QLatin1String("islamic")) {
322 typeName = QCoreApplication::translate("HolidayRegion", "Islamic", "Holiday type");
323 } else if (type == QLatin1String("islamic-sunni")) {
324 typeName = QCoreApplication::translate("HolidayRegion", "Islamic Sunni", "Holiday type");
325 } else if (type == QLatin1String("islamic-shia")) {
326 typeName = QCoreApplication::translate("HolidayRegion", "Islamic Shia", "Holiday type");
327 } else if (type == QLatin1String("islamic-sufi")) {
328 typeName = QCoreApplication::translate("HolidayRegion", "Islamic Sufi", "Holiday type");
329 }
330 }
331
332 if (!regionName.isEmpty()) {
333 if (!typeName.isEmpty()) {
334 tempName = QCoreApplication::translate("HolidayRegion", "%1 - %2", "Holiday file display name, %1 = region name, %2 = holiday type")
335 .arg(regionName, typeName);
336 } else {
337 tempName = regionName;
338 }
339 } else if (!typeName.isEmpty()) {
340 tempName = typeName;
341 } else {
342 tempName = QCoreApplication::translate("HolidayRegion", "Unknown", "Unknown holiday region");
343 }
344 }
345 return tempName;
346}
347
349{
351 if (temp.isValid()) {
352 return temp.name();
353 } else {
354 return QString();
355 }
356}
357
359{
360 return d->mDriver->fileDescription();
361}
362
364{
366 if (temp.isValid()) {
367 return temp.description();
368 } else {
369 return QString();
370 }
371}
372
374{
375 return d->mHolidayFile.exists() && d->mDriver;
376}
377
378bool HolidayRegion::isValid(const QString &regionCode)
379{
381 return temp.isValid();
382}
383
384Holiday::List HolidayRegion::rawHolidays(const QDate &startDate, const QDate &endDate, const QString &category) const
385{
386 if (isValid()) {
387 return d->mDriver->parseHolidays(startDate, endDate, category);
388 } else {
389 return Holiday::List();
390 }
391}
392
393Holiday::List HolidayRegion::rawHolidays(const QDate &startDate, const QDate &endDate) const
394{
395 if (isValid()) {
396 return d->mDriver->parseRawHolidays(startDate, endDate);
397 } else {
398 return Holiday::List();
399 }
400}
401
403{
404 if (isValid()) {
405 return d->mDriver->parseHolidays(startDate, endDate);
406 } else {
407 return Holiday::List();
408 }
409}
410
412{
413 if (isValid()) {
414 return d->mDriver->parseHolidays(date);
415 } else {
416 return Holiday::List();
417 }
418}
419
421{
422 if (isValid()) {
423 return d->mDriver->parseHolidays(calendarYear);
424 } else {
425 return Holiday::List();
426 }
427}
428
429bool HolidayRegion::isHoliday(const QDate &date) const
430{
431 const Holiday::List holidayList = rawHolidaysWithAstroSeasons(date);
432 if (!holidayList.isEmpty()) {
433 for (const KHolidays::Holiday &holiday : holidayList) {
434 if (holiday.dayType() == Holiday::NonWorkday) {
435 return true;
436 }
437 }
438 }
439 return false;
440}
441
442static bool maybeCountry(QStringView holidayId, QStringView country)
443{
444 if (country.isEmpty()) {
445 return false;
446 }
447 if (holidayId.size() < 2 || country.size() < 2 || (country.size() > 2 && country[2] != QLatin1Char('-'))) {
448 return true; // not the format we expect, check the content
449 }
450 return holidayId.startsWith(country.left(2));
451}
452
454{
455 // Try to match against the user's country and language, or failing that the language country.
456 // Scan through all the regions finding the first match for each possible default.
457 // Holiday Region Country Code can be a country subdivision or the country itself,
458 // e.g. US or US-CA for California, so we can try match on both but an exact match has priority.
459 // The Holiday Region file is in one language only, so give priority to any file in the
460 // user's language, e.g. bilingual countries with a separate file for each language.
461 // Locale language can have a country code embedded in it e.g. en_GB, which we can try to use if
462 // no country is set, but a lot of countries use en_GB so it's a lower priority option.
463
464 QString localeCountry;
465 QString localeSubdivision;
466 QString localeLanguage;
467 QString localeLanguageCountry;
468
469 if (country.isEmpty()) {
470 localeCountry = QLocale::territoryToCode(QLocale().territory()).toLower();
471 } else {
472 localeCountry = country.toLower();
473 const auto idx = localeCountry.indexOf(QLatin1Char('-'));
474 localeSubdivision = idx > 0 ? localeCountry.left(idx) : localeCountry;
475 }
476
477 if (language.isEmpty()) {
478 localeLanguage = QLocale().languageToCode(QLocale().language()).toLower();
479 } else {
480 localeLanguage = language.toLower();
481 }
482
483 if (localeLanguage.split(QLatin1Char('_')).count() > 1) {
484 localeLanguageCountry = localeLanguage.split(QLatin1Char('_')).at(1);
485 }
486
487 QString countryAndLanguageMatch;
488 QString countryOnlyMatch;
489 QString subdivisionAndLanguageMatch;
490 QString subdivisionOnlyMatch;
491 QString languageCountryAndLanguageMatch;
492 QString languageCountryOnlyMatch;
493 QString languageSubdivisionAndLanguageMatch;
494 QString languageSubdivisionOnlyMatch;
495
497 for (const QString &aRegionCode : regionList) {
498 // avoid expensive parsing in most cases by leveraging the country being in the file name
499 if (!maybeCountry(aRegionCode, localeCountry) && !maybeCountry(aRegionCode, localeLanguageCountry)) {
500 continue;
501 }
502
503 const auto hr = KHolidays::HolidayRegion(aRegionCode);
504 QString regionCountry = hr.countryCode().toLower();
505 QString regionSubdivisionCountry;
506 if (regionCountry.split(QLatin1Char('-')).count() > 1) {
507 regionSubdivisionCountry = regionCountry.split(QLatin1Char('-')).at(0);
508 } else {
509 regionSubdivisionCountry = regionCountry;
510 }
511 QString regionLanguage = hr.languageCode().toLower();
512
513 if (regionCountry == localeCountry && regionLanguage == localeLanguage) {
514 // exact match so don't look further
515 return aRegionCode;
516 } else if (regionCountry == localeSubdivision && regionLanguage == localeLanguage) {
517 countryAndLanguageMatch = aRegionCode;
518 } else if (regionCountry == localeCountry) {
519 if (countryOnlyMatch.isEmpty()) {
520 countryOnlyMatch = aRegionCode;
521 }
522 } else if (!regionSubdivisionCountry.isEmpty() && regionSubdivisionCountry == localeSubdivision && regionLanguage == localeLanguage) {
523 if (subdivisionAndLanguageMatch.isEmpty()) {
524 subdivisionAndLanguageMatch = aRegionCode;
525 }
526 } else if (!regionSubdivisionCountry.isEmpty() && regionSubdivisionCountry == localeSubdivision) {
527 if (subdivisionOnlyMatch.isEmpty()) {
528 subdivisionOnlyMatch = aRegionCode;
529 }
530 } else if (!localeLanguageCountry.isEmpty() && regionCountry == localeLanguageCountry && regionLanguage == localeLanguage) {
531 if (languageCountryAndLanguageMatch.isEmpty()) {
532 languageCountryAndLanguageMatch = aRegionCode;
533 }
534 } else if (!localeLanguageCountry.isEmpty() && regionCountry == localeLanguageCountry) {
535 if (languageCountryOnlyMatch.isEmpty()) {
536 languageCountryOnlyMatch = aRegionCode;
537 }
538 } else if (!regionSubdivisionCountry.isEmpty() && !localeLanguageCountry.isEmpty() && regionSubdivisionCountry == localeLanguageCountry
539 && regionLanguage == localeLanguage) {
540 if (languageSubdivisionAndLanguageMatch.isEmpty()) {
541 languageSubdivisionAndLanguageMatch = aRegionCode;
542 }
543 } else if (!regionSubdivisionCountry.isEmpty() && !localeLanguageCountry.isEmpty() && regionSubdivisionCountry == localeLanguageCountry) {
544 if (languageSubdivisionOnlyMatch.isEmpty()) {
545 languageSubdivisionOnlyMatch = aRegionCode;
546 }
547 }
548 }
549
551
552 if (!countryAndLanguageMatch.isEmpty()) {
553 defaultRegionCode = countryAndLanguageMatch;
554 } else if (!countryOnlyMatch.isEmpty()) {
555 defaultRegionCode = countryOnlyMatch;
556 } else if (!subdivisionAndLanguageMatch.isEmpty()) {
557 defaultRegionCode = subdivisionAndLanguageMatch;
558 } else if (!subdivisionOnlyMatch.isEmpty()) {
559 defaultRegionCode = subdivisionOnlyMatch;
560 } else if (!languageCountryAndLanguageMatch.isEmpty()) {
561 defaultRegionCode = languageCountryAndLanguageMatch;
562 } else if (!languageCountryOnlyMatch.isEmpty()) {
563 defaultRegionCode = languageCountryOnlyMatch;
564 } else if (!languageSubdivisionAndLanguageMatch.isEmpty()) {
565 defaultRegionCode = languageSubdivisionAndLanguageMatch;
566 } else if (!languageSubdivisionOnlyMatch.isEmpty()) {
567 defaultRegionCode = languageSubdivisionOnlyMatch;
568 }
569
570 return defaultRegionCode;
571}
Represents a holiday region.
bool isHoliday(const QDate &date) const
Checks whether there is any holiday defined for a date.
Holiday::List rawHolidays(const QDate &startDate, const QDate &endDate) const
static QString defaultRegionCode(const QString &country=QString(), const QString &language=QString())
~HolidayRegion()
Destroys the holidays object.
bool isValid() const
Returns whether the instance contains any holiday data.
HolidayRegion(const QString &regionCode=QString())
Creates a new Holiday Region object for a given standard Region Code.
Holiday::List rawHolidaysWithAstroSeasons(const QDate &startDate, const QDate &endDate) const
static QStringList regionCodes()
HolidayRegion & operator=(const HolidayRegion &)
Assignment operator.
Represents a holiday event.
Definition holiday.h:30
QList< Holiday > List
A list of holiday descriptions.
Definition holiday.h:40
@ NonWorkday
The holiday is a real holiday.
Definition holiday.h:48
KI18NLOCALEDATA_EXPORT KCountry country(const char *ianaId)
QCA_EXPORT void init()
QString translate(const char *context, const char *sourceText, const char *disambiguation, int n)
void append(QList< T > &&value)
const_reference at(qsizetype i) const const
iterator begin()
qsizetype count() const const
iterator end()
bool isEmpty() const const
void push_back(parameter_type value)
void reserve(qsizetype size)
Territory codeToTerritory(QStringView territoryCode)
QString languageToCode(Language language, LanguageCodeTypes codeTypes)
QString territoryToCode(Territory territory)
QString territoryToString(Territory territory)
QStringList locateAll(StandardLocation type, const QString &fileName, LocateOptions options)
QString arg(Args &&... args) const const
qsizetype indexOf(QChar ch, qsizetype from, Qt::CaseSensitivity cs) const const
bool isEmpty() const const
QString left(qsizetype n) const const
QStringList split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
QString toLower() const const
qsizetype size() const const
bool startsWith(QChar ch) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:05:38 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.