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

Provided by KDAB

Privacy Policy
Learn to use CMake with our Intro Training
Find out more

source code of qtbase/src/corelib/compat/removed_api.cpp