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
142int QOperatingSystemVersion::compare(const QOperatingSystemVersion &v1,
143 const QOperatingSystemVersion &v2)
144{
145 return QOperatingSystemVersionBase::compare(v1, v2);
146}
147
148#include "qurl.h"
149
150QString QUrl::fromAce(const QByteArray &domain)
151{
152 return fromAce(domain, options: {});
153}
154
155QByteArray QUrl::toAce(const QString &domain)
156{
157 return toAce(domain, options: {});
158}
159
160#endif // QT_CORE_REMOVED_SINCE(6, 3)
161
162#if QT_CORE_REMOVED_SINCE(6, 4)
163
164#include "qbytearray.h" // uses QT_CORE_INLINE_SINCE
165
166#include "qcalendar.h"
167
168QCalendar::QCalendar(QStringView name)
169 : QCalendar(QAnyStringView{name}) {}
170
171QCalendar::QCalendar(QLatin1StringView name)
172 : QCalendar(QAnyStringView{name}) {}
173
174#include "qcollator.h" // inline function compare(ptr, n, ptr, n) (for MSVC)
175
176#include "qhashfunctions.h"
177
178size_t qHash(const QByteArray &key, size_t seed) noexcept
179{
180 return qHashBits(p: key.constData(), size: size_t(key.size()), seed);
181}
182
183size_t qHash(const QByteArrayView &key, size_t seed) noexcept
184{
185 return qHashBits(p: key.constData(), size: size_t(key.size()), seed);
186}
187
188#include "qobject.h"
189
190void QObject::setObjectName(const QString &name)
191{
192 setObjectName<void>(name);
193}
194
195#include "qlocale.h" // uses QT_CORE_INLINE_SINCE
196
197#if QT_CONFIG(settings)
198
199#include "qsettings.h"
200
201void QSettings::beginGroup(const QString &prefix)
202{
203 return beginGroup(prefix: qToAnyStringViewIgnoringNull(s: prefix));
204}
205
206int QSettings::beginReadArray(const QString &prefix)
207{
208 return beginReadArray(prefix: qToAnyStringViewIgnoringNull(s: prefix));
209}
210
211void QSettings::beginWriteArray(const QString &prefix, int size)
212{
213 beginWriteArray(prefix: qToAnyStringViewIgnoringNull(s: prefix), size);
214}
215
216void QSettings::setValue(const QString &key, const QVariant &value)
217{
218 setValue(key: qToAnyStringViewIgnoringNull(s: key), value);
219}
220
221void QSettings::remove(const QString &key)
222{
223 remove(key: qToAnyStringViewIgnoringNull(s: key));
224}
225
226bool QSettings::contains(const QString &key) const
227{
228 return contains(key: qToAnyStringViewIgnoringNull(s: key));
229}
230
231QVariant QSettings::value(const QString &key, const QVariant &defaultValue) const
232{
233 return value(key: qToAnyStringViewIgnoringNull(s: key), defaultValue);
234}
235
236QVariant QSettings::value(const QString &key) const
237{
238 return value(key: qToAnyStringViewIgnoringNull(s: key));
239}
240
241#endif // QT_CONFIG(settings)
242
243#include "qversionnumber.h"
244
245QT_WARNING_PUSH
246QT_WARNING_DISABLE_DEPRECATED
247
248QVersionNumber QVersionNumber::fromString(const QString &string, int *suffixIndex)
249{
250 return fromString(string: qToAnyStringViewIgnoringNull(s: string), suffixIndex);
251}
252
253QVersionNumber QVersionNumber::fromString(QStringView string, int *suffixIndex)
254{
255 return fromString(string: QAnyStringView{string}, suffixIndex);
256}
257
258QVersionNumber QVersionNumber::fromString(QLatin1StringView string, int *suffixIndex)
259{
260 return fromString(string: QAnyStringView{string}, suffixIndex);
261}
262
263QT_WARNING_POP
264
265// #include <qotherheader.h>
266// // implement removed functions from qotherheader.h
267// order sections alphabetically to reduce chances of merge conflicts
268
269#endif // QT_CORE_REMOVED_SINCE(6, 4)
270
271#if QT_CORE_REMOVED_SINCE(6, 5)
272
273#include "qbasictimer.h" // inlined API
274
275#include "qbuffer.h" // inline removed API
276
277#include "qdir.h"
278
279uint QDir::count() const
280{
281 return uint(count(QT6_CALL_NEW_OVERLOAD));
282}
283
284#if QT_POINTER_SIZE != 4
285QString QDir::operator[](int i) const
286{
287 return operator[](qsizetype{i});
288}
289#endif
290
291#include "qtenvironmentvariables.h"
292
293bool qputenv(const char *varName, const QByteArray &value)
294{
295 return qputenv(varName, value: qToByteArrayViewIgnoringNull(b: value));
296}
297
298#include "qmetatype.h"
299
300int QMetaType::idHelper() const
301{
302 Q_ASSERT(d_ptr);
303 return registerHelper(iface: d_ptr);
304}
305
306#if QT_CONFIG(sharedmemory)
307#include "qsharedmemory.h"
308
309void QSharedMemory::setNativeKey(const QString &key)
310{
311 setNativeKey(key, type: QNativeIpcKey::legacyDefaultTypeForOs());
312}
313#endif
314
315#include "qvariant.h"
316
317// these implementations aren't as efficient as they used to be prior to
318// replacement, but there's no way to call the ambiguous overload
319QVariant::QVariant(const QUuid &uuid) : QVariant(QVariant::fromValue(value: uuid)) {}
320#ifndef QT_NO_GEOM_VARIANT
321#include "qline.h"
322#include "qpoint.h"
323#include "qrect.h"
324#include "qsize.h"
325QVariant::QVariant(const QPoint &pt) : QVariant(QVariant::fromValue(value: pt)) {}
326QVariant::QVariant(const QPointF &pt) : QVariant(QVariant::fromValue(value: pt)) {}
327QVariant::QVariant(const QRect &r) : QVariant(QVariant::fromValue(value: r)) {}
328QVariant::QVariant(const QRectF &r) : QVariant(QVariant::fromValue(value: r)) {}
329QVariant::QVariant(const QLine &l) : QVariant(QVariant::fromValue(value: l)) {}
330QVariant::QVariant(const QLineF &l) : QVariant(QVariant::fromValue(value: l)) {}
331QVariant::QVariant(const QSize &s) : QVariant(QVariant::fromValue(value: s)) {}
332QVariant::QVariant(const QSizeF &s) : QVariant(QVariant::fromValue(value: s)) {}
333#endif
334
335#if QT_CONFIG(xmlstreamreader)
336
337#include "qxmlstream.h"
338
339QXmlStreamReader::QXmlStreamReader(const QByteArray &data)
340 : QXmlStreamReader(data, PrivateConstructorTag{})
341{
342}
343
344QXmlStreamReader::QXmlStreamReader(const QString &data)
345 : QXmlStreamReader(qToAnyStringViewIgnoringNull(s: data))
346{
347}
348
349QXmlStreamReader::QXmlStreamReader(const char *data)
350 : QXmlStreamReader(QAnyStringView(data))
351{
352}
353
354void QXmlStreamReader::addData(const QByteArray &data)
355{
356 addData<>(data);
357}
358void QXmlStreamReader::addData(const QString &data)
359{
360 addData(data: qToAnyStringViewIgnoringNull(s: data));
361}
362
363void QXmlStreamReader::addData(const char *data)
364{
365 addData(data: QAnyStringView(data));
366}
367
368#endif // QT_CONFIG(xmlstreamreader)
369
370#if QT_CONFIG(xmlstreamwriter)
371
372#include "qxmlstream.h"
373
374void QXmlStreamWriter::writeAttribute(const QString &qualifiedName, const QString &value)
375{
376 writeAttribute(qualifiedName: qToAnyStringViewIgnoringNull(s: qualifiedName),
377 value: qToAnyStringViewIgnoringNull(s: value));
378}
379
380void QXmlStreamWriter::writeAttribute(const QString &namespaceUri, const QString &name, const QString &value)
381{
382 writeAttribute(namespaceUri: qToAnyStringViewIgnoringNull(s: namespaceUri),
383 name: qToAnyStringViewIgnoringNull(s: name),
384 value: qToAnyStringViewIgnoringNull(s: value));
385}
386
387void QXmlStreamWriter::writeCDATA(const QString &text)
388{
389 writeCDATA(text: qToAnyStringViewIgnoringNull(s: text));
390}
391
392void QXmlStreamWriter::writeCharacters(const QString &text)
393{
394 writeCharacters(text: qToAnyStringViewIgnoringNull(s: text));
395}
396
397void QXmlStreamWriter::writeComment(const QString &text)
398{
399 writeComment(text: qToAnyStringViewIgnoringNull(s: text));
400}
401
402void QXmlStreamWriter::writeDTD(const QString &dtd)
403{
404 writeDTD(dtd: qToAnyStringViewIgnoringNull(s: dtd));
405}
406
407void QXmlStreamWriter::writeEmptyElement(const QString &qualifiedName)
408{
409 writeEmptyElement(qualifiedName: qToAnyStringViewIgnoringNull(s: qualifiedName));
410}
411
412void QXmlStreamWriter::writeEmptyElement(const QString &namespaceUri, const QString &name)
413{
414 writeEmptyElement(namespaceUri: qToAnyStringViewIgnoringNull(s: namespaceUri),
415 name: qToAnyStringViewIgnoringNull(s: name));
416}
417
418void QXmlStreamWriter::writeTextElement(const QString &qualifiedName, const QString &text)
419{
420 writeTextElement(qualifiedName: qToAnyStringViewIgnoringNull(s: qualifiedName),
421 text: qToAnyStringViewIgnoringNull(s: text));
422}
423
424void QXmlStreamWriter::writeTextElement(const QString &namespaceUri, const QString &name, const QString &text)
425{
426 writeTextElement(namespaceUri: qToAnyStringViewIgnoringNull(s: namespaceUri),
427 name: qToAnyStringViewIgnoringNull(s: name),
428 text: qToAnyStringViewIgnoringNull(s: text));
429}
430
431void QXmlStreamWriter::writeEntityReference(const QString &name)
432{
433 writeEntityReference(name: qToAnyStringViewIgnoringNull(s: name));
434}
435
436void QXmlStreamWriter::writeNamespace(const QString &namespaceUri, const QString &prefix)
437{
438 writeNamespace(namespaceUri: qToAnyStringViewIgnoringNull(s: namespaceUri),
439 prefix: qToAnyStringViewIgnoringNull(s: prefix));
440}
441
442void QXmlStreamWriter::writeDefaultNamespace(const QString &namespaceUri)
443{
444 writeDefaultNamespace(namespaceUri: qToAnyStringViewIgnoringNull(s: namespaceUri));
445}
446
447void QXmlStreamWriter::writeProcessingInstruction(const QString &target, const QString &data)
448{
449 writeProcessingInstruction(target: qToAnyStringViewIgnoringNull(s: target),
450 data: qToAnyStringViewIgnoringNull(s: data));
451}
452
453void QXmlStreamWriter::writeStartDocument(const QString &version)
454{
455 writeStartDocument(version: qToAnyStringViewIgnoringNull(s: version));
456}
457
458void QXmlStreamWriter::writeStartDocument(const QString &version, bool standalone)
459{
460 writeStartDocument(version: qToAnyStringViewIgnoringNull(s: version),
461 standalone);
462}
463
464void QXmlStreamWriter::writeStartElement(const QString &qualifiedName)
465{
466 writeStartElement(qualifiedName: qToAnyStringViewIgnoringNull(s: qualifiedName));
467}
468
469void QXmlStreamWriter::writeStartElement(const QString &namespaceUri, const QString &name)
470{
471 writeStartElement(namespaceUri: qToAnyStringViewIgnoringNull(s: namespaceUri),
472 name: qToAnyStringViewIgnoringNull(s: name));
473}
474
475#endif // QT_CONFIG(xmlstreamwriter)
476
477// inlined API
478#include "qfloat16.h"
479#include "qstring.h"
480
481// #include "qotherheader.h"
482// // implement removed functions from qotherheader.h
483// order sections alphabetically to reduce chances of merge conflicts
484
485#endif // QT_CORE_REMOVED_SINCE(6, 5)
486
487#if QT_CORE_REMOVED_SINCE(6, 6)
488
489#include "qmessageauthenticationcode.h"
490
491QMessageAuthenticationCode::QMessageAuthenticationCode(QCryptographicHash::Algorithm method,
492 const QByteArray &key)
493 : QMessageAuthenticationCode(method, qToByteArrayViewIgnoringNull(b: key)) {}
494
495void QMessageAuthenticationCode::setKey(const QByteArray &key)
496{
497 setKey(qToByteArrayViewIgnoringNull(b: key));
498}
499
500void QMessageAuthenticationCode::addData(const QByteArray &data)
501{
502 addData(data: qToByteArrayViewIgnoringNull(b: data));
503}
504
505QByteArray QMessageAuthenticationCode::hash(const QByteArray &msg, const QByteArray &key,
506 QCryptographicHash::Algorithm method)
507{
508 return hash(message: qToByteArrayViewIgnoringNull(b: msg),
509 key: qToByteArrayViewIgnoringNull(b: key), method);
510}
511
512#include "qobject.h" // inlined API
513
514#include "qrunnable.h"
515
516QRunnable *QRunnable::create(std::function<void()> functionToRun)
517{
518 return QRunnable::create<std::function<void()>>(functionToRun: std::move(functionToRun));
519}
520
521#include "qstring.h"
522
523qsizetype QString::toUcs4_helper(const ushort *uc, qsizetype length, uint *out)
524{
525 return toUcs4_helper(uc: reinterpret_cast<const char16_t *>(uc), length,
526 out: reinterpret_cast<char32_t *>(out));
527}
528
529#if QT_CONFIG(thread)
530#include "qreadwritelock.h"
531
532bool QReadWriteLock::tryLockForRead()
533{
534 return tryLockForRead(timeout: 0);
535}
536
537bool QReadWriteLock::tryLockForWrite()
538{
539 return tryLockForWrite(timeout: 0);
540}
541
542#include "qthreadpool.h"
543#include "private/qthreadpool_p.h"
544
545void QThreadPool::start(std::function<void()> functionToRun, int priority)
546{
547 if (!functionToRun)
548 return;
549 start(runnable: QRunnable::create(functionToRun: std::move(functionToRun)), priority);
550}
551
552bool QThreadPool::tryStart(std::function<void()> functionToRun)
553{
554 if (!functionToRun)
555 return false;
556
557 Q_D(QThreadPool);
558 QMutexLocker locker(&d->mutex);
559 if (!d->allThreads.isEmpty() && d->areAllThreadsActive())
560 return false;
561
562 QRunnable *runnable = QRunnable::create(functionToRun: std::move(functionToRun));
563 if (d->tryStart(task: runnable))
564 return true;
565 delete runnable;
566 return false;
567}
568
569void QThreadPool::startOnReservedThread(std::function<void()> functionToRun)
570{
571 if (!functionToRun)
572 return releaseThread();
573
574 startOnReservedThread(runnable: QRunnable::create(functionToRun: std::move(functionToRun)));
575}
576
577#endif // QT_CONFIG(thread)
578
579#include "qxmlstream.h"
580
581QStringView QXmlStreamAttributes::value(const QString &namespaceUri, const QString &name) const
582{
583 return value(namespaceUri: qToAnyStringViewIgnoringNull(s: namespaceUri), name: qToAnyStringViewIgnoringNull(s: name));
584}
585
586QStringView QXmlStreamAttributes::value(const QString &namespaceUri, QLatin1StringView name) const
587{
588 return value(namespaceUri: qToAnyStringViewIgnoringNull(s: namespaceUri), name: QAnyStringView(name));
589}
590
591QStringView QXmlStreamAttributes::value(QLatin1StringView namespaceUri, QLatin1StringView name) const
592{
593 return value(namespaceUri: QAnyStringView(namespaceUri), name: QAnyStringView(name));
594}
595
596QStringView QXmlStreamAttributes::value(const QString &qualifiedName) const
597{
598 return value(qualifiedName: qToAnyStringViewIgnoringNull(s: qualifiedName));
599}
600
601QStringView QXmlStreamAttributes::value(QLatin1StringView qualifiedName) const
602{
603 return value(qualifiedName: QAnyStringView(qualifiedName));
604}
605
606// inlined API
607#if QT_CONFIG(thread)
608#include "qmutex.h"
609#include "qreadwritelock.h"
610#include "qsemaphore.h"
611#endif
612
613// #include "qotherheader.h"
614// // implement removed functions from qotherheader.h
615// order sections alphabetically to reduce chances of merge conflicts
616
617#endif // QT_CORE_REMOVED_SINCE(6, 6)
618

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