| 1 | // Copyright (C) 2021 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com> |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #define QT_CORE_BUILD_REMOVED_API |
| 5 | |
| 6 | #include "qglobal.h" |
| 7 | |
| 8 | QT_USE_NAMESPACE |
| 9 | |
| 10 | #if QT_CORE_REMOVED_SINCE(6, 1) |
| 11 | |
| 12 | #include "qmetatype.h" |
| 13 | |
| 14 | int QMetaType::id() const |
| 15 | { |
| 16 | return registerHelper(); |
| 17 | } |
| 18 | |
| 19 | #endif // QT_CORE_REMOVED_SINCE(6, 1) |
| 20 | |
| 21 | #if QT_CORE_REMOVED_SINCE(6, 2) |
| 22 | |
| 23 | #include "qbindingstorage.h" |
| 24 | |
| 25 | void QBindingStorage::maybeUpdateBindingAndRegister_helper(const QUntypedPropertyData *data) const |
| 26 | { |
| 27 | registerDependency_helper(data); |
| 28 | } |
| 29 | |
| 30 | #endif // QT_CORE_REMOVED_SINCE(6, 2) |
| 31 | |
| 32 | #if QT_CORE_REMOVED_SINCE(6, 3) |
| 33 | |
| 34 | #include "qbytearraymatcher.h" |
| 35 | |
| 36 | # if QT_POINTER_SIZE != 4 |
| 37 | |
| 38 | int QStaticByteArrayMatcherBase::indexOfIn(const char *h, uint hl, const char *n, int nl, int from) const noexcept |
| 39 | { |
| 40 | qsizetype r = indexOfIn(needle: h, nlen: size_t(hl), haystack: n, hlen: qsizetype(nl), from: qsizetype(from)); |
| 41 | Q_ASSERT(r == int(r)); |
| 42 | return r; |
| 43 | } |
| 44 | |
| 45 | # endif // QT_POINTER_SIZE != 4 |
| 46 | |
| 47 | qsizetype QByteArrayMatcher::indexIn(const QByteArray &ba, qsizetype from) const |
| 48 | { |
| 49 | return indexIn(data: QByteArrayView{ba}, from); // ba.isNull() may be significant, so don't ignore it! |
| 50 | } |
| 51 | |
| 52 | #include "tools/qcryptographichash.h" |
| 53 | |
| 54 | void QCryptographicHash::addData(const QByteArray &data) |
| 55 | { |
| 56 | addData(data: QByteArrayView{data}); |
| 57 | } |
| 58 | |
| 59 | QByteArray QCryptographicHash::hash(const QByteArray &data, Algorithm method) |
| 60 | { |
| 61 | return hash(data: QByteArrayView{data}, method); |
| 62 | } |
| 63 | |
| 64 | #include "qdatastream.h" |
| 65 | |
| 66 | # ifndef QT_NO_DATASTREAM |
| 67 | # include "qfloat16.h" |
| 68 | |
| 69 | QDataStream &QDataStream::operator>>(qfloat16 &f) |
| 70 | { |
| 71 | return *this >> reinterpret_cast<qint16&>(f); |
| 72 | } |
| 73 | |
| 74 | QDataStream &QDataStream::operator<<(qfloat16 f) |
| 75 | { |
| 76 | return *this << reinterpret_cast<qint16&>(f); |
| 77 | } |
| 78 | |
| 79 | # endif |
| 80 | |
| 81 | #include "quuid.h" |
| 82 | |
| 83 | QUuid::QUuid(const QString &text) |
| 84 | : QUuid{qToAnyStringViewIgnoringNull(s: text)} |
| 85 | { |
| 86 | } |
| 87 | |
| 88 | QUuid::QUuid(const char *text) |
| 89 | : QUuid{QAnyStringView(text)} |
| 90 | { |
| 91 | } |
| 92 | |
| 93 | QUuid::QUuid(const QByteArray &text) |
| 94 | : QUuid{qToAnyStringViewIgnoringNull(s: text)} |
| 95 | { |
| 96 | } |
| 97 | |
| 98 | QUuid QUuid::fromString(QStringView string) noexcept |
| 99 | { |
| 100 | return fromString(string: QAnyStringView{string}); |
| 101 | } |
| 102 | |
| 103 | QUuid QUuid::fromString(QLatin1StringView string) noexcept |
| 104 | { |
| 105 | return fromString(string: QAnyStringView{string}); |
| 106 | } |
| 107 | |
| 108 | QUuid QUuid::fromRfc4122(const QByteArray &bytes) |
| 109 | { |
| 110 | return fromRfc4122(qToByteArrayViewIgnoringNull(b: bytes)); |
| 111 | } |
| 112 | |
| 113 | #include "qbytearraylist.h" |
| 114 | |
| 115 | # if QT_POINTER_SIZE != 4 |
| 116 | QByteArray QtPrivate::QByteArrayList_join(const QByteArrayList *that, const char *sep, int seplen) |
| 117 | { |
| 118 | return QByteArrayList_join(that, sep, len: qsizetype(seplen)); |
| 119 | } |
| 120 | # endif |
| 121 | |
| 122 | #include "qlocale.h" |
| 123 | |
| 124 | QString QLocale::languageToCode(Language language) |
| 125 | { |
| 126 | return languageToCode(language, codeTypes: QLocale::AnyLanguageCode); |
| 127 | } |
| 128 | |
| 129 | QLocale::Language QLocale::codeToLanguage(QStringView languageCode) noexcept |
| 130 | { |
| 131 | return codeToLanguage(languageCode, codeTypes: QLocale::AnyLanguageCode); |
| 132 | } |
| 133 | |
| 134 | #include "qoperatingsystemversion.h" |
| 135 | |
| 136 | QOperatingSystemVersion QOperatingSystemVersion::current() |
| 137 | { |
| 138 | return QOperatingSystemVersionBase::current(); |
| 139 | } |
| 140 | |
| 141 | QString QOperatingSystemVersion::name() const |
| 142 | { |
| 143 | return QOperatingSystemVersionBase::name(); |
| 144 | } |
| 145 | |
| 146 | int QOperatingSystemVersion::compare(const QOperatingSystemVersion &v1, |
| 147 | const QOperatingSystemVersion &v2) |
| 148 | { |
| 149 | return QOperatingSystemVersionBase::compare(v1, v2); |
| 150 | } |
| 151 | |
| 152 | #include "qurl.h" |
| 153 | |
| 154 | QString QUrl::fromAce(const QByteArray &domain) |
| 155 | { |
| 156 | return fromAce(domain, options: {}); |
| 157 | } |
| 158 | |
| 159 | QByteArray QUrl::toAce(const QString &domain) |
| 160 | { |
| 161 | return toAce(domain, options: {}); |
| 162 | } |
| 163 | |
| 164 | #endif // QT_CORE_REMOVED_SINCE(6, 3) |
| 165 | |
| 166 | #if QT_CORE_REMOVED_SINCE(6, 4) |
| 167 | |
| 168 | #include "qbytearray.h" // uses QT_CORE_INLINE_SINCE |
| 169 | |
| 170 | #include "qcalendar.h" |
| 171 | |
| 172 | QCalendar::QCalendar(QStringView name) |
| 173 | : QCalendar(QAnyStringView{name}) {} |
| 174 | |
| 175 | QCalendar::QCalendar(QLatin1StringView name) |
| 176 | : QCalendar(QAnyStringView{name}) {} |
| 177 | |
| 178 | #include "qcollator.h" // inline function compare(ptr, n, ptr, n) (for MSVC) |
| 179 | |
| 180 | #include "qhashfunctions.h" |
| 181 | |
| 182 | size_t qHash(const QByteArray &key, size_t seed) noexcept |
| 183 | { |
| 184 | return qHashBits(p: key.constData(), size: size_t(key.size()), seed); |
| 185 | } |
| 186 | |
| 187 | size_t qHash(const QByteArrayView &key, size_t seed) noexcept |
| 188 | { |
| 189 | return qHashBits(p: key.constData(), size: size_t(key.size()), seed); |
| 190 | } |
| 191 | |
| 192 | #include "qobject.h" |
| 193 | |
| 194 | void QObject::setObjectName(const QString &name) |
| 195 | { |
| 196 | setObjectName<void>(name); |
| 197 | } |
| 198 | |
| 199 | #include "qlocale.h" // uses QT_CORE_INLINE_SINCE |
| 200 | |
| 201 | #if QT_CONFIG(settings) |
| 202 | |
| 203 | #include "qsettings.h" |
| 204 | |
| 205 | void QSettings::beginGroup(const QString &prefix) |
| 206 | { |
| 207 | beginGroup(prefix: qToAnyStringViewIgnoringNull(s: prefix)); |
| 208 | } |
| 209 | |
| 210 | int QSettings::beginReadArray(const QString &prefix) |
| 211 | { |
| 212 | return beginReadArray(prefix: qToAnyStringViewIgnoringNull(s: prefix)); |
| 213 | } |
| 214 | |
| 215 | void QSettings::beginWriteArray(const QString &prefix, int size) |
| 216 | { |
| 217 | beginWriteArray(prefix: qToAnyStringViewIgnoringNull(s: prefix), size); |
| 218 | } |
| 219 | |
| 220 | void QSettings::setValue(const QString &key, const QVariant &value) |
| 221 | { |
| 222 | setValue(key: qToAnyStringViewIgnoringNull(s: key), value); |
| 223 | } |
| 224 | |
| 225 | void QSettings::remove(const QString &key) |
| 226 | { |
| 227 | remove(key: qToAnyStringViewIgnoringNull(s: key)); |
| 228 | } |
| 229 | |
| 230 | bool QSettings::contains(const QString &key) const |
| 231 | { |
| 232 | return contains(key: qToAnyStringViewIgnoringNull(s: key)); |
| 233 | } |
| 234 | |
| 235 | QVariant QSettings::value(const QString &key, const QVariant &defaultValue) const |
| 236 | { |
| 237 | return value(key: qToAnyStringViewIgnoringNull(s: key), defaultValue); |
| 238 | } |
| 239 | |
| 240 | QVariant QSettings::value(const QString &key) const |
| 241 | { |
| 242 | return value(key: qToAnyStringViewIgnoringNull(s: key)); |
| 243 | } |
| 244 | |
| 245 | #endif // QT_CONFIG(settings) |
| 246 | |
| 247 | #include "qversionnumber.h" |
| 248 | |
| 249 | QT_WARNING_PUSH |
| 250 | QT_WARNING_DISABLE_DEPRECATED |
| 251 | |
| 252 | QVersionNumber QVersionNumber::fromString(const QString &string, int *suffixIndex) |
| 253 | { |
| 254 | return fromString(string: qToAnyStringViewIgnoringNull(s: string), suffixIndex); |
| 255 | } |
| 256 | |
| 257 | QVersionNumber QVersionNumber::fromString(QStringView string, int *suffixIndex) |
| 258 | { |
| 259 | return fromString(string: QAnyStringView{string}, suffixIndex); |
| 260 | } |
| 261 | |
| 262 | QVersionNumber QVersionNumber::fromString(QLatin1StringView string, int *suffixIndex) |
| 263 | { |
| 264 | return fromString(string: QAnyStringView{string}, suffixIndex); |
| 265 | } |
| 266 | |
| 267 | QT_WARNING_POP |
| 268 | |
| 269 | // #include <qotherheader.h> |
| 270 | // // implement removed functions from qotherheader.h |
| 271 | // order sections alphabetically to reduce chances of merge conflicts |
| 272 | |
| 273 | #endif // QT_CORE_REMOVED_SINCE(6, 4) |
| 274 | |
| 275 | #if QT_CORE_REMOVED_SINCE(6, 5) |
| 276 | |
| 277 | #include "qbasictimer.h" // inlined API |
| 278 | |
| 279 | #include "qbuffer.h" // inline removed API |
| 280 | |
| 281 | #include "qdir.h" |
| 282 | |
| 283 | uint QDir::count() const |
| 284 | { |
| 285 | return uint(count(QT6_CALL_NEW_OVERLOAD)); |
| 286 | } |
| 287 | |
| 288 | #if QT_POINTER_SIZE != 4 |
| 289 | QString QDir::operator[](int i) const |
| 290 | { |
| 291 | return operator[](qsizetype{i}); |
| 292 | } |
| 293 | #endif |
| 294 | |
| 295 | #include "qtenvironmentvariables.h" |
| 296 | |
| 297 | bool qputenv(const char *varName, const QByteArray &value) |
| 298 | { |
| 299 | return qputenv(varName, value: qToByteArrayViewIgnoringNull(b: value)); |
| 300 | } |
| 301 | |
| 302 | #include "qmetatype.h" |
| 303 | |
| 304 | int QMetaType::idHelper() const |
| 305 | { |
| 306 | Q_ASSERT(d_ptr); |
| 307 | return registerHelper(iface: d_ptr); |
| 308 | } |
| 309 | |
| 310 | #if QT_CONFIG(sharedmemory) |
| 311 | #include "qsharedmemory.h" |
| 312 | |
| 313 | void QSharedMemory::setNativeKey(const QString &key) |
| 314 | { |
| 315 | setNativeKey(key, type: QNativeIpcKey::legacyDefaultTypeForOs()); |
| 316 | } |
| 317 | #endif |
| 318 | |
| 319 | #include "qvariant.h" |
| 320 | |
| 321 | // these implementations aren't as efficient as they used to be prior to |
| 322 | // replacement, but there's no way to call the ambiguous overload |
| 323 | QVariant::QVariant(const QUuid &uuid) : QVariant(QVariant::fromValue(value: uuid)) {} |
| 324 | #include "qline.h" |
| 325 | #include "qpoint.h" |
| 326 | #include "qrect.h" |
| 327 | #include "qsize.h" |
| 328 | QVariant::QVariant(const QPoint &pt) : QVariant(QVariant::fromValue(value: pt)) {} |
| 329 | QVariant::QVariant(const QPointF &pt) : QVariant(QVariant::fromValue(value: pt)) {} |
| 330 | QVariant::QVariant(const QRect &r) : QVariant(QVariant::fromValue(value: r)) {} |
| 331 | QVariant::QVariant(const QRectF &r) : QVariant(QVariant::fromValue(value: r)) {} |
| 332 | QVariant::QVariant(const QLine &l) : QVariant(QVariant::fromValue(value: l)) {} |
| 333 | QVariant::QVariant(const QLineF &l) : QVariant(QVariant::fromValue(value: l)) {} |
| 334 | QVariant::QVariant(const QSize &s) : QVariant(QVariant::fromValue(value: s)) {} |
| 335 | QVariant::QVariant(const QSizeF &s) : QVariant(QVariant::fromValue(value: s)) {} |
| 336 | |
| 337 | #if QT_CONFIG(xmlstreamreader) |
| 338 | |
| 339 | #include "qxmlstream.h" |
| 340 | |
| 341 | QXmlStreamReader::QXmlStreamReader(const QByteArray &data) |
| 342 | : QXmlStreamReader(data, PrivateConstructorTag{}) |
| 343 | { |
| 344 | } |
| 345 | |
| 346 | QXmlStreamReader::QXmlStreamReader(const QString &data) |
| 347 | : QXmlStreamReader(qToAnyStringViewIgnoringNull(s: data)) |
| 348 | { |
| 349 | } |
| 350 | |
| 351 | QXmlStreamReader::QXmlStreamReader(const char *data) |
| 352 | : QXmlStreamReader(QAnyStringView(data)) |
| 353 | { |
| 354 | } |
| 355 | |
| 356 | void QXmlStreamReader::addData(const QByteArray &data) |
| 357 | { |
| 358 | addData<>(data); |
| 359 | } |
| 360 | void QXmlStreamReader::addData(const QString &data) |
| 361 | { |
| 362 | addData(data: qToAnyStringViewIgnoringNull(s: data)); |
| 363 | } |
| 364 | |
| 365 | void QXmlStreamReader::addData(const char *data) |
| 366 | { |
| 367 | addData(data: QAnyStringView(data)); |
| 368 | } |
| 369 | |
| 370 | #endif // QT_CONFIG(xmlstreamreader) |
| 371 | |
| 372 | #if QT_CONFIG(xmlstreamwriter) |
| 373 | |
| 374 | #include "qxmlstream.h" |
| 375 | |
| 376 | void QXmlStreamWriter::writeAttribute(const QString &qualifiedName, const QString &value) |
| 377 | { |
| 378 | writeAttribute(qualifiedName: qToAnyStringViewIgnoringNull(s: qualifiedName), |
| 379 | value: qToAnyStringViewIgnoringNull(s: value)); |
| 380 | } |
| 381 | |
| 382 | void QXmlStreamWriter::writeAttribute(const QString &namespaceUri, const QString &name, const QString &value) |
| 383 | { |
| 384 | writeAttribute(namespaceUri: qToAnyStringViewIgnoringNull(s: namespaceUri), |
| 385 | name: qToAnyStringViewIgnoringNull(s: name), |
| 386 | value: qToAnyStringViewIgnoringNull(s: value)); |
| 387 | } |
| 388 | |
| 389 | void QXmlStreamWriter::writeCDATA(const QString &text) |
| 390 | { |
| 391 | writeCDATA(text: qToAnyStringViewIgnoringNull(s: text)); |
| 392 | } |
| 393 | |
| 394 | void QXmlStreamWriter::writeCharacters(const QString &text) |
| 395 | { |
| 396 | writeCharacters(text: qToAnyStringViewIgnoringNull(s: text)); |
| 397 | } |
| 398 | |
| 399 | void QXmlStreamWriter::(const QString &text) |
| 400 | { |
| 401 | writeComment(text: qToAnyStringViewIgnoringNull(s: text)); |
| 402 | } |
| 403 | |
| 404 | void QXmlStreamWriter::writeDTD(const QString &dtd) |
| 405 | { |
| 406 | writeDTD(dtd: qToAnyStringViewIgnoringNull(s: dtd)); |
| 407 | } |
| 408 | |
| 409 | void QXmlStreamWriter::writeEmptyElement(const QString &qualifiedName) |
| 410 | { |
| 411 | writeEmptyElement(qualifiedName: qToAnyStringViewIgnoringNull(s: qualifiedName)); |
| 412 | } |
| 413 | |
| 414 | void QXmlStreamWriter::writeEmptyElement(const QString &namespaceUri, const QString &name) |
| 415 | { |
| 416 | writeEmptyElement(namespaceUri: qToAnyStringViewIgnoringNull(s: namespaceUri), |
| 417 | name: qToAnyStringViewIgnoringNull(s: name)); |
| 418 | } |
| 419 | |
| 420 | void QXmlStreamWriter::writeTextElement(const QString &qualifiedName, const QString &text) |
| 421 | { |
| 422 | writeTextElement(qualifiedName: qToAnyStringViewIgnoringNull(s: qualifiedName), |
| 423 | text: qToAnyStringViewIgnoringNull(s: text)); |
| 424 | } |
| 425 | |
| 426 | void QXmlStreamWriter::writeTextElement(const QString &namespaceUri, const QString &name, const QString &text) |
| 427 | { |
| 428 | writeTextElement(namespaceUri: qToAnyStringViewIgnoringNull(s: namespaceUri), |
| 429 | name: qToAnyStringViewIgnoringNull(s: name), |
| 430 | text: qToAnyStringViewIgnoringNull(s: text)); |
| 431 | } |
| 432 | |
| 433 | void QXmlStreamWriter::writeEntityReference(const QString &name) |
| 434 | { |
| 435 | writeEntityReference(name: qToAnyStringViewIgnoringNull(s: name)); |
| 436 | } |
| 437 | |
| 438 | void QXmlStreamWriter::writeNamespace(const QString &namespaceUri, const QString &prefix) |
| 439 | { |
| 440 | writeNamespace(namespaceUri: qToAnyStringViewIgnoringNull(s: namespaceUri), |
| 441 | prefix: qToAnyStringViewIgnoringNull(s: prefix)); |
| 442 | } |
| 443 | |
| 444 | void QXmlStreamWriter::writeDefaultNamespace(const QString &namespaceUri) |
| 445 | { |
| 446 | writeDefaultNamespace(namespaceUri: qToAnyStringViewIgnoringNull(s: namespaceUri)); |
| 447 | } |
| 448 | |
| 449 | void QXmlStreamWriter::writeProcessingInstruction(const QString &target, const QString &data) |
| 450 | { |
| 451 | writeProcessingInstruction(target: qToAnyStringViewIgnoringNull(s: target), |
| 452 | data: qToAnyStringViewIgnoringNull(s: data)); |
| 453 | } |
| 454 | |
| 455 | void QXmlStreamWriter::writeStartDocument(const QString &version) |
| 456 | { |
| 457 | writeStartDocument(version: qToAnyStringViewIgnoringNull(s: version)); |
| 458 | } |
| 459 | |
| 460 | void QXmlStreamWriter::writeStartDocument(const QString &version, bool standalone) |
| 461 | { |
| 462 | writeStartDocument(version: qToAnyStringViewIgnoringNull(s: version), |
| 463 | standalone); |
| 464 | } |
| 465 | |
| 466 | void QXmlStreamWriter::writeStartElement(const QString &qualifiedName) |
| 467 | { |
| 468 | writeStartElement(qualifiedName: qToAnyStringViewIgnoringNull(s: qualifiedName)); |
| 469 | } |
| 470 | |
| 471 | void QXmlStreamWriter::writeStartElement(const QString &namespaceUri, const QString &name) |
| 472 | { |
| 473 | writeStartElement(namespaceUri: qToAnyStringViewIgnoringNull(s: namespaceUri), |
| 474 | name: qToAnyStringViewIgnoringNull(s: name)); |
| 475 | } |
| 476 | |
| 477 | #endif // QT_CONFIG(xmlstreamwriter) |
| 478 | |
| 479 | // inlined API |
| 480 | #include "qfloat16.h" |
| 481 | #include "qstring.h" |
| 482 | |
| 483 | // #include "qotherheader.h" |
| 484 | // // implement removed functions from qotherheader.h |
| 485 | // order sections alphabetically to reduce chances of merge conflicts |
| 486 | |
| 487 | #endif // QT_CORE_REMOVED_SINCE(6, 5) |
| 488 | |
| 489 | #if QT_CORE_REMOVED_SINCE(6, 6) |
| 490 | |
| 491 | #include "qmessageauthenticationcode.h" |
| 492 | |
| 493 | QMessageAuthenticationCode::QMessageAuthenticationCode(QCryptographicHash::Algorithm method, |
| 494 | const QByteArray &key) |
| 495 | : QMessageAuthenticationCode(method, qToByteArrayViewIgnoringNull(b: key)) {} |
| 496 | |
| 497 | void QMessageAuthenticationCode::setKey(const QByteArray &key) |
| 498 | { |
| 499 | setKey(qToByteArrayViewIgnoringNull(b: key)); |
| 500 | } |
| 501 | |
| 502 | void QMessageAuthenticationCode::addData(const QByteArray &data) |
| 503 | { |
| 504 | addData(data: qToByteArrayViewIgnoringNull(b: data)); |
| 505 | } |
| 506 | |
| 507 | QByteArray QMessageAuthenticationCode::hash(const QByteArray &msg, const QByteArray &key, |
| 508 | QCryptographicHash::Algorithm method) |
| 509 | { |
| 510 | return hash(message: qToByteArrayViewIgnoringNull(b: msg), |
| 511 | key: qToByteArrayViewIgnoringNull(b: key), method); |
| 512 | } |
| 513 | |
| 514 | #include "qobject.h" // inlined API |
| 515 | |
| 516 | #include "qrunnable.h" |
| 517 | |
| 518 | QRunnable *QRunnable::create(std::function<void()> functionToRun) |
| 519 | { |
| 520 | return QRunnable::create<std::function<void()>>(functionToRun: std::move(functionToRun)); |
| 521 | } |
| 522 | |
| 523 | #include "qstring.h" |
| 524 | |
| 525 | qsizetype QString::toUcs4_helper(const ushort *uc, qsizetype length, uint *out) |
| 526 | { |
| 527 | return toUcs4_helper(uc: reinterpret_cast<const char16_t *>(uc), length, |
| 528 | out: reinterpret_cast<char32_t *>(out)); |
| 529 | } |
| 530 | |
| 531 | #if QT_CONFIG(thread) |
| 532 | #include "qreadwritelock.h" |
| 533 | |
| 534 | bool QReadWriteLock::tryLockForRead() |
| 535 | { |
| 536 | return tryLockForRead(timeout: 0); |
| 537 | } |
| 538 | |
| 539 | bool QReadWriteLock::tryLockForWrite() |
| 540 | { |
| 541 | return tryLockForWrite(timeout: 0); |
| 542 | } |
| 543 | |
| 544 | #include "qthreadpool.h" |
| 545 | #include "private/qthreadpool_p.h" |
| 546 | |
| 547 | void QThreadPool::start(std::function<void()> functionToRun, int priority) |
| 548 | { |
| 549 | if (!functionToRun) |
| 550 | return; |
| 551 | start(runnable: QRunnable::create(functionToRun: std::move(functionToRun)), priority); |
| 552 | } |
| 553 | |
| 554 | bool QThreadPool::tryStart(std::function<void()> functionToRun) |
| 555 | { |
| 556 | if (!functionToRun) |
| 557 | return false; |
| 558 | |
| 559 | Q_D(QThreadPool); |
| 560 | QMutexLocker locker(&d->mutex); |
| 561 | if (!d->allThreads.isEmpty() && d->areAllThreadsActive()) |
| 562 | return false; |
| 563 | |
| 564 | QRunnable *runnable = QRunnable::create(functionToRun: std::move(functionToRun)); |
| 565 | if (d->tryStart(task: runnable)) |
| 566 | return true; |
| 567 | delete runnable; |
| 568 | return false; |
| 569 | } |
| 570 | |
| 571 | void QThreadPool::startOnReservedThread(std::function<void()> functionToRun) |
| 572 | { |
| 573 | if (!functionToRun) |
| 574 | return releaseThread(); |
| 575 | |
| 576 | startOnReservedThread(runnable: QRunnable::create(functionToRun: std::move(functionToRun))); |
| 577 | } |
| 578 | |
| 579 | #endif // QT_CONFIG(thread) |
| 580 | |
| 581 | #if QT_CONFIG(xmlstream) |
| 582 | |
| 583 | #include "qxmlstream.h" |
| 584 | |
| 585 | QStringView QXmlStreamAttributes::value(const QString &namespaceUri, const QString &name) const |
| 586 | { |
| 587 | return value(namespaceUri: qToAnyStringViewIgnoringNull(s: namespaceUri), name: qToAnyStringViewIgnoringNull(s: name)); |
| 588 | } |
| 589 | |
| 590 | QStringView QXmlStreamAttributes::value(const QString &namespaceUri, QLatin1StringView name) const |
| 591 | { |
| 592 | return value(namespaceUri: qToAnyStringViewIgnoringNull(s: namespaceUri), name: QAnyStringView(name)); |
| 593 | } |
| 594 | |
| 595 | QStringView QXmlStreamAttributes::value(QLatin1StringView namespaceUri, QLatin1StringView name) const |
| 596 | { |
| 597 | return value(namespaceUri: QAnyStringView(namespaceUri), name: QAnyStringView(name)); |
| 598 | } |
| 599 | |
| 600 | QStringView QXmlStreamAttributes::value(const QString &qualifiedName) const |
| 601 | { |
| 602 | return value(qualifiedName: qToAnyStringViewIgnoringNull(s: qualifiedName)); |
| 603 | } |
| 604 | |
| 605 | QStringView QXmlStreamAttributes::value(QLatin1StringView qualifiedName) const |
| 606 | { |
| 607 | return value(qualifiedName: QAnyStringView(qualifiedName)); |
| 608 | } |
| 609 | |
| 610 | #endif // xmlstream |
| 611 | |
| 612 | // inlined API |
| 613 | #if QT_CONFIG(thread) |
| 614 | #include "qmutex.h" |
| 615 | #include "qreadwritelock.h" |
| 616 | #include "qsemaphore.h" |
| 617 | #endif |
| 618 | |
| 619 | // #include "qotherheader.h" |
| 620 | // // implement removed functions from qotherheader.h |
| 621 | // order sections alphabetically to reduce chances of merge conflicts |
| 622 | |
| 623 | #endif // QT_CORE_REMOVED_SINCE(6, 6) |
| 624 | |
| 625 | #if QT_CORE_REMOVED_SINCE(6, 7) |
| 626 | |
| 627 | #include "qbitarray.h" |
| 628 | |
| 629 | QBitArray QBitArray::operator~() const |
| 630 | { |
| 631 | return QBitArray(*this).inverted_inplace(); |
| 632 | } |
| 633 | |
| 634 | #include "qbytearray.h" |
| 635 | |
| 636 | QByteArray QByteArray::left(qsizetype len) const |
| 637 | { |
| 638 | if (len >= size()) |
| 639 | return *this; |
| 640 | if (len < 0) |
| 641 | len = 0; |
| 642 | return QByteArray(data(), len); |
| 643 | } |
| 644 | |
| 645 | QByteArray QByteArray::right(qsizetype len) const |
| 646 | { |
| 647 | if (len >= size()) |
| 648 | return *this; |
| 649 | if (len < 0) |
| 650 | len = 0; |
| 651 | return QByteArray(end() - len, len); |
| 652 | } |
| 653 | |
| 654 | QByteArray QByteArray::mid(qsizetype pos, qsizetype len) const |
| 655 | { |
| 656 | qsizetype p = pos; |
| 657 | qsizetype l = len; |
| 658 | using namespace QtPrivate; |
| 659 | switch (QContainerImplHelper::mid(originalLength: size(), position: &p, length: &l)) { |
| 660 | case QContainerImplHelper::Null: |
| 661 | return QByteArray(); |
| 662 | case QContainerImplHelper::Empty: |
| 663 | { |
| 664 | return QByteArray(DataPointer::fromRawData(rawData: &_empty, length: 0)); |
| 665 | } |
| 666 | case QContainerImplHelper::Full: |
| 667 | return *this; |
| 668 | case QContainerImplHelper::Subset: |
| 669 | return QByteArray(d.data() + p, l); |
| 670 | } |
| 671 | Q_UNREACHABLE_RETURN(QByteArray()); |
| 672 | } |
| 673 | |
| 674 | #ifdef Q_CC_MSVC |
| 675 | // previously inline methods, only needed for MSVC compat |
| 676 | QByteArray QByteArray::first(qsizetype n) const |
| 677 | { return sliced(0, n); } |
| 678 | QByteArray QByteArray::last(qsizetype n) const |
| 679 | { return sliced(size() - n, n); } |
| 680 | QByteArray QByteArray::sliced(qsizetype pos) const |
| 681 | { return sliced(pos, size() - pos); } |
| 682 | QByteArray QByteArray::sliced(qsizetype pos, qsizetype n) const |
| 683 | { verify(pos, n); return QByteArray(d.data() + pos, n); } |
| 684 | QByteArray QByteArray::chopped(qsizetype n) const |
| 685 | { return sliced(0, size() - n); } |
| 686 | #endif |
| 687 | |
| 688 | #include "qcborstreamreader.h" |
| 689 | |
| 690 | QCborError QCborStreamReader::lastError() |
| 691 | { |
| 692 | return std::as_const(t&: *this).lastError(); |
| 693 | } |
| 694 | |
| 695 | #include "qdatetime.h" // also inlined API |
| 696 | |
| 697 | QDateTime::QDateTime(QDate date, QTime time, const QTimeZone &timeZone) |
| 698 | : QDateTime(date, time, timeZone, TransitionResolution::LegacyBehavior) {} |
| 699 | QDateTime::QDateTime(QDate date, QTime time) |
| 700 | : QDateTime(date, time, TransitionResolution::LegacyBehavior) {} |
| 701 | void QDateTime::setDate(QDate date) { setDate(date, resolve: TransitionResolution::LegacyBehavior); } |
| 702 | void QDateTime::setTime(QTime time) { setTime(time, resolve: TransitionResolution::LegacyBehavior); } |
| 703 | void QDateTime::setTimeZone(const QTimeZone &toZone) |
| 704 | { |
| 705 | setTimeZone(toZone, resolve: TransitionResolution::LegacyBehavior); |
| 706 | } |
| 707 | |
| 708 | bool QDateTime::precedes(const QDateTime &other) const |
| 709 | { |
| 710 | return compareThreeWay(lhs: *this, rhs: other) < 0; |
| 711 | } |
| 712 | |
| 713 | #include "qdatastream.h" |
| 714 | |
| 715 | QDataStream &QDataStream::writeBytes(const char *s, uint len) |
| 716 | { |
| 717 | return writeBytes(s, len: qint64(len)); |
| 718 | } |
| 719 | |
| 720 | int QDataStream::skipRawData(int len) |
| 721 | { |
| 722 | return int(skipRawData(len: qint64(len))); |
| 723 | } |
| 724 | |
| 725 | int QDataStream::readBlock(char *data, int len) |
| 726 | { |
| 727 | return int(readBlock(data, len: qint64(len))); |
| 728 | } |
| 729 | |
| 730 | int QDataStream::readRawData(char *s, int len) |
| 731 | { |
| 732 | return int(readRawData(s, len: qint64(len))); |
| 733 | } |
| 734 | |
| 735 | int QDataStream::writeRawData(const char *s, int len) |
| 736 | { |
| 737 | return writeRawData(s, len: qint64(len)); |
| 738 | } |
| 739 | |
| 740 | #if defined(Q_OS_ANDROID) |
| 741 | |
| 742 | #include "qjniobject.h" |
| 743 | |
| 744 | jclass QJniObject::loadClass(const QByteArray &className, JNIEnv *env, bool /*binEncoded*/) |
| 745 | { |
| 746 | return QJniObject::loadClass(className, env); |
| 747 | } |
| 748 | |
| 749 | QByteArray QJniObject::toBinaryEncClassName(const QByteArray &className) |
| 750 | { |
| 751 | return QByteArray(className).replace('/', '.'); |
| 752 | } |
| 753 | |
| 754 | void QJniObject::callVoidMethodV(JNIEnv *env, jmethodID id, va_list args) const |
| 755 | { |
| 756 | env->CallVoidMethodV(javaObject(), id, args); |
| 757 | } |
| 758 | |
| 759 | #endif // Q_OS_ANDROID |
| 760 | |
| 761 | #include "qlocale.h" |
| 762 | |
| 763 | QStringList QLocale::uiLanguages() const |
| 764 | { |
| 765 | return uiLanguages(separator: TagSeparator::Dash); |
| 766 | } |
| 767 | |
| 768 | QString QLocale::name() const |
| 769 | { |
| 770 | return name(separator: TagSeparator::Underscore); |
| 771 | } |
| 772 | |
| 773 | QString QLocale::bcp47Name() const |
| 774 | { |
| 775 | return bcp47Name(separator: TagSeparator::Dash); |
| 776 | } |
| 777 | |
| 778 | #if QT_CONFIG(datestring) |
| 779 | |
| 780 | QDate QLocale::toDate(const QString &string, FormatType format) const |
| 781 | { |
| 782 | return toDate(string, format: dateFormat(format), baseYear: DefaultTwoDigitBaseYear); |
| 783 | } |
| 784 | |
| 785 | QDate QLocale::toDate(const QString &string, FormatType format, QCalendar cal) const |
| 786 | { |
| 787 | return toDate(string, format: dateFormat(format), cal, baseYear: DefaultTwoDigitBaseYear); |
| 788 | } |
| 789 | |
| 790 | QDateTime QLocale::toDateTime(const QString &string, FormatType format) const |
| 791 | { |
| 792 | return toDateTime(string, format: dateTimeFormat(format), baseYear: DefaultTwoDigitBaseYear); |
| 793 | } |
| 794 | |
| 795 | QDateTime QLocale::toDateTime(const QString &string, FormatType format, QCalendar cal) const |
| 796 | { |
| 797 | return toDateTime(string, format: dateTimeFormat(format), cal, baseYear: DefaultTwoDigitBaseYear); |
| 798 | } |
| 799 | |
| 800 | QDate QLocale::toDate(const QString &string, const QString &format) const |
| 801 | { |
| 802 | return toDate(string, format, cal: QCalendar(), baseYear: DefaultTwoDigitBaseYear); |
| 803 | } |
| 804 | |
| 805 | QDate QLocale::toDate(const QString &string, const QString &format, QCalendar cal) const |
| 806 | { |
| 807 | return toDate(string, format, cal, baseYear: DefaultTwoDigitBaseYear); |
| 808 | } |
| 809 | |
| 810 | QDateTime QLocale::toDateTime(const QString &string, const QString &format) const |
| 811 | { |
| 812 | return toDateTime(string, format, cal: QCalendar(), baseYear: DefaultTwoDigitBaseYear); |
| 813 | } |
| 814 | |
| 815 | QDateTime QLocale::toDateTime(const QString &string, const QString &format, QCalendar cal) const |
| 816 | { |
| 817 | return toDateTime(string, format, cal, baseYear: DefaultTwoDigitBaseYear); |
| 818 | } |
| 819 | |
| 820 | #endif // datestring |
| 821 | |
| 822 | #include "qobject.h" |
| 823 | |
| 824 | void qt_qFindChildren_helper(const QObject *parent, const QMetaObject &mo, |
| 825 | QList<void*> *list, Qt::FindChildOptions options) |
| 826 | { |
| 827 | qt_qFindChildren_helper(parent, name: QAnyStringView(), mo, list, options); |
| 828 | } |
| 829 | |
| 830 | void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QMetaObject &mo, |
| 831 | QList<void*> *list, Qt::FindChildOptions options) |
| 832 | { |
| 833 | qt_qFindChildren_helper(parent, name: QAnyStringView{name}, mo, list, options); |
| 834 | } |
| 835 | |
| 836 | QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, |
| 837 | Qt::FindChildOptions options) |
| 838 | { |
| 839 | return qt_qFindChild_helper(parent, name: QAnyStringView{name}, mo, options); |
| 840 | } |
| 841 | |
| 842 | void QObject::moveToThread(QThread *targetThread) |
| 843 | { |
| 844 | moveToThread(thread: targetThread, QT6_CALL_NEW_OVERLOAD); |
| 845 | } |
| 846 | |
| 847 | #include "qobjectdefs.h" |
| 848 | |
| 849 | bool QMetaObject::invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase *slot, Qt::ConnectionType type, void *ret) |
| 850 | { |
| 851 | return invokeMethodImpl(object, slotObj: slot, type, parameterCount: 1, params: &ret, names: nullptr, metaTypes: nullptr); |
| 852 | } |
| 853 | |
| 854 | #include "qstring.h" |
| 855 | |
| 856 | QString QString::left(qsizetype n) const |
| 857 | { |
| 858 | if (size_t(n) >= size_t(size())) |
| 859 | return *this; |
| 860 | return QString((const QChar*) d.data(), n); |
| 861 | } |
| 862 | |
| 863 | QString QString::right(qsizetype n) const |
| 864 | { |
| 865 | if (size_t(n) >= size_t(size())) |
| 866 | return *this; |
| 867 | return QString(constData() + size() - n, n); |
| 868 | } |
| 869 | |
| 870 | QString QString::mid(qsizetype position, qsizetype n) const |
| 871 | { |
| 872 | qsizetype p = position; |
| 873 | qsizetype l = n; |
| 874 | using namespace QtPrivate; |
| 875 | switch (QContainerImplHelper::mid(originalLength: size(), position: &p, length: &l)) { |
| 876 | case QContainerImplHelper::Null: |
| 877 | return QString(); |
| 878 | case QContainerImplHelper::Empty: |
| 879 | return QString(DataPointer::fromRawData(rawData: &_empty, length: 0)); |
| 880 | case QContainerImplHelper::Full: |
| 881 | return *this; |
| 882 | case QContainerImplHelper::Subset: |
| 883 | return QString(constData() + p, l); |
| 884 | } |
| 885 | Q_UNREACHABLE_RETURN(QString()); |
| 886 | } |
| 887 | |
| 888 | #ifdef Q_CC_MSVC |
| 889 | // previously inline methods, only needed for MSVC compat |
| 890 | QString QString::first(qsizetype n) const |
| 891 | { return sliced(0, n); } |
| 892 | QString QString::last(qsizetype n) const |
| 893 | { return sliced(size() - n, n); } |
| 894 | QString QString::sliced(qsizetype pos) const |
| 895 | { return sliced(pos, size() - pos); } |
| 896 | QString QString::sliced(qsizetype pos, qsizetype n) const |
| 897 | { verify(pos, n); return QString(begin() + pos, n); } |
| 898 | QString QString::chopped(qsizetype n) const |
| 899 | { return sliced(0, size() - n); } |
| 900 | #endif |
| 901 | |
| 902 | #include "qtimezone.h" |
| 903 | |
| 904 | bool QTimeZone::operator==(const QTimeZone &other) const |
| 905 | { |
| 906 | return comparesEqual(lhs: *this, rhs: other); |
| 907 | } |
| 908 | |
| 909 | bool QTimeZone::operator!=(const QTimeZone &other) const |
| 910 | { |
| 911 | return !comparesEqual(lhs: *this, rhs: other); |
| 912 | } |
| 913 | |
| 914 | #include "qurl.h" |
| 915 | |
| 916 | QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode mode) |
| 917 | { |
| 918 | return QUrl::fromEncoded(input: QByteArrayView(input), mode); |
| 919 | } |
| 920 | |
| 921 | |
| 922 | // #include "qotherheader.h" |
| 923 | // // implement removed functions from qotherheader.h |
| 924 | // order sections alphabetically to reduce chances of merge conflicts |
| 925 | |
| 926 | #endif // QT_CORE_REMOVED_SINCE(6, 7) |
| 927 | |
| 928 | #if QT_CORE_REMOVED_SINCE(6, 8) |
| 929 | |
| 930 | #if QT_CONFIG(itemmodel) |
| 931 | #include "qabstractitemmodel.h" |
| 932 | |
| 933 | bool QPersistentModelIndex::operator<(const QPersistentModelIndex &other) const noexcept |
| 934 | { |
| 935 | return is_lt(o: compareThreeWay(lhs: *this, rhs: other)); |
| 936 | } |
| 937 | |
| 938 | bool QPersistentModelIndex::operator==(const QPersistentModelIndex &other) const noexcept |
| 939 | { |
| 940 | return comparesEqual(lhs: *this, rhs: other); |
| 941 | } |
| 942 | |
| 943 | bool QPersistentModelIndex::operator==(const QModelIndex &other) const noexcept |
| 944 | { |
| 945 | return comparesEqual(lhs: *this, rhs: other); |
| 946 | } |
| 947 | |
| 948 | bool QPersistentModelIndex::operator!=(const QModelIndex &other) const noexcept |
| 949 | { |
| 950 | return !comparesEqual(lhs: *this, rhs: other); |
| 951 | } |
| 952 | |
| 953 | #endif // QT_CONFIG(itemmodel) |
| 954 | |
| 955 | #include "qbitarray.h" // inlined API |
| 956 | |
| 957 | #include "qbytearray.h" // inlined API |
| 958 | |
| 959 | QT_BEGIN_NAMESPACE |
| 960 | namespace QtPrivate { |
| 961 | Q_CORE_EXPORT qsizetype lastIndexOf(QByteArrayView haystack, qsizetype from, char needle) noexcept |
| 962 | { |
| 963 | return lastIndexOf(haystack, from, needle: uchar(needle)); |
| 964 | } |
| 965 | } |
| 966 | QT_END_NAMESPACE |
| 967 | |
| 968 | #include "qcborarray.h" // inlined API |
| 969 | |
| 970 | #include "qcbormap.h" // inlined API |
| 971 | |
| 972 | #include "qcborvalue.h" // inlined API |
| 973 | |
| 974 | #include "qdatastream.h" // inlined API |
| 975 | |
| 976 | QDataStream &QDataStream::operator<<(bool i) |
| 977 | { |
| 978 | return (*this << qint8(i)); |
| 979 | } |
| 980 | |
| 981 | #include "qdebug.h" |
| 982 | |
| 983 | Q_CORE_EXPORT void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, int value) |
| 984 | { |
| 985 | qt_QMetaEnum_flagDebugOperator(debug, sizeofT, value: uint(value)); |
| 986 | } |
| 987 | |
| 988 | #include "qdir.h" // inlined API |
| 989 | |
| 990 | bool QDir::operator==(const QDir &dir) const |
| 991 | { |
| 992 | return comparesEqual(lhs: *this, rhs: dir); |
| 993 | } |
| 994 | |
| 995 | #if QT_CONFIG(easingcurve) |
| 996 | #include "qeasingcurve.h" |
| 997 | |
| 998 | bool QEasingCurve::operator==(const QEasingCurve &other) const |
| 999 | { |
| 1000 | return comparesEqual(lhs: *this, rhs: other); |
| 1001 | } |
| 1002 | #endif // QT_CONFIG(easingcurve) |
| 1003 | |
| 1004 | #include "qfileinfo.h" // inlined API |
| 1005 | |
| 1006 | bool QFileInfo::operator==(const QFileInfo &fileinfo) const |
| 1007 | { |
| 1008 | return comparesEqual(lhs: *this, rhs: fileinfo); |
| 1009 | } |
| 1010 | |
| 1011 | #if QT_CONFIG(itemmodel) |
| 1012 | #include "qitemselectionmodel.h" // inlined API |
| 1013 | #endif // itemmodel |
| 1014 | |
| 1015 | #include "qjsonarray.h" |
| 1016 | |
| 1017 | bool QJsonArray::operator==(const QJsonArray &other) const |
| 1018 | { |
| 1019 | return comparesEqual(lhs: *this, rhs: other); |
| 1020 | } |
| 1021 | |
| 1022 | bool QJsonArray::operator!=(const QJsonArray &other) const |
| 1023 | { |
| 1024 | return !comparesEqual(lhs: *this, rhs: other); |
| 1025 | } |
| 1026 | |
| 1027 | #include "qjsondocument.h" |
| 1028 | |
| 1029 | bool QJsonDocument::operator==(const QJsonDocument &other) const |
| 1030 | { |
| 1031 | return comparesEqual(lhs: *this, rhs: other); |
| 1032 | } |
| 1033 | |
| 1034 | #include "qjsonobject.h" |
| 1035 | |
| 1036 | bool QJsonObject::operator==(const QJsonObject &other) const |
| 1037 | { |
| 1038 | return comparesEqual(lhs: *this, rhs: other); |
| 1039 | } |
| 1040 | |
| 1041 | |
| 1042 | bool QJsonObject::operator!=(const QJsonObject &other) const |
| 1043 | { |
| 1044 | return !comparesEqual(lhs: *this, rhs: other); |
| 1045 | } |
| 1046 | |
| 1047 | #include "qjsonvalue.h" |
| 1048 | |
| 1049 | bool QJsonValue::operator==(const QJsonValue &other) const |
| 1050 | { |
| 1051 | return comparesEqual(lhs: *this, rhs: other); |
| 1052 | } |
| 1053 | |
| 1054 | bool QJsonValue::operator!=(const QJsonValue &other) const |
| 1055 | { |
| 1056 | return !comparesEqual(lhs: *this, rhs: other); |
| 1057 | } |
| 1058 | |
| 1059 | #include "qline.h" // inlined API |
| 1060 | |
| 1061 | #if QT_CONFIG(mimetype) |
| 1062 | #include "qmimetype.h" |
| 1063 | |
| 1064 | bool QMimeType::operator==(const QMimeType &other) const |
| 1065 | { |
| 1066 | return comparesEqual(lhs: *this, rhs: other); |
| 1067 | } |
| 1068 | #endif // QT_CONFIG(mimetype) |
| 1069 | |
| 1070 | #include "qobject.h" |
| 1071 | #include "qnumeric.h" |
| 1072 | |
| 1073 | int QObject::startTimer(std::chrono::milliseconds time, Qt::TimerType timerType) |
| 1074 | { |
| 1075 | using namespace std::chrono; |
| 1076 | using ratio = std::ratio_divide<std::milli, std::nano>; |
| 1077 | nanoseconds::rep r; |
| 1078 | if (qMulOverflow<ratio::num>(v1: time.count(), r: &r)) { |
| 1079 | qWarning(msg: "QObject::startTimer(std::chrono::milliseconds): " |
| 1080 | "'time' arg overflowed when converted to nanoseconds." ); |
| 1081 | r = nanoseconds::max().count(); |
| 1082 | } |
| 1083 | return startTimer(time: nanoseconds{r}, timerType); |
| 1084 | } |
| 1085 | |
| 1086 | #if QT_CONFIG(processenvironment) |
| 1087 | #include "qprocess.h" // inlined API |
| 1088 | |
| 1089 | bool QProcessEnvironment::operator==(const QProcessEnvironment &other) const |
| 1090 | { |
| 1091 | return comparesEqual(lhs: *this, rhs: other); |
| 1092 | } |
| 1093 | #endif // QT_CONFIG(processenvironment) |
| 1094 | |
| 1095 | #if QT_CONFIG(regularexpression) |
| 1096 | #include "qregularexpression.h" |
| 1097 | |
| 1098 | bool QRegularExpressionMatch::hasCaptured(QStringView name) const |
| 1099 | { |
| 1100 | return hasCaptured(name: QAnyStringView(name)); |
| 1101 | } |
| 1102 | |
| 1103 | QString QRegularExpressionMatch::captured(QStringView name) const |
| 1104 | { |
| 1105 | return captured(name: QAnyStringView(name)); |
| 1106 | } |
| 1107 | |
| 1108 | QStringView QRegularExpressionMatch::capturedView(QStringView name) const |
| 1109 | { |
| 1110 | return capturedView(name: QAnyStringView(name)); |
| 1111 | } |
| 1112 | |
| 1113 | qsizetype QRegularExpressionMatch::capturedStart(QStringView name) const |
| 1114 | { |
| 1115 | return capturedStart(name: QAnyStringView(name)); |
| 1116 | } |
| 1117 | |
| 1118 | qsizetype QRegularExpressionMatch::capturedLength(QStringView name) const |
| 1119 | { |
| 1120 | return capturedLength(name: QAnyStringView(name)); |
| 1121 | } |
| 1122 | |
| 1123 | qsizetype QRegularExpressionMatch::capturedEnd(QStringView name) const |
| 1124 | { |
| 1125 | return capturedEnd(name: QAnyStringView(name)); |
| 1126 | } |
| 1127 | |
| 1128 | bool QRegularExpression::operator==(const QRegularExpression &other) const |
| 1129 | { |
| 1130 | return comparesEqual(lhs: *this, rhs: other); |
| 1131 | } |
| 1132 | #endif // QT_CONFIG(regularexpression) |
| 1133 | |
| 1134 | #if QT_CONFIG(future) |
| 1135 | #include "qresultstore.h" |
| 1136 | |
| 1137 | bool QtPrivate::ResultIteratorBase::operator==(const QtPrivate::ResultIteratorBase &other) const |
| 1138 | { |
| 1139 | return comparesEqual(lhs: *this, rhs: other); |
| 1140 | } |
| 1141 | |
| 1142 | bool QtPrivate::ResultIteratorBase::operator!=(const QtPrivate::ResultIteratorBase &other) const |
| 1143 | { |
| 1144 | return !comparesEqual(lhs: *this, rhs: other); |
| 1145 | } |
| 1146 | #endif // QT_CONFIG(future) |
| 1147 | |
| 1148 | #include "qstring.h" // inlined API |
| 1149 | |
| 1150 | #include "qstringconverter.h" |
| 1151 | |
| 1152 | QStringConverter::QStringConverter(const char *name, Flags f) |
| 1153 | : QStringConverter(QAnyStringView{name}, f) |
| 1154 | {} |
| 1155 | |
| 1156 | auto QStringConverter::encodingForName(const char *name) noexcept -> std::optional<Encoding> |
| 1157 | { |
| 1158 | return encodingForName(name: QAnyStringView{name}); |
| 1159 | } |
| 1160 | |
| 1161 | #if QT_CONFIG(thread) |
| 1162 | # include "qthreadpool.h" // inlined API |
| 1163 | #endif |
| 1164 | |
| 1165 | #include "qtimer.h" // inlined API |
| 1166 | // removed inline API (MSVC) |
| 1167 | |
| 1168 | void QTimer::singleShot(std::chrono::milliseconds interval, Qt::TimerType timerType, |
| 1169 | const QObject *receiver, const char *member) |
| 1170 | { |
| 1171 | singleShot(interval: from_msecs(interval), timerType, receiver, member); |
| 1172 | } |
| 1173 | |
| 1174 | void QTimer::singleShotImpl(std::chrono::milliseconds interval, Qt::TimerType timerType, |
| 1175 | const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj) |
| 1176 | { |
| 1177 | QtPrivate::SlotObjUniquePtr slot(slotObj); // don't leak if from_msecs throws |
| 1178 | const auto ns = from_msecs(interval); |
| 1179 | singleShotImpl(interval: ns, timerType, receiver, slotObj: slot.release()); |
| 1180 | } |
| 1181 | |
| 1182 | #include "qurl.h" |
| 1183 | |
| 1184 | bool QUrl::operator<(const QUrl &url) const |
| 1185 | { |
| 1186 | return is_lt(o: compareThreeWay(lhs: *this, rhs: url)); |
| 1187 | } |
| 1188 | |
| 1189 | bool QUrl::operator==(const QUrl &url) const |
| 1190 | { |
| 1191 | return comparesEqual(lhs: *this, rhs: url); |
| 1192 | } |
| 1193 | |
| 1194 | bool QUrl::operator!=(const QUrl &url) const |
| 1195 | { |
| 1196 | return !comparesEqual(lhs: *this, rhs: url); |
| 1197 | } |
| 1198 | |
| 1199 | #include "qurlquery.h" |
| 1200 | |
| 1201 | bool QUrlQuery::operator==(const QUrlQuery &other) const |
| 1202 | { |
| 1203 | return comparesEqual(lhs: *this, rhs: other); |
| 1204 | } |
| 1205 | |
| 1206 | #include "qbasictimer.h" |
| 1207 | |
| 1208 | void QBasicTimer::start(std::chrono::milliseconds duration, QObject *object) |
| 1209 | { |
| 1210 | start(duration: std::chrono::nanoseconds(duration), obj: object); |
| 1211 | } |
| 1212 | |
| 1213 | void QBasicTimer::start(std::chrono::milliseconds duration, Qt::TimerType timerType, QObject *obj) |
| 1214 | { |
| 1215 | start(duration: std::chrono::nanoseconds(duration), timerType, obj); |
| 1216 | } |
| 1217 | |
| 1218 | #include "quuid.h" |
| 1219 | |
| 1220 | bool QUuid::operator<(const QUuid &other) const noexcept |
| 1221 | { |
| 1222 | return is_lt(o: compareThreeWay(lhs: *this, rhs: other)); |
| 1223 | } |
| 1224 | |
| 1225 | bool QUuid::operator>(const QUuid &other) const noexcept |
| 1226 | { |
| 1227 | return is_gt(o: compareThreeWay(lhs: *this, rhs: other)); |
| 1228 | } |
| 1229 | |
| 1230 | QUuid QUuid::createUuidV3(const QUuid &ns, const QByteArray &baseData) noexcept |
| 1231 | { |
| 1232 | return createUuidV3(ns, baseData: qToByteArrayViewIgnoringNull(b: baseData)); |
| 1233 | } |
| 1234 | |
| 1235 | QUuid QUuid::createUuidV5(const QUuid &ns, const QByteArray &baseData) noexcept |
| 1236 | { |
| 1237 | return createUuidV5(ns, baseData: qToByteArrayViewIgnoringNull(b: baseData)); |
| 1238 | } |
| 1239 | |
| 1240 | #if QT_CONFIG(xmlstream) |
| 1241 | #include "qxmlstream.h" // inlined API |
| 1242 | #endif // QT_CONFIG(xmlstream) |
| 1243 | |
| 1244 | // #include "qotherheader.h" |
| 1245 | // // implement removed functions from qotherheader.h |
| 1246 | // order sections alphabetically to reduce chances of merge conflicts |
| 1247 | |
| 1248 | #endif // QT_CORE_REMOVED_SINCE(6, 8) |
| 1249 | |
| 1250 | #if QT_CORE_REMOVED_SINCE(6, 9) |
| 1251 | |
| 1252 | #include "qchar.h" // inlined API |
| 1253 | |
| 1254 | |
| 1255 | #include "qexceptionhandling.h" |
| 1256 | |
| 1257 | QT_BEGIN_NAMESPACE |
| 1258 | Q_NORETURN void qTerminate() noexcept |
| 1259 | { |
| 1260 | std::terminate(); |
| 1261 | } |
| 1262 | QT_END_NAMESPACE |
| 1263 | |
| 1264 | |
| 1265 | #include "qmetatype.h" |
| 1266 | |
| 1267 | bool QMetaType::isRegistered() const |
| 1268 | { |
| 1269 | return isRegistered(QT6_CALL_NEW_OVERLOAD); |
| 1270 | } |
| 1271 | |
| 1272 | bool QMetaType::isValid() const |
| 1273 | { |
| 1274 | return isValid(QT6_CALL_NEW_OVERLOAD); |
| 1275 | } |
| 1276 | |
| 1277 | |
| 1278 | #include "qmetaobject.h" |
| 1279 | |
| 1280 | const char *QMetaEnum::valueToKey(int value) const |
| 1281 | { |
| 1282 | return valueToKey(value: quint64(uint(value))); |
| 1283 | } |
| 1284 | |
| 1285 | QByteArray QMetaEnum::valueToKeys(int value) const |
| 1286 | { |
| 1287 | return valueToKeys(value: quint64(uint(value))); |
| 1288 | } |
| 1289 | |
| 1290 | |
| 1291 | #include "qmutex.h" |
| 1292 | |
| 1293 | #if QT_CONFIG(thread) |
| 1294 | void QBasicMutex::destroyInternal(QMutexPrivate *d) |
| 1295 | { |
| 1296 | destroyInternal(d: static_cast<void *>(d)); |
| 1297 | } |
| 1298 | #endif |
| 1299 | |
| 1300 | |
| 1301 | #include "qobject.h" |
| 1302 | |
| 1303 | #ifdef Q_COMPILER_MANGLES_RETURN_TYPE |
| 1304 | QMetaObject *QObjectData::dynamicMetaObject() const |
| 1305 | { |
| 1306 | // ### keep in sync with the master version in qobject.cpp |
| 1307 | return metaObject->toDynamicMetaObject(q_ptr); |
| 1308 | } |
| 1309 | #endif // Q_COMPILER_MANGLES_RETURN_TYPE |
| 1310 | |
| 1311 | |
| 1312 | #include "qstring.h" |
| 1313 | |
| 1314 | QString QString::arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const |
| 1315 | { |
| 1316 | return arg_impl(a, fieldwidth: fieldWidth, base, fillChar); |
| 1317 | } |
| 1318 | |
| 1319 | QString QString::arg(qulonglong a, int fieldWidth, int base, QChar fillChar) const |
| 1320 | { |
| 1321 | return arg_impl(a, fieldwidth: fieldWidth, base, fillChar); |
| 1322 | } |
| 1323 | |
| 1324 | QString QString::arg(double a, int fieldWidth, char format, int precision, QChar fillChar) const |
| 1325 | { |
| 1326 | return arg_impl(a, fieldWidth, format, precision, fillChar); |
| 1327 | } |
| 1328 | |
| 1329 | QString QString::arg(char a, int fieldWidth, QChar fillChar) const |
| 1330 | { |
| 1331 | return arg_impl(a: QAnyStringView(a), fieldWidth, fillChar); |
| 1332 | } |
| 1333 | |
| 1334 | QString QString::arg(QChar a, int fieldWidth, QChar fillChar) const |
| 1335 | { |
| 1336 | return arg_impl(a: QAnyStringView{a}, fieldWidth, fillChar); |
| 1337 | } |
| 1338 | |
| 1339 | QString QString::arg(const QString &a, int fieldWidth, QChar fillChar) const |
| 1340 | { |
| 1341 | return arg_impl(a: qToAnyStringViewIgnoringNull(s: a), fieldWidth, fillChar); |
| 1342 | } |
| 1343 | |
| 1344 | QString QString::arg(QStringView a, int fieldWidth, QChar fillChar) const |
| 1345 | { |
| 1346 | return arg_impl(a: QAnyStringView(a), fieldWidth, fillChar); |
| 1347 | } |
| 1348 | |
| 1349 | QString QString::arg(QLatin1StringView a, int fieldWidth, QChar fillChar) const |
| 1350 | { |
| 1351 | return arg(a: QAnyStringView(a), fieldWidth, fillChar); |
| 1352 | } |
| 1353 | |
| 1354 | QString QtPrivate::argToQString(QStringView pattern, size_t n, const ArgBase **args) |
| 1355 | { |
| 1356 | return argToQString(pattern: QAnyStringView{pattern}, n, args); |
| 1357 | } |
| 1358 | |
| 1359 | QString QtPrivate::argToQString(QLatin1StringView pattern, size_t n, const ArgBase **args) |
| 1360 | { |
| 1361 | return argToQString(pattern: QAnyStringView{pattern}, n, args); |
| 1362 | } |
| 1363 | |
| 1364 | |
| 1365 | #include "quuid.h" |
| 1366 | |
| 1367 | bool QUuid::isNull() const noexcept |
| 1368 | { |
| 1369 | return isNull(QT6_CALL_NEW_OVERLOAD); |
| 1370 | } |
| 1371 | |
| 1372 | QUuid::Variant QUuid::variant() const noexcept |
| 1373 | { |
| 1374 | return variant(QT6_CALL_NEW_OVERLOAD); |
| 1375 | } |
| 1376 | |
| 1377 | QUuid::Version QUuid::version() const noexcept |
| 1378 | { |
| 1379 | return version(QT6_CALL_NEW_OVERLOAD); |
| 1380 | } |
| 1381 | |
| 1382 | // #include "qotherheader.h" |
| 1383 | // // implement removed functions from qotherheader.h |
| 1384 | // order sections alphabetically to reduce chances of merge conflicts |
| 1385 | |
| 1386 | #endif // QT_CORE_REMOVED_SINCE(6, 9) |
| 1387 | |
| 1388 | #if QT_CORE_REMOVED_SINCE(6, 10) |
| 1389 | |
| 1390 | #include "qcborstreamwriter.h" // Q_WEAK_OVERLOAD added |
| 1391 | |
| 1392 | #include "qcoreapplication.h" |
| 1393 | |
| 1394 | #if QT_CONFIG(permissions) |
| 1395 | void QCoreApplication::requestPermission(const QPermission &requestedPermission, |
| 1396 | QtPrivate::QSlotObjectBase *slotObjRaw, const QObject *context) |
| 1397 | { |
| 1398 | return requestPermissionImpl(permission: requestedPermission, slotObj: slotObjRaw, context); |
| 1399 | } |
| 1400 | #endif |
| 1401 | |
| 1402 | #include "qdir.h" |
| 1403 | |
| 1404 | bool QDir::mkdir(const QString &dirName) const |
| 1405 | { |
| 1406 | return mkdir(dirName, p: std::nullopt); |
| 1407 | } |
| 1408 | |
| 1409 | bool QDir::mkdir(const QString &dirName, QFile::Permissions permissions) const |
| 1410 | { |
| 1411 | return mkdir(dirName, p: std::optional{permissions}); |
| 1412 | } |
| 1413 | |
| 1414 | bool QDir::mkpath(const QString &dirPath) const |
| 1415 | { |
| 1416 | return mkpath(dirPath, p: std::nullopt); |
| 1417 | } |
| 1418 | |
| 1419 | #if QT_CONFIG(future) |
| 1420 | #include "qfuture.h" // for ContinuationWrapper |
| 1421 | #include "qfutureinterface.h" |
| 1422 | |
| 1423 | void QtPrivate::watchContinuationImpl(const QObject *context, |
| 1424 | QtPrivate::QSlotObjectBase *slotObj, |
| 1425 | QFutureInterfaceBase &fi) |
| 1426 | { |
| 1427 | Q_ASSERT(context); |
| 1428 | Q_ASSERT(slotObj); |
| 1429 | |
| 1430 | auto slot = QtPrivate::SlotObjUniquePtr(slotObj); |
| 1431 | |
| 1432 | // That is now a double-inderection, because the setContinuation() overload |
| 1433 | // also uses QSlotObjectBase approach. But that's a solution for backwards |
| 1434 | // compatibility, so should be fine. |
| 1435 | // We pass a default-constructed QVariant() and an Unknown type, because |
| 1436 | // that's effectively the same as passing a nullptr continuationData, and |
| 1437 | // that's what the old code was doing. |
| 1438 | fi.setContinuation(context, func: QtPrivate::ContinuationWrapper([slot = std::move(slot)]() |
| 1439 | { |
| 1440 | void *args[] = { nullptr }; // for `void` return value |
| 1441 | slot->call(r: nullptr, a: args); |
| 1442 | }), continuationFuture: QVariant(), type: QFutureInterfaceBase::ContinuationType::Unknown); |
| 1443 | } |
| 1444 | |
| 1445 | void QFutureInterfaceBase::setContinuation(std::function<void(const QFutureInterfaceBase &)> func) |
| 1446 | { |
| 1447 | setContinuation(func: std::move(func), continuationFutureData: nullptr); |
| 1448 | } |
| 1449 | |
| 1450 | void QFutureInterfaceBase::setContinuation(std::function<void(const QFutureInterfaceBase &)> func, |
| 1451 | QFutureInterfaceBasePrivate *continuationFutureData) |
| 1452 | { |
| 1453 | // Backwards compatibility - the continuation data was used for |
| 1454 | // then-continuations |
| 1455 | setContinuation(func: std::move(func), continuationFutureData, type: ContinuationType::Then); |
| 1456 | } |
| 1457 | #endif // QT_CONFIG(future) |
| 1458 | |
| 1459 | #include "qlockfile.h" // inlined API |
| 1460 | |
| 1461 | #include "qlogging.h" |
| 1462 | |
| 1463 | QNoDebug QMessageLogger::noDebug() const noexcept |
| 1464 | { |
| 1465 | return QNoDebug(); |
| 1466 | } |
| 1467 | |
| 1468 | #include "qmutex.h" // removed, previously-inline API |
| 1469 | |
| 1470 | #include "qobject.h" |
| 1471 | |
| 1472 | bool QObject::doSetProperty(const char *name, const QVariant *lvalue, QVariant *rvalue) |
| 1473 | { |
| 1474 | return doSetProperty(name, value: *lvalue, rvalue); |
| 1475 | } |
| 1476 | |
| 1477 | #include "qstring.h" // inlined API |
| 1478 | |
| 1479 | #include "qvariant.h" // inlined API |
| 1480 | |
| 1481 | // #include "qotherheader.h" |
| 1482 | // // implement removed functions from qotherheader.h |
| 1483 | // order sections alphabetically to reduce chances of merge conflicts |
| 1484 | |
| 1485 | #endif // QT_CORE_REMOVED_SINCE(6, 10) |
| 1486 | |