File indexing completed on 2025-01-05 04:26:48
0001 /* 0002 * Replacement fot QT Bindings that were removed from QT5 0003 * Copyright (C) 2020 Pedro de Carvalho Gomes <pedrogomes81@gmail.com> 0004 * 0005 * This program is free software: you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation, either version 3 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0017 */ 0018 0019 #include "CoreLocale.h" 0020 0021 #include <QDate> 0022 #include <QDateTime> 0023 #include <QJSEngine> 0024 #include <QTime> 0025 #include <QMetaMethod> 0026 0027 using namespace QtBindings::Core; 0028 0029 Locale::Locale() 0030 { 0031 } 0032 0033 Locale::Locale(const QString &name) : QLocale(name) 0034 { 0035 } 0036 0037 Locale::Locale(QLocale::Language language, QLocale::Country country) : QLocale(language, country) 0038 { 0039 } 0040 0041 Locale::Locale(QLocale::Language language, QLocale::Script script, 0042 QLocale::Country country) : QLocale(language, script, country) 0043 { 0044 } 0045 0046 Locale::Locale(const QLocale &other) : QLocale(other) 0047 { 0048 } 0049 0050 Locale::Locale(const Locale &other) : QObject(), QLocale(other) 0051 { 0052 } 0053 0054 QString Locale::amText() const 0055 { 0056 return QLocale::amText(); 0057 } 0058 0059 QString Locale::bcp47Name() const 0060 { 0061 return QLocale::bcp47Name(); 0062 } 0063 0064 QLocale::Country Locale::country() const 0065 { 0066 return QLocale::country(); 0067 } 0068 0069 QString Locale::createSeparatedList(const QStringList &strl) const 0070 { 0071 return QLocale::createSeparatedList(strl); 0072 } 0073 0074 QString Locale::currencySymbol(QLocale::CurrencySymbolFormat format) const 0075 { 0076 return QLocale::currencySymbol(format); 0077 } 0078 0079 QString Locale::dateFormat(QLocale::FormatType format) const 0080 { 0081 return QLocale::dateFormat(format); 0082 } 0083 0084 QString Locale::dateTimeFormat(QLocale::FormatType format) const 0085 { 0086 return QLocale::dateTimeFormat(format); 0087 } 0088 0089 QString Locale::dayName(int day, QLocale::FormatType format) const 0090 { 0091 return QLocale::dayName(day, format); 0092 } 0093 0094 QChar Locale::decimalPoint() const 0095 { 0096 return QLocale::decimalPoint(); 0097 } 0098 0099 QChar Locale::exponential() const 0100 { 0101 return QLocale::exponential(); 0102 } 0103 0104 Qt::DayOfWeek Locale::firstDayOfWeek() const 0105 { 0106 return QLocale::firstDayOfWeek(); 0107 } 0108 0109 QChar Locale::groupSeparator() const 0110 { 0111 return QLocale::groupSeparator(); 0112 } 0113 0114 QLocale::Language Locale::language() const 0115 { 0116 return QLocale::language(); 0117 } 0118 0119 QLocale::MeasurementSystem Locale::measurementSystem() const 0120 { 0121 return QLocale::measurementSystem(); 0122 } 0123 0124 QString Locale::monthName(int month, QLocale::FormatType format) const 0125 { 0126 return QLocale::monthName(month, format); 0127 } 0128 0129 QString Locale::name() const 0130 { 0131 return QLocale::name(); 0132 } 0133 0134 QString Locale::nativeCountryName() const 0135 { 0136 return QLocale::nativeCountryName(); 0137 } 0138 0139 QString Locale::nativeLanguageName() const 0140 { 0141 return QLocale::nativeLanguageName(); 0142 } 0143 0144 QChar Locale::negativeSign() const 0145 { 0146 return QLocale::negativeSign(); 0147 } 0148 0149 QLocale::NumberOptions Locale::numberOptions() const 0150 { 0151 return QLocale::numberOptions(); 0152 } 0153 0154 QChar Locale::percent() const 0155 { 0156 return QLocale::percent(); 0157 } 0158 0159 QString Locale::pmText() const 0160 { 0161 return QLocale::pmText(); 0162 } 0163 0164 QChar Locale::positiveSign() const 0165 { 0166 return QLocale::positiveSign(); 0167 } 0168 0169 QString Locale::quoteString(const QStringRef &str, QLocale::QuotationStyle style) const 0170 { 0171 return QLocale::quoteString(str, style); 0172 } 0173 0174 QString Locale::quoteString(const QString &str, QLocale::QuotationStyle style) const 0175 { 0176 return QLocale::quoteString(str, style); 0177 } 0178 0179 QLocale::Script Locale::script() const 0180 { 0181 return QLocale::script(); 0182 } 0183 0184 void Locale::setNumberOptions(QLocale::NumberOptions options) 0185 { 0186 QLocale::setNumberOptions(options); 0187 } 0188 0189 QString Locale::standaloneDayName(int day, QLocale::FormatType format) const 0190 { 0191 return QLocale::standaloneDayName(day, format); 0192 } 0193 0194 QString Locale::standaloneMonthName(int month, QLocale::FormatType format) const 0195 { 0196 return QLocale::standaloneMonthName(month, format); 0197 } 0198 0199 void Locale::swap(QLocale &other) 0200 { 0201 QLocale::swap(other); 0202 } 0203 0204 Qt::LayoutDirection Locale::textDirection() const 0205 { 0206 return QLocale::textDirection(); 0207 } 0208 0209 QString Locale::timeFormat(QLocale::FormatType format) const 0210 { 0211 return QLocale::timeFormat(format); 0212 } 0213 0214 QString Locale::toCurrencyString(double value, const QString &symbol, int precision) const 0215 { 0216 return QLocale::toCurrencyString(value, symbol, precision); 0217 } 0218 0219 QString Locale::toCurrencyString(double value, const QString &symbol) const 0220 { 0221 return QLocale::toCurrencyString(value, symbol); 0222 } 0223 0224 QString Locale::toCurrencyString(float i, const QString &symbol, int precision) const 0225 { 0226 return QLocale::toCurrencyString(i, symbol, precision); 0227 } 0228 0229 QString Locale::toCurrencyString(float i, const QString &symbol) const 0230 { 0231 return QLocale::toCurrencyString(i, symbol); 0232 } 0233 0234 QString Locale::toCurrencyString(int value, const QString &symbol) const 0235 { 0236 return QLocale::toCurrencyString(value, symbol); 0237 } 0238 0239 QString Locale::toCurrencyString(qlonglong value, const QString &symbol) const 0240 { 0241 return QLocale::toCurrencyString(value, symbol); 0242 } 0243 0244 QString Locale::toCurrencyString(qulonglong value, const QString &symbol) const 0245 { 0246 return QLocale::toCurrencyString(value, symbol); 0247 } 0248 0249 QString Locale::toCurrencyString(short value, const QString &symbol) const 0250 { 0251 return QLocale::toCurrencyString(value, symbol); 0252 } 0253 0254 QString Locale::toCurrencyString(uint value, const QString &symbol) const 0255 { 0256 return QLocale::toCurrencyString(value, symbol); 0257 } 0258 0259 QString Locale::toCurrencyString(ushort value, const QString &symbol) const 0260 { 0261 return QLocale::toCurrencyString(value, symbol); 0262 } 0263 0264 QDate Locale::toDate(const QString &string, const QString &format) const 0265 { 0266 return QLocale::toDate(string, format); 0267 } 0268 0269 QDate Locale::toDate(const QString &string, QLocale::FormatType format) const 0270 { 0271 return QLocale::toDate(string, format); 0272 } 0273 0274 QDateTime Locale::toDateTime(const QString &string, const QString &format) const 0275 { 0276 return QLocale::toDateTime(string, format); 0277 } 0278 0279 QDateTime Locale::toDateTime(const QString &string, QLocale::FormatType format) const 0280 { 0281 return QLocale::toDateTime(string, format); 0282 } 0283 0284 double Locale::toDouble(const QStringRef &s, bool *ok) const 0285 { 0286 return QLocale::toDouble(s, ok); 0287 } 0288 0289 double Locale::toDouble(const QString &s, bool *ok) const 0290 { 0291 return QLocale::toDouble(s, ok); 0292 } 0293 0294 float Locale::toFloat(const QStringRef &s, bool *ok) const 0295 { 0296 return QLocale::toFloat(s, ok); 0297 } 0298 0299 float Locale::toFloat(const QString &s, bool *ok) const 0300 { 0301 return QLocale::toFloat(s, ok); 0302 } 0303 0304 int Locale::toInt(const QStringRef &s, bool *ok) const 0305 { 0306 return QLocale::toInt(s, ok); 0307 } 0308 0309 int Locale::toInt(const QString &s, bool *ok) const 0310 { 0311 return QLocale::toInt(s, ok); 0312 } 0313 0314 qlonglong Locale::toLongLong(const QStringRef &s, bool *ok) const 0315 { 0316 return QLocale::toLongLong(s, ok); 0317 } 0318 0319 qlonglong Locale::toLongLong(const QString &s, bool *ok) const 0320 { 0321 return QLocale::toLongLong(s, ok); 0322 } 0323 0324 QString Locale::toLower(const QString &str) const 0325 { 0326 return QLocale::toLower(str); 0327 } 0328 0329 short Locale::toShort(const QStringRef &s, bool *ok) const 0330 { 0331 return QLocale::toShort(s, ok); 0332 } 0333 0334 short Locale::toShort(const QString &s, bool *ok) const 0335 { 0336 return QLocale::toShort(s, ok); 0337 } 0338 0339 QString Locale::toString(const QDate &date, const QString &formatStr) const 0340 { 0341 return QLocale::toString(date, formatStr); 0342 } 0343 0344 QString Locale::toString(const QDate &date, QLocale::FormatType format) const 0345 { 0346 return QLocale::toString(date, format); 0347 } 0348 0349 QString Locale::toString(const QDateTime &dateTime, const QString &format) const 0350 { 0351 return QLocale::toString(dateTime, format); 0352 } 0353 0354 QString Locale::toString(const QDateTime &dateTime, QLocale::FormatType format) const 0355 { 0356 return QLocale::toString(dateTime, format); 0357 } 0358 0359 QString Locale::toString(const QTime &time, const QString &formatStr) const 0360 { 0361 return QLocale::toString(time, formatStr); 0362 } 0363 0364 QString Locale::toString(const QTime &time, QLocale::FormatType format) const 0365 { 0366 return QLocale::toString(time, format); 0367 } 0368 0369 QString Locale::toString(double i, char f, int prec) const 0370 { 0371 return QLocale::toString(i, f, prec); 0372 } 0373 0374 QString Locale::toString(float i, char f, int prec) const 0375 { 0376 return QLocale::toString(i, f, prec); 0377 } 0378 0379 QString Locale::toString(int i) const 0380 { 0381 return QLocale::toString(i); 0382 } 0383 0384 QString Locale::toString(qlonglong i) const 0385 { 0386 return QLocale::toString(i); 0387 } 0388 0389 QString Locale::toString(qulonglong i) const 0390 { 0391 return QLocale::toString(i); 0392 } 0393 0394 QString Locale::toString(short i) const 0395 { 0396 return QLocale::toString(i); 0397 } 0398 0399 QString Locale::toString(uint i) const 0400 { 0401 return QLocale::toString(i); 0402 } 0403 0404 QString Locale::toString(ushort i) const 0405 { 0406 return QLocale::toString(i); 0407 } 0408 0409 QTime Locale::toTime(const QString &string, const QString &format) const 0410 { 0411 return QLocale::toTime(string, format); 0412 } 0413 0414 QTime Locale::toTime(const QString &string, QLocale::FormatType format) const 0415 { 0416 return QLocale::toTime(string, format); 0417 } 0418 0419 uint Locale::toUInt(const QStringRef &s, bool *ok) const 0420 { 0421 return QLocale::toUInt(s, ok); 0422 } 0423 0424 uint Locale::toUInt(const QString &s, bool *ok) const 0425 { 0426 return QLocale::toUInt(s, ok); 0427 } 0428 0429 qulonglong Locale::toULongLong(const QStringRef &s, bool *ok) const 0430 { 0431 return QLocale::toULongLong(s, ok); 0432 } 0433 0434 qulonglong Locale::toULongLong(const QString &s, bool *ok) const 0435 { 0436 return QLocale::toULongLong(s, ok); 0437 } 0438 0439 QString Locale::toUpper(const QString &str) const 0440 { 0441 return QLocale::toUpper(str); 0442 } 0443 0444 ushort Locale::toUShort(const QStringRef &s, bool *ok) const 0445 { 0446 return QLocale::toUShort(s, ok); 0447 } 0448 0449 ushort Locale::toUShort(const QString &s, bool *ok) const 0450 { 0451 return QLocale::toUShort(s, ok); 0452 } 0453 0454 QStringList Locale::uiLanguages() const 0455 { 0456 return QLocale::uiLanguages(); 0457 } 0458 0459 QList<Qt::DayOfWeek> Locale::weekdays() const 0460 { 0461 return QLocale::weekdays(); 0462 } 0463 0464 QChar Locale::zeroDigit() const 0465 { 0466 return QLocale::zeroDigit(); 0467 } 0468 0469 QList<QLocale::Country> Locale::countriesForLanguage(QLocale::Language lang) 0470 { 0471 return QLocale::countriesForLanguage(lang); 0472 } 0473 0474 QList<QLocale> 0475 Locale::matchingLocales(QLocale::Language language, QLocale::Script script, QLocale::Country country) 0476 { 0477 return QLocale::matchingLocales(language,script,country); 0478 } 0479 0480 QLocale Locale::c() 0481 { 0482 return QLocale::c(); 0483 } 0484 0485 Locale Locale::system() 0486 { 0487 return Locale(QLocale::system()); 0488 } 0489 0490 QString Locale::countryToString(QLocale::Country country) 0491 { 0492 return QLocale::countryToString(country); 0493 } 0494 0495 QString Locale::languageToString(QLocale::Language language) 0496 { 0497 return QLocale::languageToString(language); 0498 } 0499 0500 QString Locale::scriptToString(QLocale::Script script) 0501 { 0502 return QLocale::scriptToString(script); 0503 } 0504 0505 void Locale::setDefault(const QLocale &locale) 0506 { 0507 QLocale::setDefault(locale); 0508 } 0509 0510 Locale &Locale::operator=(const Locale &other) 0511 { 0512 if (this != &other) 0513 QLocale::operator=(other); 0514 return *this; 0515 }