diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QArrayDataPointer b/qt/6.8.1/msvc2022_64/include/QtCore/QArrayDataPointer new file mode 100644 index 0000000000000000000000000000000000000000..2093f67f1825d2b81bdb2254a1010a9f4d49bc1b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QArrayDataPointer @@ -0,0 +1 @@ +#include "qarraydatapointer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QAssociativeConstIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QAssociativeConstIterator new file mode 100644 index 0000000000000000000000000000000000000000..ae48e800d186c3cb617ae85a707bbee74e21e489 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QAssociativeConstIterator @@ -0,0 +1 @@ +#include "qassociativeiterable.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QAssociativeIterable b/qt/6.8.1/msvc2022_64/include/QtCore/QAssociativeIterable new file mode 100644 index 0000000000000000000000000000000000000000..ae48e800d186c3cb617ae85a707bbee74e21e489 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QAssociativeIterable @@ -0,0 +1 @@ +#include "qassociativeiterable.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QAssociativeIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QAssociativeIterator new file mode 100644 index 0000000000000000000000000000000000000000..ae48e800d186c3cb617ae85a707bbee74e21e489 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QAssociativeIterator @@ -0,0 +1 @@ +#include "qassociativeiterable.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QAtomicInt b/qt/6.8.1/msvc2022_64/include/QtCore/QAtomicInt new file mode 100644 index 0000000000000000000000000000000000000000..ef1656184210b51d22ff639dfbec0b1d7c9f7f0a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QAtomicInt @@ -0,0 +1 @@ +#include "qatomic.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QAtomicInteger b/qt/6.8.1/msvc2022_64/include/QtCore/QAtomicInteger new file mode 100644 index 0000000000000000000000000000000000000000..ef1656184210b51d22ff639dfbec0b1d7c9f7f0a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QAtomicInteger @@ -0,0 +1 @@ +#include "qatomic.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QAtomicPointer b/qt/6.8.1/msvc2022_64/include/QtCore/QAtomicPointer new file mode 100644 index 0000000000000000000000000000000000000000..ef1656184210b51d22ff639dfbec0b1d7c9f7f0a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QAtomicPointer @@ -0,0 +1 @@ +#include "qatomic.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QAtomicScopedValueRollback b/qt/6.8.1/msvc2022_64/include/QtCore/QAtomicScopedValueRollback new file mode 100644 index 0000000000000000000000000000000000000000..696879563fda02675162804b3bf5245674333102 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QAtomicScopedValueRollback @@ -0,0 +1 @@ +#include "qatomicscopedvaluerollback.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QBEInteger b/qt/6.8.1/msvc2022_64/include/QtCore/QBEInteger new file mode 100644 index 0000000000000000000000000000000000000000..d97b75063d4fc4d14bf125c5e6cfeefc4be1dbf2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QBEInteger @@ -0,0 +1 @@ +#include "qendian.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QBaseIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QBaseIterator new file mode 100644 index 0000000000000000000000000000000000000000..2f6a0dec463c0239f5c82c9f9037d870a20088c1 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QBaseIterator @@ -0,0 +1 @@ +#include "qiterable.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QBasicMutex b/qt/6.8.1/msvc2022_64/include/QtCore/QBasicMutex new file mode 100644 index 0000000000000000000000000000000000000000..f4efe9420df458f9e0ea0b9b1ee1ed57a7286028 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QBasicMutex @@ -0,0 +1 @@ +#include "qmutex.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QBasicTimer b/qt/6.8.1/msvc2022_64/include/QtCore/QBasicTimer new file mode 100644 index 0000000000000000000000000000000000000000..a3a42eebbc4d3a1c11d0e05625bbd43ce31376d2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QBasicTimer @@ -0,0 +1 @@ +#include "qbasictimer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QBasicUtf8StringView b/qt/6.8.1/msvc2022_64/include/QtCore/QBasicUtf8StringView new file mode 100644 index 0000000000000000000000000000000000000000..1820516b5dd65fdd813ed9ad0f963000f4ecdaea --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QBasicUtf8StringView @@ -0,0 +1 @@ +#include "qutf8stringview.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QBigEndianStorageType b/qt/6.8.1/msvc2022_64/include/QtCore/QBigEndianStorageType new file mode 100644 index 0000000000000000000000000000000000000000..d97b75063d4fc4d14bf125c5e6cfeefc4be1dbf2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QBigEndianStorageType @@ -0,0 +1 @@ +#include "qendian.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QBindable b/qt/6.8.1/msvc2022_64/include/QtCore/QBindable new file mode 100644 index 0000000000000000000000000000000000000000..4cdcd92eb3cd04e9ba02bc1c5e4afdb4ff5925d8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QBindable @@ -0,0 +1 @@ +#include "qproperty.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QBindingStatus b/qt/6.8.1/msvc2022_64/include/QtCore/QBindingStatus new file mode 100644 index 0000000000000000000000000000000000000000..ff1ce5f69db6292b0e60ce487daae2ab8cf5e323 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QBindingStatus @@ -0,0 +1 @@ +#include "qbindingstorage.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QBindingStorage b/qt/6.8.1/msvc2022_64/include/QtCore/QBindingStorage new file mode 100644 index 0000000000000000000000000000000000000000..ff1ce5f69db6292b0e60ce487daae2ab8cf5e323 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QBindingStorage @@ -0,0 +1 @@ +#include "qbindingstorage.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QBitArray b/qt/6.8.1/msvc2022_64/include/QtCore/QBitArray new file mode 100644 index 0000000000000000000000000000000000000000..a537d090fb4592f37c35ae4a02dd0c03a877d3d6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QBitArray @@ -0,0 +1 @@ +#include "qbitarray.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QBitRef b/qt/6.8.1/msvc2022_64/include/QtCore/QBitRef new file mode 100644 index 0000000000000000000000000000000000000000..a537d090fb4592f37c35ae4a02dd0c03a877d3d6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QBitRef @@ -0,0 +1 @@ +#include "qbitarray.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QBluetoothPermission b/qt/6.8.1/msvc2022_64/include/QtCore/QBluetoothPermission new file mode 100644 index 0000000000000000000000000000000000000000..ca67e48d2d62a329c7cc5825f66f92b7994f3382 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QBluetoothPermission @@ -0,0 +1 @@ +#include "qpermissions.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QBuffer b/qt/6.8.1/msvc2022_64/include/QtCore/QBuffer new file mode 100644 index 0000000000000000000000000000000000000000..d75437bd593584089f387fb3918f6c60a7ae6366 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QBuffer @@ -0,0 +1 @@ +#include "qbuffer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QByteArray b/qt/6.8.1/msvc2022_64/include/QtCore/QByteArray new file mode 100644 index 0000000000000000000000000000000000000000..136a8663b7e39f226176383faacaf63ed3713a76 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QByteArray @@ -0,0 +1 @@ +#include "qbytearray.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QByteArrayAlgorithms b/qt/6.8.1/msvc2022_64/include/QtCore/QByteArrayAlgorithms new file mode 100644 index 0000000000000000000000000000000000000000..520e87b58aeb787587e1862fdbc2ac1bcfe9e2ca --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QByteArrayAlgorithms @@ -0,0 +1 @@ +#include "qbytearrayalgorithms.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QByteArrayList b/qt/6.8.1/msvc2022_64/include/QtCore/QByteArrayList new file mode 100644 index 0000000000000000000000000000000000000000..d2683b9ca817133beead41477acbb67fee607a05 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QByteArrayList @@ -0,0 +1 @@ +#include "qbytearraylist.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QByteArrayListIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QByteArrayListIterator new file mode 100644 index 0000000000000000000000000000000000000000..d2683b9ca817133beead41477acbb67fee607a05 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QByteArrayListIterator @@ -0,0 +1 @@ +#include "qbytearraylist.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QByteArrayMatcher b/qt/6.8.1/msvc2022_64/include/QtCore/QByteArrayMatcher new file mode 100644 index 0000000000000000000000000000000000000000..f0c84e230ec0d207ed29255d7456eed2625bbfb6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QByteArrayMatcher @@ -0,0 +1 @@ +#include "qbytearraymatcher.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QByteArrayView b/qt/6.8.1/msvc2022_64/include/QtCore/QByteArrayView new file mode 100644 index 0000000000000000000000000000000000000000..52345be1a0aafc31adc2e643f7c070ea29cd3b5e --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QByteArrayView @@ -0,0 +1 @@ +#include "qbytearrayview.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QCache b/qt/6.8.1/msvc2022_64/include/QtCore/QCache new file mode 100644 index 0000000000000000000000000000000000000000..fa582e91198e2754c51ebd89f5f0f68e05e3d085 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QCache @@ -0,0 +1 @@ +#include "qcache.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QCalendar b/qt/6.8.1/msvc2022_64/include/QtCore/QCalendar new file mode 100644 index 0000000000000000000000000000000000000000..58764dcbc46befd91c42c0aa0554f9c02cea93bc --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QCalendar @@ -0,0 +1 @@ +#include "qcalendar.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QCalendarPermission b/qt/6.8.1/msvc2022_64/include/QtCore/QCalendarPermission new file mode 100644 index 0000000000000000000000000000000000000000..ca67e48d2d62a329c7cc5825f66f92b7994f3382 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QCalendarPermission @@ -0,0 +1 @@ +#include "qpermissions.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QCborArray b/qt/6.8.1/msvc2022_64/include/QtCore/QCborArray new file mode 100644 index 0000000000000000000000000000000000000000..9119b666f70885e9399e0693881403c4f76c499e --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QCborArray @@ -0,0 +1 @@ +#include "qcborarray.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QCborError b/qt/6.8.1/msvc2022_64/include/QtCore/QCborError new file mode 100644 index 0000000000000000000000000000000000000000..be3d0c84f82f85729888f35ec29bf0abafce0391 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QCborError @@ -0,0 +1 @@ +#include "qcborcommon.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QCborMap b/qt/6.8.1/msvc2022_64/include/QtCore/QCborMap new file mode 100644 index 0000000000000000000000000000000000000000..110167c6c176d7b9635c3414fb078d7a8e238f41 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QCborMap @@ -0,0 +1 @@ +#include "qcbormap.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QCborParserError b/qt/6.8.1/msvc2022_64/include/QtCore/QCborParserError new file mode 100644 index 0000000000000000000000000000000000000000..7b691736ac837a15b526fb22ce555f833e90e45a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QCborParserError @@ -0,0 +1 @@ +#include "qcborvalue.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QCborStreamReader b/qt/6.8.1/msvc2022_64/include/QtCore/QCborStreamReader new file mode 100644 index 0000000000000000000000000000000000000000..040bc524e486ecc64c21ec185f3f2959d0ed355f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QCborStreamReader @@ -0,0 +1 @@ +#include "qcborstreamreader.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QCborStreamWriter b/qt/6.8.1/msvc2022_64/include/QtCore/QCborStreamWriter new file mode 100644 index 0000000000000000000000000000000000000000..7e02f20f77f41326aeaa21d114f4e766e6bc4ddb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QCborStreamWriter @@ -0,0 +1 @@ +#include "qcborstreamwriter.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QCborValue b/qt/6.8.1/msvc2022_64/include/QtCore/QCborValue new file mode 100644 index 0000000000000000000000000000000000000000..7b691736ac837a15b526fb22ce555f833e90e45a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QCborValue @@ -0,0 +1 @@ +#include "qcborvalue.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QCborValueConstRef b/qt/6.8.1/msvc2022_64/include/QtCore/QCborValueConstRef new file mode 100644 index 0000000000000000000000000000000000000000..7b691736ac837a15b526fb22ce555f833e90e45a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QCborValueConstRef @@ -0,0 +1 @@ +#include "qcborvalue.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QCborValueRef b/qt/6.8.1/msvc2022_64/include/QtCore/QCborValueRef new file mode 100644 index 0000000000000000000000000000000000000000..7b691736ac837a15b526fb22ce555f833e90e45a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QCborValueRef @@ -0,0 +1 @@ +#include "qcborvalue.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QChar b/qt/6.8.1/msvc2022_64/include/QtCore/QChar new file mode 100644 index 0000000000000000000000000000000000000000..6fe3dfdb1a1b86e0e063e62f4cdaf57543257302 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QChar @@ -0,0 +1 @@ +#include "qchar.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QChildEvent b/qt/6.8.1/msvc2022_64/include/QtCore/QChildEvent new file mode 100644 index 0000000000000000000000000000000000000000..0c3751e4c9bb886b64bf75cfdad55c496865f9d1 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QChildEvent @@ -0,0 +1 @@ +#include "qcoreevent.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QChronoTimer b/qt/6.8.1/msvc2022_64/include/QtCore/QChronoTimer new file mode 100644 index 0000000000000000000000000000000000000000..93f318fc6919a4da0df7adb19cc3539b4ae15735 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QChronoTimer @@ -0,0 +1 @@ +#include "qchronotimer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QCollator b/qt/6.8.1/msvc2022_64/include/QtCore/QCollator new file mode 100644 index 0000000000000000000000000000000000000000..9f64bd9343ede62675820c4af280d2d9f5061c5c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QCollator @@ -0,0 +1 @@ +#include "qcollator.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QCollatorSortKey b/qt/6.8.1/msvc2022_64/include/QtCore/QCollatorSortKey new file mode 100644 index 0000000000000000000000000000000000000000..9f64bd9343ede62675820c4af280d2d9f5061c5c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QCollatorSortKey @@ -0,0 +1 @@ +#include "qcollator.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QCommandLineOption b/qt/6.8.1/msvc2022_64/include/QtCore/QCommandLineOption new file mode 100644 index 0000000000000000000000000000000000000000..7d94bfc92d825decbcc67429b4d8fc81d0140146 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QCommandLineOption @@ -0,0 +1 @@ +#include "qcommandlineoption.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QCommandLineParser b/qt/6.8.1/msvc2022_64/include/QtCore/QCommandLineParser new file mode 100644 index 0000000000000000000000000000000000000000..3e977653b3f308f56b4c7ed6de4e8e486e67d3b8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QCommandLineParser @@ -0,0 +1 @@ +#include "qcommandlineparser.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QConcatenateTablesProxyModel b/qt/6.8.1/msvc2022_64/include/QtCore/QConcatenateTablesProxyModel new file mode 100644 index 0000000000000000000000000000000000000000..bc0970ff3e11811a424fe38ca1bf3ae3b5b06a3c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QConcatenateTablesProxyModel @@ -0,0 +1 @@ +#include "qconcatenatetablesproxymodel.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QConstIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QConstIterator new file mode 100644 index 0000000000000000000000000000000000000000..2f6a0dec463c0239f5c82c9f9037d870a20088c1 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QConstIterator @@ -0,0 +1 @@ +#include "qiterable.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QConstOverload b/qt/6.8.1/msvc2022_64/include/QtCore/QConstOverload new file mode 100644 index 0000000000000000000000000000000000000000..be914e16061e028090c1bf834e355c1b45abf0ba --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QConstOverload @@ -0,0 +1 @@ +#include "qoverload.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QContactsPermission b/qt/6.8.1/msvc2022_64/include/QtCore/QContactsPermission new file mode 100644 index 0000000000000000000000000000000000000000..ca67e48d2d62a329c7cc5825f66f92b7994f3382 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QContactsPermission @@ -0,0 +1 @@ +#include "qpermissions.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QContiguousCache b/qt/6.8.1/msvc2022_64/include/QtCore/QContiguousCache new file mode 100644 index 0000000000000000000000000000000000000000..7a6f046c5344c88ce03a0ee95405abbe25acccb2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QContiguousCache @@ -0,0 +1 @@ +#include "qcontiguouscache.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QContiguousCacheData b/qt/6.8.1/msvc2022_64/include/QtCore/QContiguousCacheData new file mode 100644 index 0000000000000000000000000000000000000000..7a6f046c5344c88ce03a0ee95405abbe25acccb2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QContiguousCacheData @@ -0,0 +1 @@ +#include "qcontiguouscache.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QContiguousCacheTypedData b/qt/6.8.1/msvc2022_64/include/QtCore/QContiguousCacheTypedData new file mode 100644 index 0000000000000000000000000000000000000000..7a6f046c5344c88ce03a0ee95405abbe25acccb2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QContiguousCacheTypedData @@ -0,0 +1 @@ +#include "qcontiguouscache.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QCoreApplication b/qt/6.8.1/msvc2022_64/include/QtCore/QCoreApplication new file mode 100644 index 0000000000000000000000000000000000000000..dcc3f20cfa67e1d19230d25209ed20764f26ae22 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QCoreApplication @@ -0,0 +1 @@ +#include "qcoreapplication.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QCryptographicHash b/qt/6.8.1/msvc2022_64/include/QtCore/QCryptographicHash new file mode 100644 index 0000000000000000000000000000000000000000..2b6345d7a3b495f2a8ad991b98a16a8e1fde3f84 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QCryptographicHash @@ -0,0 +1 @@ +#include "qcryptographichash.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QDataStream b/qt/6.8.1/msvc2022_64/include/QtCore/QDataStream new file mode 100644 index 0000000000000000000000000000000000000000..9175665cd685b1bcd1cb0b8d44d3862efb9934b6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QDataStream @@ -0,0 +1 @@ +#include "qdatastream.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QDate b/qt/6.8.1/msvc2022_64/include/QtCore/QDate new file mode 100644 index 0000000000000000000000000000000000000000..053d3a6938fde637da846aadcbb980c988ed3992 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QDate @@ -0,0 +1 @@ +#include "qdatetime.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QDateTime b/qt/6.8.1/msvc2022_64/include/QtCore/QDateTime new file mode 100644 index 0000000000000000000000000000000000000000..053d3a6938fde637da846aadcbb980c988ed3992 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QDateTime @@ -0,0 +1 @@ +#include "qdatetime.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QDeadlineTimer b/qt/6.8.1/msvc2022_64/include/QtCore/QDeadlineTimer new file mode 100644 index 0000000000000000000000000000000000000000..12a55dd581bdbd40e98c69d2d85385a6b794001f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QDeadlineTimer @@ -0,0 +1 @@ +#include "qdeadlinetimer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QDebug b/qt/6.8.1/msvc2022_64/include/QtCore/QDebug new file mode 100644 index 0000000000000000000000000000000000000000..787e69549068b8daca4aac6ba73d98139bf901d0 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QDebug @@ -0,0 +1 @@ +#include "qdebug.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QDebugStateSaver b/qt/6.8.1/msvc2022_64/include/QtCore/QDebugStateSaver new file mode 100644 index 0000000000000000000000000000000000000000..787e69549068b8daca4aac6ba73d98139bf901d0 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QDebugStateSaver @@ -0,0 +1 @@ +#include "qdebug.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QDir b/qt/6.8.1/msvc2022_64/include/QtCore/QDir new file mode 100644 index 0000000000000000000000000000000000000000..915615035d00aeac25e47b891d84de622da0e298 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QDir @@ -0,0 +1 @@ +#include "qdir.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QDirIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QDirIterator new file mode 100644 index 0000000000000000000000000000000000000000..7c771f98fcc2ac11fbf3ef4dee217e4b49f5514b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QDirIterator @@ -0,0 +1 @@ +#include "qdiriterator.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QDirListing b/qt/6.8.1/msvc2022_64/include/QtCore/QDirListing new file mode 100644 index 0000000000000000000000000000000000000000..6a62da560919f110be2211dbc0bee37afa38145b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QDirListing @@ -0,0 +1 @@ +#include "qdirlisting.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QDynamicPropertyChangeEvent b/qt/6.8.1/msvc2022_64/include/QtCore/QDynamicPropertyChangeEvent new file mode 100644 index 0000000000000000000000000000000000000000..0c3751e4c9bb886b64bf75cfdad55c496865f9d1 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QDynamicPropertyChangeEvent @@ -0,0 +1 @@ +#include "qcoreevent.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QEasingCurve b/qt/6.8.1/msvc2022_64/include/QtCore/QEasingCurve new file mode 100644 index 0000000000000000000000000000000000000000..88c197d0c8373148e92e0a36f1d63b49b78a0220 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QEasingCurve @@ -0,0 +1 @@ +#include "qeasingcurve.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QElapsedTimer b/qt/6.8.1/msvc2022_64/include/QtCore/QElapsedTimer new file mode 100644 index 0000000000000000000000000000000000000000..097a12877100d9ef35edbd30db4820b99e9f4523 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QElapsedTimer @@ -0,0 +1 @@ +#include "qelapsedtimer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QEnableSharedFromThis b/qt/6.8.1/msvc2022_64/include/QtCore/QEnableSharedFromThis new file mode 100644 index 0000000000000000000000000000000000000000..f9aa7ebf9ddcc62231a62c5b7a02454f5cc2c0a2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QEnableSharedFromThis @@ -0,0 +1 @@ +#include "qsharedpointer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QEvent b/qt/6.8.1/msvc2022_64/include/QtCore/QEvent new file mode 100644 index 0000000000000000000000000000000000000000..0c3751e4c9bb886b64bf75cfdad55c496865f9d1 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QEvent @@ -0,0 +1 @@ +#include "qcoreevent.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QEventLoop b/qt/6.8.1/msvc2022_64/include/QtCore/QEventLoop new file mode 100644 index 0000000000000000000000000000000000000000..b4ccc4d1dbeebce42c420768a61d45ecd5c65b48 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QEventLoop @@ -0,0 +1 @@ +#include "qeventloop.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QEventLoopLocker b/qt/6.8.1/msvc2022_64/include/QtCore/QEventLoopLocker new file mode 100644 index 0000000000000000000000000000000000000000..b4ccc4d1dbeebce42c420768a61d45ecd5c65b48 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QEventLoopLocker @@ -0,0 +1 @@ +#include "qeventloop.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QException b/qt/6.8.1/msvc2022_64/include/QtCore/QException new file mode 100644 index 0000000000000000000000000000000000000000..aa8a91df97da0ec818245f3770cb914a9e8b8318 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QException @@ -0,0 +1 @@ +#include "qexception.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QExplicitlySharedDataPointer b/qt/6.8.1/msvc2022_64/include/QtCore/QExplicitlySharedDataPointer new file mode 100644 index 0000000000000000000000000000000000000000..317e02ff53457d6138d4ccf173608d1a43867421 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QExplicitlySharedDataPointer @@ -0,0 +1 @@ +#include "qshareddata.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QFactoryInterface b/qt/6.8.1/msvc2022_64/include/QtCore/QFactoryInterface new file mode 100644 index 0000000000000000000000000000000000000000..15af1bec54fd00288ee37d34ea4d3e16e067042b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QFactoryInterface @@ -0,0 +1 @@ +#include "qfactoryinterface.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QFile b/qt/6.8.1/msvc2022_64/include/QtCore/QFile new file mode 100644 index 0000000000000000000000000000000000000000..2bc9e133aace513e5b25f40dc56188fccf44ee0e --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QFile @@ -0,0 +1 @@ +#include "qfile.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QFileDevice b/qt/6.8.1/msvc2022_64/include/QtCore/QFileDevice new file mode 100644 index 0000000000000000000000000000000000000000..375b561be57ed430c4bb69196ddf9657ce2e4ce4 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QFileDevice @@ -0,0 +1 @@ +#include "qfiledevice.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QFileInfo b/qt/6.8.1/msvc2022_64/include/QtCore/QFileInfo new file mode 100644 index 0000000000000000000000000000000000000000..d13e00b671995fc22584816017ecd18dde049bb7 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QFileInfo @@ -0,0 +1 @@ +#include "qfileinfo.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QFileInfoList b/qt/6.8.1/msvc2022_64/include/QtCore/QFileInfoList new file mode 100644 index 0000000000000000000000000000000000000000..d13e00b671995fc22584816017ecd18dde049bb7 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QFileInfoList @@ -0,0 +1 @@ +#include "qfileinfo.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QFileSelector b/qt/6.8.1/msvc2022_64/include/QtCore/QFileSelector new file mode 100644 index 0000000000000000000000000000000000000000..fa4e0c2f5d26c90076af9dd850987b519702e30d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QFileSelector @@ -0,0 +1 @@ +#include "qfileselector.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QFileSystemWatcher b/qt/6.8.1/msvc2022_64/include/QtCore/QFileSystemWatcher new file mode 100644 index 0000000000000000000000000000000000000000..1778ec5760dde8d1db2c29106b0eec0ba5f0c291 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QFileSystemWatcher @@ -0,0 +1 @@ +#include "qfilesystemwatcher.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QFlag b/qt/6.8.1/msvc2022_64/include/QtCore/QFlag new file mode 100644 index 0000000000000000000000000000000000000000..9148e6439e7b9d9a1bf6491648e2a9af9cb3f277 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QFlag @@ -0,0 +1 @@ +#include "qflags.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QFlags b/qt/6.8.1/msvc2022_64/include/QtCore/QFlags new file mode 100644 index 0000000000000000000000000000000000000000..9148e6439e7b9d9a1bf6491648e2a9af9cb3f277 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QFlags @@ -0,0 +1 @@ +#include "qflags.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QFloat16 b/qt/6.8.1/msvc2022_64/include/QtCore/QFloat16 new file mode 100644 index 0000000000000000000000000000000000000000..1fa94942c3bac9bcd228f91aa63bfc44ae060e17 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QFloat16 @@ -0,0 +1 @@ +#include "qfloat16.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QForeach b/qt/6.8.1/msvc2022_64/include/QtCore/QForeach new file mode 100644 index 0000000000000000000000000000000000000000..9aff1499c023ce82e48a396b2c951b6faf89ee05 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QForeach @@ -0,0 +1 @@ +#include "qforeach.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QFunctionPointer b/qt/6.8.1/msvc2022_64/include/QtCore/QFunctionPointer new file mode 100644 index 0000000000000000000000000000000000000000..2f0edba898c1d3c880ee75acc414017b0b1ffc9f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QFunctionPointer @@ -0,0 +1 @@ +#include "qfunctionpointer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QFuture b/qt/6.8.1/msvc2022_64/include/QtCore/QFuture new file mode 100644 index 0000000000000000000000000000000000000000..f1675124608e114316cabf2c6d57c58c2fcb497b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QFuture @@ -0,0 +1 @@ +#include "qfuture.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QFutureInterface b/qt/6.8.1/msvc2022_64/include/QtCore/QFutureInterface new file mode 100644 index 0000000000000000000000000000000000000000..776ce8ddee6f4d2eaf6e8b521b22dc2d5949a91d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QFutureInterface @@ -0,0 +1 @@ +#include "qfutureinterface.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QFutureInterfaceBase b/qt/6.8.1/msvc2022_64/include/QtCore/QFutureInterfaceBase new file mode 100644 index 0000000000000000000000000000000000000000..776ce8ddee6f4d2eaf6e8b521b22dc2d5949a91d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QFutureInterfaceBase @@ -0,0 +1 @@ +#include "qfutureinterface.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QFutureIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QFutureIterator new file mode 100644 index 0000000000000000000000000000000000000000..f1675124608e114316cabf2c6d57c58c2fcb497b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QFutureIterator @@ -0,0 +1 @@ +#include "qfuture.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QFutureSynchronizer b/qt/6.8.1/msvc2022_64/include/QtCore/QFutureSynchronizer new file mode 100644 index 0000000000000000000000000000000000000000..7f4ddac2938a492cb64f3db106e17f110abd4fc1 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QFutureSynchronizer @@ -0,0 +1 @@ +#include "qfuturesynchronizer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QFutureWatcher b/qt/6.8.1/msvc2022_64/include/QtCore/QFutureWatcher new file mode 100644 index 0000000000000000000000000000000000000000..77d7954778145b25b54e1335aefc84ce0a3a43a6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QFutureWatcher @@ -0,0 +1 @@ +#include "qfuturewatcher.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QFutureWatcherBase b/qt/6.8.1/msvc2022_64/include/QtCore/QFutureWatcherBase new file mode 100644 index 0000000000000000000000000000000000000000..77d7954778145b25b54e1335aefc84ce0a3a43a6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QFutureWatcherBase @@ -0,0 +1 @@ +#include "qfuturewatcher.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QGenericArgument b/qt/6.8.1/msvc2022_64/include/QtCore/QGenericArgument new file mode 100644 index 0000000000000000000000000000000000000000..7ab6274b1fe05d6ae81d6ca90fcc1ab61bc516cc --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QGenericArgument @@ -0,0 +1 @@ +#include "qobjectdefs.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QGenericReturnArgument b/qt/6.8.1/msvc2022_64/include/QtCore/QGenericReturnArgument new file mode 100644 index 0000000000000000000000000000000000000000..7ab6274b1fe05d6ae81d6ca90fcc1ab61bc516cc --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QGenericReturnArgument @@ -0,0 +1 @@ +#include "qobjectdefs.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QGlobalStatic b/qt/6.8.1/msvc2022_64/include/QtCore/QGlobalStatic new file mode 100644 index 0000000000000000000000000000000000000000..eddac805e1b085fca2a4a6d543e9a9c40052b2f0 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QGlobalStatic @@ -0,0 +1 @@ +#include "qglobalstatic.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QHash b/qt/6.8.1/msvc2022_64/include/QtCore/QHash new file mode 100644 index 0000000000000000000000000000000000000000..a71aa974a6bd27eb3df02a5f0111441e94c2a2fb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QHash @@ -0,0 +1 @@ +#include "qhash.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QHashDummyValue b/qt/6.8.1/msvc2022_64/include/QtCore/QHashDummyValue new file mode 100644 index 0000000000000000000000000000000000000000..a71aa974a6bd27eb3df02a5f0111441e94c2a2fb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QHashDummyValue @@ -0,0 +1 @@ +#include "qhash.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QHashFunctions b/qt/6.8.1/msvc2022_64/include/QtCore/QHashFunctions new file mode 100644 index 0000000000000000000000000000000000000000..70b571d55f661b67bc51d2c0afb6fbe6319a8b48 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QHashFunctions @@ -0,0 +1 @@ +#include "qhashfunctions.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QHashHeterogeneousSearch b/qt/6.8.1/msvc2022_64/include/QtCore/QHashHeterogeneousSearch new file mode 100644 index 0000000000000000000000000000000000000000..70b571d55f661b67bc51d2c0afb6fbe6319a8b48 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QHashHeterogeneousSearch @@ -0,0 +1 @@ +#include "qhashfunctions.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QHashIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QHashIterator new file mode 100644 index 0000000000000000000000000000000000000000..a71aa974a6bd27eb3df02a5f0111441e94c2a2fb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QHashIterator @@ -0,0 +1 @@ +#include "qhash.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QHashSeed b/qt/6.8.1/msvc2022_64/include/QtCore/QHashSeed new file mode 100644 index 0000000000000000000000000000000000000000..70b571d55f661b67bc51d2c0afb6fbe6319a8b48 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QHashSeed @@ -0,0 +1 @@ +#include "qhashfunctions.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QIODevice b/qt/6.8.1/msvc2022_64/include/QtCore/QIODevice new file mode 100644 index 0000000000000000000000000000000000000000..663565b72c79305d9e3d9bc386a4858376f6ef55 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QIODevice @@ -0,0 +1 @@ +#include "qiodevice.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QIODeviceBase b/qt/6.8.1/msvc2022_64/include/QtCore/QIODeviceBase new file mode 100644 index 0000000000000000000000000000000000000000..b111af5208d58e1c104c6c6657afd093a4c38623 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QIODeviceBase @@ -0,0 +1 @@ +#include "qiodevicebase.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QIdentityProxyModel b/qt/6.8.1/msvc2022_64/include/QtCore/QIdentityProxyModel new file mode 100644 index 0000000000000000000000000000000000000000..30228db626463c1d1e962db4a55be4fbc5e45267 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QIdentityProxyModel @@ -0,0 +1 @@ +#include "qidentityproxymodel.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QIncompatibleFlag b/qt/6.8.1/msvc2022_64/include/QtCore/QIncompatibleFlag new file mode 100644 index 0000000000000000000000000000000000000000..9148e6439e7b9d9a1bf6491648e2a9af9cb3f277 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QIncompatibleFlag @@ -0,0 +1 @@ +#include "qflags.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QIntegerForSize b/qt/6.8.1/msvc2022_64/include/QtCore/QIntegerForSize new file mode 100644 index 0000000000000000000000000000000000000000..223d79eb31011a8ad39278063c8ba7288829cd00 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QIntegerForSize @@ -0,0 +1 @@ +#include "qtypes.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QInternal b/qt/6.8.1/msvc2022_64/include/QtCore/QInternal new file mode 100644 index 0000000000000000000000000000000000000000..afb4f65e19023ffec1c486c7e6d1f37261a526ac --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QInternal @@ -0,0 +1 @@ +#include "qnamespace.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QItemSelection b/qt/6.8.1/msvc2022_64/include/QtCore/QItemSelection new file mode 100644 index 0000000000000000000000000000000000000000..bf2f575faf7a4b05baa465a963b6bf76f582b6d3 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QItemSelection @@ -0,0 +1 @@ +#include "qitemselectionmodel.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QItemSelectionModel b/qt/6.8.1/msvc2022_64/include/QtCore/QItemSelectionModel new file mode 100644 index 0000000000000000000000000000000000000000..bf2f575faf7a4b05baa465a963b6bf76f582b6d3 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QItemSelectionModel @@ -0,0 +1 @@ +#include "qitemselectionmodel.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QItemSelectionRange b/qt/6.8.1/msvc2022_64/include/QtCore/QItemSelectionRange new file mode 100644 index 0000000000000000000000000000000000000000..bf2f575faf7a4b05baa465a963b6bf76f582b6d3 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QItemSelectionRange @@ -0,0 +1 @@ +#include "qitemselectionmodel.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QIterable b/qt/6.8.1/msvc2022_64/include/QtCore/QIterable new file mode 100644 index 0000000000000000000000000000000000000000..2f6a0dec463c0239f5c82c9f9037d870a20088c1 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QIterable @@ -0,0 +1 @@ +#include "qiterable.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QIterator new file mode 100644 index 0000000000000000000000000000000000000000..2f6a0dec463c0239f5c82c9f9037d870a20088c1 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QIterator @@ -0,0 +1 @@ +#include "qiterable.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QJsonArray b/qt/6.8.1/msvc2022_64/include/QtCore/QJsonArray new file mode 100644 index 0000000000000000000000000000000000000000..2d98b686d20d8804a26108f944c042b81082a91c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QJsonArray @@ -0,0 +1 @@ +#include "qjsonarray.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QJsonDocument b/qt/6.8.1/msvc2022_64/include/QtCore/QJsonDocument new file mode 100644 index 0000000000000000000000000000000000000000..1eb16551696f9fbf93b3af5097759696ea20bde2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QJsonDocument @@ -0,0 +1 @@ +#include "qjsondocument.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QJsonObject b/qt/6.8.1/msvc2022_64/include/QtCore/QJsonObject new file mode 100644 index 0000000000000000000000000000000000000000..db9fafc043355dd82d5d3610c499f31f37fe3cef --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QJsonObject @@ -0,0 +1 @@ +#include "qjsonobject.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QJsonParseError b/qt/6.8.1/msvc2022_64/include/QtCore/QJsonParseError new file mode 100644 index 0000000000000000000000000000000000000000..1eb16551696f9fbf93b3af5097759696ea20bde2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QJsonParseError @@ -0,0 +1 @@ +#include "qjsondocument.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QJsonValue b/qt/6.8.1/msvc2022_64/include/QtCore/QJsonValue new file mode 100644 index 0000000000000000000000000000000000000000..e2779f520a52c1372ccaf2e0f1be2bef15e820ba --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QJsonValue @@ -0,0 +1 @@ +#include "qjsonvalue.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QJsonValueConstRef b/qt/6.8.1/msvc2022_64/include/QtCore/QJsonValueConstRef new file mode 100644 index 0000000000000000000000000000000000000000..e2779f520a52c1372ccaf2e0f1be2bef15e820ba --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QJsonValueConstRef @@ -0,0 +1 @@ +#include "qjsonvalue.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QJsonValueRef b/qt/6.8.1/msvc2022_64/include/QtCore/QJsonValueRef new file mode 100644 index 0000000000000000000000000000000000000000..e2779f520a52c1372ccaf2e0f1be2bef15e820ba --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QJsonValueRef @@ -0,0 +1 @@ +#include "qjsonvalue.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QKeyCombination b/qt/6.8.1/msvc2022_64/include/QtCore/QKeyCombination new file mode 100644 index 0000000000000000000000000000000000000000..afb4f65e19023ffec1c486c7e6d1f37261a526ac --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QKeyCombination @@ -0,0 +1 @@ +#include "qnamespace.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QKeyValueIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QKeyValueIterator new file mode 100644 index 0000000000000000000000000000000000000000..4661cb6a6b0d366dae0fdecae7ebb5622154f762 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QKeyValueIterator @@ -0,0 +1 @@ +#include "qiterator.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QLEInteger b/qt/6.8.1/msvc2022_64/include/QtCore/QLEInteger new file mode 100644 index 0000000000000000000000000000000000000000..d97b75063d4fc4d14bf125c5e6cfeefc4be1dbf2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QLEInteger @@ -0,0 +1 @@ +#include "qendian.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QLatin1Char b/qt/6.8.1/msvc2022_64/include/QtCore/QLatin1Char new file mode 100644 index 0000000000000000000000000000000000000000..6fe3dfdb1a1b86e0e063e62f4cdaf57543257302 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QLatin1Char @@ -0,0 +1 @@ +#include "qchar.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QLatin1String b/qt/6.8.1/msvc2022_64/include/QtCore/QLatin1String new file mode 100644 index 0000000000000000000000000000000000000000..7e35f2130e78a83621a4443c2812b0171a11f57b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QLatin1String @@ -0,0 +1 @@ +#include "qlatin1stringview.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QLatin1StringMatcher b/qt/6.8.1/msvc2022_64/include/QtCore/QLatin1StringMatcher new file mode 100644 index 0000000000000000000000000000000000000000..5d1f5be414eef477942aeafa6dbe17fedf81b823 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QLatin1StringMatcher @@ -0,0 +1 @@ +#include "qlatin1stringmatcher.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QLatin1StringView b/qt/6.8.1/msvc2022_64/include/QtCore/QLatin1StringView new file mode 100644 index 0000000000000000000000000000000000000000..7e35f2130e78a83621a4443c2812b0171a11f57b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QLatin1StringView @@ -0,0 +1 @@ +#include "qlatin1stringview.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QLibrary b/qt/6.8.1/msvc2022_64/include/QtCore/QLibrary new file mode 100644 index 0000000000000000000000000000000000000000..6dcb12d652c1703da9558310bc07babc606ef776 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QLibrary @@ -0,0 +1 @@ +#include "qlibrary.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QLibraryInfo b/qt/6.8.1/msvc2022_64/include/QtCore/QLibraryInfo new file mode 100644 index 0000000000000000000000000000000000000000..3b00ff0795ab8e32abadeb8cc0ad4f91511a7549 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QLibraryInfo @@ -0,0 +1 @@ +#include "qlibraryinfo.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QLine b/qt/6.8.1/msvc2022_64/include/QtCore/QLine new file mode 100644 index 0000000000000000000000000000000000000000..27e0e65c1107992ccfd9445c6641519ee00ab1b6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QLine @@ -0,0 +1 @@ +#include "qline.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QLineF b/qt/6.8.1/msvc2022_64/include/QtCore/QLineF new file mode 100644 index 0000000000000000000000000000000000000000..27e0e65c1107992ccfd9445c6641519ee00ab1b6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QLineF @@ -0,0 +1 @@ +#include "qline.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QList b/qt/6.8.1/msvc2022_64/include/QtCore/QList new file mode 100644 index 0000000000000000000000000000000000000000..28dfd0069a06f29d4db9778150072b186603d73c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QList @@ -0,0 +1 @@ +#include "qlist.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QListIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QListIterator new file mode 100644 index 0000000000000000000000000000000000000000..28dfd0069a06f29d4db9778150072b186603d73c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QListIterator @@ -0,0 +1 @@ +#include "qlist.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QListSpecialMethods b/qt/6.8.1/msvc2022_64/include/QtCore/QListSpecialMethods new file mode 100644 index 0000000000000000000000000000000000000000..28dfd0069a06f29d4db9778150072b186603d73c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QListSpecialMethods @@ -0,0 +1 @@ +#include "qlist.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QListSpecialMethodsBase b/qt/6.8.1/msvc2022_64/include/QtCore/QListSpecialMethodsBase new file mode 100644 index 0000000000000000000000000000000000000000..28dfd0069a06f29d4db9778150072b186603d73c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QListSpecialMethodsBase @@ -0,0 +1 @@ +#include "qlist.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QLittleEndianStorageType b/qt/6.8.1/msvc2022_64/include/QtCore/QLittleEndianStorageType new file mode 100644 index 0000000000000000000000000000000000000000..d97b75063d4fc4d14bf125c5e6cfeefc4be1dbf2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QLittleEndianStorageType @@ -0,0 +1 @@ +#include "qendian.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QLocale b/qt/6.8.1/msvc2022_64/include/QtCore/QLocale new file mode 100644 index 0000000000000000000000000000000000000000..19a49fe3e3543afc02743e00f0c771834abb5a84 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QLocale @@ -0,0 +1 @@ +#include "qlocale.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QLocationPermission b/qt/6.8.1/msvc2022_64/include/QtCore/QLocationPermission new file mode 100644 index 0000000000000000000000000000000000000000..ca67e48d2d62a329c7cc5825f66f92b7994f3382 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QLocationPermission @@ -0,0 +1 @@ +#include "qpermissions.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QLockFile b/qt/6.8.1/msvc2022_64/include/QtCore/QLockFile new file mode 100644 index 0000000000000000000000000000000000000000..7261bc4d9822d904f151297344ac94b0733a94e8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QLockFile @@ -0,0 +1 @@ +#include "qlockfile.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QLoggingCategory b/qt/6.8.1/msvc2022_64/include/QtCore/QLoggingCategory new file mode 100644 index 0000000000000000000000000000000000000000..3676a8742c4a122bd141afcb7ea9bbfb83dcaff6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QLoggingCategory @@ -0,0 +1 @@ +#include "qloggingcategory.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMap b/qt/6.8.1/msvc2022_64/include/QtCore/QMap new file mode 100644 index 0000000000000000000000000000000000000000..1406568da2526d3b1ac5194d0f08643448c29113 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMap @@ -0,0 +1 @@ +#include "qmap.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMapData b/qt/6.8.1/msvc2022_64/include/QtCore/QMapData new file mode 100644 index 0000000000000000000000000000000000000000..1406568da2526d3b1ac5194d0f08643448c29113 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMapData @@ -0,0 +1 @@ +#include "qmap.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMapIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QMapIterator new file mode 100644 index 0000000000000000000000000000000000000000..1406568da2526d3b1ac5194d0f08643448c29113 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMapIterator @@ -0,0 +1 @@ +#include "qmap.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMargins b/qt/6.8.1/msvc2022_64/include/QtCore/QMargins new file mode 100644 index 0000000000000000000000000000000000000000..733ecaf66d91cf9b216780f9439b31ac75df2c58 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMargins @@ -0,0 +1 @@ +#include "qmargins.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMarginsF b/qt/6.8.1/msvc2022_64/include/QtCore/QMarginsF new file mode 100644 index 0000000000000000000000000000000000000000..733ecaf66d91cf9b216780f9439b31ac75df2c58 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMarginsF @@ -0,0 +1 @@ +#include "qmargins.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMessageAuthenticationCode b/qt/6.8.1/msvc2022_64/include/QtCore/QMessageAuthenticationCode new file mode 100644 index 0000000000000000000000000000000000000000..6e6dd1f0dd0d714f7f66bb0a5e7e94e94b8aa622 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMessageAuthenticationCode @@ -0,0 +1 @@ +#include "qmessageauthenticationcode.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMessageLogContext b/qt/6.8.1/msvc2022_64/include/QtCore/QMessageLogContext new file mode 100644 index 0000000000000000000000000000000000000000..1839b927f82930640eea3c1db76d6fdc1a14ab08 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMessageLogContext @@ -0,0 +1 @@ +#include "qlogging.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMessageLogger b/qt/6.8.1/msvc2022_64/include/QtCore/QMessageLogger new file mode 100644 index 0000000000000000000000000000000000000000..1839b927f82930640eea3c1db76d6fdc1a14ab08 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMessageLogger @@ -0,0 +1 @@ +#include "qlogging.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMetaAssociation b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaAssociation new file mode 100644 index 0000000000000000000000000000000000000000..b6036afb2b8a6ec775ab2d0bfe7366c92108730d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaAssociation @@ -0,0 +1 @@ +#include "qmetacontainer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMetaClassInfo b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaClassInfo new file mode 100644 index 0000000000000000000000000000000000000000..7aa6d7b578c71f104cd86532da2c337629362ece --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaClassInfo @@ -0,0 +1 @@ +#include "qmetaobject.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMetaContainer b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaContainer new file mode 100644 index 0000000000000000000000000000000000000000..b6036afb2b8a6ec775ab2d0bfe7366c92108730d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaContainer @@ -0,0 +1 @@ +#include "qmetacontainer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMetaEnum b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaEnum new file mode 100644 index 0000000000000000000000000000000000000000..7aa6d7b578c71f104cd86532da2c337629362ece --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaEnum @@ -0,0 +1 @@ +#include "qmetaobject.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMetaMethod b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaMethod new file mode 100644 index 0000000000000000000000000000000000000000..7aa6d7b578c71f104cd86532da2c337629362ece --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaMethod @@ -0,0 +1 @@ +#include "qmetaobject.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMetaMethodArgument b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaMethodArgument new file mode 100644 index 0000000000000000000000000000000000000000..7ab6274b1fe05d6ae81d6ca90fcc1ab61bc516cc --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaMethodArgument @@ -0,0 +1 @@ +#include "qobjectdefs.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMetaMethodReturnArgument b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaMethodReturnArgument new file mode 100644 index 0000000000000000000000000000000000000000..7ab6274b1fe05d6ae81d6ca90fcc1ab61bc516cc --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaMethodReturnArgument @@ -0,0 +1 @@ +#include "qobjectdefs.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMetaObject b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaObject new file mode 100644 index 0000000000000000000000000000000000000000..7ab6274b1fe05d6ae81d6ca90fcc1ab61bc516cc --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaObject @@ -0,0 +1 @@ +#include "qobjectdefs.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMetaProperty b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaProperty new file mode 100644 index 0000000000000000000000000000000000000000..7aa6d7b578c71f104cd86532da2c337629362ece --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaProperty @@ -0,0 +1 @@ +#include "qmetaobject.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMetaSequence b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaSequence new file mode 100644 index 0000000000000000000000000000000000000000..b6036afb2b8a6ec775ab2d0bfe7366c92108730d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaSequence @@ -0,0 +1 @@ +#include "qmetacontainer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMetaType b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaType new file mode 100644 index 0000000000000000000000000000000000000000..c13e56e720d2845cf5da22979b5e8b7e65fa80eb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaType @@ -0,0 +1 @@ +#include "qmetatype.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMetaTypeId b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaTypeId new file mode 100644 index 0000000000000000000000000000000000000000..c13e56e720d2845cf5da22979b5e8b7e65fa80eb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaTypeId @@ -0,0 +1 @@ +#include "qmetatype.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMetaTypeId2 b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaTypeId2 new file mode 100644 index 0000000000000000000000000000000000000000..c13e56e720d2845cf5da22979b5e8b7e65fa80eb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaTypeId2 @@ -0,0 +1 @@ +#include "qmetatype.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMetaTypeIdQObject b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaTypeIdQObject new file mode 100644 index 0000000000000000000000000000000000000000..c13e56e720d2845cf5da22979b5e8b7e65fa80eb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMetaTypeIdQObject @@ -0,0 +1 @@ +#include "qmetatype.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMethodRawArguments b/qt/6.8.1/msvc2022_64/include/QtCore/QMethodRawArguments new file mode 100644 index 0000000000000000000000000000000000000000..7ab6274b1fe05d6ae81d6ca90fcc1ab61bc516cc --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMethodRawArguments @@ -0,0 +1 @@ +#include "qobjectdefs.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMimeData b/qt/6.8.1/msvc2022_64/include/QtCore/QMimeData new file mode 100644 index 0000000000000000000000000000000000000000..20394d58fa0f41a1866d7e1708138eea1b6f8e3e --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMimeData @@ -0,0 +1 @@ +#include "qmimedata.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMimeDatabase b/qt/6.8.1/msvc2022_64/include/QtCore/QMimeDatabase new file mode 100644 index 0000000000000000000000000000000000000000..91314eaf774bc5200e81038ad7985158cfbbcd9a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMimeDatabase @@ -0,0 +1 @@ +#include "qmimedatabase.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMimeType b/qt/6.8.1/msvc2022_64/include/QtCore/QMimeType new file mode 100644 index 0000000000000000000000000000000000000000..5ccbf6b8f705c73408b3d0e9f766ebd8f3d6f579 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMimeType @@ -0,0 +1 @@ +#include "qmimetype.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QModelIndex b/qt/6.8.1/msvc2022_64/include/QtCore/QModelIndex new file mode 100644 index 0000000000000000000000000000000000000000..905b7bbc0d43c8dad89e51f3a9cf4c552b09fc06 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QModelIndex @@ -0,0 +1 @@ +#include "qabstractitemmodel.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QModelIndexList b/qt/6.8.1/msvc2022_64/include/QtCore/QModelIndexList new file mode 100644 index 0000000000000000000000000000000000000000..905b7bbc0d43c8dad89e51f3a9cf4c552b09fc06 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QModelIndexList @@ -0,0 +1 @@ +#include "qabstractitemmodel.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QModelRoleData b/qt/6.8.1/msvc2022_64/include/QtCore/QModelRoleData new file mode 100644 index 0000000000000000000000000000000000000000..905b7bbc0d43c8dad89e51f3a9cf4c552b09fc06 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QModelRoleData @@ -0,0 +1 @@ +#include "qabstractitemmodel.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QModelRoleDataSpan b/qt/6.8.1/msvc2022_64/include/QtCore/QModelRoleDataSpan new file mode 100644 index 0000000000000000000000000000000000000000..905b7bbc0d43c8dad89e51f3a9cf4c552b09fc06 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QModelRoleDataSpan @@ -0,0 +1 @@ +#include "qabstractitemmodel.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMultiHash b/qt/6.8.1/msvc2022_64/include/QtCore/QMultiHash new file mode 100644 index 0000000000000000000000000000000000000000..a71aa974a6bd27eb3df02a5f0111441e94c2a2fb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMultiHash @@ -0,0 +1 @@ +#include "qhash.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMultiHashIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QMultiHashIterator new file mode 100644 index 0000000000000000000000000000000000000000..a71aa974a6bd27eb3df02a5f0111441e94c2a2fb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMultiHashIterator @@ -0,0 +1 @@ +#include "qhash.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMultiMap b/qt/6.8.1/msvc2022_64/include/QtCore/QMultiMap new file mode 100644 index 0000000000000000000000000000000000000000..1406568da2526d3b1ac5194d0f08643448c29113 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMultiMap @@ -0,0 +1 @@ +#include "qmap.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMultiMapIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QMultiMapIterator new file mode 100644 index 0000000000000000000000000000000000000000..1406568da2526d3b1ac5194d0f08643448c29113 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMultiMapIterator @@ -0,0 +1 @@ +#include "qmap.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMutableByteArrayListIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QMutableByteArrayListIterator new file mode 100644 index 0000000000000000000000000000000000000000..d2683b9ca817133beead41477acbb67fee607a05 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMutableByteArrayListIterator @@ -0,0 +1 @@ +#include "qbytearraylist.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMutableFutureIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QMutableFutureIterator new file mode 100644 index 0000000000000000000000000000000000000000..f1675124608e114316cabf2c6d57c58c2fcb497b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMutableFutureIterator @@ -0,0 +1 @@ +#include "qfuture.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMutableHashIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QMutableHashIterator new file mode 100644 index 0000000000000000000000000000000000000000..a71aa974a6bd27eb3df02a5f0111441e94c2a2fb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMutableHashIterator @@ -0,0 +1 @@ +#include "qhash.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMutableListIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QMutableListIterator new file mode 100644 index 0000000000000000000000000000000000000000..28dfd0069a06f29d4db9778150072b186603d73c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMutableListIterator @@ -0,0 +1 @@ +#include "qlist.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMutableMapIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QMutableMapIterator new file mode 100644 index 0000000000000000000000000000000000000000..1406568da2526d3b1ac5194d0f08643448c29113 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMutableMapIterator @@ -0,0 +1 @@ +#include "qmap.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMutableMultiHashIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QMutableMultiHashIterator new file mode 100644 index 0000000000000000000000000000000000000000..a71aa974a6bd27eb3df02a5f0111441e94c2a2fb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMutableMultiHashIterator @@ -0,0 +1 @@ +#include "qhash.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMutableMultiMapIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QMutableMultiMapIterator new file mode 100644 index 0000000000000000000000000000000000000000..1406568da2526d3b1ac5194d0f08643448c29113 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMutableMultiMapIterator @@ -0,0 +1 @@ +#include "qmap.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMutableSetIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QMutableSetIterator new file mode 100644 index 0000000000000000000000000000000000000000..949f35a02eae8ded36348dcc6c830e6d227a9c21 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMutableSetIterator @@ -0,0 +1 @@ +#include "qset.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMutableVectorIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QMutableVectorIterator new file mode 100644 index 0000000000000000000000000000000000000000..b6230370a1dcc790ae19172139e23d10e35f7c82 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMutableVectorIterator @@ -0,0 +1 @@ +#include "qvector.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMutex b/qt/6.8.1/msvc2022_64/include/QtCore/QMutex new file mode 100644 index 0000000000000000000000000000000000000000..f4efe9420df458f9e0ea0b9b1ee1ed57a7286028 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMutex @@ -0,0 +1 @@ +#include "qmutex.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QMutexLocker b/qt/6.8.1/msvc2022_64/include/QtCore/QMutexLocker new file mode 100644 index 0000000000000000000000000000000000000000..f4efe9420df458f9e0ea0b9b1ee1ed57a7286028 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QMutexLocker @@ -0,0 +1 @@ +#include "qmutex.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QNativeIpcKey b/qt/6.8.1/msvc2022_64/include/QtCore/QNativeIpcKey new file mode 100644 index 0000000000000000000000000000000000000000..88ec1e00c2066d99a402589f6d46891f07cdfd72 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QNativeIpcKey @@ -0,0 +1 @@ +#include "qtipccommon.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QNoDebug b/qt/6.8.1/msvc2022_64/include/QtCore/QNoDebug new file mode 100644 index 0000000000000000000000000000000000000000..787e69549068b8daca4aac6ba73d98139bf901d0 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QNoDebug @@ -0,0 +1 @@ +#include "qdebug.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QNonConstOverload b/qt/6.8.1/msvc2022_64/include/QtCore/QNonConstOverload new file mode 100644 index 0000000000000000000000000000000000000000..be914e16061e028090c1bf834e355c1b45abf0ba --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QNonConstOverload @@ -0,0 +1 @@ +#include "qoverload.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QNtfsPermissionCheckGuard b/qt/6.8.1/msvc2022_64/include/QtCore/QNtfsPermissionCheckGuard new file mode 100644 index 0000000000000000000000000000000000000000..2bc9e133aace513e5b25f40dc56188fccf44ee0e --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QNtfsPermissionCheckGuard @@ -0,0 +1 @@ +#include "qfile.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QObject b/qt/6.8.1/msvc2022_64/include/QtCore/QObject new file mode 100644 index 0000000000000000000000000000000000000000..e073c9cc3fc366d43df1a79811780b62225dabc4 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QObject @@ -0,0 +1 @@ +#include "qobject.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QObjectBindableProperty b/qt/6.8.1/msvc2022_64/include/QtCore/QObjectBindableProperty new file mode 100644 index 0000000000000000000000000000000000000000..4cdcd92eb3cd04e9ba02bc1c5e4afdb4ff5925d8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QObjectBindableProperty @@ -0,0 +1 @@ +#include "qproperty.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QObjectCleanupHandler b/qt/6.8.1/msvc2022_64/include/QtCore/QObjectCleanupHandler new file mode 100644 index 0000000000000000000000000000000000000000..a953b9404654b1560325920190cd15fc15e6a00c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QObjectCleanupHandler @@ -0,0 +1 @@ +#include "qobjectcleanuphandler.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QObjectComputedProperty b/qt/6.8.1/msvc2022_64/include/QtCore/QObjectComputedProperty new file mode 100644 index 0000000000000000000000000000000000000000..4cdcd92eb3cd04e9ba02bc1c5e4afdb4ff5925d8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QObjectComputedProperty @@ -0,0 +1 @@ +#include "qproperty.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QObjectData b/qt/6.8.1/msvc2022_64/include/QtCore/QObjectData new file mode 100644 index 0000000000000000000000000000000000000000..e073c9cc3fc366d43df1a79811780b62225dabc4 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QObjectData @@ -0,0 +1 @@ +#include "qobject.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QObjectList b/qt/6.8.1/msvc2022_64/include/QtCore/QObjectList new file mode 100644 index 0000000000000000000000000000000000000000..e073c9cc3fc366d43df1a79811780b62225dabc4 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QObjectList @@ -0,0 +1 @@ +#include "qobject.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QOperatingSystemVersion b/qt/6.8.1/msvc2022_64/include/QtCore/QOperatingSystemVersion new file mode 100644 index 0000000000000000000000000000000000000000..1d5d854072320670e0c3edbc796f5ac6e3cb1c1c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QOperatingSystemVersion @@ -0,0 +1 @@ +#include "qoperatingsystemversion.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QOperatingSystemVersionBase b/qt/6.8.1/msvc2022_64/include/QtCore/QOperatingSystemVersionBase new file mode 100644 index 0000000000000000000000000000000000000000..1d5d854072320670e0c3edbc796f5ac6e3cb1c1c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QOperatingSystemVersionBase @@ -0,0 +1 @@ +#include "qoperatingsystemversion.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QOperatingSystemVersionUnexported b/qt/6.8.1/msvc2022_64/include/QtCore/QOperatingSystemVersionUnexported new file mode 100644 index 0000000000000000000000000000000000000000..1d5d854072320670e0c3edbc796f5ac6e3cb1c1c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QOperatingSystemVersionUnexported @@ -0,0 +1 @@ +#include "qoperatingsystemversion.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QOverload b/qt/6.8.1/msvc2022_64/include/QtCore/QOverload new file mode 100644 index 0000000000000000000000000000000000000000..be914e16061e028090c1bf834e355c1b45abf0ba --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QOverload @@ -0,0 +1 @@ +#include "qoverload.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPair b/qt/6.8.1/msvc2022_64/include/QtCore/QPair new file mode 100644 index 0000000000000000000000000000000000000000..cdf68969b0cf084d07259300995f53c250ca9604 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPair @@ -0,0 +1 @@ +#include "qpair.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QParallelAnimationGroup b/qt/6.8.1/msvc2022_64/include/QtCore/QParallelAnimationGroup new file mode 100644 index 0000000000000000000000000000000000000000..14b5a612b2cc31c76b84a94ee134812b414d3366 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QParallelAnimationGroup @@ -0,0 +1 @@ +#include "qparallelanimationgroup.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPartialOrdering b/qt/6.8.1/msvc2022_64/include/QtCore/QPartialOrdering new file mode 100644 index 0000000000000000000000000000000000000000..3f3343ff4247500d4d3a2e0016efdeebf1c16e8a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPartialOrdering @@ -0,0 +1 @@ +#include "qcompare.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPauseAnimation b/qt/6.8.1/msvc2022_64/include/QtCore/QPauseAnimation new file mode 100644 index 0000000000000000000000000000000000000000..2979afeade1ad329e24a4e8aa44286b4cd253261 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPauseAnimation @@ -0,0 +1 @@ +#include "qpauseanimation.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPermission b/qt/6.8.1/msvc2022_64/include/QtCore/QPermission new file mode 100644 index 0000000000000000000000000000000000000000..ca67e48d2d62a329c7cc5825f66f92b7994f3382 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPermission @@ -0,0 +1 @@ +#include "qpermissions.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPermissions b/qt/6.8.1/msvc2022_64/include/QtCore/QPermissions new file mode 100644 index 0000000000000000000000000000000000000000..ca67e48d2d62a329c7cc5825f66f92b7994f3382 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPermissions @@ -0,0 +1 @@ +#include "qpermissions.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPersistentModelIndex b/qt/6.8.1/msvc2022_64/include/QtCore/QPersistentModelIndex new file mode 100644 index 0000000000000000000000000000000000000000..905b7bbc0d43c8dad89e51f3a9cf4c552b09fc06 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPersistentModelIndex @@ -0,0 +1 @@ +#include "qabstractitemmodel.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPluginLoader b/qt/6.8.1/msvc2022_64/include/QtCore/QPluginLoader new file mode 100644 index 0000000000000000000000000000000000000000..6e2832ad484035952767bb36e46caa3f868ccaad --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPluginLoader @@ -0,0 +1 @@ +#include "qpluginloader.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPluginMetaData b/qt/6.8.1/msvc2022_64/include/QtCore/QPluginMetaData new file mode 100644 index 0000000000000000000000000000000000000000..0ae7d826de35314816fae5a999433ee302c2980b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPluginMetaData @@ -0,0 +1 @@ +#include "qplugin.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPluginMetaDataV2 b/qt/6.8.1/msvc2022_64/include/QtCore/QPluginMetaDataV2 new file mode 100644 index 0000000000000000000000000000000000000000..0ae7d826de35314816fae5a999433ee302c2980b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPluginMetaDataV2 @@ -0,0 +1 @@ +#include "qplugin.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPoint b/qt/6.8.1/msvc2022_64/include/QtCore/QPoint new file mode 100644 index 0000000000000000000000000000000000000000..6934183d8e87c18c1459aeaca65e2b4e24e68766 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPoint @@ -0,0 +1 @@ +#include "qpoint.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPointF b/qt/6.8.1/msvc2022_64/include/QtCore/QPointF new file mode 100644 index 0000000000000000000000000000000000000000..6934183d8e87c18c1459aeaca65e2b4e24e68766 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPointF @@ -0,0 +1 @@ +#include "qpoint.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPointer b/qt/6.8.1/msvc2022_64/include/QtCore/QPointer new file mode 100644 index 0000000000000000000000000000000000000000..b823200eff1db8f405d9faa7378d675ad5dd6653 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPointer @@ -0,0 +1 @@ +#include "qpointer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QProcess b/qt/6.8.1/msvc2022_64/include/QtCore/QProcess new file mode 100644 index 0000000000000000000000000000000000000000..a6624baaf22ab5eaf8d8e51b128ea0dca95c2099 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QProcess @@ -0,0 +1 @@ +#include "qprocess.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QProcessEnvironment b/qt/6.8.1/msvc2022_64/include/QtCore/QProcessEnvironment new file mode 100644 index 0000000000000000000000000000000000000000..a6624baaf22ab5eaf8d8e51b128ea0dca95c2099 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QProcessEnvironment @@ -0,0 +1 @@ +#include "qprocess.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPromise b/qt/6.8.1/msvc2022_64/include/QtCore/QPromise new file mode 100644 index 0000000000000000000000000000000000000000..58810d580672090ae86ff9780265c18654b4a80c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPromise @@ -0,0 +1 @@ +#include "qpromise.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QProperty b/qt/6.8.1/msvc2022_64/include/QtCore/QProperty new file mode 100644 index 0000000000000000000000000000000000000000..4cdcd92eb3cd04e9ba02bc1c5e4afdb4ff5925d8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QProperty @@ -0,0 +1 @@ +#include "qproperty.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyAnimation b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyAnimation new file mode 100644 index 0000000000000000000000000000000000000000..82335925efb5d3ffd4e0fd46df40c6ff637c6e36 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyAnimation @@ -0,0 +1 @@ +#include "qpropertyanimation.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyBinding b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyBinding new file mode 100644 index 0000000000000000000000000000000000000000..4cdcd92eb3cd04e9ba02bc1c5e4afdb4ff5925d8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyBinding @@ -0,0 +1 @@ +#include "qproperty.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyBindingError b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyBindingError new file mode 100644 index 0000000000000000000000000000000000000000..4cdcd92eb3cd04e9ba02bc1c5e4afdb4ff5925d8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyBindingError @@ -0,0 +1 @@ +#include "qproperty.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyBindingPrivatePtr b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyBindingPrivatePtr new file mode 100644 index 0000000000000000000000000000000000000000..d8265e6d9b156a072aec12e22b9927b92226360b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyBindingPrivatePtr @@ -0,0 +1 @@ +#include "qpropertyprivate.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyBindingSourceLocation b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyBindingSourceLocation new file mode 100644 index 0000000000000000000000000000000000000000..4cdcd92eb3cd04e9ba02bc1c5e4afdb4ff5925d8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyBindingSourceLocation @@ -0,0 +1 @@ +#include "qproperty.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyChangeHandler b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyChangeHandler new file mode 100644 index 0000000000000000000000000000000000000000..4cdcd92eb3cd04e9ba02bc1c5e4afdb4ff5925d8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyChangeHandler @@ -0,0 +1 @@ +#include "qproperty.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyData b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyData new file mode 100644 index 0000000000000000000000000000000000000000..4cdcd92eb3cd04e9ba02bc1c5e4afdb4ff5925d8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyData @@ -0,0 +1 @@ +#include "qproperty.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyNotifier b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyNotifier new file mode 100644 index 0000000000000000000000000000000000000000..4cdcd92eb3cd04e9ba02bc1c5e4afdb4ff5925d8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyNotifier @@ -0,0 +1 @@ +#include "qproperty.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyObserver b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyObserver new file mode 100644 index 0000000000000000000000000000000000000000..4cdcd92eb3cd04e9ba02bc1c5e4afdb4ff5925d8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyObserver @@ -0,0 +1 @@ +#include "qproperty.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyObserverBase b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyObserverBase new file mode 100644 index 0000000000000000000000000000000000000000..4cdcd92eb3cd04e9ba02bc1c5e4afdb4ff5925d8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyObserverBase @@ -0,0 +1 @@ +#include "qproperty.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyProxyBindingData b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyProxyBindingData new file mode 100644 index 0000000000000000000000000000000000000000..d8265e6d9b156a072aec12e22b9927b92226360b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QPropertyProxyBindingData @@ -0,0 +1 @@ +#include "qpropertyprivate.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QQueue b/qt/6.8.1/msvc2022_64/include/QtCore/QQueue new file mode 100644 index 0000000000000000000000000000000000000000..ed5c05f434b6044a7017fd7b86fc6ada196d785f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QQueue @@ -0,0 +1 @@ +#include "qqueue.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QRandomGenerator b/qt/6.8.1/msvc2022_64/include/QtCore/QRandomGenerator new file mode 100644 index 0000000000000000000000000000000000000000..b317103232dd7595a60401bc03d0ac1837bfa26a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QRandomGenerator @@ -0,0 +1 @@ +#include "qrandom.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QRandomGenerator64 b/qt/6.8.1/msvc2022_64/include/QtCore/QRandomGenerator64 new file mode 100644 index 0000000000000000000000000000000000000000..b317103232dd7595a60401bc03d0ac1837bfa26a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QRandomGenerator64 @@ -0,0 +1 @@ +#include "qrandom.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QReadLocker b/qt/6.8.1/msvc2022_64/include/QtCore/QReadLocker new file mode 100644 index 0000000000000000000000000000000000000000..56bc3b6fd869848dbb692858e5f28cb49a612fb2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QReadLocker @@ -0,0 +1 @@ +#include "qreadwritelock.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QReadWriteLock b/qt/6.8.1/msvc2022_64/include/QtCore/QReadWriteLock new file mode 100644 index 0000000000000000000000000000000000000000..56bc3b6fd869848dbb692858e5f28cb49a612fb2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QReadWriteLock @@ -0,0 +1 @@ +#include "qreadwritelock.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QRect b/qt/6.8.1/msvc2022_64/include/QtCore/QRect new file mode 100644 index 0000000000000000000000000000000000000000..613617ac107ea15b82ea2bf9ea8a2f90e25816c9 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QRect @@ -0,0 +1 @@ +#include "qrect.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QRectF b/qt/6.8.1/msvc2022_64/include/QtCore/QRectF new file mode 100644 index 0000000000000000000000000000000000000000..613617ac107ea15b82ea2bf9ea8a2f90e25816c9 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QRectF @@ -0,0 +1 @@ +#include "qrect.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QRecursiveMutex b/qt/6.8.1/msvc2022_64/include/QtCore/QRecursiveMutex new file mode 100644 index 0000000000000000000000000000000000000000..f4efe9420df458f9e0ea0b9b1ee1ed57a7286028 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QRecursiveMutex @@ -0,0 +1 @@ +#include "qmutex.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QRegularExpression b/qt/6.8.1/msvc2022_64/include/QtCore/QRegularExpression new file mode 100644 index 0000000000000000000000000000000000000000..ba9ed5dc801ddd0a8dd65e3af1bd0a0ed144e007 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QRegularExpression @@ -0,0 +1 @@ +#include "qregularexpression.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QRegularExpressionMatch b/qt/6.8.1/msvc2022_64/include/QtCore/QRegularExpressionMatch new file mode 100644 index 0000000000000000000000000000000000000000..ba9ed5dc801ddd0a8dd65e3af1bd0a0ed144e007 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QRegularExpressionMatch @@ -0,0 +1 @@ +#include "qregularexpression.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QRegularExpressionMatchIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QRegularExpressionMatchIterator new file mode 100644 index 0000000000000000000000000000000000000000..ba9ed5dc801ddd0a8dd65e3af1bd0a0ed144e007 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QRegularExpressionMatchIterator @@ -0,0 +1 @@ +#include "qregularexpression.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QResource b/qt/6.8.1/msvc2022_64/include/QtCore/QResource new file mode 100644 index 0000000000000000000000000000000000000000..9572d5699371eba8cded3a76ee9eedc2746909af --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QResource @@ -0,0 +1 @@ +#include "qresource.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QReturnArgument b/qt/6.8.1/msvc2022_64/include/QtCore/QReturnArgument new file mode 100644 index 0000000000000000000000000000000000000000..7ab6274b1fe05d6ae81d6ca90fcc1ab61bc516cc --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QReturnArgument @@ -0,0 +1 @@ +#include "qobjectdefs.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QRunnable b/qt/6.8.1/msvc2022_64/include/QtCore/QRunnable new file mode 100644 index 0000000000000000000000000000000000000000..47ef409d5b9590f3d3892857df2d54b3a45c36f6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QRunnable @@ -0,0 +1 @@ +#include "qrunnable.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSaveFile b/qt/6.8.1/msvc2022_64/include/QtCore/QSaveFile new file mode 100644 index 0000000000000000000000000000000000000000..b98247aab16c76a33a2eff964c4f2e9a9b24a800 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSaveFile @@ -0,0 +1 @@ +#include "qsavefile.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QScopeGuard b/qt/6.8.1/msvc2022_64/include/QtCore/QScopeGuard new file mode 100644 index 0000000000000000000000000000000000000000..be5ef6bb04a357c6df65cd6528b780d570fd04e6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QScopeGuard @@ -0,0 +1 @@ +#include "qscopeguard.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QScopedArrayPointer b/qt/6.8.1/msvc2022_64/include/QtCore/QScopedArrayPointer new file mode 100644 index 0000000000000000000000000000000000000000..ce2995386603f094836b52e4bc2b3d1e65160b57 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QScopedArrayPointer @@ -0,0 +1 @@ +#include "qscopedpointer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPointer b/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPointer new file mode 100644 index 0000000000000000000000000000000000000000..ce2995386603f094836b52e4bc2b3d1e65160b57 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPointer @@ -0,0 +1 @@ +#include "qscopedpointer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPointerArrayDeleter b/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPointerArrayDeleter new file mode 100644 index 0000000000000000000000000000000000000000..ce2995386603f094836b52e4bc2b3d1e65160b57 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPointerArrayDeleter @@ -0,0 +1 @@ +#include "qscopedpointer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPointerDeleteLater b/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPointerDeleteLater new file mode 100644 index 0000000000000000000000000000000000000000..ce2995386603f094836b52e4bc2b3d1e65160b57 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPointerDeleteLater @@ -0,0 +1 @@ +#include "qscopedpointer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPointerDeleter b/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPointerDeleter new file mode 100644 index 0000000000000000000000000000000000000000..ce2995386603f094836b52e4bc2b3d1e65160b57 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPointerDeleter @@ -0,0 +1 @@ +#include "qscopedpointer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPointerObjectDeleteLater b/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPointerObjectDeleteLater new file mode 100644 index 0000000000000000000000000000000000000000..ce2995386603f094836b52e4bc2b3d1e65160b57 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPointerObjectDeleteLater @@ -0,0 +1 @@ +#include "qscopedpointer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPointerPodDeleter b/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPointerPodDeleter new file mode 100644 index 0000000000000000000000000000000000000000..ce2995386603f094836b52e4bc2b3d1e65160b57 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPointerPodDeleter @@ -0,0 +1 @@ +#include "qscopedpointer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPropertyUpdateGroup b/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPropertyUpdateGroup new file mode 100644 index 0000000000000000000000000000000000000000..4cdcd92eb3cd04e9ba02bc1c5e4afdb4ff5925d8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QScopedPropertyUpdateGroup @@ -0,0 +1 @@ +#include "qproperty.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QScopedValueRollback b/qt/6.8.1/msvc2022_64/include/QtCore/QScopedValueRollback new file mode 100644 index 0000000000000000000000000000000000000000..16b74256b094fd6f0333994867a20c11f0379716 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QScopedValueRollback @@ -0,0 +1 @@ +#include "qscopedvaluerollback.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSemaphore b/qt/6.8.1/msvc2022_64/include/QtCore/QSemaphore new file mode 100644 index 0000000000000000000000000000000000000000..9123251f8127815252faebd5242cf5326d444593 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSemaphore @@ -0,0 +1 @@ +#include "qsemaphore.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSemaphoreReleaser b/qt/6.8.1/msvc2022_64/include/QtCore/QSemaphoreReleaser new file mode 100644 index 0000000000000000000000000000000000000000..9123251f8127815252faebd5242cf5326d444593 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSemaphoreReleaser @@ -0,0 +1 @@ +#include "qsemaphore.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSequentialAnimationGroup b/qt/6.8.1/msvc2022_64/include/QtCore/QSequentialAnimationGroup new file mode 100644 index 0000000000000000000000000000000000000000..d8a74445d6c6490ca336adcf6ec128caeb92fa2d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSequentialAnimationGroup @@ -0,0 +1 @@ +#include "qsequentialanimationgroup.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSequentialConstIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QSequentialConstIterator new file mode 100644 index 0000000000000000000000000000000000000000..c44e5453e37dc05306bd2d71f61664cdd01c6b58 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSequentialConstIterator @@ -0,0 +1 @@ +#include "qsequentialiterable.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSequentialIterable b/qt/6.8.1/msvc2022_64/include/QtCore/QSequentialIterable new file mode 100644 index 0000000000000000000000000000000000000000..c44e5453e37dc05306bd2d71f61664cdd01c6b58 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSequentialIterable @@ -0,0 +1 @@ +#include "qsequentialiterable.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSequentialIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QSequentialIterator new file mode 100644 index 0000000000000000000000000000000000000000..c44e5453e37dc05306bd2d71f61664cdd01c6b58 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSequentialIterator @@ -0,0 +1 @@ +#include "qsequentialiterable.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSet b/qt/6.8.1/msvc2022_64/include/QtCore/QSet new file mode 100644 index 0000000000000000000000000000000000000000..949f35a02eae8ded36348dcc6c830e6d227a9c21 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSet @@ -0,0 +1 @@ +#include "qset.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSetIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QSetIterator new file mode 100644 index 0000000000000000000000000000000000000000..949f35a02eae8ded36348dcc6c830e6d227a9c21 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSetIterator @@ -0,0 +1 @@ +#include "qset.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSettings b/qt/6.8.1/msvc2022_64/include/QtCore/QSettings new file mode 100644 index 0000000000000000000000000000000000000000..d55df23c3ff564e891377a5d1f7762215a6278e4 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSettings @@ -0,0 +1 @@ +#include "qsettings.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSharedData b/qt/6.8.1/msvc2022_64/include/QtCore/QSharedData new file mode 100644 index 0000000000000000000000000000000000000000..317e02ff53457d6138d4ccf173608d1a43867421 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSharedData @@ -0,0 +1 @@ +#include "qshareddata.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSharedDataPointer b/qt/6.8.1/msvc2022_64/include/QtCore/QSharedDataPointer new file mode 100644 index 0000000000000000000000000000000000000000..317e02ff53457d6138d4ccf173608d1a43867421 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSharedDataPointer @@ -0,0 +1 @@ +#include "qshareddata.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSharedMemory b/qt/6.8.1/msvc2022_64/include/QtCore/QSharedMemory new file mode 100644 index 0000000000000000000000000000000000000000..da21b3ed06a2653ad84eb53633666dd0ee34708d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSharedMemory @@ -0,0 +1 @@ +#include "qsharedmemory.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSharedPointer b/qt/6.8.1/msvc2022_64/include/QtCore/QSharedPointer new file mode 100644 index 0000000000000000000000000000000000000000..f9aa7ebf9ddcc62231a62c5b7a02454f5cc2c0a2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSharedPointer @@ -0,0 +1 @@ +#include "qsharedpointer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSignalBlocker b/qt/6.8.1/msvc2022_64/include/QtCore/QSignalBlocker new file mode 100644 index 0000000000000000000000000000000000000000..e073c9cc3fc366d43df1a79811780b62225dabc4 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSignalBlocker @@ -0,0 +1 @@ +#include "qobject.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSignalMapper b/qt/6.8.1/msvc2022_64/include/QtCore/QSignalMapper new file mode 100644 index 0000000000000000000000000000000000000000..4034bbeec07191e7f84f9441d7d136ba30617a6d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSignalMapper @@ -0,0 +1 @@ +#include "qsignalmapper.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSize b/qt/6.8.1/msvc2022_64/include/QtCore/QSize new file mode 100644 index 0000000000000000000000000000000000000000..41d3d9969dcbc144783dc000b2ad9f6eeb5651eb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSize @@ -0,0 +1 @@ +#include "qsize.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSizeF b/qt/6.8.1/msvc2022_64/include/QtCore/QSizeF new file mode 100644 index 0000000000000000000000000000000000000000..41d3d9969dcbc144783dc000b2ad9f6eeb5651eb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSizeF @@ -0,0 +1 @@ +#include "qsize.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSocketDescriptor b/qt/6.8.1/msvc2022_64/include/QtCore/QSocketDescriptor new file mode 100644 index 0000000000000000000000000000000000000000..43388a28a4f1c036fc625f29162b6de6716aa29d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSocketDescriptor @@ -0,0 +1 @@ +#include "qsocketnotifier.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSocketNotifier b/qt/6.8.1/msvc2022_64/include/QtCore/QSocketNotifier new file mode 100644 index 0000000000000000000000000000000000000000..43388a28a4f1c036fc625f29162b6de6716aa29d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSocketNotifier @@ -0,0 +1 @@ +#include "qsocketnotifier.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSortFilterProxyModel b/qt/6.8.1/msvc2022_64/include/QtCore/QSortFilterProxyModel new file mode 100644 index 0000000000000000000000000000000000000000..5a080f0b523ddced792749ba441e274ea5f54554 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSortFilterProxyModel @@ -0,0 +1 @@ +#include "qsortfilterproxymodel.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSpan b/qt/6.8.1/msvc2022_64/include/QtCore/QSpan new file mode 100644 index 0000000000000000000000000000000000000000..fb66455c39095d51164a2a0ac3573f4aff98295f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSpan @@ -0,0 +1 @@ +#include "qspan.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSpecialInteger b/qt/6.8.1/msvc2022_64/include/QtCore/QSpecialInteger new file mode 100644 index 0000000000000000000000000000000000000000..d97b75063d4fc4d14bf125c5e6cfeefc4be1dbf2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSpecialInteger @@ -0,0 +1 @@ +#include "qendian.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStack b/qt/6.8.1/msvc2022_64/include/QtCore/QStack new file mode 100644 index 0000000000000000000000000000000000000000..4c5ec449646edab4f6f5a97a4d084a5d2a0dd02d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStack @@ -0,0 +1 @@ +#include "qstack.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStandardPaths b/qt/6.8.1/msvc2022_64/include/QtCore/QStandardPaths new file mode 100644 index 0000000000000000000000000000000000000000..d6c8c32f16eda8bb7e45d4dd2411426cb240741e --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStandardPaths @@ -0,0 +1 @@ +#include "qstandardpaths.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStaticByteArrayMatcher b/qt/6.8.1/msvc2022_64/include/QtCore/QStaticByteArrayMatcher new file mode 100644 index 0000000000000000000000000000000000000000..f0c84e230ec0d207ed29255d7456eed2625bbfb6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStaticByteArrayMatcher @@ -0,0 +1 @@ +#include "qbytearraymatcher.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStaticByteArrayMatcherBase b/qt/6.8.1/msvc2022_64/include/QtCore/QStaticByteArrayMatcherBase new file mode 100644 index 0000000000000000000000000000000000000000..f0c84e230ec0d207ed29255d7456eed2625bbfb6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStaticByteArrayMatcherBase @@ -0,0 +1 @@ +#include "qbytearraymatcher.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStaticLatin1StringMatcher b/qt/6.8.1/msvc2022_64/include/QtCore/QStaticLatin1StringMatcher new file mode 100644 index 0000000000000000000000000000000000000000..235ee88eb02870c304d0a6ef692314f570792d66 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStaticLatin1StringMatcher @@ -0,0 +1 @@ +#include "qstaticlatin1stringmatcher.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStaticPlugin b/qt/6.8.1/msvc2022_64/include/QtCore/QStaticPlugin new file mode 100644 index 0000000000000000000000000000000000000000..0ae7d826de35314816fae5a999433ee302c2980b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStaticPlugin @@ -0,0 +1 @@ +#include "qplugin.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStorageInfo b/qt/6.8.1/msvc2022_64/include/QtCore/QStorageInfo new file mode 100644 index 0000000000000000000000000000000000000000..970cb98903bea32303d8e15a870fca58c748efcf --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStorageInfo @@ -0,0 +1 @@ +#include "qstorageinfo.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QString b/qt/6.8.1/msvc2022_64/include/QtCore/QString new file mode 100644 index 0000000000000000000000000000000000000000..418f914fa1d02aed550090b49c1160648f3be6b3 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QString @@ -0,0 +1 @@ +#include "qstring.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStringAlgorithms b/qt/6.8.1/msvc2022_64/include/QtCore/QStringAlgorithms new file mode 100644 index 0000000000000000000000000000000000000000..7bf791cedef5110b18c606e1dcf1711e3dc386dc --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStringAlgorithms @@ -0,0 +1 @@ +#include "qstringalgorithms.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStringBuilder b/qt/6.8.1/msvc2022_64/include/QtCore/QStringBuilder new file mode 100644 index 0000000000000000000000000000000000000000..2ee01be859717603eece1260dfc1517de0889eed --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStringBuilder @@ -0,0 +1 @@ +#include "qstringbuilder.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStringConverter b/qt/6.8.1/msvc2022_64/include/QtCore/QStringConverter new file mode 100644 index 0000000000000000000000000000000000000000..8a8a0846701c273d1202a02be000dbd4da99d7ed --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStringConverter @@ -0,0 +1 @@ +#include "qstringconverter.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStringConverterBase b/qt/6.8.1/msvc2022_64/include/QtCore/QStringConverterBase new file mode 100644 index 0000000000000000000000000000000000000000..8a8a0846701c273d1202a02be000dbd4da99d7ed --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStringConverterBase @@ -0,0 +1 @@ +#include "qstringconverter.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStringDecoder b/qt/6.8.1/msvc2022_64/include/QtCore/QStringDecoder new file mode 100644 index 0000000000000000000000000000000000000000..8a8a0846701c273d1202a02be000dbd4da99d7ed --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStringDecoder @@ -0,0 +1 @@ +#include "qstringconverter.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStringEncoder b/qt/6.8.1/msvc2022_64/include/QtCore/QStringEncoder new file mode 100644 index 0000000000000000000000000000000000000000..8a8a0846701c273d1202a02be000dbd4da99d7ed --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStringEncoder @@ -0,0 +1 @@ +#include "qstringconverter.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStringList b/qt/6.8.1/msvc2022_64/include/QtCore/QStringList new file mode 100644 index 0000000000000000000000000000000000000000..ce1d3357e3892e2c2917104d7afd924ab5ed57f1 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStringList @@ -0,0 +1 @@ +#include "qstringlist.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStringListModel b/qt/6.8.1/msvc2022_64/include/QtCore/QStringListModel new file mode 100644 index 0000000000000000000000000000000000000000..e701db221933a2a035176e3072e13d2ad144d2f9 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStringListModel @@ -0,0 +1 @@ +#include "qstringlistmodel.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStringLiteral b/qt/6.8.1/msvc2022_64/include/QtCore/QStringLiteral new file mode 100644 index 0000000000000000000000000000000000000000..0d15537564ea90613eb4249ae5a697bc078f9b6a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStringLiteral @@ -0,0 +1 @@ +#include "qstringliteral.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStringMatcher b/qt/6.8.1/msvc2022_64/include/QtCore/QStringMatcher new file mode 100644 index 0000000000000000000000000000000000000000..2f2ada02ebf85818875198bbae4b86c13a4291b5 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStringMatcher @@ -0,0 +1 @@ +#include "qstringmatcher.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStringTokenizer b/qt/6.8.1/msvc2022_64/include/QtCore/QStringTokenizer new file mode 100644 index 0000000000000000000000000000000000000000..052f23c42edb411e7d9d85564bf6525adf9d0da8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStringTokenizer @@ -0,0 +1 @@ +#include "qstringtokenizer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStringTokenizerBase b/qt/6.8.1/msvc2022_64/include/QtCore/QStringTokenizerBase new file mode 100644 index 0000000000000000000000000000000000000000..052f23c42edb411e7d9d85564bf6525adf9d0da8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStringTokenizerBase @@ -0,0 +1 @@ +#include "qstringtokenizer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStringTokenizerBaseBase b/qt/6.8.1/msvc2022_64/include/QtCore/QStringTokenizerBaseBase new file mode 100644 index 0000000000000000000000000000000000000000..052f23c42edb411e7d9d85564bf6525adf9d0da8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStringTokenizerBaseBase @@ -0,0 +1 @@ +#include "qstringtokenizer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QStringView b/qt/6.8.1/msvc2022_64/include/QtCore/QStringView new file mode 100644 index 0000000000000000000000000000000000000000..550c1ff91d75ef66984fb8eb8bf01b05974a709a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QStringView @@ -0,0 +1 @@ +#include "qstringview.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSysInfo b/qt/6.8.1/msvc2022_64/include/QtCore/QSysInfo new file mode 100644 index 0000000000000000000000000000000000000000..3c4bd69956a268fd0dbe55a233edb453ba527192 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSysInfo @@ -0,0 +1 @@ +#include "qsysinfo.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QSystemSemaphore b/qt/6.8.1/msvc2022_64/include/QtCore/QSystemSemaphore new file mode 100644 index 0000000000000000000000000000000000000000..2332f0afdfd453eec174c942fed40955ac37607f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QSystemSemaphore @@ -0,0 +1 @@ +#include "qsystemsemaphore.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QTaggedIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QTaggedIterator new file mode 100644 index 0000000000000000000000000000000000000000..2f6a0dec463c0239f5c82c9f9037d870a20088c1 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QTaggedIterator @@ -0,0 +1 @@ +#include "qiterable.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QTaggedPointer b/qt/6.8.1/msvc2022_64/include/QtCore/QTaggedPointer new file mode 100644 index 0000000000000000000000000000000000000000..d84809ffa86d2de9e540f4e8c1ff5f7ab9d6f932 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QTaggedPointer @@ -0,0 +1 @@ +#include "qtaggedpointer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QTemplatedMetaMethodReturnArgument b/qt/6.8.1/msvc2022_64/include/QtCore/QTemplatedMetaMethodReturnArgument new file mode 100644 index 0000000000000000000000000000000000000000..7ab6274b1fe05d6ae81d6ca90fcc1ab61bc516cc --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QTemplatedMetaMethodReturnArgument @@ -0,0 +1 @@ +#include "qobjectdefs.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QTemporaryDir b/qt/6.8.1/msvc2022_64/include/QtCore/QTemporaryDir new file mode 100644 index 0000000000000000000000000000000000000000..e4562c1b62c9a504f2ce33c75e9374a75c1c70c1 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QTemporaryDir @@ -0,0 +1 @@ +#include "qtemporarydir.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QTemporaryFile b/qt/6.8.1/msvc2022_64/include/QtCore/QTemporaryFile new file mode 100644 index 0000000000000000000000000000000000000000..c46363023c5c20b909ce8b6f38786a8dbc88df17 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QTemporaryFile @@ -0,0 +1 @@ +#include "qtemporaryfile.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QTextBoundaryFinder b/qt/6.8.1/msvc2022_64/include/QtCore/QTextBoundaryFinder new file mode 100644 index 0000000000000000000000000000000000000000..cadd336b50f6cc5d242b09b2af6e7e1513937456 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QTextBoundaryFinder @@ -0,0 +1 @@ +#include "qtextboundaryfinder.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QTextStream b/qt/6.8.1/msvc2022_64/include/QtCore/QTextStream new file mode 100644 index 0000000000000000000000000000000000000000..de36473f5d2526e3a71b7cfea81d66d2cd2bf3fb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QTextStream @@ -0,0 +1 @@ +#include "qtextstream.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QTextStreamFunction b/qt/6.8.1/msvc2022_64/include/QtCore/QTextStreamFunction new file mode 100644 index 0000000000000000000000000000000000000000..de36473f5d2526e3a71b7cfea81d66d2cd2bf3fb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QTextStreamFunction @@ -0,0 +1 @@ +#include "qtextstream.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QTextStreamManipulator b/qt/6.8.1/msvc2022_64/include/QtCore/QTextStreamManipulator new file mode 100644 index 0000000000000000000000000000000000000000..de36473f5d2526e3a71b7cfea81d66d2cd2bf3fb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QTextStreamManipulator @@ -0,0 +1 @@ +#include "qtextstream.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QThread b/qt/6.8.1/msvc2022_64/include/QtCore/QThread new file mode 100644 index 0000000000000000000000000000000000000000..91878ae0cc45db60afd70cb2c841a658cd292b6e --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QThread @@ -0,0 +1 @@ +#include "qthread.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QThreadPool b/qt/6.8.1/msvc2022_64/include/QtCore/QThreadPool new file mode 100644 index 0000000000000000000000000000000000000000..50792afd3730bb2259bde0c6e56164ae22898955 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QThreadPool @@ -0,0 +1 @@ +#include "qthreadpool.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QThreadStorage b/qt/6.8.1/msvc2022_64/include/QtCore/QThreadStorage new file mode 100644 index 0000000000000000000000000000000000000000..93df83c30681975993fd8e25fcc37c6765d1d64f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QThreadStorage @@ -0,0 +1 @@ +#include "qthreadstorage.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QThreadStorageData b/qt/6.8.1/msvc2022_64/include/QtCore/QThreadStorageData new file mode 100644 index 0000000000000000000000000000000000000000..93df83c30681975993fd8e25fcc37c6765d1d64f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QThreadStorageData @@ -0,0 +1 @@ +#include "qthreadstorage.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QTime b/qt/6.8.1/msvc2022_64/include/QtCore/QTime new file mode 100644 index 0000000000000000000000000000000000000000..053d3a6938fde637da846aadcbb980c988ed3992 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QTime @@ -0,0 +1 @@ +#include "qdatetime.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QTimeLine b/qt/6.8.1/msvc2022_64/include/QtCore/QTimeLine new file mode 100644 index 0000000000000000000000000000000000000000..6e99b3823ad27f59ea575628a4631f687042f8ad --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QTimeLine @@ -0,0 +1 @@ +#include "qtimeline.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QTimeZone b/qt/6.8.1/msvc2022_64/include/QtCore/QTimeZone new file mode 100644 index 0000000000000000000000000000000000000000..0d6ff1eb59af17fcb3b30728da581fcc87b3d39d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QTimeZone @@ -0,0 +1 @@ +#include "qtimezone.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QTimer b/qt/6.8.1/msvc2022_64/include/QtCore/QTimer new file mode 100644 index 0000000000000000000000000000000000000000..50393f6868432668dd813ced71a8b4ce3b039d22 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QTimer @@ -0,0 +1 @@ +#include "qtimer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QTimerEvent b/qt/6.8.1/msvc2022_64/include/QtCore/QTimerEvent new file mode 100644 index 0000000000000000000000000000000000000000..0c3751e4c9bb886b64bf75cfdad55c496865f9d1 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QTimerEvent @@ -0,0 +1 @@ +#include "qcoreevent.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QTranslator b/qt/6.8.1/msvc2022_64/include/QtCore/QTranslator new file mode 100644 index 0000000000000000000000000000000000000000..70855ad5175d3a2055e15bdab1cdea6145cabed3 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QTranslator @@ -0,0 +1 @@ +#include "qtranslator.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QTransposeProxyModel b/qt/6.8.1/msvc2022_64/include/QtCore/QTransposeProxyModel new file mode 100644 index 0000000000000000000000000000000000000000..67034dacda655b682b5ebff4bb006d34e626801b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QTransposeProxyModel @@ -0,0 +1 @@ +#include "qtransposeproxymodel.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QTypeInfo b/qt/6.8.1/msvc2022_64/include/QtCore/QTypeInfo new file mode 100644 index 0000000000000000000000000000000000000000..65f9c7af31f99c39b74e4084cb28c50c53adf9c2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QTypeInfo @@ -0,0 +1 @@ +#include "qtypeinfo.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QTypeInfoMerger b/qt/6.8.1/msvc2022_64/include/QtCore/QTypeInfoMerger new file mode 100644 index 0000000000000000000000000000000000000000..65f9c7af31f99c39b74e4084cb28c50c53adf9c2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QTypeInfoMerger @@ -0,0 +1 @@ +#include "qtypeinfo.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QTypeRevision b/qt/6.8.1/msvc2022_64/include/QtCore/QTypeRevision new file mode 100644 index 0000000000000000000000000000000000000000..c69b8e1c1519fad7ceab2e1bf223392f452155c7 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QTypeRevision @@ -0,0 +1 @@ +#include "qtyperevision.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QTypedArrayData b/qt/6.8.1/msvc2022_64/include/QtCore/QTypedArrayData new file mode 100644 index 0000000000000000000000000000000000000000..95bf35dabd8f1ad9d895c10565f230a7259a152f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QTypedArrayData @@ -0,0 +1 @@ +#include "qarraydata.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QUnhandledException b/qt/6.8.1/msvc2022_64/include/QtCore/QUnhandledException new file mode 100644 index 0000000000000000000000000000000000000000..aa8a91df97da0ec818245f3770cb914a9e8b8318 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QUnhandledException @@ -0,0 +1 @@ +#include "qexception.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QUntypedBindable b/qt/6.8.1/msvc2022_64/include/QtCore/QUntypedBindable new file mode 100644 index 0000000000000000000000000000000000000000..4cdcd92eb3cd04e9ba02bc1c5e4afdb4ff5925d8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QUntypedBindable @@ -0,0 +1 @@ +#include "qproperty.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QUntypedPropertyBinding b/qt/6.8.1/msvc2022_64/include/QtCore/QUntypedPropertyBinding new file mode 100644 index 0000000000000000000000000000000000000000..4cdcd92eb3cd04e9ba02bc1c5e4afdb4ff5925d8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QUntypedPropertyBinding @@ -0,0 +1 @@ +#include "qproperty.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QUntypedPropertyData b/qt/6.8.1/msvc2022_64/include/QtCore/QUntypedPropertyData new file mode 100644 index 0000000000000000000000000000000000000000..d8265e6d9b156a072aec12e22b9927b92226360b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QUntypedPropertyData @@ -0,0 +1 @@ +#include "qpropertyprivate.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QUrl b/qt/6.8.1/msvc2022_64/include/QtCore/QUrl new file mode 100644 index 0000000000000000000000000000000000000000..230e6f2e0e36807d03910642d12400c082624ee2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QUrl @@ -0,0 +1 @@ +#include "qurl.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QUrlQuery b/qt/6.8.1/msvc2022_64/include/QtCore/QUrlQuery new file mode 100644 index 0000000000000000000000000000000000000000..a69c4ffa76da5a76029fcaccfa550d4d2ccc5ffa --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QUrlQuery @@ -0,0 +1 @@ +#include "qurlquery.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QUrlTwoFlags b/qt/6.8.1/msvc2022_64/include/QtCore/QUrlTwoFlags new file mode 100644 index 0000000000000000000000000000000000000000..230e6f2e0e36807d03910642d12400c082624ee2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QUrlTwoFlags @@ -0,0 +1 @@ +#include "qurl.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QUtf8StringView b/qt/6.8.1/msvc2022_64/include/QtCore/QUtf8StringView new file mode 100644 index 0000000000000000000000000000000000000000..1820516b5dd65fdd813ed9ad0f963000f4ecdaea --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QUtf8StringView @@ -0,0 +1 @@ +#include "qutf8stringview.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QUuid b/qt/6.8.1/msvc2022_64/include/QtCore/QUuid new file mode 100644 index 0000000000000000000000000000000000000000..b344fede61b95b21b4ad457486907a5d30368651 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QUuid @@ -0,0 +1 @@ +#include "quuid.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QVarLengthArray b/qt/6.8.1/msvc2022_64/include/QtCore/QVarLengthArray new file mode 100644 index 0000000000000000000000000000000000000000..b8b17699c877847dc3d6d7a938502b4c9b34832f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QVarLengthArray @@ -0,0 +1 @@ +#include "qvarlengtharray.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QVariant b/qt/6.8.1/msvc2022_64/include/QtCore/QVariant new file mode 100644 index 0000000000000000000000000000000000000000..60864dbd651a4ec91d483a0e8ce5e623b5be49e2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QVariant @@ -0,0 +1 @@ +#include "qvariant.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QVariantAnimation b/qt/6.8.1/msvc2022_64/include/QtCore/QVariantAnimation new file mode 100644 index 0000000000000000000000000000000000000000..e890c38d014c4c3e05d9ace2cd191b1b917865f3 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QVariantAnimation @@ -0,0 +1 @@ +#include "qvariantanimation.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QVariantConstPointer b/qt/6.8.1/msvc2022_64/include/QtCore/QVariantConstPointer new file mode 100644 index 0000000000000000000000000000000000000000..60864dbd651a4ec91d483a0e8ce5e623b5be49e2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QVariantConstPointer @@ -0,0 +1 @@ +#include "qvariant.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QVariantHash b/qt/6.8.1/msvc2022_64/include/QtCore/QVariantHash new file mode 100644 index 0000000000000000000000000000000000000000..a5c8bc1c763c44e9dbdf4018483b336673563052 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QVariantHash @@ -0,0 +1 @@ +#include "qvarianthash.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QVariantList b/qt/6.8.1/msvc2022_64/include/QtCore/QVariantList new file mode 100644 index 0000000000000000000000000000000000000000..64a5a9c60cf00c1e0549e82207b72db972eeeb05 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QVariantList @@ -0,0 +1 @@ +#include "qvariantlist.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QVariantMap b/qt/6.8.1/msvc2022_64/include/QtCore/QVariantMap new file mode 100644 index 0000000000000000000000000000000000000000..7033d7b79975f8e10ed6617159824291d2bcc7a7 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QVariantMap @@ -0,0 +1 @@ +#include "qvariantmap.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QVariantPointer b/qt/6.8.1/msvc2022_64/include/QtCore/QVariantPointer new file mode 100644 index 0000000000000000000000000000000000000000..60864dbd651a4ec91d483a0e8ce5e623b5be49e2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QVariantPointer @@ -0,0 +1 @@ +#include "qvariant.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QVariantRef b/qt/6.8.1/msvc2022_64/include/QtCore/QVariantRef new file mode 100644 index 0000000000000000000000000000000000000000..60864dbd651a4ec91d483a0e8ce5e623b5be49e2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QVariantRef @@ -0,0 +1 @@ +#include "qvariant.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QVector b/qt/6.8.1/msvc2022_64/include/QtCore/QVector new file mode 100644 index 0000000000000000000000000000000000000000..b6230370a1dcc790ae19172139e23d10e35f7c82 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QVector @@ -0,0 +1 @@ +#include "qvector.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QVectorIterator b/qt/6.8.1/msvc2022_64/include/QtCore/QVectorIterator new file mode 100644 index 0000000000000000000000000000000000000000..b6230370a1dcc790ae19172139e23d10e35f7c82 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QVectorIterator @@ -0,0 +1 @@ +#include "qvector.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QVersionNumber b/qt/6.8.1/msvc2022_64/include/QtCore/QVersionNumber new file mode 100644 index 0000000000000000000000000000000000000000..d2a42cf06e20074f5c1e95ac5351e7b294b903fe --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QVersionNumber @@ -0,0 +1 @@ +#include "qversionnumber.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QWaitCondition b/qt/6.8.1/msvc2022_64/include/QtCore/QWaitCondition new file mode 100644 index 0000000000000000000000000000000000000000..2feeeece2bcf62a53810f7e2823e0c24dfb177a6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QWaitCondition @@ -0,0 +1 @@ +#include "qwaitcondition.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QWeakPointer b/qt/6.8.1/msvc2022_64/include/QtCore/QWeakPointer new file mode 100644 index 0000000000000000000000000000000000000000..f9aa7ebf9ddcc62231a62c5b7a02454f5cc2c0a2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QWeakPointer @@ -0,0 +1 @@ +#include "qsharedpointer.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QWinEventNotifier b/qt/6.8.1/msvc2022_64/include/QtCore/QWinEventNotifier new file mode 100644 index 0000000000000000000000000000000000000000..75b2e6ff7276ae4f39dc2ef8887a35d488ea02b3 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QWinEventNotifier @@ -0,0 +1 @@ +#include "qwineventnotifier.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QWriteLocker b/qt/6.8.1/msvc2022_64/include/QtCore/QWriteLocker new file mode 100644 index 0000000000000000000000000000000000000000..56bc3b6fd869848dbb692858e5f28cb49a612fb2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QWriteLocker @@ -0,0 +1 @@ +#include "qreadwritelock.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamAttribute b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamAttribute new file mode 100644 index 0000000000000000000000000000000000000000..02760cb2a8fc19a413ff3bd2435ef70202e5e71d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamAttribute @@ -0,0 +1 @@ +#include "qxmlstream.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamAttributes b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamAttributes new file mode 100644 index 0000000000000000000000000000000000000000..02760cb2a8fc19a413ff3bd2435ef70202e5e71d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamAttributes @@ -0,0 +1 @@ +#include "qxmlstream.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamEntityDeclaration b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamEntityDeclaration new file mode 100644 index 0000000000000000000000000000000000000000..02760cb2a8fc19a413ff3bd2435ef70202e5e71d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamEntityDeclaration @@ -0,0 +1 @@ +#include "qxmlstream.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamEntityDeclarations b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamEntityDeclarations new file mode 100644 index 0000000000000000000000000000000000000000..02760cb2a8fc19a413ff3bd2435ef70202e5e71d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamEntityDeclarations @@ -0,0 +1 @@ +#include "qxmlstream.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamEntityResolver b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamEntityResolver new file mode 100644 index 0000000000000000000000000000000000000000..02760cb2a8fc19a413ff3bd2435ef70202e5e71d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamEntityResolver @@ -0,0 +1 @@ +#include "qxmlstream.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamNamespaceDeclaration b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamNamespaceDeclaration new file mode 100644 index 0000000000000000000000000000000000000000..02760cb2a8fc19a413ff3bd2435ef70202e5e71d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamNamespaceDeclaration @@ -0,0 +1 @@ +#include "qxmlstream.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamNamespaceDeclarations b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamNamespaceDeclarations new file mode 100644 index 0000000000000000000000000000000000000000..02760cb2a8fc19a413ff3bd2435ef70202e5e71d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamNamespaceDeclarations @@ -0,0 +1 @@ +#include "qxmlstream.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamNotationDeclaration b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamNotationDeclaration new file mode 100644 index 0000000000000000000000000000000000000000..02760cb2a8fc19a413ff3bd2435ef70202e5e71d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamNotationDeclaration @@ -0,0 +1 @@ +#include "qxmlstream.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamNotationDeclarations b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamNotationDeclarations new file mode 100644 index 0000000000000000000000000000000000000000..02760cb2a8fc19a413ff3bd2435ef70202e5e71d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamNotationDeclarations @@ -0,0 +1 @@ +#include "qxmlstream.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamReader b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamReader new file mode 100644 index 0000000000000000000000000000000000000000..02760cb2a8fc19a413ff3bd2435ef70202e5e71d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamReader @@ -0,0 +1 @@ +#include "qxmlstream.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamWriter b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamWriter new file mode 100644 index 0000000000000000000000000000000000000000..02760cb2a8fc19a413ff3bd2435ef70202e5e71d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QXmlStreamWriter @@ -0,0 +1 @@ +#include "qxmlstream.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/Qt b/qt/6.8.1/msvc2022_64/include/QtCore/Qt new file mode 100644 index 0000000000000000000000000000000000000000..afb4f65e19023ffec1c486c7e6d1f37261a526ac --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/Qt @@ -0,0 +1 @@ +#include "qnamespace.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtAlgorithms b/qt/6.8.1/msvc2022_64/include/QtCore/QtAlgorithms new file mode 100644 index 0000000000000000000000000000000000000000..94e7c723e462598f6b83d9ca08b819c607bb0825 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtAlgorithms @@ -0,0 +1 @@ +#include "qalgorithms.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtAssert b/qt/6.8.1/msvc2022_64/include/QtCore/QtAssert new file mode 100644 index 0000000000000000000000000000000000000000..3801477767c2e8578642e811c5da6abdd91cab7a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtAssert @@ -0,0 +1 @@ +#include "qassert.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtCborCommon b/qt/6.8.1/msvc2022_64/include/QtCore/QtCborCommon new file mode 100644 index 0000000000000000000000000000000000000000..be3d0c84f82f85729888f35ec29bf0abafce0391 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtCborCommon @@ -0,0 +1 @@ +#include "qcborcommon.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtClassHelperMacros b/qt/6.8.1/msvc2022_64/include/QtCore/QtClassHelperMacros new file mode 100644 index 0000000000000000000000000000000000000000..2d59ab34c6ee988557894babf4f44084c2887c6f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtClassHelperMacros @@ -0,0 +1 @@ +#include "qtclasshelpermacros.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtCleanUpFunction b/qt/6.8.1/msvc2022_64/include/QtCore/QtCleanUpFunction new file mode 100644 index 0000000000000000000000000000000000000000..dcc3f20cfa67e1d19230d25209ed20764f26ae22 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtCleanUpFunction @@ -0,0 +1 @@ +#include "qcoreapplication.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtCompare b/qt/6.8.1/msvc2022_64/include/QtCore/QtCompare new file mode 100644 index 0000000000000000000000000000000000000000..3f3343ff4247500d4d3a2e0016efdeebf1c16e8a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtCompare @@ -0,0 +1 @@ +#include "qcompare.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtCompilerDetection b/qt/6.8.1/msvc2022_64/include/QtCore/QtCompilerDetection new file mode 100644 index 0000000000000000000000000000000000000000..d0d37338fff180d669900d4920f74dde30257c0a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtCompilerDetection @@ -0,0 +1 @@ +#include "qcompilerdetection.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtConfig b/qt/6.8.1/msvc2022_64/include/QtCore/QtConfig new file mode 100644 index 0000000000000000000000000000000000000000..ac84098237991ca820d6733ded176cb9e221673b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtConfig @@ -0,0 +1 @@ +#include "qconfig.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtConstructorMacros b/qt/6.8.1/msvc2022_64/include/QtCore/QtConstructorMacros new file mode 100644 index 0000000000000000000000000000000000000000..157f1fc98be0b5370065757df7a89c7c6c0d721c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtConstructorMacros @@ -0,0 +1 @@ +#include "qconstructormacros.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtContainerFwd b/qt/6.8.1/msvc2022_64/include/QtCore/QtContainerFwd new file mode 100644 index 0000000000000000000000000000000000000000..6d046ffdd152762c0de82420f26c5a6f3572de84 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtContainerFwd @@ -0,0 +1 @@ +#include "qcontainerfwd.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtCore b/qt/6.8.1/msvc2022_64/include/QtCore/QtCore new file mode 100644 index 0000000000000000000000000000000000000000..e919dee566e5a2467e20eda80e9390a1f0237f73 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtCore @@ -0,0 +1,320 @@ +#ifndef QT_QTCORE_MODULE_H +#define QT_QTCORE_MODULE_H +#include +#include "qglobal.h" +#include "q20algorithm.h" +#include "q20chrono.h" +#include "q20functional.h" +#include "q20iterator.h" +#include "q20map.h" +#include "q20memory.h" +#include "q20vector.h" +#include "q23functional.h" +#include "q23utility.h" +#include "q26numeric.h" +#if QT_CONFIG(animation) +#include "qabstractanimation.h" +#endif +#include "qabstracteventdispatcher.h" +#if QT_CONFIG(itemmodel) +#include "qabstractitemmodel.h" +#endif +#include "qabstractnativeeventfilter.h" +#if QT_CONFIG(proxymodel) +#include "qabstractproxymodel.h" +#endif +#include "qalgorithms.h" +#if QT_CONFIG(animation) +#include "qanimationgroup.h" +#endif +#include "qanystringview.h" +#include "qapplicationstatic.h" +#include "qarraydata.h" +#include "qarraydataops.h" +#include "qarraydatapointer.h" +#include "qassert.h" +#include "qassociativeiterable.h" +#include "qatomic.h" +#include "qatomicscopedvaluerollback.h" +#include "qbasictimer.h" +#include "qbindingstorage.h" +#include "qbitarray.h" +#include "qbuffer.h" +#include "qbytearray.h" +#include "qbytearrayalgorithms.h" +#include "qbytearraylist.h" +#include "qbytearraymatcher.h" +#include "qbytearrayview.h" +#include "qcache.h" +#include "qcalendar.h" +#include "qcborarray.h" +#include "qcborcommon.h" +#include "qcbormap.h" +#include "qcborstream.h" +#if QT_CONFIG(cborstreamreader) +#include "qcborstreamreader.h" +#endif +#if QT_CONFIG(cborstreamwriter) +#include "qcborstreamwriter.h" +#endif +#include "qcborvalue.h" +#include "qchar.h" +#include "qchronotimer.h" +#include "qcollator.h" +#if QT_CONFIG(commandlineparser) +#include "qcommandlineoption.h" +#endif +#if QT_CONFIG(commandlineparser) +#include "qcommandlineparser.h" +#endif +#include "qcompare.h" +#include "qcompilerdetection.h" +#if QT_CONFIG(concatenatetablesproxymodel) +#include "qconcatenatetablesproxymodel.h" +#endif +#include "qconstructormacros.h" +#include "qcontainerfwd.h" +#include "qcontainerinfo.h" +#include "qcontiguouscache.h" +#include "qcoreapplication.h" +#include "qcoreevent.h" +#include "qcryptographichash.h" +#include "qdarwinhelpers.h" +#include "qdatastream.h" +#include "qdatetime.h" +#include "qdeadlinetimer.h" +#include "qdebug.h" +#include "qdir.h" +#include "qdiriterator.h" +#include "qdirlisting.h" +#if QT_CONFIG(easingcurve) +#include "qeasingcurve.h" +#endif +#include "qelapsedtimer.h" +#include "qendian.h" +#include "qeventloop.h" +#if QT_CONFIG(future) +#include "qexception.h" +#endif +#include "qexceptionhandling.h" +#include "qfactoryinterface.h" +#include "qfile.h" +#include "qfiledevice.h" +#include "qfileinfo.h" +#include "qfileselector.h" +#if QT_CONFIG(filesystemwatcher) +#include "qfilesystemwatcher.h" +#endif +#include "qflags.h" +#include "qforeach.h" +#include "qfunctionpointer.h" +#if QT_CONFIG(future) +#include "qfuture.h" +#endif +#if QT_CONFIG(future) +#include "qfutureinterface.h" +#endif +#if QT_CONFIG(future) +#include "qfuturesynchronizer.h" +#endif +#if QT_CONFIG(future) +#include "qfuturewatcher.h" +#endif +#include "qgenericatomic.h" +#include "qglobalstatic.h" +#include "qhash.h" +#include "qhashfunctions.h" +#if QT_CONFIG(identityproxymodel) +#include "qidentityproxymodel.h" +#endif +#include "qiodevice.h" +#include "qiodevicebase.h" +#if QT_CONFIG(itemmodel) +#include "qitemselectionmodel.h" +#endif +#include "qiterable.h" +#include "qiterator.h" +#include "qjsonarray.h" +#include "qjsondocument.h" +#include "qjsonobject.h" +#include "qjsonvalue.h" +#include "qlatin1stringmatcher.h" +#include "qlatin1stringview.h" +#if QT_CONFIG(library) +#include "qlibrary.h" +#endif +#include "qlibraryinfo.h" +#include "qline.h" +#include "qlist.h" +#include "qlocale.h" +#include "qlockfile.h" +#include "qloggingcategory.h" +#include "qmalloc.h" +#include "qmap.h" +#include "qmargins.h" +#include "qmath.h" +#include "qmessageauthenticationcode.h" +#include "qmetacontainer.h" +#include "qmetaobject.h" +#include "qmetatype.h" +#include "qmimedata.h" +#if QT_CONFIG(mimetype) +#include "qmimedatabase.h" +#endif +#if QT_CONFIG(mimetype) +#include "qmimetype.h" +#endif +#include "qminmax.h" +#include "qmutex.h" +#include "qnamespace.h" +#include "qnativeinterface.h" +#include "qnumeric.h" +#include "qobject.h" +#include "qobjectcleanuphandler.h" +#include "qobjectdefs.h" +#include "qoperatingsystemversion.h" +#include "qoverload.h" +#include "qpair.h" +#if QT_CONFIG(animation) +#include "qparallelanimationgroup.h" +#endif +#if QT_CONFIG(animation) +#include "qpauseanimation.h" +#endif +#if QT_CONFIG(permissions) +#include "qpermissions.h" +#endif +#include "qplugin.h" +#include "qpluginloader.h" +#include "qpoint.h" +#include "qpointer.h" +#if QT_CONFIG(processenvironment) +#include "qprocess.h" +#endif +#include "qprocessordetection.h" +#if QT_CONFIG(future) +#include "qpromise.h" +#endif +#include "qproperty.h" +#if QT_CONFIG(animation) +#include "qpropertyanimation.h" +#endif +#include "qpropertyprivate.h" +#include "qqueue.h" +#include "qrandom.h" +#include "qreadwritelock.h" +#include "qrect.h" +#include "qrefcount.h" +#if QT_CONFIG(regularexpression) +#include "qregularexpression.h" +#endif +#include "qresource.h" +#if QT_CONFIG(future) +#include "qresultstore.h" +#endif +#include "qrunnable.h" +#include "qsavefile.h" +#include "qscopedpointer.h" +#include "qscopedvaluerollback.h" +#include "qscopeguard.h" +#if QT_CONFIG(thread) +#include "qsemaphore.h" +#endif +#if QT_CONFIG(animation) +#include "qsequentialanimationgroup.h" +#endif +#include "qsequentialiterable.h" +#include "qset.h" +#if QT_CONFIG(settings) +#include "qsettings.h" +#endif +#include "qshareddata.h" +#include "qsharedmemory.h" +#include "qsharedpointer.h" +#include "qsignalmapper.h" +#include "qsimd.h" +#include "qsize.h" +#include "qsocketnotifier.h" +#if QT_CONFIG(sortfilterproxymodel) +#include "qsortfilterproxymodel.h" +#endif +#include "qspan.h" +#include "qstack.h" +#include "qstandardpaths.h" +#include "qstaticlatin1stringmatcher.h" +#include "qstorageinfo.h" +#include "qstring.h" +#include "qstringalgorithms.h" +#include "qstringbuilder.h" +#include "qstringconverter.h" +#include "qstringfwd.h" +#include "qstringlist.h" +#if QT_CONFIG(stringlistmodel) +#include "qstringlistmodel.h" +#endif +#include "qstringliteral.h" +#include "qstringmatcher.h" +#include "qstringtokenizer.h" +#include "qstringview.h" +#include "qswap.h" +#include "qsysinfo.h" +#include "qsystemdetection.h" +#include "qsystemsemaphore.h" +#include "qtaggedpointer.h" +#include "qtclasshelpermacros.h" +#include "qtconfiginclude.h" +#include "qtconfigmacros.h" +#include "qtcoreversion.h" +#include "qtdeprecationmarkers.h" +#include "qtemporarydir.h" +#include "qtemporaryfile.h" +#include "qtenvironmentvariables.h" +#include "qtextboundaryfinder.h" +#include "qtextstream.h" +#include "qthread.h" +#if QT_CONFIG(thread) +#include "qthreadpool.h" +#endif +#include "qthreadstorage.h" +#if QT_CONFIG(easingcurve) +#include "qtimeline.h" +#endif +#include "qtimer.h" +#include "qtimezone.h" +#include "qtipccommon.h" +#include "qtmetamacros.h" +#include "qtnoop.h" +#include "qtpreprocessorsupport.h" +#include "qtranslator.h" +#if QT_CONFIG(transposeproxymodel) +#include "qtransposeproxymodel.h" +#endif +#include "qtresource.h" +#include "qtsymbolmacros.h" +#include "qttranslation.h" +#include "qttypetraits.h" +#include "qtversion.h" +#include "qtversionchecks.h" +#include "qtypeinfo.h" +#include "qtyperevision.h" +#include "qtypes.h" +#include "qurl.h" +#include "qurlquery.h" +#include "qutf8stringview.h" +#include "quuid.h" +#include "qvariant.h" +#if QT_CONFIG(animation) +#include "qvariantanimation.h" +#endif +#include "qvarianthash.h" +#include "qvariantlist.h" +#include "qvariantmap.h" +#include "qvarlengtharray.h" +#include "qvector.h" +#include "qversionnumber.h" +#include "qwaitcondition.h" +#include "qwineventnotifier.h" +#include "qxmlstream.h" +#include "qxpfunctional.h" +#include "qyieldcpu.h" +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtCoreDepends b/qt/6.8.1/msvc2022_64/include/QtCore/QtCoreDepends new file mode 100644 index 0000000000000000000000000000000000000000..b726994b485f7f6657a21c9135ba77711e109b76 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtCoreDepends @@ -0,0 +1,3 @@ +/* This file was generated by cmake with the info from Core target. */ +#ifdef __cplusplus /* create empty PCH in C mode */ +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtCoreVersion b/qt/6.8.1/msvc2022_64/include/QtCore/QtCoreVersion new file mode 100644 index 0000000000000000000000000000000000000000..6012b5ac28f55b4d69a6edaa463e95bb2a8fb331 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtCoreVersion @@ -0,0 +1 @@ +#include "qtcoreversion.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtDarwinHelpers b/qt/6.8.1/msvc2022_64/include/QtCore/QtDarwinHelpers new file mode 100644 index 0000000000000000000000000000000000000000..e44993ac33c2560121fa8dd95e66eecaeb664a03 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtDarwinHelpers @@ -0,0 +1 @@ +#include "qdarwinhelpers.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtDebug b/qt/6.8.1/msvc2022_64/include/QtCore/QtDebug new file mode 100644 index 0000000000000000000000000000000000000000..787e69549068b8daca4aac6ba73d98139bf901d0 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtDebug @@ -0,0 +1 @@ +#include "qdebug.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtDeprecationMarkers b/qt/6.8.1/msvc2022_64/include/QtCore/QtDeprecationMarkers new file mode 100644 index 0000000000000000000000000000000000000000..c4583a8e09b5ea6cbd13841408116b1f98bf709d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtDeprecationMarkers @@ -0,0 +1 @@ +#include "qtdeprecationmarkers.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtEndian b/qt/6.8.1/msvc2022_64/include/QtCore/QtEndian new file mode 100644 index 0000000000000000000000000000000000000000..d97b75063d4fc4d14bf125c5e6cfeefc4be1dbf2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtEndian @@ -0,0 +1 @@ +#include "qendian.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtEnvironmentVariables b/qt/6.8.1/msvc2022_64/include/QtCore/QtEnvironmentVariables new file mode 100644 index 0000000000000000000000000000000000000000..3371b4ac91985368a4b3533dea9a3d29eff2f51f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtEnvironmentVariables @@ -0,0 +1 @@ +#include "qtenvironmentvariables.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtExceptionHandling b/qt/6.8.1/msvc2022_64/include/QtCore/QtExceptionHandling new file mode 100644 index 0000000000000000000000000000000000000000..d0bd61b0dccbb2ba6011823672f002524d0aa53c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtExceptionHandling @@ -0,0 +1 @@ +#include "qexceptionhandling.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtGlobal b/qt/6.8.1/msvc2022_64/include/QtCore/QtGlobal new file mode 100644 index 0000000000000000000000000000000000000000..b8d1c89d79caef043742c3b6d5ccf6566b0756f3 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtGlobal @@ -0,0 +1 @@ +#include "qglobal.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtLogging b/qt/6.8.1/msvc2022_64/include/QtCore/QtLogging new file mode 100644 index 0000000000000000000000000000000000000000..1839b927f82930640eea3c1db76d6fdc1a14ab08 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtLogging @@ -0,0 +1 @@ +#include "qlogging.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtMalloc b/qt/6.8.1/msvc2022_64/include/QtCore/QtMalloc new file mode 100644 index 0000000000000000000000000000000000000000..d5f5f19edda1b5e82f9c2f9a958b3db1cfe347ff --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtMalloc @@ -0,0 +1 @@ +#include "qmalloc.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtMath b/qt/6.8.1/msvc2022_64/include/QtCore/QtMath new file mode 100644 index 0000000000000000000000000000000000000000..6d7967101ee2235b6acc90f7e5438c025e459fad --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtMath @@ -0,0 +1 @@ +#include "qmath.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtMessageHandler b/qt/6.8.1/msvc2022_64/include/QtCore/QtMessageHandler new file mode 100644 index 0000000000000000000000000000000000000000..1839b927f82930640eea3c1db76d6fdc1a14ab08 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtMessageHandler @@ -0,0 +1 @@ +#include "qlogging.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtMinMax b/qt/6.8.1/msvc2022_64/include/QtCore/QtMinMax new file mode 100644 index 0000000000000000000000000000000000000000..7a478a19043e9fb26cc4c3e8f233bc557bdab819 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtMinMax @@ -0,0 +1 @@ +#include "qminmax.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtNumeric b/qt/6.8.1/msvc2022_64/include/QtCore/QtNumeric new file mode 100644 index 0000000000000000000000000000000000000000..a941e48191ec790e68420a770f3ff71741ac5d85 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtNumeric @@ -0,0 +1 @@ +#include "qnumeric.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtPlugin b/qt/6.8.1/msvc2022_64/include/QtCore/QtPlugin new file mode 100644 index 0000000000000000000000000000000000000000..0ae7d826de35314816fae5a999433ee302c2980b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtPlugin @@ -0,0 +1 @@ +#include "qplugin.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtPluginInstanceFunction b/qt/6.8.1/msvc2022_64/include/QtCore/QtPluginInstanceFunction new file mode 100644 index 0000000000000000000000000000000000000000..0ae7d826de35314816fae5a999433ee302c2980b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtPluginInstanceFunction @@ -0,0 +1 @@ +#include "qplugin.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtPluginMetaDataFunction b/qt/6.8.1/msvc2022_64/include/QtCore/QtPluginMetaDataFunction new file mode 100644 index 0000000000000000000000000000000000000000..0ae7d826de35314816fae5a999433ee302c2980b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtPluginMetaDataFunction @@ -0,0 +1 @@ +#include "qplugin.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtPreprocessorSupport b/qt/6.8.1/msvc2022_64/include/QtCore/QtPreprocessorSupport new file mode 100644 index 0000000000000000000000000000000000000000..2099f4cc02fb4a30c45b4a52204f49348f4b1b49 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtPreprocessorSupport @@ -0,0 +1 @@ +#include "qtpreprocessorsupport.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtProcessorDetection b/qt/6.8.1/msvc2022_64/include/QtCore/QtProcessorDetection new file mode 100644 index 0000000000000000000000000000000000000000..7e3e5b7a6484572778637c49acf71ca90fdea308 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtProcessorDetection @@ -0,0 +1 @@ +#include "qprocessordetection.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtResource b/qt/6.8.1/msvc2022_64/include/QtCore/QtResource new file mode 100644 index 0000000000000000000000000000000000000000..7d61ec8d2f5f61f98d6ca128967e3471813e3d5b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtResource @@ -0,0 +1 @@ +#include "qtresource.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtStartUpFunction b/qt/6.8.1/msvc2022_64/include/QtCore/QtStartUpFunction new file mode 100644 index 0000000000000000000000000000000000000000..dcc3f20cfa67e1d19230d25209ed20764f26ae22 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtStartUpFunction @@ -0,0 +1 @@ +#include "qcoreapplication.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtSwap b/qt/6.8.1/msvc2022_64/include/QtCore/QtSwap new file mode 100644 index 0000000000000000000000000000000000000000..43d60e688e3f0ebe122a20756b54070c2c4d0710 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtSwap @@ -0,0 +1 @@ +#include "qswap.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtSystemDetection b/qt/6.8.1/msvc2022_64/include/QtCore/QtSystemDetection new file mode 100644 index 0000000000000000000000000000000000000000..b39d1204526805c14f1e51c9cb75777081f58e91 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtSystemDetection @@ -0,0 +1 @@ +#include "qsystemdetection.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtTranslation b/qt/6.8.1/msvc2022_64/include/QtCore/QtTranslation new file mode 100644 index 0000000000000000000000000000000000000000..4b1a01e628be9bd66e29ae222419b0cc5ecd9948 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtTranslation @@ -0,0 +1 @@ +#include "qttranslation.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtTypeTraits b/qt/6.8.1/msvc2022_64/include/QtCore/QtTypeTraits new file mode 100644 index 0000000000000000000000000000000000000000..62c34f423996b2d86768e0795cf2c2e75f1bbeff --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtTypeTraits @@ -0,0 +1 @@ +#include "qttypetraits.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtTypes b/qt/6.8.1/msvc2022_64/include/QtCore/QtTypes new file mode 100644 index 0000000000000000000000000000000000000000..223d79eb31011a8ad39278063c8ba7288829cd00 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtTypes @@ -0,0 +1 @@ +#include "qtypes.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtVersion b/qt/6.8.1/msvc2022_64/include/QtCore/QtVersion new file mode 100644 index 0000000000000000000000000000000000000000..9e4ea55480ba6cd088525214ba909a62b4138208 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtVersion @@ -0,0 +1 @@ +#include "qtversion.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/QtVersionChecks b/qt/6.8.1/msvc2022_64/include/QtCore/QtVersionChecks new file mode 100644 index 0000000000000000000000000000000000000000..84b407bd7f079a5a69bb162c8484262581990d1a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/QtVersionChecks @@ -0,0 +1 @@ +#include "qtversionchecks.h" // IWYU pragma: export diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qarraydataops.h b/qt/6.8.1/msvc2022_64/include/QtCore/qarraydataops.h new file mode 100644 index 0000000000000000000000000000000000000000..058c72381567b624a86e6ef6d4d559f9f71d0ac5 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qarraydataops.h @@ -0,0 +1,957 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QARRAYDATAOPS_H +#define QARRAYDATAOPS_H + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +template struct QArrayDataPointer; + +namespace QtPrivate { + +template +struct QPodArrayOps + : public QArrayDataPointer +{ + static_assert (std::is_nothrow_destructible_v, "Types with throwing destructors are not supported in Qt containers."); + +protected: + typedef QTypedArrayData Data; + using DataPointer = QArrayDataPointer; + +public: + typedef typename QArrayDataPointer::parameter_type parameter_type; + + using QArrayDataPointer::QArrayDataPointer; + + void appendInitialize(qsizetype newSize) noexcept + { + Q_ASSERT(this->isMutable()); + Q_ASSERT(!this->isShared()); + Q_ASSERT(newSize > this->size); + Q_ASSERT(newSize - this->size <= this->freeSpaceAtEnd()); + + T *where = this->end(); + this->size = newSize; + const T *e = this->end(); + while (where != e) + *where++ = T(); + } + + void copyAppend(const T *b, const T *e) noexcept + { + Q_ASSERT(this->isMutable() || b == e); + Q_ASSERT(!this->isShared() || b == e); + Q_ASSERT(b <= e); + Q_ASSERT((e - b) <= this->freeSpaceAtEnd()); + + if (b == e) + return; + + ::memcpy(static_cast(this->end()), static_cast(b), (e - b) * sizeof(T)); + this->size += (e - b); + } + + void copyAppend(qsizetype n, parameter_type t) noexcept + { + Q_ASSERT(!this->isShared() || n == 0); + Q_ASSERT(this->freeSpaceAtEnd() >= n); + if (!n) + return; + + T *where = this->end(); + this->size += qsizetype(n); + while (n--) + *where++ = t; + } + + void moveAppend(T *b, T *e) noexcept + { + copyAppend(b, e); + } + + void truncate(size_t newSize) noexcept + { + Q_ASSERT(this->isMutable()); + Q_ASSERT(!this->isShared()); + Q_ASSERT(newSize < size_t(this->size)); + + this->size = qsizetype(newSize); + } + + void destroyAll() noexcept // Call from destructors, ONLY! + { + Q_ASSERT(this->d); + Q_ASSERT(this->d->ref_.loadRelaxed() == 0); + + // As this is to be called only from destructor, it doesn't need to be + // exception safe; size not updated. + } + + T *createHole(QArrayData::GrowthPosition pos, qsizetype where, qsizetype n) + { + Q_ASSERT((pos == QArrayData::GrowsAtBeginning && n <= this->freeSpaceAtBegin()) || + (pos == QArrayData::GrowsAtEnd && n <= this->freeSpaceAtEnd())); + + T *insertionPoint = this->ptr + where; + if (pos == QArrayData::GrowsAtEnd) { + if (where < this->size) + ::memmove(static_cast(insertionPoint + n), static_cast(insertionPoint), (this->size - where) * sizeof(T)); + } else { + Q_ASSERT(where == 0); + this->ptr -= n; + insertionPoint -= n; + } + this->size += n; + return insertionPoint; + } + + void insert(qsizetype i, const T *data, qsizetype n) + { + typename Data::GrowthPosition pos = Data::GrowsAtEnd; + if (this->size != 0 && i == 0) + pos = Data::GrowsAtBeginning; + + DataPointer oldData; + this->detachAndGrow(pos, n, &data, &oldData); + Q_ASSERT((pos == Data::GrowsAtBeginning && this->freeSpaceAtBegin() >= n) || + (pos == Data::GrowsAtEnd && this->freeSpaceAtEnd() >= n)); + + T *where = createHole(pos, i, n); + ::memcpy(static_cast(where), static_cast(data), n * sizeof(T)); + } + + void insert(qsizetype i, qsizetype n, parameter_type t) + { + T copy(t); + + typename Data::GrowthPosition pos = Data::GrowsAtEnd; + if (this->size != 0 && i == 0) + pos = Data::GrowsAtBeginning; + + this->detachAndGrow(pos, n, nullptr, nullptr); + Q_ASSERT((pos == Data::GrowsAtBeginning && this->freeSpaceAtBegin() >= n) || + (pos == Data::GrowsAtEnd && this->freeSpaceAtEnd() >= n)); + + T *where = createHole(pos, i, n); + while (n--) + *where++ = copy; + } + + template + void emplace(qsizetype i, Args &&... args) + { + bool detach = this->needsDetach(); + if (!detach) { + if (i == this->size && this->freeSpaceAtEnd()) { + new (this->end()) T(std::forward(args)...); + ++this->size; + return; + } + if (i == 0 && this->freeSpaceAtBegin()) { + new (this->begin() - 1) T(std::forward(args)...); + --this->ptr; + ++this->size; + return; + } + } + T tmp(std::forward(args)...); + typename QArrayData::GrowthPosition pos = QArrayData::GrowsAtEnd; + if (this->size != 0 && i == 0) + pos = QArrayData::GrowsAtBeginning; + + this->detachAndGrow(pos, 1, nullptr, nullptr); + + T *where = createHole(pos, i, 1); + new (where) T(std::move(tmp)); + } + + void erase(T *b, qsizetype n) + { + T *e = b + n; + Q_ASSERT(this->isMutable()); + Q_ASSERT(b < e); + Q_ASSERT(b >= this->begin() && b < this->end()); + Q_ASSERT(e > this->begin() && e <= this->end()); + + // Comply with std::vector::erase(): erased elements and all after them + // are invalidated. However, erasing from the beginning effectively + // means that all iterators are invalidated. We can use this freedom to + // erase by moving towards the end. + if (b == this->begin() && e != this->end()) { + this->ptr = e; + } else if (e != this->end()) { + ::memmove(static_cast(b), static_cast(e), + (static_cast(this->end()) - e) * sizeof(T)); + } + this->size -= n; + } + + void eraseFirst() noexcept + { + Q_ASSERT(this->isMutable()); + Q_ASSERT(this->size); + ++this->ptr; + --this->size; + } + + void eraseLast() noexcept + { + Q_ASSERT(this->isMutable()); + Q_ASSERT(this->size); + --this->size; + } + + template + qsizetype eraseIf(Predicate pred) + { + qsizetype result = 0; + if (this->size == 0) + return result; + + if (!this->needsDetach()) { + auto end = this->end(); + auto it = std::remove_if(this->begin(), end, pred); + if (it != end) { + result = std::distance(it, end); + erase(it, result); + } + } else { + const auto begin = this->begin(); + const auto end = this->end(); + auto it = std::find_if(begin, end, pred); + if (it == end) + return result; + + QPodArrayOps other(this->size); + Q_CHECK_PTR(other.data()); + auto dest = other.begin(); + // std::uninitialized_copy will fallback to ::memcpy/memmove() + dest = std::uninitialized_copy(begin, it, dest); + dest = q_uninitialized_remove_copy_if(std::next(it), end, dest, pred); + other.size = std::distance(other.data(), dest); + result = this->size - other.size; + this->swap(other); + } + return result; + } + + struct Span { T *begin; T *end; }; + + void copyRanges(std::initializer_list ranges) + { + auto it = this->begin(); + std::for_each(ranges.begin(), ranges.end(), [&it](const auto &span) { + it = std::copy(span.begin, span.end, it); + }); + this->size = std::distance(this->begin(), it); + } + + void assign(T *b, T *e, parameter_type t) noexcept + { + Q_ASSERT(b <= e); + Q_ASSERT(b >= this->begin() && e <= this->end()); + + while (b != e) + ::memcpy(static_cast(b++), static_cast(&t), sizeof(T)); + } + + void reallocate(qsizetype alloc, QArrayData::AllocationOption option) + { + auto pair = Data::reallocateUnaligned(this->d, this->ptr, alloc, option); + Q_CHECK_PTR(pair.second); + Q_ASSERT(pair.first != nullptr); + this->d = pair.first; + this->ptr = pair.second; + } +}; + +template +struct QGenericArrayOps + : public QArrayDataPointer +{ + static_assert (std::is_nothrow_destructible_v, "Types with throwing destructors are not supported in Qt containers."); + +protected: + typedef QTypedArrayData Data; + using DataPointer = QArrayDataPointer; + +public: + typedef typename QArrayDataPointer::parameter_type parameter_type; + + void appendInitialize(qsizetype newSize) + { + Q_ASSERT(this->isMutable()); + Q_ASSERT(!this->isShared()); + Q_ASSERT(newSize > this->size); + Q_ASSERT(newSize - this->size <= this->freeSpaceAtEnd()); + + T *const b = this->begin(); + do { + new (b + this->size) T; + } while (++this->size != newSize); + } + + void copyAppend(const T *b, const T *e) + { + Q_ASSERT(this->isMutable() || b == e); + Q_ASSERT(!this->isShared() || b == e); + Q_ASSERT(b <= e); + Q_ASSERT((e - b) <= this->freeSpaceAtEnd()); + + if (b == e) // short-cut and handling the case b and e == nullptr + return; + + T *data = this->begin(); + while (b < e) { + new (data + this->size) T(*b); + ++b; + ++this->size; + } + } + + void copyAppend(qsizetype n, parameter_type t) + { + Q_ASSERT(!this->isShared() || n == 0); + Q_ASSERT(this->freeSpaceAtEnd() >= n); + if (!n) + return; + + T *data = this->begin(); + while (n--) { + new (data + this->size) T(t); + ++this->size; + } + } + + void moveAppend(T *b, T *e) + { + Q_ASSERT(this->isMutable() || b == e); + Q_ASSERT(!this->isShared() || b == e); + Q_ASSERT(b <= e); + Q_ASSERT((e - b) <= this->freeSpaceAtEnd()); + + if (b == e) + return; + + T *data = this->begin(); + while (b < e) { + new (data + this->size) T(std::move(*b)); + ++b; + ++this->size; + } + } + + void truncate(size_t newSize) + { + Q_ASSERT(this->isMutable()); + Q_ASSERT(!this->isShared()); + Q_ASSERT(newSize < size_t(this->size)); + + std::destroy(this->begin() + newSize, this->end()); + this->size = newSize; + } + + void destroyAll() // Call from destructors, ONLY + { + Q_ASSERT(this->d); + // As this is to be called only from destructor, it doesn't need to be + // exception safe; size not updated. + + Q_ASSERT(this->d->ref_.loadRelaxed() == 0); + + std::destroy(this->begin(), this->end()); + } + + struct Inserter + { + QArrayDataPointer *data; + T *begin; + qsizetype size; + + qsizetype sourceCopyConstruct = 0, nSource = 0, move = 0, sourceCopyAssign = 0; + T *end = nullptr, *last = nullptr, *where = nullptr; + + Inserter(QArrayDataPointer *d) : data(d) + { + begin = d->ptr; + size = d->size; + } + ~Inserter() { + data->ptr = begin; + data->size = size; + } + Q_DISABLE_COPY(Inserter) + + void setup(qsizetype pos, qsizetype n) + { + end = begin + size; + last = end - 1; + where = begin + pos; + qsizetype dist = size - pos; + sourceCopyConstruct = 0; + nSource = n; + move = n - dist; // smaller 0 + sourceCopyAssign = n; + if (n > dist) { + sourceCopyConstruct = n - dist; + move = 0; + sourceCopyAssign -= sourceCopyConstruct; + } + } + + void insert(qsizetype pos, const T *source, qsizetype n) + { + qsizetype oldSize = size; + Q_UNUSED(oldSize); + + setup(pos, n); + + // first create new elements at the end, by copying from elements + // to be inserted (if they extend past the current end of the array) + for (qsizetype i = 0; i != sourceCopyConstruct; ++i) { + new (end + i) T(source[nSource - sourceCopyConstruct + i]); + ++size; + } + Q_ASSERT(size <= oldSize + n); + + // now move construct new elements at the end from existing elements inside + // the array. + for (qsizetype i = sourceCopyConstruct; i != nSource; ++i) { + new (end + i) T(std::move(*(end + i - nSource))); + ++size; + } + // array has the new size now! + Q_ASSERT(size == oldSize + n); + + // now move assign existing elements towards the end + for (qsizetype i = 0; i != move; --i) + last[i] = std::move(last[i - nSource]); + + // finally copy the remaining elements from source over + for (qsizetype i = 0; i != sourceCopyAssign; ++i) + where[i] = source[i]; + } + + void insert(qsizetype pos, const T &t, qsizetype n) + { + const qsizetype oldSize = size; + Q_UNUSED(oldSize); + + setup(pos, n); + + // first create new elements at the end, by copying from elements + // to be inserted (if they extend past the current end of the array) + for (qsizetype i = 0; i != sourceCopyConstruct; ++i) { + new (end + i) T(t); + ++size; + } + Q_ASSERT(size <= oldSize + n); + + // now move construct new elements at the end from existing elements inside + // the array. + for (qsizetype i = sourceCopyConstruct; i != nSource; ++i) { + new (end + i) T(std::move(*(end + i - nSource))); + ++size; + } + // array has the new size now! + Q_ASSERT(size == oldSize + n); + + // now move assign existing elements towards the end + for (qsizetype i = 0; i != move; --i) + last[i] = std::move(last[i - nSource]); + + // finally copy the remaining elements from source over + for (qsizetype i = 0; i != sourceCopyAssign; ++i) + where[i] = t; + } + + void insertOne(qsizetype pos, T &&t) + { + setup(pos, 1); + + if (sourceCopyConstruct) { + Q_ASSERT(sourceCopyConstruct == 1); + new (end) T(std::move(t)); + ++size; + } else { + // create a new element at the end by move constructing one existing element + // inside the array. + new (end) T(std::move(*(end - 1))); + ++size; + + // now move assign existing elements towards the end + for (qsizetype i = 0; i != move; --i) + last[i] = std::move(last[i - 1]); + + // and move the new item into place + *where = std::move(t); + } + } + }; + + void insert(qsizetype i, const T *data, qsizetype n) + { + const bool growsAtBegin = this->size != 0 && i == 0; + const auto pos = growsAtBegin ? Data::GrowsAtBeginning : Data::GrowsAtEnd; + + DataPointer oldData; + this->detachAndGrow(pos, n, &data, &oldData); + Q_ASSERT((pos == Data::GrowsAtBeginning && this->freeSpaceAtBegin() >= n) || + (pos == Data::GrowsAtEnd && this->freeSpaceAtEnd() >= n)); + + if (growsAtBegin) { + // copy construct items in reverse order at the begin + Q_ASSERT(this->freeSpaceAtBegin() >= n); + while (n) { + --n; + new (this->begin() - 1) T(data[n]); + --this->ptr; + ++this->size; + } + } else { + Inserter(this).insert(i, data, n); + } + } + + void insert(qsizetype i, qsizetype n, parameter_type t) + { + T copy(t); + + const bool growsAtBegin = this->size != 0 && i == 0; + const auto pos = growsAtBegin ? Data::GrowsAtBeginning : Data::GrowsAtEnd; + + this->detachAndGrow(pos, n, nullptr, nullptr); + Q_ASSERT((pos == Data::GrowsAtBeginning && this->freeSpaceAtBegin() >= n) || + (pos == Data::GrowsAtEnd && this->freeSpaceAtEnd() >= n)); + + if (growsAtBegin) { + // copy construct items in reverse order at the begin + Q_ASSERT(this->freeSpaceAtBegin() >= n); + while (n--) { + new (this->begin() - 1) T(copy); + --this->ptr; + ++this->size; + } + } else { + Inserter(this).insert(i, copy, n); + } + } + + template + void emplace(qsizetype i, Args &&... args) + { + bool detach = this->needsDetach(); + if (!detach) { + if (i == this->size && this->freeSpaceAtEnd()) { + new (this->end()) T(std::forward(args)...); + ++this->size; + return; + } + if (i == 0 && this->freeSpaceAtBegin()) { + new (this->begin() - 1) T(std::forward(args)...); + --this->ptr; + ++this->size; + return; + } + } + T tmp(std::forward(args)...); + const bool growsAtBegin = this->size != 0 && i == 0; + const auto pos = growsAtBegin ? Data::GrowsAtBeginning : Data::GrowsAtEnd; + + this->detachAndGrow(pos, 1, nullptr, nullptr); + + if (growsAtBegin) { + Q_ASSERT(this->freeSpaceAtBegin()); + new (this->begin() - 1) T(std::move(tmp)); + --this->ptr; + ++this->size; + } else { + Inserter(this).insertOne(i, std::move(tmp)); + } + } + + void erase(T *b, qsizetype n) + { + T *e = b + n; + Q_ASSERT(this->isMutable()); + Q_ASSERT(b < e); + Q_ASSERT(b >= this->begin() && b < this->end()); + Q_ASSERT(e > this->begin() && e <= this->end()); + + // Comply with std::vector::erase(): erased elements and all after them + // are invalidated. However, erasing from the beginning effectively + // means that all iterators are invalidated. We can use this freedom to + // erase by moving towards the end. + if (b == this->begin() && e != this->end()) { + this->ptr = e; + } else { + const T *const end = this->end(); + + // move (by assignment) the elements from e to end + // onto b to the new end + while (e != end) { + *b = std::move(*e); + ++b; + ++e; + } + } + this->size -= n; + std::destroy(b, e); + } + + void eraseFirst() noexcept + { + Q_ASSERT(this->isMutable()); + Q_ASSERT(this->size); + this->begin()->~T(); + ++this->ptr; + --this->size; + } + + void eraseLast() noexcept + { + Q_ASSERT(this->isMutable()); + Q_ASSERT(this->size); + (this->end() - 1)->~T(); + --this->size; + } + + + void assign(T *b, T *e, parameter_type t) + { + Q_ASSERT(b <= e); + Q_ASSERT(b >= this->begin() && e <= this->end()); + + while (b != e) + *b++ = t; + } +}; + +template +struct QMovableArrayOps + : QGenericArrayOps +{ + static_assert (std::is_nothrow_destructible_v, "Types with throwing destructors are not supported in Qt containers."); + +protected: + typedef QTypedArrayData Data; + using DataPointer = QArrayDataPointer; + +public: + // using QGenericArrayOps::copyAppend; + // using QGenericArrayOps::moveAppend; + // using QGenericArrayOps::truncate; + // using QGenericArrayOps::destroyAll; + typedef typename QGenericArrayOps::parameter_type parameter_type; + + struct Inserter + { + QArrayDataPointer *data; + T *displaceFrom; + T *displaceTo; + qsizetype nInserts = 0; + qsizetype bytes; + + Inserter(QArrayDataPointer *d) : data(d) { } + ~Inserter() { + if constexpr (!std::is_nothrow_copy_constructible_v) { + if (displaceFrom != displaceTo) { + ::memmove(static_cast(displaceFrom), static_cast(displaceTo), bytes); + nInserts -= qAbs(displaceFrom - displaceTo); + } + } + data->size += nInserts; + } + Q_DISABLE_COPY(Inserter) + + T *displace(qsizetype pos, qsizetype n) + { + nInserts = n; + T *insertionPoint = data->ptr + pos; + displaceFrom = data->ptr + pos; + displaceTo = displaceFrom + n; + bytes = data->size - pos; + bytes *= sizeof(T); + ::memmove(static_cast(displaceTo), static_cast(displaceFrom), bytes); + return insertionPoint; + } + + void insert(qsizetype pos, const T *source, qsizetype n) + { + T *where = displace(pos, n); + + while (n--) { + new (where) T(*source); + ++where; + ++source; + ++displaceFrom; + } + } + + void insert(qsizetype pos, const T &t, qsizetype n) + { + T *where = displace(pos, n); + + while (n--) { + new (where) T(t); + ++where; + ++displaceFrom; + } + } + + void insertOne(qsizetype pos, T &&t) + { + T *where = displace(pos, 1); + new (where) T(std::move(t)); + ++displaceFrom; + Q_ASSERT(displaceFrom == displaceTo); + } + + }; + + + void insert(qsizetype i, const T *data, qsizetype n) + { + const bool growsAtBegin = this->size != 0 && i == 0; + const auto pos = growsAtBegin ? Data::GrowsAtBeginning : Data::GrowsAtEnd; + + DataPointer oldData; + this->detachAndGrow(pos, n, &data, &oldData); + Q_ASSERT((pos == Data::GrowsAtBeginning && this->freeSpaceAtBegin() >= n) || + (pos == Data::GrowsAtEnd && this->freeSpaceAtEnd() >= n)); + + if (growsAtBegin) { + // copy construct items in reverse order at the begin + Q_ASSERT(this->freeSpaceAtBegin() >= n); + while (n) { + --n; + new (this->begin() - 1) T(data[n]); + --this->ptr; + ++this->size; + } + } else { + Inserter(this).insert(i, data, n); + } + } + + void insert(qsizetype i, qsizetype n, parameter_type t) + { + T copy(t); + + const bool growsAtBegin = this->size != 0 && i == 0; + const auto pos = growsAtBegin ? Data::GrowsAtBeginning : Data::GrowsAtEnd; + + this->detachAndGrow(pos, n, nullptr, nullptr); + Q_ASSERT((pos == Data::GrowsAtBeginning && this->freeSpaceAtBegin() >= n) || + (pos == Data::GrowsAtEnd && this->freeSpaceAtEnd() >= n)); + + if (growsAtBegin) { + // copy construct items in reverse order at the begin + Q_ASSERT(this->freeSpaceAtBegin() >= n); + while (n--) { + new (this->begin() - 1) T(copy); + --this->ptr; + ++this->size; + } + } else { + Inserter(this).insert(i, copy, n); + } + } + + template + void emplace(qsizetype i, Args &&... args) + { + bool detach = this->needsDetach(); + if (!detach) { + if (i == this->size && this->freeSpaceAtEnd()) { + new (this->end()) T(std::forward(args)...); + ++this->size; + return; + } + if (i == 0 && this->freeSpaceAtBegin()) { + new (this->begin() - 1) T(std::forward(args)...); + --this->ptr; + ++this->size; + return; + } + } + T tmp(std::forward(args)...); + const bool growsAtBegin = this->size != 0 && i == 0; + const auto pos = growsAtBegin ? Data::GrowsAtBeginning : Data::GrowsAtEnd; + + this->detachAndGrow(pos, 1, nullptr, nullptr); + if (growsAtBegin) { + Q_ASSERT(this->freeSpaceAtBegin()); + new (this->begin() - 1) T(std::move(tmp)); + --this->ptr; + ++this->size; + } else { + Inserter(this).insertOne(i, std::move(tmp)); + } + } + + void erase(T *b, qsizetype n) + { + T *e = b + n; + + Q_ASSERT(this->isMutable()); + Q_ASSERT(b < e); + Q_ASSERT(b >= this->begin() && b < this->end()); + Q_ASSERT(e > this->begin() && e <= this->end()); + + // Comply with std::vector::erase(): erased elements and all after them + // are invalidated. However, erasing from the beginning effectively + // means that all iterators are invalidated. We can use this freedom to + // erase by moving towards the end. + + std::destroy(b, e); + if (b == this->begin() && e != this->end()) { + this->ptr = e; + } else if (e != this->end()) { + memmove(static_cast(b), static_cast(e), (static_cast(this->end()) - e)*sizeof(T)); + } + this->size -= n; + } + + void reallocate(qsizetype alloc, QArrayData::AllocationOption option) + { + auto pair = Data::reallocateUnaligned(this->d, this->ptr, alloc, option); + Q_CHECK_PTR(pair.second); + Q_ASSERT(pair.first != nullptr); + this->d = pair.first; + this->ptr = pair.second; + } +}; + +template +struct QArrayOpsSelector +{ + typedef QGenericArrayOps Type; +}; + +template +struct QArrayOpsSelector::isComplex && QTypeInfo::isRelocatable + >::type> +{ + typedef QPodArrayOps Type; +}; + +template +struct QArrayOpsSelector::isComplex && QTypeInfo::isRelocatable + >::type> +{ + typedef QMovableArrayOps Type; +}; + +template +struct QCommonArrayOps : QArrayOpsSelector::Type +{ + using Base = typename QArrayOpsSelector::Type; + using Data = QTypedArrayData; + using DataPointer = QArrayDataPointer; + using parameter_type = typename Base::parameter_type; + +protected: + using Self = QCommonArrayOps; + +public: + // using Base::truncate; + // using Base::destroyAll; + // using Base::assign; + + template + void appendIteratorRange(It b, It e, QtPrivate::IfIsForwardIterator = true) + { + Q_ASSERT(this->isMutable() || b == e); + Q_ASSERT(!this->isShared() || b == e); + const qsizetype distance = std::distance(b, e); + Q_ASSERT(distance >= 0 && distance <= this->allocatedCapacity() - this->size); + Q_UNUSED(distance); + +#if __cplusplus >= 202002L && defined(__cpp_concepts) && defined(__cpp_lib_concepts) + constexpr bool canUseCopyAppend = + std::contiguous_iterator && + std::is_same_v< + std::remove_cv_t::value_type>, + T + >; + if constexpr (canUseCopyAppend) { + this->copyAppend(std::to_address(b), std::to_address(e)); + } else +#endif + { + T *iter = this->end(); + for (; b != e; ++iter, ++b) { + new (iter) T(*b); + ++this->size; + } + } + } + + // slightly higher level API than copyAppend() that also preallocates space + void growAppend(const T *b, const T *e) + { + if (b == e) + return; + Q_ASSERT(b < e); + const qsizetype n = e - b; + DataPointer old; + + // points into range: + if (QtPrivate::q_points_into_range(b, *this)) + this->detachAndGrow(QArrayData::GrowsAtEnd, n, &b, &old); + else + this->detachAndGrow(QArrayData::GrowsAtEnd, n, nullptr, nullptr); + Q_ASSERT(this->freeSpaceAtEnd() >= n); + // b might be updated so use [b, n) + this->copyAppend(b, b + n); + } + + void appendUninitialized(qsizetype newSize) + { + Q_ASSERT(this->isMutable()); + Q_ASSERT(!this->isShared()); + Q_ASSERT(newSize > this->size); + Q_ASSERT(newSize - this->size <= this->freeSpaceAtEnd()); + + + T *const b = this->begin() + this->size; + T *const e = this->begin() + newSize; + if constexpr (std::is_constructible_v) + std::uninitialized_fill(b, e, Qt::Uninitialized); + else + std::uninitialized_default_construct(b, e); + this->size = newSize; + } +}; + +} // namespace QtPrivate + +template +struct QArrayDataOps + : QtPrivate::QCommonArrayOps +{ +}; + +QT_END_NAMESPACE + +#endif // include guard diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qarraydatapointer.h b/qt/6.8.1/msvc2022_64/include/QtCore/qarraydatapointer.h new file mode 100644 index 0000000000000000000000000000000000000000..29e8bf7a5ac8f0a0c0322d80436e81ae65622fb1 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qarraydatapointer.h @@ -0,0 +1,530 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QARRAYDATAPOINTER_H +#define QARRAYDATAPOINTER_H + +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +template +struct QArrayDataPointer +{ +private: + typedef QTypedArrayData Data; + typedef QArrayDataOps DataOps; + +public: + enum { + pass_parameter_by_value = + std::is_arithmetic::value || std::is_pointer::value || std::is_enum::value + }; + + typedef typename std::conditional::type parameter_type; + + Q_NODISCARD_CTOR + constexpr QArrayDataPointer() noexcept + : d(nullptr), ptr(nullptr), size(0) + { + } + + Q_NODISCARD_CTOR + QArrayDataPointer(const QArrayDataPointer &other) noexcept + : d(other.d), ptr(other.ptr), size(other.size) + { + ref(); + } + + Q_NODISCARD_CTOR + constexpr QArrayDataPointer(Data *header, T *adata, qsizetype n = 0) noexcept + : d(header), ptr(adata), size(n) + { + } + + Q_NODISCARD_CTOR + explicit QArrayDataPointer(std::pair *, T *> adata, qsizetype n = 0) noexcept + : d(adata.first), ptr(adata.second), size(n) + { + } + + Q_NODISCARD_CTOR explicit + QArrayDataPointer(qsizetype alloc, qsizetype n = 0, + QArrayData::AllocationOption option = QArrayData::KeepSize) + : QArrayDataPointer(Data::allocate(alloc, option), n) + { + } + + Q_NODISCARD_CTOR + static QArrayDataPointer fromRawData(const T *rawData, qsizetype length) noexcept + { + Q_ASSERT(rawData || !length); + return { nullptr, const_cast(rawData), length }; + } + + QArrayDataPointer &operator=(const QArrayDataPointer &other) noexcept + { + QArrayDataPointer tmp(other); + this->swap(tmp); + return *this; + } + + Q_NODISCARD_CTOR + QArrayDataPointer(QArrayDataPointer &&other) noexcept + : d(std::exchange(other.d, nullptr)), + ptr(std::exchange(other.ptr, nullptr)), + size(std::exchange(other.size, 0)) + { + } + + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QArrayDataPointer) + + DataOps &operator*() noexcept + { + return *static_cast(this); + } + + DataOps *operator->() noexcept + { + return static_cast(this); + } + + const DataOps &operator*() const noexcept + { + return *static_cast(this); + } + + const DataOps *operator->() const noexcept + { + return static_cast(this); + } + + ~QArrayDataPointer() + { + if (!deref()) { + (*this)->destroyAll(); + free(d); + } + } + + bool isNull() const noexcept + { + return !ptr; + } + + T *data() noexcept { return ptr; } + const T *data() const noexcept { return ptr; } + + T *begin() noexcept { return data(); } + T *end() noexcept { return data() + size; } + const T *begin() const noexcept { return data(); } + const T *end() const noexcept { return data() + size; } + const T *constBegin() const noexcept { return data(); } + const T *constEnd() const noexcept { return data() + size; } + + void swap(QArrayDataPointer &other) noexcept + { + qt_ptr_swap(d, other.d); + qt_ptr_swap(ptr, other.ptr); + std::swap(size, other.size); + } + + void clear() noexcept(std::is_nothrow_destructible::value) + { + QArrayDataPointer tmp; + swap(tmp); + } + + void detach(QArrayDataPointer *old = nullptr) + { + if (needsDetach()) + reallocateAndGrow(QArrayData::GrowsAtEnd, 0, old); + } + + /*! \internal + + Reinterprets the data of this QArrayDataPointer to type X. It's the + caller's responsibility to ensure that the data contents are valid and + properly aligned, particularly if T and X are not trivial types (i.e, + don't do that). The current size is kept and the allocated capacity is + updated to account for the difference in the element type's size. + + This is used in QString::fromLatin1 to perform in-place conversion of + QString to QByteArray. + */ + template QArrayDataPointer reinterpreted() && + { + if (sizeof(T) != sizeof(X)) { + Q_ASSERT(!d->isShared()); + d->alloc = d->alloc * sizeof(T) / sizeof(X); + } + auto od = reinterpret_cast *>(std::exchange(d, nullptr)); + auto optr = reinterpret_cast(std::exchange(ptr, nullptr)); + return { od, optr, std::exchange(size, 0) }; + } + + /*! \internal + + Detaches this (optionally) and grows to accommodate the free space for + \a n elements at the required side. The side is determined from \a pos. + + \a data pointer can be provided when the caller knows that \a data + points into range [this->begin(), this->end()). In case it is, *data + would be updated so that it continues to point to the element it was + pointing to before the data move. if \a data does not point into range, + one can/should pass \c nullptr. + + Similarly to \a data, \a old, pointer to a default-constructed QADP, can + be provided when the caller expects to e.g. copy the data from this to + itself: + \code + QList list(5); + qsizetype pos = getArbitraryPos(); + list.insert(pos, list.begin(), list.end()); + \endcode + + The default rule would be: \a data and \a old must either both be valid + pointers, or both equal to \c nullptr. + */ + void detachAndGrow(QArrayData::GrowthPosition where, qsizetype n, const T **data, + QArrayDataPointer *old) + { + const bool detach = needsDetach(); + bool readjusted = false; + if (!detach) { + if (!n || (where == QArrayData::GrowsAtBeginning && freeSpaceAtBegin() >= n) + || (where == QArrayData::GrowsAtEnd && freeSpaceAtEnd() >= n)) + return; + readjusted = tryReadjustFreeSpace(where, n, data); + Q_ASSERT(!readjusted + || (where == QArrayData::GrowsAtBeginning && freeSpaceAtBegin() >= n) + || (where == QArrayData::GrowsAtEnd && freeSpaceAtEnd() >= n)); + } + + if (!readjusted) + reallocateAndGrow(where, n, old); + } + + /*! \internal + + Reallocates to accommodate the free space for \a n elements at the + required side. The side is determined from \a pos. Might also shrink + when n < 0. + */ + Q_NEVER_INLINE void reallocateAndGrow(QArrayData::GrowthPosition where, qsizetype n, + QArrayDataPointer *old = nullptr) + { + if constexpr (QTypeInfo::isRelocatable && alignof(T) <= alignof(std::max_align_t)) { + if (where == QArrayData::GrowsAtEnd && !old && !needsDetach() && n > 0) { + (*this)->reallocate(constAllocatedCapacity() - freeSpaceAtEnd() + n, QArrayData::Grow); // fast path + return; + } + } + + QArrayDataPointer dp(allocateGrow(*this, n, where)); + if (n > 0) + Q_CHECK_PTR(dp.data()); + if (where == QArrayData::GrowsAtBeginning) { + Q_ASSERT(dp.freeSpaceAtBegin() >= n); + } else { + Q_ASSERT(dp.freeSpaceAtEnd() >= n); + } + if (size) { + qsizetype toCopy = size; + if (n < 0) + toCopy += n; + if (needsDetach() || old) + dp->copyAppend(begin(), begin() + toCopy); + else + dp->moveAppend(begin(), begin() + toCopy); + Q_ASSERT(dp.size == toCopy); + } + + swap(dp); + if (old) + old->swap(dp); + } + + /*! \internal + + Attempts to relocate [begin(), end()) to accommodate the free space for + \a n elements at the required side. The side is determined from \a pos. + + Returns \c true if the internal data is moved. Returns \c false when + there is no point in moving the data or the move is impossible. If \c + false is returned, it is the responsibility of the caller to figure out + how to accommodate the free space for \a n elements at \a pos. + + This function expects that certain preconditions are met, e.g. the + detach is not needed, n > 0 and so on. This is intentional to reduce the + number of if-statements when the caller knows that preconditions would + be satisfied. + + \sa reallocateAndGrow + */ + bool tryReadjustFreeSpace(QArrayData::GrowthPosition pos, qsizetype n, const T **data = nullptr) + { + Q_ASSERT(!this->needsDetach()); + Q_ASSERT(n > 0); + Q_ASSERT((pos == QArrayData::GrowsAtEnd && this->freeSpaceAtEnd() < n) + || (pos == QArrayData::GrowsAtBeginning && this->freeSpaceAtBegin() < n)); + + const qsizetype capacity = this->constAllocatedCapacity(); + const qsizetype freeAtBegin = this->freeSpaceAtBegin(); + const qsizetype freeAtEnd = this->freeSpaceAtEnd(); + + qsizetype dataStartOffset = 0; + // algorithm: + // a. GrowsAtEnd: relocate if space at begin AND size < (capacity * 2) / 3 + // [all goes to free space at end]: + // new free space at begin = 0 + // + // b. GrowsAtBeginning: relocate if space at end AND size < capacity / 3 + // [balance the free space]: + // new free space at begin = n + (total free space - n) / 2 + if (pos == QArrayData::GrowsAtEnd && freeAtBegin >= n + && ((3 * this->size) < (2 * capacity))) { + // dataStartOffset = 0; - done in declaration + } else if (pos == QArrayData::GrowsAtBeginning && freeAtEnd >= n + && ((3 * this->size) < capacity)) { + // total free space == capacity - size + dataStartOffset = n + qMax(0, (capacity - this->size - n) / 2); + } else { + // nothing to do otherwise + return false; + } + + relocate(dataStartOffset - freeAtBegin, data); + + Q_ASSERT((pos == QArrayData::GrowsAtEnd && this->freeSpaceAtEnd() >= n) + || (pos == QArrayData::GrowsAtBeginning && this->freeSpaceAtBegin() >= n)); + return true; + } + + /*! \internal + + Relocates [begin(), end()) by \a offset and updates \a data if it is not + \c nullptr and points into [begin(), end()). + */ + void relocate(qsizetype offset, const T **data = nullptr) + { + T *res = this->ptr + offset; + QtPrivate::q_relocate_overlap_n(this->ptr, this->size, res); + // first update data pointer, then this->ptr + if (data && QtPrivate::q_points_into_range(*data, *this)) + *data += offset; + this->ptr = res; + } + + template + void assign(InputIterator first, InputIterator last, Projection proj = {}) + { + // This function only provides the basic exception guarantee. + constexpr bool IsFwdIt = std::is_convertible_v< + typename std::iterator_traits::iterator_category, + std::forward_iterator_tag>; + constexpr bool IsIdentity = std::is_same_v; + + if constexpr (IsFwdIt) { + const qsizetype n = std::distance(first, last); + if (needsDetach() || n > constAllocatedCapacity()) { + QArrayDataPointer allocated(detachCapacity(n)); + swap(allocated); + } + } else if (needsDetach()) { + QArrayDataPointer allocated(allocatedCapacity()); + swap(allocated); + // We don't want to copy data that we know we'll overwrite + } + + auto offset = freeSpaceAtBegin(); + const auto capacityBegin = begin() - offset; + const auto prependBufferEnd = begin(); + + if constexpr (!std::is_nothrow_constructible_v) { + // If construction can throw, and we have freeSpaceAtBegin(), + // it's easiest to just clear the container and start fresh. + // The alternative would be to keep track of two active, disjoint ranges. + if (offset) { + (*this)->truncate(0); + setBegin(capacityBegin); + offset = 0; + } + } + + auto dst = capacityBegin; + const auto dend = end(); + if (offset) { // avoids dead stores + setBegin(capacityBegin); // undo prepend optimization + + // By construction, the following loop is nothrow! + // (otherwise, we can't reach here) + // Assumes InputIterator operations don't throw. + // (but we can't statically assert that, as these operations + // have preconditons, so typically aren't noexcept) + while (true) { + if (dst == prependBufferEnd) { // ran out of prepend buffer space + size += offset; + // we now have a contiguous buffer, continue with the main loop: + break; + } + if (first == last) { // ran out of elements to assign + std::destroy(prependBufferEnd, dend); + size = dst - begin(); + return; + } + // construct element in prepend buffer + q20::construct_at(dst, std::invoke(proj, *first)); + ++dst; + ++first; + } + } + + while (true) { + if (first == last) { // ran out of elements to assign + std::destroy(dst, dend); + break; + } + if (dst == dend) { // ran out of existing elements to overwrite + if constexpr (IsFwdIt && IsIdentity) { + dst = std::uninitialized_copy(first, last, dst); + break; + } else if constexpr (IsFwdIt && !IsIdentity + && std::is_nothrow_constructible_v) { + for (; first != last; ++dst, ++first) // uninitialized_copy with projection + q20::construct_at(dst, std::invoke(proj, *first)); + break; + } else { + do { + (*this)->emplace(size, std::invoke(proj, *first)); + } while (++first != last); + return; // size() is already correct (and dst invalidated)! + } + } + *dst = std::invoke(proj, *first); // overwrite existing element + ++dst; + ++first; + } + size = dst - begin(); + } + + QArrayDataPointer sliced(qsizetype pos, qsizetype n) const & + { + QArrayDataPointer result(n); + std::uninitialized_copy_n(begin() + pos, n, result.begin()); + result.size = n; + return result; + } + + QArrayDataPointer sliced(qsizetype pos, qsizetype n) && + { + if (needsDetach()) + return sliced(pos, n); + T *newBeginning = begin() + pos; + std::destroy(begin(), newBeginning); + std::destroy(newBeginning + n, end()); + setBegin(newBeginning); + size = n; + return std::move(*this); + } + + // forwards from QArrayData + qsizetype allocatedCapacity() noexcept { return d ? d->allocatedCapacity() : 0; } + qsizetype constAllocatedCapacity() const noexcept { return d ? d->constAllocatedCapacity() : 0; } + void ref() noexcept { if (d) d->ref(); } + bool deref() noexcept { return !d || d->deref(); } + bool isMutable() const noexcept { return d; } + bool isShared() const noexcept { return !d || d->isShared(); } + bool isSharedWith(const QArrayDataPointer &other) const noexcept { return d && d == other.d; } + bool needsDetach() const noexcept { return !d || d->needsDetach(); } + qsizetype detachCapacity(qsizetype newSize) const noexcept { return d ? d->detachCapacity(newSize) : newSize; } + const typename Data::ArrayOptions flags() const noexcept { return d ? d->flags : Data::ArrayOptionDefault; } + void setFlag(typename Data::ArrayOptions f) noexcept { Q_ASSERT(d); d->flags |= f; } + void clearFlag(typename Data::ArrayOptions f) noexcept { if (d) d->flags &= ~f; } + + Data *d_ptr() noexcept { return d; } + void setBegin(T *begin) noexcept { ptr = begin; } + + qsizetype freeSpaceAtBegin() const noexcept + { + if (d == nullptr) + return 0; + return this->ptr - Data::dataStart(d, alignof(typename Data::AlignmentDummy)); + } + + qsizetype freeSpaceAtEnd() const noexcept + { + if (d == nullptr) + return 0; + return d->constAllocatedCapacity() - freeSpaceAtBegin() - this->size; + } + + // allocate and grow. Ensure that at the minimum requiredSpace is available at the requested end + static QArrayDataPointer allocateGrow(const QArrayDataPointer &from, qsizetype n, QArrayData::GrowthPosition position) + { + // calculate new capacity. We keep the free capacity at the side that does not have to grow + // to avoid quadratic behavior with mixed append/prepend cases + + // use qMax below, because constAllocatedCapacity() can be 0 when using fromRawData() + qsizetype minimalCapacity = qMax(from.size, from.constAllocatedCapacity()) + n; + // subtract the free space at the side we want to allocate. This ensures that the total size requested is + // the existing allocation at the other side + size + n. + minimalCapacity -= (position == QArrayData::GrowsAtEnd) ? from.freeSpaceAtEnd() : from.freeSpaceAtBegin(); + qsizetype capacity = from.detachCapacity(minimalCapacity); + const bool grows = capacity > from.constAllocatedCapacity(); + auto [header, dataPtr] = Data::allocate(capacity, grows ? QArrayData::Grow : QArrayData::KeepSize); + const bool valid = header != nullptr && dataPtr != nullptr; + if (!valid) + return QArrayDataPointer(header, dataPtr); + + // Idea: * when growing backwards, adjust pointer to prepare free space at the beginning + // * when growing forward, adjust by the previous data pointer offset + dataPtr += (position == QArrayData::GrowsAtBeginning) + ? n + qMax(0, (header->alloc - from.size - n) / 2) + : from.freeSpaceAtBegin(); + header->flags = from.flags(); + return QArrayDataPointer(header, dataPtr); + } + + friend bool operator==(const QArrayDataPointer &lhs, const QArrayDataPointer &rhs) noexcept + { + return lhs.data() == rhs.data() && lhs.size == rhs.size; + } + + friend bool operator!=(const QArrayDataPointer &lhs, const QArrayDataPointer &rhs) noexcept + { + return lhs.data() != rhs.data() || lhs.size != rhs.size; + } + + Data *d; + T *ptr; + qsizetype size; +}; + +template +inline void swap(QArrayDataPointer &p1, QArrayDataPointer &p2) noexcept +{ + p1.swap(p2); +} + +//////////////////////////////////////////////////////////////////////////////// +// Q_ARRAY_LITERAL + +// The idea here is to place a (read-only) copy of header and array data in an +// mmappable portion of the executable (typically, .rodata section). + +// Hide array inside a lambda +#define Q_ARRAY_LITERAL(Type, ...) \ + ([]() -> QArrayDataPointer { \ + static Type const data[] = { __VA_ARGS__ }; \ + return QArrayDataPointer::fromRawData(const_cast(data), std::size(data)); \ + }()) +/**/ + +QT_END_NAMESPACE + +#endif // include guard diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qassert.h b/qt/6.8.1/msvc2022_64/include/QtCore/qassert.h new file mode 100644 index 0000000000000000000000000000000000000000..d52b1ae05afbd380bd9b54adcd970b689c61bf6a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qassert.h @@ -0,0 +1,116 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QASSERT_H +#define QASSERT_H + +#include +#include +#include +#include + +#if 0 +#pragma qt_class(QtAssert) +#pragma qt_sync_stop_processing +#endif + +QT_BEGIN_NAMESPACE + +#if defined(__cplusplus) + +#if !defined(Q_CC_MSVC_ONLY) +Q_NORETURN +#endif +Q_DECL_COLD_FUNCTION +Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line) noexcept; + +#if !defined(Q_ASSERT) +# if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) +# define Q_ASSERT(cond) static_cast(false && (cond)) +# else +# define Q_ASSERT(cond) ((cond) ? static_cast(0) : qt_assert(#cond, __FILE__, __LINE__)) +# endif +#endif + +#if !defined(Q_CC_MSVC_ONLY) +Q_NORETURN +#endif +Q_DECL_COLD_FUNCTION +Q_CORE_EXPORT +void qt_assert_x(const char *where, const char *what, const char *file, int line) noexcept; + +#if !defined(Q_ASSERT_X) +# if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) +# define Q_ASSERT_X(cond, where, what) static_cast(false && (cond)) +# else +# define Q_ASSERT_X(cond, where, what) ((cond) ? static_cast(0) : qt_assert_x(where, what, __FILE__, __LINE__)) +# endif +#endif + +Q_NORETURN Q_CORE_EXPORT void qt_check_pointer(const char *, int) noexcept; +Q_NORETURN Q_DECL_COLD_FUNCTION +Q_CORE_EXPORT void qBadAlloc(); + +#ifdef QT_NO_EXCEPTIONS +# if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) +# define Q_CHECK_PTR(p) qt_noop() +# else +# define Q_CHECK_PTR(p) do {if (!(p)) qt_check_pointer(__FILE__,__LINE__);} while (false) +# endif +#else +# define Q_CHECK_PTR(p) do { if (!(p)) qBadAlloc(); } while (false) +#endif + +template +inline T *q_check_ptr(T *p) { Q_CHECK_PTR(p); return p; } + +// Q_UNREACHABLE_IMPL() and Q_ASSUME_IMPL() used below are defined in qcompilerdetection.h +#define Q_UNREACHABLE() \ + do {\ + Q_ASSERT_X(false, "Q_UNREACHABLE()", "Q_UNREACHABLE was reached");\ + Q_UNREACHABLE_IMPL();\ + } while (false) + +#ifndef Q_UNREACHABLE_RETURN +# ifdef Q_COMPILER_COMPLAINS_ABOUT_RETURN_AFTER_UNREACHABLE +# define Q_UNREACHABLE_RETURN(...) Q_UNREACHABLE() +# else +# define Q_UNREACHABLE_RETURN(...) do { Q_UNREACHABLE(); return __VA_ARGS__; } while (0) +# endif +#endif + +Q_DECL_DEPRECATED_X("Q_ASSUME() is deprecated because it can produce worse code than when it's absent; " + "use C++23 [[assume]] instead") +inline bool qt_assume_is_deprecated(bool cond) noexcept { return cond; } +#define Q_ASSUME(Expr) \ + [] (bool valueOfExpression) {\ + Q_ASSERT_X(valueOfExpression, "Q_ASSUME()", "Assumption in Q_ASSUME(\"" #Expr "\") was not correct");\ + Q_ASSUME_IMPL(valueOfExpression);\ + }(qt_assume_is_deprecated(Expr)) + +// Don't use these in C++ mode, use static_assert directly. +// These are here only to keep old code compiling. +# define Q_STATIC_ASSERT(Condition) static_assert(bool(Condition), #Condition) +# define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message) + +#elif defined(Q_COMPILER_STATIC_ASSERT) +// C11 mode - using the _S version in case doesn't do the right thing +# define Q_STATIC_ASSERT(Condition) _Static_assert(!!(Condition), #Condition) +# define Q_STATIC_ASSERT_X(Condition, Message) _Static_assert(!!(Condition), Message) +#else +// C89 & C99 version +# define Q_STATIC_ASSERT_PRIVATE_JOIN(A, B) Q_STATIC_ASSERT_PRIVATE_JOIN_IMPL(A, B) +# define Q_STATIC_ASSERT_PRIVATE_JOIN_IMPL(A, B) A ## B +# ifdef __COUNTER__ +# define Q_STATIC_ASSERT(Condition) \ + typedef char Q_STATIC_ASSERT_PRIVATE_JOIN(q_static_assert_result, __COUNTER__) [(Condition) ? 1 : -1]; +# else +# define Q_STATIC_ASSERT(Condition) \ + typedef char Q_STATIC_ASSERT_PRIVATE_JOIN(q_static_assert_result, __LINE__) [(Condition) ? 1 : -1]; +# endif /* __COUNTER__ */ +# define Q_STATIC_ASSERT_X(Condition, Message) Q_STATIC_ASSERT(Condition) +#endif // __cplusplus + +QT_END_NAMESPACE + +#endif // QASSERT_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qassociativeiterable.h b/qt/6.8.1/msvc2022_64/include/QtCore/qassociativeiterable.h new file mode 100644 index 0000000000000000000000000000000000000000..8051c64f20f3fa7c61e5d4b97e117ae0fd2c9b24 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qassociativeiterable.h @@ -0,0 +1,173 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QASSOCIATIVEITERABLE_H +#define QASSOCIATIVEITERABLE_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class Q_CORE_EXPORT QAssociativeIterator : public QIterator +{ +public: + using key_type = QVariant; + using mapped_type = QVariant; + using reference = QVariantRef; + using pointer = QVariantPointer; + + QAssociativeIterator(QIterator &&it) + : QIterator(std::move(it)) + {} + + QVariant key() const; + QVariantRef value() const; + + QVariantRef operator*() const; + QVariantPointer operator->() const; +}; + +class Q_CORE_EXPORT QAssociativeConstIterator : public QConstIterator +{ +public: + using key_type = QVariant; + using mapped_type = QVariant; + using reference = const QVariant &; + using pointer = QVariantConstPointer; + + QAssociativeConstIterator(QConstIterator &&it) + : QConstIterator(std::move(it)) + {} + + QVariant key() const; + QVariant value() const; + + QVariant operator*() const; + QVariantConstPointer operator->() const; +}; + +class Q_CORE_EXPORT QAssociativeIterable : public QIterable +{ +public: + using iterator = QTaggedIterator; + using const_iterator = QTaggedIterator; + + using RandomAccessIterator = QTaggedIterator; + using BidirectionalIterator = QTaggedIterator; + using ForwardIterator = QTaggedIterator; + using InputIterator = QTaggedIterator; + + using RandomAccessConstIterator = QTaggedIterator; + using BidirectionalConstIterator = QTaggedIterator; + using ForwardConstIterator = QTaggedIterator; + using InputConstIterator = QTaggedIterator; + + template + QAssociativeIterable(const T *p) + : QIterable(QMetaAssociation::fromContainer(), p) + { + } + + template + QAssociativeIterable(T *p) + : QIterable(QMetaAssociation::fromContainer(), p) + { + } + + QAssociativeIterable() + : QIterable(QMetaAssociation(), nullptr) + { + } + + template + QAssociativeIterable(const QMetaAssociation &metaAssociation, Pointer iterable) + : QIterable(metaAssociation, iterable) + { + } + + // ### Qt7: Pass QMetaType as value rather than const ref. + QAssociativeIterable(const QMetaAssociation &metaAssociation, const QMetaType &metaType, + void *iterable) + : QIterable(metaAssociation, metaType.alignOf(), iterable) + { + } + + // ### Qt7: Pass QMetaType as value rather than const ref. + QAssociativeIterable(const QMetaAssociation &metaAssociation, const QMetaType &metaType, + const void *iterable) + : QIterable(metaAssociation, metaType.alignOf(), iterable) + { + } + + QAssociativeIterable(QIterable &&other) : QIterable(std::move(other)) {} + + QAssociativeIterable &operator=(QIterable &&other) + { + QIterable::operator=(std::move(other)); + return *this; + } + + const_iterator begin() const { return constBegin(); } + const_iterator end() const { return constEnd(); } + + const_iterator constBegin() const { return const_iterator(QIterable::constBegin()); } + const_iterator constEnd() const { return const_iterator(QIterable::constEnd()); } + + iterator mutableBegin() { return iterator(QIterable::mutableBegin()); } + iterator mutableEnd() { return iterator(QIterable::mutableEnd()); } + + const_iterator find(const QVariant &key) const; + const_iterator constFind(const QVariant &key) const { return find(key); } + iterator mutableFind(const QVariant &key); + + bool containsKey(const QVariant &key); + void insertKey(const QVariant &key); + void removeKey(const QVariant &key); + + QVariant value(const QVariant &key) const; + void setValue(const QVariant &key, const QVariant &mapped); +}; + +template<> +inline QVariantRef::operator QVariant() const +{ + if (m_pointer == nullptr) + return QVariant(); + + const auto metaAssociation = m_pointer->metaContainer(); + const QMetaType metaType(metaAssociation.mappedMetaType()); + if (!metaType.isValid()) + return m_pointer->key(); + + QVariant v(metaType); + metaAssociation.mappedAtIterator(m_pointer->constIterator(), + metaType == QMetaType::fromType() ? &v : v.data()); + return v; +} + +template<> +inline QVariantRef &QVariantRef::operator=( + const QVariant &value) +{ + if (m_pointer == nullptr) + return *this; + + const auto metaAssociation = m_pointer->metaContainer(); + const QMetaType metaType(metaAssociation.mappedMetaType()); + if (metaType.isValid()) { + QtPrivate::QVariantTypeCoercer coercer; + metaAssociation.setMappedAtIterator(m_pointer->constIterator(), + coercer.coerce(value, metaType)); + } + + return *this; +} + +Q_DECLARE_TYPEINFO(QAssociativeIterable, Q_RELOCATABLE_TYPE); +Q_DECLARE_TYPEINFO(QAssociativeIterable::iterator, Q_RELOCATABLE_TYPE); +Q_DECLARE_TYPEINFO(QAssociativeIterable::const_iterator, Q_RELOCATABLE_TYPE); + +QT_END_NAMESPACE + +#endif // QASSOCIATIVEITERABLE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qatomic.h b/qt/6.8.1/msvc2022_64/include/QtCore/qatomic.h new file mode 100644 index 0000000000000000000000000000000000000000..4586155862c3d04ff4a72a0ef51187695d3d1577 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qatomic.h @@ -0,0 +1,210 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QATOMIC_H +#define QATOMIC_H + +#include + +QT_BEGIN_NAMESPACE + +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wextra") + +// High-level atomic integer operations +template +class QAtomicInteger : public QBasicAtomicInteger +{ +public: + // Non-atomic API + constexpr QAtomicInteger(T value = 0) noexcept : QBasicAtomicInteger(value) {} + + inline QAtomicInteger(const QAtomicInteger &other) noexcept + : QBasicAtomicInteger() + { + this->storeRelease(other.loadAcquire()); + } + + inline QAtomicInteger &operator=(const QAtomicInteger &other) noexcept + { + this->storeRelease(other.loadAcquire()); + return *this; + } + +#ifdef Q_QDOC + T loadRelaxed() const; + T loadAcquire() const; + void storeRelaxed(T newValue); + void storeRelease(T newValue); + + operator T() const; + QAtomicInteger &operator=(T); + + static constexpr bool isReferenceCountingNative(); + static constexpr bool isReferenceCountingWaitFree(); + + bool ref(); + bool deref(); + + static constexpr bool isTestAndSetNative(); + static constexpr bool isTestAndSetWaitFree(); + + bool testAndSetRelaxed(T expectedValue, T newValue); + bool testAndSetAcquire(T expectedValue, T newValue); + bool testAndSetRelease(T expectedValue, T newValue); + bool testAndSetOrdered(T expectedValue, T newValue); + + bool testAndSetRelaxed(T expectedValue, T newValue, T ¤tValue); + bool testAndSetAcquire(T expectedValue, T newValue, T ¤tValue); + bool testAndSetRelease(T expectedValue, T newValue, T ¤tValue); + bool testAndSetOrdered(T expectedValue, T newValue, T ¤tValue); + + static constexpr bool isFetchAndStoreNative(); + static constexpr bool isFetchAndStoreWaitFree(); + + T fetchAndStoreRelaxed(T newValue); + T fetchAndStoreAcquire(T newValue); + T fetchAndStoreRelease(T newValue); + T fetchAndStoreOrdered(T newValue); + + static constexpr bool isFetchAndAddNative(); + static constexpr bool isFetchAndAddWaitFree(); + + T fetchAndAddRelaxed(T valueToAdd); + T fetchAndAddAcquire(T valueToAdd); + T fetchAndAddRelease(T valueToAdd); + T fetchAndAddOrdered(T valueToAdd); + + T fetchAndSubRelaxed(T valueToSub); + T fetchAndSubAcquire(T valueToSub); + T fetchAndSubRelease(T valueToSub); + T fetchAndSubOrdered(T valueToSub); + + T fetchAndOrRelaxed(T valueToOr); + T fetchAndOrAcquire(T valueToOr); + T fetchAndOrRelease(T valueToOr); + T fetchAndOrOrdered(T valueToOr); + + T fetchAndAndRelaxed(T valueToAnd); + T fetchAndAndAcquire(T valueToAnd); + T fetchAndAndRelease(T valueToAnd); + T fetchAndAndOrdered(T valueToAnd); + + T fetchAndXorRelaxed(T valueToXor); + T fetchAndXorAcquire(T valueToXor); + T fetchAndXorRelease(T valueToXor); + T fetchAndXorOrdered(T valueToXor); + + T operator++(); + T operator++(int); + T operator--(); + T operator--(int); + T operator+=(T value); + T operator-=(T value); + T operator|=(T value); + T operator&=(T value); + T operator^=(T value); +#endif +}; + +class QAtomicInt : public QAtomicInteger +{ +public: + // Non-atomic API + // We could use QT_COMPILER_INHERITING_CONSTRUCTORS, but we need only one; + // the implicit definition for all the others is fine. + constexpr QAtomicInt(int value = 0) noexcept : QAtomicInteger(value) {} +}; + +// High-level atomic pointer operations +template +class QAtomicPointer : public QBasicAtomicPointer +{ +public: + constexpr QAtomicPointer(T *value = nullptr) noexcept : QBasicAtomicPointer(value) {} + + inline QAtomicPointer(const QAtomicPointer &other) noexcept + : QBasicAtomicPointer() + { + this->storeRelease(other.loadAcquire()); + } + + inline QAtomicPointer &operator=(const QAtomicPointer &other) noexcept + { + this->storeRelease(other.loadAcquire()); + return *this; + } + +#ifdef Q_QDOC + T *loadAcquire() const; + T *loadRelaxed() const; + void storeRelaxed(T *newValue); + void storeRelease(T *newValue); + + static constexpr bool isTestAndSetNative(); + static constexpr bool isTestAndSetWaitFree(); + + bool testAndSetRelaxed(T *expectedValue, T *newValue); + bool testAndSetAcquire(T *expectedValue, T *newValue); + bool testAndSetRelease(T *expectedValue, T *newValue); + bool testAndSetOrdered(T *expectedValue, T *newValue); + + static constexpr bool isFetchAndStoreNative(); + static constexpr bool isFetchAndStoreWaitFree(); + + T *fetchAndStoreRelaxed(T *newValue); + T *fetchAndStoreAcquire(T *newValue); + T *fetchAndStoreRelease(T *newValue); + T *fetchAndStoreOrdered(T *newValue); + + static constexpr bool isFetchAndAddNative(); + static constexpr bool isFetchAndAddWaitFree(); + + T *fetchAndAddRelaxed(qptrdiff valueToAdd); + T *fetchAndAddAcquire(qptrdiff valueToAdd); + T *fetchAndAddRelease(qptrdiff valueToAdd); + T *fetchAndAddOrdered(qptrdiff valueToAdd); +#endif +}; + +QT_WARNING_POP + +/*! + This is a helper for the assignment operators of implicitly + shared classes. Your assignment operator should look like this: + + \snippet code/src.corelib.thread.qatomic.h 0 +*/ +template +inline void qAtomicAssign(T *&d, T *x) +{ + if (d == x) + return; + x->ref.ref(); + if (!d->ref.deref()) + delete d; + d = x; +} + +/*! + This is a helper for the detach method of implicitly shared + classes. Your private class needs a copy constructor which copies + the members and sets the refcount to 1. After that, your detach + function should look like this: + + \snippet code/src.corelib.thread.qatomic.h 1 +*/ +template +inline void qAtomicDetach(T *&d) +{ + if (d->ref.loadRelaxed() == 1) + return; + T *x = d; + d = new T(*d); + if (!x->ref.deref()) + delete x; +} + +QT_END_NAMESPACE +#endif // QATOMIC_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qatomic_cxx11.h b/qt/6.8.1/msvc2022_64/include/QtCore/qatomic_cxx11.h new file mode 100644 index 0000000000000000000000000000000000000000..0f2065811175d62cf29fe090e04e53a3f20070a4 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qatomic_cxx11.h @@ -0,0 +1,464 @@ +// Copyright (C) 2011 Thiago Macieira +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QATOMIC_CXX11_H +#define QATOMIC_CXX11_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#if 0 +// silence syncqt warnings +QT_END_NAMESPACE +#pragma qt_sync_skip_header_check +#pragma qt_sync_stop_processing +#endif + +/* Attempt to detect whether the atomic operations exist in hardware + * or whether they are emulated by way of a lock. + * + * C++11 29.4 [atomics.lockfree] p1 says + * + * The ATOMIC_..._LOCK_FREE macros indicate the lock-free property of the + * corresponding atomic types, with the signed and unsigned variants grouped + * together. The properties also apply to the corresponding (partial) + * specializations of the atomic template. A value of 0 indicates that the + * types are never lock-free. A value of 1 indicates that the types are + * sometimes lock-free. A value of 2 indicates that the types are always + * lock-free. + * + * We have a problem when the value is 1: we'd need to check at runtime, but + * QAtomicInteger requires a constexpr answer (defect introduced in Qt 5.0). So + * we'll err in the side of caution and say it isn't. + */ +template struct QAtomicTraits +{ static inline bool isLockFree(); }; + +#define Q_ATOMIC_INT32_IS_SUPPORTED +#if ATOMIC_INT_LOCK_FREE == 2 +# define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE +# define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE +# define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE +# define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE +# define Q_ATOMIC_INT32_REFERENCE_COUNTING_IS_ALWAYS_NATIVE +# define Q_ATOMIC_INT32_TEST_AND_SET_IS_ALWAYS_NATIVE +# define Q_ATOMIC_INT32_FETCH_AND_STORE_IS_ALWAYS_NATIVE +# define Q_ATOMIC_INT32_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +template <> inline bool QAtomicTraits<4>::isLockFree() +{ return true; } +#elif ATOMIC_INT_LOCK_FREE == 1 +# define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE +# define Q_ATOMIC_INT_TEST_AND_SET_IS_SOMETIMES_NATIVE +# define Q_ATOMIC_INT_FETCH_AND_STORE_IS_SOMETIMES_NATIVE +# define Q_ATOMIC_INT_FETCH_AND_ADD_IS_SOMETIMES_NATIVE +# define Q_ATOMIC_INT32_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE +# define Q_ATOMIC_INT32_TEST_AND_SET_IS_SOMETIMES_NATIVE +# define Q_ATOMIC_INT32_FETCH_AND_STORE_IS_SOMETIMES_NATIVE +# define Q_ATOMIC_INT32_FETCH_AND_ADD_IS_SOMETIMES_NATIVE + +template <> inline bool QAtomicTraits<4>::isLockFree() +{ return false; } +#else +# define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NEVER_NATIVE +# define Q_ATOMIC_INT_TEST_AND_SET_IS_NEVER_NATIVE +# define Q_ATOMIC_INT_FETCH_AND_STORE_IS_NEVER_NATIVE +# define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NEVER_NATIVE +# define Q_ATOMIC_INT32_REFERENCE_COUNTING_IS_NEVER_NATIVE +# define Q_ATOMIC_INT32_TEST_AND_SET_IS_NEVER_NATIVE +# define Q_ATOMIC_INT32_FETCH_AND_STORE_IS_NEVER_NATIVE +# define Q_ATOMIC_INT32_FETCH_AND_ADD_IS_NEVER_NATIVE + +template <> inline bool QAtomicTraits<4>::isLockFree() +{ return false; } +#endif + +#if ATOMIC_POINTER_LOCK_FREE == 2 +# define Q_ATOMIC_POINTER_REFERENCE_COUNTING_IS_ALWAYS_NATIVE +# define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE +# define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE +# define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE +#elif ATOMIC_POINTER_LOCK_FREE == 1 +# define Q_ATOMIC_POINTER_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE +# define Q_ATOMIC_POINTER_TEST_AND_SET_IS_SOMETIMES_NATIVE +# define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_SOMETIMES_NATIVE +# define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_SOMETIMES_NATIVE +#else +# define Q_ATOMIC_POINTER_REFERENCE_COUNTING_IS_NEVER_NATIVE +# define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NEVER_NATIVE +# define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_NEVER_NATIVE +# define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NEVER_NATIVE +#endif + +template<> struct QAtomicOpsSupport<1> { enum { IsSupported = 1 }; }; +#define Q_ATOMIC_INT8_IS_SUPPORTED +#if ATOMIC_CHAR_LOCK_FREE == 2 +# define Q_ATOMIC_INT8_REFERENCE_COUNTING_IS_ALWAYS_NATIVE +# define Q_ATOMIC_INT8_TEST_AND_SET_IS_ALWAYS_NATIVE +# define Q_ATOMIC_INT8_FETCH_AND_STORE_IS_ALWAYS_NATIVE +# define Q_ATOMIC_INT8_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +template <> inline bool QAtomicTraits<1>::isLockFree() +{ return true; } +#elif ATOMIC_CHAR_LOCK_FREE == 1 +# define Q_ATOMIC_INT8_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE +# define Q_ATOMIC_INT8_TEST_AND_SET_IS_SOMETIMES_NATIVE +# define Q_ATOMIC_INT8_FETCH_AND_STORE_IS_SOMETIMES_NATIVE +# define Q_ATOMIC_INT8_FETCH_AND_ADD_IS_SOMETIMES_NATIVE + +template <> inline bool QAtomicTraits<1>::isLockFree() +{ return false; } +#else +# define Q_ATOMIC_INT8_REFERENCE_COUNTING_IS_NEVER_NATIVE +# define Q_ATOMIC_INT8_TEST_AND_SET_IS_NEVER_NATIVE +# define Q_ATOMIC_INT8_FETCH_AND_STORE_IS_NEVER_NATIVE +# define Q_ATOMIC_INT8_FETCH_AND_ADD_IS_NEVER_NATIVE + +template <> bool QAtomicTraits<1>::isLockFree() +{ return false; } +#endif + +template<> struct QAtomicOpsSupport<2> { enum { IsSupported = 1 }; }; +#define Q_ATOMIC_INT16_IS_SUPPORTED +#if ATOMIC_SHORT_LOCK_FREE == 2 +# define Q_ATOMIC_INT16_REFERENCE_COUNTING_IS_ALWAYS_NATIVE +# define Q_ATOMIC_INT16_TEST_AND_SET_IS_ALWAYS_NATIVE +# define Q_ATOMIC_INT16_FETCH_AND_STORE_IS_ALWAYS_NATIVE +# define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +template <> inline bool QAtomicTraits<2>::isLockFree() +{ return false; } +#elif ATOMIC_SHORT_LOCK_FREE == 1 +# define Q_ATOMIC_INT16_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE +# define Q_ATOMIC_INT16_TEST_AND_SET_IS_SOMETIMES_NATIVE +# define Q_ATOMIC_INT16_FETCH_AND_STORE_IS_SOMETIMES_NATIVE +# define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_SOMETIMES_NATIVE + +template <> inline bool QAtomicTraits<2>::isLockFree() +{ return false; } +#else +# define Q_ATOMIC_INT16_REFERENCE_COUNTING_IS_NEVER_NATIVE +# define Q_ATOMIC_INT16_TEST_AND_SET_IS_NEVER_NATIVE +# define Q_ATOMIC_INT16_FETCH_AND_STORE_IS_NEVER_NATIVE +# define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_NEVER_NATIVE + +template <> inline bool QAtomicTraits<2>::isLockFree() +{ return false; } +#endif + +#if !defined(QT_BOOTSTRAPPED) && QT_CONFIG(std_atomic64) +template<> struct QAtomicOpsSupport<8> { enum { IsSupported = 1 }; }; +# define Q_ATOMIC_INT64_IS_SUPPORTED +# if ATOMIC_LLONG_LOCK_FREE == 2 +# define Q_ATOMIC_INT64_REFERENCE_COUNTING_IS_ALWAYS_NATIVE +# define Q_ATOMIC_INT64_TEST_AND_SET_IS_ALWAYS_NATIVE +# define Q_ATOMIC_INT64_FETCH_AND_STORE_IS_ALWAYS_NATIVE +# define Q_ATOMIC_INT64_FETCH_AND_ADD_IS_ALWAYS_NATIVE + +template <> inline bool QAtomicTraits<8>::isLockFree() +{ return true; } +# elif ATOMIC_LLONG_LOCK_FREE == 1 +# define Q_ATOMIC_INT64_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE +# define Q_ATOMIC_INT64_TEST_AND_SET_IS_SOMETIMES_NATIVE +# define Q_ATOMIC_INT64_FETCH_AND_STORE_IS_SOMETIMES_NATIVE +# define Q_ATOMIC_INT64_FETCH_AND_ADD_IS_SOMETIMES_NATIVE + +template <> inline bool QAtomicTraits<8>::isLockFree() +{ return false; } +# else +# define Q_ATOMIC_INT64_REFERENCE_COUNTING_IS_NEVER_NATIVE +# define Q_ATOMIC_INT64_TEST_AND_SET_IS_NEVER_NATIVE +# define Q_ATOMIC_INT64_FETCH_AND_STORE_IS_NEVER_NATIVE +# define Q_ATOMIC_INT64_FETCH_AND_ADD_IS_NEVER_NATIVE + +template <> inline bool QAtomicTraits<8>::isLockFree() +{ return false; } +# endif +#endif + +template struct QAtomicOps +{ + typedef std::atomic Type; + + template static inline + T load(const std::atomic &_q_value) noexcept + { + return _q_value.load(std::memory_order_relaxed); + } + + template static inline + T load(const volatile std::atomic &_q_value) noexcept + { + return _q_value.load(std::memory_order_relaxed); + } + + template static inline + T loadRelaxed(const std::atomic &_q_value) noexcept + { + return _q_value.load(std::memory_order_relaxed); + } + + template static inline + T loadRelaxed(const volatile std::atomic &_q_value) noexcept + { + return _q_value.load(std::memory_order_relaxed); + } + + template static inline + T loadAcquire(const std::atomic &_q_value) noexcept + { + return _q_value.load(std::memory_order_acquire); + } + + template static inline + T loadAcquire(const volatile std::atomic &_q_value) noexcept + { + return _q_value.load(std::memory_order_acquire); + } + + template static inline + void store(std::atomic &_q_value, T newValue) noexcept + { + _q_value.store(newValue, std::memory_order_relaxed); + } + + template static inline + void storeRelaxed(std::atomic &_q_value, T newValue) noexcept + { + _q_value.store(newValue, std::memory_order_relaxed); + } + + template static inline + void storeRelease(std::atomic &_q_value, T newValue) noexcept + { + _q_value.store(newValue, std::memory_order_release); + } + + static inline bool isReferenceCountingNative() noexcept { return isTestAndSetNative(); } + static inline constexpr bool isReferenceCountingWaitFree() noexcept { return false; } + template + static inline bool ref(std::atomic &_q_value) + { + /* Conceptually, we want to + * return ++_q_value != 0; + * However, that would be sequentially consistent, and thus stronger + * than what we need. Based on + * http://eel.is/c++draft/atomics.types.memop#6, we know that + * pre-increment is equivalent to fetch_add(1) + 1. Unlike + * pre-increment, fetch_add takes a memory order argument, so we can get + * the desired acquire-release semantics. + * One last gotcha is that fetch_add(1) + 1 would need to be converted + * back to T, because it's susceptible to integer promotion. To sidestep + * this issue and to avoid UB on signed overflow, we rewrite the + * expression to: + */ + return _q_value.fetch_add(1, std::memory_order_acq_rel) != T(-1); + } + + template + static inline bool deref(std::atomic &_q_value) noexcept + { + // compare with ref + return _q_value.fetch_sub(1, std::memory_order_acq_rel) != T(1); + } + + static inline bool isTestAndSetNative() noexcept + { return QAtomicTraits::isLockFree(); } + static inline constexpr bool isTestAndSetWaitFree() noexcept { return false; } + + template + static bool testAndSetRelaxed(std::atomic &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) noexcept + { + bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_relaxed, std::memory_order_relaxed); + if (currentValue) + *currentValue = expectedValue; + return tmp; + } + + template + static bool testAndSetAcquire(std::atomic &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) noexcept + { + bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_acquire, std::memory_order_acquire); + if (currentValue) + *currentValue = expectedValue; + return tmp; + } + + template + static bool testAndSetRelease(std::atomic &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) noexcept + { + bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_release, std::memory_order_relaxed); + if (currentValue) + *currentValue = expectedValue; + return tmp; + } + + template + static bool testAndSetOrdered(std::atomic &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) noexcept + { + bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_acq_rel, std::memory_order_acquire); + if (currentValue) + *currentValue = expectedValue; + return tmp; + } + + static inline bool isFetchAndStoreNative() noexcept { return isTestAndSetNative(); } + static inline constexpr bool isFetchAndStoreWaitFree() noexcept { return false; } + + template + static T fetchAndStoreRelaxed(std::atomic &_q_value, T newValue) noexcept + { + return _q_value.exchange(newValue, std::memory_order_relaxed); + } + + template + static T fetchAndStoreAcquire(std::atomic &_q_value, T newValue) noexcept + { + return _q_value.exchange(newValue, std::memory_order_acquire); + } + + template + static T fetchAndStoreRelease(std::atomic &_q_value, T newValue) noexcept + { + return _q_value.exchange(newValue, std::memory_order_release); + } + + template + static T fetchAndStoreOrdered(std::atomic &_q_value, T newValue) noexcept + { + return _q_value.exchange(newValue, std::memory_order_acq_rel); + } + + static inline bool isFetchAndAddNative() noexcept { return isTestAndSetNative(); } + static inline constexpr bool isFetchAndAddWaitFree() noexcept { return false; } + + template static inline + T fetchAndAddRelaxed(std::atomic &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) noexcept + { + return _q_value.fetch_add(valueToAdd, std::memory_order_relaxed); + } + + template static inline + T fetchAndAddAcquire(std::atomic &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) noexcept + { + return _q_value.fetch_add(valueToAdd, std::memory_order_acquire); + } + + template static inline + T fetchAndAddRelease(std::atomic &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) noexcept + { + return _q_value.fetch_add(valueToAdd, std::memory_order_release); + } + + template static inline + T fetchAndAddOrdered(std::atomic &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) noexcept + { + return _q_value.fetch_add(valueToAdd, std::memory_order_acq_rel); + } + + template static inline + T fetchAndSubRelaxed(std::atomic &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) noexcept + { + return _q_value.fetch_sub(valueToAdd, std::memory_order_relaxed); + } + + template static inline + T fetchAndSubAcquire(std::atomic &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) noexcept + { + return _q_value.fetch_sub(valueToAdd, std::memory_order_acquire); + } + + template static inline + T fetchAndSubRelease(std::atomic &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) noexcept + { + return _q_value.fetch_sub(valueToAdd, std::memory_order_release); + } + + template static inline + T fetchAndSubOrdered(std::atomic &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) noexcept + { + return _q_value.fetch_sub(valueToAdd, std::memory_order_acq_rel); + } + + template static inline + T fetchAndAndRelaxed(std::atomic &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) noexcept + { + return _q_value.fetch_and(valueToAdd, std::memory_order_relaxed); + } + + template static inline + T fetchAndAndAcquire(std::atomic &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) noexcept + { + return _q_value.fetch_and(valueToAdd, std::memory_order_acquire); + } + + template static inline + T fetchAndAndRelease(std::atomic &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) noexcept + { + return _q_value.fetch_and(valueToAdd, std::memory_order_release); + } + + template static inline + T fetchAndAndOrdered(std::atomic &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) noexcept + { + return _q_value.fetch_and(valueToAdd, std::memory_order_acq_rel); + } + + template static inline + T fetchAndOrRelaxed(std::atomic &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) noexcept + { + return _q_value.fetch_or(valueToAdd, std::memory_order_relaxed); + } + + template static inline + T fetchAndOrAcquire(std::atomic &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) noexcept + { + return _q_value.fetch_or(valueToAdd, std::memory_order_acquire); + } + + template static inline + T fetchAndOrRelease(std::atomic &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) noexcept + { + return _q_value.fetch_or(valueToAdd, std::memory_order_release); + } + + template static inline + T fetchAndOrOrdered(std::atomic &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) noexcept + { + return _q_value.fetch_or(valueToAdd, std::memory_order_acq_rel); + } + + template static inline + T fetchAndXorRelaxed(std::atomic &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) noexcept + { + return _q_value.fetch_xor(valueToAdd, std::memory_order_relaxed); + } + + template static inline + T fetchAndXorAcquire(std::atomic &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) noexcept + { + return _q_value.fetch_xor(valueToAdd, std::memory_order_acquire); + } + + template static inline + T fetchAndXorRelease(std::atomic &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) noexcept + { + return _q_value.fetch_xor(valueToAdd, std::memory_order_release); + } + + template static inline + T fetchAndXorOrdered(std::atomic &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) noexcept + { + return _q_value.fetch_xor(valueToAdd, std::memory_order_acq_rel); + } +}; + +# define Q_BASIC_ATOMIC_INITIALIZER(a) { a } + +QT_END_NAMESPACE + +#endif // QATOMIC_CXX0X_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qatomicscopedvaluerollback.h b/qt/6.8.1/msvc2022_64/include/QtCore/qatomicscopedvaluerollback.h new file mode 100644 index 0000000000000000000000000000000000000000..d14712f19d726b47e73d01d63dec317680964a11 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qatomicscopedvaluerollback.h @@ -0,0 +1,127 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QATOMICSCOPEDVALUEROLLBACK_H +#define QATOMICSCOPEDVALUEROLLBACK_H + +#include +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +template +class QAtomicScopedValueRollback +{ + std::atomic &m_atomic; + T m_value; + std::memory_order m_mo; + + Q_DISABLE_COPY_MOVE(QAtomicScopedValueRollback) + + static constexpr std::memory_order store_part(std::memory_order mo) noexcept + { + switch (mo) { + case std::memory_order_relaxed: + case std::memory_order_consume: + case std::memory_order_acquire: return std::memory_order_relaxed; + case std::memory_order_release: + case std::memory_order_acq_rel: return std::memory_order_release; + case std::memory_order_seq_cst: return std::memory_order_seq_cst; + } + // GCC 8.x does not treat __builtin_unreachable() as constexpr +#if !defined(Q_CC_GNU_ONLY) || (Q_CC_GNU >= 900) + // NOLINTNEXTLINE(qt-use-unreachable-return): Triggers on Clang, breaking GCC 8 + Q_UNREACHABLE(); +#endif + return std::memory_order_seq_cst; + } + + static constexpr std::memory_order load_part(std::memory_order mo) noexcept + { + switch (mo) { + case std::memory_order_relaxed: + case std::memory_order_release: return std::memory_order_relaxed; + case std::memory_order_consume: return std::memory_order_consume; + case std::memory_order_acquire: + case std::memory_order_acq_rel: return std::memory_order_acquire; + case std::memory_order_seq_cst: return std::memory_order_seq_cst; + } + // GCC 8.x does not treat __builtin_unreachable() as constexpr +#if !defined(Q_CC_GNU_ONLY) || (Q_CC_GNU >= 900) + // NOLINTNEXTLINE(qt-use-unreachable-return): Triggers on Clang, breaking GCC 8 + Q_UNREACHABLE(); +#endif + return std::memory_order_seq_cst; + } +public: + // + // std::atomic: + // + Q_NODISCARD_CTOR + explicit constexpr + QAtomicScopedValueRollback(std::atomic &var, + std::memory_order mo = std::memory_order_seq_cst) + : m_atomic(var), m_value(var.load(load_part(mo))), m_mo(mo) {} + + Q_NODISCARD_CTOR + explicit constexpr + QAtomicScopedValueRollback(std::atomic &var, T value, + std::memory_order mo = std::memory_order_seq_cst) + : m_atomic(var), m_value(var.exchange(value, mo)), m_mo(mo) {} + + // + // Q(Basic)AtomicInteger: + // + Q_NODISCARD_CTOR + explicit constexpr + QAtomicScopedValueRollback(QBasicAtomicInteger &var, + std::memory_order mo = std::memory_order_seq_cst) + : QAtomicScopedValueRollback(var._q_value, mo) {} + + Q_NODISCARD_CTOR + explicit constexpr + QAtomicScopedValueRollback(QBasicAtomicInteger &var, T value, + std::memory_order mo = std::memory_order_seq_cst) + : QAtomicScopedValueRollback(var._q_value, value, mo) {} + + // + // Q(Basic)AtomicPointer: + // + Q_NODISCARD_CTOR + explicit constexpr + QAtomicScopedValueRollback(QBasicAtomicPointer> &var, + std::memory_order mo = std::memory_order_seq_cst) + : QAtomicScopedValueRollback(var._q_value, mo) {} + + Q_NODISCARD_CTOR + explicit constexpr + QAtomicScopedValueRollback(QBasicAtomicPointer> &var, T value, + std::memory_order mo = std::memory_order_seq_cst) + : QAtomicScopedValueRollback(var._q_value, value, mo) {} + + ~QAtomicScopedValueRollback() + { + m_atomic.store(m_value, store_part(m_mo)); + } + + void commit() + { + m_value = m_atomic.load(load_part(m_mo)); + } +}; + +template +QAtomicScopedValueRollback(QBasicAtomicPointer &) + -> QAtomicScopedValueRollback; +template +QAtomicScopedValueRollback(QBasicAtomicPointer &, std::memory_order) + -> QAtomicScopedValueRollback; + +QT_END_NAMESPACE + +#endif // QATOMICASCOPEDVALUEROLLBACK_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qbasicatomic.h b/qt/6.8.1/msvc2022_64/include/QtCore/qbasicatomic.h new file mode 100644 index 0000000000000000000000000000000000000000..68d040b9e5921b8188b51a376350fd2895716284 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qbasicatomic.h @@ -0,0 +1,262 @@ +// Copyright (C) 2011 Thiago Macieira +// Copyright (C) 2018 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QBASICATOMIC_H +#define QBASICATOMIC_H + +#include + +QT_WARNING_PUSH +QT_WARNING_DISABLE_MSVC(4522) + +QT_BEGIN_NAMESPACE + +#if 0 +// silence syncqt warnings +QT_END_NAMESPACE +#pragma qt_no_master_include +#pragma qt_sync_stop_processing +#endif + +template +class QBasicAtomicInteger +{ +public: + typedef T Type; + typedef QAtomicOps Ops; + // static check that this is a valid integer + static_assert(std::is_integral_v, "template parameter is not an integral type"); + static_assert(QAtomicOpsSupport::IsSupported, "template parameter is an integral of a size not supported on this platform"); + + typename Ops::Type _q_value; + + // Everything below is either implemented in ../arch/qatomic_XXX.h or (as + // fallback) in qgenericatomic.h + T loadRelaxed() const noexcept { return Ops::loadRelaxed(_q_value); } + void storeRelaxed(T newValue) noexcept { Ops::storeRelaxed(_q_value, newValue); } + + T loadAcquire() const noexcept { return Ops::loadAcquire(_q_value); } + void storeRelease(T newValue) noexcept { Ops::storeRelease(_q_value, newValue); } + operator T() const noexcept { return loadAcquire(); } + T operator=(T newValue) noexcept { storeRelease(newValue); return newValue; } + + static constexpr bool isReferenceCountingNative() noexcept { return Ops::isReferenceCountingNative(); } + static constexpr bool isReferenceCountingWaitFree() noexcept { return Ops::isReferenceCountingWaitFree(); } + + bool ref() noexcept { return Ops::ref(_q_value); } + bool deref() noexcept { return Ops::deref(_q_value); } + + static constexpr bool isTestAndSetNative() noexcept { return Ops::isTestAndSetNative(); } + static constexpr bool isTestAndSetWaitFree() noexcept { return Ops::isTestAndSetWaitFree(); } + + bool testAndSetRelaxed(T expectedValue, T newValue) noexcept + { return Ops::testAndSetRelaxed(_q_value, expectedValue, newValue); } + bool testAndSetAcquire(T expectedValue, T newValue) noexcept + { return Ops::testAndSetAcquire(_q_value, expectedValue, newValue); } + bool testAndSetRelease(T expectedValue, T newValue) noexcept + { return Ops::testAndSetRelease(_q_value, expectedValue, newValue); } + bool testAndSetOrdered(T expectedValue, T newValue) noexcept + { return Ops::testAndSetOrdered(_q_value, expectedValue, newValue); } + + bool testAndSetRelaxed(T expectedValue, T newValue, T ¤tValue) noexcept + { return Ops::testAndSetRelaxed(_q_value, expectedValue, newValue, ¤tValue); } + bool testAndSetAcquire(T expectedValue, T newValue, T ¤tValue) noexcept + { return Ops::testAndSetAcquire(_q_value, expectedValue, newValue, ¤tValue); } + bool testAndSetRelease(T expectedValue, T newValue, T ¤tValue) noexcept + { return Ops::testAndSetRelease(_q_value, expectedValue, newValue, ¤tValue); } + bool testAndSetOrdered(T expectedValue, T newValue, T ¤tValue) noexcept + { return Ops::testAndSetOrdered(_q_value, expectedValue, newValue, ¤tValue); } + + static constexpr bool isFetchAndStoreNative() noexcept { return Ops::isFetchAndStoreNative(); } + static constexpr bool isFetchAndStoreWaitFree() noexcept { return Ops::isFetchAndStoreWaitFree(); } + + T fetchAndStoreRelaxed(T newValue) noexcept + { return Ops::fetchAndStoreRelaxed(_q_value, newValue); } + T fetchAndStoreAcquire(T newValue) noexcept + { return Ops::fetchAndStoreAcquire(_q_value, newValue); } + T fetchAndStoreRelease(T newValue) noexcept + { return Ops::fetchAndStoreRelease(_q_value, newValue); } + T fetchAndStoreOrdered(T newValue) noexcept + { return Ops::fetchAndStoreOrdered(_q_value, newValue); } + + static constexpr bool isFetchAndAddNative() noexcept { return Ops::isFetchAndAddNative(); } + static constexpr bool isFetchAndAddWaitFree() noexcept { return Ops::isFetchAndAddWaitFree(); } + + T fetchAndAddRelaxed(T valueToAdd) noexcept + { return Ops::fetchAndAddRelaxed(_q_value, valueToAdd); } + T fetchAndAddAcquire(T valueToAdd) noexcept + { return Ops::fetchAndAddAcquire(_q_value, valueToAdd); } + T fetchAndAddRelease(T valueToAdd) noexcept + { return Ops::fetchAndAddRelease(_q_value, valueToAdd); } + T fetchAndAddOrdered(T valueToAdd) noexcept + { return Ops::fetchAndAddOrdered(_q_value, valueToAdd); } + + T fetchAndSubRelaxed(T valueToAdd) noexcept + { return Ops::fetchAndSubRelaxed(_q_value, valueToAdd); } + T fetchAndSubAcquire(T valueToAdd) noexcept + { return Ops::fetchAndSubAcquire(_q_value, valueToAdd); } + T fetchAndSubRelease(T valueToAdd) noexcept + { return Ops::fetchAndSubRelease(_q_value, valueToAdd); } + T fetchAndSubOrdered(T valueToAdd) noexcept + { return Ops::fetchAndSubOrdered(_q_value, valueToAdd); } + + T fetchAndAndRelaxed(T valueToAdd) noexcept + { return Ops::fetchAndAndRelaxed(_q_value, valueToAdd); } + T fetchAndAndAcquire(T valueToAdd) noexcept + { return Ops::fetchAndAndAcquire(_q_value, valueToAdd); } + T fetchAndAndRelease(T valueToAdd) noexcept + { return Ops::fetchAndAndRelease(_q_value, valueToAdd); } + T fetchAndAndOrdered(T valueToAdd) noexcept + { return Ops::fetchAndAndOrdered(_q_value, valueToAdd); } + + T fetchAndOrRelaxed(T valueToAdd) noexcept + { return Ops::fetchAndOrRelaxed(_q_value, valueToAdd); } + T fetchAndOrAcquire(T valueToAdd) noexcept + { return Ops::fetchAndOrAcquire(_q_value, valueToAdd); } + T fetchAndOrRelease(T valueToAdd) noexcept + { return Ops::fetchAndOrRelease(_q_value, valueToAdd); } + T fetchAndOrOrdered(T valueToAdd) noexcept + { return Ops::fetchAndOrOrdered(_q_value, valueToAdd); } + + T fetchAndXorRelaxed(T valueToAdd) noexcept + { return Ops::fetchAndXorRelaxed(_q_value, valueToAdd); } + T fetchAndXorAcquire(T valueToAdd) noexcept + { return Ops::fetchAndXorAcquire(_q_value, valueToAdd); } + T fetchAndXorRelease(T valueToAdd) noexcept + { return Ops::fetchAndXorRelease(_q_value, valueToAdd); } + T fetchAndXorOrdered(T valueToAdd) noexcept + { return Ops::fetchAndXorOrdered(_q_value, valueToAdd); } + + T operator++() noexcept + { return fetchAndAddOrdered(1) + 1; } + T operator++(int) noexcept + { return fetchAndAddOrdered(1); } + T operator--() noexcept + { return fetchAndSubOrdered(1) - 1; } + T operator--(int) noexcept + { return fetchAndSubOrdered(1); } + + T operator+=(T v) noexcept + { return fetchAndAddOrdered(v) + v; } + T operator-=(T v) noexcept + { return fetchAndSubOrdered(v) - v; } + T operator&=(T v) noexcept + { return fetchAndAndOrdered(v) & v; } + T operator|=(T v) noexcept + { return fetchAndOrOrdered(v) | v; } + T operator^=(T v) noexcept + { return fetchAndXorOrdered(v) ^ v; } + + + QBasicAtomicInteger() = default; + constexpr QBasicAtomicInteger(T value) noexcept : _q_value(value) {} + QBasicAtomicInteger(const QBasicAtomicInteger &) = delete; + QBasicAtomicInteger &operator=(const QBasicAtomicInteger &) = delete; + QBasicAtomicInteger &operator=(const QBasicAtomicInteger &) volatile = delete; +}; +typedef QBasicAtomicInteger QBasicAtomicInt; + +template +class QBasicAtomicPointer +{ +public: + typedef X *Type; + typedef QAtomicOps Ops; + typedef typename Ops::Type AtomicType; + + AtomicType _q_value; + + Type loadRelaxed() const noexcept { return Ops::loadRelaxed(_q_value); } + void storeRelaxed(Type newValue) noexcept { Ops::storeRelaxed(_q_value, newValue); } + + operator Type() const noexcept { return loadAcquire(); } + Type operator=(Type newValue) noexcept { storeRelease(newValue); return newValue; } + + // Atomic API, implemented in qatomic_XXX.h + Type loadAcquire() const noexcept { return Ops::loadAcquire(_q_value); } + void storeRelease(Type newValue) noexcept { Ops::storeRelease(_q_value, newValue); } + + static constexpr bool isTestAndSetNative() noexcept { return Ops::isTestAndSetNative(); } + static constexpr bool isTestAndSetWaitFree() noexcept { return Ops::isTestAndSetWaitFree(); } + + bool testAndSetRelaxed(Type expectedValue, Type newValue) noexcept + { return Ops::testAndSetRelaxed(_q_value, expectedValue, newValue); } + bool testAndSetAcquire(Type expectedValue, Type newValue) noexcept + { return Ops::testAndSetAcquire(_q_value, expectedValue, newValue); } + bool testAndSetRelease(Type expectedValue, Type newValue) noexcept + { return Ops::testAndSetRelease(_q_value, expectedValue, newValue); } + bool testAndSetOrdered(Type expectedValue, Type newValue) noexcept + { return Ops::testAndSetOrdered(_q_value, expectedValue, newValue); } + + bool testAndSetRelaxed(Type expectedValue, Type newValue, Type ¤tValue) noexcept + { return Ops::testAndSetRelaxed(_q_value, expectedValue, newValue, ¤tValue); } + bool testAndSetAcquire(Type expectedValue, Type newValue, Type ¤tValue) noexcept + { return Ops::testAndSetAcquire(_q_value, expectedValue, newValue, ¤tValue); } + bool testAndSetRelease(Type expectedValue, Type newValue, Type ¤tValue) noexcept + { return Ops::testAndSetRelease(_q_value, expectedValue, newValue, ¤tValue); } + bool testAndSetOrdered(Type expectedValue, Type newValue, Type ¤tValue) noexcept + { return Ops::testAndSetOrdered(_q_value, expectedValue, newValue, ¤tValue); } + + static constexpr bool isFetchAndStoreNative() noexcept { return Ops::isFetchAndStoreNative(); } + static constexpr bool isFetchAndStoreWaitFree() noexcept { return Ops::isFetchAndStoreWaitFree(); } + + Type fetchAndStoreRelaxed(Type newValue) noexcept + { return Ops::fetchAndStoreRelaxed(_q_value, newValue); } + Type fetchAndStoreAcquire(Type newValue) noexcept + { return Ops::fetchAndStoreAcquire(_q_value, newValue); } + Type fetchAndStoreRelease(Type newValue) noexcept + { return Ops::fetchAndStoreRelease(_q_value, newValue); } + Type fetchAndStoreOrdered(Type newValue) noexcept + { return Ops::fetchAndStoreOrdered(_q_value, newValue); } + + static constexpr bool isFetchAndAddNative() noexcept { return Ops::isFetchAndAddNative(); } + static constexpr bool isFetchAndAddWaitFree() noexcept { return Ops::isFetchAndAddWaitFree(); } + + Type fetchAndAddRelaxed(qptrdiff valueToAdd) noexcept + { return Ops::fetchAndAddRelaxed(_q_value, valueToAdd); } + Type fetchAndAddAcquire(qptrdiff valueToAdd) noexcept + { return Ops::fetchAndAddAcquire(_q_value, valueToAdd); } + Type fetchAndAddRelease(qptrdiff valueToAdd) noexcept + { return Ops::fetchAndAddRelease(_q_value, valueToAdd); } + Type fetchAndAddOrdered(qptrdiff valueToAdd) noexcept + { return Ops::fetchAndAddOrdered(_q_value, valueToAdd); } + + Type fetchAndSubRelaxed(qptrdiff valueToAdd) noexcept + { return Ops::fetchAndSubRelaxed(_q_value, valueToAdd); } + Type fetchAndSubAcquire(qptrdiff valueToAdd) noexcept + { return Ops::fetchAndSubAcquire(_q_value, valueToAdd); } + Type fetchAndSubRelease(qptrdiff valueToAdd) noexcept + { return Ops::fetchAndSubRelease(_q_value, valueToAdd); } + Type fetchAndSubOrdered(qptrdiff valueToAdd) noexcept + { return Ops::fetchAndSubOrdered(_q_value, valueToAdd); } + + Type operator++() noexcept + { return fetchAndAddOrdered(1) + 1; } + Type operator++(int) noexcept + { return fetchAndAddOrdered(1); } + Type operator--() noexcept + { return fetchAndSubOrdered(1) - 1; } + Type operator--(int) noexcept + { return fetchAndSubOrdered(1); } + Type operator+=(qptrdiff valueToAdd) noexcept + { return fetchAndAddOrdered(valueToAdd) + valueToAdd; } + Type operator-=(qptrdiff valueToSub) noexcept + { return fetchAndSubOrdered(valueToSub) - valueToSub; } + + QBasicAtomicPointer() = default; + constexpr QBasicAtomicPointer(Type value) noexcept : _q_value(value) {} + QBasicAtomicPointer(const QBasicAtomicPointer &) = delete; + QBasicAtomicPointer &operator=(const QBasicAtomicPointer &) = delete; + QBasicAtomicPointer &operator=(const QBasicAtomicPointer &) volatile = delete; +}; + +#ifndef Q_BASIC_ATOMIC_INITIALIZER +# define Q_BASIC_ATOMIC_INITIALIZER(a) { (a) } +#endif + +QT_END_NAMESPACE + +QT_WARNING_POP + +#endif // QBASICATOMIC_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qbasictimer.h b/qt/6.8.1/msvc2022_64/include/QtCore/qbasictimer.h new file mode 100644 index 0000000000000000000000000000000000000000..931f97c98f00e7fdb7ee58794170eea47940c95a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qbasictimer.h @@ -0,0 +1,63 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QBASICTIMER_H +#define QBASICTIMER_H + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + + +class QObject; + +class Q_CORE_EXPORT QBasicTimer +{ + Qt::TimerId m_id; + Q_DISABLE_COPY(QBasicTimer) + +public: + constexpr QBasicTimer() noexcept : m_id{Qt::TimerId::Invalid} {} + ~QBasicTimer() { if (isActive()) stop(); } + + QBasicTimer(QBasicTimer &&other) noexcept + : m_id{std::exchange(other.m_id, Qt::TimerId::Invalid)} + {} + + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QBasicTimer) + + void swap(QBasicTimer &other) noexcept { std::swap(m_id, other.m_id); } + + bool isActive() const noexcept { return m_id != Qt::TimerId::Invalid; } + int timerId() const noexcept { return qToUnderlying(id()); } + Qt::TimerId id() const noexcept { return m_id; } + QT_CORE_INLINE_SINCE(6, 5) + void start(int msec, QObject *obj); + QT_CORE_INLINE_SINCE(6, 5) + void start(int msec, Qt::TimerType timerType, QObject *obj); + void start(std::chrono::milliseconds duration, QObject *obj); + void start(std::chrono::milliseconds duration, Qt::TimerType timerType, QObject *obj); + void stop(); +}; +Q_DECLARE_TYPEINFO(QBasicTimer, Q_RELOCATABLE_TYPE); + +#if QT_CORE_INLINE_IMPL_SINCE(6, 5) +void QBasicTimer::start(int msec, QObject *obj) +{ + start(std::chrono::milliseconds{msec}, obj); +} + +void QBasicTimer::start(int msec, Qt::TimerType t, QObject *obj) +{ + start(std::chrono::milliseconds{msec}, t, obj); +} +#endif + +inline void swap(QBasicTimer &lhs, QBasicTimer &rhs) noexcept { lhs.swap(rhs); } + +QT_END_NAMESPACE + +#endif // QBASICTIMER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qbindingstorage.h b/qt/6.8.1/msvc2022_64/include/QtCore/qbindingstorage.h new file mode 100644 index 0000000000000000000000000000000000000000..14d331b362bc89494137d7b1c6410de643494d76 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qbindingstorage.h @@ -0,0 +1,94 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QBINDINGSTORAGE_H +#define QBINDINGSTORAGE_H + +#include +#include + +QT_BEGIN_NAMESPACE + +template +class QObjectCompatProperty; +struct QPropertyDelayedNotifications; +class QUntypedPropertyData; + +namespace QtPrivate { + +class QPropertyBindingData; +struct BindingEvaluationState; +struct CompatPropertySafePoint; +} + +struct QBindingStatus +{ + QtPrivate::BindingEvaluationState *currentlyEvaluatingBinding = nullptr; + QtPrivate::CompatPropertySafePoint *currentCompatProperty = nullptr; + Qt::HANDLE threadId = nullptr; + QPropertyDelayedNotifications *groupUpdateData = nullptr; +}; + +namespace QtPrivate { +struct QBindingStatusAccessToken; +Q_AUTOTEST_EXPORT QBindingStatus *getBindingStatus(QBindingStatusAccessToken); +} + + +struct QBindingStorageData; +class Q_CORE_EXPORT QBindingStorage +{ + mutable QBindingStorageData *d = nullptr; + QBindingStatus *bindingStatus = nullptr; + + template + friend class QObjectCompatProperty; + friend class QObjectPrivate; + friend class QtPrivate::QPropertyBindingData; +public: + QBindingStorage(); + ~QBindingStorage(); + + bool isEmpty() { return !d; } + bool isValid() const noexcept { return bindingStatus; } + + const QBindingStatus *status(QtPrivate::QBindingStatusAccessToken) const; + + void registerDependency(const QUntypedPropertyData *data) const + { + if (!bindingStatus || !bindingStatus->currentlyEvaluatingBinding) + return; + registerDependency_helper(data); + } + QtPrivate::QPropertyBindingData *bindingData(const QUntypedPropertyData *data) const + { + if (!d) + return nullptr; + return bindingData_helper(data); + } + +#if QT_CORE_REMOVED_SINCE(6, 2) + void maybeUpdateBindingAndRegister(const QUntypedPropertyData *data) const { registerDependency(data); } +#endif + + QtPrivate::QPropertyBindingData *bindingData(QUntypedPropertyData *data, bool create) + { + if (!d && !create) + return nullptr; + return bindingData_helper(data, create); + } +private: + void reinitAfterThreadMove(); + void clear(); + void registerDependency_helper(const QUntypedPropertyData *data) const; +#if QT_CORE_REMOVED_SINCE(6, 2) + // ### Unused, but keep for BC + void maybeUpdateBindingAndRegister_helper(const QUntypedPropertyData *data) const; +#endif + QtPrivate::QPropertyBindingData *bindingData_helper(const QUntypedPropertyData *data) const; + QtPrivate::QPropertyBindingData *bindingData_helper(QUntypedPropertyData *data, bool create); +}; + +QT_END_NAMESPACE + +#endif // QBINDINGSTORAGE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qbitarray.h b/qt/6.8.1/msvc2022_64/include/QtCore/qbitarray.h new file mode 100644 index 0000000000000000000000000000000000000000..2eafcd16cdb57ff07fc24ab76907781ca277de80 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qbitarray.h @@ -0,0 +1,179 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QBITARRAY_H +#define QBITARRAY_H + +#include + +QT_BEGIN_NAMESPACE + +class QBitRef; +class Q_CORE_EXPORT QBitArray +{ + Q_CORE_EXPORT friend QBitArray operator&(const QBitArray &a1, const QBitArray &a2); + friend QBitArray operator&(QBitArray &&a1, const QBitArray &a2) + { return a1 &= a2; } + friend QBitArray operator&(const QBitArray &a1, QBitArray &&a2) + { return a2 &= a1; } + friend QBitArray operator&(QBitArray &&a1, QBitArray &&a2) + { return a1 &= a2; } + + Q_CORE_EXPORT friend QBitArray operator|(const QBitArray &a1, const QBitArray &a2); + friend QBitArray operator|(QBitArray &&a1, const QBitArray &a2) + { return a1 |= a2; } + friend QBitArray operator|(const QBitArray &a1, QBitArray &&a2) + { return a2 |= a1; } + friend QBitArray operator|(QBitArray &&a1, QBitArray &&a2) + { return a1 |= a2; } + + Q_CORE_EXPORT friend QBitArray operator^(const QBitArray &a1, const QBitArray &a2); + friend QBitArray operator^(QBitArray &&a1, const QBitArray &a2) + { return a1 ^= a2; } + friend QBitArray operator^(const QBitArray &a1, QBitArray &&a2) + { return a2 ^= a1; } + friend QBitArray operator^(QBitArray &&a1, QBitArray &&a2) + { return a1 ^= a2; } + +#ifndef QT_NO_DATASTREAM + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QBitArray &); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QBitArray &); +#endif + friend Q_CORE_EXPORT size_t qHash(const QBitArray &key, size_t seed) noexcept; + friend QBitArray operator~(QBitArray a) + { return std::move(a).inverted_inplace(); } + QByteArray d; + + QBitArray(QByteArrayData &&dd) : d(std::move(dd)) {} + + template static auto bitLocation(BitArray &ba, qsizetype i) + { + Q_ASSERT(size_t(i) < size_t(ba.size())); + struct R { + decltype(ba.d[1]) byte; + uchar bitMask; + }; + qsizetype byteIdx = i >> 3; + qsizetype bitIdx = i & 7; + return R{ ba.d[1 + byteIdx], uchar(1U << bitIdx) }; + } + + QBitArray inverted_inplace() &&; + +public: + inline QBitArray() noexcept {} + explicit QBitArray(qsizetype size, bool val = false); + // Rule Of Zero applies +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) + QBitArray(const QBitArray &other) noexcept : d(other.d) {} + inline QBitArray &operator=(const QBitArray &other) noexcept { d = other.d; return *this; } + inline QBitArray(QBitArray &&other) noexcept : d(std::move(other.d)) {} + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QBitArray) +#endif // Qt 6 + + void swap(QBitArray &other) noexcept { d.swap(other.d); } + + qsizetype size() const { return qsizetype((size_t(d.size()) << 3) - *d.constData()); } + qsizetype count() const { return size(); } + qsizetype count(bool on) const; + + inline bool isEmpty() const { return d.isEmpty(); } + inline bool isNull() const { return d.isNull(); } + + void resize(qsizetype size); + + inline void detach() { d.detach(); } + inline bool isDetached() const { return d.isDetached(); } + inline void clear() { d.clear(); } + + bool testBit(qsizetype i) const + { auto r = bitLocation(*this, i); return r.byte & r.bitMask; } + void setBit(qsizetype i) + { auto r = bitLocation(*this, i); r.byte |= r.bitMask; } + void setBit(qsizetype i, bool val) + { if (val) setBit(i); else clearBit(i); } + void clearBit(qsizetype i) + { auto r = bitLocation(*this, i); r.byte &= ~r.bitMask; } + bool toggleBit(qsizetype i) + { + auto r = bitLocation(*this, i); + bool cl = r.byte & r.bitMask; + r.byte ^= r.bitMask; + return cl; + } + + bool at(qsizetype i) const { return testBit(i); } + inline QBitRef operator[](qsizetype i); + bool operator[](qsizetype i) const { return testBit(i); } + + QBitArray &operator&=(QBitArray &&); + QBitArray &operator|=(QBitArray &&); + QBitArray &operator^=(QBitArray &&); + QBitArray &operator&=(const QBitArray &); + QBitArray &operator|=(const QBitArray &); + QBitArray &operator^=(const QBitArray &); +#if QT_CORE_REMOVED_SINCE(6, 7) + QBitArray operator~() const; +#endif + +#if QT_CORE_REMOVED_SINCE(6, 8) + inline bool operator==(const QBitArray &other) const { return comparesEqual(d, other.d); } + inline bool operator!=(const QBitArray &other) const { return !operator==(other); } +#endif + + bool fill(bool aval, qsizetype asize = -1) + { *this = QBitArray((asize < 0 ? this->size() : asize), aval); return true; } + void fill(bool val, qsizetype first, qsizetype last); + + inline void truncate(qsizetype pos) { if (pos < size()) resize(pos); } + + const char *bits() const { return isEmpty() ? nullptr : d.constData() + 1; } + static QBitArray fromBits(const char *data, qsizetype len); + + quint32 toUInt32(QSysInfo::Endian endianness, bool *ok = nullptr) const noexcept; + +public: + typedef QByteArray::DataPointer DataPtr; + inline DataPtr &data_ptr() { return d.data_ptr(); } + inline const DataPtr &data_ptr() const { return d.data_ptr(); } + +private: + friend bool comparesEqual(const QBitArray &lhs, const QBitArray &rhs) noexcept + { + return lhs.d == rhs.d; + } + Q_DECLARE_EQUALITY_COMPARABLE(QBitArray) +}; + +class QT6_ONLY(Q_CORE_EXPORT) QBitRef +{ +private: + QBitArray &a; + qsizetype i; + inline QBitRef(QBitArray &array, qsizetype idx) : a(array), i(idx) { } + friend class QBitArray; + +public: + inline operator bool() const { return a.testBit(i); } + inline bool operator!() const { return !a.testBit(i); } + QBitRef &operator=(const QBitRef &val) { a.setBit(i, val); return *this; } + QBitRef &operator=(bool val) { a.setBit(i, val); return *this; } +}; + +QBitRef QBitArray::operator[](qsizetype i) +{ Q_ASSERT(i >= 0); return QBitRef(*this, i); } + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QBitArray &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QBitArray &); +#endif + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QBitArray &); +#endif + +Q_DECLARE_SHARED(QBitArray) + +QT_END_NAMESPACE + +#endif // QBITARRAY_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qbuffer.h b/qt/6.8.1/msvc2022_64/include/QtCore/qbuffer.h new file mode 100644 index 0000000000000000000000000000000000000000..3480593fe12ce241c4b295e3509ce75c749c8434 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qbuffer.h @@ -0,0 +1,68 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QBUFFER_H +#define QBUFFER_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QObject; +class QBufferPrivate; + +class Q_CORE_EXPORT QBuffer : public QIODevice +{ +#ifndef QT_NO_QOBJECT + Q_OBJECT +#endif + +public: +#ifndef QT_NO_QOBJECT + explicit QBuffer(QObject *parent = nullptr); + QBuffer(QByteArray *buf, QObject *parent = nullptr); +#else + QBuffer(); + explicit QBuffer(QByteArray *buf); +#endif + ~QBuffer(); + + QByteArray &buffer(); + const QByteArray &buffer() const; + void setBuffer(QByteArray *a); + + void setData(const QByteArray &data); +#if QT_CORE_REMOVED_SINCE(6, 5) && QT_POINTER_SIZE != 4 + void setData(const char *data, int len) { setData(data, qsizetype(len)); } +#endif + void setData(const char *data, qsizetype len); + const QByteArray &data() const; + + bool open(OpenMode openMode) override; + + void close() override; + qint64 size() const override; + qint64 pos() const override; + bool seek(qint64 off) override; + bool atEnd() const override; + bool canReadLine() const override; + +protected: +#ifndef QT_NO_QOBJECT + void connectNotify(const QMetaMethod &) override; + void disconnectNotify(const QMetaMethod &) override; +#endif + qint64 readData(char *data, qint64 maxlen) override; + qint64 writeData(const char *data, qint64 len) override; + +private: + Q_DECLARE_PRIVATE(QBuffer) + Q_DISABLE_COPY(QBuffer) + + Q_PRIVATE_SLOT(d_func(), void _q_emitSignals()) +}; + +QT_END_NAMESPACE + +#endif // QBUFFER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qbytearray.h b/qt/6.8.1/msvc2022_64/include/QtCore/qbytearray.h new file mode 100644 index 0000000000000000000000000000000000000000..cc1358d9f78d1007e5020d2c73f1d7d2cb580fea --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qbytearray.h @@ -0,0 +1,832 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QBYTEARRAY_H +#define QBYTEARRAY_H + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#ifndef QT5_NULL_STRINGS +// Would ideally be off, but in practice breaks too much (Qt 6.0). +#define QT5_NULL_STRINGS 1 +#endif + +#ifdef truncate +#error qbytearray.h must be included before any header file that defines truncate +#endif + +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) +Q_FORWARD_DECLARE_CF_TYPE(CFData); +Q_FORWARD_DECLARE_OBJC_CLASS(NSData); +#endif + +#if defined(Q_OS_WASM) || defined(Q_QDOC) +namespace emscripten { + class val; +} +#endif + +class tst_QByteArray; + +QT_BEGIN_NAMESPACE + +class QString; +class QDataStream; + +using QByteArrayData = QArrayDataPointer; + +# define QByteArrayLiteral(str) \ + (QByteArray(QByteArrayData(nullptr, const_cast(str), sizeof(str) - 1))) \ + /**/ + +class Q_CORE_EXPORT QByteArray +{ +public: + using DataPointer = QByteArrayData; +private: + typedef QTypedArrayData Data; + + DataPointer d; + static const char _empty; + + friend class ::tst_QByteArray; + + template + using if_input_iterator = QtPrivate::IfIsInputIterator; +public: + enum Base64Option { + Base64Encoding = 0, + Base64UrlEncoding = 1, + + KeepTrailingEquals = 0, + OmitTrailingEquals = 2, + + IgnoreBase64DecodingErrors = 0, + AbortOnBase64DecodingErrors = 4, + }; + Q_DECLARE_FLAGS(Base64Options, Base64Option) + + enum class Base64DecodingStatus { + Ok, + IllegalInputLength, + IllegalCharacter, + IllegalPadding, + }; + + inline constexpr QByteArray() noexcept; + QByteArray(const char *, qsizetype size = -1); + QByteArray(qsizetype size, char c); + QByteArray(qsizetype size, Qt::Initialization); + explicit QByteArray(QByteArrayView v) : QByteArray(v.data(), v.size()) {} + inline QByteArray(const QByteArray &) noexcept; + inline ~QByteArray(); + + QByteArray &operator=(const QByteArray &) noexcept; + QByteArray &operator=(const char *str); + inline QByteArray(QByteArray && other) noexcept + = default; + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QByteArray) + inline void swap(QByteArray &other) noexcept + { d.swap(other.d); } + + bool isEmpty() const noexcept { return size() == 0; } + void resize(qsizetype size); + void resize(qsizetype size, char c); + void resizeForOverwrite(qsizetype size); + + QByteArray &fill(char c, qsizetype size = -1); + + inline qsizetype capacity() const; + inline void reserve(qsizetype size); + inline void squeeze(); + +#ifndef QT_NO_CAST_FROM_BYTEARRAY + inline operator const char *() const; + inline operator const void *() const; +#endif + inline char *data(); + inline const char *data() const noexcept; + const char *constData() const noexcept { return data(); } + inline void detach(); + inline bool isDetached() const; + inline bool isSharedWith(const QByteArray &other) const noexcept + { return data() == other.data() && size() == other.size(); } + void clear(); + + inline char at(qsizetype i) const; + inline char operator[](qsizetype i) const; + [[nodiscard]] inline char &operator[](qsizetype i); + [[nodiscard]] char front() const { return at(0); } + [[nodiscard]] inline char &front(); + [[nodiscard]] char back() const { return at(size() - 1); } + [[nodiscard]] inline char &back(); + + QT_CORE_INLINE_SINCE(6, 8) + qsizetype indexOf(char c, qsizetype from = 0) const; + qsizetype indexOf(QByteArrayView bv, qsizetype from = 0) const + { return QtPrivate::findByteArray(qToByteArrayViewIgnoringNull(*this), from, bv); } + + QT_CORE_INLINE_SINCE(6, 8) + qsizetype lastIndexOf(char c, qsizetype from = -1) const; + qsizetype lastIndexOf(QByteArrayView bv) const + { return lastIndexOf(bv, size()); } + qsizetype lastIndexOf(QByteArrayView bv, qsizetype from) const + { return QtPrivate::lastIndexOf(qToByteArrayViewIgnoringNull(*this), from, bv); } + + inline bool contains(char c) const; + inline bool contains(QByteArrayView bv) const; + qsizetype count(char c) const; + qsizetype count(QByteArrayView bv) const + { return QtPrivate::count(qToByteArrayViewIgnoringNull(*this), bv); } + + inline int compare(QByteArrayView a, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + +#if QT_CORE_REMOVED_SINCE(6, 7) + QByteArray left(qsizetype len) const; + QByteArray right(qsizetype len) const; + QByteArray mid(qsizetype index, qsizetype len = -1) const; + QByteArray first(qsizetype n) const; + QByteArray last(qsizetype n) const; + QByteArray sliced(qsizetype pos) const; + QByteArray sliced(qsizetype pos, qsizetype n) const; + QByteArray chopped(qsizetype len) const; +#else + [[nodiscard]] QByteArray left(qsizetype n) const & + { + if (n >= size()) + return *this; + return first(qMax(n, 0)); + } + [[nodiscard]] QByteArray left(qsizetype n) && + { + if (n >= size()) + return std::move(*this); + return std::move(*this).first(qMax(n, 0)); + } + [[nodiscard]] QByteArray right(qsizetype n) const & + { + if (n >= size()) + return *this; + return last(qMax(n, 0)); + } + [[nodiscard]] QByteArray right(qsizetype n) && + { + if (n >= size()) + return std::move(*this); + return std::move(*this).last(qMax(n, 0)); + } + [[nodiscard]] QByteArray mid(qsizetype index, qsizetype len = -1) const &; + [[nodiscard]] QByteArray mid(qsizetype index, qsizetype len = -1) &&; + + [[nodiscard]] QByteArray first(qsizetype n) const & + { verify(0, n); return sliced(0, n); } + [[nodiscard]] QByteArray last(qsizetype n) const & + { verify(0, n); return sliced(size() - n, n); } + [[nodiscard]] QByteArray sliced(qsizetype pos) const & + { verify(pos, 0); return sliced(pos, size() - pos); } + [[nodiscard]] QByteArray sliced(qsizetype pos, qsizetype n) const & + { verify(pos, n); return QByteArray(d.data() + pos, n); } + [[nodiscard]] QByteArray chopped(qsizetype len) const & + { verify(0, len); return sliced(0, size() - len); } + + [[nodiscard]] QByteArray first(qsizetype n) && + { + verify(0, n); + resize(n); // may detach and allocate memory + return std::move(*this); + } + [[nodiscard]] QByteArray last(qsizetype n) && + { verify(0, n); return sliced_helper(*this, size() - n, n); } + [[nodiscard]] QByteArray sliced(qsizetype pos) && + { verify(pos, 0); return sliced_helper(*this, pos, size() - pos); } + [[nodiscard]] QByteArray sliced(qsizetype pos, qsizetype n) && + { verify(pos, n); return sliced_helper(*this, pos, n); } + [[nodiscard]] QByteArray chopped(qsizetype len) && + { verify(0, len); return std::move(*this).first(size() - len); } +#endif + + bool startsWith(QByteArrayView bv) const + { return QtPrivate::startsWith(qToByteArrayViewIgnoringNull(*this), bv); } + bool startsWith(char c) const { return size() > 0 && front() == c; } + + bool endsWith(char c) const { return size() > 0 && back() == c; } + bool endsWith(QByteArrayView bv) const + { return QtPrivate::endsWith(qToByteArrayViewIgnoringNull(*this), bv); } + + bool isUpper() const; + bool isLower() const; + + [[nodiscard]] bool isValidUtf8() const noexcept + { + return QtPrivate::isValidUtf8(qToByteArrayViewIgnoringNull(*this)); + } + + void truncate(qsizetype pos); + void chop(qsizetype n); + + QByteArray &slice(qsizetype pos) + { verify(pos, 0); return remove(0, pos); } + QByteArray &slice(qsizetype pos, qsizetype n) + { + verify(pos, n); + if (isNull()) + return *this; + resize(pos + n); + return remove(0, pos); + } + +#if !defined(Q_QDOC) + [[nodiscard]] QByteArray toLower() const & + { return toLower_helper(*this); } + [[nodiscard]] QByteArray toLower() && + { return toLower_helper(*this); } + [[nodiscard]] QByteArray toUpper() const & + { return toUpper_helper(*this); } + [[nodiscard]] QByteArray toUpper() && + { return toUpper_helper(*this); } + [[nodiscard]] QByteArray trimmed() const & + { return trimmed_helper(*this); } + [[nodiscard]] QByteArray trimmed() && + { return trimmed_helper(*this); } + [[nodiscard]] QByteArray simplified() const & + { return simplified_helper(*this); } + [[nodiscard]] QByteArray simplified() && + { return simplified_helper(*this); } +#else + [[nodiscard]] QByteArray toLower() const; + [[nodiscard]] QByteArray toUpper() const; + [[nodiscard]] QByteArray trimmed() const; + [[nodiscard]] QByteArray simplified() const; +#endif + + [[nodiscard]] QByteArray leftJustified(qsizetype width, char fill = ' ', bool truncate = false) const; + [[nodiscard]] QByteArray rightJustified(qsizetype width, char fill = ' ', bool truncate = false) const; + + QByteArray &prepend(char c) + { return insert(0, QByteArrayView(&c, 1)); } + inline QByteArray &prepend(qsizetype count, char c); + QByteArray &prepend(const char *s) + { return insert(0, QByteArrayView(s, qsizetype(qstrlen(s)))); } + QByteArray &prepend(const char *s, qsizetype len) + { return insert(0, QByteArrayView(s, len)); } + QByteArray &prepend(const QByteArray &a); + QByteArray &prepend(QByteArrayView a) + { return insert(0, a); } + + QByteArray &append(char c); + inline QByteArray &append(qsizetype count, char c); + QByteArray &append(const char *s) + { return append(s, -1); } + QByteArray &append(const char *s, qsizetype len) + { return append(QByteArrayView(s, len < 0 ? qsizetype(qstrlen(s)) : len)); } + QByteArray &append(const QByteArray &a); + QByteArray &append(QByteArrayView a) + { return insert(size(), a); } + + QByteArray &assign(QByteArrayView v); + QByteArray &assign(qsizetype n, char c) + { + Q_ASSERT(n >= 0); + return fill(c, n); + } + template = true> + QByteArray &assign(InputIterator first, InputIterator last) + { + d.assign(first, last); + if (d.data()) + d.data()[d.size] = '\0'; + return *this; + } + + QByteArray &insert(qsizetype i, QByteArrayView data); + inline QByteArray &insert(qsizetype i, const char *s) + { return insert(i, QByteArrayView(s)); } + inline QByteArray &insert(qsizetype i, const QByteArray &data) + { return insert(i, QByteArrayView(data)); } + QByteArray &insert(qsizetype i, qsizetype count, char c); + QByteArray &insert(qsizetype i, char c) + { return insert(i, QByteArrayView(&c, 1)); } + QByteArray &insert(qsizetype i, const char *s, qsizetype len) + { return insert(i, QByteArrayView(s, len)); } + + QByteArray &remove(qsizetype index, qsizetype len); + QByteArray &removeAt(qsizetype pos) + { return size_t(pos) < size_t(size()) ? remove(pos, 1) : *this; } + QByteArray &removeFirst() { return !isEmpty() ? remove(0, 1) : *this; } + QByteArray &removeLast() { return !isEmpty() ? remove(size() - 1, 1) : *this; } + + template + QByteArray &removeIf(Predicate pred) + { + removeIf_helper(pred); + return *this; + } + + QByteArray &replace(qsizetype index, qsizetype len, const char *s, qsizetype alen) + { return replace(index, len, QByteArrayView(s, alen)); } + QByteArray &replace(qsizetype index, qsizetype len, QByteArrayView s); + QByteArray &replace(char before, QByteArrayView after) + { return replace(QByteArrayView(&before, 1), after); } + QByteArray &replace(const char *before, qsizetype bsize, const char *after, qsizetype asize) + { return replace(QByteArrayView(before, bsize), QByteArrayView(after, asize)); } + QByteArray &replace(QByteArrayView before, QByteArrayView after); + QByteArray &replace(char before, char after); + + QByteArray &operator+=(char c) + { return append(c); } + QByteArray &operator+=(const char *s) + { return append(s); } + QByteArray &operator+=(const QByteArray &a) + { return append(a); } + QByteArray &operator+=(QByteArrayView a) + { return append(a); } + + QList split(char sep) const; + + [[nodiscard]] QByteArray repeated(qsizetype times) const; + +#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) +#if QT_CORE_REMOVED_SINCE(6, 8) + QT_ASCII_CAST_WARN inline bool operator==(const QString &s2) const; + QT_ASCII_CAST_WARN inline bool operator!=(const QString &s2) const; + QT_ASCII_CAST_WARN inline bool operator<(const QString &s2) const; + QT_ASCII_CAST_WARN inline bool operator>(const QString &s2) const; + QT_ASCII_CAST_WARN inline bool operator<=(const QString &s2) const; + QT_ASCII_CAST_WARN inline bool operator>=(const QString &s2) const; +#endif // QT_CORE_REMOVED_SINCE(6, 8) +#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) + + short toShort(bool *ok = nullptr, int base = 10) const; + ushort toUShort(bool *ok = nullptr, int base = 10) const; + int toInt(bool *ok = nullptr, int base = 10) const; + uint toUInt(bool *ok = nullptr, int base = 10) const; + long toLong(bool *ok = nullptr, int base = 10) const; + ulong toULong(bool *ok = nullptr, int base = 10) const; + qlonglong toLongLong(bool *ok = nullptr, int base = 10) const; + qulonglong toULongLong(bool *ok = nullptr, int base = 10) const; + float toFloat(bool *ok = nullptr) const; + double toDouble(bool *ok = nullptr) const; + QByteArray toBase64(Base64Options options = Base64Encoding) const; + QByteArray toHex(char separator = '\0') const; + QByteArray toPercentEncoding(const QByteArray &exclude = QByteArray(), + const QByteArray &include = QByteArray(), + char percent = '%') const; + [[nodiscard]] QByteArray percentDecoded(char percent = '%') const; + + inline QByteArray &setNum(short, int base = 10); + inline QByteArray &setNum(ushort, int base = 10); + inline QByteArray &setNum(int, int base = 10); + inline QByteArray &setNum(uint, int base = 10); + inline QByteArray &setNum(long, int base = 10); + inline QByteArray &setNum(ulong, int base = 10); + QByteArray &setNum(qlonglong, int base = 10); + QByteArray &setNum(qulonglong, int base = 10); + inline QByteArray &setNum(float, char format = 'g', int precision = 6); + QByteArray &setNum(double, char format = 'g', int precision = 6); + QByteArray &setRawData(const char *a, qsizetype n); + + [[nodiscard]] static QByteArray number(int, int base = 10); + [[nodiscard]] static QByteArray number(uint, int base = 10); + [[nodiscard]] static QByteArray number(long, int base = 10); + [[nodiscard]] static QByteArray number(ulong, int base = 10); + [[nodiscard]] static QByteArray number(qlonglong, int base = 10); + [[nodiscard]] static QByteArray number(qulonglong, int base = 10); + [[nodiscard]] static QByteArray number(double, char format = 'g', int precision = 6); + [[nodiscard]] static QByteArray fromRawData(const char *data, qsizetype size) + { + return QByteArray(DataPointer(nullptr, const_cast(data), size)); + } + + class FromBase64Result; + [[nodiscard]] static FromBase64Result fromBase64Encoding(QByteArray &&base64, Base64Options options = Base64Encoding); + [[nodiscard]] static FromBase64Result fromBase64Encoding(const QByteArray &base64, Base64Options options = Base64Encoding); + [[nodiscard]] static QByteArray fromBase64(const QByteArray &base64, Base64Options options = Base64Encoding); + [[nodiscard]] static QByteArray fromHex(const QByteArray &hexEncoded); + [[nodiscard]] static QByteArray fromPercentEncoding(const QByteArray &pctEncoded, char percent = '%'); + +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) + static QByteArray fromCFData(CFDataRef data); + static QByteArray fromRawCFData(CFDataRef data); + CFDataRef toCFData() const Q_DECL_CF_RETURNS_RETAINED; + CFDataRef toRawCFData() const Q_DECL_CF_RETURNS_RETAINED; + static QByteArray fromNSData(const NSData *data); + static QByteArray fromRawNSData(const NSData *data); + NSData *toNSData() const Q_DECL_NS_RETURNS_AUTORELEASED; + NSData *toRawNSData() const Q_DECL_NS_RETURNS_AUTORELEASED; +#endif + +#if defined(Q_OS_WASM) || defined(Q_QDOC) + static QByteArray fromEcmaUint8Array(emscripten::val uint8array); + emscripten::val toEcmaUint8Array(); +#endif + + typedef char *iterator; + typedef const char *const_iterator; + typedef iterator Iterator; + typedef const_iterator ConstIterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + iterator begin() { return data(); } + const_iterator begin() const noexcept { return d.data(); } + const_iterator cbegin() const noexcept { return begin(); } + const_iterator constBegin() const noexcept { return begin(); } + iterator end() { return begin() + size(); } + const_iterator end() const noexcept { return begin() + size(); } + const_iterator cend() const noexcept { return end(); } + const_iterator constEnd() const noexcept { return end(); } + reverse_iterator rbegin() { return reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } + const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } + const_reverse_iterator crbegin() const noexcept { return rbegin(); } + const_reverse_iterator crend() const noexcept { return rend(); } + + // stl compatibility + typedef qsizetype size_type; + typedef qptrdiff difference_type; + typedef const char & const_reference; + typedef char & reference; + typedef char *pointer; + typedef const char *const_pointer; + typedef char value_type; + void push_back(char c) + { append(c); } + void push_back(const char *s) + { append(s); } + void push_back(const QByteArray &a) + { append(a); } + void push_back(QByteArrayView a) + { append(a); } + void push_front(char c) + { prepend(c); } + void push_front(const char *c) + { prepend(c); } + void push_front(const QByteArray &a) + { prepend(a); } + void push_front(QByteArrayView a) + { prepend(a); } + void shrink_to_fit() { squeeze(); } + iterator erase(const_iterator first, const_iterator last); + inline iterator erase(const_iterator it) { return erase(it, it + 1); } + constexpr qsizetype max_size() const noexcept + { + return maxSize(); + } + + static QByteArray fromStdString(const std::string &s); + std::string toStdString() const; + + static constexpr qsizetype maxSize() noexcept + { + // -1 to deal with the NUL terminator + return Data::maxSize() - 1; + } + inline qsizetype size() const noexcept { return d.size; } +#if QT_DEPRECATED_SINCE(6, 4) + QT_DEPRECATED_VERSION_X_6_4("Use size() or length() instead.") + inline qsizetype count() const noexcept { return size(); } +#endif + inline qsizetype length() const noexcept { return size(); } + QT_CORE_INLINE_SINCE(6, 4) + bool isNull() const noexcept; + + inline const DataPointer &data_ptr() const { return d; } + inline DataPointer &data_ptr() { return d; } +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) + explicit inline QByteArray(const DataPointer &dd) : d(dd) {} +#endif + explicit inline QByteArray(DataPointer &&dd) : d(std::move(dd)) {} + +private: + friend bool comparesEqual(const QByteArray &lhs, const QByteArrayView &rhs) noexcept + { return QByteArrayView(lhs) == rhs; } + friend Qt::strong_ordering + compareThreeWay(const QByteArray &lhs, const QByteArrayView &rhs) noexcept + { + const int res = QtPrivate::compareMemory(QByteArrayView(lhs), rhs); + return Qt::compareThreeWay(res, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QByteArray) + Q_DECLARE_STRONGLY_ORDERED(QByteArray, QByteArrayView) + Q_DECLARE_STRONGLY_ORDERED(QByteArray, const char *) +#if defined(__GLIBCXX__) && defined(__cpp_lib_three_way_comparison) + // libstdc++ has a bug [0] when `operator const void *()` is preferred over + // `operator<=>()` when calling std::less<> and other similar methods. + // Fix it by explicitly providing relational operators in such case. + // [0]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114153 + friend bool operator<(const QByteArray &lhs, const QByteArray &rhs) noexcept + { return is_lt(compareThreeWay(lhs, rhs)); } + friend bool operator<=(const QByteArray &lhs, const QByteArray &rhs) noexcept + { return is_lteq(compareThreeWay(lhs, rhs)); } + friend bool operator>(const QByteArray &lhs, const QByteArray &rhs) noexcept + { return is_gt(compareThreeWay(lhs, rhs)); } + friend bool operator>=(const QByteArray &lhs, const QByteArray &rhs) noexcept + { return is_gteq(compareThreeWay(lhs, rhs)); } +#endif // defined(__GLIBCXX__) && defined(__cpp_lib_three_way_comparison) + + // Check isEmpty() instead of isNull() for backwards compatibility. + friend bool comparesEqual(const QByteArray &lhs, std::nullptr_t) noexcept + { return lhs.isEmpty(); } + friend Qt::strong_ordering compareThreeWay(const QByteArray &lhs, std::nullptr_t) noexcept + { return lhs.isEmpty() ? Qt::strong_ordering::equivalent : Qt::strong_ordering::greater; } + Q_DECLARE_STRONGLY_ORDERED(QByteArray, std::nullptr_t) + + // defined in qstring.cpp + friend Q_CORE_EXPORT bool comparesEqual(const QByteArray &lhs, const QChar &rhs) noexcept; + friend Q_CORE_EXPORT Qt::strong_ordering + compareThreeWay(const QByteArray &lhs, const QChar &rhs) noexcept; + friend Q_CORE_EXPORT bool comparesEqual(const QByteArray &lhs, char16_t rhs) noexcept; + friend Q_CORE_EXPORT Qt::strong_ordering + compareThreeWay(const QByteArray &lhs, char16_t rhs) noexcept; +#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) + Q_DECLARE_STRONGLY_ORDERED(QByteArray, QChar, QT_ASCII_CAST_WARN) + Q_DECLARE_STRONGLY_ORDERED(QByteArray, char16_t, QT_ASCII_CAST_WARN) +#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) + + + void reallocData(qsizetype alloc, QArrayData::AllocationOption option); + void reallocGrowData(qsizetype n); + void expand(qsizetype i); + + Q_ALWAYS_INLINE constexpr void verify([[maybe_unused]] qsizetype pos = 0, + [[maybe_unused]] qsizetype n = 1) const + { + Q_ASSERT(pos >= 0); + Q_ASSERT(pos <= d.size); + Q_ASSERT(n >= 0); + Q_ASSERT(n <= d.size - pos); + } + + static QByteArray sliced_helper(QByteArray &a, qsizetype pos, qsizetype n); + static QByteArray toLower_helper(const QByteArray &a); + static QByteArray toLower_helper(QByteArray &a); + static QByteArray toUpper_helper(const QByteArray &a); + static QByteArray toUpper_helper(QByteArray &a); + static QByteArray trimmed_helper(const QByteArray &a); + static QByteArray trimmed_helper(QByteArray &a); + static QByteArray simplified_helper(const QByteArray &a); + static QByteArray simplified_helper(QByteArray &a); + template + qsizetype removeIf_helper(Predicate pred) + { + const qsizetype result = d->eraseIf(pred); + if (result > 0) + d.data()[d.size] = '\0'; + return result; + } + + friend class QString; + friend Q_CORE_EXPORT QByteArray qUncompress(const uchar *data, qsizetype nbytes); + + template friend qsizetype erase(QByteArray &ba, const T &t); + template friend qsizetype erase_if(QByteArray &ba, Predicate pred); +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QByteArray::Base64Options) + +inline constexpr QByteArray::QByteArray() noexcept {} +inline QByteArray::~QByteArray() {} + +inline char QByteArray::at(qsizetype i) const +{ verify(i, 1); return d.data()[i]; } +inline char QByteArray::operator[](qsizetype i) const +{ verify(i, 1); return d.data()[i]; } + +#ifndef QT_NO_CAST_FROM_BYTEARRAY +inline QByteArray::operator const char *() const +{ return data(); } +inline QByteArray::operator const void *() const +{ return data(); } +#endif +inline char *QByteArray::data() +{ + detach(); + Q_ASSERT(d.data()); + return d.data(); +} +inline const char *QByteArray::data() const noexcept +{ +#if QT5_NULL_STRINGS == 1 + return d.data() ? d.data() : &_empty; +#else + return d.data(); +#endif +} +inline void QByteArray::detach() +{ if (d.needsDetach()) reallocData(size(), QArrayData::KeepSize); } +inline bool QByteArray::isDetached() const +{ return !d.isShared(); } +inline QByteArray::QByteArray(const QByteArray &a) noexcept : d(a.d) +{} + +inline qsizetype QByteArray::capacity() const { return qsizetype(d.constAllocatedCapacity()); } + +inline void QByteArray::reserve(qsizetype asize) +{ + if (d.needsDetach() || asize > capacity() - d.freeSpaceAtBegin()) + reallocData(qMax(size(), asize), QArrayData::KeepSize); + if (d.constAllocatedCapacity()) + d.setFlag(Data::CapacityReserved); +} + +inline void QByteArray::squeeze() +{ + if (!d.isMutable()) + return; + if (d.needsDetach() || size() < capacity()) + reallocData(size(), QArrayData::KeepSize); + if (d.constAllocatedCapacity()) + d.clearFlag(Data::CapacityReserved); +} + +inline char &QByteArray::operator[](qsizetype i) +{ verify(i, 1); return data()[i]; } +inline char &QByteArray::front() { return operator[](0); } +inline char &QByteArray::back() { return operator[](size() - 1); } +inline QByteArray &QByteArray::append(qsizetype n, char ch) +{ return insert(size(), n, ch); } +inline QByteArray &QByteArray::prepend(qsizetype n, char ch) +{ return insert(0, n, ch); } +inline bool QByteArray::contains(char c) const +{ return indexOf(c) != -1; } +inline bool QByteArray::contains(QByteArrayView bv) const +{ return indexOf(bv) != -1; } +inline int QByteArray::compare(QByteArrayView a, Qt::CaseSensitivity cs) const noexcept +{ + return cs == Qt::CaseSensitive ? QtPrivate::compareMemory(*this, a) : + qstrnicmp(data(), size(), a.data(), a.size()); +} +#if !defined(QT_USE_QSTRINGBUILDER) +inline QByteArray operator+(const QByteArray &a1, const QByteArray &a2) +{ return QByteArray(a1) += a2; } +inline QByteArray operator+(QByteArray &&lhs, const QByteArray &rhs) +{ return std::move(lhs += rhs); } +inline QByteArray operator+(const QByteArray &a1, const char *a2) +{ return QByteArray(a1) += a2; } +inline QByteArray operator+(QByteArray &&lhs, const char *rhs) +{ return std::move(lhs += rhs); } +inline QByteArray operator+(const QByteArray &a1, char a2) +{ return QByteArray(a1) += a2; } +inline QByteArray operator+(QByteArray &&lhs, char rhs) +{ return std::move(lhs += rhs); } +inline QByteArray operator+(const char *a1, const QByteArray &a2) +{ return QByteArray(a1) += a2; } +inline QByteArray operator+(char a1, const QByteArray &a2) +{ return QByteArray(&a1, 1) += a2; } +#endif // QT_USE_QSTRINGBUILDER + +inline QByteArray &QByteArray::setNum(short n, int base) +{ return setNum(qlonglong(n), base); } +inline QByteArray &QByteArray::setNum(ushort n, int base) +{ return setNum(qulonglong(n), base); } +inline QByteArray &QByteArray::setNum(int n, int base) +{ return setNum(qlonglong(n), base); } +inline QByteArray &QByteArray::setNum(uint n, int base) +{ return setNum(qulonglong(n), base); } +inline QByteArray &QByteArray::setNum(long n, int base) +{ return setNum(qlonglong(n), base); } +inline QByteArray &QByteArray::setNum(ulong n, int base) +{ return setNum(qulonglong(n), base); } +inline QByteArray &QByteArray::setNum(float n, char format, int precision) +{ return setNum(double(n), format, precision); } + +#if QT_CORE_INLINE_IMPL_SINCE(6, 4) +bool QByteArray::isNull() const noexcept +{ + return d.isNull(); +} +#endif +#if QT_CORE_INLINE_IMPL_SINCE(6, 8) +qsizetype QByteArray::indexOf(char ch, qsizetype from) const +{ + return qToByteArrayViewIgnoringNull(*this).indexOf(ch, from); +} +qsizetype QByteArray::lastIndexOf(char ch, qsizetype from) const +{ + return qToByteArrayViewIgnoringNull(*this).lastIndexOf(ch, from); +} +#endif + +#if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED) +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QByteArray &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QByteArray &); +#endif + +#ifndef QT_NO_COMPRESS +Q_CORE_EXPORT QByteArray qCompress(const uchar* data, qsizetype nbytes, int compressionLevel = -1); +Q_CORE_EXPORT QByteArray qUncompress(const uchar* data, qsizetype nbytes); +inline QByteArray qCompress(const QByteArray& data, int compressionLevel = -1) +{ return qCompress(reinterpret_cast(data.constData()), data.size(), compressionLevel); } +inline QByteArray qUncompress(const QByteArray& data) +{ return qUncompress(reinterpret_cast(data.constData()), data.size()); } +#endif + +Q_DECLARE_SHARED(QByteArray) + +class QByteArray::FromBase64Result +{ +public: + QByteArray decoded; + QByteArray::Base64DecodingStatus decodingStatus; + + void swap(QByteArray::FromBase64Result &other) noexcept + { + decoded.swap(other.decoded); + std::swap(decodingStatus, other.decodingStatus); + } + + explicit operator bool() const noexcept { return decodingStatus == QByteArray::Base64DecodingStatus::Ok; } + +#if defined(Q_COMPILER_REF_QUALIFIERS) && !defined(Q_QDOC) + QByteArray &operator*() & noexcept { return decoded; } + const QByteArray &operator*() const & noexcept { return decoded; } + QByteArray &&operator*() && noexcept { return std::move(decoded); } +#else + QByteArray &operator*() noexcept { return decoded; } + const QByteArray &operator*() const noexcept { return decoded; } +#endif + + friend inline bool operator==(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept + { + if (lhs.decodingStatus != rhs.decodingStatus) + return false; + + if (lhs.decodingStatus == QByteArray::Base64DecodingStatus::Ok && lhs.decoded != rhs.decoded) + return false; + + return true; + } + + friend inline bool operator!=(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept + { + return !(lhs == rhs); + } +}; + +Q_DECLARE_SHARED(QByteArray::FromBase64Result) + + +Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(const QByteArray::FromBase64Result &key, size_t seed = 0) noexcept; + +template +qsizetype erase(QByteArray &ba, const T &t) +{ + return ba.removeIf_helper([&t](const auto &e) { return t == e; }); +} + +template +qsizetype erase_if(QByteArray &ba, Predicate pred) +{ + return ba.removeIf_helper(pred); +} + +// +// QByteArrayView members that require QByteArray: +// +QByteArray QByteArrayView::toByteArray() const +{ + return QByteArray(*this); +} + +namespace Qt { +inline namespace Literals { +inline namespace StringLiterals { + +inline QByteArray operator""_ba(const char *str, size_t size) noexcept +{ + return QByteArray(QByteArrayData(nullptr, const_cast(str), qsizetype(size))); +} + +} // StringLiterals +} // Literals +} // Qt + +inline namespace QtLiterals { +#if QT_DEPRECATED_SINCE(6, 8) + +QT_DEPRECATED_VERSION_X_6_8("Use _ba from Qt::StringLiterals namespace instead.") +inline QByteArray operator""_qba(const char *str, size_t size) noexcept +{ + return Qt::StringLiterals::operator""_ba(str, size); +} + +#endif // QT_DEPRECATED_SINCE(6, 8) +} // QtLiterals + +QT_END_NAMESPACE + +#endif // QBYTEARRAY_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qbytearrayalgorithms.h b/qt/6.8.1/msvc2022_64/include/QtCore/qbytearrayalgorithms.h new file mode 100644 index 0000000000000000000000000000000000000000..61d9ae5fbcaf364762a39099a07203cf0a2a0e51 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qbytearrayalgorithms.h @@ -0,0 +1,154 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QBYTEARRAYALGORITHMS_H +#define QBYTEARRAYALGORITHMS_H + +#include + +#include +#include + +#if 0 +#pragma qt_class(QByteArrayAlgorithms) +#endif + +QT_BEGIN_NAMESPACE + +class QByteArrayView; + +namespace QtPrivate { + +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION +bool startsWith(QByteArrayView haystack, QByteArrayView needle) noexcept; + +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION +bool endsWith(QByteArrayView haystack, QByteArrayView needle) noexcept; + +[[nodiscard]] inline // defined in qbytearrayview.h +qsizetype findByteArray(QByteArrayView haystack, qsizetype from, char needle) noexcept; + +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION +qsizetype findByteArray(QByteArrayView haystack, qsizetype from, QByteArrayView needle) noexcept; + +[[nodiscard]] inline // defined in qbytearrayview.h +qsizetype lastIndexOf(QByteArrayView haystack, qsizetype from, uchar needle) noexcept; + +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION +qsizetype lastIndexOf(QByteArrayView haystack, qsizetype from, QByteArrayView needle) noexcept; + +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION +qsizetype count(QByteArrayView haystack, QByteArrayView needle) noexcept; + +[[nodiscard]] Q_CORE_EXPORT int compareMemory(QByteArrayView lhs, QByteArrayView rhs); + +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION QByteArrayView trimmed(QByteArrayView s) noexcept; + +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isValidUtf8(QByteArrayView s) noexcept; + +template +class ParsedNumber +{ + T m_value; + quint32 m_error : 1; + quint32 m_reserved : 31; + void *m_reserved2 = nullptr; +public: + constexpr ParsedNumber() noexcept : m_value(), m_error(true), m_reserved(0) {} + constexpr explicit ParsedNumber(T v) : m_value(v), m_error(false), m_reserved(0) {} + + // minimal optional-like API: + explicit operator bool() const noexcept { return !m_error; } + T &operator*() { Q_ASSERT(*this); return m_value; } + const T &operator*() const { Q_ASSERT(*this); return m_value; } + T *operator->() noexcept { return *this ? &m_value : nullptr; } + const T *operator->() const noexcept { return *this ? &m_value : nullptr; } + template // not = T, as that'd allow calls that are incompatible with std::optional + T value_or(U &&u) const { return *this ? m_value : T(std::forward(u)); } +}; + +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION ParsedNumber toDouble(QByteArrayView a) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION ParsedNumber toFloat(QByteArrayView a) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION ParsedNumber toSignedInteger(QByteArrayView data, int base); +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION ParsedNumber toUnsignedInteger(QByteArrayView data, int base); + +// QByteArrayView has incomplete type here, and we can't include qbytearrayview.h, +// since it includes qbytearrayalgorithms.h. Use the ByteArrayView template type as +// a workaround. +template >> +static inline T toIntegral(ByteArrayView data, bool *ok, int base) +{ + const auto val = [&] { + if constexpr (std::is_unsigned_v) + return toUnsignedInteger(data, base); + else + return toSignedInteger(data, base); + }(); + const bool failed = !val || T(*val) != *val; + if (ok) + *ok = !failed; + if (failed) + return 0; + return T(*val); +} + +} // namespace QtPrivate + +/***************************************************************************** + Safe and portable C string functions; extensions to standard string.h + *****************************************************************************/ + +[[nodiscard]] Q_DECL_PURE_FUNCTION Q_CORE_EXPORT +const void *qmemrchr(const void *s, int needle, size_t n) noexcept; +Q_CORE_EXPORT char *qstrdup(const char *); + +inline size_t qstrlen(const char *str) +{ + QT_WARNING_PUSH +#if defined(Q_CC_GNU_ONLY) && Q_CC_GNU >= 900 && Q_CC_GNU < 1000 + // spurious compiler warning (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91490#c6) + // when Q_DECLARE_METATYPE_TEMPLATE_1ARG is used + QT_WARNING_DISABLE_GCC("-Wstringop-overflow") +#endif + return str ? strlen(str) : 0; + QT_WARNING_POP +} + +inline size_t qstrnlen(const char *str, size_t maxlen) +{ + if (!str) + return 0; + auto end = static_cast(memchr(str, '\0', maxlen)); + return end ? end - str : maxlen; +} + +// implemented in qbytearray.cpp +Q_CORE_EXPORT char *qstrcpy(char *dst, const char *src); +Q_CORE_EXPORT char *qstrncpy(char *dst, const char *src, size_t len); + +Q_CORE_EXPORT int qstrcmp(const char *str1, const char *str2); + +inline int qstrncmp(const char *str1, const char *str2, size_t len) +{ + return (str1 && str2) ? strncmp(str1, str2, len) + : (str1 ? 1 : (str2 ? -1 : 0)); +} +Q_CORE_EXPORT int qstricmp(const char *, const char *); +Q_CORE_EXPORT int qstrnicmp(const char *, const char *, size_t len); +Q_CORE_EXPORT int qstrnicmp(const char *, qsizetype, const char *, qsizetype = -1); + +#ifndef QT_NO_QSNPRINTF // use std::(v)snprintf() from instead +// implemented in qvsnprintf.cpp +Q_CORE_EXPORT int qvsnprintf(char *str, size_t n, const char *fmt, va_list ap) + Q_ATTRIBUTE_FORMAT_PRINTF(3, 0); +Q_CORE_EXPORT int qsnprintf(char *str, size_t n, const char *fmt, ...) + Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); +#endif // QT_NO_QSNPRINTF + +// qChecksum: Internet checksum +Q_CORE_EXPORT quint16 qChecksum(QByteArrayView data, Qt::ChecksumType standard = Qt::ChecksumIso3309); + +QT_END_NAMESPACE + +#endif // QBYTEARRAYALGORITHMS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qbytearraylist.h b/qt/6.8.1/msvc2022_64/include/QtCore/qbytearraylist.h new file mode 100644 index 0000000000000000000000000000000000000000..675bc05776c4c90a90c2f876d76137f879b6a4d0 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qbytearraylist.h @@ -0,0 +1,60 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Intel Corporation. +// Copyright (C) 2014 by Southwest Research Institute (R) +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include + +#ifndef QBYTEARRAYLIST_H +#define QBYTEARRAYLIST_H + +#include + +#include + +QT_BEGIN_NAMESPACE + +#if !defined(QT_NO_JAVA_STYLE_ITERATORS) +typedef QListIterator QByteArrayListIterator; +typedef QMutableListIterator QMutableByteArrayListIterator; +#endif + +#ifndef Q_QDOC + +namespace QtPrivate { +#if QT_CORE_REMOVED_SINCE(6, 3) && QT_POINTER_SIZE != 4 + QByteArray Q_CORE_EXPORT QByteArrayList_join(const QByteArrayList *that, const char *separator, int separatorLength); +#endif + QByteArray Q_CORE_EXPORT QByteArrayList_join(const QByteArrayList *that, const char *sep, qsizetype len); +} +#endif + +#ifdef Q_QDOC +class QByteArrayList : public QList +#else +template <> struct QListSpecialMethods : QListSpecialMethodsBase +#endif +{ +#ifndef Q_QDOC +protected: + ~QListSpecialMethods() = default; +#endif +public: + using QListSpecialMethodsBase::indexOf; + using QListSpecialMethodsBase::lastIndexOf; + using QListSpecialMethodsBase::contains; + + QByteArray join(QByteArrayView sep = {}) const + { + return QtPrivate::QByteArrayList_join(self(), sep.data(), sep.size()); + } + Q_WEAK_OVERLOAD + inline QByteArray join(const QByteArray &sep) const + { return join(qToByteArrayViewIgnoringNull(sep)); } + inline QByteArray join(char sep) const + { return join({&sep, 1}); } +}; + +QT_END_NAMESPACE + +#endif // QBYTEARRAYLIST_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qbytearraymatcher.h b/qt/6.8.1/msvc2022_64/include/QtCore/qbytearraymatcher.h new file mode 100644 index 0000000000000000000000000000000000000000..0bd6abb29878ba3c6a27c07960072b01db4beef8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qbytearraymatcher.h @@ -0,0 +1,128 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QBYTEARRAYMATCHER_H +#define QBYTEARRAYMATCHER_H + +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + + +class QByteArrayMatcherPrivate; + +class Q_CORE_EXPORT QByteArrayMatcher +{ +public: + QByteArrayMatcher(); + explicit QByteArrayMatcher(const QByteArray &pattern); + explicit QByteArrayMatcher(QByteArrayView pattern) + : QByteArrayMatcher(pattern.data(), pattern.size()) + {} + explicit QByteArrayMatcher(const char *pattern, qsizetype length = -1); + QByteArrayMatcher(const QByteArrayMatcher &other); + ~QByteArrayMatcher(); + + QByteArrayMatcher &operator=(const QByteArrayMatcher &other); + + void setPattern(const QByteArray &pattern); + +#if QT_CORE_REMOVED_SINCE(6, 3) + qsizetype indexIn(const QByteArray &ba, qsizetype from = 0) const; +#else + Q_WEAK_OVERLOAD + qsizetype indexIn(const QByteArray &ba, qsizetype from = 0) const + { return indexIn(QByteArrayView{ba}, from); } +#endif + qsizetype indexIn(const char *str, qsizetype len, qsizetype from = 0) const; + qsizetype indexIn(QByteArrayView data, qsizetype from = 0) const; + inline QByteArray pattern() const + { + if (q_pattern.isNull()) + return QByteArray(reinterpret_cast(p.p), p.l); + return q_pattern; + } + +private: + QByteArrayMatcherPrivate *d; + QByteArray q_pattern; + struct Data { + uchar q_skiptable[256]; + const uchar *p; + qsizetype l; + }; + union { + uint dummy[256]; + Data p; + }; +}; + +class QStaticByteArrayMatcherBase +{ + alignas(16) + struct Skiptable { + uchar data[256]; + } m_skiptable; +protected: + explicit constexpr QStaticByteArrayMatcherBase(const char *pattern, size_t n) noexcept + : m_skiptable(generate(pattern, n)) {} + // compiler-generated copy/more ctors/assignment operators are ok! + ~QStaticByteArrayMatcherBase() = default; + +#if QT_CORE_REMOVED_SINCE(6, 3) && QT_POINTER_SIZE != 4 + Q_CORE_EXPORT int indexOfIn(const char *needle, uint nlen, const char *haystack, int hlen, int from) const noexcept; +#endif + Q_CORE_EXPORT qsizetype indexOfIn(const char *needle, size_t nlen, + const char *haystack, qsizetype hlen, + qsizetype from) const noexcept; + +private: + static constexpr Skiptable generate(const char *pattern, size_t n) noexcept + { + const auto uchar_max = (std::numeric_limits::max)(); + uchar max = n > uchar_max ? uchar_max : uchar(n); + Skiptable table = {}; + q20::fill(std::begin(table.data), std::end(table.data), max); + pattern += n - max; + while (max--) + table.data[uchar(*pattern++)] = max; + return table; + } +}; + +template +class QStaticByteArrayMatcher : QStaticByteArrayMatcherBase +{ + char m_pattern[N]; + // N includes the terminating '\0'! + static_assert(N > 2, "QStaticByteArrayMatcher makes no sense for finding a single-char pattern"); +public: + explicit constexpr QStaticByteArrayMatcher(const char (&patternToMatch)[N]) noexcept + : QStaticByteArrayMatcherBase(patternToMatch, N - 1), m_pattern() + { + for (size_t i = 0; i < N; ++i) + m_pattern[i] = patternToMatch[i]; + } + + Q_WEAK_OVERLOAD + qsizetype indexIn(const QByteArray &haystack, qsizetype from = 0) const noexcept + { return this->indexOfIn(m_pattern, N - 1, haystack.data(), haystack.size(), from); } + qsizetype indexIn(const char *haystack, qsizetype hlen, qsizetype from = 0) const noexcept + { return this->indexOfIn(m_pattern, N - 1, haystack, hlen, from); } + qsizetype indexIn(QByteArrayView haystack, qsizetype from = 0) const noexcept + { return this->indexOfIn(m_pattern, N - 1, haystack.data(), haystack.size(), from); } + + QByteArray pattern() const { return QByteArray(m_pattern, qsizetype(N - 1)); } +}; + +template +constexpr QStaticByteArrayMatcher qMakeStaticByteArrayMatcher(const char (&pattern)[N]) noexcept +{ return QStaticByteArrayMatcher(pattern); } + +QT_END_NAMESPACE + +#endif // QBYTEARRAYMATCHER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qbytearrayview.h b/qt/6.8.1/msvc2022_64/include/QtCore/qbytearrayview.h new file mode 100644 index 0000000000000000000000000000000000000000..943c5898b26c6dbbaa7867be68a15b8479dc64bf --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qbytearrayview.h @@ -0,0 +1,437 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +#ifndef QBYTEARRAYVIEW_H +#define QBYTEARRAYVIEW_H + +#include +#include +#include +#include +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtPrivate { + +template +struct IsCompatibleByteTypeHelper : std::false_type {}; +template <> struct IsCompatibleByteTypeHelper : std::true_type {}; +template <> struct IsCompatibleByteTypeHelper : std::true_type {}; +template <> struct IsCompatibleByteTypeHelper : std::true_type {}; +template <> struct IsCompatibleByteTypeHelper : std::true_type {}; + +template +struct IsCompatibleByteType + : IsCompatibleByteTypeHelper> {}; + +template +struct IsCompatibleByteArrayPointerHelper : std::false_type {}; +template +struct IsCompatibleByteArrayPointerHelper + : IsCompatibleByteType {}; +template +struct IsCompatibleByteArrayPointer + : IsCompatibleByteArrayPointerHelper> {}; + +template +struct IsContainerCompatibleWithQByteArrayView : std::false_type {}; + +template +struct IsContainerCompatibleWithQByteArrayView()))>, + // ... and that has a suitable size ... + std::is_convertible())), qsizetype>, + // ... and it's a range as it defines an iterator-like API + IsCompatibleByteType()))>::value_type>, + std::is_convertible()) + != std::end(std::declval())), + bool>, + + // This needs to be treated specially due to the empty vs null distinction + std::negation, QByteArray>>, + + // We handle array literals specially for source compat reasons + std::negation>, + + // Don't make an accidental copy constructor + std::negation, QByteArrayView>>>>> : std::true_type {}; + +// Used by QLatin1StringView too +template +static constexpr qsizetype lengthHelperPointer(const Char *data) noexcept +{ + // std::char_traits can only be used with one of the regular char types + // (char, char16_t, wchar_t, but not uchar or QChar), so we roll the loop + // out by ourselves. + qsizetype i = 0; + if (!data) + return i; + while (data[i] != Char(0)) + ++i; + return i; +} + +} // namespace QtPrivate + +class Q_CORE_EXPORT QByteArrayView +{ +public: + typedef char storage_type; + typedef const char value_type; + typedef qptrdiff difference_type; + typedef qsizetype size_type; + typedef value_type &reference; + typedef value_type &const_reference; + typedef value_type *pointer; + typedef value_type *const_pointer; + + typedef pointer iterator; + typedef const_pointer const_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + +private: + template + using if_compatible_byte = + typename std::enable_if_t::value, bool>; + + template + using if_compatible_pointer = + typename std::enable_if_t::value, + bool>; + + template + using if_compatible_qbytearray_like = + typename std::enable_if_t, bool>; + + template + using if_compatible_container = + typename std::enable_if_t::value, + bool>; + + template + static constexpr qsizetype lengthHelperContainer(const Container &c) noexcept + { + return qsizetype(std::size(c)); + } + + static constexpr qsizetype lengthHelperCharArray(const char *data, size_t size) noexcept + { + const auto it = std::char_traits::find(data, size, '\0'); + const auto end = it ? it : std::next(data, size); + return qsizetype(std::distance(data, end)); + } + + template + static const storage_type *castHelper(const Byte *data) noexcept + { return reinterpret_cast(data); } + static constexpr const storage_type *castHelper(const storage_type *data) noexcept + { return data; } + +public: + constexpr QByteArrayView() noexcept + : m_size(0), m_data(nullptr) {} + constexpr QByteArrayView(std::nullptr_t) noexcept + : QByteArrayView() {} + + template = true> + constexpr QByteArrayView(const Byte *data, qsizetype len) + : m_size((Q_ASSERT(len >= 0), Q_ASSERT(data || !len), len)), + m_data(castHelper(data)) {} + + template = true> + constexpr QByteArrayView(const Byte *first, const Byte *last) + : QByteArrayView(first, last - first) {} + +#ifdef Q_QDOC + template + constexpr QByteArrayView(const Byte *data) noexcept; +#else + template = true> + constexpr QByteArrayView(const Pointer &data) noexcept + : QByteArrayView( + data, data ? QtPrivate::lengthHelperPointer(data) : 0) {} +#endif + +#ifdef Q_QDOC + QByteArrayView(const QByteArray &data) noexcept; +#else + template = true> + QByteArrayView(const ByteArray &ba) noexcept + : QByteArrayView{ba.begin(), ba.size()} {} +#endif + + template = true> + constexpr QByteArrayView(const Container &c) noexcept + : QByteArrayView(std::data(c), lengthHelperContainer(c)) {} + template + constexpr QByteArrayView(const char (&data)[Size]) noexcept + : QByteArrayView(data, lengthHelperCharArray(data, Size)) {} + +#ifdef Q_QDOC + template +#else + template = true> +#endif + [[nodiscard]] constexpr static QByteArrayView fromArray(const Byte (&data)[Size]) noexcept + { return QByteArrayView(data, Size); } + [[nodiscard]] inline QByteArray toByteArray() const; // defined in qbytearray.h + + [[nodiscard]] constexpr qsizetype size() const noexcept { return m_size; } + [[nodiscard]] constexpr const_pointer data() const noexcept { return m_data; } + [[nodiscard]] constexpr const_pointer constData() const noexcept { return data(); } + + [[nodiscard]] constexpr char operator[](qsizetype n) const + { verify(n, 1); return m_data[n]; } + + // + // QByteArray API + // + [[nodiscard]] constexpr char at(qsizetype n) const { return (*this)[n]; } + + [[nodiscard]] constexpr QByteArrayView first(qsizetype n) const + { verify(0, n); return sliced(0, n); } + [[nodiscard]] constexpr QByteArrayView last(qsizetype n) const + { verify(0, n); return sliced(size() - n, n); } + [[nodiscard]] constexpr QByteArrayView sliced(qsizetype pos) const + { verify(pos, 0); return QByteArrayView(data() + pos, size() - pos); } + [[nodiscard]] constexpr QByteArrayView sliced(qsizetype pos, qsizetype n) const + { verify(pos, n); return QByteArrayView(data() + pos, n); } + + constexpr QByteArrayView &slice(qsizetype pos) + { *this = sliced(pos); return *this; } + constexpr QByteArrayView &slice(qsizetype pos, qsizetype n) + { *this = sliced(pos, n); return *this; } + + [[nodiscard]] constexpr QByteArrayView chopped(qsizetype len) const + { verify(0, len); return sliced(0, size() - len); } + + [[nodiscard]] constexpr QByteArrayView left(qsizetype n) const + { if (n < 0 || n > size()) n = size(); return QByteArrayView(data(), n); } + [[nodiscard]] constexpr QByteArrayView right(qsizetype n) const + { if (n < 0 || n > size()) n = size(); if (n < 0) n = 0; return QByteArrayView(data() + size() - n, n); } + [[nodiscard]] constexpr QByteArrayView mid(qsizetype pos, qsizetype n = -1) const + { + using namespace QtPrivate; + auto result = QContainerImplHelper::mid(size(), &pos, &n); + return result == QContainerImplHelper::Null ? QByteArrayView() + : QByteArrayView(m_data + pos, n); + } + + constexpr void truncate(qsizetype n) + { verify(0, n); m_size = n; } + constexpr void chop(qsizetype n) + { verify(0, n); m_size -= n; } + + // Defined in qbytearray.cpp: + [[nodiscard]] QByteArrayView trimmed() const noexcept + { return QtPrivate::trimmed(*this); } + [[nodiscard]] short toShort(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral(*this, ok, base); } + [[nodiscard]] ushort toUShort(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral(*this, ok, base); } + [[nodiscard]] int toInt(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral(*this, ok, base); } + [[nodiscard]] uint toUInt(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral(*this, ok, base); } + [[nodiscard]] long toLong(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral(*this, ok, base); } + [[nodiscard]] ulong toULong(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral(*this, ok, base); } + [[nodiscard]] qlonglong toLongLong(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral(*this, ok, base); } + [[nodiscard]] qulonglong toULongLong(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral(*this, ok, base); } + [[nodiscard]] float toFloat(bool *ok = nullptr) const + { + const auto r = QtPrivate::toFloat(*this); + if (ok) + *ok = bool(r); + return r.value_or(0.0f); + } + [[nodiscard]] double toDouble(bool *ok = nullptr) const + { + const auto r = QtPrivate::toDouble(*this); + if (ok) + *ok = bool(r); + return r.value_or(0.0); + } + + [[nodiscard]] bool startsWith(QByteArrayView other) const noexcept + { return QtPrivate::startsWith(*this, other); } + [[nodiscard]] constexpr bool startsWith(char c) const noexcept + { return !empty() && front() == c; } + + [[nodiscard]] bool endsWith(QByteArrayView other) const noexcept + { return QtPrivate::endsWith(*this, other); } + [[nodiscard]] constexpr bool endsWith(char c) const noexcept + { return !empty() && back() == c; } + + [[nodiscard]] qsizetype indexOf(QByteArrayView a, qsizetype from = 0) const noexcept + { return QtPrivate::findByteArray(*this, from, a); } + [[nodiscard]] qsizetype indexOf(char ch, qsizetype from = 0) const noexcept + { return QtPrivate::findByteArray(*this, from, ch); } + + [[nodiscard]] bool contains(QByteArrayView a) const noexcept + { return indexOf(a) != qsizetype(-1); } + [[nodiscard]] bool contains(char c) const noexcept + { return indexOf(c) != qsizetype(-1); } + + [[nodiscard]] qsizetype lastIndexOf(QByteArrayView a) const noexcept + { return lastIndexOf(a, size()); } + [[nodiscard]] qsizetype lastIndexOf(QByteArrayView a, qsizetype from) const noexcept + { return QtPrivate::lastIndexOf(*this, from, a); } + [[nodiscard]] qsizetype lastIndexOf(char ch, qsizetype from = -1) const noexcept + { return QtPrivate::lastIndexOf(*this, from, ch); } + + [[nodiscard]] qsizetype count(QByteArrayView a) const noexcept + { return QtPrivate::count(*this, a); } + [[nodiscard]] qsizetype count(char ch) const noexcept + { return QtPrivate::count(*this, QByteArrayView(&ch, 1)); } + + inline int compare(QByteArrayView a, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + + [[nodiscard]] inline bool isValidUtf8() const noexcept { return QtPrivate::isValidUtf8(*this); } + + // + // STL compatibility API: + // + [[nodiscard]] constexpr const_iterator begin() const noexcept { return data(); } + [[nodiscard]] constexpr const_iterator end() const noexcept { return data() + size(); } + [[nodiscard]] constexpr const_iterator cbegin() const noexcept { return begin(); } + [[nodiscard]] constexpr const_iterator cend() const noexcept { return end(); } + [[nodiscard]] constexpr const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } + [[nodiscard]] constexpr const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } + [[nodiscard]] constexpr const_reverse_iterator crbegin() const noexcept { return rbegin(); } + [[nodiscard]] constexpr const_reverse_iterator crend() const noexcept { return rend(); } + + [[nodiscard]] constexpr bool empty() const noexcept { return size() == 0; } + [[nodiscard]] constexpr char front() const { Q_ASSERT(!empty()); return m_data[0]; } + [[nodiscard]] constexpr char back() const { Q_ASSERT(!empty()); return m_data[m_size - 1]; } + + [[nodiscard]] constexpr Q_IMPLICIT operator std::string_view() const noexcept + { return std::string_view(m_data, size_t(m_size)); } + + [[nodiscard]] constexpr qsizetype max_size() const noexcept { return maxSize(); } + + // + // Qt compatibility API: + // + [[nodiscard]] constexpr bool isNull() const noexcept { return !m_data; } + [[nodiscard]] constexpr bool isEmpty() const noexcept { return empty(); } + [[nodiscard]] constexpr qsizetype length() const noexcept + { return size(); } + [[nodiscard]] constexpr char first() const { return front(); } + [[nodiscard]] constexpr char last() const { return back(); } + + [[nodiscard]] static constexpr qsizetype maxSize() noexcept + { + // -1 to deal with the pointer one-past-the-end; + return QtPrivate::MaxAllocSize - 1; + } + +private: + Q_ALWAYS_INLINE constexpr void verify([[maybe_unused]] qsizetype pos = 0, + [[maybe_unused]] qsizetype n = 1) const + { + Q_ASSERT(pos >= 0); + Q_ASSERT(pos <= size()); + Q_ASSERT(n >= 0); + Q_ASSERT(n <= size() - pos); + } + + friend bool + comparesEqual(const QByteArrayView &lhs, const QByteArrayView &rhs) noexcept + { + return lhs.size() == rhs.size() + && (!lhs.size() || memcmp(lhs.data(), rhs.data(), lhs.size()) == 0); + } + friend Qt::strong_ordering + compareThreeWay(const QByteArrayView &lhs, const QByteArrayView &rhs) noexcept + { + const int res = QtPrivate::compareMemory(lhs, rhs); + return Qt::compareThreeWay(res, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QByteArrayView) + + friend bool comparesEqual(const QByteArrayView &lhs, const char *rhs) noexcept + { return comparesEqual(lhs, QByteArrayView(rhs)); } + friend Qt::strong_ordering + compareThreeWay(const QByteArrayView &lhs, const char *rhs) noexcept + { return compareThreeWay(lhs, QByteArrayView(rhs)); } + Q_DECLARE_STRONGLY_ORDERED(QByteArrayView, const char *) + + // defined in qstring.cpp + friend Q_CORE_EXPORT bool + comparesEqual(const QByteArrayView &lhs, const QChar &rhs) noexcept; + friend Q_CORE_EXPORT Qt::strong_ordering + compareThreeWay(const QByteArrayView &lhs, const QChar &rhs) noexcept; + friend Q_CORE_EXPORT bool + comparesEqual(const QByteArrayView &lhs, char16_t rhs) noexcept; + friend Q_CORE_EXPORT Qt::strong_ordering + compareThreeWay(const QByteArrayView &lhs, char16_t rhs) noexcept; +#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) + Q_DECLARE_STRONGLY_ORDERED(QByteArrayView, QChar, QT_ASCII_CAST_WARN) + Q_DECLARE_STRONGLY_ORDERED(QByteArrayView, char16_t, QT_ASCII_CAST_WARN) +#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) + + qsizetype m_size; + const storage_type *m_data; +}; +Q_DECLARE_TYPEINFO(QByteArrayView, Q_PRIMITIVE_TYPE); + +template, bool> = true> +[[nodiscard]] inline QByteArrayView qToByteArrayViewIgnoringNull(const QByteArrayLike &b) noexcept +{ return QByteArrayView(b.begin(), b.size()); } + +inline int QByteArrayView::compare(QByteArrayView a, Qt::CaseSensitivity cs) const noexcept +{ + return cs == Qt::CaseSensitive ? QtPrivate::compareMemory(*this, a) : + qstrnicmp(data(), size(), a.data(), a.size()); +} + +#if QT_DEPRECATED_SINCE(6, 0) +QT_DEPRECATED_VERSION_X_6_0("Use the QByteArrayView overload.") +inline quint16 qChecksum(const char *s, qsizetype len, + Qt::ChecksumType standard = Qt::ChecksumIso3309) +{ return qChecksum(QByteArrayView(s, len), standard); } +#endif + +qsizetype QtPrivate::findByteArray(QByteArrayView haystack, qsizetype from, char needle) noexcept +{ + if (from < 0) + from = qMax(from + haystack.size(), qsizetype(0)); + if (from < haystack.size()) { + const char *const b = haystack.data(); + if (const auto n = static_cast( + memchr(b + from, needle, static_cast(haystack.size() - from)))) { + return n - b; + } + } + return -1; +} + +qsizetype QtPrivate::lastIndexOf(QByteArrayView haystack, qsizetype from, uchar needle) noexcept +{ + if (from < 0) + from = qMax(from + haystack.size(), qsizetype(0)); + else + from = qMin(from, haystack.size() - 1); + + const char *const b = haystack.data(); + const void *n = b ? qmemrchr(b, needle, from + 1) : nullptr; + return n ? static_cast(n) - b : -1; +} + +QT_END_NAMESPACE + +#endif // QBYTEARRAYVIEW_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcache.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcache.h new file mode 100644 index 0000000000000000000000000000000000000000..69295d2a54ae8c6322005c8962c445d7cbe8e451 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcache.h @@ -0,0 +1,253 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCACHE_H +#define QCACHE_H + +#include + +QT_BEGIN_NAMESPACE + + +template +class QCache +{ + struct Value + { + T *t = nullptr; + qsizetype cost = 0; + Value() noexcept = default; + Value(T *tt, qsizetype c) noexcept + : t(tt), cost(c) + {} + Value(Value &&other) noexcept + : t(other.t), + cost(other.cost) + { + other.t = nullptr; + } + Value &operator=(Value &&other) noexcept + { + qt_ptr_swap(t, other.t); + std::swap(cost, other.cost); + return *this; + } + ~Value() { delete t; } + + private: + Q_DISABLE_COPY(Value) + }; + + struct Chain + { + Chain() noexcept : prev(this), next(this) { } + Chain *prev; + Chain *next; + }; + + struct Node : public Chain + { + using KeyType = Key; + using ValueType = Value; + + Key key; + Value value; + + Node(const Key &k, Value &&t) noexcept(std::is_nothrow_move_assignable_v) + : Chain(), + key(k), + value(std::move(t)) + { + } + Node(Key &&k, Value &&t) noexcept(std::is_nothrow_move_assignable_v) + : Chain(), + key(std::move(k)), + value(std::move(t)) + { + } + static void createInPlace(Node *n, const Key &k, T *o, qsizetype cost) + { + new (n) Node{ Key(k), Value(o, cost) }; + } + void emplace(T *o, qsizetype cost) + { + value = Value(o, cost); + } + + Node(Node &&other) + : Chain(other), + key(std::move(other.key)), + value(std::move(other.value)) + { + Q_ASSERT(this->prev); + Q_ASSERT(this->next); + this->prev->next = this; + this->next->prev = this; + } + private: + Q_DISABLE_COPY(Node) + }; + + using Data = QHashPrivate::Data; + + mutable Chain chain; + Data d; + qsizetype mx = 0; + qsizetype total = 0; + + void unlink(Node *n) noexcept(std::is_nothrow_destructible_v) + { + Q_ASSERT(n->prev); + Q_ASSERT(n->next); + n->prev->next = n->next; + n->next->prev = n->prev; + total -= n->value.cost; + auto it = d.findBucket(n->key); + d.erase(it); + } + T *relink(const Key &key) const noexcept + { + if (isEmpty()) + return nullptr; + Node *n = d.findNode(key); + if (!n) + return nullptr; + + if (chain.next != n) { + Q_ASSERT(n->prev); + Q_ASSERT(n->next); + n->prev->next = n->next; + n->next->prev = n->prev; + n->next = chain.next; + chain.next->prev = n; + n->prev = &chain; + chain.next = n; + } + return n->value.t; + } + + void trim(qsizetype m) noexcept(std::is_nothrow_destructible_v) + { + while (chain.prev != &chain && total > m) { + Node *n = static_cast(chain.prev); + unlink(n); + } + } + + + Q_DISABLE_COPY(QCache) + +public: + inline explicit QCache(qsizetype maxCost = 100) noexcept + : mx(maxCost) + { + } + inline ~QCache() + { + static_assert(std::is_nothrow_destructible_v, "Types with throwing destructors are not supported in Qt containers."); + static_assert(std::is_nothrow_destructible_v, "Types with throwing destructors are not supported in Qt containers."); + + clear(); + } + + inline qsizetype maxCost() const noexcept { return mx; } + void setMaxCost(qsizetype m) noexcept(std::is_nothrow_destructible_v) + { + mx = m; + trim(mx); + } + inline qsizetype totalCost() const noexcept { return total; } + + inline qsizetype size() const noexcept { return qsizetype(d.size); } + inline qsizetype count() const noexcept { return qsizetype(d.size); } + inline bool isEmpty() const noexcept { return !d.size; } + inline QList keys() const + { + QList k; + if (size()) { + k.reserve(size()); + for (auto it = d.begin(); it != d.end(); ++it) + k << it.node()->key; + } + Q_ASSERT(k.size() == size()); + return k; + } + + void clear() noexcept(std::is_nothrow_destructible_v) + { + d.clear(); + total = 0; + chain.next = &chain; + chain.prev = &chain; + } + + bool insert(const Key &key, T *object, qsizetype cost = 1) + { + if (cost > mx) { + remove(key); + delete object; + return false; + } + trim(mx - cost); + auto result = d.findOrInsert(key); + Node *n = result.it.node(); + if (result.initialized) { + auto prevCost = n->value.cost; + result.it.node()->emplace(object, cost); + cost -= prevCost; + relink(key); + } else { + Node::createInPlace(n, key, object, cost); + n->prev = &chain; + n->next = chain.next; + chain.next->prev = n; + chain.next = n; + } + total += cost; + return true; + } + T *object(const Key &key) const noexcept + { + return relink(key); + } + T *operator[](const Key &key) const noexcept + { + return relink(key); + } + inline bool contains(const Key &key) const noexcept + { + return !isEmpty() && d.findNode(key) != nullptr; + } + + bool remove(const Key &key) noexcept(std::is_nothrow_destructible_v) + { + if (isEmpty()) + return false; + Node *n = d.findNode(key); + if (!n) { + return false; + } else { + unlink(n); + return true; + } + } + + T *take(const Key &key) noexcept(std::is_nothrow_destructible_v) + { + if (isEmpty()) + return nullptr; + Node *n = d.findNode(key); + if (!n) + return nullptr; + + T *t = n->value.t; + n->value.t = nullptr; + unlink(n); + return t; + } + +}; + +QT_END_NAMESPACE + +#endif // QCACHE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcalendar.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcalendar.h new file mode 100644 index 0000000000000000000000000000000000000000..16f3da832a8df324909df46019f5fdf6e4f797c9 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcalendar.h @@ -0,0 +1,178 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCALENDAR_H +#define QCALENDAR_H + +#include + +#include +#include +#include +#include + +/* Suggested enum names for other calendars known to CLDR (v33.1) + + Not yet implemented - see QCalendar::System - contributions welcome: + + * Buddhist -- Thai Buddhist, to be specific + * Chinese + * Coptic + * Dangi -- Korean + * Ethiopic (Amete Mihret - epoch approx. 8 C.E.) + * EthiopicAmeteAlem (Amete Alem - epoch approx. 5493 B.C.E; data from + type="ethiopic-amete-alem", an alias for type="ethioaa") + * Hebrew + * Indian -- National + * Islamic -- Based on astronomical observations, not predictions, so hard to + implement. CLDR's data for type="islamic" apply, unless overridden, to the + other Islamic calendar variants, i.e. IslamicCivil, above, and the three + following. See QHijriCalendar, a common base to provide that data. + * IslamicTabular -- tabular, astronomical epoch (same as IslamicCivil, except + for epoch), CLDR type="islamic-tbla" + * Saudi -- Saudi Arabia, sighting; CLDR type="islamic-rgsa" + * UmmAlQura -- Umm al-Qura, Saudi Arabia, calculated; CLDR type="islamic-umalqura" + * Iso8601 -- as Gregorian, but treating ISO 8601 weeks as "months" + * Japanese -- Imperial calendar + * Minguo -- Republic of China, Taiwan; CLDR type="roc" + + See: + http://www.unicode.org/repos/cldr/tags/latest/common/bcp47/calendar.xml + + These can potentially be supported, as features, using CLDR's data; any + others shall need hand-crafted localization data; it would probably be best + to do that by contributing data for them to CLDR. +*/ + +QT_BEGIN_NAMESPACE + +class QCalendarBackend; +class QDate; + +class Q_CORE_EXPORT QCalendar +{ + Q_GADGET +public: + // (Extra parentheses to suppress bogus reading of min() as a macro.) + enum : int { Unspecified = (std::numeric_limits::min)() }; + struct YearMonthDay + { + YearMonthDay() = default; + YearMonthDay(int y, int m = 1, int d = 1) : year(y), month(m), day(d) {} + + bool isValid() const + { return month != Unspecified && day != Unspecified; } + // (The first year supported by QDate has year == Unspecified.) + + int year = Unspecified; + int month = Unspecified; + int day = Unspecified; + }; + // Feature (\w+)calendar uses CLDR type="\1" data, except as noted in type="..." comments below + enum class System + { + Gregorian, // CLDR: type = "gregory", alias = "gregorian" +#ifndef QT_BOOTSTRAPPED + Julian = 8, + Milankovic = 9, +#endif // These are Roman-based, so share Gregorian's CLDR data + + // Feature-controlled calendars: +#if QT_CONFIG(jalalicalendar) // type="persian" + Jalali = 10, +#endif +#if QT_CONFIG(islamiccivilcalendar) // type="islamic-civil", uses data from type="islamic" + IslamicCivil = 11, + // tabular, civil epoch + // 30 year cycle, leap on 2, 5, 7, 10, 13, 16, 18, 21, 24, 26 and 29 + // (Other variants: 2, 5, 8, (10|11), 13, 16, 19, 21, 24, 27 and 29.) +#endif + + Last = 11, // Highest number of any above + User = -1 + }; + // New entries must be added to the \enum doc in qcalendar.cpp and + // handled in QCalendarBackend::fromEnum() + Q_ENUM(System) + class SystemId + { + size_t id; + friend class QCalendarBackend; + constexpr bool isInEnum() const { return id <= size_t(QCalendar::System::Last); } + constexpr explicit SystemId(QCalendar::System e) : id(size_t(e)) { } + constexpr explicit SystemId(size_t i) : id(i) { } + + public: + constexpr SystemId() : id(~size_t(0)) {} + constexpr size_t index() const noexcept { return id; } + constexpr bool isValid() const noexcept { return ~id; } + }; + + explicit QCalendar(); // Gregorian, optimised + explicit QCalendar(System system); +#if QT_CORE_REMOVED_SINCE(6, 4) + explicit QCalendar(QLatin1StringView name); + explicit QCalendar(QStringView name); +#endif + explicit QCalendar(QAnyStringView name); + explicit QCalendar(SystemId id); + + // QCalendar is a trivially copyable value type. + bool isValid() const { return d_ptr != nullptr; } + + // Date queries: + int daysInMonth(int month, int year = Unspecified) const; + int daysInYear(int year) const; + int monthsInYear(int year) const; + bool isDateValid(int year, int month, int day) const; + + // Leap years: + bool isLeapYear(int year) const; + + // Properties of the calendar: + bool isGregorian() const; + bool isLunar() const; + bool isLuniSolar() const; + bool isSolar() const; + bool isProleptic() const; + bool hasYearZero() const; + int maximumDaysInMonth() const; + int minimumDaysInMonth() const; + int maximumMonthsInYear() const; + QString name() const; + + // QDate conversions: + QDate dateFromParts(int year, int month, int day) const; + QDate dateFromParts(const YearMonthDay &parts) const; + QDate matchCenturyToWeekday(const YearMonthDay &parts, int dow) const; + YearMonthDay partsFromDate(QDate date) const; + int dayOfWeek(QDate date) const; + + // Month and week-day names (as in QLocale): + QString monthName(const QLocale &locale, int month, int year = Unspecified, + QLocale::FormatType format=QLocale::LongFormat) const; + QString standaloneMonthName(const QLocale &locale, int month, int year = Unspecified, + QLocale::FormatType format = QLocale::LongFormat) const; + QString weekDayName(const QLocale &locale, int day, + QLocale::FormatType format = QLocale::LongFormat) const; + QString standaloneWeekDayName(const QLocale &locale, int day, + QLocale::FormatType format=QLocale::LongFormat) const; + + // Formatting of date-times: + QString dateTimeToString(QStringView format, const QDateTime &datetime, + QDate dateOnly, QTime timeOnly, + const QLocale &locale) const; + + // What's available ? + static QStringList availableCalendars(); +private: + // Always supplied by QCalendarBackend and expected to be a singleton + // Note that the calendar registry destroys all backends when it is itself + // destroyed. The code should check if the registry is destroyed before + // dereferencing this pointer. + const QCalendarBackend *d_ptr; +}; + +QT_END_NAMESPACE + +#endif // QCALENDAR_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcborarray.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcborarray.h new file mode 100644 index 0000000000000000000000000000000000000000..e73b0d91ce88a3ccfa7ff98ef712863b2a2b032b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcborarray.h @@ -0,0 +1,401 @@ +// Copyright (C) 2022 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCBORARRAY_H +#define QCBORARRAY_H + +#include + +#include + +QT_BEGIN_NAMESPACE + +class QJsonArray; +class QDataStream; + +namespace QJsonPrivate { class Variant; } + +class QCborContainerPrivate; +class Q_CORE_EXPORT QCborArray +{ +public: + class ConstIterator; + class Iterator { + QCborValueRef item {}; + friend class ConstIterator; + friend class QCborArray; + Iterator(QCborContainerPrivate *dd, qsizetype ii) : item(dd, ii) {} + public: + typedef std::random_access_iterator_tag iterator_category; + typedef qsizetype difference_type; + typedef QCborValue value_type; + typedef QCborValueRef reference; + typedef QCborValueRef *pointer; + + constexpr Iterator() = default; + constexpr Iterator(const Iterator &) = default; + Iterator &operator=(const Iterator &other) + { + // rebind the reference + item.d = other.item.d; + item.i = other.item.i; + return *this; + } + + QCborValueRef operator*() const { return item; } + QCborValueRef *operator->() { return &item; } + const QCborValueConstRef *operator->() const { return &item; } + QCborValueRef operator[](qsizetype j) const { return { item.d, item.i + j }; } +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator==(const Iterator &o) const { return item.d == o.item.d && item.i == o.item.i; } + bool operator!=(const Iterator &o) const { return !operator==(o); } + bool operator<(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i < other.item.i; } + bool operator<=(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i <= other.item.i; } + bool operator>(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i > other.item.i; } + bool operator>=(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i >= other.item.i; } + bool operator==(const ConstIterator &o) const { return item.d == o.item.d && item.i == o.item.i; } + bool operator!=(const ConstIterator &o) const { return !operator==(o); } + bool operator<(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i < other.item.i; } + bool operator<=(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i <= other.item.i; } + bool operator>(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i > other.item.i; } + bool operator>=(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i >= other.item.i; } +#endif + Iterator &operator++() { ++item.i; return *this; } + Iterator operator++(int) { Iterator n = *this; ++item.i; return n; } + Iterator &operator--() { item.i--; return *this; } + Iterator operator--(int) { Iterator n = *this; item.i--; return n; } + Iterator &operator+=(qsizetype j) { item.i += j; return *this; } + Iterator &operator-=(qsizetype j) { item.i -= j; return *this; } + Iterator operator+(qsizetype j) const { return Iterator({ item.d, item.i + j }); } + Iterator operator-(qsizetype j) const { return Iterator({ item.d, item.i - j }); } + qsizetype operator-(Iterator j) const { return item.i - j.item.i; } + private: + // Helper functions + static bool comparesEqual_helper(const Iterator &lhs, const Iterator &rhs) noexcept + { + return lhs.item.d == rhs.item.d && lhs.item.i == rhs.item.i; + } + + static bool comparesEqual_helper(const Iterator &lhs, const ConstIterator &rhs) noexcept + { + return lhs.item.d == rhs.item.d && lhs.item.i == rhs.item.i; + } + + static Qt::strong_ordering compareThreeWay_helper(const Iterator &lhs, + const Iterator &rhs) noexcept + { + Q_ASSERT(lhs.item.d == rhs.item.d); + return Qt::compareThreeWay(lhs.item.i, rhs.item.i); + } + + static Qt::strong_ordering compareThreeWay_helper(const Iterator &lhs, + const ConstIterator &rhs) noexcept + { + Q_ASSERT(lhs.item.d == rhs.item.d); + return Qt::compareThreeWay(lhs.item.i, rhs.item.i); + } + + // Compare friends + friend bool comparesEqual(const Iterator &lhs, const Iterator &rhs) noexcept + { + return comparesEqual_helper(lhs, rhs); + } + friend Qt::strong_ordering compareThreeWay(const Iterator &lhs, + const Iterator &rhs) noexcept + { + return compareThreeWay_helper(lhs, rhs); + } + Q_DECLARE_STRONGLY_ORDERED(Iterator) + friend bool comparesEqual(const Iterator &lhs, const ConstIterator &rhs) noexcept + { + return comparesEqual_helper(lhs, rhs); + } + friend Qt::strong_ordering compareThreeWay(const Iterator &lhs, + const ConstIterator &rhs) noexcept + { + return compareThreeWay_helper(lhs, rhs); + } + Q_DECLARE_STRONGLY_ORDERED(Iterator, ConstIterator) + }; + + class ConstIterator { + QCborValueConstRef item; + friend class Iterator; + friend class QCborArray; + ConstIterator(QCborContainerPrivate *dd, qsizetype ii) : item(dd, ii) {} + public: + typedef std::random_access_iterator_tag iterator_category; + typedef qsizetype difference_type; + typedef const QCborValue value_type; + typedef const QCborValueRef reference; + typedef const QCborValueRef *pointer; + + constexpr ConstIterator() = default; + constexpr ConstIterator(const ConstIterator &) = default; + ConstIterator &operator=(const ConstIterator &other) + { + // rebind the reference + item.d = other.item.d; + item.i = other.item.i; + return *this; + } + + QCborValueConstRef operator*() const { return item; } + const QCborValueConstRef *operator->() const { return &item; } + QCborValueConstRef operator[](qsizetype j) const { return QCborValueRef{ item.d, item.i + j }; } +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator==(const Iterator &o) const { return item.d == o.item.d && item.i == o.item.i; } + bool operator!=(const Iterator &o) const { return !operator==(o); } + bool operator<(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i < other.item.i; } + bool operator<=(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i <= other.item.i; } + bool operator>(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i > other.item.i; } + bool operator>=(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i >= other.item.i; } + bool operator==(const ConstIterator &o) const { return item.d == o.item.d && item.i == o.item.i; } + bool operator!=(const ConstIterator &o) const { return !operator==(o); } + bool operator<(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i < other.item.i; } + bool operator<=(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i <= other.item.i; } + bool operator>(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i > other.item.i; } + bool operator>=(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i >= other.item.i; } +#endif + ConstIterator &operator++() { ++item.i; return *this; } + ConstIterator operator++(int) { ConstIterator n = *this; ++item.i; return n; } + ConstIterator &operator--() { item.i--; return *this; } + ConstIterator operator--(int) { ConstIterator n = *this; item.i--; return n; } + ConstIterator &operator+=(qsizetype j) { item.i += j; return *this; } + ConstIterator &operator-=(qsizetype j) { item.i -= j; return *this; } + ConstIterator operator+(qsizetype j) const { return ConstIterator({ item.d, item.i + j }); } + ConstIterator operator-(qsizetype j) const { return ConstIterator({ item.d, item.i - j }); } + qsizetype operator-(ConstIterator j) const { return item.i - j.item.i; } + private: + // Helper functions + static bool comparesEqual_helper(const ConstIterator &lhs, + const ConstIterator &rhs) noexcept + { + return lhs.item.d == rhs.item.d && lhs.item.i == rhs.item.i; + } + static Qt::strong_ordering compareThreeWay_helper(const ConstIterator &lhs, + const ConstIterator &rhs) noexcept + { + Q_ASSERT(lhs.item.d == rhs.item.d); + return Qt::compareThreeWay(lhs.item.i, rhs.item.i); + } + + // Compare friends + friend bool comparesEqual(const ConstIterator &lhs, const ConstIterator &rhs) noexcept + { + return comparesEqual_helper(lhs, rhs); + } + friend Qt::strong_ordering compareThreeWay(const ConstIterator &lhs, + const ConstIterator &rhs) noexcept + { + return compareThreeWay_helper(lhs, rhs); + } + Q_DECLARE_STRONGLY_ORDERED(ConstIterator) + }; + + typedef qsizetype size_type; + typedef QCborValue value_type; + typedef value_type *pointer; + typedef const value_type *const_pointer; + typedef QCborValue &reference; + typedef const QCborValue &const_reference; + typedef qsizetype difference_type; + + QCborArray() noexcept; + QCborArray(const QCborArray &other) noexcept; + QCborArray &operator=(const QCborArray &other) noexcept; + QCborArray(std::initializer_list args) + : QCborArray() + { + detach(qsizetype(args.size())); + for (const QCborValue &v : args) + append(v); + } + ~QCborArray(); + + void swap(QCborArray &other) noexcept + { + d.swap(other.d); + } + + QCborValue toCborValue() const { return *this; } + + qsizetype size() const noexcept; + bool isEmpty() const { return size() == 0; } + void clear(); + + QCborValue at(qsizetype i) const; + QCborValue first() const { return at(0); } + QCborValue last() const { return at(size() - 1); } + const QCborValue operator[](qsizetype i) const { return at(i); } + QCborValueRef first() { Q_ASSERT(!isEmpty()); return begin()[0]; } + QCborValueRef last() { Q_ASSERT(!isEmpty()); return begin()[size() - 1]; } + QCborValueRef operator[](qsizetype i) + { + if (i >= size()) + insert(i, QCborValue()); + return begin()[i]; + } + + void insert(qsizetype i, const QCborValue &value); + void insert(qsizetype i, QCborValue &&value); + void prepend(const QCborValue &value) { insert(0, value); } + void prepend(QCborValue &&value) { insert(0, std::move(value)); } + void append(const QCborValue &value) { insert(-1, value); } + void append(QCborValue &&value) { insert(-1, std::move(value)); } + QCborValue extract(ConstIterator it) { return extract(Iterator{ it.item.d, it.item.i }); } + QCborValue extract(Iterator it); + void removeAt(qsizetype i); + QCborValue takeAt(qsizetype i) { Q_ASSERT(i < size()); return extract(begin() + i); } + void removeFirst() { removeAt(0); } + void removeLast() { removeAt(size() - 1); } + QCborValue takeFirst() { return takeAt(0); } + QCborValue takeLast() { return takeAt(size() - 1); } + + bool contains(const QCborValue &value) const; + + int compare(const QCborArray &other) const noexcept Q_DECL_PURE_FUNCTION; +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator==(const QCborArray &other) const noexcept + { return compare(other) == 0; } + bool operator!=(const QCborArray &other) const noexcept + { return !operator==(other); } + bool operator<(const QCborArray &other) const + { return compare(other) < 0; } +#endif + + typedef Iterator iterator; + typedef ConstIterator const_iterator; + iterator begin() { detach(); return iterator{d.data(), 0}; } + const_iterator constBegin() const { return const_iterator{d.data(), 0}; } + const_iterator begin() const { return constBegin(); } + const_iterator cbegin() const { return constBegin(); } + iterator end() { detach(); return iterator{d.data(), size()}; } + const_iterator constEnd() const { return const_iterator{d.data(), size()}; } + const_iterator end() const { return constEnd(); } + const_iterator cend() const { return constEnd(); } + iterator insert(iterator before, const QCborValue &value) + { insert(before.item.i, value); return iterator{d.data(), before.item.i}; } + iterator insert(const_iterator before, const QCborValue &value) + { insert(before.item.i, value); return iterator{d.data(), before.item.i}; } + iterator erase(iterator it) { removeAt(it.item.i); return iterator{d.data(), it.item.i}; } + iterator erase(const_iterator it) { removeAt(it.item.i); return iterator{d.data(), it.item.i}; } + + void push_back(const QCborValue &t) { append(t); } + void push_front(const QCborValue &t) { prepend(t); } + void pop_front() { removeFirst(); } + void pop_back() { removeLast(); } + bool empty() const { return isEmpty(); } + + // convenience + QCborArray operator+(const QCborValue &v) const + { QCborArray n = *this; n += v; return n; } + QCborArray &operator+=(const QCborValue &v) + { append(v); return *this; } + QCborArray &operator<<(const QCborValue &v) + { append(v); return *this; } + + static QCborArray fromStringList(const QStringList &list); + static QCborArray fromVariantList(const QVariantList &list); + static QCborArray fromJsonArray(const QJsonArray &array); + static QCborArray fromJsonArray(QJsonArray &&array) noexcept; + QVariantList toVariantList() const; + QJsonArray toJsonArray() const; + +private: + friend Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool + comparesEqual(const QCborArray &lhs, const QCborArray &rhs) noexcept; + friend Qt::strong_ordering compareThreeWay(const QCborArray &lhs, + const QCborArray &rhs) noexcept + { + int c = lhs.compare(rhs); + return Qt::compareThreeWay(c, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QCborArray) + + static Q_DECL_PURE_FUNCTION bool + comparesEqual_helper(const QCborArray &lhs, const QCborValue &rhs) noexcept; + static Q_DECL_PURE_FUNCTION Qt::strong_ordering + compareThreeWay_helper(const QCborArray &lhs, const QCborValue &rhs) noexcept; + friend bool comparesEqual(const QCborArray &lhs, + const QCborValue &rhs) noexcept + { + return comparesEqual_helper(lhs, rhs); + } + friend Qt::strong_ordering compareThreeWay(const QCborArray &lhs, + const QCborValue &rhs) noexcept + { + return compareThreeWay_helper(lhs, rhs); + } + Q_DECLARE_STRONGLY_ORDERED(QCborArray, QCborValue) + + static Q_DECL_PURE_FUNCTION bool + comparesEqual_helper(const QCborArray &lhs, QCborValueConstRef rhs) noexcept; + static Q_DECL_PURE_FUNCTION Qt::strong_ordering + compareThreeWay_helper(const QCborArray &lhs, QCborValueConstRef rhs) noexcept; + friend bool comparesEqual(const QCborArray &lhs, + const QCborValueConstRef &rhs) noexcept + { + return comparesEqual_helper(lhs, rhs); + } + friend Qt::strong_ordering compareThreeWay(const QCborArray &lhs, + const QCborValueConstRef &rhs) noexcept + { + return compareThreeWay_helper(lhs, rhs); + } + Q_DECLARE_STRONGLY_ORDERED(QCborArray, QCborValueConstRef) + + void detach(qsizetype reserve = 0); + + friend QCborValue; + friend QCborValueRef; + friend class QJsonPrivate::Variant; + explicit QCborArray(QCborContainerPrivate &dd) noexcept; + QExplicitlySharedDataPointer d; +}; + +Q_DECLARE_SHARED(QCborArray) + +inline QCborValue::QCborValue(QCborArray &&a) + : n(-1), container(a.d.take()), t(Array) +{ +} + +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED) +inline QCborArray QCborValueRef::toArray() const +{ + return concrete().toArray(); +} + +inline QCborArray QCborValueRef::toArray(const QCborArray &a) const +{ + return concrete().toArray(a); +} +#endif + +inline QCborArray QCborValueConstRef::toArray() const +{ + return concrete().toArray(); +} + +inline QCborArray QCborValueConstRef::toArray(const QCborArray &a) const +{ + return concrete().toArray(a); +} + +Q_CORE_EXPORT size_t qHash(const QCborArray &array, size_t seed = 0); + +#if !defined(QT_NO_DEBUG_STREAM) +Q_CORE_EXPORT QDebug operator<<(QDebug, const QCborArray &a); +#endif + +#ifndef QT_NO_DATASTREAM +#if QT_CONFIG(cborstreamwriter) +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QCborArray &); +#endif +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QCborArray &); +#endif + +QT_END_NAMESPACE + +#endif // QCBORARRAY_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcborcommon.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcborcommon.h new file mode 100644 index 0000000000000000000000000000000000000000..a75c1de0f90a792484a9c3e031a6e8bb2f6581dc --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcborcommon.h @@ -0,0 +1,127 @@ +// Copyright (C) 2018 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCBORCOMMON_H +#define QCBORCOMMON_H + +#include +#include +#include + +#if 0 +#pragma qt_class(QtCborCommon) +#endif + +/* X11 headers use these values too, but as defines */ +#if defined(False) && defined(True) +# undef True +# undef False +#endif + +QT_BEGIN_NAMESPACE + +enum class QCborSimpleType : quint8 { + False = 20, + True = 21, + Null = 22, + Undefined = 23 +}; + +enum class QCborTag : quint64 {}; +enum class QCborKnownTags { + DateTimeString = 0, + UnixTime_t = 1, + PositiveBignum = 2, + NegativeBignum = 3, + Decimal = 4, + Bigfloat = 5, + COSE_Encrypt0 = 16, + COSE_Mac0 = 17, + COSE_Sign1 = 18, + ExpectedBase64url = 21, + ExpectedBase64 = 22, + ExpectedBase16 = 23, + EncodedCbor = 24, + Url = 32, + Base64url = 33, + Base64 = 34, + RegularExpression = 35, + MimeMessage = 36, + Uuid = 37, + COSE_Encrypt = 96, + COSE_Mac = 97, + COSE_Sign = 98, + Signature = 55799 +}; + +inline bool operator==(QCborTag t, QCborKnownTags kt) { return quint64(t) == quint64(kt); } +inline bool operator==(QCborKnownTags kt, QCborTag t) { return quint64(t) == quint64(kt); } +inline bool operator!=(QCborTag t, QCborKnownTags kt) { return quint64(t) != quint64(kt); } +inline bool operator!=(QCborKnownTags kt, QCborTag t) { return quint64(t) != quint64(kt); } + +struct Q_CORE_EXPORT QCborError +{ + Q_GADGET +public: + enum Code : int { + UnknownError = 1, + AdvancePastEnd = 3, + InputOutputError = 4, + GarbageAtEnd = 256, + EndOfFile, + UnexpectedBreak, + UnknownType, + IllegalType, + IllegalNumber, + IllegalSimpleType, + + InvalidUtf8String = 516, + + DataTooLarge = 1024, + NestingTooDeep, + UnsupportedType, + + NoError = 0 + }; + Q_ENUM(Code) + + Code c; + operator Code() const { return c; } + QString toString() const; +}; + +#if !defined(QT_NO_DEBUG_STREAM) +Q_CORE_EXPORT QDebug operator<<(QDebug, QCborSimpleType st); +Q_CORE_EXPORT QDebug operator<<(QDebug, QCborKnownTags tg); +Q_CORE_EXPORT QDebug operator<<(QDebug, QCborTag tg); +#endif + +#if !defined(QT_NO_DATASTREAM) +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &ds, QCborSimpleType st); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &ds, QCborSimpleType &st); +#endif + +inline size_t qHash(QCborSimpleType tag, size_t seed = 0) +{ + return qHash(quint8(tag), seed); +} + +inline size_t qHash(QCborTag tag, size_t seed = 0) +{ + return qHash(quint64(tag), seed); +} + +enum class QCborNegativeInteger : quint64 {}; + +QT_END_NAMESPACE + +QT_DECL_METATYPE_EXTERN(QCborTag, Q_CORE_EXPORT) + +// To avoid changing namespace we need to reinstate defines, even though our .cpp +// will then have to remove them again. +#if defined(QT_X11_DEFINES_FOUND) +# define True 1 +# define False 0 +#endif + +#endif // QCBORSTREAM_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcbormap.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcbormap.h new file mode 100644 index 0000000000000000000000000000000000000000..46c17ce6c6b83117c482b9d195602712c7b93079 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcbormap.h @@ -0,0 +1,473 @@ +// Copyright (C) 2022 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCBORMAP_H +#define QCBORMAP_H + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QJsonObject; +class QDataStream; + +namespace QJsonPrivate { class Variant; } + +class QCborContainerPrivate; +class Q_CORE_EXPORT QCborMap +{ +public: + typedef std::pair value_type; + typedef QCborValue key_type; + typedef QCborValue mapped_type; + typedef qsizetype size_type; + + class ConstIterator; + class Iterator { + QCborValueRef item {}; // points to the value + friend class ConstIterator; + friend class QCborMap; + Iterator(QCborContainerPrivate *dd, qsizetype ii) : item(dd, ii) {} + public: + typedef std::random_access_iterator_tag iterator_category; + typedef qsizetype difference_type; + typedef std::pair value_type; + typedef std::pair reference; + typedef std::pair pointer; + + constexpr Iterator() = default; + constexpr Iterator(const Iterator &) = default; + ~Iterator() = default; + Iterator &operator=(const Iterator &other) + { + // rebind the reference + item.d = other.item.d; + item.i = other.item.i; + return *this; + } + + value_type operator*() const { return { QCborValueRef{item.d, item.i - 1}, item }; } + value_type operator[](qsizetype j) const { return *(*this + j); } + QCborValueRef *operator->() { return &item; } + const QCborValueConstRef *operator->() const { return &item; } +#if QT_VERSION >= QT_VERSION_CHECK(7,0,0) + QCborValueConstRef +#else + QCborValue +#endif + key() const { return QCborValueRef(item.d, item.i - 1); } + QCborValueRef value() const { return item; } + +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator==(const Iterator &o) const { return item.d == o.item.d && item.i == o.item.i; } + bool operator!=(const Iterator &o) const { return !operator==(o); } + bool operator<(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i < other.item.i; } + bool operator<=(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i <= other.item.i; } + bool operator>(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i > other.item.i; } + bool operator>=(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i >= other.item.i; } + bool operator==(const ConstIterator &o) const { return item.d == o.item.d && item.i == o.item.i; } + bool operator!=(const ConstIterator &o) const { return !operator==(o); } + bool operator<(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i < other.item.i; } + bool operator<=(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i <= other.item.i; } + bool operator>(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i > other.item.i; } + bool operator>=(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i >= other.item.i; } +#endif + Iterator &operator++() { item.i += 2; return *this; } + Iterator operator++(int) { Iterator n = *this; item.i += 2; return n; } + Iterator &operator--() { item.i -= 2; return *this; } + Iterator operator--(int) { Iterator n = *this; item.i -= 2; return n; } + Iterator &operator+=(qsizetype j) { item.i += 2 * j; return *this; } + Iterator &operator-=(qsizetype j) { item.i -= 2 * j; return *this; } + Iterator operator+(qsizetype j) const { return Iterator({ item.d, item.i + 2 * j }); } + Iterator operator-(qsizetype j) const { return Iterator({ item.d, item.i - 2 * j }); } + qsizetype operator-(Iterator j) const { return (item.i - j.item.i) / 2; } + + private: + // Helper functions + static bool comparesEqual_helper(const Iterator &lhs, const Iterator &rhs) noexcept + { + return lhs.item.d == rhs.item.d && lhs.item.i == rhs.item.i; + } + + static bool comparesEqual_helper(const Iterator &lhs, const ConstIterator &rhs) noexcept + { + return lhs.item.d == rhs.item.d && lhs.item.i == rhs.item.i; + } + + static Qt::strong_ordering compareThreeWay_helper(const Iterator &lhs, + const Iterator &rhs) + { + Q_ASSERT(lhs.item.d == rhs.item.d); + return Qt::compareThreeWay(lhs.item.i, rhs.item.i); + } + + static Qt::strong_ordering compareThreeWay_helper(const Iterator &lhs, + const ConstIterator &rhs) + { + Q_ASSERT(lhs.item.d == rhs.item.d); + return Qt::compareThreeWay(lhs.item.i, rhs.item.i); + } + + // Compare friends + friend bool comparesEqual(const Iterator &lhs, const Iterator &rhs) noexcept + { + return comparesEqual_helper(lhs, rhs); + } + friend Qt::strong_ordering compareThreeWay(const Iterator &lhs, + const Iterator &rhs) + { + return compareThreeWay_helper(lhs, rhs); + } + Q_DECLARE_STRONGLY_ORDERED_NON_NOEXCEPT(Iterator) + friend bool comparesEqual(const Iterator &lhs, const ConstIterator &rhs) noexcept + { + return comparesEqual_helper(lhs, rhs); + } + friend Qt::strong_ordering compareThreeWay(const Iterator &lhs, + const ConstIterator &rhs) + { + return compareThreeWay_helper(lhs, rhs); + } + Q_DECLARE_STRONGLY_ORDERED_NON_NOEXCEPT(Iterator, ConstIterator) + }; + + class ConstIterator { + QCborValueConstRef item; // points to the value + friend class Iterator; + friend class QCborMap; + friend class QCborValue; + friend class QCborValueRef; + constexpr ConstIterator(QCborValueConstRef it) : item{it} {} + ConstIterator(QCborContainerPrivate *dd, qsizetype ii) : item(dd, ii) {} + public: + typedef std::random_access_iterator_tag iterator_category; + typedef qsizetype difference_type; + typedef std::pair value_type; + typedef std::pair reference; + typedef std::pair pointer; + + constexpr ConstIterator() = default; + constexpr ConstIterator(const ConstIterator &) = default; + ~ConstIterator() = default; + ConstIterator &operator=(const ConstIterator &other) + { + // rebind the reference + item.d = other.item.d; + item.i = other.item.i; + return *this; + } + + value_type operator*() const { return { QCborValueRef(item.d, item.i - 1), item }; } + value_type operator[](qsizetype j) const { return *(*this + j); } + const QCborValueConstRef *operator->() const { return &item; } +#if QT_VERSION >= QT_VERSION_CHECK(7,0,0) + QCborValueConstRef +#else + QCborValue +#endif + key() const { return QCborValueRef(item.d, item.i - 1); } + QCborValueConstRef value() const { return item; } + +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator==(const Iterator &o) const { return item.d == o.item.d && item.i == o.item.i; } + bool operator!=(const Iterator &o) const { return !operator==(o); } + bool operator<(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i < other.item.i; } + bool operator<=(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i <= other.item.i; } + bool operator>(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i > other.item.i; } + bool operator>=(const Iterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i >= other.item.i; } + bool operator==(const ConstIterator &o) const { return item.d == o.item.d && item.i == o.item.i; } + bool operator!=(const ConstIterator &o) const { return !operator==(o); } + bool operator<(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i < other.item.i; } + bool operator<=(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i <= other.item.i; } + bool operator>(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i > other.item.i; } + bool operator>=(const ConstIterator& other) const { Q_ASSERT(item.d == other.item.d); return item.i >= other.item.i; } +#endif + ConstIterator &operator++() { item.i += 2; return *this; } + ConstIterator operator++(int) { ConstIterator n = *this; item.i += 2; return n; } + ConstIterator &operator--() { item.i -= 2; return *this; } + ConstIterator operator--(int) { ConstIterator n = *this; item.i -= 2; return n; } + ConstIterator &operator+=(qsizetype j) { item.i += 2 * j; return *this; } + ConstIterator &operator-=(qsizetype j) { item.i -= 2 * j; return *this; } + ConstIterator operator+(qsizetype j) const { return ConstIterator{ item.d, item.i + 2 * j }; } + ConstIterator operator-(qsizetype j) const { return ConstIterator{ item.d, item.i - 2 * j }; } + qsizetype operator-(ConstIterator j) const { return (item.i - j.item.i) / 2; } + private: + // Helper functions + static bool comparesEqual_helper(const ConstIterator &lhs, + const ConstIterator &rhs) noexcept + { + return lhs.item.d == rhs.item.d && lhs.item.i == rhs.item.i; + } + static Qt::strong_ordering compareThreeWay_helper(const ConstIterator &lhs, + const ConstIterator &rhs) + { + Q_ASSERT(lhs.item.d == rhs.item.d); + return Qt::compareThreeWay(lhs.item.i, rhs.item.i); + } + + // Compare friends + friend bool comparesEqual(const ConstIterator &lhs, const ConstIterator &rhs) noexcept + { + return comparesEqual_helper(lhs, rhs); + } + friend Qt::strong_ordering compareThreeWay(const ConstIterator &lhs, + const ConstIterator &rhs) + { + return compareThreeWay_helper(lhs, rhs); + } + Q_DECLARE_STRONGLY_ORDERED_NON_NOEXCEPT(ConstIterator) + }; + + QCborMap() noexcept; + QCborMap(const QCborMap &other) noexcept; + QCborMap &operator=(const QCborMap &other) noexcept; + QCborMap(std::initializer_list args) + : QCborMap() + { + detach(args.size()); + for (const auto &pair : args) + insert(pair.first, pair.second); + } + ~QCborMap(); + + void swap(QCborMap &other) noexcept + { + d.swap(other.d); + } + + QCborValue toCborValue() const { return *this; } + + qsizetype size() const noexcept Q_DECL_PURE_FUNCTION; + bool isEmpty() const { return size() == 0; } + void clear(); + QList keys() const; + + QCborValue value(qint64 key) const + { const_iterator it = find(key); return comparesEqual(it, end()) ? QCborValue() : it.value(); } + QCborValue value(QLatin1StringView key) const + { const_iterator it = find(key); return comparesEqual(it, end()) ? QCborValue() : it.value(); } + QCborValue value(const QString & key) const + { const_iterator it = find(key); return comparesEqual(it, end()) ? QCborValue() : it.value(); } + QCborValue value(const QCborValue &key) const + { const_iterator it = find(key); return comparesEqual(it, end()) ? QCborValue() : it.value(); } +#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) + template QT_ASCII_CAST_WARN const QCborValue value(const char (&key)[N]) const + { return value(QString::fromUtf8(key, N - 1)); } +#endif + const QCborValue operator[](qint64 key) const + { const_iterator it = find(key); return comparesEqual(it, end()) ? QCborValue() : it.value(); } + const QCborValue operator[](QLatin1StringView key) const + { const_iterator it = find(key); return comparesEqual(it, end()) ? QCborValue() : it.value(); } + const QCborValue operator[](const QString & key) const + { const_iterator it = find(key); return comparesEqual(it, end()) ? QCborValue() : it.value(); } + const QCborValue operator[](const QCborValue &key) const + { const_iterator it = find(key); return comparesEqual(it, end()) ? QCborValue() : it.value(); } +#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) + template QT_ASCII_CAST_WARN const QCborValue operator[](const char (&key)[N]) const + { return operator[](QString::fromUtf8(key, N - 1)); } +#endif + QCborValueRef operator[](qint64 key); + QCborValueRef operator[](QLatin1StringView key); + QCborValueRef operator[](const QString & key); + QCborValueRef operator[](const QCborValue &key); + + QCborValue take(qint64 key) + { const_iterator it = constFind(key); if (!comparesEqual(it, constEnd())) return extract(it); return QCborValue(); } + QCborValue take(QLatin1StringView key) + { const_iterator it = constFind(key); if (!comparesEqual(it, constEnd())) return extract(it); return QCborValue(); } + QCborValue take(const QString &key) + { const_iterator it = constFind(key); if (!comparesEqual(it, constEnd())) return extract(it); return QCborValue(); } + QCborValue take(const QCborValue &key) + { const_iterator it = constFind(key); if (!comparesEqual(it, constEnd())) return extract(it); return QCborValue(); } + void remove(qint64 key) + { const_iterator it = constFind(key); if (!comparesEqual(it, constEnd())) erase(it); } + void remove(QLatin1StringView key) + { const_iterator it = constFind(key); if (!comparesEqual(it, constEnd())) erase(it); } + void remove(const QString & key) + { const_iterator it = constFind(key); if (!comparesEqual(it, constEnd())) erase(it); } + void remove(const QCborValue &key) + { const_iterator it = constFind(key); if (!comparesEqual(it, constEnd())) erase(it); } + bool contains(qint64 key) const + { const_iterator it = find(key); return !comparesEqual(it, end()); } + bool contains(QLatin1StringView key) const + { const_iterator it = find(key); return !comparesEqual(it, end()); } + bool contains(const QString & key) const + { const_iterator it = find(key); return !comparesEqual(it, end()); } + bool contains(const QCborValue &key) const + { const_iterator it = find(key); return !comparesEqual(it, end()); } + + int compare(const QCborMap &other) const noexcept Q_DECL_PURE_FUNCTION; +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator==(const QCborMap &other) const noexcept + { return compare(other) == 0; } + bool operator!=(const QCborMap &other) const noexcept + { return !operator==(other); } + bool operator<(const QCborMap &other) const + { return compare(other) < 0; } +#endif + + typedef Iterator iterator; + typedef ConstIterator const_iterator; + iterator begin() { detach(); return iterator{d.data(), 1}; } + const_iterator constBegin() const { return const_iterator{d.data(), 1}; } + const_iterator begin() const { return constBegin(); } + const_iterator cbegin() const { return constBegin(); } + iterator end() { detach(); return iterator{d.data(), 2 * size() + 1}; } + const_iterator constEnd() const { return const_iterator{d.data(), 2 * size() + 1}; } + const_iterator end() const { return constEnd(); } + const_iterator cend() const { return constEnd(); } + iterator erase(iterator it); + iterator erase(const_iterator it) { return erase(iterator{ it.item.d, it.item.i }); } + QCborValue extract(iterator it); + QCborValue extract(const_iterator it) { return extract(iterator{ it.item.d, it.item.i }); } + bool empty() const { return isEmpty(); } + + iterator find(qint64 key); + iterator find(QLatin1StringView key); + iterator find(const QString & key); + iterator find(const QCborValue &key); + const_iterator constFind(qint64 key) const; + const_iterator constFind(QLatin1StringView key) const; + const_iterator constFind(const QString & key) const; + const_iterator constFind(const QCborValue &key) const; + const_iterator find(qint64 key) const { return constFind(key); } + const_iterator find(QLatin1StringView key) const { return constFind(key); } + const_iterator find(const QString & key) const { return constFind(key); } + const_iterator find(const QCborValue &key) const { return constFind(key); } + + iterator insert(qint64 key, const QCborValue &value_) + { + QCborValueRef v = operator[](key); // detaches + v = value_; + return { d.data(), v.i }; + } + iterator insert(QLatin1StringView key, const QCborValue &value_) + { + QCborValueRef v = operator[](key); // detaches + v = value_; + return { d.data(), v.i }; + } + iterator insert(const QString &key, const QCborValue &value_) + { + QCborValueRef v = operator[](key); // detaches + v = value_; + return { d.data(), v.i }; + } + iterator insert(const QCborValue &key, const QCborValue &value_) + { + QCborValueRef v = operator[](key); // detaches + v = value_; + return { d.data(), v.i }; + } + iterator insert(value_type v) { return insert(v.first, v.second); } + + static QCborMap fromVariantMap(const QVariantMap &map); + static QCborMap fromVariantHash(const QVariantHash &hash); + static QCborMap fromJsonObject(const QJsonObject &o); + static QCborMap fromJsonObject(QJsonObject &&o) noexcept; + QVariantMap toVariantMap() const; + QVariantHash toVariantHash() const; + QJsonObject toJsonObject() const; + +private: + friend class QCborContainerPrivate; + friend class QCborValue; + friend class QCborValueRef; + friend class QJsonPrivate::Variant; + void detach(qsizetype reserve = 0); + + friend Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool + comparesEqual(const QCborMap &lhs, const QCborMap &rhs) noexcept; + friend Qt::strong_ordering compareThreeWay(const QCborMap &lhs, + const QCborMap &rhs) noexcept + { + int c = lhs.compare(rhs); + return Qt::compareThreeWay(c, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QCborMap) + + static Q_DECL_PURE_FUNCTION bool + comparesEqual_helper(const QCborMap &lhs, const QCborValue &rhs) noexcept; + static Q_DECL_PURE_FUNCTION Qt::strong_ordering + compareThreeWay_helper(const QCborMap &lhs, const QCborValue &rhs) noexcept; + friend bool comparesEqual(const QCborMap &lhs, + const QCborValue &rhs) noexcept + { + return comparesEqual_helper(lhs, rhs); + } + friend Qt::strong_ordering compareThreeWay(const QCborMap &lhs, + const QCborValue &rhs) noexcept + { + return compareThreeWay_helper(lhs, rhs); + } + Q_DECLARE_STRONGLY_ORDERED(QCborMap, QCborValue) + + static Q_DECL_PURE_FUNCTION bool + comparesEqual_helper(const QCborMap &lhs, QCborValueConstRef rhs) noexcept; + static Q_DECL_PURE_FUNCTION Qt::strong_ordering + compareThreeWay_helper(const QCborMap &lhs, QCborValueConstRef rhs) noexcept; + friend bool comparesEqual(const QCborMap &lhs, + const QCborValueConstRef &rhs) noexcept + { + return comparesEqual_helper(lhs, rhs); + } + friend Qt::strong_ordering compareThreeWay(const QCborMap &lhs, + const QCborValueConstRef &rhs) noexcept + { + return compareThreeWay_helper(lhs, rhs); + } + Q_DECLARE_STRONGLY_ORDERED(QCborMap, QCborValueConstRef) + + explicit QCborMap(QCborContainerPrivate &dd) noexcept; + QExplicitlySharedDataPointer d; +}; + +Q_DECLARE_SHARED(QCborMap) + +inline QCborValue::QCborValue(QCborMap &&m) + : n(-1), container(m.d.take()), t(Map) +{ +} + +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED) +inline QCborMap QCborValueRef::toMap() const +{ + return concrete().toMap(); +} + +inline QCborMap QCborValueRef::toMap(const QCborMap &m) const +{ + return concrete().toMap(m); +} +#endif + +inline QCborMap QCborValueConstRef::toMap() const +{ + return concrete().toMap(); +} + +inline QCborMap QCborValueConstRef::toMap(const QCborMap &m) const +{ + return concrete().toMap(m); +} + +Q_CORE_EXPORT size_t qHash(const QCborMap &map, size_t seed = 0); + +#if !defined(QT_NO_DEBUG_STREAM) +Q_CORE_EXPORT QDebug operator<<(QDebug, const QCborMap &m); +#endif + +#ifndef QT_NO_DATASTREAM +#if QT_CONFIG(cborstreamwriter) +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QCborMap &); +#endif +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QCborMap &); +#endif + + +QT_END_NAMESPACE + +#endif // QCBORMAP_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcborstream.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcborstream.h new file mode 100644 index 0000000000000000000000000000000000000000..a3ce5b67fb6683e6fdca63f9ec33f2998f2b1111 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcborstream.h @@ -0,0 +1,21 @@ +// Copyright (C) 2019 The Qt Company Ltd. +// Copyright (C) 2018 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCBORSTREAM_H +#define QCBORSTREAM_H + +#include + +#if QT_CONFIG(cborstreamreader) +#include +#endif + +#if QT_CONFIG(cborstreamwriter) +#include +#endif + +QT_BEGIN_NAMESPACE +QT_END_NAMESPACE + +#endif // QCBORSTREAM_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcborstreamreader.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcborstreamreader.h new file mode 100644 index 0000000000000000000000000000000000000000..82e6c21d828bce7c7559b455f34a9694d7f74578 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcborstreamreader.h @@ -0,0 +1,209 @@ +// Copyright (C) 2018 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCBORSTREAMREADER_H +#define QCBORSTREAMREADER_H + +#include +#include +#include +#include +#include +#include + +QT_REQUIRE_CONFIG(cborstreamreader); + +/* X11 headers use these values too, but as defines */ +#if defined(False) && defined(True) +# undef True +# undef False +#endif + +QT_BEGIN_NAMESPACE + +class QIODevice; + +class QCborStreamReaderPrivate; +class Q_CORE_EXPORT QCborStreamReader +{ + Q_GADGET +public: + enum Type : quint8 { + UnsignedInteger = 0x00, + NegativeInteger = 0x20, + ByteString = 0x40, + ByteArray = ByteString, + TextString = 0x60, + String = TextString, + Array = 0x80, + Map = 0xa0, + Tag = 0xc0, + SimpleType = 0xe0, + HalfFloat = 0xf9, + Float16 = HalfFloat, + Float = 0xfa, + Double = 0xfb, + + Invalid = 0xff + }; + Q_ENUM(Type) + + enum StringResultCode { + EndOfString = 0, + Ok = 1, + Error = -1 + }; + template struct StringResult { + Container data; + StringResultCode status = Error; + }; + Q_ENUM(StringResultCode) + + QCborStreamReader(); + QCborStreamReader(const char *data, qsizetype len); + QCborStreamReader(const quint8 *data, qsizetype len); + explicit QCborStreamReader(const QByteArray &data); + explicit QCborStreamReader(QIODevice *device); + ~QCborStreamReader(); + Q_DISABLE_COPY(QCborStreamReader) + + void setDevice(QIODevice *device); + QIODevice *device() const; + void addData(const QByteArray &data); + void addData(const char *data, qsizetype len); + void addData(const quint8 *data, qsizetype len) + { addData(reinterpret_cast(data), len); } + void reparse(); + void clear(); + void reset(); + +#if QT_CORE_REMOVED_SINCE(6, 7) + QCborError lastError(); +#endif + QCborError lastError() const; + + qint64 currentOffset() const; + + bool isValid() const { return !isInvalid(); } + + int containerDepth() const; + QCborStreamReader::Type parentContainerType() const; + bool hasNext() const noexcept Q_DECL_PURE_FUNCTION; + bool next(int maxRecursion = 10000); + + Type type() const { return QCborStreamReader::Type(type_); } + bool isUnsignedInteger() const { return type() == UnsignedInteger; } + bool isNegativeInteger() const { return type() == NegativeInteger; } + bool isInteger() const { return quint8(type()) <= quint8(NegativeInteger); } + bool isByteArray() const { return type() == ByteArray; } + bool isString() const { return type() == String; } + bool isArray() const { return type() == Array; } + bool isMap() const { return type() == Map; } + bool isTag() const { return type() == Tag; } + bool isSimpleType() const { return type() == SimpleType; } + bool isFloat16() const { return type() == Float16; } + bool isFloat() const { return type() == Float; } + bool isDouble() const { return type() == Double; } + bool isInvalid() const { return type() == Invalid; } + + bool isSimpleType(QCborSimpleType st) const { return isSimpleType() && toSimpleType() == st; } + bool isFalse() const { return isSimpleType(QCborSimpleType::False); } + bool isTrue() const { return isSimpleType(QCborSimpleType::True); } + bool isBool() const { return isFalse() || isTrue(); } + bool isNull() const { return isSimpleType(QCborSimpleType::Null); } + bool isUndefined() const { return isSimpleType(QCborSimpleType::Undefined); } + + bool isLengthKnown() const noexcept Q_DECL_PURE_FUNCTION; + quint64 length() const; + + bool isContainer() const { return isMap() || isArray(); } + bool enterContainer() { Q_ASSERT(isContainer()); return _enterContainer_helper(); } + bool leaveContainer(); + + bool readAndAppendToString(QString &dst) + { Q_ASSERT(isString()); return _readAndAppendToString_helper(dst); } + bool readAndAppendToUtf8String(QByteArray &dst) + { Q_ASSERT(isString()); return _readAndAppendToUtf8String_helper(dst); } + bool readAndAppendToByteArray(QByteArray &dst) + { Q_ASSERT(isByteArray()); return _readAndAppendToByteArray_helper(dst); } + StringResult readString() { Q_ASSERT(isString()); return _readString_helper(); } + StringResult readUtf8String() { Q_ASSERT(isString()); return _readUtf8String_helper(); } + StringResult readByteArray(){ Q_ASSERT(isByteArray()); return _readByteArray_helper(); } + qsizetype currentStringChunkSize() const{ Q_ASSERT(isString() || isByteArray()); return _currentStringChunkSize(); } + StringResult readStringChunk(char *ptr, qsizetype maxlen); + + bool toBool() const { Q_ASSERT(isBool()); return value64 - int(QCborSimpleType::False); } + QCborTag toTag() const { Q_ASSERT(isTag()); return QCborTag(value64); } + quint64 toUnsignedInteger() const { Q_ASSERT(isUnsignedInteger()); return value64; } + QCborNegativeInteger toNegativeInteger() const { Q_ASSERT(isNegativeInteger()); return QCborNegativeInteger(value64 + 1); } + QCborSimpleType toSimpleType() const{ Q_ASSERT(isSimpleType()); return QCborSimpleType(value64); } + qfloat16 toFloat16() const { Q_ASSERT(isFloat16()); return _toFloatingPoint(); } + float toFloat() const { Q_ASSERT(isFloat()); return _toFloatingPoint(); } + double toDouble() const { Q_ASSERT(isDouble()); return _toFloatingPoint(); } + + qint64 toInteger() const + { + Q_ASSERT(isInteger()); + qint64 v = qint64(value64); + if (isNegativeInteger()) + return -v - 1; + return v; + } + QString readAllString() + { + QString dst; + if (!readAndAppendToString(dst)) + dst = QString{}; + return dst; + } + QByteArray readAllUtf8String() + { + QByteArray dst; + if (!readAndAppendToUtf8String(dst)) + dst = QByteArray{}; + return dst; + } + QByteArray readAllByteArray() + { + QByteArray dst; + if (!readAndAppendToByteArray(dst)) + dst = QByteArray{}; + return dst; + } + +private: + void preparse(); + bool _enterContainer_helper(); + StringResult _readString_helper(); + StringResult _readUtf8String_helper(); + StringResult _readByteArray_helper(); + qsizetype _currentStringChunkSize() const; + bool _readAndAppendToString_helper(QString &); + bool _readAndAppendToUtf8String_helper(QByteArray &); + bool _readAndAppendToByteArray_helper(QByteArray &); + + template FP _toFloatingPoint() const noexcept + { + using UIntFP = typename QIntegerForSizeof::Unsigned; + UIntFP u = UIntFP(value64); + FP f; + memcpy(static_cast(&f), &u, sizeof(f)); + return f; + } + + friend QCborStreamReaderPrivate; + friend class QCborContainerPrivate; + quint64 value64; + QScopedPointer d; + quint8 type_; + quint8 reserved[3] = {}; +}; + +QT_END_NAMESPACE + +#if defined(QT_X11_DEFINES_FOUND) +# define True 1 +# define False 0 +#endif + +#endif // QCBORSTREAMREADER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcborstreamwriter.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcborstreamwriter.h new file mode 100644 index 0000000000000000000000000000000000000000..cc3b87b10493a964c22c21cbb0bf755071655b11 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcborstreamwriter.h @@ -0,0 +1,94 @@ +// Copyright (C) 2018 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCBORSTREAMWRITER_H +#define QCBORSTREAMWRITER_H + +#include +#include +#include +#include +#include +#ifndef QT_BOOTSTRAPPED +#include +#endif + +QT_REQUIRE_CONFIG(cborstreamwriter); + +/* X11 headers use these values too, but as defines */ +#if defined(False) && defined(True) +# undef True +# undef False +#endif + +QT_BEGIN_NAMESPACE + +class QIODevice; + +class QCborStreamWriterPrivate; +class Q_CORE_EXPORT QCborStreamWriter +{ +public: + explicit QCborStreamWriter(QIODevice *device); + explicit QCborStreamWriter(QByteArray *data); + ~QCborStreamWriter(); + Q_DISABLE_COPY(QCborStreamWriter) + + void setDevice(QIODevice *device); + QIODevice *device() const; + + void append(quint64 u); + void append(qint64 i); + void append(QCborNegativeInteger n); + void append(const QByteArray &ba) { appendByteString(ba.constData(), ba.size()); } + void append(QLatin1StringView str); + void append(QStringView str); + void append(QCborTag tag); + void append(QCborKnownTags tag) { append(QCborTag(tag)); } + void append(QCborSimpleType st); + void append(std::nullptr_t) { append(QCborSimpleType::Null); } +#ifndef QT_BOOTSTRAPPED + void append(qfloat16 f); +#endif + void append(float f); + void append(double d); + + void appendByteString(const char *data, qsizetype len); + void appendTextString(const char *utf8, qsizetype len); + + // convenience + void append(bool b) { append(b ? QCborSimpleType::True : QCborSimpleType::False); } + void appendNull() { append(QCborSimpleType::Null); } + void appendUndefined() { append(QCborSimpleType::Undefined); } + +#ifndef Q_QDOC + // overloads to make normal code not complain + void append(int i) { append(qint64(i)); } + void append(uint u) { append(quint64(u)); } +#endif +#ifndef QT_NO_CAST_FROM_ASCII + void append(const char *str, qsizetype size = -1) + { appendTextString(str, (str && size == -1) ? int(strlen(str)) : size); } +#endif + + void startArray(); + void startArray(quint64 count); + bool endArray(); + void startMap(); + void startMap(quint64 count); + bool endMap(); + + // no API for encoding chunked strings + +private: + QScopedPointer d; +}; + +QT_END_NAMESPACE + +#if defined(QT_X11_DEFINES_FOUND) +# define True 1 +# define False 0 +#endif + +#endif // QCBORSTREAMWRITER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcborvalue.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcborvalue.h new file mode 100644 index 0000000000000000000000000000000000000000..833bdbda776dc51c86bca96b977fa6284ea95544 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcborvalue.h @@ -0,0 +1,620 @@ +// Copyright (C) 2022 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCBORVALUE_H +#define QCBORVALUE_H + +#include +#include +#include +#include +#if QT_CONFIG(regularexpression) +# include +#endif +#include +#include +#include +#include +#include + +/* X11 headers use these values too, but as defines */ +#if defined(False) && defined(True) +# undef True +# undef False +#endif + +QT_BEGIN_NAMESPACE + +class QCborArray; +class QCborMap; +class QCborStreamReader; +class QCborStreamWriter; +class QDataStream; + +namespace QJsonPrivate { class Value; } + +struct QCborParserError +{ + qint64 offset = 0; + QCborError error = { QCborError::NoError }; + + QString errorString() const { return error.toString(); } +}; + +class QCborValueRef; +class QCborContainerPrivate; +class Q_CORE_EXPORT QCborValue +{ + Q_GADGET +public: + enum EncodingOption { + SortKeysInMaps = 0x01, + UseFloat = 0x02, +#ifndef QT_BOOTSTRAPPED + UseFloat16 = UseFloat | 0x04, +#endif + UseIntegers = 0x08, + + NoTransformation = 0 + }; + Q_DECLARE_FLAGS(EncodingOptions, EncodingOption) + + enum DiagnosticNotationOption { + Compact = 0x00, + LineWrapped = 0x01, + ExtendedFormat = 0x02 + }; + Q_DECLARE_FLAGS(DiagnosticNotationOptions, DiagnosticNotationOption) + + // different from QCborStreamReader::Type because we have more types + enum Type : int { + Integer = 0x00, + ByteArray = 0x40, + String = 0x60, + Array = 0x80, + Map = 0xa0, + Tag = 0xc0, + + // range 0x100 - 0x1ff for Simple Types + SimpleType = 0x100, + False = SimpleType + int(QCborSimpleType::False), + True = SimpleType + int(QCborSimpleType::True), + Null = SimpleType + int(QCborSimpleType::Null), + Undefined = SimpleType + int(QCborSimpleType::Undefined), + + Double = 0x202, + + // extended (tagged) types + DateTime = 0x10000, + Url = 0x10020, + RegularExpression = 0x10023, + Uuid = 0x10025, + + Invalid = -1 + }; + Q_ENUM(Type) + + QCborValue() {} + QCborValue(Type t_) : t(t_) {} + QCborValue(std::nullptr_t) : t(Null) {} + QCborValue(bool b_) : t(b_ ? True : False) {} +#ifndef Q_QDOC + QCborValue(int i) : QCborValue(qint64(i)) {} + QCborValue(unsigned u) : QCborValue(qint64(u)) {} +#endif + QCborValue(qint64 i) : n(i), t(Integer) {} + QCborValue(double v) : t(Double) { memcpy(&n, &v, sizeof(n)); } + QCborValue(QCborSimpleType st) : t(type_helper(st)) {} + + QCborValue(const QByteArray &ba); + QCborValue(const QString &s); + QCborValue(QStringView s); + QCborValue(QLatin1StringView s); +#ifndef QT_NO_CAST_FROM_ASCII + QT_ASCII_CAST_WARN QCborValue(const char *s) : QCborValue(QString::fromUtf8(s)) {} +#endif + QCborValue(const QCborArray &a); + QCborValue(QCborArray &&a); + QCborValue(const QCborMap &m); + QCborValue(QCborMap &&m); + QCborValue(QCborTag tag, const QCborValue &taggedValue = QCborValue()); + QCborValue(QCborKnownTags t_, const QCborValue &tv = QCborValue()) + : QCborValue(QCborTag(t_), tv) + {} + + explicit QCborValue(const QDateTime &dt); +#ifndef QT_BOOTSTRAPPED + explicit QCborValue(const QUrl &url); +# if QT_CONFIG(regularexpression) + explicit QCborValue(const QRegularExpression &rx); +# endif + explicit QCborValue(const QUuid &uuid); +#endif + + ~QCborValue() { if (container) dispose(); } + + // make sure const char* doesn't go call the bool constructor + QCborValue(const void *) = delete; + + QCborValue(const QCborValue &other) noexcept; + QCborValue(QCborValue &&other) noexcept + : n(other.n), container(std::exchange(other.container, nullptr)), t(std::exchange(other.t, Undefined)) + { + } + QCborValue &operator=(const QCborValue &other) noexcept; + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QCborValue) + + void swap(QCborValue &other) noexcept + { + std::swap(n, other.n); + qt_ptr_swap(container, other.container); + std::swap(t, other.t); + } + + Type type() const { return t; } + bool isInteger() const { return type() == Integer; } + bool isByteArray() const { return type() == ByteArray; } + bool isString() const { return type() == String; } + bool isArray() const { return type() == Array; } + bool isMap() const { return type() == Map; } + bool isTag() const { return isTag_helper(type()); } + bool isFalse() const { return type() == False; } + bool isTrue() const { return type() == True; } + bool isBool() const { return isFalse() || isTrue(); } + bool isNull() const { return type() == Null; } + bool isUndefined() const { return type() == Undefined; } + bool isDouble() const { return type() == Double; } + bool isDateTime() const { return type() == DateTime; } + bool isUrl() const { return type() == Url; } + bool isRegularExpression() const { return type() == RegularExpression; } + bool isUuid() const { return type() == Uuid; } + bool isInvalid() const { return type() == Invalid; } + bool isContainer() const { return isMap() || isArray(); } + + bool isSimpleType() const + { + return int(type()) >> 8 == int(SimpleType) >> 8; + } + bool isSimpleType(QCborSimpleType st) const + { + return type() == type_helper(st); + } + QCborSimpleType toSimpleType(QCborSimpleType defaultValue = QCborSimpleType::Undefined) const + { + return isSimpleType() ? QCborSimpleType(type() & 0xff) : defaultValue; + } + + qint64 toInteger(qint64 defaultValue = 0) const + { return isInteger() ? value_helper() : isDouble() ? qint64(fp_helper()) : defaultValue; } + bool toBool(bool defaultValue = false) const + { return isBool() ? isTrue() : defaultValue; } + double toDouble(double defaultValue = 0) const + { return isDouble() ? fp_helper() : isInteger() ? double(value_helper()) : defaultValue; } + + QCborTag tag(QCborTag defaultValue = QCborTag(-1)) const; + QCborValue taggedValue(const QCborValue &defaultValue = QCborValue()) const; + + QByteArray toByteArray(const QByteArray &defaultValue = {}) const; + QString toString(const QString &defaultValue = {}) const; + QDateTime toDateTime(const QDateTime &defaultValue = {}) const; +#ifndef QT_BOOTSTRAPPED + QUrl toUrl(const QUrl &defaultValue = {}) const; +# if QT_CONFIG(regularexpression) + QRegularExpression toRegularExpression(const QRegularExpression &defaultValue = {}) const; +# endif + QUuid toUuid(const QUuid &defaultValue = {}) const; +#endif + + // only forward-declared, need split functions + QCborArray toArray() const; + QCborArray toArray(const QCborArray &defaultValue) const; + QCborMap toMap() const; + QCborMap toMap(const QCborMap &defaultValue) const; + + const QCborValue operator[](const QString &key) const; + const QCborValue operator[](QLatin1StringView key) const; + const QCborValue operator[](qint64 key) const; + QCborValueRef operator[](qint64 key); + QCborValueRef operator[](QLatin1StringView key); + QCborValueRef operator[](const QString & key); + + int compare(const QCborValue &other) const; +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator==(const QCborValue &other) const noexcept + { return compare(other) == 0; } + bool operator!=(const QCborValue &other) const noexcept + { return !operator==(other); } + bool operator<(const QCborValue &other) const + { return compare(other) < 0; } +#endif + + static QCborValue fromVariant(const QVariant &variant); + QVariant toVariant() const; + static QCborValue fromJsonValue(const QJsonValue &v); + QJsonValue toJsonValue() const; + +#if QT_CONFIG(cborstreamreader) + static QCborValue fromCbor(QCborStreamReader &reader); + static QCborValue fromCbor(const QByteArray &ba, QCborParserError *error = nullptr); + static QCborValue fromCbor(const char *data, qsizetype len, QCborParserError *error = nullptr) + { return fromCbor(QByteArray(data, int(len)), error); } + static QCborValue fromCbor(const quint8 *data, qsizetype len, QCborParserError *error = nullptr) + { return fromCbor(QByteArray(reinterpret_cast(data), int(len)), error); } +#endif // QT_CONFIG(cborstreamreader) +#if QT_CONFIG(cborstreamwriter) + QByteArray toCbor(EncodingOptions opt = NoTransformation) const; + void toCbor(QCborStreamWriter &writer, EncodingOptions opt = NoTransformation) const; +#endif + + QString toDiagnosticNotation(DiagnosticNotationOptions opts = Compact) const; + +private: + friend Q_CORE_EXPORT Q_DECL_PURE_FUNCTION + bool comparesEqual(const QCborValue &lhs, const QCborValue &rhs) noexcept; + friend Qt::strong_ordering compareThreeWay(const QCborValue &lhs, + const QCborValue &rhs) noexcept + { + int c = lhs.compare(rhs); + return Qt::compareThreeWay(c, 0); + } + + Q_DECLARE_STRONGLY_ORDERED(QCborValue) + friend class QCborArray; + friend class QCborMap; + friend class QCborValueConstRef; + friend class QCborValueRef; + friend class QCborContainerPrivate; + friend class QJsonPrivate::Value; + + qint64 n = 0; + QCborContainerPrivate *container = nullptr; + Type t = Undefined; + + void dispose(); + qint64 value_helper() const + { + return n; + } + + double fp_helper() const + { + static_assert(sizeof(double) == sizeof(n)); + double d; + memcpy(&d, &n, sizeof(d)); + return d; + } + + constexpr static Type type_helper(QCborSimpleType st) + { + return Type(quint8(st) | SimpleType); + } + + constexpr static bool isTag_helper(Type tt) + { + return tt == Tag || tt >= 0x10000; + } +}; +Q_DECLARE_SHARED(QCborValue) + +class QCborValueConstRef +{ +public: + QCborValueConstRef(const QCborValueConstRef &) = default; + QCborValueConstRef &operator=(const QCborValueConstRef &) = delete; + operator QCborValue() const { return concrete(); } + + QCborValue::Type type() const { return concreteType(*this); } + bool isInteger() const { return type() == QCborValue::Integer; } + bool isByteArray() const { return type() == QCborValue::ByteArray; } + bool isString() const { return type() == QCborValue::String; } + bool isArray() const { return type() == QCborValue::Array; } + bool isMap() const { return type() == QCborValue::Map; } + bool isTag() const { return concrete().isTag(); } + bool isFalse() const { return type() == QCborValue::False; } + bool isTrue() const { return type() == QCborValue::True; } + bool isBool() const { return isFalse() || isTrue(); } + bool isNull() const { return type() == QCborValue::Null; } + bool isUndefined() const { return type() == QCborValue::Undefined; } + bool isDouble() const { return type() == QCborValue::Double; } + bool isDateTime() const { return type() == QCborValue::DateTime; } + bool isUrl() const { return type() == QCborValue::Url; } + bool isRegularExpression() const { return type() == QCborValue::RegularExpression; } + bool isUuid() const { return type() == QCborValue::Uuid; } + bool isInvalid() const { return type() == QCborValue::Invalid; } + bool isContainer() const { return isMap() || isArray(); } + bool isSimpleType() const { return concrete().isSimpleType(); } + bool isSimpleType(QCborSimpleType st) const { return concrete().isSimpleType(st); } + + QCborSimpleType toSimpleType(QCborSimpleType defaultValue = QCborSimpleType::Undefined) const + { + return concrete().toSimpleType(defaultValue); + } + + QCborTag tag(QCborTag defaultValue = QCborTag(-1)) const + { return concrete().tag(defaultValue); } + QCborValue taggedValue(const QCborValue &defaultValue = QCborValue()) const + { return concrete().taggedValue(defaultValue); } + + qint64 toInteger(qint64 defaultValue = 0) const + { return concrete().toInteger(defaultValue); } + bool toBool(bool defaultValue = false) const + { return concrete().toBool(defaultValue); } + double toDouble(double defaultValue = 0) const + { return concrete().toDouble(defaultValue); } + + QByteArray toByteArray(const QByteArray &defaultValue = {}) const + { return concrete().toByteArray(defaultValue); } + QString toString(const QString &defaultValue = {}) const + { return concrete().toString(defaultValue); } + QDateTime toDateTime(const QDateTime &defaultValue = {}) const + { return concrete().toDateTime(defaultValue); } +#ifndef QT_BOOTSTRAPPED + QUrl toUrl(const QUrl &defaultValue = {}) const + { return concrete().toUrl(defaultValue); } +# if QT_CONFIG(regularexpression) + QRegularExpression toRegularExpression(const QRegularExpression &defaultValue = {}) const + { return concrete().toRegularExpression(defaultValue); } +# endif + QUuid toUuid(const QUuid &defaultValue = {}) const + { return concrete().toUuid(defaultValue); } +#endif + + // only forward-declared, need split functions. Implemented in qcbor{array,map}.h + inline QCborArray toArray() const; + inline QCborArray toArray(const QCborArray &a) const; + inline QCborMap toMap() const; + inline QCborMap toMap(const QCborMap &m) const; + + Q_CORE_EXPORT const QCborValue operator[](const QString &key) const; + Q_CORE_EXPORT const QCborValue operator[](QLatin1StringView key) const; + Q_CORE_EXPORT const QCborValue operator[](qint64 key) const; + + int compare(const QCborValue &other) const + { return concrete().compare(other); } + + QVariant toVariant() const { return concrete().toVariant(); } + inline QJsonValue toJsonValue() const; // in qjsonvalue.h + +#if QT_CONFIG(cborstreamwriter) + QByteArray toCbor(QCborValue::EncodingOptions opt = QCborValue::NoTransformation) const + { return concrete().toCbor(opt); } + void toCbor(QCborStreamWriter &writer, QCborValue::EncodingOptions opt = QCborValue::NoTransformation) const + { return concrete().toCbor(writer, opt); } +#endif + + QString toDiagnosticNotation(QCborValue::DiagnosticNotationOptions opt = QCborValue::Compact) const + { return concrete().toDiagnosticNotation(opt); } + +protected: + friend class QCborValue; + friend class QCborArray; + friend class QCborMap; + friend class QCborContainerPrivate; + + QCborValue concrete() const noexcept { return concrete(*this); } + static Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool + comparesEqual_helper(QCborValueConstRef lhs, QCborValueConstRef rhs) noexcept; + static Q_CORE_EXPORT Q_DECL_PURE_FUNCTION Qt::strong_ordering + compareThreeWay_helper(QCborValueConstRef lhs, QCborValueConstRef rhs) noexcept; + friend bool comparesEqual(const QCborValueConstRef &lhs, + const QCborValueConstRef &rhs) noexcept + { + return comparesEqual_helper(lhs, rhs); + } + friend Qt::strong_ordering compareThreeWay(const QCborValueConstRef &lhs, + const QCborValueConstRef &rhs) noexcept + { + return compareThreeWay_helper(lhs, rhs); + } + Q_DECLARE_STRONGLY_ORDERED(QCborValueConstRef) + + static Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool + comparesEqual_helper(QCborValueConstRef lhs, const QCborValue &rhs) noexcept; + static Q_CORE_EXPORT Q_DECL_PURE_FUNCTION Qt::strong_ordering + compareThreeWay_helper(QCborValueConstRef lhs, const QCborValue &rhs) noexcept; + friend bool comparesEqual(const QCborValueConstRef &lhs, + const QCborValue &rhs) noexcept + { + return comparesEqual_helper(lhs, rhs); + } + friend Qt::strong_ordering compareThreeWay(const QCborValueConstRef &lhs, + const QCborValue &rhs) noexcept + { + return compareThreeWay_helper(lhs, rhs); + } + Q_DECLARE_STRONGLY_ORDERED(QCborValueConstRef, QCborValue) + + static Q_CORE_EXPORT QCborValue concrete(QCborValueConstRef that) noexcept; + static Q_CORE_EXPORT QCborValue::Type concreteType(QCborValueConstRef that) noexcept Q_DECL_PURE_FUNCTION; + static Q_CORE_EXPORT bool + concreteBoolean(QCborValueConstRef that, bool defaultValue) noexcept Q_DECL_PURE_FUNCTION; + static Q_CORE_EXPORT double + concreteDouble(QCborValueConstRef that, double defaultValue) noexcept Q_DECL_PURE_FUNCTION; + static Q_CORE_EXPORT qint64 + concreteIntegral(QCborValueConstRef that, qint64 defaultValue) noexcept Q_DECL_PURE_FUNCTION; + static Q_CORE_EXPORT QByteArray + concreteByteArray(QCborValueConstRef that, const QByteArray &defaultValue); + static Q_CORE_EXPORT QString + concreteString(QCborValueConstRef that, const QString &defaultValue); + + constexpr QCborValueConstRef() : d(nullptr), i(0) {} // this will actually be invalid + constexpr QCborValueConstRef(QCborContainerPrivate *dd, qsizetype ii) + : d(dd), i(ii) + {} + QCborContainerPrivate *d; + qsizetype i; +}; + +QT_WARNING_PUSH +QT6_ONLY(QT_WARNING_DISABLE_MSVC(4275)) // non dll-interface class 'QJsonValueConstRef' used as base for dll-interface class 'QJsonValueRef' +class QT6_ONLY(Q_CORE_EXPORT) QCborValueRef : public QCborValueConstRef +{ +public: + QCborValueRef(const QCborValueRef &) noexcept = default; + QCborValueRef(QCborValueRef &&) noexcept = default; + QCborValueRef &operator=(const QCborValue &other) + { assign(*this, other); return *this; } + QCborValueRef &operator=(QCborValue &&other) + { assign(*this, std::move(other)); other.container = nullptr; return *this; } + QCborValueRef &operator=(const QCborValueRef &other) + { assign(*this, other); return *this; } + + QT7_ONLY(Q_CORE_EXPORT) QCborValueRef operator[](qint64 key); + QT7_ONLY(Q_CORE_EXPORT) QCborValueRef operator[](QLatin1StringView key); + QT7_ONLY(Q_CORE_EXPORT) QCborValueRef operator[](const QString & key); + +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED) + // retained for binary compatibility (due to the Q_CORE_EXPORT) because at + // least one compiler emits and exports all inlines in an exported class + + operator QCborValue() const { return concrete(); } + QCborValue::Type type() const { return concreteType(); } + bool isInteger() const { return type() == QCborValue::Integer; } + bool isByteArray() const { return type() == QCborValue::ByteArray; } + bool isString() const { return type() == QCborValue::String; } + bool isArray() const { return type() == QCborValue::Array; } + bool isMap() const { return type() == QCborValue::Map; } + bool isTag() const { return QCborValue::isTag_helper(type()); } + bool isFalse() const { return type() == QCborValue::False; } + bool isTrue() const { return type() == QCborValue::True; } + bool isBool() const { return isFalse() || isTrue(); } + bool isNull() const { return type() == QCborValue::Null; } + bool isUndefined() const { return type() == QCborValue::Undefined; } + bool isDouble() const { return type() == QCborValue::Double; } + bool isDateTime() const { return type() == QCborValue::DateTime; } + bool isUrl() const { return type() == QCborValue::Url; } + bool isRegularExpression() const { return type() == QCborValue::RegularExpression; } + bool isUuid() const { return type() == QCborValue::Uuid; } + bool isInvalid() const { return type() == QCborValue::Invalid; } + bool isContainer() const { return isMap() || isArray(); } + bool isSimpleType() const + { + return type() >= QCborValue::SimpleType && type() < QCborValue::SimpleType + 0x100; + } + bool isSimpleType(QCborSimpleType st) const + { + return type() == QCborValue::type_helper(st); + } + QCborSimpleType toSimpleType(QCborSimpleType defaultValue = QCborSimpleType::Undefined) const + { + return isSimpleType() ? QCborSimpleType(type() & 0xff) : defaultValue; + } + + QCborTag tag(QCborTag defaultValue = QCborTag(-1)) const + { return concrete().tag(defaultValue); } + QCborValue taggedValue(const QCborValue &defaultValue = QCborValue()) const + { return concrete().taggedValue(defaultValue); } + + qint64 toInteger(qint64 defaultValue = 0) const + { return concreteIntegral(*this, defaultValue); } + bool toBool(bool defaultValue = false) const + { return concreteBoolean(*this, defaultValue); } + double toDouble(double defaultValue = 0) const + { return concreteDouble(*this, defaultValue); } + + QByteArray toByteArray(const QByteArray &defaultValue = {}) const + { return concreteByteArray(*this, defaultValue); } + QString toString(const QString &defaultValue = {}) const + { return concreteString(*this, defaultValue); } + QDateTime toDateTime(const QDateTime &defaultValue = {}) const + { return concrete().toDateTime(defaultValue); } +#ifndef QT_BOOTSTRAPPED + QUrl toUrl(const QUrl &defaultValue = {}) const + { return concrete().toUrl(defaultValue); } +# if QT_CONFIG(regularexpression) + QRegularExpression toRegularExpression(const QRegularExpression &defaultValue = {}) const + { return concrete().toRegularExpression(defaultValue); } +# endif + QUuid toUuid(const QUuid &defaultValue = {}) const + { return concrete().toUuid(defaultValue); } +#endif + + // only forward-declared, need split functions. Implemented in qcbor{array,map}.h + QCborArray toArray() const; + QCborArray toArray(const QCborArray &a) const; + QCborMap toMap() const; + QCborMap toMap(const QCborMap &m) const; + + const QCborValue operator[](const QString &key) const; + const QCborValue operator[](QLatin1StringView key) const; + const QCborValue operator[](qint64 key) const; + + int compare(const QCborValue &other) const + { return concrete().compare(other); } +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator==(const QCborValue &other) const + { return compare(other) == 0; } + bool operator!=(const QCborValue &other) const + { return !operator==(other); } + bool operator<(const QCborValue &other) const + { return compare(other) < 0; } +#endif + + QVariant toVariant() const { return concrete().toVariant(); } + QJsonValue toJsonValue() const; + +#if QT_CONFIG(cborstreamwriter) + using QCborValueConstRef::toCbor; + QByteArray toCbor(QCborValue::EncodingOptions opt = QCborValue::NoTransformation) + { return std::as_const(*this).toCbor(opt); } + void toCbor(QCborStreamWriter &writer, QCborValue::EncodingOptions opt = QCborValue::NoTransformation); +#endif + + using QCborValueConstRef::toDiagnosticNotation; + QString toDiagnosticNotation(QCborValue::DiagnosticNotationOptions opt = QCborValue::Compact) + { return std::as_const(*this).toDiagnosticNotation(opt); } + +private: + static QCborValue concrete(QCborValueRef that) noexcept; + QCborValue concrete() const noexcept { return concrete(*this); } + + static QCborValue::Type concreteType(QCborValueRef self) noexcept Q_DECL_PURE_FUNCTION; + QCborValue::Type concreteType() const noexcept { return concreteType(*this); } + + // this will actually be invalid... + constexpr QCborValueRef() : QCborValueConstRef(nullptr, 0) {} + + QCborValueRef(QCborContainerPrivate *dd, qsizetype ii) + : QCborValueConstRef(dd, ii) + {} +#else +private: + using QCborValueConstRef::QCborValueConstRef; +#endif // < Qt 7 + + friend class QCborValue; + friend class QCborArray; + friend class QCborMap; + friend class QCborContainerPrivate; + friend class QCborValueConstRef; + + // static so we can pass this by value + QT7_ONLY(Q_CORE_EXPORT) static void assign(QCborValueRef that, const QCborValue &other); + QT7_ONLY(Q_CORE_EXPORT) static void assign(QCborValueRef that, QCborValue &&other); + QT7_ONLY(Q_CORE_EXPORT) static void assign(QCborValueRef that, const QCborValueRef other); +}; +QT_WARNING_POP +Q_DECLARE_OPERATORS_FOR_FLAGS(QCborValue::EncodingOptions) +Q_DECLARE_OPERATORS_FOR_FLAGS(QCborValue::DiagnosticNotationOptions) + +Q_CORE_EXPORT size_t qHash(const QCborValue &value, size_t seed = 0); + +#if !defined(QT_NO_DEBUG_STREAM) +Q_CORE_EXPORT QDebug operator<<(QDebug, const QCborValue &v); +#endif + +#ifndef QT_NO_DATASTREAM +#if QT_CONFIG(cborstreamwriter) +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QCborValue &); +#endif +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QCborValue &); +#endif + +QT_END_NAMESPACE + +#if defined(QT_X11_DEFINES_FOUND) +# define True 1 +# define False 0 +#endif + +#endif // QCBORVALUE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qchar.h b/qt/6.8.1/msvc2022_64/include/QtCore/qchar.h new file mode 100644 index 0000000000000000000000000000000000000000..41100d783eaeb132e8bab099733f5fb09c88f0c4 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qchar.h @@ -0,0 +1,660 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCHAR_H +#define QCHAR_H + +#include +#include + +#include // for std::hash + +QT_BEGIN_NAMESPACE + + +class QString; + +struct QLatin1Char +{ +public: + constexpr inline explicit QLatin1Char(char c) noexcept : ch(c) {} + constexpr inline char toLatin1() const noexcept { return ch; } + constexpr inline char16_t unicode() const noexcept { return char16_t(uchar(ch)); } + + friend constexpr bool + comparesEqual(const QLatin1Char &lhs, const QLatin1Char &rhs) noexcept + { return lhs.ch == rhs.ch; } + friend constexpr Qt::strong_ordering + compareThreeWay(const QLatin1Char &lhs, const QLatin1Char &rhs) noexcept + { return Qt::compareThreeWay(uchar(lhs.ch), uchar(rhs.ch)); } + Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE(QLatin1Char) + + friend constexpr bool comparesEqual(const QLatin1Char &lhs, char rhs) noexcept + { return lhs.toLatin1() == rhs; } + friend constexpr Qt::strong_ordering + compareThreeWay(const QLatin1Char &lhs, char rhs) noexcept + { return Qt::compareThreeWay(uchar(lhs.toLatin1()), uchar(rhs)); } + Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE(QLatin1Char, char) + +private: + char ch; +}; + +#define QT_CHAR_FASTCALL QT7_ONLY(Q_CORE_EXPORT) QT_FASTCALL +class QT6_ONLY(Q_CORE_EXPORT) QChar { +public: + enum SpecialCharacter { + Null = 0x0000, + Tabulation = 0x0009, + LineFeed = 0x000a, + FormFeed = 0x000c, + CarriageReturn = 0x000d, + Space = 0x0020, + Nbsp = 0x00a0, + SoftHyphen = 0x00ad, + ReplacementCharacter = 0xfffd, + ObjectReplacementCharacter = 0xfffc, + ByteOrderMark = 0xfeff, + ByteOrderSwapped = 0xfffe, + ParagraphSeparator = 0x2029, + LineSeparator = 0x2028, + VisualTabCharacter = 0x2192, + LastValidCodePoint = 0x10ffff + }; + +#ifdef QT_IMPLICIT_QCHAR_CONSTRUCTION +#error This macro has been removed in Qt 6.8. +#endif + + constexpr Q_IMPLICIT QChar() noexcept : ucs(0) {} + constexpr Q_IMPLICIT QChar(ushort rc) noexcept : ucs(rc) {} + constexpr explicit QChar(uchar c, uchar r) noexcept : ucs(char16_t((r << 8) | c)) {} + constexpr Q_IMPLICIT QChar(short rc) noexcept : ucs(char16_t(rc)) {} + constexpr explicit QChar(uint rc) noexcept : ucs((Q_ASSERT(rc <= 0xffff), char16_t(rc))) {} + constexpr explicit QChar(int rc) noexcept : QChar(uint(rc)) {} + constexpr Q_IMPLICIT QChar(SpecialCharacter s) noexcept : ucs(char16_t(s)) {} + constexpr Q_IMPLICIT QChar(QLatin1Char ch) noexcept : ucs(ch.unicode()) {} + constexpr Q_IMPLICIT QChar(char16_t ch) noexcept : ucs(ch) {} +#if defined(Q_OS_WIN) || defined(Q_QDOC) + constexpr Q_IMPLICIT QChar(wchar_t ch) noexcept : ucs(char16_t(ch)) {} +#endif + +#ifndef QT_NO_CAST_FROM_ASCII + // Always implicit -- allow for 'x' => QChar conversions + QT_ASCII_CAST_WARN constexpr Q_IMPLICIT QChar(char c) noexcept : ucs(uchar(c)) { } +#ifndef QT_RESTRICTED_CAST_FROM_ASCII + QT_ASCII_CAST_WARN constexpr explicit QChar(uchar c) noexcept : ucs(c) { } +#endif +#endif + + static constexpr QChar fromUcs2(char16_t c) noexcept { return QChar{c}; } + static constexpr inline auto fromUcs4(char32_t c) noexcept; + + // Unicode information + + enum Category + { + Mark_NonSpacing, // Mn + Mark_SpacingCombining, // Mc + Mark_Enclosing, // Me + + Number_DecimalDigit, // Nd + Number_Letter, // Nl + Number_Other, // No + + Separator_Space, // Zs + Separator_Line, // Zl + Separator_Paragraph, // Zp + + Other_Control, // Cc + Other_Format, // Cf + Other_Surrogate, // Cs + Other_PrivateUse, // Co + Other_NotAssigned, // Cn + + Letter_Uppercase, // Lu + Letter_Lowercase, // Ll + Letter_Titlecase, // Lt + Letter_Modifier, // Lm + Letter_Other, // Lo + + Punctuation_Connector, // Pc + Punctuation_Dash, // Pd + Punctuation_Open, // Ps + Punctuation_Close, // Pe + Punctuation_InitialQuote, // Pi + Punctuation_FinalQuote, // Pf + Punctuation_Other, // Po + + Symbol_Math, // Sm + Symbol_Currency, // Sc + Symbol_Modifier, // Sk + Symbol_Other // So + }; + + enum Script + { + Script_Unknown, + Script_Inherited, + Script_Common, + + Script_Latin, + Script_Greek, + Script_Cyrillic, + Script_Armenian, + Script_Hebrew, + Script_Arabic, + Script_Syriac, + Script_Thaana, + Script_Devanagari, + Script_Bengali, + Script_Gurmukhi, + Script_Gujarati, + Script_Oriya, + Script_Tamil, + Script_Telugu, + Script_Kannada, + Script_Malayalam, + Script_Sinhala, + Script_Thai, + Script_Lao, + Script_Tibetan, + Script_Myanmar, + Script_Georgian, + Script_Hangul, + Script_Ethiopic, + Script_Cherokee, + Script_CanadianAboriginal, + Script_Ogham, + Script_Runic, + Script_Khmer, + Script_Mongolian, + Script_Hiragana, + Script_Katakana, + Script_Bopomofo, + Script_Han, + Script_Yi, + Script_OldItalic, + Script_Gothic, + Script_Deseret, + Script_Tagalog, + Script_Hanunoo, + Script_Buhid, + Script_Tagbanwa, + Script_Coptic, + + // Unicode 4.0 additions + Script_Limbu, + Script_TaiLe, + Script_LinearB, + Script_Ugaritic, + Script_Shavian, + Script_Osmanya, + Script_Cypriot, + Script_Braille, + + // Unicode 4.1 additions + Script_Buginese, + Script_NewTaiLue, + Script_Glagolitic, + Script_Tifinagh, + Script_SylotiNagri, + Script_OldPersian, + Script_Kharoshthi, + + // Unicode 5.0 additions + Script_Balinese, + Script_Cuneiform, + Script_Phoenician, + Script_PhagsPa, + Script_Nko, + + // Unicode 5.1 additions + Script_Sundanese, + Script_Lepcha, + Script_OlChiki, + Script_Vai, + Script_Saurashtra, + Script_KayahLi, + Script_Rejang, + Script_Lycian, + Script_Carian, + Script_Lydian, + Script_Cham, + + // Unicode 5.2 additions + Script_TaiTham, + Script_TaiViet, + Script_Avestan, + Script_EgyptianHieroglyphs, + Script_Samaritan, + Script_Lisu, + Script_Bamum, + Script_Javanese, + Script_MeeteiMayek, + Script_ImperialAramaic, + Script_OldSouthArabian, + Script_InscriptionalParthian, + Script_InscriptionalPahlavi, + Script_OldTurkic, + Script_Kaithi, + + // Unicode 6.0 additions + Script_Batak, + Script_Brahmi, + Script_Mandaic, + + // Unicode 6.1 additions + Script_Chakma, + Script_MeroiticCursive, + Script_MeroiticHieroglyphs, + Script_Miao, + Script_Sharada, + Script_SoraSompeng, + Script_Takri, + + // Unicode 7.0 additions + Script_CaucasianAlbanian, + Script_BassaVah, + Script_Duployan, + Script_Elbasan, + Script_Grantha, + Script_PahawhHmong, + Script_Khojki, + Script_LinearA, + Script_Mahajani, + Script_Manichaean, + Script_MendeKikakui, + Script_Modi, + Script_Mro, + Script_OldNorthArabian, + Script_Nabataean, + Script_Palmyrene, + Script_PauCinHau, + Script_OldPermic, + Script_PsalterPahlavi, + Script_Siddham, + Script_Khudawadi, + Script_Tirhuta, + Script_WarangCiti, + + // Unicode 8.0 additions + Script_Ahom, + Script_AnatolianHieroglyphs, + Script_Hatran, + Script_Multani, + Script_OldHungarian, + Script_SignWriting, + + // Unicode 9.0 additions + Script_Adlam, + Script_Bhaiksuki, + Script_Marchen, + Script_Newa, + Script_Osage, + Script_Tangut, + + // Unicode 10.0 additions + Script_MasaramGondi, + Script_Nushu, + Script_Soyombo, + Script_ZanabazarSquare, + + // Unicode 12.1 additions + Script_Dogra, + Script_GunjalaGondi, + Script_HanifiRohingya, + Script_Makasar, + Script_Medefaidrin, + Script_OldSogdian, + Script_Sogdian, + Script_Elymaic, + Script_Nandinagari, + Script_NyiakengPuachueHmong, + Script_Wancho, + + // Unicode 13.0 additions + Script_Chorasmian, + Script_DivesAkuru, + Script_KhitanSmallScript, + Script_Yezidi, + + // Unicode 14.0 additions + Script_CyproMinoan, + Script_OldUyghur, + Script_Tangsa, + Script_Toto, + Script_Vithkuqi, + + // Unicode 15.0 additions + Script_Kawi, + Script_NagMundari, + + ScriptCount + }; + + enum Direction + { + DirL, DirR, DirEN, DirES, DirET, DirAN, DirCS, DirB, DirS, DirWS, DirON, + DirLRE, DirLRO, DirAL, DirRLE, DirRLO, DirPDF, DirNSM, DirBN, + DirLRI, DirRLI, DirFSI, DirPDI + }; + + enum Decomposition + { + NoDecomposition, + Canonical, + Font, + NoBreak, + Initial, + Medial, + Final, + Isolated, + Circle, + Super, + Sub, + Vertical, + Wide, + Narrow, + Small, + Square, + Compat, + Fraction + }; + + enum JoiningType { + Joining_None, + Joining_Causing, + Joining_Dual, + Joining_Right, + Joining_Left, + Joining_Transparent + }; + + enum CombiningClass + { + Combining_BelowLeftAttached = 200, + Combining_BelowAttached = 202, + Combining_BelowRightAttached = 204, + Combining_LeftAttached = 208, + Combining_RightAttached = 210, + Combining_AboveLeftAttached = 212, + Combining_AboveAttached = 214, + Combining_AboveRightAttached = 216, + + Combining_BelowLeft = 218, + Combining_Below = 220, + Combining_BelowRight = 222, + Combining_Left = 224, + Combining_Right = 226, + Combining_AboveLeft = 228, + Combining_Above = 230, + Combining_AboveRight = 232, + + Combining_DoubleBelow = 233, + Combining_DoubleAbove = 234, + Combining_IotaSubscript = 240 + }; + + enum UnicodeVersion { + Unicode_Unassigned, + Unicode_1_1, + Unicode_2_0, + Unicode_2_1_2, + Unicode_3_0, + Unicode_3_1, + Unicode_3_2, + Unicode_4_0, + Unicode_4_1, + Unicode_5_0, + Unicode_5_1, + Unicode_5_2, + Unicode_6_0, + Unicode_6_1, + Unicode_6_2, + Unicode_6_3, + Unicode_7_0, + Unicode_8_0, + Unicode_9_0, + Unicode_10_0, + Unicode_11_0, + Unicode_12_0, + Unicode_12_1, + Unicode_13_0, + Unicode_14_0, + Unicode_15_0, + Unicode_15_1, + }; + + inline Category category() const noexcept { return QChar::category(ucs); } + inline Direction direction() const noexcept { return QChar::direction(ucs); } + inline JoiningType joiningType() const noexcept { return QChar::joiningType(ucs); } + inline unsigned char combiningClass() const noexcept { return QChar::combiningClass(ucs); } + + inline QChar mirroredChar() const noexcept { return QChar(QChar::mirroredChar(ucs)); } + inline bool hasMirrored() const noexcept { return QChar::hasMirrored(ucs); } + + QString decomposition() const; + inline Decomposition decompositionTag() const noexcept { return QChar::decompositionTag(ucs); } + + inline int digitValue() const noexcept { return QChar::digitValue(ucs); } + inline QChar toLower() const noexcept { return QChar(QChar::toLower(ucs)); } + inline QChar toUpper() const noexcept { return QChar(QChar::toUpper(ucs)); } + inline QChar toTitleCase() const noexcept { return QChar(QChar::toTitleCase(ucs)); } + inline QChar toCaseFolded() const noexcept { return QChar(QChar::toCaseFolded(ucs)); } + + inline Script script() const noexcept { return QChar::script(ucs); } + + inline UnicodeVersion unicodeVersion() const noexcept { return QChar::unicodeVersion(ucs); } + + constexpr inline char toLatin1() const noexcept { return ucs > 0xff ? '\0' : char(ucs); } + constexpr inline char16_t unicode() const noexcept { return ucs; } + constexpr inline char16_t &unicode() noexcept { return ucs; } + + static constexpr QChar fromLatin1(char c) noexcept { return QLatin1Char(c); } + + constexpr inline bool isNull() const noexcept { return ucs == 0; } + + inline bool isPrint() const noexcept { return QChar::isPrint(ucs); } + constexpr inline bool isSpace() const noexcept { return QChar::isSpace(ucs); } + inline bool isMark() const noexcept { return QChar::isMark(ucs); } + inline bool isPunct() const noexcept { return QChar::isPunct(ucs); } + inline bool isSymbol() const noexcept { return QChar::isSymbol(ucs); } + constexpr inline bool isLetter() const noexcept { return QChar::isLetter(ucs); } + constexpr inline bool isNumber() const noexcept { return QChar::isNumber(ucs); } + constexpr inline bool isLetterOrNumber() const noexcept { return QChar::isLetterOrNumber(ucs); } + constexpr inline bool isDigit() const noexcept { return QChar::isDigit(ucs); } + constexpr inline bool isLower() const noexcept { return QChar::isLower(ucs); } + constexpr inline bool isUpper() const noexcept { return QChar::isUpper(ucs); } + constexpr inline bool isTitleCase() const noexcept { return QChar::isTitleCase(ucs); } + + constexpr inline bool isNonCharacter() const noexcept { return QChar::isNonCharacter(ucs); } + constexpr inline bool isHighSurrogate() const noexcept { return QChar::isHighSurrogate(ucs); } + constexpr inline bool isLowSurrogate() const noexcept { return QChar::isLowSurrogate(ucs); } + constexpr inline bool isSurrogate() const noexcept { return QChar::isSurrogate(ucs); } + + constexpr inline uchar cell() const noexcept { return uchar(ucs & 0xff); } + constexpr inline uchar row() const noexcept { return uchar((ucs>>8)&0xff); } + constexpr inline void setCell(uchar acell) noexcept { ucs = char16_t((ucs & 0xff00) + acell); } + constexpr inline void setRow(uchar arow) noexcept { ucs = char16_t((char16_t(arow)<<8) + (ucs&0xff)); } + + static constexpr inline bool isNonCharacter(char32_t ucs4) noexcept + { + return ucs4 >= 0xfdd0 && (ucs4 <= 0xfdef || (ucs4 & 0xfffe) == 0xfffe); + } + static constexpr inline bool isHighSurrogate(char32_t ucs4) noexcept + { + return (ucs4 & 0xfffffc00) == 0xd800; // 0xd800 + up to 1023 (0x3ff) + } + static constexpr inline bool isLowSurrogate(char32_t ucs4) noexcept + { + return (ucs4 & 0xfffffc00) == 0xdc00; // 0xdc00 + up to 1023 (0x3ff) + } + static constexpr inline bool isSurrogate(char32_t ucs4) noexcept + { + return (ucs4 - 0xd800u < 2048u); + } + static constexpr inline bool requiresSurrogates(char32_t ucs4) noexcept + { + return (ucs4 >= 0x10000); + } + static constexpr inline char32_t surrogateToUcs4(char16_t high, char16_t low) noexcept + { + // 0x010000 through 0x10ffff, provided params are actual high, low surrogates. + // 0x010000 + ((high - 0xd800) << 10) + (low - 0xdc00), optimized: + return (char32_t(high)<<10) + low - 0x35fdc00; + } + static constexpr inline char32_t surrogateToUcs4(QChar high, QChar low) noexcept + { + return surrogateToUcs4(high.ucs, low.ucs); + } + static constexpr inline char16_t highSurrogate(char32_t ucs4) noexcept + { + return char16_t((ucs4>>10) + 0xd7c0); + } + static constexpr inline char16_t lowSurrogate(char32_t ucs4) noexcept + { + return char16_t(ucs4%0x400 + 0xdc00); + } + + static Category QT_CHAR_FASTCALL category(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + static Direction QT_CHAR_FASTCALL direction(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + static JoiningType QT_CHAR_FASTCALL joiningType(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + static unsigned char QT_CHAR_FASTCALL combiningClass(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + + static char32_t QT_CHAR_FASTCALL mirroredChar(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + static bool QT_CHAR_FASTCALL hasMirrored(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + + static QString QT_CHAR_FASTCALL decomposition(char32_t ucs4); + static Decomposition QT_CHAR_FASTCALL decompositionTag(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + + static int QT_CHAR_FASTCALL digitValue(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + static char32_t QT_CHAR_FASTCALL toLower(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + static char32_t QT_CHAR_FASTCALL toUpper(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + static char32_t QT_CHAR_FASTCALL toTitleCase(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + static char32_t QT_CHAR_FASTCALL toCaseFolded(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + + static Script QT_CHAR_FASTCALL script(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + + static UnicodeVersion QT_CHAR_FASTCALL unicodeVersion(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + + static UnicodeVersion QT_CHAR_FASTCALL currentUnicodeVersion() noexcept Q_DECL_CONST_FUNCTION; + + static bool QT_CHAR_FASTCALL isPrint(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + static constexpr inline bool isSpace(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION + { + // note that [0x09..0x0d] + 0x85 are exceptional Cc-s and must be handled explicitly + return ucs4 == 0x20 || (ucs4 <= 0x0d && ucs4 >= 0x09) + || (ucs4 > 127 && (ucs4 == 0x85 || ucs4 == 0xa0 || QChar::isSpace_helper(ucs4))); + } + static bool QT_CHAR_FASTCALL isMark(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + static bool QT_CHAR_FASTCALL isPunct(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + static bool QT_CHAR_FASTCALL isSymbol(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + static constexpr inline bool isLetter(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION + { + return (ucs4 >= 'A' && ucs4 <= 'z' && (ucs4 >= 'a' || ucs4 <= 'Z')) + || (ucs4 > 127 && QChar::isLetter_helper(ucs4)); + } + static constexpr inline bool isNumber(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION + { return (ucs4 <= '9' && ucs4 >= '0') || (ucs4 > 127 && QChar::isNumber_helper(ucs4)); } + static constexpr inline bool isLetterOrNumber(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION + { + return (ucs4 >= 'A' && ucs4 <= 'z' && (ucs4 >= 'a' || ucs4 <= 'Z')) + || (ucs4 >= '0' && ucs4 <= '9') + || (ucs4 > 127 && QChar::isLetterOrNumber_helper(ucs4)); + } + static constexpr inline bool isDigit(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION + { return (ucs4 <= '9' && ucs4 >= '0') || (ucs4 > 127 && QChar::category(ucs4) == Number_DecimalDigit); } + static constexpr inline bool isLower(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION + { return (ucs4 <= 'z' && ucs4 >= 'a') || (ucs4 > 127 && QChar::category(ucs4) == Letter_Lowercase); } + static constexpr inline bool isUpper(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION + { return (ucs4 <= 'Z' && ucs4 >= 'A') || (ucs4 > 127 && QChar::category(ucs4) == Letter_Uppercase); } + static constexpr inline bool isTitleCase(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION + { return ucs4 > 127 && QChar::category(ucs4) == Letter_Titlecase; } + + friend constexpr bool comparesEqual(const QChar &lhs, const QChar &rhs) noexcept + { return lhs.ucs == rhs.ucs; } + friend constexpr Qt::strong_ordering + compareThreeWay(const QChar &lhs, const QChar &rhs) noexcept + { return Qt::compareThreeWay(lhs.ucs, rhs.ucs); } + Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE(QChar) + + friend constexpr bool comparesEqual(const QChar &lhs, std::nullptr_t) noexcept + { return lhs.isNull(); } + friend constexpr Qt::strong_ordering + compareThreeWay(const QChar &lhs, std::nullptr_t) noexcept + { return lhs.isNull() ? Qt::strong_ordering::equivalent : Qt::strong_ordering::greater; } + Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE(QChar, std::nullptr_t) + +private: + static bool QT_CHAR_FASTCALL isSpace_helper(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + static bool QT_CHAR_FASTCALL isLetter_helper(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + static bool QT_CHAR_FASTCALL isNumber_helper(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + static bool QT_CHAR_FASTCALL isLetterOrNumber_helper(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION; + + // defined in qstring.cpp, because we need to go via QUtf8StringView + static bool QT_CHAR_FASTCALL + equal_helper(QChar lhs, const char *rhs) noexcept Q_DECL_CONST_FUNCTION; + static int QT_CHAR_FASTCALL + compare_helper(QChar lhs, const char *rhs) noexcept Q_DECL_CONST_FUNCTION; + +#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) + Q_WEAK_OVERLOAD + friend bool comparesEqual(const QChar &lhs, const char *rhs) noexcept + { return equal_helper(lhs, rhs); } + Q_WEAK_OVERLOAD + friend Qt::strong_ordering compareThreeWay(const QChar &lhs, const char *rhs) noexcept + { + const int res = compare_helper(lhs, rhs); + return Qt::compareThreeWay(res, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QChar, const char *, Q_WEAK_OVERLOAD QT_ASCII_CAST_WARN) +#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) + +#ifdef QT_NO_CAST_FROM_ASCII + QChar(char c) = delete; + QChar(uchar c) = delete; +#endif + + char16_t ucs; +}; +#undef QT_CHAR_FASTCALL + +Q_DECLARE_TYPEINFO(QChar, Q_PRIMITIVE_TYPE); + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, QChar); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QChar &); +#endif + +namespace Qt { +inline namespace Literals { +inline namespace StringLiterals { + +constexpr inline QLatin1Char operator""_L1(char ch) noexcept +{ + return QLatin1Char(ch); +} + +} // StringLiterals +} // Literals +} // Qt + +QT_END_NAMESPACE + +namespace std { +template <> +struct hash +{ + template // for transparent constexpr tracking + constexpr size_t operator()(QT_PREPEND_NAMESPACE(QChar) c) const + noexcept(noexcept(std::hash{}(u' '))) + { + return std::hash{}(c.unicode()); + } +}; +} // namespace std + +#endif // QCHAR_H + +#include // for QChar::fromUcs4() definition diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qchronotimer.h b/qt/6.8.1/msvc2022_64/include/QtCore/qchronotimer.h new file mode 100644 index 0000000000000000000000000000000000000000..3a9a93c955ac64642b0ecec551452d3c968ee899 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qchronotimer.h @@ -0,0 +1,98 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCHRONOTIMER_H +#define QCHRONOTIMER_H + +#ifndef QT_NO_QOBJECT + +#include +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QTimerPrivate; +class Q_CORE_EXPORT QChronoTimer : public QObject +{ + Q_OBJECT + Q_PROPERTY(bool singleShot READ isSingleShot WRITE setSingleShot + BINDABLE bindableSingleShot FINAL) + Q_PROPERTY(std::chrono::nanoseconds interval READ interval WRITE setInterval + BINDABLE bindableInterval FINAL) + Q_PROPERTY(std::chrono::nanoseconds remainingTime READ remainingTime FINAL) + Q_PROPERTY(Qt::TimerType timerType READ timerType WRITE setTimerType + BINDABLE bindableTimerType FINAL) + Q_PROPERTY(bool active READ isActive STORED false BINDABLE bindableActive FINAL) + + template + using FunctorContext = typename QtPrivate::ContextTypeForFunctor::ContextType; + +public: + explicit QChronoTimer(std::chrono::nanoseconds nsec, QObject *parent = nullptr); + explicit QChronoTimer(QObject *parent = nullptr); + ~QChronoTimer() override; + + bool isActive() const; + QBindable bindableActive(); + Qt::TimerId id() const; + + void setInterval(std::chrono::nanoseconds nsec); + std::chrono::nanoseconds interval() const; + QBindable bindableInterval(); + + std::chrono::nanoseconds remainingTime() const; + + void setTimerType(Qt::TimerType atype); + Qt::TimerType timerType() const; + QBindable bindableTimerType(); + + void setSingleShot(bool singleShot); + bool isSingleShot() const; + QBindable bindableSingleShot(); + +#ifdef Q_QDOC + template + QMetaObject::Connection callOnTimeout(const QObject *context, Functor &&slot, + Qt::ConnectionType connectionType = Qt::AutoConnection); +#else + template + QMetaObject::Connection callOnTimeout(Args && ...args) + { + return QObject::connect(this, &QChronoTimer::timeout, std::forward(args)... ); + } +#endif + +public Q_SLOTS: + void start(); + void stop(); + +Q_SIGNALS: + void timeout(QPrivateSignal); + +protected: + void timerEvent(QTimerEvent *) override; + +private: + Q_DISABLE_COPY(QChronoTimer) + + // QChronoTimer uses QTimerPrivate + inline QTimerPrivate *d_func() noexcept + { Q_CAST_IGNORE_ALIGN(return reinterpret_cast(qGetPtrHelper(d_ptr));) } + inline const QTimerPrivate *d_func() const noexcept + { Q_CAST_IGNORE_ALIGN(return reinterpret_cast(qGetPtrHelper(d_ptr));) } + + // These two functions are inherited from QObject + int startTimer(std::chrono::nanoseconds) = delete; + void killTimer(int) = delete; +}; + +QT_END_NAMESPACE + +#endif // QT_NO_QOBJECT + +#endif // QCHRONOTIMER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcollator.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcollator.h new file mode 100644 index 0000000000000000000000000000000000000000..3b69b2522c24164471746b936e868e20e92fd403 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcollator.h @@ -0,0 +1,102 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2013 Aleix Pol Gonzalez +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCOLLATOR_H +#define QCOLLATOR_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QCollatorPrivate; +class QCollatorSortKeyPrivate; +QT_DECLARE_QESDP_SPECIALIZATION_DTOR(QCollatorSortKeyPrivate) + +class Q_CORE_EXPORT QCollatorSortKey +{ + friend class QCollator; +public: + QCollatorSortKey(const QCollatorSortKey &other); + QCollatorSortKey(QCollatorSortKey &&other) noexcept = default; + ~QCollatorSortKey(); + QCollatorSortKey &operator=(const QCollatorSortKey &other); + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QCollatorSortKey) + void swap(QCollatorSortKey &other) noexcept + { d.swap(other.d); } + + int compare(const QCollatorSortKey &key) const; + friend bool operator<(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs) + { return lhs.compare(rhs) < 0; } + +protected: + QCollatorSortKey(QCollatorSortKeyPrivate*); + + QExplicitlySharedDataPointer d; + +private: + QCollatorSortKey(); +}; + +class Q_CORE_EXPORT QCollator +{ +public: + QCollator(); + explicit QCollator(const QLocale &locale); + QCollator(const QCollator &); + ~QCollator(); + QCollator &operator=(const QCollator &); + QCollator(QCollator &&other) noexcept + : d(other.d) { other.d = nullptr; } + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QCollator) + + void swap(QCollator &other) noexcept + { qt_ptr_swap(d, other.d); } + + void setLocale(const QLocale &locale); + QLocale locale() const; + + Qt::CaseSensitivity caseSensitivity() const; + void setCaseSensitivity(Qt::CaseSensitivity cs); + + void setNumericMode(bool on); + bool numericMode() const; + + void setIgnorePunctuation(bool on); + bool ignorePunctuation() const; + + int compare(const QString &s1, const QString &s2) const + { return compare(QStringView(s1), QStringView(s2)); } +#if QT_CORE_REMOVED_SINCE(6, 4) && QT_POINTER_SIZE != 4 + int compare(const QChar *s1, int len1, const QChar *s2, int len2) const + { return compare(QStringView(s1, len1), QStringView(s2, len2)); } +#endif + int compare(const QChar *s1, qsizetype len1, const QChar *s2, qsizetype len2) const + { return compare(QStringView(s1, len1), QStringView(s2, len2)); } + + bool operator()(const QString &s1, const QString &s2) const + { return compare(s1, s2) < 0; } + int compare(QStringView s1, QStringView s2) const; + + bool operator()(QStringView s1, QStringView s2) const + { return compare(s1, s2) < 0; } + + QCollatorSortKey sortKey(const QString &string) const; + + static int defaultCompare(QStringView s1, QStringView s2); + static QCollatorSortKey defaultSortKey(QStringView key); + +private: + QCollatorPrivate *d; + + void detach(); +}; + +Q_DECLARE_SHARED(QCollatorSortKey) +Q_DECLARE_SHARED(QCollator) + +QT_END_NAMESPACE + +#endif // QCOLLATOR_P_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcommandlineoption.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcommandlineoption.h new file mode 100644 index 0000000000000000000000000000000000000000..0255a51cb14dcc71e9a87c7f8ee56e6254602826 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcommandlineoption.h @@ -0,0 +1,69 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2013 Laszlo Papp +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCOMMANDLINEOPTION_H +#define QCOMMANDLINEOPTION_H + +#include +#include + +QT_REQUIRE_CONFIG(commandlineparser); + +QT_BEGIN_NAMESPACE + +class QCommandLineOptionPrivate; + +class Q_CORE_EXPORT QCommandLineOption +{ +public: + enum Flag { + HiddenFromHelp = 0x1, + ShortOptionStyle = 0x2 + }; + Q_DECLARE_FLAGS(Flags, Flag) + + explicit QCommandLineOption(const QString &name); + explicit QCommandLineOption(const QStringList &names); + /*implicit*/ QCommandLineOption(const QString &name, const QString &description, + const QString &valueName = QString(), + const QString &defaultValue = QString()); + /*implicit*/ QCommandLineOption(const QStringList &names, const QString &description, + const QString &valueName = QString(), + const QString &defaultValue = QString()); + QCommandLineOption(const QCommandLineOption &other); + + ~QCommandLineOption(); + + QCommandLineOption &operator=(const QCommandLineOption &other); + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QCommandLineOption) + + void swap(QCommandLineOption &other) noexcept + { d.swap(other.d); } + + QStringList names() const; + + void setValueName(const QString &name); + QString valueName() const; + + void setDescription(const QString &description); + QString description() const; + + void setDefaultValue(const QString &defaultValue); + void setDefaultValues(const QStringList &defaultValues); + QStringList defaultValues() const; + + Flags flags() const; + void setFlags(Flags aflags); + +private: + QSharedDataPointer d; +}; + +Q_DECLARE_SHARED(QCommandLineOption) +Q_DECLARE_OPERATORS_FOR_FLAGS(QCommandLineOption::Flags) + + +QT_END_NAMESPACE + +#endif // QCOMMANDLINEOPTION_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcommandlineparser.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcommandlineparser.h new file mode 100644 index 0000000000000000000000000000000000000000..4324797794a44c32b7e5c014b3cdfab0c99d54ca --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcommandlineparser.h @@ -0,0 +1,78 @@ +// Copyright (C) 2013 Laszlo Papp +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCOMMANDLINEPARSER_H +#define QCOMMANDLINEPARSER_H + +#include + +#include +#include + +QT_REQUIRE_CONFIG(commandlineparser); + +QT_BEGIN_NAMESPACE + +class QCommandLineParserPrivate; +class QCoreApplication; + +class Q_CORE_EXPORT QCommandLineParser +{ + Q_DECLARE_TR_FUNCTIONS(QCommandLineParser) +public: + QCommandLineParser(); + ~QCommandLineParser(); + + enum SingleDashWordOptionMode { + ParseAsCompactedShortOptions, + ParseAsLongOptions + }; + void setSingleDashWordOptionMode(SingleDashWordOptionMode parsingMode); + + enum OptionsAfterPositionalArgumentsMode { + ParseAsOptions, + ParseAsPositionalArguments + }; + void setOptionsAfterPositionalArgumentsMode(OptionsAfterPositionalArgumentsMode mode); + + bool addOption(const QCommandLineOption &commandLineOption); + bool addOptions(const QList &options); + + QCommandLineOption addVersionOption(); + QCommandLineOption addHelpOption(); + void setApplicationDescription(const QString &description); + QString applicationDescription() const; + void addPositionalArgument(const QString &name, const QString &description, const QString &syntax = QString()); + void clearPositionalArguments(); + + void process(const QStringList &arguments); + void process(const QCoreApplication &app); + + bool parse(const QStringList &arguments); + QString errorText() const; + + bool isSet(const QString &name) const; + QString value(const QString &name) const; + QStringList values(const QString &name) const; + + bool isSet(const QCommandLineOption &option) const; + QString value(const QCommandLineOption &option) const; + QStringList values(const QCommandLineOption &option) const; + + QStringList positionalArguments() const; + QStringList optionNames() const; + QStringList unknownOptionNames() const; + + Q_NORETURN void showVersion(); + Q_NORETURN void showHelp(int exitCode = 0); + QString helpText() const; + +private: + Q_DISABLE_COPY(QCommandLineParser) + + QCommandLineParserPrivate * const d; +}; + +QT_END_NAMESPACE + +#endif // QCOMMANDLINEPARSER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcompare.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcompare.h new file mode 100644 index 0000000000000000000000000000000000000000..83742f7a9429d6ccd08d6183529070d0f6ef51f7 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcompare.h @@ -0,0 +1,918 @@ +// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCOMPARE_H +#define QCOMPARE_H + +#if 0 +#pragma qt_class(QtCompare) +#endif + +#include +#include + +#ifdef __cpp_lib_bit_cast +#include +#endif +#ifdef __cpp_lib_three_way_comparison +#include +#endif + +QT_BEGIN_NAMESPACE + +namespace QtPrivate { +using CompareUnderlyingType = qint8; + +// [cmp.categories.pre] / 1 +enum class Ordering : CompareUnderlyingType +{ + Equal = 0, + Equivalent = Equal, + Less = -1, + Greater = 1 +}; + +enum class Uncomparable : CompareUnderlyingType +{ + Unordered = + #if defined(_LIBCPP_VERSION) // libc++ + -127 + #elif defined(__GLIBCXX__) // libstdc++ + 2 + #else // assume MSSTL + -128 + #endif +}; + +} // namespace QtPrivate + +namespace QtOrderingPrivate { + +template +constexpr O reversed(O o) noexcept +{ + // https://eel.is/c++draft/cmp.partialord#5 + return is_lt(o) ? O::greater : + is_gt(o) ? O::less : + /*else*/ o ; +} + +} // namespace QtOrderingPrivate + +namespace Qt { + +class weak_ordering; +class strong_ordering; + +class partial_ordering +{ +public: + static const partial_ordering less; + static const partial_ordering equivalent; + static const partial_ordering greater; + static const partial_ordering unordered; + + friend constexpr bool operator==(partial_ordering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.isOrdered() && lhs.m_order == 0; } + + friend constexpr bool operator!=(partial_ordering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return !lhs.isOrdered() || lhs.m_order != 0; } + + friend constexpr bool operator< (partial_ordering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.isOrdered() && lhs.m_order < 0; } + + friend constexpr bool operator<=(partial_ordering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.isOrdered() && lhs.m_order <= 0; } + + friend constexpr bool operator> (partial_ordering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.isOrdered() && lhs.m_order > 0; } + + friend constexpr bool operator>=(partial_ordering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.isOrdered() && lhs.m_order >= 0; } + + + friend constexpr bool operator==(QtPrivate::CompareAgainstLiteralZero, + partial_ordering rhs) noexcept + { return rhs.isOrdered() && 0 == rhs.m_order; } + + friend constexpr bool operator!=(QtPrivate::CompareAgainstLiteralZero, + partial_ordering rhs) noexcept + { return !rhs.isOrdered() || 0 != rhs.m_order; } + + friend constexpr bool operator< (QtPrivate::CompareAgainstLiteralZero, + partial_ordering rhs) noexcept + { return rhs.isOrdered() && 0 < rhs.m_order; } + + friend constexpr bool operator<=(QtPrivate::CompareAgainstLiteralZero, + partial_ordering rhs) noexcept + { return rhs.isOrdered() && 0 <= rhs.m_order; } + + friend constexpr bool operator> (QtPrivate::CompareAgainstLiteralZero, + partial_ordering rhs) noexcept + { return rhs.isOrdered() && 0 > rhs.m_order; } + + friend constexpr bool operator>=(QtPrivate::CompareAgainstLiteralZero, + partial_ordering rhs) noexcept + { return rhs.isOrdered() && 0 >= rhs.m_order; } + + +#ifdef __cpp_lib_three_way_comparison + friend constexpr std::partial_ordering + operator<=>(partial_ordering lhs, QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs; } // https://eel.is/c++draft/cmp.partialord#4 + + friend constexpr std::partial_ordering + operator<=>(QtPrivate::CompareAgainstLiteralZero, partial_ordering rhs) noexcept + { return QtOrderingPrivate::reversed(rhs); } +#endif // __cpp_lib_three_way_comparison + + + friend constexpr bool operator==(partial_ordering lhs, partial_ordering rhs) noexcept + { return lhs.m_order == rhs.m_order; } + + friend constexpr bool operator!=(partial_ordering lhs, partial_ordering rhs) noexcept + { return lhs.m_order != rhs.m_order; } + +#ifdef __cpp_lib_three_way_comparison + constexpr Q_IMPLICIT partial_ordering(std::partial_ordering stdorder) noexcept + { + if (stdorder == std::partial_ordering::less) + m_order = static_cast(QtPrivate::Ordering::Less); + else if (stdorder == std::partial_ordering::equivalent) + m_order = static_cast(QtPrivate::Ordering::Equivalent); + else if (stdorder == std::partial_ordering::greater) + m_order = static_cast(QtPrivate::Ordering::Greater); + else if (stdorder == std::partial_ordering::unordered) + m_order = static_cast(QtPrivate::Uncomparable::Unordered); + } + + constexpr Q_IMPLICIT operator std::partial_ordering() const noexcept + { + static_assert(sizeof(*this) == sizeof(std::partial_ordering)); +#ifdef __cpp_lib_bit_cast + return std::bit_cast(*this); +#else + using O = QtPrivate::Ordering; + using U = QtPrivate::Uncomparable; + using R = std::partial_ordering; + switch (m_order) { + case qToUnderlying(O::Less): return R::less; + case qToUnderlying(O::Greater): return R::greater; + case qToUnderlying(O::Equivalent): return R::equivalent; + case qToUnderlying(U::Unordered): return R::unordered; + } + Q_UNREACHABLE_RETURN(R::unordered); +#endif // __cpp_lib_bit_cast + } + + friend constexpr bool operator==(partial_ordering lhs, std::partial_ordering rhs) noexcept + { return static_cast(lhs) == rhs; } + + friend constexpr bool operator!=(partial_ordering lhs, std::partial_ordering rhs) noexcept + { return static_cast(lhs) != rhs; } + + friend constexpr bool operator==(std::partial_ordering lhs, partial_ordering rhs) noexcept + { return lhs == static_cast(rhs); } + + friend constexpr bool operator!=(std::partial_ordering lhs, partial_ordering rhs) noexcept + { return lhs != static_cast(rhs); } + + friend constexpr bool operator==(partial_ordering lhs, std::strong_ordering rhs) noexcept + { return static_cast(lhs) == rhs; } + + friend constexpr bool operator!=(partial_ordering lhs, std::strong_ordering rhs) noexcept + { return static_cast(lhs) != rhs; } + + friend constexpr bool operator==(std::strong_ordering lhs, partial_ordering rhs) noexcept + { return lhs == static_cast(rhs); } + + friend constexpr bool operator!=(std::strong_ordering lhs, partial_ordering rhs) noexcept + { return lhs != static_cast(rhs); } + + friend constexpr bool operator==(partial_ordering lhs, std::weak_ordering rhs) noexcept + { return static_cast(lhs) == rhs; } + + friend constexpr bool operator!=(partial_ordering lhs, std::weak_ordering rhs) noexcept + { return static_cast(lhs) != rhs; } + + friend constexpr bool operator==(std::weak_ordering lhs, partial_ordering rhs) noexcept + { return lhs == static_cast(rhs); } + + friend constexpr bool operator!=(std::weak_ordering lhs, partial_ordering rhs) noexcept + { return lhs != static_cast(rhs); } +#endif // __cpp_lib_three_way_comparison + +private: + friend class weak_ordering; + friend class strong_ordering; + + constexpr explicit partial_ordering(QtPrivate::Ordering order) noexcept + : m_order(static_cast(order)) + {} + constexpr explicit partial_ordering(QtPrivate::Uncomparable order) noexcept + : m_order(static_cast(order)) + {} + + QT_WARNING_PUSH + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100903 + QT_WARNING_DISABLE_GCC("-Wzero-as-null-pointer-constant") + friend constexpr bool is_eq (partial_ordering o) noexcept { return o == 0; } + friend constexpr bool is_neq (partial_ordering o) noexcept { return o != 0; } + friend constexpr bool is_lt (partial_ordering o) noexcept { return o < 0; } + friend constexpr bool is_lteq(partial_ordering o) noexcept { return o <= 0; } + friend constexpr bool is_gt (partial_ordering o) noexcept { return o > 0; } + friend constexpr bool is_gteq(partial_ordering o) noexcept { return o >= 0; } + QT_WARNING_POP + + // instead of the exposition only is_ordered member in [cmp.partialord], + // use a private function + constexpr bool isOrdered() const noexcept + { return m_order != static_cast(QtPrivate::Uncomparable::Unordered); } + + QtPrivate::CompareUnderlyingType m_order; +}; + +inline constexpr partial_ordering partial_ordering::less(QtPrivate::Ordering::Less); +inline constexpr partial_ordering partial_ordering::equivalent(QtPrivate::Ordering::Equivalent); +inline constexpr partial_ordering partial_ordering::greater(QtPrivate::Ordering::Greater); +inline constexpr partial_ordering partial_ordering::unordered(QtPrivate::Uncomparable::Unordered); + +class weak_ordering +{ +public: + static const weak_ordering less; + static const weak_ordering equivalent; + static const weak_ordering greater; + + constexpr Q_IMPLICIT operator partial_ordering() const noexcept + { return partial_ordering(static_cast(m_order)); } + + friend constexpr bool operator==(weak_ordering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.m_order == 0; } + + friend constexpr bool operator!=(weak_ordering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.m_order != 0; } + + friend constexpr bool operator< (weak_ordering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.m_order < 0; } + + friend constexpr bool operator<=(weak_ordering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.m_order <= 0; } + + friend constexpr bool operator> (weak_ordering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.m_order > 0; } + + friend constexpr bool operator>=(weak_ordering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.m_order >= 0; } + + + friend constexpr bool operator==(QtPrivate::CompareAgainstLiteralZero, + weak_ordering rhs) noexcept + { return 0 == rhs.m_order; } + + friend constexpr bool operator!=(QtPrivate::CompareAgainstLiteralZero, + weak_ordering rhs) noexcept + { return 0 != rhs.m_order; } + + friend constexpr bool operator< (QtPrivate::CompareAgainstLiteralZero, + weak_ordering rhs) noexcept + { return 0 < rhs.m_order; } + + friend constexpr bool operator<=(QtPrivate::CompareAgainstLiteralZero, + weak_ordering rhs) noexcept + { return 0 <= rhs.m_order; } + + friend constexpr bool operator> (QtPrivate::CompareAgainstLiteralZero, + weak_ordering rhs) noexcept + { return 0 > rhs.m_order; } + + friend constexpr bool operator>=(QtPrivate::CompareAgainstLiteralZero, + weak_ordering rhs) noexcept + { return 0 >= rhs.m_order; } + + +#ifdef __cpp_lib_three_way_comparison + friend constexpr std::weak_ordering + operator<=>(weak_ordering lhs, QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs; } // https://eel.is/c++draft/cmp.weakord#5 + + friend constexpr std::weak_ordering + operator<=>(QtPrivate::CompareAgainstLiteralZero, weak_ordering rhs) noexcept + { return QtOrderingPrivate::reversed(rhs); } +#endif // __cpp_lib_three_way_comparison + + + friend constexpr bool operator==(weak_ordering lhs, weak_ordering rhs) noexcept + { return lhs.m_order == rhs.m_order; } + + friend constexpr bool operator!=(weak_ordering lhs, weak_ordering rhs) noexcept + { return lhs.m_order != rhs.m_order; } + + friend constexpr bool operator==(weak_ordering lhs, partial_ordering rhs) noexcept + { return static_cast(lhs) == rhs; } + + friend constexpr bool operator!=(weak_ordering lhs, partial_ordering rhs) noexcept + { return static_cast(lhs) != rhs; } + + friend constexpr bool operator==(partial_ordering lhs, weak_ordering rhs) noexcept + { return lhs == static_cast(rhs); } + + friend constexpr bool operator!=(partial_ordering lhs, weak_ordering rhs) noexcept + { return lhs != static_cast(rhs); } + +#ifdef __cpp_lib_three_way_comparison + constexpr Q_IMPLICIT weak_ordering(std::weak_ordering stdorder) noexcept + { + if (stdorder == std::weak_ordering::less) + m_order = static_cast(QtPrivate::Ordering::Less); + else if (stdorder == std::weak_ordering::equivalent) + m_order = static_cast(QtPrivate::Ordering::Equivalent); + else if (stdorder == std::weak_ordering::greater) + m_order = static_cast(QtPrivate::Ordering::Greater); + } + + constexpr Q_IMPLICIT operator std::weak_ordering() const noexcept + { + static_assert(sizeof(*this) == sizeof(std::weak_ordering)); +#ifdef __cpp_lib_bit_cast + return std::bit_cast(*this); +#else + using O = QtPrivate::Ordering; + using R = std::weak_ordering; + switch (m_order) { + case qToUnderlying(O::Less): return R::less; + case qToUnderlying(O::Greater): return R::greater; + case qToUnderlying(O::Equivalent): return R::equivalent; + } + Q_UNREACHABLE_RETURN(R::equivalent); +#endif // __cpp_lib_bit_cast + } + + friend constexpr bool operator==(weak_ordering lhs, std::weak_ordering rhs) noexcept + { return static_cast(lhs) == rhs; } + + friend constexpr bool operator!=(weak_ordering lhs, std::weak_ordering rhs) noexcept + { return static_cast(lhs) != rhs; } + + friend constexpr bool operator==(weak_ordering lhs, std::partial_ordering rhs) noexcept + { return static_cast(lhs) == rhs; } + + friend constexpr bool operator!=(weak_ordering lhs, std::partial_ordering rhs) noexcept + { return static_cast(lhs) != rhs; } + + friend constexpr bool operator==(weak_ordering lhs, std::strong_ordering rhs) noexcept + { return static_cast(lhs) == rhs; } + + friend constexpr bool operator!=(weak_ordering lhs, std::strong_ordering rhs) noexcept + { return static_cast(lhs) != rhs; } + + friend constexpr bool operator==(std::weak_ordering lhs, weak_ordering rhs) noexcept + { return lhs == static_cast(rhs); } + + friend constexpr bool operator!=(std::weak_ordering lhs, weak_ordering rhs) noexcept + { return lhs != static_cast(rhs); } + + friend constexpr bool operator==(std::partial_ordering lhs, weak_ordering rhs) noexcept + { return lhs == static_cast(rhs); } + + friend constexpr bool operator!=(std::partial_ordering lhs, weak_ordering rhs) noexcept + { return lhs != static_cast(rhs); } + + friend constexpr bool operator==(std::strong_ordering lhs, weak_ordering rhs) noexcept + { return lhs == static_cast(rhs); } + + friend constexpr bool operator!=(std::strong_ordering lhs, weak_ordering rhs) noexcept + { return lhs != static_cast(rhs); } +#endif // __cpp_lib_three_way_comparison + +private: + friend class strong_ordering; + + constexpr explicit weak_ordering(QtPrivate::Ordering order) noexcept + : m_order(static_cast(order)) + {} + + QT_WARNING_PUSH + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100903 + QT_WARNING_DISABLE_GCC("-Wzero-as-null-pointer-constant") + friend constexpr bool is_eq (weak_ordering o) noexcept { return o == 0; } + friend constexpr bool is_neq (weak_ordering o) noexcept { return o != 0; } + friend constexpr bool is_lt (weak_ordering o) noexcept { return o < 0; } + friend constexpr bool is_lteq(weak_ordering o) noexcept { return o <= 0; } + friend constexpr bool is_gt (weak_ordering o) noexcept { return o > 0; } + friend constexpr bool is_gteq(weak_ordering o) noexcept { return o >= 0; } + QT_WARNING_POP + + QtPrivate::CompareUnderlyingType m_order; +}; + +inline constexpr weak_ordering weak_ordering::less(QtPrivate::Ordering::Less); +inline constexpr weak_ordering weak_ordering::equivalent(QtPrivate::Ordering::Equivalent); +inline constexpr weak_ordering weak_ordering::greater(QtPrivate::Ordering::Greater); + +class strong_ordering +{ +public: + static const strong_ordering less; + static const strong_ordering equivalent; + static const strong_ordering equal; + static const strong_ordering greater; + + constexpr Q_IMPLICIT operator partial_ordering() const noexcept + { return partial_ordering(static_cast(m_order)); } + + constexpr Q_IMPLICIT operator weak_ordering() const noexcept + { return weak_ordering(static_cast(m_order)); } + + friend constexpr bool operator==(strong_ordering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.m_order == 0; } + + friend constexpr bool operator!=(strong_ordering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.m_order != 0; } + + friend constexpr bool operator< (strong_ordering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.m_order < 0; } + + friend constexpr bool operator<=(strong_ordering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.m_order <= 0; } + + friend constexpr bool operator> (strong_ordering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.m_order > 0; } + + friend constexpr bool operator>=(strong_ordering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.m_order >= 0; } + + + friend constexpr bool operator==(QtPrivate::CompareAgainstLiteralZero, + strong_ordering rhs) noexcept + { return 0 == rhs.m_order; } + + friend constexpr bool operator!=(QtPrivate::CompareAgainstLiteralZero, + strong_ordering rhs) noexcept + { return 0 != rhs.m_order; } + + friend constexpr bool operator< (QtPrivate::CompareAgainstLiteralZero, + strong_ordering rhs) noexcept + { return 0 < rhs.m_order; } + + friend constexpr bool operator<=(QtPrivate::CompareAgainstLiteralZero, + strong_ordering rhs) noexcept + { return 0 <= rhs.m_order; } + + friend constexpr bool operator> (QtPrivate::CompareAgainstLiteralZero, + strong_ordering rhs) noexcept + { return 0 > rhs.m_order; } + + friend constexpr bool operator>=(QtPrivate::CompareAgainstLiteralZero, + strong_ordering rhs) noexcept + { return 0 >= rhs.m_order; } + + +#ifdef __cpp_lib_three_way_comparison + friend constexpr std::strong_ordering + operator<=>(strong_ordering lhs, QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs; } // https://eel.is/c++draft/cmp.strongord#6 + + friend constexpr std::strong_ordering + operator<=>(QtPrivate::CompareAgainstLiteralZero, strong_ordering rhs) noexcept + { return QtOrderingPrivate::reversed(rhs); } +#endif // __cpp_lib_three_way_comparison + + + friend constexpr bool operator==(strong_ordering lhs, strong_ordering rhs) noexcept + { return lhs.m_order == rhs.m_order; } + + friend constexpr bool operator!=(strong_ordering lhs, strong_ordering rhs) noexcept + { return lhs.m_order != rhs.m_order; } + + friend constexpr bool operator==(strong_ordering lhs, partial_ordering rhs) noexcept + { return static_cast(lhs) == rhs; } + + friend constexpr bool operator!=(strong_ordering lhs, partial_ordering rhs) noexcept + { return static_cast(lhs) == rhs; } + + friend constexpr bool operator==(partial_ordering lhs, strong_ordering rhs) noexcept + { return lhs == static_cast(rhs); } + + friend constexpr bool operator!=(partial_ordering lhs, strong_ordering rhs) noexcept + { return lhs != static_cast(rhs); } + + friend constexpr bool operator==(strong_ordering lhs, weak_ordering rhs) noexcept + { return static_cast(lhs) == rhs; } + + friend constexpr bool operator!=(strong_ordering lhs, weak_ordering rhs) noexcept + { return static_cast(lhs) == rhs; } + + friend constexpr bool operator==(weak_ordering lhs, strong_ordering rhs) noexcept + { return lhs == static_cast(rhs); } + + friend constexpr bool operator!=(weak_ordering lhs, strong_ordering rhs) noexcept + { return lhs != static_cast(rhs); } + +#ifdef __cpp_lib_three_way_comparison + constexpr Q_IMPLICIT strong_ordering(std::strong_ordering stdorder) noexcept + { + if (stdorder == std::strong_ordering::less) + m_order = static_cast(QtPrivate::Ordering::Less); + else if (stdorder == std::strong_ordering::equivalent) + m_order = static_cast(QtPrivate::Ordering::Equivalent); + else if (stdorder == std::strong_ordering::equal) + m_order = static_cast(QtPrivate::Ordering::Equal); + else if (stdorder == std::strong_ordering::greater) + m_order = static_cast(QtPrivate::Ordering::Greater); + } + + constexpr Q_IMPLICIT operator std::strong_ordering() const noexcept + { + static_assert(sizeof(*this) == sizeof(std::strong_ordering)); +#ifdef __cpp_lib_bit_cast + return std::bit_cast(*this); +#else + using O = QtPrivate::Ordering; + using R = std::strong_ordering; + switch (m_order) { + case qToUnderlying(O::Less): return R::less; + case qToUnderlying(O::Greater): return R::greater; + case qToUnderlying(O::Equal): return R::equal; + } + Q_UNREACHABLE_RETURN(R::equal); +#endif // __cpp_lib_bit_cast + } + + friend constexpr bool operator==(strong_ordering lhs, std::strong_ordering rhs) noexcept + { return static_cast(lhs) == rhs; } + + friend constexpr bool operator!=(strong_ordering lhs, std::strong_ordering rhs) noexcept + { return static_cast(lhs) != rhs; } + + friend constexpr bool operator==(strong_ordering lhs, std::partial_ordering rhs) noexcept + { return static_cast(lhs) == rhs; } + + friend constexpr bool operator!=(strong_ordering lhs, std::partial_ordering rhs) noexcept + { return static_cast(lhs) != rhs; } + + friend constexpr bool operator==(strong_ordering lhs, std::weak_ordering rhs) noexcept + { return static_cast(lhs) == rhs; } + + friend constexpr bool operator!=(strong_ordering lhs, std::weak_ordering rhs) noexcept + { return static_cast(lhs) != rhs; } + + friend constexpr bool operator==(std::strong_ordering lhs, strong_ordering rhs) noexcept + { return lhs == static_cast(rhs); } + + friend constexpr bool operator!=(std::strong_ordering lhs, strong_ordering rhs) noexcept + { return lhs != static_cast(rhs); } + + friend constexpr bool operator==(std::partial_ordering lhs, strong_ordering rhs) noexcept + { return lhs == static_cast(rhs); } + + friend constexpr bool operator!=(std::partial_ordering lhs, strong_ordering rhs) noexcept + { return lhs != static_cast(rhs); } + + friend constexpr bool operator==(std::weak_ordering lhs, strong_ordering rhs) noexcept + { return lhs == static_cast(rhs); } + + friend constexpr bool operator!=(std::weak_ordering lhs, strong_ordering rhs) noexcept + { return lhs != static_cast(rhs); } +#endif // __cpp_lib_three_way_comparison + + private: + constexpr explicit strong_ordering(QtPrivate::Ordering order) noexcept + : m_order(static_cast(order)) + {} + + QT_WARNING_PUSH + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100903 + QT_WARNING_DISABLE_GCC("-Wzero-as-null-pointer-constant") + friend constexpr bool is_eq (strong_ordering o) noexcept { return o == 0; } + friend constexpr bool is_neq (strong_ordering o) noexcept { return o != 0; } + friend constexpr bool is_lt (strong_ordering o) noexcept { return o < 0; } + friend constexpr bool is_lteq(strong_ordering o) noexcept { return o <= 0; } + friend constexpr bool is_gt (strong_ordering o) noexcept { return o > 0; } + friend constexpr bool is_gteq(strong_ordering o) noexcept { return o >= 0; } + QT_WARNING_POP + + QtPrivate::CompareUnderlyingType m_order; +}; + +inline constexpr strong_ordering strong_ordering::less(QtPrivate::Ordering::Less); +inline constexpr strong_ordering strong_ordering::equivalent(QtPrivate::Ordering::Equivalent); +inline constexpr strong_ordering strong_ordering::equal(QtPrivate::Ordering::Equal); +inline constexpr strong_ordering strong_ordering::greater(QtPrivate::Ordering::Greater); + +} // namespace Qt + +QT_BEGIN_INCLUDE_NAMESPACE + +// This is intentionally included after Qt::*_ordering types and before +// qCompareThreeWay. Do not change! +#include + +QT_END_INCLUDE_NAMESPACE + +namespace QtPrivate { + +namespace CompareThreeWayTester { + + using Qt::compareThreeWay; + + // Check if compareThreeWay is implemented for the (LT, RT) argument + // pair. + template + constexpr bool hasCompareThreeWay = false; + + template + constexpr bool hasCompareThreeWay< + LT, RT, std::void_t(), std::declval()))> + > = true; + + // Check if the operation is noexcept. We have two different overloads, + // depending on the available compareThreeWay() implementation. + // Both are declared, but not implemented. To be used only in unevaluated + // context. + + template , bool> = true> + constexpr bool compareThreeWayNoexcept() noexcept + { return noexcept(compareThreeWay(std::declval(), std::declval())); } + + template && hasCompareThreeWay, + bool> = true> + constexpr bool compareThreeWayNoexcept() noexcept + { return noexcept(compareThreeWay(std::declval(), std::declval())); } + +} // namespace CompareThreeWayTester + +} // namespace QtPrivate + +#if defined(Q_QDOC) + +template +auto qCompareThreeWay(const LeftType &lhs, const RightType &rhs); + +#else + +template + || QtPrivate::CompareThreeWayTester::hasCompareThreeWay, + bool> = true> +auto qCompareThreeWay(const LT &lhs, const RT &rhs) + noexcept(QtPrivate::CompareThreeWayTester::compareThreeWayNoexcept()) +{ + using Qt::compareThreeWay; + if constexpr (QtPrivate::CompareThreeWayTester::hasCompareThreeWay) { + return compareThreeWay(lhs, rhs); + } else { + const auto retval = compareThreeWay(rhs, lhs); + return QtOrderingPrivate::reversed(retval); + } +} + +#endif // defined(Q_QDOC) + +// +// Legacy QPartialOrdering +// + +namespace QtPrivate { +enum class LegacyUncomparable : CompareUnderlyingType +{ + Unordered = -127 +}; +} + +// [cmp.partialord] +class QPartialOrdering +{ +public: + static const QPartialOrdering Less; + static const QPartialOrdering Equivalent; + static const QPartialOrdering Greater; + static const QPartialOrdering Unordered; + + static const QPartialOrdering less; + static const QPartialOrdering equivalent; + static const QPartialOrdering greater; + static const QPartialOrdering unordered; + + friend constexpr bool operator==(QPartialOrdering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.isOrdered() && lhs.m_order == 0; } + + friend constexpr bool operator!=(QPartialOrdering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return !lhs.isOrdered() || lhs.m_order != 0; } + + friend constexpr bool operator< (QPartialOrdering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.isOrdered() && lhs.m_order < 0; } + + friend constexpr bool operator<=(QPartialOrdering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.isOrdered() && lhs.m_order <= 0; } + + friend constexpr bool operator> (QPartialOrdering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.isOrdered() && lhs.m_order > 0; } + + friend constexpr bool operator>=(QPartialOrdering lhs, + QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs.isOrdered() && lhs.m_order >= 0; } + + + friend constexpr bool operator==(QtPrivate::CompareAgainstLiteralZero, + QPartialOrdering rhs) noexcept + { return rhs.isOrdered() && 0 == rhs.m_order; } + + friend constexpr bool operator!=(QtPrivate::CompareAgainstLiteralZero, + QPartialOrdering rhs) noexcept + { return !rhs.isOrdered() || 0 != rhs.m_order; } + + friend constexpr bool operator< (QtPrivate::CompareAgainstLiteralZero, + QPartialOrdering rhs) noexcept + { return rhs.isOrdered() && 0 < rhs.m_order; } + + friend constexpr bool operator<=(QtPrivate::CompareAgainstLiteralZero, + QPartialOrdering rhs) noexcept + { return rhs.isOrdered() && 0 <= rhs.m_order; } + + friend constexpr bool operator> (QtPrivate::CompareAgainstLiteralZero, + QPartialOrdering rhs) noexcept + { return rhs.isOrdered() && 0 > rhs.m_order; } + + friend constexpr bool operator>=(QtPrivate::CompareAgainstLiteralZero, + QPartialOrdering rhs) noexcept + { return rhs.isOrdered() && 0 >= rhs.m_order; } + + +#ifdef __cpp_lib_three_way_comparison + friend constexpr std::partial_ordering + operator<=>(QPartialOrdering lhs, QtPrivate::CompareAgainstLiteralZero) noexcept + { return lhs; } // https://eel.is/c++draft/cmp.partialord#4 + + friend constexpr std::partial_ordering + operator<=>(QtPrivate::CompareAgainstLiteralZero, QPartialOrdering rhs) noexcept + { return QtOrderingPrivate::reversed(rhs); } +#endif // __cpp_lib_three_way_comparison + + + friend constexpr bool operator==(QPartialOrdering lhs, QPartialOrdering rhs) noexcept + { return lhs.m_order == rhs.m_order; } + + friend constexpr bool operator!=(QPartialOrdering lhs, QPartialOrdering rhs) noexcept + { return lhs.m_order != rhs.m_order; } + + constexpr Q_IMPLICIT QPartialOrdering(Qt::partial_ordering order) noexcept + : m_order{} // == equivalent + { + if (order == Qt::partial_ordering::less) + m_order = static_cast(QtPrivate::Ordering::Less); + else if (order == Qt::partial_ordering::greater) + m_order = static_cast(QtPrivate::Ordering::Greater); + else if (order == Qt::partial_ordering::unordered) + m_order = static_cast(QtPrivate::LegacyUncomparable::Unordered); + } + + constexpr Q_IMPLICIT QPartialOrdering(Qt::weak_ordering stdorder) noexcept + : QPartialOrdering(Qt::partial_ordering{stdorder}) {} + + constexpr Q_IMPLICIT QPartialOrdering(Qt::strong_ordering stdorder) noexcept + : QPartialOrdering(Qt::partial_ordering{stdorder}) {} + + constexpr Q_IMPLICIT operator Qt::partial_ordering() const noexcept + { + using O = QtPrivate::Ordering; + using U = QtPrivate::LegacyUncomparable; + using R = Qt::partial_ordering; + switch (m_order) { + case qToUnderlying(O::Less): return R::less; + case qToUnderlying(O::Greater): return R::greater; + case qToUnderlying(O::Equivalent): return R::equivalent; + case qToUnderlying(U::Unordered): return R::unordered; + } + // GCC 8.x does not treat __builtin_unreachable() as constexpr +#if !defined(Q_CC_GNU_ONLY) || (Q_CC_GNU >= 900) + // NOLINTNEXTLINE(qt-use-unreachable-return): Triggers on Clang, breaking GCC 8 + Q_UNREACHABLE(); +#endif + return R::unordered; + } + + friend constexpr bool operator==(QPartialOrdering lhs, Qt::partial_ordering rhs) noexcept + { Qt::partial_ordering qt = lhs; return qt == rhs; } + + friend constexpr bool operator!=(QPartialOrdering lhs, Qt::partial_ordering rhs) noexcept + { Qt::partial_ordering qt = lhs; return qt != rhs; } + + friend constexpr bool operator==(Qt::partial_ordering lhs, QPartialOrdering rhs) noexcept + { Qt::partial_ordering qt = rhs; return lhs == qt; } + + friend constexpr bool operator!=(Qt::partial_ordering lhs, QPartialOrdering rhs) noexcept + { Qt::partial_ordering qt = rhs; return lhs != qt; } + +#ifdef __cpp_lib_three_way_comparison + constexpr Q_IMPLICIT QPartialOrdering(std::partial_ordering stdorder) noexcept + { + if (stdorder == std::partial_ordering::less) + m_order = static_cast(QtPrivate::Ordering::Less); + else if (stdorder == std::partial_ordering::equivalent) + m_order = static_cast(QtPrivate::Ordering::Equivalent); + else if (stdorder == std::partial_ordering::greater) + m_order = static_cast(QtPrivate::Ordering::Greater); + else if (stdorder == std::partial_ordering::unordered) + m_order = static_cast(QtPrivate::LegacyUncomparable::Unordered); + } + + constexpr Q_IMPLICIT QPartialOrdering(std::weak_ordering stdorder) noexcept + : QPartialOrdering(std::partial_ordering(stdorder)) {} + + constexpr Q_IMPLICIT QPartialOrdering(std::strong_ordering stdorder) noexcept + : QPartialOrdering(std::partial_ordering(stdorder)) {} + + constexpr Q_IMPLICIT operator std::partial_ordering() const noexcept + { + using O = QtPrivate::Ordering; + using U = QtPrivate::LegacyUncomparable; + using R = std::partial_ordering; + switch (m_order) { + case qToUnderlying(O::Less): return R::less; + case qToUnderlying(O::Greater): return R::greater; + case qToUnderlying(O::Equivalent): return R::equivalent; + case qToUnderlying(U::Unordered): return R::unordered; + } + Q_UNREACHABLE_RETURN(R::unordered); + } + + friend constexpr bool operator==(QPartialOrdering lhs, std::partial_ordering rhs) noexcept + { return static_cast(lhs) == rhs; } + + friend constexpr bool operator!=(QPartialOrdering lhs, std::partial_ordering rhs) noexcept + { return static_cast(lhs) != rhs; } + + friend constexpr bool operator==(std::partial_ordering lhs, QPartialOrdering rhs) noexcept + { return lhs == static_cast(rhs); } + + friend constexpr bool operator!=(std::partial_ordering lhs, QPartialOrdering rhs) noexcept + { return lhs != static_cast(rhs); } +#endif // __cpp_lib_three_way_comparison + +private: + constexpr explicit QPartialOrdering(QtPrivate::Ordering order) noexcept + : m_order(static_cast(order)) + {} + constexpr explicit QPartialOrdering(QtPrivate::LegacyUncomparable order) noexcept + : m_order(static_cast(order)) + {} + + QT_WARNING_PUSH + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100903 + QT_WARNING_DISABLE_GCC("-Wzero-as-null-pointer-constant") + friend constexpr bool is_eq (QPartialOrdering o) noexcept { return o == 0; } + friend constexpr bool is_neq (QPartialOrdering o) noexcept { return o != 0; } + friend constexpr bool is_lt (QPartialOrdering o) noexcept { return o < 0; } + friend constexpr bool is_lteq(QPartialOrdering o) noexcept { return o <= 0; } + friend constexpr bool is_gt (QPartialOrdering o) noexcept { return o > 0; } + friend constexpr bool is_gteq(QPartialOrdering o) noexcept { return o >= 0; } + QT_WARNING_POP + + // instead of the exposition only is_ordered member in [cmp.partialord], + // use a private function + constexpr bool isOrdered() const noexcept + { return m_order != static_cast(QtPrivate::LegacyUncomparable::Unordered); } + + QtPrivate::CompareUnderlyingType m_order; +}; + +inline constexpr QPartialOrdering QPartialOrdering::Less(QtPrivate::Ordering::Less); +inline constexpr QPartialOrdering QPartialOrdering::Equivalent(QtPrivate::Ordering::Equivalent); +inline constexpr QPartialOrdering QPartialOrdering::Greater(QtPrivate::Ordering::Greater); +inline constexpr QPartialOrdering QPartialOrdering::Unordered(QtPrivate::LegacyUncomparable::Unordered); + +inline constexpr QPartialOrdering QPartialOrdering::less(QtPrivate::Ordering::Less); +inline constexpr QPartialOrdering QPartialOrdering::equivalent(QtPrivate::Ordering::Equivalent); +inline constexpr QPartialOrdering QPartialOrdering::greater(QtPrivate::Ordering::Greater); +inline constexpr QPartialOrdering QPartialOrdering::unordered(QtPrivate::LegacyUncomparable::Unordered); + +QT_END_NAMESPACE + +#endif // QCOMPARE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcompare_impl.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcompare_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..59912fed5174fb9846687f51f8880755d09449a0 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcompare_impl.h @@ -0,0 +1,34 @@ +// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCOMPARE_IMPL_H +#define QCOMPARE_IMPL_H + +#if 0 +#pragma qt_sync_skip_header_check +#pragma qt_sync_stop_processing +#endif + +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtPrivate { + +// [cmp.categories.pre] / 3, but using a safe bool trick +// and also rejecting std::nullptr_t (unlike the example) +class CompareAgainstLiteralZero { +public: + using SafeZero = void (CompareAgainstLiteralZero::*)(); + Q_IMPLICIT constexpr CompareAgainstLiteralZero(SafeZero) noexcept {} + + template , bool> = true> + CompareAgainstLiteralZero(T) = delete; +}; + +} // namespace QtPrivate + +QT_END_NAMESPACE + +#endif // QCOMPARE_IMPL_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcomparehelpers.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcomparehelpers.h new file mode 100644 index 0000000000000000000000000000000000000000..ea1146626bd3627170157d343d7cf9ad9ebc0fa6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcomparehelpers.h @@ -0,0 +1,880 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCOMPARE_H +#error "Do not include qcomparehelpers.h directly. Use qcompare.h instead." +#endif + +#ifndef QCOMPAREHELPERS_H +#define QCOMPAREHELPERS_H + +#if 0 +#pragma qt_no_master_include +#pragma qt_sync_skip_header_check +#pragma qt_sync_stop_processing +#endif + +#include +#include +#include +#include + +#ifdef __cpp_lib_three_way_comparison +#include +#endif +#include + +#include // std::less, std::hash + +QT_BEGIN_NAMESPACE + +class QPartialOrdering; + +namespace QtOrderingPrivate { +#ifdef __cpp_lib_three_way_comparison + +template struct StdOrdering; +template struct QtOrdering; + +#define QT_STD_MAP(x) \ + template <> struct StdOrdering< Qt::x##_ordering> : q20::type_identity {};\ + template <> struct StdOrdering : q20::type_identity {};\ + template <> struct QtOrdering : q20::type_identity< Qt::x##_ordering> {};\ + template <> struct QtOrdering< Qt::x##_ordering> : q20::type_identity< Qt::x##_ordering> {};\ + /* end */ +QT_STD_MAP(partial) +QT_STD_MAP(weak) +QT_STD_MAP(strong) +#undef QT_STD_MAP + +template <> struct StdOrdering : q20::type_identity {}; +template <> struct QtOrdering : q20::type_identity< Qt::partial_ordering> {}; + +template constexpr auto to_std(In in) noexcept + -> typename QtOrderingPrivate::StdOrdering::type +{ return in; } + +template constexpr auto to_Qt(In in) noexcept + -> typename QtOrderingPrivate::QtOrdering::type +{ return in; } + +#endif // __cpp_lib_three_way_comparison +} // namespace QtOrderingPrivate + +/* + For all the macros these parameter names are used: + * LeftType - the type of the left operand of the comparison + * RightType - the type of the right operand of the comparison + * Constexpr - must be either constexpr or empty. Defines whether the + operator is constexpr or not + * Noexcept - a noexcept specifier. By default the relational operators are + expected to be noexcept. However, there are some cases when + this cannot be achieved (e.g. QDir). The public macros will + pass noexcept(true) or noexcept(false) in this parameter, + because conditional noexcept is known to cause some issues. + However, internally we might want to pass a predicate here + for some specific classes (e.g. QList, etc). + * Attributes - an optional list of attributes. For example, pass + \c QT_ASCII_CAST_WARN when defining comparisons between + C-style string and an encoding-aware string type. + + The macros require two helper functions. For operators to be constexpr, + these must be constexpr, too. Additionally, other attributes (like + Q__EXPORT, Q_DECL_CONST_FUNCTION, etc) can be applied to them. + Aside from that, their declaration should match: + bool comparesEqual(LeftType, RightType) noexcept; + ReturnType compareThreeWay(LeftType, RightType) noexcept; + + The ReturnType can be one of Qt::{partial,weak,strong}_ordering. The actual + type depends on the macro being used. + It makes sense to define the helper functions as hidden friends of the + class, so that they could be found via ADL, and don't participate in + unintended implicit conversions. +*/ + +/* + Some systems (e.g. QNX and Integrity (GHS compiler)) have bugs in + handling conditional noexcept in lambdas. + This macro is needed to overcome such bugs and provide a noexcept check only + on platforms that behave normally. + It does nothing on the systems that have problems. +*/ +#if !defined(Q_OS_QNX) && !defined(Q_CC_GHS) +# define QT_COMPARISON_NOEXCEPT_CHECK(Noexcept, Func) \ + constexpr auto f = []() Noexcept {}; \ + static_assert(!noexcept(f()) || noexcept(Func(lhs, rhs)), \ + "Use *_NON_NOEXCEPT version of the macro, " \ + "or make the helper function noexcept") +#else +# define QT_COMPARISON_NOEXCEPT_CHECK(Noexcept, Func) /* no check */ +#endif + + +// Seems that qdoc uses C++20 even when Qt is compiled in C++17 mode. +// Or at least it defines __cpp_lib_three_way_comparison. +// Let qdoc see only the C++17 operators for now, because that's what our docs +// currently describe. +#if defined(__cpp_lib_three_way_comparison) && !defined(Q_QDOC) +// C++20 - provide operator==() for equality, and operator<=>() for ordering + +#define QT_DECLARE_EQUALITY_OPERATORS_HELPER(LeftType, RightType, Constexpr, \ + Noexcept, Attributes) \ + Attributes \ + friend Constexpr bool operator==(LeftType const &lhs, RightType const &rhs) Noexcept \ + { \ + QT_COMPARISON_NOEXCEPT_CHECK(Noexcept, comparesEqual); \ + return comparesEqual(lhs, rhs); \ + } + +#define QT_DECLARE_3WAY_HELPER_STRONG(LeftType, RightType, Constexpr, Noexcept, Attributes) \ + Attributes \ + friend Constexpr std::strong_ordering \ + operator<=>(LeftType const &lhs, RightType const &rhs) Noexcept \ + { \ + QT_COMPARISON_NOEXCEPT_CHECK(Noexcept, compareThreeWay); \ + return compareThreeWay(lhs, rhs); \ + } + +#define QT_DECLARE_3WAY_HELPER_WEAK(LeftType, RightType, Constexpr, Noexcept, Attributes) \ + Attributes \ + friend Constexpr std::weak_ordering \ + operator<=>(LeftType const &lhs, RightType const &rhs) Noexcept \ + { \ + QT_COMPARISON_NOEXCEPT_CHECK(Noexcept, compareThreeWay); \ + return compareThreeWay(lhs, rhs); \ + } + +#define QT_DECLARE_3WAY_HELPER_PARTIAL(LeftType, RightType, Constexpr, Noexcept, Attributes) \ + Attributes \ + friend Constexpr std::partial_ordering \ + operator<=>(LeftType const &lhs, RightType const &rhs) Noexcept \ + { \ + QT_COMPARISON_NOEXCEPT_CHECK(Noexcept, compareThreeWay); \ + return compareThreeWay(lhs, rhs); \ + } + +#define QT_DECLARE_ORDERING_OPERATORS_HELPER(OrderingType, LeftType, RightType, Constexpr, \ + Noexcept, Attributes) \ + QT_DECLARE_EQUALITY_OPERATORS_HELPER(LeftType, RightType, Constexpr, Noexcept, Attributes) \ + QT_DECLARE_3WAY_HELPER_ ## OrderingType (LeftType, RightType, Constexpr, Noexcept, Attributes) + +#ifdef Q_COMPILER_LACKS_THREE_WAY_COMPARE_SYMMETRY + +// define reversed versions of the operators manually, because buggy MSVC versions do not do it +#define QT_DECLARE_EQUALITY_OPERATORS_REVERSED_HELPER(LeftType, RightType, Constexpr, \ + Noexcept, Attributes) \ + Attributes \ + friend Constexpr bool operator==(RightType const &lhs, LeftType const &rhs) Noexcept \ + { return comparesEqual(rhs, lhs); } + +#define QT_DECLARE_REVERSED_3WAY_HELPER_STRONG(LeftType, RightType, Constexpr, \ + Noexcept, Attributes) \ + Attributes \ + friend Constexpr std::strong_ordering \ + operator<=>(RightType const &lhs, LeftType const &rhs) Noexcept \ + { \ + const auto r = compareThreeWay(rhs, lhs); \ + return QtOrderingPrivate::reversed(r); \ + } + +#define QT_DECLARE_REVERSED_3WAY_HELPER_WEAK(LeftType, RightType, Constexpr, \ + Noexcept, Attributes) \ + Attributes \ + friend Constexpr std::weak_ordering \ + operator<=>(RightType const &lhs, LeftType const &rhs) Noexcept \ + { \ + const auto r = compareThreeWay(rhs, lhs); \ + return QtOrderingPrivate::reversed(r); \ + } + +#define QT_DECLARE_REVERSED_3WAY_HELPER_PARTIAL(LeftType, RightType, Constexpr, \ + Noexcept, Attributes) \ + Attributes \ + friend Constexpr std::partial_ordering \ + operator<=>(RightType const &lhs, LeftType const &rhs) Noexcept \ + { \ + const auto r = compareThreeWay(rhs, lhs); \ + return QtOrderingPrivate::reversed(r); \ + } + +#define QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(OrderingString, LeftType, RightType, \ + Constexpr, Noexcept, Attributes) \ + QT_DECLARE_EQUALITY_OPERATORS_REVERSED_HELPER(LeftType, RightType, Constexpr, \ + Noexcept, Attributes) \ + QT_DECLARE_REVERSED_3WAY_HELPER_ ## OrderingString (LeftType, RightType, Constexpr, \ + Noexcept, Attributes) + +#else + +// dummy macros for C++17 compatibility, reversed operators are generated by the compiler +#define QT_DECLARE_EQUALITY_OPERATORS_REVERSED_HELPER(LeftType, RightType, Constexpr, \ + Noexcept, Attributes) +#define QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(OrderingString, LeftType, RightType, \ + Constexpr, Noexcept, Attributes) + +#endif // Q_COMPILER_LACKS_THREE_WAY_COMPARE_SYMMETRY + +#else +// C++17 - provide operator==() and operator!=() for equality, +// and all 4 comparison operators for ordering + +#define QT_DECLARE_EQUALITY_OPERATORS_HELPER(LeftType, RightType, Constexpr, \ + Noexcept, Attributes) \ + Attributes \ + friend Constexpr bool operator==(LeftType const &lhs, RightType const &rhs) Noexcept \ + { \ + QT_COMPARISON_NOEXCEPT_CHECK(Noexcept, comparesEqual); \ + return comparesEqual(lhs, rhs); \ + } \ + Attributes \ + friend Constexpr bool operator!=(LeftType const &lhs, RightType const &rhs) Noexcept \ + { return !comparesEqual(lhs, rhs); } + +// Helpers for reversed comparison, using the existing comparesEqual() function. +#define QT_DECLARE_EQUALITY_OPERATORS_REVERSED_HELPER(LeftType, RightType, Constexpr, \ + Noexcept, Attributes) \ + Attributes \ + friend Constexpr bool operator==(RightType const &lhs, LeftType const &rhs) Noexcept \ + { return comparesEqual(rhs, lhs); } \ + Attributes \ + friend Constexpr bool operator!=(RightType const &lhs, LeftType const &rhs) Noexcept \ + { return !comparesEqual(rhs, lhs); } + +#define QT_DECLARE_ORDERING_HELPER_TEMPLATE(OrderingType, LeftType, RightType, Constexpr, \ + Noexcept, Attributes) \ + Attributes \ + friend Constexpr bool operator<(LeftType const &lhs, RightType const &rhs) Noexcept \ + { \ + QT_COMPARISON_NOEXCEPT_CHECK(Noexcept, compareThreeWay); \ + return is_lt(compareThreeWay(lhs, rhs)); \ + } \ + Attributes \ + friend Constexpr bool operator>(LeftType const &lhs, RightType const &rhs) Noexcept \ + { return is_gt(compareThreeWay(lhs, rhs)); } \ + Attributes \ + friend Constexpr bool operator<=(LeftType const &lhs, RightType const &rhs) Noexcept \ + { return is_lteq(compareThreeWay(lhs, rhs)); } \ + Attributes \ + friend Constexpr bool operator>=(LeftType const &lhs, RightType const &rhs) Noexcept \ + { return is_gteq(compareThreeWay(lhs, rhs)); } + +#define QT_DECLARE_ORDERING_HELPER_PARTIAL(LeftType, RightType, Constexpr, Noexcept, Attributes) \ + QT_DECLARE_ORDERING_HELPER_TEMPLATE(Qt::partial_ordering, LeftType, RightType, Constexpr, \ + Noexcept, Attributes) + +#define QT_DECLARE_ORDERING_HELPER_WEAK(LeftType, RightType, Constexpr, Noexcept, Attributes) \ + QT_DECLARE_ORDERING_HELPER_TEMPLATE(Qt::weak_ordering, LeftType, RightType, Constexpr, \ + Noexcept, Attributes) + +#define QT_DECLARE_ORDERING_HELPER_STRONG(LeftType, RightType, Constexpr, Noexcept, Attributes) \ + QT_DECLARE_ORDERING_HELPER_TEMPLATE(Qt::strong_ordering, LeftType, RightType, Constexpr, \ + Noexcept, Attributes) + +#define QT_DECLARE_ORDERING_OPERATORS_HELPER(OrderingString, LeftType, RightType, Constexpr, \ + Noexcept, Attributes) \ + QT_DECLARE_EQUALITY_OPERATORS_HELPER(LeftType, RightType, Constexpr, Noexcept, Attributes) \ + QT_DECLARE_ORDERING_HELPER_ ## OrderingString (LeftType, RightType, Constexpr, Noexcept, \ + Attributes) + +// Helpers for reversed ordering, using the existing compareThreeWay() function. +#define QT_DECLARE_REVERSED_ORDERING_HELPER_TEMPLATE(OrderingType, LeftType, RightType, Constexpr, \ + Noexcept, Attributes) \ + Attributes \ + friend Constexpr bool operator<(RightType const &lhs, LeftType const &rhs) Noexcept \ + { return is_gt(compareThreeWay(rhs, lhs)); } \ + Attributes \ + friend Constexpr bool operator>(RightType const &lhs, LeftType const &rhs) Noexcept \ + { return is_lt(compareThreeWay(rhs, lhs)); } \ + Attributes \ + friend Constexpr bool operator<=(RightType const &lhs, LeftType const &rhs) Noexcept \ + { return is_gteq(compareThreeWay(rhs, lhs)); } \ + Attributes \ + friend Constexpr bool operator>=(RightType const &lhs, LeftType const &rhs) Noexcept \ + { return is_lteq(compareThreeWay(rhs, lhs)); } + +#define QT_DECLARE_REVERSED_ORDERING_HELPER_PARTIAL(LeftType, RightType, Constexpr, Noexcept, \ + Attributes) \ + QT_DECLARE_REVERSED_ORDERING_HELPER_TEMPLATE(Qt::partial_ordering, LeftType, RightType, \ + Constexpr, Noexcept, Attributes) + +#define QT_DECLARE_REVERSED_ORDERING_HELPER_WEAK(LeftType, RightType, Constexpr, Noexcept, \ + Attributes) \ + QT_DECLARE_REVERSED_ORDERING_HELPER_TEMPLATE(Qt::weak_ordering, LeftType, RightType, \ + Constexpr, Noexcept, Attributes) + +#define QT_DECLARE_REVERSED_ORDERING_HELPER_STRONG(LeftType, RightType, Constexpr, Noexcept, \ + Attributes) \ + QT_DECLARE_REVERSED_ORDERING_HELPER_TEMPLATE(Qt::strong_ordering, LeftType, RightType, \ + Constexpr, Noexcept, Attributes) + +#define QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(OrderingString, LeftType, RightType, \ + Constexpr, Noexcept, Attributes) \ + QT_DECLARE_EQUALITY_OPERATORS_REVERSED_HELPER(LeftType, RightType, Constexpr, Noexcept, \ + Attributes) \ + QT_DECLARE_REVERSED_ORDERING_HELPER_ ## OrderingString (LeftType, RightType, Constexpr, \ + Noexcept, Attributes) + +#endif // __cpp_lib_three_way_comparison + +/* Public API starts here */ + +// Equality operators +#define QT_DECLARE_EQUALITY_COMPARABLE_1(Type) \ + QT_DECLARE_EQUALITY_OPERATORS_HELPER(Type, Type, /* non-constexpr */, noexcept(true), \ + /* no attributes */) + +#define QT_DECLARE_EQUALITY_COMPARABLE_2(LeftType, RightType) \ + QT_DECLARE_EQUALITY_OPERATORS_HELPER(LeftType, RightType, /* non-constexpr */, \ + noexcept(true), /* no attributes */) \ + QT_DECLARE_EQUALITY_OPERATORS_REVERSED_HELPER(LeftType, RightType, /* non-constexpr */, \ + noexcept(true), /* no attributes */) + +#define QT_DECLARE_EQUALITY_COMPARABLE_3(LeftType, RightType, Attributes) \ + QT_DECLARE_EQUALITY_OPERATORS_HELPER(LeftType, RightType, /* non-constexpr */, \ + noexcept(true), Attributes) \ + QT_DECLARE_EQUALITY_OPERATORS_REVERSED_HELPER(LeftType, RightType, /* non-constexpr */, \ + noexcept(true), Attributes) + +#define Q_DECLARE_EQUALITY_COMPARABLE(...) \ + QT_OVERLOADED_MACRO(QT_DECLARE_EQUALITY_COMPARABLE, __VA_ARGS__) + +#define QT_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE_1(Type) \ + QT_DECLARE_EQUALITY_OPERATORS_HELPER(Type, Type, constexpr, noexcept(true), \ + /* no attributes */) + +#define QT_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE_2(LeftType, RightType) \ + QT_DECLARE_EQUALITY_OPERATORS_HELPER(LeftType, RightType, constexpr, noexcept(true), \ + /* no attributes */) \ + QT_DECLARE_EQUALITY_OPERATORS_REVERSED_HELPER(LeftType, RightType, constexpr, \ + noexcept(true), /* no attributes */) + +#define QT_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE_3(LeftType, RightType, Attributes) \ + QT_DECLARE_EQUALITY_OPERATORS_HELPER(LeftType, RightType, constexpr, noexcept(true), \ + Attributes) \ + QT_DECLARE_EQUALITY_OPERATORS_REVERSED_HELPER(LeftType, RightType, constexpr, noexcept(true), \ + Attributes) + +#define Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(...) \ + QT_OVERLOADED_MACRO(QT_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE, __VA_ARGS__) + +#define QT_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT_1(Type) \ + QT_DECLARE_EQUALITY_OPERATORS_HELPER(Type, Type, /* non-constexpr */, noexcept(false), \ + /* no attributes */) + +#define QT_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT_2(LeftType, RightType) \ + QT_DECLARE_EQUALITY_OPERATORS_HELPER(LeftType, RightType, /* non-constexpr */, \ + noexcept(false), /* no attributes */) \ + QT_DECLARE_EQUALITY_OPERATORS_REVERSED_HELPER(LeftType, RightType, /* non-constexpr */, \ + noexcept(false), /* no attributes */) + +#define QT_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT_3(LeftType, RightType, Attributes) \ + QT_DECLARE_EQUALITY_OPERATORS_HELPER(LeftType, RightType, /* non-constexpr */, \ + noexcept(false), Attributes) \ + QT_DECLARE_EQUALITY_OPERATORS_REVERSED_HELPER(LeftType, RightType, /* non-constexpr */, \ + noexcept(false), Attributes) + +#define Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(...) \ + QT_OVERLOADED_MACRO(QT_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT, __VA_ARGS__) + +// Partial ordering operators +#define QT_DECLARE_PARTIALLY_ORDERED_1(Type) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(PARTIAL, Type, Type, /* non-constexpr */, \ + noexcept(true), /* no attributes */) + +#define QT_DECLARE_PARTIALLY_ORDERED_2(LeftType, RightType) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(PARTIAL, LeftType, RightType, /* non-constexpr */, \ + noexcept(true), /* no attributes */) \ + QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(PARTIAL, LeftType, RightType, \ + /* non-constexpr */, noexcept(true), \ + /* no attributes */) + +#define QT_DECLARE_PARTIALLY_ORDERED_3(LeftType, RightType, Attributes) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(PARTIAL, LeftType, RightType, /* non-constexpr */, \ + noexcept(true), Attributes) \ + QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(PARTIAL, LeftType, RightType, \ + /* non-constexpr */, noexcept(true), Attributes) + +#define Q_DECLARE_PARTIALLY_ORDERED(...) \ + QT_OVERLOADED_MACRO(QT_DECLARE_PARTIALLY_ORDERED, __VA_ARGS__) + +#define QT_DECLARE_PARTIALLY_ORDERED_LITERAL_TYPE_1(Type) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(PARTIAL, Type, Type, constexpr, noexcept(true), \ + /* no attributes */) + +#define QT_DECLARE_PARTIALLY_ORDERED_LITERAL_TYPE_2(LeftType, RightType) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(PARTIAL, LeftType, RightType, constexpr, \ + noexcept(true), /* no attributes */) \ + QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(PARTIAL, LeftType, RightType, constexpr, \ + noexcept(true), /* no attributes */) + +#define QT_DECLARE_PARTIALLY_ORDERED_LITERAL_TYPE_3(LeftType, RightType, Attributes) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(PARTIAL, LeftType, RightType, constexpr, noexcept(true), \ + Attributes) \ + QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(PARTIAL, LeftType, RightType, constexpr, \ + noexcept(true), Attributes) + +#define Q_DECLARE_PARTIALLY_ORDERED_LITERAL_TYPE(...) \ + QT_OVERLOADED_MACRO(QT_DECLARE_PARTIALLY_ORDERED_LITERAL_TYPE, __VA_ARGS__) + +#define QT_DECLARE_PARTIALLY_ORDERED_NON_NOEXCEPT_1(Type) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(PARTIAL, Type, Type, /* non-constexpr */, \ + noexcept(false), /* no attributes */) + +#define QT_DECLARE_PARTIALLY_ORDERED_NON_NOEXCEPT_2(LeftType, RightType) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(PARTIAL, LeftType, RightType, /* non-constexpr */, \ + noexcept(false), /* no attributes */) \ + QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(PARTIAL, LeftType, RightType, \ + /* non-constexpr */, noexcept(false), \ + /* no attributes */) + +#define QT_DECLARE_PARTIALLY_ORDERED_NON_NOEXCEPT_3(LeftType, RightType, Attributes) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(PARTIAL, LeftType, RightType, /* non-constexpr */, \ + noexcept(false), Attributes) \ + QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(PARTIAL, LeftType, RightType, \ + /* non-constexpr */, noexcept(false), Attributes) + +#define Q_DECLARE_PARTIALLY_ORDERED_NON_NOEXCEPT(...) \ + QT_OVERLOADED_MACRO(QT_DECLARE_PARTIALLY_ORDERED_NON_NOEXCEPT, __VA_ARGS__) + +// Weak ordering operators +#define QT_DECLARE_WEAKLY_ORDERED_1(Type) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(WEAK, Type, Type, /* non-constexpr */, noexcept(true), \ + /* no attributes */) + +#define QT_DECLARE_WEAKLY_ORDERED_2(LeftType, RightType) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(WEAK, LeftType, RightType, /* non-constexpr */, \ + noexcept(true), /* no attributes */) \ + QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(WEAK, LeftType, RightType, /* non-constexpr */, \ + noexcept(true), /* no attributes */) + +#define QT_DECLARE_WEAKLY_ORDERED_3(LeftType, RightType, Attributes) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(WEAK, LeftType, RightType, /* non-constexpr */, \ + noexcept(true), Attributes) \ + QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(WEAK, LeftType, RightType, /* non-constexpr */, \ + noexcept(true), Attributes) + +#define Q_DECLARE_WEAKLY_ORDERED(...) \ + QT_OVERLOADED_MACRO(QT_DECLARE_WEAKLY_ORDERED, __VA_ARGS__) + +#define QT_DECLARE_WEAKLY_ORDERED_LITERAL_TYPE_1(Type) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(WEAK, Type, Type, constexpr, noexcept(true), \ + /* no attributes */) + +#define QT_DECLARE_WEAKLY_ORDERED_LITERAL_TYPE_2(LeftType, RightType) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(WEAK, LeftType, RightType, constexpr, \ + noexcept(true), /* no attributes */) \ + QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(WEAK, LeftType, RightType, constexpr, \ + noexcept(true), /* no attributes */) + +#define QT_DECLARE_WEAKLY_ORDERED_LITERAL_TYPE_3(LeftType, RightType, Attributes) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(WEAK, LeftType, RightType, constexpr, noexcept(true), \ + Attributes) \ + QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(WEAK, LeftType, RightType, constexpr, \ + noexcept(true), Attributes) + +#define Q_DECLARE_WEAKLY_ORDERED_LITERAL_TYPE(...) \ + QT_OVERLOADED_MACRO(QT_DECLARE_WEAKLY_ORDERED_LITERAL_TYPE, __VA_ARGS__) + +#define QT_DECLARE_WEAKLY_ORDERED_NON_NOEXCEPT_1(Type) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(WEAK, Type, Type, /* non-constexpr */, noexcept(false), \ + /* no attributes */) + +#define QT_DECLARE_WEAKLY_ORDERED_NON_NOEXCEPT_2(LeftType, RightType) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(WEAK, LeftType, RightType, /* non-constexpr */, \ + noexcept(false), /* no attributes */) \ + QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(WEAK, LeftType, RightType, /* non-constexpr */, \ + noexcept(false), /* no attributes */) + +#define QT_DECLARE_WEAKLY_ORDERED_NON_NOEXCEPT_3(LeftType, RightType, Attributes) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(WEAK, LeftType, RightType, /* non-constexpr */, \ + noexcept(false), Attributes) \ + QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(WEAK, LeftType, RightType, /* non-constexpr */, \ + noexcept(false), Attributes) + +#define Q_DECLARE_WEAKLY_ORDERED_NON_NOEXCEPT(...) \ + QT_OVERLOADED_MACRO(QT_DECLARE_WEAKLY_ORDERED_NON_NOEXCEPT, __VA_ARGS__) + +// Strong ordering operators +#define QT_DECLARE_STRONGLY_ORDERED_1(Type) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(STRONG, Type, Type, /* non-constexpr */, \ + noexcept(true), /* no attributes */) + +#define QT_DECLARE_STRONGLY_ORDERED_2(LeftType, RightType) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(STRONG, LeftType, RightType, /* non-constexpr */, \ + noexcept(true), /* no attributes */) \ + QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(STRONG, LeftType, RightType, \ + /* non-constexpr */, noexcept(true), \ + /* no attributes */) + +#define QT_DECLARE_STRONGLY_ORDERED_3(LeftType, RightType, Attributes) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(STRONG, LeftType, RightType, /* non-constexpr */, \ + noexcept(true), Attributes) \ + QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(STRONG, LeftType, RightType, \ + /* non-constexpr */, noexcept(true), Attributes) + +#define Q_DECLARE_STRONGLY_ORDERED(...) \ + QT_OVERLOADED_MACRO(QT_DECLARE_STRONGLY_ORDERED, __VA_ARGS__) + +#define QT_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE_1(Type) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(STRONG, Type, Type, constexpr, noexcept(true), \ + /* no attributes */) + +#define QT_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE_2(LeftType, RightType) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(STRONG, LeftType, RightType, constexpr, \ + noexcept(true), /* no attributes */) \ + QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(STRONG, LeftType, RightType, constexpr, \ + noexcept(true), /* no attributes */) + +#define QT_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE_3(LeftType, RightType, Attributes) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(STRONG, LeftType, RightType, constexpr, noexcept(true), \ + Attributes) \ + QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(STRONG, LeftType, RightType, constexpr, \ + noexcept(true), Attributes) + +#define Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE(...) \ + QT_OVERLOADED_MACRO(QT_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE, __VA_ARGS__) + +#define QT_DECLARE_STRONGLY_ORDERED_NON_NOEXCEPT_1(Type) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(STRONG, Type, Type, /* non-constexpr */, \ + noexcept(false), /* no attributes */) + +#define QT_DECLARE_STRONGLY_ORDERED_NON_NOEXCEPT_2(LeftType, RightType) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(STRONG, LeftType, RightType, /* non-constexpr */, \ + noexcept(false), /* no attributes */) \ + QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(STRONG, LeftType, RightType, \ + /* non-constexpr */, noexcept(false), \ + /* no attributes */) + +#define QT_DECLARE_STRONGLY_ORDERED_NON_NOEXCEPT_3(LeftType, RightType, Attributes) \ + QT_DECLARE_ORDERING_OPERATORS_HELPER(STRONG, LeftType, RightType, /* non-constexpr */, \ + noexcept(false), Attributes) \ + QT_DECLARE_ORDERING_OPERATORS_REVERSED_HELPER(STRONG, LeftType, RightType, \ + /* non-constexpr */, noexcept(false), Attributes) + +#define Q_DECLARE_STRONGLY_ORDERED_NON_NOEXCEPT(...) \ + QT_OVERLOADED_MACRO(QT_DECLARE_STRONGLY_ORDERED_NON_NOEXCEPT, __VA_ARGS__) + +namespace QtPrivate { + +template +constexpr bool IsIntegralType_v = std::numeric_limits>::is_specialized + && std::numeric_limits>::is_integer; + +template +constexpr bool IsFloatType_v = std::is_floating_point_v; + +#if QFLOAT16_IS_NATIVE +template <> +inline constexpr bool IsFloatType_v = true; +#endif + +} // namespace QtPrivate + +namespace QtOrderingPrivate { + +template +constexpr Qt::strong_ordering +strongOrderingCompareDefaultImpl(T lhs, U rhs) noexcept +{ +#ifdef __cpp_lib_three_way_comparison + return lhs <=> rhs; +#else + if (lhs == rhs) + return Qt::strong_ordering::equivalent; + else if (lhs < rhs) + return Qt::strong_ordering::less; + else + return Qt::strong_ordering::greater; +#endif // __cpp_lib_three_way_comparison +} + +} // namespace QtOrderingPrivate + +namespace Qt { + +template +using if_integral = std::enable_if_t, bool>; + +template +using if_floating_point = std::enable_if_t, bool>; + +template +using if_compatible_pointers = + std::enable_if_t, + std::is_base_of, + std::is_base_of>, + bool>; + +template +using if_enum = std::enable_if_t, bool>; + +template = true, + if_integral = true> +constexpr Qt::strong_ordering compareThreeWay(LeftInt lhs, RightInt rhs) noexcept +{ + static_assert(std::is_signed_v == std::is_signed_v, + "Qt::compareThreeWay() does not allow mixed-sign comparison."); + +#ifdef __cpp_lib_three_way_comparison + return lhs <=> rhs; +#else + if (lhs == rhs) + return Qt::strong_ordering::equivalent; + else if (lhs < rhs) + return Qt::strong_ordering::less; + else + return Qt::strong_ordering::greater; +#endif // __cpp_lib_three_way_comparison +} + +template = true, + if_floating_point = true> +constexpr Qt::partial_ordering compareThreeWay(LeftFloat lhs, RightFloat rhs) noexcept +{ +QT_WARNING_PUSH +QT_WARNING_DISABLE_FLOAT_COMPARE +#ifdef __cpp_lib_three_way_comparison + return lhs <=> rhs; +#else + if (lhs < rhs) + return Qt::partial_ordering::less; + else if (lhs > rhs) + return Qt::partial_ordering::greater; + else if (lhs == rhs) + return Qt::partial_ordering::equivalent; + else + return Qt::partial_ordering::unordered; +#endif // __cpp_lib_three_way_comparison +QT_WARNING_POP +} + +template = true, + if_floating_point = true> +constexpr Qt::partial_ordering compareThreeWay(IntType lhs, FloatType rhs) noexcept +{ + return compareThreeWay(FloatType(lhs), rhs); +} + +template = true, + if_integral = true> +constexpr Qt::partial_ordering compareThreeWay(FloatType lhs, IntType rhs) noexcept +{ + return compareThreeWay(lhs, FloatType(rhs)); +} + +#if QT_DEPRECATED_SINCE(6, 8) + +template = true> +QT_DEPRECATED_VERSION_X_6_8("Wrap the pointers into Qt::totally_ordered_wrapper and use the respective overload instead.") +constexpr Qt::strong_ordering compareThreeWay(const LeftType *lhs, const RightType *rhs) noexcept +{ +#ifdef __cpp_lib_three_way_comparison + return std::compare_three_way{}(lhs, rhs); +#else + if (lhs == rhs) + return Qt::strong_ordering::equivalent; + else if (std::less<>{}(lhs, rhs)) + return Qt::strong_ordering::less; + else + return Qt::strong_ordering::greater; +#endif // __cpp_lib_three_way_comparison +} + +template +QT_DEPRECATED_VERSION_X_6_8("Wrap the pointer into Qt::totally_ordered_wrapper and use the respective overload instead.") +constexpr Qt::strong_ordering compareThreeWay(const T *lhs, std::nullptr_t rhs) noexcept +{ + return compareThreeWay(lhs, static_cast(rhs)); +} + +template +QT_DEPRECATED_VERSION_X_6_8("Wrap the pointer into Qt::totally_ordered_wrapper and use the respective overload instead.") +constexpr Qt::strong_ordering compareThreeWay(std::nullptr_t lhs, const T *rhs) noexcept +{ + return compareThreeWay(static_cast(lhs), rhs); +} + +#endif // QT_DEPRECATED_SINCE(6, 8) + +template = true> +constexpr Qt::strong_ordering compareThreeWay(Enum lhs, Enum rhs) noexcept +{ + return compareThreeWay(qToUnderlying(lhs), qToUnderlying(rhs)); +} +} // namespace Qt + +namespace QtOrderingPrivate { + +template +constexpr std::tuple qt_tuple_pop_front_impl(const std::tuple &t, + std::index_sequence) noexcept +{ + return std::tuple(std::get(t)...); +} + +template +constexpr std::tuple qt_tuple_pop_front(const std::tuple &t) noexcept +{ + return qt_tuple_pop_front_impl(t, std::index_sequence_for{}); +} + +template +constexpr auto compareThreeWayMulti(const std::tuple &lhs, // ie. not empty + const std::tuple &rhs) noexcept +{ + static_assert(sizeof...(LhsTail) == sizeof...(RhsTail), + // expanded together below, but provide a nicer error message: + "The tuple arguments have to have the same size."); + + using Qt::compareThreeWay; + using R = std::common_type_t< + decltype(compareThreeWay(std::declval(), std::declval())), + decltype(compareThreeWay(std::declval(), std::declval()))... + >; + + const auto &l = std::get<0>(lhs); + const auto &r = std::get<0>(rhs); + static_assert(noexcept(compareThreeWay(l, r)), + "This function requires all relational operators to be noexcept."); + const auto res = compareThreeWay(l, r); + if constexpr (sizeof...(LhsTail) > 0) { + if (is_eq(res)) + return R{compareThreeWayMulti(qt_tuple_pop_front(lhs), qt_tuple_pop_front(rhs))}; + } + return R{res}; +} + +} //QtOrderingPrivate + +namespace Qt { +// A wrapper class that adapts the wrappee to use the strongly-ordered +// function objects for implementing the relational operators. +// Mostly useful to avoid UB on pointers (which it currently mandates P to be), +// because all the comparison helpers (incl. std::compare_three_way on +// std::tuple!) will use the language-level operators. +// +template +class totally_ordered_wrapper +{ + static_assert(std::is_pointer_v

); + using T = std::remove_pointer_t

; + + P ptr; +public: + totally_ordered_wrapper() noexcept = default; + Q_IMPLICIT constexpr totally_ordered_wrapper(std::nullptr_t) + // requires std::is_pointer_v

+ : totally_ordered_wrapper(P{nullptr}) {} + explicit constexpr totally_ordered_wrapper(P p) noexcept : ptr(p) {} + + constexpr P get() const noexcept { return ptr; } + constexpr void reset(P p) noexcept { ptr = p; } + constexpr P operator->() const noexcept { return get(); } + template , bool> = true> + constexpr U &operator*() const noexcept { return *get(); } + + explicit constexpr operator bool() const noexcept { return get(); } + +private: + // TODO: Replace the constraints with std::common_type_t when + // a bug in VxWorks is fixed! + template + using if_compatible_types = + std::enable_if_t, + std::is_pointer, + std::disjunction, + std::is_convertible>>, + bool>; + +#define MAKE_RELOP(Ret, op, Op) \ + template = true> \ + friend constexpr Ret operator op (const totally_ordered_wrapper

&lhs, const totally_ordered_wrapper &rhs) noexcept \ + { return std:: Op {}(lhs.ptr, rhs.get()); } \ + template = true> \ + friend constexpr Ret operator op (const totally_ordered_wrapper

&lhs, const U &rhs) noexcept \ + { return std:: Op {}(lhs.ptr, rhs ); } \ + template = true> \ + friend constexpr Ret operator op (const U &lhs, const totally_ordered_wrapper

&rhs) noexcept \ + { return std:: Op {}(lhs, rhs.ptr); } \ + friend constexpr Ret operator op (const totally_ordered_wrapper &lhs, std::nullptr_t) noexcept \ + { return std:: Op {}(lhs.ptr, P(nullptr)); } \ + friend constexpr Ret operator op (std::nullptr_t, const totally_ordered_wrapper &rhs) noexcept \ + { return std:: Op {}(P(nullptr), rhs.ptr); } \ + /* end */ + MAKE_RELOP(bool, ==, equal_to<>) + MAKE_RELOP(bool, !=, not_equal_to<>) + MAKE_RELOP(bool, < , less<>) + MAKE_RELOP(bool, <=, less_equal<>) + MAKE_RELOP(bool, > , greater<>) + MAKE_RELOP(bool, >=, greater_equal<>) +#ifdef __cpp_lib_three_way_comparison + MAKE_RELOP(auto, <=>, compare_three_way) +#endif +#undef MAKE_RELOP + friend void qt_ptr_swap(totally_ordered_wrapper &lhs, totally_ordered_wrapper &rhs) noexcept + { qt_ptr_swap(lhs.ptr, rhs.ptr); } + friend void swap(totally_ordered_wrapper &lhs, totally_ordered_wrapper &rhs) noexcept + { qt_ptr_swap(lhs, rhs); } + friend size_t qHash(totally_ordered_wrapper key, size_t seed = 0) noexcept + { return qHash(key.ptr, seed); } +}; + +template = true> +constexpr Qt::strong_ordering +compareThreeWay(Qt::totally_ordered_wrapper lhs, Qt::totally_ordered_wrapper rhs) noexcept +{ + return QtOrderingPrivate::strongOrderingCompareDefaultImpl(lhs, rhs); +} + +template = true> +constexpr Qt::strong_ordering +compareThreeWay(Qt::totally_ordered_wrapper lhs, U *rhs) noexcept +{ + return QtOrderingPrivate::strongOrderingCompareDefaultImpl(lhs, rhs); +} + +template = true> +constexpr Qt::strong_ordering +compareThreeWay(U *lhs, Qt::totally_ordered_wrapper rhs) noexcept +{ + return QtOrderingPrivate::strongOrderingCompareDefaultImpl(lhs, rhs); +} + +template +constexpr Qt::strong_ordering +compareThreeWay(Qt::totally_ordered_wrapper lhs, std::nullptr_t rhs) noexcept +{ + return QtOrderingPrivate::strongOrderingCompareDefaultImpl(lhs, rhs); +} + +template +constexpr Qt::strong_ordering +compareThreeWay(std::nullptr_t lhs, Qt::totally_ordered_wrapper rhs) noexcept +{ + return QtOrderingPrivate::strongOrderingCompareDefaultImpl(lhs, rhs); +} + +} //Qt + +template +class QTypeInfo> : public QTypeInfo

{}; + +QT_END_NAMESPACE + +namespace std { + template + struct hash> + { + using argument_type = QT_PREPEND_NAMESPACE(Qt::totally_ordered_wrapper)

; + using result_type = size_t; + constexpr result_type operator()(argument_type w) const noexcept + { return std::hash

{}(w.get()); } + }; +} + +#endif // QCOMPAREHELPERS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcompilerdetection.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcompilerdetection.h new file mode 100644 index 0000000000000000000000000000000000000000..0a4702ad085c4fa9fb1ae76ba67f748d6ee0ccf6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcompilerdetection.h @@ -0,0 +1,1428 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#if 0 +#pragma qt_class(QtCompilerDetection) +#pragma qt_sync_skip_header_check +#pragma qt_sync_stop_processing +#endif + +#ifndef QCOMPILERDETECTION_H +#define QCOMPILERDETECTION_H + +#include +#include +#include + +/* + The compiler, must be one of: (Q_CC_x) + + COVERITY - Coverity cov-scan + SYM - Digital Mars C/C++ (used to be Symantec C++) + MSVC - Microsoft Visual C/C++, Intel C++ for Windows + BOR - Borland/Turbo C++ + WAT - Watcom C++ + GNU - GNU C++ + COMEAU - Comeau C++ + EDG - Edison Design Group C++ + OC - CenterLine C++ + SUN - Forte Developer, or Sun Studio C++ + MIPS - MIPSpro C++ + DEC - DEC C++ + HPACC - HP aC++ + USLC - SCO OUDK and UDK + CDS - Reliant C++ + KAI - KAI C++ + INTEL - Intel C++ for Linux, Intel C++ for Windows + HIGHC - MetaWare High C/C++ + PGI - Portland Group C++ + GHS - Green Hills Optimizing C++ Compilers + RVCT - ARM Realview Compiler Suite + CLANG - C++ front-end for the LLVM compiler + + + Should be sorted most to least authoritative. +*/ + +#if defined(__COVERITY__) +# define Q_CC_COVERITY +# define Q_COMPILER_COMPLAINS_ABOUT_RETURN_AFTER_UNREACHABLE +#endif + +/* Symantec C++ is now Digital Mars */ +#if defined(__DMC__) || defined(__SC__) +# define Q_CC_SYM +/* "explicit" semantics implemented in 8.1e but keyword recognized since 7.5 */ +# if defined(__SC__) && __SC__ < 0x750 +# error "Compiler not supported" +# endif + +#elif defined(_MSC_VER) +# define Q_CC_MSVC (_MSC_VER) +# define Q_CC_MSVC_NET +# define Q_CC_MSVC_ONLY Q_CC_MSVC +# ifdef __clang__ +# undef Q_CC_MSVC_ONLY +# define Q_CC_CLANG ((__clang_major__ * 100) + __clang_minor__) +# define Q_CC_CLANG_ONLY Q_CC_CLANG +# endif +# define Q_OUTOFLINE_TEMPLATE inline +# define Q_COMPILER_MANGLES_RETURN_TYPE +# define Q_COMPILER_MANGLES_ACCESS_SPECIFIER +# define Q_FUNC_INFO __FUNCSIG__ +# define Q_ASSUME_IMPL(expr) __assume(expr) +# define Q_UNREACHABLE_IMPL() __assume(0) +# define Q_DECL_EXPORT __declspec(dllexport) +# define Q_DECL_IMPORT __declspec(dllimport) +# if _MSC_VER < 1938 // stdext is deprecated since VS 2022 17.8 +# define QT_MAKE_CHECKED_ARRAY_ITERATOR(x, N) stdext::make_checked_array_iterator(x, size_t(N)) // Since _MSC_VER >= 1500 +# endif +# define Q_COMPILER_COMPLAINS_ABOUT_RETURN_AFTER_UNREACHABLE + +#elif defined(__BORLANDC__) || defined(__TURBOC__) +# define Q_CC_BOR +# define Q_INLINE_TEMPLATE +# if __BORLANDC__ < 0x502 +# error "Compiler not supported" +# endif + +#elif defined(__WATCOMC__) +# define Q_CC_WAT + +/* ARM Realview Compiler Suite + RVCT compiler also defines __EDG__ and __GNUC__ (if --gnu flag is given), + so check for it before that */ +#elif defined(__ARMCC__) || defined(__CC_ARM) +# define Q_CC_RVCT +/* work-around for missing compiler intrinsics */ +# define __is_empty(X) false +# define __is_pod(X) false +# define Q_DECL_DEPRECATED __attribute__ ((__deprecated__)) +# ifdef Q_OS_LINUX +# define Q_DECL_EXPORT __attribute__((visibility("default"))) +# define Q_DECL_IMPORT __attribute__((visibility("default"))) +# define Q_DECL_HIDDEN __attribute__((visibility("hidden"))) +# else +# define Q_DECL_EXPORT __declspec(dllexport) +# define Q_DECL_IMPORT __declspec(dllimport) +# endif + +#elif defined(__GNUC__) +# define Q_CC_GNU (__GNUC__ * 100 + __GNUC_MINOR__) +# if defined(__MINGW32__) +# define Q_CC_MINGW +# endif +# if defined(__clang__) +/* Clang also masquerades as GCC */ +# if defined(__apple_build_version__) + // The Clang version reported by Apple Clang in __clang_major__ + // and __clang_minor__ does _not_ reflect the actual upstream + // version of the compiler. To allow consumers to use a single + // define to verify the Clang version we hard-code the versions + // based on the best available info we have about the actual + // version: http://en.wikipedia.org/wiki/Xcode#Toolchain_Versions +# if __apple_build_version__ >= 14030022 // Xcode 14.3 +# define Q_CC_CLANG 1500 +# elif __apple_build_version__ >= 14000029 // Xcode 14.0 +# define Q_CC_CLANG 1400 +# elif __apple_build_version__ >= 13160021 // Xcode 13.3 +# define Q_CC_CLANG 1300 +# elif __apple_build_version__ >= 13000029 // Xcode 13.0 +# define Q_CC_CLANG 1200 +# elif __apple_build_version__ >= 12050022 // Xcode 12.5 +# define Q_CC_CLANG 1110 +# elif __apple_build_version__ >= 12000032 // Xcode 12.0 +# define Q_CC_CLANG 1000 +# elif __apple_build_version__ >= 11030032 // Xcode 11.4 +# define Q_CC_CLANG 900 +# elif __apple_build_version__ >= 11000033 // Xcode 11.0 +# define Q_CC_CLANG 800 +# else +# error "Unsupported Apple Clang version" +# endif +# else + // Non-Apple Clang, so we trust the versions reported +# define Q_CC_CLANG ((__clang_major__ * 100) + __clang_minor__) +# endif +# define Q_CC_CLANG_ONLY Q_CC_CLANG +# if __has_builtin(__builtin_assume) +# define Q_ASSUME_IMPL(expr) __builtin_assume(expr) +# else +# define Q_ASSUME_IMPL(expr) if (expr){} else __builtin_unreachable() +# endif +# define Q_UNREACHABLE_IMPL() __builtin_unreachable() +# if !defined(__has_extension) +# /* Compatibility with older Clang versions */ +# define __has_extension __has_feature +# endif +# if defined(__APPLE__) + /* Apple/clang specific features */ +# define Q_DECL_CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) +# ifdef __OBJC__ +# define Q_DECL_NS_RETURNS_AUTORELEASED __attribute__((ns_returns_autoreleased)) +# endif +# endif +# ifdef __EMSCRIPTEN__ +# define Q_CC_EMSCRIPTEN +# endif +# else +/* Plain GCC */ +# define Q_CC_GNU_ONLY Q_CC_GNU +# if Q_CC_GNU >= 405 +# define Q_ASSUME_IMPL(expr) if (expr){} else __builtin_unreachable() +# define Q_UNREACHABLE_IMPL() __builtin_unreachable() +# define Q_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text))) +# endif +# endif + +# ifdef Q_OS_WIN +# define Q_DECL_EXPORT __declspec(dllexport) +# define Q_DECL_IMPORT __declspec(dllimport) +# else +# define Q_DECL_EXPORT_OVERRIDABLE __attribute__((visibility("default"), weak)) +# ifdef QT_USE_PROTECTED_VISIBILITY +# define Q_DECL_EXPORT __attribute__((visibility("protected"))) +# else +# define Q_DECL_EXPORT __attribute__((visibility("default"))) +# endif +# define Q_DECL_IMPORT __attribute__((visibility("default"))) +# define Q_DECL_HIDDEN __attribute__((visibility("hidden"))) +# endif + +# define Q_FUNC_INFO __PRETTY_FUNCTION__ +# define Q_TYPEOF(expr) __typeof__(expr) +# define Q_DECL_DEPRECATED __attribute__ ((__deprecated__)) +# define Q_DECL_UNUSED __attribute__((__unused__)) +# define Q_LIKELY(expr) __builtin_expect(!!(expr), true) +# define Q_UNLIKELY(expr) __builtin_expect(!!(expr), false) +# define Q_NORETURN __attribute__((__noreturn__)) +# define Q_REQUIRED_RESULT __attribute__ ((__warn_unused_result__)) +# define Q_DECL_PURE_FUNCTION __attribute__((pure)) +# define Q_DECL_CONST_FUNCTION __attribute__((const)) +# define Q_DECL_COLD_FUNCTION __attribute__((cold)) +# if !defined(QT_MOC_CPP) +# define Q_PACKED __attribute__ ((__packed__)) +# ifndef __ARM_EABI__ +# define QT_NO_ARM_EABI +# endif +# endif +# if Q_CC_GNU >= 403 && !defined(Q_CC_CLANG) +# define Q_ALLOC_SIZE(x) __attribute__((alloc_size(x))) +# endif + +/* IBM compiler versions are a bit messy. There are actually two products: + the C product, and the C++ product. The C++ compiler is always packaged + with the latest version of the C compiler. Version numbers do not always + match. This little table (I'm not sure it's accurate) should be helpful: + + C++ product C product + + C Set 3.1 C Compiler 3.0 + ... ... + C++ Compiler 3.6.6 C Compiler 4.3 + ... ... + Visual Age C++ 4.0 ... + ... ... + Visual Age C++ 5.0 C Compiler 5.0 + ... ... + Visual Age C++ 6.0 C Compiler 6.0 + + Now: + __xlC__ is the version of the C compiler in hexadecimal notation + is only an approximation of the C++ compiler version + __IBMCPP__ is the version of the C++ compiler in decimal notation + but it is not defined on older compilers like C Set 3.1 */ +#elif defined(__xlC__) +# define Q_CC_XLC +# if __xlC__ < 0x400 +# error "Compiler not supported" +# elif __xlC__ >= 0x0600 +# define Q_TYPEOF(expr) __typeof__(expr) +# define Q_PACKED __attribute__((__packed__)) +# endif + +/* Older versions of DEC C++ do not define __EDG__ or __EDG - observed + on DEC C++ V5.5-004. New versions do define __EDG__ - observed on + Compaq C++ V6.3-002. + This compiler is different enough from other EDG compilers to handle + it separately anyway. */ +#elif defined(__DECCXX) || defined(__DECC) +# define Q_CC_DEC +/* Compaq C++ V6 compilers are EDG-based but I'm not sure about older + DEC C++ V5 compilers. */ +# if defined(__EDG__) +# define Q_CC_EDG +# endif +/* Compaq has disabled EDG's _BOOL macro and uses _BOOL_EXISTS instead + - observed on Compaq C++ V6.3-002. + In any case versions prior to Compaq C++ V6.0-005 do not have bool. */ +# if !defined(_BOOL_EXISTS) +# error "Compiler not supported" +# endif +/* Spurious (?) error messages observed on Compaq C++ V6.5-014. */ +/* Apply to all versions prior to Compaq C++ V6.0-000 - observed on + DEC C++ V5.5-004. */ +# if __DECCXX_VER < 60060000 +# define Q_BROKEN_TEMPLATE_SPECIALIZATION +# endif +/* avoid undefined symbol problems with out-of-line template members */ +# define Q_OUTOFLINE_TEMPLATE inline + +/* The Portland Group C++ compiler is based on EDG and does define __EDG__ + but the C compiler does not */ +#elif defined(__PGI) +# define Q_CC_PGI +# if defined(__EDG__) +# define Q_CC_EDG +# endif + +/* Compilers with EDG front end are similar. To detect them we test: + __EDG documented by SGI, observed on MIPSpro 7.3.1.1 and KAI C++ 4.0b + __EDG__ documented in EDG online docs, observed on Compaq C++ V6.3-002 + and PGI C++ 5.2-4 */ +#elif !defined(Q_OS_HPUX) && (defined(__EDG) || defined(__EDG__)) +# define Q_CC_EDG +/* From the EDG documentation (does not seem to apply to Compaq C++ or GHS C): + _BOOL + Defined in C++ mode when bool is a keyword. The name of this + predefined macro is specified by a configuration flag. _BOOL + is the default. + __BOOL_DEFINED + Defined in Microsoft C++ mode when bool is a keyword. */ +# if !defined(_BOOL) && !defined(__BOOL_DEFINED) && !defined(__ghs) +# error "Compiler not supported" +# endif + +/* The Comeau compiler is based on EDG and does define __EDG__ */ +# if defined(__COMO__) +# define Q_CC_COMEAU + +/* The `using' keyword was introduced to avoid KAI C++ warnings + but it's now causing KAI C++ errors instead. The standard is + unclear about the use of this keyword, and in practice every + compiler is using its own set of rules. Forget it. */ +# elif defined(__KCC) +# define Q_CC_KAI + +/* Uses CFront, make sure to read the manual how to tweak templates. */ +# elif defined(__ghs) +# define Q_CC_GHS +# define Q_DECL_DEPRECATED __attribute__ ((__deprecated__)) +# define Q_PACKED __attribute__ ((__packed__)) +# define Q_FUNC_INFO __PRETTY_FUNCTION__ +# define Q_TYPEOF(expr) __typeof__(expr) +# define Q_UNREACHABLE_IMPL() +# if defined(__cplusplus) +# define Q_COMPILER_AUTO_TYPE +# define Q_COMPILER_STATIC_ASSERT +# define Q_COMPILER_RANGE_FOR +# if __GHS_VERSION_NUMBER >= 201505 +# define Q_COMPILER_ALIGNAS +# define Q_COMPILER_ALIGNOF +# define Q_COMPILER_ATOMICS +# define Q_COMPILER_ATTRIBUTES +# define Q_COMPILER_AUTO_FUNCTION +# define Q_COMPILER_CLASS_ENUM +# define Q_COMPILER_DECLTYPE +# define Q_COMPILER_DEFAULT_MEMBERS +# define Q_COMPILER_DELETE_MEMBERS +# define Q_COMPILER_DELEGATING_CONSTRUCTORS +# define Q_COMPILER_EXPLICIT_CONVERSIONS +# define Q_COMPILER_EXPLICIT_OVERRIDES +# define Q_COMPILER_EXTERN_TEMPLATES +# define Q_COMPILER_INHERITING_CONSTRUCTORS +# define Q_COMPILER_INITIALIZER_LISTS +# define Q_COMPILER_LAMBDA +# define Q_COMPILER_NONSTATIC_MEMBER_INIT +# define Q_COMPILER_NOEXCEPT +# define Q_COMPILER_NULLPTR +# define Q_COMPILER_RANGE_FOR +# define Q_COMPILER_RAW_STRINGS +# define Q_COMPILER_REF_QUALIFIERS +# define Q_COMPILER_RVALUE_REFS +# define Q_COMPILER_STATIC_ASSERT +# define Q_COMPILER_TEMPLATE_ALIAS +# define Q_COMPILER_THREAD_LOCAL +# define Q_COMPILER_UDL +# define Q_COMPILER_UNICODE_STRINGS +# define Q_COMPILER_UNIFORM_INIT +# define Q_COMPILER_UNRESTRICTED_UNIONS +# define Q_COMPILER_VARIADIC_MACROS +# define Q_COMPILER_VARIADIC_TEMPLATES +# endif +# endif //__cplusplus + +# elif defined(__DCC__) +# define Q_CC_DIAB +# if !defined(__bool) +# error "Compiler not supported" +# endif + +/* The UnixWare 7 UDK compiler is based on EDG and does define __EDG__ */ +# elif defined(__USLC__) && defined(__SCO_VERSION__) +# define Q_CC_USLC +/* The latest UDK 7.1.1b does not need this, but previous versions do */ +# if !defined(__SCO_VERSION__) || (__SCO_VERSION__ < 302200010) +# define Q_OUTOFLINE_TEMPLATE inline +# endif + +/* Never tested! */ +# elif defined(CENTERLINE_CLPP) || defined(OBJECTCENTER) +# define Q_CC_OC + +/* CDS++ defines __EDG__ although this is not documented in the Reliant + documentation. It also follows conventions like _BOOL and this documented */ +# elif defined(sinix) +# define Q_CC_CDS +# endif + +/* VxWorks' DIAB toolchain has an additional EDG type C++ compiler + (see __DCC__ above). This one is for C mode files (__EDG is not defined) */ +#elif defined(_DIAB_TOOL) +# define Q_CC_DIAB +# define Q_FUNC_INFO __PRETTY_FUNCTION__ + +/* Never tested! */ +#elif defined(__HIGHC__) +# define Q_CC_HIGHC + +#elif defined(__SUNPRO_CC) || defined(__SUNPRO_C) +# define Q_CC_SUN +# define Q_COMPILER_MANGLES_RETURN_TYPE +/* 5.0 compiler or better + 'bool' is enabled by default but can be disabled using -features=nobool + in which case _BOOL is not defined + this is the default in 4.2 compatibility mode triggered by -compat=4 */ +# if __SUNPRO_CC >= 0x500 +# define QT_NO_TEMPLATE_TEMPLATE_PARAMETERS + /* see http://developers.sun.com/sunstudio/support/Ccompare.html */ +# if __SUNPRO_CC >= 0x590 +# define Q_TYPEOF(expr) __typeof__(expr) +# endif +# if __SUNPRO_CC >= 0x550 +# define Q_DECL_EXPORT __global +# endif +# if !defined(_BOOL) +# error "Compiler not supported" +# endif +/* 4.2 compiler or older */ +# else +# error "Compiler not supported" +# endif + +/* CDS++ does not seem to define __EDG__ or __EDG according to Reliant + documentation but nevertheless uses EDG conventions like _BOOL */ +#elif defined(sinix) +# define Q_CC_EDG +# define Q_CC_CDS +# if !defined(_BOOL) +# error "Compiler not supported" +# endif +# define Q_BROKEN_TEMPLATE_SPECIALIZATION + +#else +# error "Qt has not been tested with this compiler - see http://www.qt-project.org/" +#endif + +/* + * SG10's SD-6 feature detection and some useful extensions from Clang and GCC + * https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations + * http://clang.llvm.org/docs/LanguageExtensions.html#feature-checking-macros + * Not using wrapper macros, per http://eel.is/c++draft/cpp.cond#7.sentence-2 + */ +#ifndef __has_builtin +# define __has_builtin(x) 0 +#endif +#ifndef __has_feature +# define __has_feature(x) 0 +#endif +#ifndef __has_attribute +# define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute +# define __has_cpp_attribute(x) 0 +#endif +#ifndef __has_include +# define __has_include(x) 0 +#endif +#ifndef __has_include_next +# define __has_include_next(x) 0 +#endif + +/* + detecting ASAN can be helpful to disable slow tests + clang uses feature, gcc defines __SANITIZE_ADDRESS__ + unconditionally check both in case other compilers mirror + either of those options + */ +#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) +# define QT_ASAN_ENABLED +#endif + +#ifdef __cplusplus +# if __has_include() /* remove this check once Integrity, QNX have caught up */ +# include +# endif +#endif + +/* + * C++11 support + * + * Paper Macro SD-6 macro + * N2341 Q_COMPILER_ALIGNAS + * N2341 Q_COMPILER_ALIGNOF + * N2427 Q_COMPILER_ATOMICS + * N2761 Q_COMPILER_ATTRIBUTES __cpp_attributes = 200809 + * N2541 Q_COMPILER_AUTO_FUNCTION + * N1984 N2546 Q_COMPILER_AUTO_TYPE + * N2437 Q_COMPILER_CLASS_ENUM + * N2235 Q_COMPILER_CONSTEXPR __cpp_constexpr = 200704 + * N2343 N3276 Q_COMPILER_DECLTYPE __cpp_decltype = 200707 + * N2346 Q_COMPILER_DEFAULT_MEMBERS + * N2346 Q_COMPILER_DELETE_MEMBERS + * N1986 Q_COMPILER_DELEGATING_CONSTRUCTORS + * N2437 Q_COMPILER_EXPLICIT_CONVERSIONS + * N3206 N3272 Q_COMPILER_EXPLICIT_OVERRIDES + * N1987 Q_COMPILER_EXTERN_TEMPLATES + * N2540 Q_COMPILER_INHERITING_CONSTRUCTORS + * N2672 Q_COMPILER_INITIALIZER_LISTS + * N2658 N2927 Q_COMPILER_LAMBDA __cpp_lambdas = 200907 + * N2756 Q_COMPILER_NONSTATIC_MEMBER_INIT + * N2855 N3050 Q_COMPILER_NOEXCEPT + * N2431 Q_COMPILER_NULLPTR + * N2930 Q_COMPILER_RANGE_FOR + * N2442 Q_COMPILER_RAW_STRINGS __cpp_raw_strings = 200710 + * N2439 Q_COMPILER_REF_QUALIFIERS + * N2118 N2844 N3053 Q_COMPILER_RVALUE_REFS __cpp_rvalue_references = 200610 + * N1720 Q_COMPILER_STATIC_ASSERT __cpp_static_assert = 200410 + * N2258 Q_COMPILER_TEMPLATE_ALIAS + * N2659 Q_COMPILER_THREAD_LOCAL + * N2660 Q_COMPILER_THREADSAFE_STATICS + * N2765 Q_COMPILER_UDL __cpp_user_defined_literals = 200809 + * N2442 Q_COMPILER_UNICODE_STRINGS __cpp_unicode_literals = 200710 + * N2640 Q_COMPILER_UNIFORM_INIT + * N2544 Q_COMPILER_UNRESTRICTED_UNIONS + * N1653 Q_COMPILER_VARIADIC_MACROS + * N2242 N2555 Q_COMPILER_VARIADIC_TEMPLATES __cpp_variadic_templates = 200704 + * + * + * For the C++ standards C++14 and C++17, we use only the SD-6 macro. + * + * For any future version of the C++ standard, we use only the C++20 feature test macro. + * For library features, we assume is present (this header includes it). + * + * For a full listing of feature test macros, see + * https://en.cppreference.com/w/cpp/feature_test + * + * C++ extensions: + * Q_COMPILER_RESTRICTED_VLA variable-length arrays, prior to __cpp_runtime_arrays + */ + +/* + * Now that we require C++17, we unconditionally expect threadsafe statics mandated since C++11 + */ +#define Q_COMPILER_THREADSAFE_STATICS + +#if defined(Q_CC_CLANG) +/* General C++ features */ +# define Q_COMPILER_RESTRICTED_VLA +# if __has_feature(attribute_deprecated_with_message) +# define Q_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text))) +# endif + +// Clang supports binary literals in C, C++98 and C++11 modes +// It's been supported "since the dawn of time itself" (cf. commit 179883) +# if __has_extension(cxx_binary_literals) +# define Q_COMPILER_BINARY_LITERALS +# endif + +// Variadic macros are supported for gnu++98, c++11, c99 ... since 2.9 +# if Q_CC_CLANG >= 209 +# if !defined(__STRICT_ANSI__) || defined(__GXX_EXPERIMENTAL_CXX0X__) \ + || (defined(__cplusplus) && (__cplusplus >= 201103L)) \ + || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) +# define Q_COMPILER_VARIADIC_MACROS +# endif +# endif + +/* C++11 features, see http://clang.llvm.org/cxx_status.html */ +# if (defined(__cplusplus) && __cplusplus >= 201103L) \ + || defined(__GXX_EXPERIMENTAL_CXX0X__) + /* Detect C++ features using __has_feature(), see http://clang.llvm.org/docs/LanguageExtensions.html#cxx11 */ +# if __has_feature(cxx_alignas) +# define Q_COMPILER_ALIGNAS +# define Q_COMPILER_ALIGNOF +# endif +# if __has_feature(cxx_atomic) && __has_include() +# define Q_COMPILER_ATOMICS +# endif +# if __has_feature(cxx_attributes) +# define Q_COMPILER_ATTRIBUTES +# endif +# if __has_feature(cxx_auto_type) +# define Q_COMPILER_AUTO_FUNCTION +# define Q_COMPILER_AUTO_TYPE +# endif +# if __has_feature(cxx_strong_enums) +# define Q_COMPILER_CLASS_ENUM +# endif +# if __has_feature(cxx_constexpr) && Q_CC_CLANG > 302 /* CLANG 3.2 has bad/partial support */ +# define Q_COMPILER_CONSTEXPR +# endif +# if __has_feature(cxx_decltype) /* && __has_feature(cxx_decltype_incomplete_return_types) */ +# define Q_COMPILER_DECLTYPE +# endif +# if __has_feature(cxx_defaulted_functions) +# define Q_COMPILER_DEFAULT_MEMBERS +# endif +# if __has_feature(cxx_deleted_functions) +# define Q_COMPILER_DELETE_MEMBERS +# endif +# if __has_feature(cxx_delegating_constructors) +# define Q_COMPILER_DELEGATING_CONSTRUCTORS +# endif +# if __has_feature(cxx_explicit_conversions) +# define Q_COMPILER_EXPLICIT_CONVERSIONS +# endif +# if __has_feature(cxx_override_control) +# define Q_COMPILER_EXPLICIT_OVERRIDES +# endif +# if __has_feature(cxx_inheriting_constructors) +# define Q_COMPILER_INHERITING_CONSTRUCTORS +# endif +# if __has_feature(cxx_generalized_initializers) +# define Q_COMPILER_INITIALIZER_LISTS +# define Q_COMPILER_UNIFORM_INIT /* both covered by this feature macro, according to docs */ +# endif +# if __has_feature(cxx_lambdas) +# define Q_COMPILER_LAMBDA +# endif +# if __has_feature(cxx_noexcept) +# define Q_COMPILER_NOEXCEPT +# endif +# if __has_feature(cxx_nonstatic_member_init) +# define Q_COMPILER_NONSTATIC_MEMBER_INIT +# endif +# if __has_feature(cxx_nullptr) +# define Q_COMPILER_NULLPTR +# endif +# if __has_feature(cxx_range_for) +# define Q_COMPILER_RANGE_FOR +# endif +# if __has_feature(cxx_raw_string_literals) +# define Q_COMPILER_RAW_STRINGS +# endif +# if __has_feature(cxx_reference_qualified_functions) +# define Q_COMPILER_REF_QUALIFIERS +# endif +# if __has_feature(cxx_rvalue_references) +# define Q_COMPILER_RVALUE_REFS +# endif +# if __has_feature(cxx_static_assert) +# define Q_COMPILER_STATIC_ASSERT +# endif +# if __has_feature(cxx_alias_templates) +# define Q_COMPILER_TEMPLATE_ALIAS +# endif +# if __has_feature(cxx_thread_local) +# if !defined(__FreeBSD__) /* FreeBSD clang fails on __cxa_thread_atexit */ +# define Q_COMPILER_THREAD_LOCAL +# endif +# endif +# if __has_feature(cxx_user_literals) +# define Q_COMPILER_UDL +# endif +# if __has_feature(cxx_unicode_literals) +# define Q_COMPILER_UNICODE_STRINGS +# endif +# if __has_feature(cxx_unrestricted_unions) +# define Q_COMPILER_UNRESTRICTED_UNIONS +# endif +# if __has_feature(cxx_variadic_templates) +# define Q_COMPILER_VARIADIC_TEMPLATES +# endif + /* Features that have no __has_feature() check */ +# if Q_CC_CLANG >= 209 /* since clang 2.9 */ +# define Q_COMPILER_EXTERN_TEMPLATES +# endif +# endif // (defined(__cplusplus) && __cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X__) + +/* C++1y features, deprecated macros. Do not update this list. */ +# if defined(__cplusplus) && __cplusplus > 201103L +//# if __has_feature(cxx_binary_literals) +//# define Q_COMPILER_BINARY_LITERALS // see above +//# endif +# if __has_feature(cxx_generic_lambda) +# define Q_COMPILER_GENERIC_LAMBDA +# endif +# if __has_feature(cxx_init_capture) +# define Q_COMPILER_LAMBDA_CAPTURES +# endif +# if __has_feature(cxx_relaxed_constexpr) +# define Q_COMPILER_RELAXED_CONSTEXPR_FUNCTIONS +# endif +# if __has_feature(cxx_decltype_auto) && __has_feature(cxx_return_type_deduction) +# define Q_COMPILER_RETURN_TYPE_DEDUCTION +# endif +# if __has_feature(cxx_variable_templates) +# define Q_COMPILER_VARIABLE_TEMPLATES +# endif +# if __has_feature(cxx_runtime_array) +# define Q_COMPILER_VLA +# endif +# endif // if defined(__cplusplus) && __cplusplus > 201103L + +# if defined(__STDC_VERSION__) +# if __has_feature(c_static_assert) +# define Q_COMPILER_STATIC_ASSERT +# endif +# if __has_feature(c_thread_local) && __has_include() +# if !defined(__FreeBSD__) /* FreeBSD clang fails on __cxa_thread_atexit */ +# define Q_COMPILER_THREAD_LOCAL +# endif +# endif +# endif + +# ifndef Q_DECL_UNUSED +# define Q_DECL_UNUSED __attribute__((__unused__)) +# endif +# define Q_DECL_UNUSED_MEMBER Q_DECL_UNUSED +#endif // defined(Q_CC_CLANG) + +#if defined(Q_CC_GNU_ONLY) +# define Q_COMPILER_RESTRICTED_VLA +# if Q_CC_GNU >= 403 +// GCC supports binary literals in C, C++98 and C++11 modes +# define Q_COMPILER_BINARY_LITERALS +# endif +# if !defined(__STRICT_ANSI__) || defined(__GXX_EXPERIMENTAL_CXX0X__) \ + || (defined(__cplusplus) && (__cplusplus >= 201103L)) \ + || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) + // Variadic macros are supported for gnu++98, c++11, C99 ... since forever (gcc 2.97) +# define Q_COMPILER_VARIADIC_MACROS +# endif +# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L +# if Q_CC_GNU >= 403 + /* C++11 features supported in GCC 4.3: */ +# define Q_COMPILER_DECLTYPE +# define Q_COMPILER_RVALUE_REFS +# define Q_COMPILER_STATIC_ASSERT +# endif +# if Q_CC_GNU >= 404 + /* C++11 features supported in GCC 4.4: */ +# define Q_COMPILER_AUTO_FUNCTION +# define Q_COMPILER_AUTO_TYPE +# define Q_COMPILER_EXTERN_TEMPLATES +# define Q_COMPILER_UNIFORM_INIT +# define Q_COMPILER_UNICODE_STRINGS +# define Q_COMPILER_VARIADIC_TEMPLATES +# endif +# if Q_CC_GNU >= 405 + /* C++11 features supported in GCC 4.5: */ +# define Q_COMPILER_EXPLICIT_CONVERSIONS + /* GCC 4.4 implements initializer_list but does not define typedefs required + * by the standard. */ +# define Q_COMPILER_INITIALIZER_LISTS +# define Q_COMPILER_LAMBDA +# define Q_COMPILER_RAW_STRINGS +# define Q_COMPILER_CLASS_ENUM +# endif +# if Q_CC_GNU >= 406 + /* Pre-4.6 compilers implement a non-final snapshot of N2346, hence default and delete + * functions are supported only if they are public. Starting from 4.6, GCC handles + * final version - the access modifier is not relevant. */ +# define Q_COMPILER_DEFAULT_MEMBERS +# define Q_COMPILER_DELETE_MEMBERS + /* C++11 features supported in GCC 4.6: */ +# define Q_COMPILER_NULLPTR +# define Q_COMPILER_UNRESTRICTED_UNIONS +# define Q_COMPILER_RANGE_FOR +# endif +# if Q_CC_GNU >= 407 + /* GCC 4.4 implemented and std::atomic using its old intrinsics. + * However, the implementation is incomplete for most platforms until GCC 4.7: + * instead, std::atomic would use an external lock. Since we need an std::atomic + * that is behavior-compatible with QBasicAtomic, we only enable it here */ +# define Q_COMPILER_ATOMICS + /* GCC 4.6.x has problems dealing with noexcept expressions, + * so turn the feature on for 4.7 and above, only */ +# define Q_COMPILER_NOEXCEPT + /* C++11 features supported in GCC 4.7: */ +# define Q_COMPILER_NONSTATIC_MEMBER_INIT +# define Q_COMPILER_DELEGATING_CONSTRUCTORS +# define Q_COMPILER_EXPLICIT_OVERRIDES +# define Q_COMPILER_TEMPLATE_ALIAS +# define Q_COMPILER_UDL +# endif +# if Q_CC_GNU >= 408 +# define Q_COMPILER_ATTRIBUTES +# define Q_COMPILER_ALIGNAS +# define Q_COMPILER_ALIGNOF +# define Q_COMPILER_INHERITING_CONSTRUCTORS +# define Q_COMPILER_THREAD_LOCAL +# if Q_CC_GNU > 408 || __GNUC_PATCHLEVEL__ >= 1 +# define Q_COMPILER_REF_QUALIFIERS +# endif +# endif +# if Q_CC_GNU >= 500 + /* GCC 4.6 introduces constexpr, but it's bugged (at least) in the whole + * 4.x series, see e.g. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57694 */ +# define Q_COMPILER_CONSTEXPR +# endif +# endif +# if __cplusplus > 201103L +# if Q_CC_GNU >= 409 + /* C++1y features in GCC 4.9 - deprecated, do not update this list */ +//# define Q_COMPILER_BINARY_LITERALS // already supported since GCC 4.3 as an extension +# define Q_COMPILER_LAMBDA_CAPTURES +# define Q_COMPILER_RETURN_TYPE_DEDUCTION +# endif +# endif +# if defined(__STDC_VERSION__) && __STDC_VERSION__ > 199901L +# if Q_CC_GNU >= 407 + /* C11 features supported in GCC 4.7: */ +# define Q_COMPILER_STATIC_ASSERT +# endif +# if Q_CC_GNU >= 409 && defined(__has_include) + /* C11 features supported in GCC 4.9: */ +# if __has_include() +# define Q_COMPILER_THREAD_LOCAL +# endif +# endif +# endif +#endif + +#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG) +# if defined(__cplusplus) + /* C++11 features supported in VC8 = VC2005: */ +# define Q_COMPILER_VARIADIC_MACROS + + /* 2005 supports the override and final contextual keywords, in + the same positions as the C++11 variants, but 'final' is + called 'sealed' instead: + http://msdn.microsoft.com/en-us/library/0w2w91tf%28v=vs.80%29.aspx + The behavior is slightly different in C++/CLI, which requires the + "virtual" keyword to be present too, so don't define for that. + So don't define Q_COMPILER_EXPLICIT_OVERRIDES (since it's not + the same as the C++11 version), but define the Q_DECL_* flags + accordingly. */ + /* C++11 features supported in VC10 = VC2010: */ +# define Q_COMPILER_AUTO_FUNCTION +# define Q_COMPILER_AUTO_TYPE +# define Q_COMPILER_DECLTYPE +# define Q_COMPILER_EXTERN_TEMPLATES +# define Q_COMPILER_LAMBDA +# define Q_COMPILER_NULLPTR +# define Q_COMPILER_RVALUE_REFS +# define Q_COMPILER_STATIC_ASSERT + /* C++11 features supported in VC11 = VC2012: */ +# define Q_COMPILER_EXPLICIT_OVERRIDES /* ...and use std C++11 now */ +# define Q_COMPILER_CLASS_ENUM +# define Q_COMPILER_ATOMICS + /* C++11 features in VC12 = VC2013 */ +# define Q_COMPILER_DELETE_MEMBERS +# define Q_COMPILER_DELEGATING_CONSTRUCTORS +# define Q_COMPILER_EXPLICIT_CONVERSIONS +# define Q_COMPILER_NONSTATIC_MEMBER_INIT +# define Q_COMPILER_RAW_STRINGS +# define Q_COMPILER_TEMPLATE_ALIAS +# define Q_COMPILER_VARIADIC_TEMPLATES +# define Q_COMPILER_INITIALIZER_LISTS // VC 12 SP 2 RC + /* C++11 features in VC14 = VC2015 */ +# define Q_COMPILER_DEFAULT_MEMBERS +# define Q_COMPILER_ALIGNAS +# define Q_COMPILER_ALIGNOF +# define Q_COMPILER_INHERITING_CONSTRUCTORS +# define Q_COMPILER_NOEXCEPT +# define Q_COMPILER_RANGE_FOR +# define Q_COMPILER_REF_QUALIFIERS +# define Q_COMPILER_THREAD_LOCAL +# define Q_COMPILER_UDL +# define Q_COMPILER_UNICODE_STRINGS +# define Q_COMPILER_UNRESTRICTED_UNIONS +# if _MSC_FULL_VER >= 190023419 +# define Q_COMPILER_ATTRIBUTES +// Almost working, see https://connect.microsoft.com/VisualStudio/feedback/details/2011648 +//# define Q_COMPILER_CONSTEXPR +# define Q_COMPILER_UNIFORM_INIT +# endif +# if _MSC_VER >= 1910 +# define Q_COMPILER_CONSTEXPR +# endif +// MSVC versions before 19.36 have a bug in C++20 comparison implementation. +// This leads to ambiguities when resolving comparison operator overloads in +// certain scenarios (the buggy MSVC versions were checked using our CI and +// compiler explorer). +# if _MSC_VER < 1936 +# define Q_COMPILER_LACKS_THREE_WAY_COMPARE_SYMMETRY +# endif +// QTBUG-124376: MSVC is slow at compiling qstrnlen() +# define Q_COMPILER_SLOW_QSTRNLEN_COMPILATION +# endif /* __cplusplus */ +#endif // defined(Q_CC_MSVC) && !defined(Q_CC_CLANG) + +#ifdef Q_COMPILER_UNICODE_STRINGS +# define Q_STDLIB_UNICODE_STRINGS +#elif defined(__cplusplus) +# error "Qt6 requires Unicode string support in both the compiler and the standard library" +#endif + +#ifdef __cplusplus +# include +# if defined(Q_OS_QNX) +// By default, QNX 7.0 uses libc++ (from LLVM) and +// QNX 6.X uses Dinkumware's libcpp. In all versions, +// it is also possible to use GNU libstdc++. + +// For Dinkumware, some features must be disabled +// (mostly because of library problems). +// Dinkumware is assumed when __GLIBCXX__ (GNU libstdc++) +// and _LIBCPP_VERSION (LLVM libc++) are both absent. +# if !defined(__GLIBCXX__) && !defined(_LIBCPP_VERSION) + +// Older versions of libcpp (QNX 650) do not support C++11 features +// _HAS_* macros are set to 1 by toolchains that actually include +// Dinkum C++11 libcpp. + +# if !defined(_HAS_CPP0X) || !_HAS_CPP0X +// Disable C++11 features that depend on library support +# undef Q_COMPILER_INITIALIZER_LISTS +# undef Q_COMPILER_RVALUE_REFS +# undef Q_COMPILER_REF_QUALIFIERS +# undef Q_COMPILER_NOEXCEPT +// Disable C++11 library features: +# undef Q_STDLIB_UNICODE_STRINGS +# endif // !_HAS_CPP0X +# if !defined(_HAS_NULLPTR_T) || !_HAS_NULLPTR_T +# undef Q_COMPILER_NULLPTR +# endif //!_HAS_NULLPTR_T +# if !defined(_HAS_CONSTEXPR) || !_HAS_CONSTEXPR +// The libcpp is missing constexpr keywords on important functions like std::numeric_limits<>::min() +// Disable constexpr support on QNX even if the compiler supports it +# undef Q_COMPILER_CONSTEXPR +# endif // !_HAS_CONSTEXPR +# endif // !__GLIBCXX__ && !_LIBCPP_VERSION +# endif // Q_OS_QNX +# if defined(Q_CC_CLANG) && defined(Q_OS_DARWIN) +# if defined(__GNUC_LIBSTD__) && ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402) +// Apple has not updated libstdc++ since 2007, which means it does not have +// or std::move. Let's disable these features +# undef Q_COMPILER_INITIALIZER_LISTS +# undef Q_COMPILER_RVALUE_REFS +# undef Q_COMPILER_REF_QUALIFIERS +// Also disable , since it's clearly not there +# undef Q_COMPILER_ATOMICS +# endif +# if defined(__cpp_lib_memory_resource) \ + && ((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 140000) \ + || (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 170000)) +# undef __cpp_lib_memory_resource // Only supported on macOS 14 and iOS 17 +# endif +# endif // defined(Q_CC_CLANG) && defined(Q_OS_DARWIN) +#endif + +// Don't break code that is already using Q_COMPILER_DEFAULT_DELETE_MEMBERS +#if defined(Q_COMPILER_DEFAULT_MEMBERS) && defined(Q_COMPILER_DELETE_MEMBERS) +# define Q_COMPILER_DEFAULT_DELETE_MEMBERS +#endif + +/* + * Compatibility macros for C++11/14 keywords and expressions. + * Don't use in new code and port away whenever you have a chance. + */ +#define Q_ALIGNOF(x) alignof(x) +#define Q_DECL_ALIGN(n) alignas(n) +#define Q_DECL_NOTHROW Q_DECL_NOEXCEPT +#ifdef __cplusplus +# define Q_CONSTEXPR constexpr +# define Q_DECL_CONSTEXPR constexpr +# define Q_DECL_EQ_DEFAULT = default +# define Q_DECL_EQ_DELETE = delete +# define Q_DECL_FINAL final +# define Q_DECL_NOEXCEPT noexcept +# define Q_DECL_NOEXCEPT_EXPR(x) noexcept(x) +# define Q_DECL_OVERRIDE override +# define Q_DECL_RELAXED_CONSTEXPR constexpr +# define Q_NULLPTR nullptr +# define Q_RELAXED_CONSTEXPR constexpr +#else +# define Q_CONSTEXPR const +# define Q_DECL_CONSTEXPR +# define Q_DECL_RELAXED_CONSTEXPR +# define Q_NULLPTR NULL +# define Q_RELAXED_CONSTEXPR const +# ifdef Q_CC_GNU +# define Q_DECL_NOEXCEPT __attribute__((__nothrow__)) +# else +# define Q_DECL_NOEXCEPT +# endif +#endif + +#if __has_cpp_attribute(nodiscard) && (!defined(Q_CC_CLANG) || __cplusplus > 201402L) // P0188R1 +// Can't use [[nodiscard]] with Clang and C++11/14, see https://bugs.llvm.org/show_bug.cgi?id=33518 +# undef Q_REQUIRED_RESULT +# define Q_REQUIRED_RESULT [[nodiscard]] +#endif + +#if __has_cpp_attribute(nodiscard) >= 201907L /* used for both P1771 and P1301... */ +// [[nodiscard]] constructor (P1771) +# ifndef Q_NODISCARD_CTOR +# define Q_NODISCARD_CTOR [[nodiscard]] +# endif +// [[nodiscard("reason")]] (P1301) +# ifndef Q_NODISCARD_X +# define Q_NODISCARD_X(message) [[nodiscard(message)]] +# endif +# ifndef Q_NODISCARD_CTOR_X +# define Q_NODISCARD_CTOR_X(message) [[nodiscard(message)]] +# endif +#endif + +#if __has_cpp_attribute(maybe_unused) +# undef Q_DECL_UNUSED +# define Q_DECL_UNUSED [[maybe_unused]] +#endif + +#if __has_cpp_attribute(noreturn) +# undef Q_NORETURN +# define Q_NORETURN [[noreturn]] +#endif + +#if __has_cpp_attribute(deprecated) +# ifdef Q_DECL_DEPRECATED +# undef Q_DECL_DEPRECATED +# endif +# ifdef Q_DECL_DEPRECATED_X +# undef Q_DECL_DEPRECATED_X +# endif +# define Q_DECL_DEPRECATED [[deprecated]] +# define Q_DECL_DEPRECATED_X(x) [[deprecated(x)]] +#endif + +#define Q_DECL_ENUMERATOR_DEPRECATED Q_DECL_DEPRECATED +#define Q_DECL_ENUMERATOR_DEPRECATED_X(x) Q_DECL_DEPRECATED_X(x) + +/* + * Fallback macros to certain compiler features + */ + +#ifndef Q_NORETURN +# define Q_NORETURN +#endif +#ifndef Q_LIKELY +# define Q_LIKELY(x) (x) +#endif +#ifndef Q_UNLIKELY +# define Q_UNLIKELY(x) (x) +#endif +#ifndef Q_ASSUME_IMPL +# define Q_ASSUME_IMPL(expr) qt_noop() +#endif +#ifndef Q_UNREACHABLE_IMPL +# define Q_UNREACHABLE_IMPL() qt_noop() +#endif +#ifndef Q_ALLOC_SIZE +# define Q_ALLOC_SIZE(x) +#endif +#ifndef Q_REQUIRED_RESULT +# define Q_REQUIRED_RESULT +#endif +#ifndef Q_NODISCARD_X +# define Q_NODISCARD_X(message) Q_REQUIRED_RESULT +#endif +#ifndef Q_NODISCARD_CTOR +# define Q_NODISCARD_CTOR +#endif +#ifndef Q_NODISCARD_CTOR_X +# define Q_NODISCARD_CTOR_X(message) Q_NODISCARD_CTOR +#endif +#ifndef Q_DECL_DEPRECATED +# define Q_DECL_DEPRECATED +#endif +#ifndef Q_DECL_VARIABLE_DEPRECATED +# define Q_DECL_VARIABLE_DEPRECATED Q_DECL_DEPRECATED +#endif +#ifndef Q_DECL_DEPRECATED_X +# define Q_DECL_DEPRECATED_X(text) Q_DECL_DEPRECATED +#endif +#ifndef Q_DECL_EXPORT +# define Q_DECL_EXPORT +#endif +#ifndef Q_DECL_EXPORT_OVERRIDABLE +# define Q_DECL_EXPORT_OVERRIDABLE Q_DECL_EXPORT +#endif +#ifndef Q_DECL_IMPORT +# define Q_DECL_IMPORT +#endif +#ifndef Q_DECL_HIDDEN +# define Q_DECL_HIDDEN +#endif +#ifndef Q_DECL_UNUSED +# define Q_DECL_UNUSED +#endif +#ifndef Q_DECL_UNUSED_MEMBER +# define Q_DECL_UNUSED_MEMBER +#endif +#ifndef Q_FUNC_INFO +# if defined(Q_OS_SOLARIS) || defined(Q_CC_XLC) +# define Q_FUNC_INFO __FILE__ "(line number unavailable)" +# else +# define Q_FUNC_INFO __FILE__ ":" QT_STRINGIFY(__LINE__) +# endif +#endif +#ifndef Q_DECL_CF_RETURNS_RETAINED +# define Q_DECL_CF_RETURNS_RETAINED +#endif +#ifndef Q_DECL_NS_RETURNS_AUTORELEASED +# define Q_DECL_NS_RETURNS_AUTORELEASED +#endif +#ifndef Q_DECL_PURE_FUNCTION +# define Q_DECL_PURE_FUNCTION +#endif +#ifndef Q_DECL_CONST_FUNCTION +# define Q_DECL_CONST_FUNCTION Q_DECL_PURE_FUNCTION +#endif +#ifndef Q_DECL_COLD_FUNCTION +# define Q_DECL_COLD_FUNCTION +#endif +#ifndef QT_MAKE_UNCHECKED_ARRAY_ITERATOR +# define QT_MAKE_UNCHECKED_ARRAY_ITERATOR(x) (x) +#endif +#ifndef QT_MAKE_CHECKED_ARRAY_ITERATOR +# define QT_MAKE_CHECKED_ARRAY_ITERATOR(x, N) (x) +#endif + +/* + * "Weak overloads" - makes an otherwise confliciting overload weaker + * (by making it a template) + */ +#ifndef Q_QDOC +# define Q_WEAK_OVERLOAD template +#else +# define Q_WEAK_OVERLOAD +#endif + +/* + * If one wants to add functions that use post-C++17 APIs, one needs to: + * + * 1) make them fully inline; and + * 2) guard them using the necessary feature-testing macros. + * + * This decouples the C++ version used to build Qt with the one used by + * end-user applications; Qt and the application can either choose any C++ + * version. + * + * A problem arises on MSVC for member functions of exported classes. Client + * code that tries to use such a function will see it as exported, and simply + * try to consume the function's *symbol*. However, if Qt has been built in + * C++17, it won't have such a symbol, and linking will fail. + * + * The workaround: declare such functions as function templates. + * (Obviously a function template does not need this marker.) +*/ +#ifndef Q_QDOC +# define QT_POST_CXX17_API_IN_EXPORTED_CLASS template +#else +# define QT_POST_CXX17_API_IN_EXPORTED_CLASS +#endif + +/* + * Warning/diagnostic handling + */ + +#define QT_DO_PRAGMA(text) _Pragma(#text) +#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG) +# undef QT_DO_PRAGMA /* not needed */ +# define QT_WARNING_PUSH __pragma(warning(push)) +# define QT_WARNING_POP __pragma(warning(pop)) +# define QT_WARNING_DISABLE_MSVC(number) __pragma(warning(disable: number)) +# define QT_WARNING_DISABLE_INTEL(number) +# define QT_WARNING_DISABLE_CLANG(text) +# define QT_WARNING_DISABLE_GCC(text) +# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_MSVC(4996) +# define QT_WARNING_DISABLE_FLOAT_COMPARE +# define QT_WARNING_DISABLE_INVALID_OFFSETOF +#elif defined(Q_CC_CLANG) +# define QT_WARNING_PUSH QT_DO_PRAGMA(clang diagnostic push) +# define QT_WARNING_POP QT_DO_PRAGMA(clang diagnostic pop) +# define QT_WARNING_DISABLE_CLANG(text) QT_DO_PRAGMA(clang diagnostic ignored text) +# define QT_WARNING_DISABLE_GCC(text) +# define QT_WARNING_DISABLE_INTEL(number) +# define QT_WARNING_DISABLE_MSVC(number) +# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_CLANG("-Wdeprecated-declarations") +# define QT_WARNING_DISABLE_FLOAT_COMPARE QT_WARNING_DISABLE_CLANG("-Wfloat-equal") +# define QT_WARNING_DISABLE_INVALID_OFFSETOF QT_WARNING_DISABLE_CLANG("-Winvalid-offsetof") +#elif defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) +# define QT_WARNING_PUSH QT_DO_PRAGMA(GCC diagnostic push) +# define QT_WARNING_POP QT_DO_PRAGMA(GCC diagnostic pop) +# define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text) +# define QT_WARNING_DISABLE_CLANG(text) +# define QT_WARNING_DISABLE_INTEL(number) +# define QT_WARNING_DISABLE_MSVC(number) +# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations") +# define QT_WARNING_DISABLE_FLOAT_COMPARE QT_WARNING_DISABLE_GCC("-Wfloat-equal") +# define QT_WARNING_DISABLE_INVALID_OFFSETOF QT_WARNING_DISABLE_GCC("-Winvalid-offsetof") +#else // All other compilers, GCC < 4.6 and MSVC < 2008 +# define QT_WARNING_DISABLE_GCC(text) +# define QT_WARNING_PUSH +# define QT_WARNING_POP +# define QT_WARNING_DISABLE_INTEL(number) +# define QT_WARNING_DISABLE_MSVC(number) +# define QT_WARNING_DISABLE_CLANG(text) +# define QT_WARNING_DISABLE_GCC(text) +# define QT_WARNING_DISABLE_DEPRECATED +# define QT_WARNING_DISABLE_FLOAT_COMPARE +# define QT_WARNING_DISABLE_INVALID_OFFSETOF +#endif + +#ifndef QT_IGNORE_DEPRECATIONS +#define QT_IGNORE_DEPRECATIONS(statement) \ + QT_WARNING_PUSH \ + QT_WARNING_DISABLE_DEPRECATED \ + statement \ + QT_WARNING_POP +#endif + +// The body must be a statement: +#define Q_CAST_IGNORE_ALIGN(body) QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wcast-align") body QT_WARNING_POP + +// This macro can be used to calculate member offsets for types with a non standard layout. +// It uses the fact that offsetof() is allowed to support those types since C++17 as an optional +// feature. All our compilers do support this, but some issue a warning, so we wrap the offsetof() +// call in a macro that disables the compiler warning. +#define Q_OFFSETOF(Class, member) \ + []() -> size_t { \ + QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF \ + return offsetof(Class, member); \ + QT_WARNING_POP \ + }() + +/* + Proper for-scoping in MIPSpro CC +*/ +#ifndef QT_NO_KEYWORDS +# if defined(Q_CC_MIPS) || (defined(Q_CC_HPACC) && defined(__ia64)) +# define for if (0) {} else for +# endif +#endif + +#ifdef Q_COMPILER_RVALUE_REFS +#define qMove(x) std::move(x) +#else +#define qMove(x) (x) +#endif + +#if defined(__cplusplus) +#if __has_cpp_attribute(clang::fallthrough) +# define Q_FALLTHROUGH() [[clang::fallthrough]] +#elif __has_cpp_attribute(gnu::fallthrough) +# define Q_FALLTHROUGH() [[gnu::fallthrough]] +#elif __has_cpp_attribute(fallthrough) +# define Q_FALLTHROUGH() [[fallthrough]] +#endif +#endif +#ifndef Q_FALLTHROUGH +# ifdef Q_CC_GNU +# define Q_FALLTHROUGH() __attribute__((fallthrough)) +# else +# define Q_FALLTHROUGH() (void)0 +# endif +#endif + + +/* + Sanitize compiler feature availability +*/ +#if !defined(Q_PROCESSOR_X86) +# undef QT_COMPILER_SUPPORTS_SSE2 +# undef QT_COMPILER_SUPPORTS_SSE3 +# undef QT_COMPILER_SUPPORTS_SSSE3 +# undef QT_COMPILER_SUPPORTS_SSE4_1 +# undef QT_COMPILER_SUPPORTS_SSE4_2 +# undef QT_COMPILER_SUPPORTS_AVX +# undef QT_COMPILER_SUPPORTS_AVX2 +# undef QT_COMPILER_SUPPORTS_F16C +#endif +#if !defined(Q_PROCESSOR_ARM) +# undef QT_COMPILER_SUPPORTS_NEON +#endif +#if !defined(Q_PROCESSOR_MIPS) +# undef QT_COMPILER_SUPPORTS_MIPS_DSP +# undef QT_COMPILER_SUPPORTS_MIPS_DSPR2 +#endif + +// Compiler version check +#if defined(__cplusplus) && (__cplusplus < 201703L) +# ifdef Q_CC_MSVC +# error "Qt requires a C++17 compiler, and a suitable value for __cplusplus. On MSVC, you must pass the /Zc:__cplusplus option to the compiler." +# else +# error "Qt requires a C++17 compiler" +# endif +#endif // __cplusplus + +#if defined(__cplusplus) && defined(Q_CC_MSVC) && !defined(Q_CC_CLANG) +# if Q_CC_MSVC < 1927 + // Check below only works with 16.7 or newer +# error "Qt requires at least Visual Studio 2019 version 16.7 (VC++ version 14.27). Please upgrade." +# endif + +// On MSVC we require /permissive- set by user code. Check that we are +// under its rules -- for instance, check that std::nullptr_t->bool is +// not an implicit conversion, as per +// https://docs.microsoft.com/en-us/cpp/overview/cpp-conformance-improvements?view=msvc-160#nullptr_t-is-only-convertible-to-bool-as-a-direct-initialization +static_assert(!std::is_convertible_v, + "On MSVC you must pass the /permissive- option to the compiler."); +#endif + +#if defined(QT_BOOTSTRAPPED) || defined(QT_USE_PROTECTED_VISIBILITY) || !defined(__ELF__) || defined(__PIC__) +// this is fine +#elif defined(QT_REDUCE_RELOCATIONS) +# error "You must build your code with position independent code if Qt was configured with -reduce-relocations. "\ + "Compile your code with -fPIC (and not with -fPIE)." +#endif + +#ifdef Q_PROCESSOR_X86_32 +# if defined(Q_CC_GNU) +# define QT_FASTCALL __attribute__((regparm(3))) +# elif defined(Q_CC_MSVC) +# define QT_FASTCALL __fastcall +# else +# define QT_FASTCALL +# endif +#else +# define QT_FASTCALL +#endif + +// enable gcc warnings for printf-style functions +#if defined(Q_CC_GNU) && !defined(__INSURE__) +# if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG) +# define Q_ATTRIBUTE_FORMAT_PRINTF(A, B) \ + __attribute__((format(gnu_printf, (A), (B)))) +# else +# define Q_ATTRIBUTE_FORMAT_PRINTF(A, B) \ + __attribute__((format(printf, (A), (B)))) +# endif +#else +# define Q_ATTRIBUTE_FORMAT_PRINTF(A, B) +#endif + +#ifdef Q_CC_MSVC +# define Q_NEVER_INLINE __declspec(noinline) +# define Q_ALWAYS_INLINE __forceinline +#elif defined(Q_CC_GNU) +# define Q_NEVER_INLINE __attribute__((noinline)) +# define Q_ALWAYS_INLINE inline __attribute__((always_inline)) +#else +# define Q_NEVER_INLINE +# define Q_ALWAYS_INLINE inline +#endif + +//defines the type for the WNDPROC on windows +//the alignment needs to be forced for sse2 to not crash with mingw +#if defined(Q_OS_WIN) +# if defined(Q_CC_MINGW) && defined(Q_PROCESSOR_X86_32) +# define QT_ENSURE_STACK_ALIGNED_FOR_SSE __attribute__ ((force_align_arg_pointer)) +# else +# define QT_ENSURE_STACK_ALIGNED_FOR_SSE +# endif +# define QT_WIN_CALLBACK CALLBACK QT_ENSURE_STACK_ALIGNED_FOR_SSE +#endif + +#ifdef __cpp_conditional_explicit +#define Q_IMPLICIT explicit(false) +#else +#define Q_IMPLICIT +#endif + +#if defined(__cplusplus) + +#ifdef __cpp_constinit +# if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG) + // https://developercommunity.visualstudio.com/t/C:-constinit-for-an-optional-fails-if-/1406069 +# define Q_CONSTINIT +# else +# define Q_CONSTINIT constinit +# endif +#elif defined(__has_cpp_attribute) && __has_cpp_attribute(clang::require_constant_initialization) +# define Q_CONSTINIT [[clang::require_constant_initialization]] +#elif defined(Q_CC_GNU_ONLY) && Q_CC_GNU >= 1000 +# define Q_CONSTINIT __constinit +#else +# define Q_CONSTINIT +#endif + +#ifndef Q_OUTOFLINE_TEMPLATE +# define Q_OUTOFLINE_TEMPLATE +#endif +#ifndef Q_INLINE_TEMPLATE +# define Q_INLINE_TEMPLATE inline +#endif + +/* + Avoid some particularly useless warnings from some stupid compilers. + To get ALL C++ compiler warnings, define QT_CC_WARNINGS or comment out + the line "#define QT_NO_WARNINGS". See also QTBUG-26877. +*/ +#if !defined(QT_CC_WARNINGS) +# define QT_NO_WARNINGS +#endif +#if defined(QT_NO_WARNINGS) +# if defined(Q_CC_MSVC) +QT_WARNING_DISABLE_MSVC(4251) /* class 'type' needs to have dll-interface to be used by clients of class 'type2' */ +QT_WARNING_DISABLE_MSVC(4244) /* conversion from 'type1' to 'type2', possible loss of data */ +QT_WARNING_DISABLE_MSVC(4275) /* non - DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier' */ +QT_WARNING_DISABLE_MSVC(4514) /* unreferenced inline function has been removed */ +QT_WARNING_DISABLE_MSVC(4800) /* 'type' : forcing value to bool 'true' or 'false' (performance warning) */ +QT_WARNING_DISABLE_MSVC(4097) /* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */ +QT_WARNING_DISABLE_MSVC(4706) /* assignment within conditional expression */ +QT_WARNING_DISABLE_MSVC(4355) /* 'this' : used in base member initializer list */ +QT_WARNING_DISABLE_MSVC(4710) /* function not inlined */ +QT_WARNING_DISABLE_MSVC(4530) /* C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc */ +# elif defined(Q_CC_BOR) +# pragma option -w-inl +# pragma option -w-aus +# pragma warn -inl +# pragma warn -pia +# pragma warn -ccc +# pragma warn -rch +# pragma warn -sig +# endif +#endif + +#if !defined(QT_NO_EXCEPTIONS) +# if !defined(Q_MOC_RUN) +# if defined(Q_CC_GNU) && !defined(__cpp_exceptions) +# define QT_NO_EXCEPTIONS +# endif +# elif defined(QT_BOOTSTRAPPED) +# define QT_NO_EXCEPTIONS +# endif +#endif + +// libstdc++ shipped with gcc < 11 does not have a fix for defect LWG 3346 +#if __cplusplus >= 202002L && (!defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE >= 11) +# define QT_COMPILER_HAS_LWG3346 +#endif + +#if defined(__cplusplus) && __cplusplus >= 202002L // P0846 doesn't have a feature macro :/ +# if !defined(Q_CC_MSVC_ONLY) || Q_CC_MSVC >= 1939 // claims C++20 support but lacks P0846 + // 1939 is known to work + // 1936 is known to fail +# define QT_COMPILER_HAS_P0846 +# endif +#endif + +#ifdef QT_COMPILER_HAS_P0846 +# define QT_ENABLE_P0846_SEMANTICS_FOR(func) +#else + class QT_CLASS_JUST_FOR_P0846_SIMULATION; +# define QT_ENABLE_P0846_SEMANTICS_FOR(func) \ + template \ + void func (QT_CLASS_JUST_FOR_P0846_SIMULATION *); \ + /* end */ +#endif // !P0846 + +#endif // __cplusplus + +#endif // QCOMPILERDETECTION_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qconcatenatetablesproxymodel.h b/qt/6.8.1/msvc2022_64/include/QtCore/qconcatenatetablesproxymodel.h new file mode 100644 index 0000000000000000000000000000000000000000..f28f50c982fe33d569d7c65d58b80d14d746401a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qconcatenatetablesproxymodel.h @@ -0,0 +1,53 @@ +// Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCONCATENATEROWSPROXYMODEL_H +#define QCONCATENATEROWSPROXYMODEL_H + +#include + +QT_REQUIRE_CONFIG(concatenatetablesproxymodel); + +QT_BEGIN_NAMESPACE + +class QConcatenateTablesProxyModelPrivate; + +class Q_CORE_EXPORT QConcatenateTablesProxyModel : public QAbstractItemModel +{ + Q_OBJECT + +public: + explicit QConcatenateTablesProxyModel(QObject *parent = nullptr); + ~QConcatenateTablesProxyModel(); + + QList sourceModels() const; + Q_SCRIPTABLE void addSourceModel(QAbstractItemModel *sourceModel); + Q_SCRIPTABLE void removeSourceModel(QAbstractItemModel *sourceModel); + + QModelIndex mapFromSource(const QModelIndex &sourceIndex) const; + QModelIndex mapToSource(const QModelIndex &proxyIndex) const; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; + QMap itemData(const QModelIndex &proxyIndex) const override; + bool setItemData(const QModelIndex &index, const QMap &roles) override; + Qt::ItemFlags flags(const QModelIndex &index) const override; + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; + QModelIndex parent(const QModelIndex &index) const override; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + int columnCount(const QModelIndex &parent = QModelIndex()) const override; + QStringList mimeTypes() const override; + QMimeData *mimeData(const QModelIndexList &indexes) const override; + bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override; + bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override; + QSize span(const QModelIndex &index) const override; + +private: + Q_DECLARE_PRIVATE(QConcatenateTablesProxyModel) + Q_DISABLE_COPY(QConcatenateTablesProxyModel) +}; + +QT_END_NAMESPACE + +#endif // QCONCATENATEROWSPROXYMODEL_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qconfig.h b/qt/6.8.1/msvc2022_64/include/QtCore/qconfig.h new file mode 100644 index 0000000000000000000000000000000000000000..0f836c78847dc9a4d176434a09177001b422c24a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qconfig.h @@ -0,0 +1,88 @@ +#define QT_FEATURE_version_tagging 1 + +#define QT_FEATURE_shared 1 + +#define QT_FEATURE_static -1 + +#define QT_FEATURE_cross_compile -1 + +#define QT_FEATURE_pkg_config -1 + +#define QT_FEATURE_debug_and_release 1 + +#define QT_FEATURE_separate_debug_info -1 + +#define QT_FEATURE_appstore_compliant -1 + +#define QT_FEATURE_simulator_and_device -1 + +#define QT_FEATURE_rpath -1 + +#define QT_FEATURE_force_asserts -1 + +#define QT_FEATURE_framework -1 + +#define QT_FEATURE_cxx20 -1 + +#define QT_FEATURE_cxx2a -1 + +#define QT_FEATURE_cxx2b -1 + +#define QT_FEATURE_reduce_relocations -1 + +#define QT_FEATURE_signaling_nan 1 + +#define QT_FEATURE_wasm_simd128 -1 + +#define QT_FEATURE_wasm_exceptions -1 + +#define QT_FEATURE_zstd -1 + +#define QT_FEATURE_thread 1 + +#define QT_FEATURE_future 1 + +#define QT_FEATURE_concurrent 1 + +#define QT_FEATURE_dbus 1 + +#define QT_FEATURE_openssl_linked -1 + +#define QT_FEATURE_opensslv11 -1 + +#define QT_FEATURE_opensslv30 1 + + +#define QT_VERSION_STR "6.8.1" + +#define QT_VERSION_MAJOR 6 + +#define QT_VERSION_MINOR 8 + +#define QT_VERSION_PATCH 1 + +#define QT_COPYRIGHT "Copyright (C) The Qt Company Ltd. and other contributors." +#define QT_LARGEFILE_SUPPORT 64 +#define QT_COMPILER_SUPPORTS_SSE2 1 +#define QT_COMPILER_SUPPORTS_SSE3 1 +#define QT_COMPILER_SUPPORTS_SSSE3 1 +#define QT_COMPILER_SUPPORTS_SSE4_1 1 +#define QT_COMPILER_SUPPORTS_SSE4_2 1 +#define QT_COMPILER_SUPPORTS_AVX 1 +#define QT_COMPILER_SUPPORTS_F16C 1 +#define QT_COMPILER_SUPPORTS_AVX2 1 +#define QT_COMPILER_SUPPORTS_AVX512F 1 +#define QT_COMPILER_SUPPORTS_AVX512ER 1 +#define QT_COMPILER_SUPPORTS_AVX512CD 1 +#define QT_COMPILER_SUPPORTS_AVX512PF 1 +#define QT_COMPILER_SUPPORTS_AVX512DQ 1 +#define QT_COMPILER_SUPPORTS_AVX512BW 1 +#define QT_COMPILER_SUPPORTS_AVX512VL 1 +#define QT_COMPILER_SUPPORTS_AVX512IFMA 1 +#define QT_COMPILER_SUPPORTS_AVX512VBMI 1 +#define QT_COMPILER_SUPPORTS_AVX512VBMI2 1 +#define QT_COMPILER_SUPPORTS_AES 1 +#define QT_COMPILER_SUPPORTS_VAES 1 +#define QT_COMPILER_SUPPORTS_RDRND 1 +#define QT_COMPILER_SUPPORTS_RDSEED 1 +#define QT_COMPILER_SUPPORTS_SHA 1 diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qconstructormacros.h b/qt/6.8.1/msvc2022_64/include/QtCore/qconstructormacros.h new file mode 100644 index 0000000000000000000000000000000000000000..7bdfdf1fbac7855ffdb72232ccb00f24b56e06cd --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qconstructormacros.h @@ -0,0 +1,38 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCONSTRUCTORMACROS_H +#define QCONSTRUCTORMACROS_H + +#if 0 +#pragma qt_class(QtConstructorMacros) +#pragma qt_sync_stop_processing +#endif + +#if defined(__cplusplus) + +#ifndef Q_CONSTRUCTOR_FUNCTION +# define Q_CONSTRUCTOR_FUNCTION0(AFUNC) \ + namespace { \ + static const struct AFUNC ## _ctor_class_ { \ + inline AFUNC ## _ctor_class_() { AFUNC(); } \ + } AFUNC ## _ctor_instance_; \ + } + +# define Q_CONSTRUCTOR_FUNCTION(AFUNC) Q_CONSTRUCTOR_FUNCTION0(AFUNC) +#endif + +#ifndef Q_DESTRUCTOR_FUNCTION +# define Q_DESTRUCTOR_FUNCTION0(AFUNC) \ + namespace { \ + static const struct AFUNC ## _dtor_class_ { \ + inline AFUNC ## _dtor_class_() { } \ + inline ~ AFUNC ## _dtor_class_() { AFUNC(); } \ + } AFUNC ## _dtor_instance_; \ + } +# define Q_DESTRUCTOR_FUNCTION(AFUNC) Q_DESTRUCTOR_FUNCTION0(AFUNC) +#endif + +#endif // __cplusplus + +#endif // QCONSTRUCTORMACROS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcontainerfwd.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcontainerfwd.h new file mode 100644 index 0000000000000000000000000000000000000000..d2ff5f194cefafa023eead792af7b9e2e48c3feb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcontainerfwd.h @@ -0,0 +1,64 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCONTAINERFWD_H +#define QCONTAINERFWD_H + +#include +#include + +#if 0 +#pragma qt_class(QtContainerFwd) +#endif + +// std headers can unfortunately not be forward declared +#include // std::size_t +#include +#include + +QT_BEGIN_NAMESPACE + +template class QCache; +template class QHash; +template class QMap; +template class QMultiHash; +template class QMultiMap; +#ifndef QT_NO_QPAIR +template +using QPair = std::pair; +#endif +template class QQueue; +template class QSet; +template class QSpan; +template class QStack; +constexpr qsizetype QVarLengthArrayDefaultPrealloc = 256; +template class QVarLengthArray; +template class QList; +class QString; +#ifndef Q_QDOC +template using QVector = QList; +using QStringList = QList; +class QByteArray; +using QByteArrayList = QList; +#else +template class QVector; +class QStringList; +class QByteArrayList; +#endif +class QMetaType; +class QVariant; + +using QVariantList = QList; +using QVariantMap = QMap; +using QVariantHash = QHash; +using QVariantPair = std::pair; + +namespace QtPrivate +{ +[[maybe_unused]] +constexpr qsizetype MaxAllocSize = (std::numeric_limits::max)(); +} + +QT_END_NAMESPACE + +#endif // QCONTAINERFWD_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcontainerinfo.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcontainerinfo.h new file mode 100644 index 0000000000000000000000000000000000000000..6041c0d70ef0f4447bfe7681a0e9582f56a2003c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcontainerinfo.h @@ -0,0 +1,229 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCONTAINERINFO_H +#define QCONTAINERINFO_H + +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QContainerInfo { + +template +using value_type = typename C::value_type; + +template +using key_type = typename C::key_type; + +template +using mapped_type = typename C::mapped_type; + +template +using iterator = typename C::iterator; + +template +using const_iterator = typename C::const_iterator; + +// Some versions of Apple clang warn about the constexpr variables below being unused. +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wunused-const-variable") + +template +inline constexpr bool has_value_type_v = false; +template +inline constexpr bool has_value_type_v>> = true; + +template +inline constexpr bool has_key_type_v = false; +template +inline constexpr bool has_key_type_v>> = true; + +template +inline constexpr bool has_mapped_type_v = false; +template +inline constexpr bool has_mapped_type_v>> = true; + +template +inline constexpr bool has_size_v = false; +template +inline constexpr bool has_size_v> = true; + +template +inline constexpr bool has_reserve_v = false; +template +inline constexpr bool has_reserve_v> = true; + +template +inline constexpr bool has_clear_v = false; +template +inline constexpr bool has_clear_v> = true; + +template +inline constexpr bool has_at_index_v = false; +template +inline constexpr bool has_at_index_v> = true; + +template +inline constexpr bool has_at_key_v = false; +template +inline constexpr bool has_at_key_v()))>> = true; + +template +inline constexpr bool can_get_at_index_v = false; +template +inline constexpr bool can_get_at_index_v(decltype(C()[0]))>> = true; + +template +inline constexpr bool can_set_at_index_v = false; +template +inline constexpr bool can_set_at_index_v())>> = true; + +template +inline constexpr bool has_push_front_v = false; +template +inline constexpr bool has_push_front_v()))>> = true; + +template +inline constexpr bool has_push_back_v = false; +template +inline constexpr bool has_push_back_v()))>> = true; + +template +inline constexpr bool has_insert_v = false; +template +inline constexpr bool has_insert_v()))>> = true; + +template +inline constexpr bool has_pop_front_v = false; +template +inline constexpr bool has_pop_front_v> = true; + +template +inline constexpr bool has_pop_back_v = false; +template +inline constexpr bool has_pop_back_v> = true; + +template +inline constexpr bool has_iterator_v = false; +template +inline constexpr bool has_iterator_v>> = true; + +template +inline constexpr bool has_const_iterator_v = false; +template +inline constexpr bool has_const_iterator_v>> = true; + +template +inline constexpr bool can_set_value_at_iterator_v = false; +template +inline constexpr bool can_set_value_at_iterator_v())>> = true; + +template +inline constexpr bool can_set_mapped_at_iterator_v = false; +template +inline constexpr bool can_set_mapped_at_iterator_v())>> = true; + +template +inline constexpr bool can_insert_value_at_iterator_v = false; +template +inline constexpr bool can_insert_value_at_iterator_v()))>> = true; + +template +inline constexpr bool can_erase_at_iterator_v = false; +template +inline constexpr bool can_erase_at_iterator_v> = true; + +template +inline constexpr bool can_erase_range_at_iterator_v = false; +template +inline constexpr bool can_erase_range_at_iterator_v> = true; + +template +inline constexpr bool can_get_at_key_v = false; +template +inline constexpr bool can_get_at_key_v(decltype(C()[key_type()]))>> = true; + +template +inline constexpr bool can_set_at_key_v = false; +template +inline constexpr bool can_set_at_key_v()] = mapped_type())>> = true; + +template +inline constexpr bool can_erase_at_key_v = false; +template +inline constexpr bool can_erase_at_key_v()))>> = true; + +template +inline constexpr bool can_remove_at_key_v = false; +template +inline constexpr bool can_remove_at_key_v()))>> = true; + +template +inline constexpr bool can_insert_key_v = false; +template +inline constexpr bool can_insert_key_v()))>> = true; + +template +inline constexpr bool can_insert_pair_v = false; +template +inline constexpr bool can_insert_pair_v(), mapped_type()}))>> = true; + +template +inline constexpr bool can_insert_key_mapped_v = false; +template +inline constexpr bool can_insert_key_mapped_v(), mapped_type()))>> = true; + +template +inline constexpr bool has_contains_v = false; +template +inline constexpr bool has_contains_v())))>> = true; + +template +inline constexpr bool has_find_v = false; +template +inline constexpr bool has_find_v()))>> = true; + +template +inline constexpr bool iterator_dereferences_to_value_v = false; +template +inline constexpr bool iterator_dereferences_to_value_v(*C().begin()))>> = true; + +template +inline constexpr bool iterator_has_key_v = false; +template +inline constexpr bool iterator_has_key_v(C().begin().key()))>> = true; + +template +inline constexpr bool value_type_has_first_v = false; +template +inline constexpr bool value_type_has_first_v(value_type().first))>> = true; + +template +inline constexpr bool iterator_dereferences_to_key_v = false; +template +inline constexpr bool iterator_dereferences_to_key_v(*C().begin()))>> = true; + +template +inline constexpr bool iterator_has_value_v = false; +template +inline constexpr bool iterator_has_value_v(C().begin().value()))>> = true; + +template +inline constexpr bool value_type_has_second_v = false; +template +inline constexpr bool value_type_has_second_v(value_type().second))>> = true; + +template +inline constexpr bool iterator_dereferences_to_mapped_v = false; +template +inline constexpr bool iterator_dereferences_to_mapped_v(*C().begin()))>> = true; + +QT_WARNING_POP + +} + +QT_END_NAMESPACE + +#endif // QCONTAINERINFO_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcontainertools_impl.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcontainertools_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..6c08919d3ab01e671ccc251ddb9e1a4672749525 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcontainertools_impl.h @@ -0,0 +1,470 @@ +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#if 0 +#pragma qt_sync_skip_header_check +#pragma qt_sync_stop_processing +#endif + +#ifndef QCONTAINERTOOLS_IMPL_H +#define QCONTAINERTOOLS_IMPL_H + +#include +#include + +#include + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtPrivate +{ + +/*! + \internal + + Returns whether \a p is within a range [b, e). In simplest form equivalent to: + b <= p < e. +*/ +template> +static constexpr bool q_points_into_range(const T *p, const T *b, const T *e, + Cmp less = {}) noexcept +{ + return !less(p, b) && less(p, e); +} + +/*! + \internal + + Returns whether \a p is within container \a c. In its simplest form equivalent to: + c.data() <= p < c.data() + c.size() +*/ +template +static constexpr bool q_points_into_range(const T &p, const C &c) noexcept +{ + static_assert(std::is_same_v); + + // std::distance because QArrayDataPointer has a "qsizetype size" + // member but no size() function + return q_points_into_range(p, std::data(c), + std::data(c) + std::distance(std::begin(c), std::end(c))); +} + +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wmaybe-uninitialized") + +template +void q_uninitialized_move_if_noexcept_n(T* first, N n, T* out) +{ + if constexpr (std::is_nothrow_move_constructible_v || !std::is_copy_constructible_v) + std::uninitialized_move_n(first, n, out); + else + std::uninitialized_copy_n(first, n, out); +} + +template +void q_uninitialized_relocate_n(T* first, N n, T* out) +{ + if constexpr (QTypeInfo::isRelocatable) { + static_assert(std::is_copy_constructible_v || std::is_move_constructible_v, + "Refusing to relocate this non-copy/non-move-constructible type."); + if (n != N(0)) { // even if N == 0, out == nullptr or first == nullptr are UB for memcpy() + std::memcpy(static_cast(out), + static_cast(first), + n * sizeof(T)); + } + } else { + q_uninitialized_move_if_noexcept_n(first, n, out); + if constexpr (QTypeInfo::isComplex) + std::destroy_n(first, n); + } +} + +QT_WARNING_POP + +/*! + \internal + + A wrapper around std::rotate(), with an optimization for + Q_RELOCATABLE_TYPEs. We omit the return value, as it would be more work to + compute in the Q_RELOCATABLE_TYPE case and, unlike std::rotate on + ForwardIterators, callers can compute the result in constant time + themselves. +*/ +template +void q_rotate(T *first, T *mid, T *last) +{ + if constexpr (QTypeInfo::isRelocatable) { + const auto cast = [](T *p) { return reinterpret_cast(p); }; + std::rotate(cast(first), cast(mid), cast(last)); + } else { + std::rotate(first, mid, last); + } +} + +/*! + \internal + Copies all elements, except the ones for which \a pred returns \c true, from + range [first, last), to the uninitialized memory buffer starting at \a out. + + It's undefined behavior if \a out points into [first, last). + + Returns a pointer one past the last copied element. + + If an exception is thrown, all the already copied elements in the destination + buffer are destroyed. +*/ +template +T *q_uninitialized_remove_copy_if(T *first, T *last, T *out, Predicate &pred) +{ + static_assert(std::is_nothrow_destructible_v, + "This algorithm requires that T has a non-throwing destructor"); + Q_ASSERT(!q_points_into_range(out, first, last)); + + T *dest_begin = out; + QT_TRY { + while (first != last) { + if (!pred(*first)) { + new (std::addressof(*out)) T(*first); + ++out; + } + ++first; + } + } QT_CATCH (...) { + std::destroy(std::reverse_iterator(out), std::reverse_iterator(dest_begin)); + QT_RETHROW; + } + return out; +} + +template +void q_relocate_overlap_n_left_move(iterator first, N n, iterator d_first) +{ + // requires: [first, n) is a valid range + // requires: d_first + n is reachable from d_first + // requires: iterator is at least a random access iterator + // requires: value_type(iterator) has a non-throwing destructor + + Q_ASSERT(n); + Q_ASSERT(d_first < first); // only allow moves to the "left" + using T = typename std::iterator_traits::value_type; + + // Watches passed iterator. Unless commit() is called, all the elements that + // the watched iterator passes through are deleted at the end of object + // lifetime. freeze() could be used to stop watching the passed iterator and + // remain at current place. + // + // requires: the iterator is expected to always point to an invalid object + // (to uninitialized memory) + struct Destructor + { + iterator *iter; + iterator end; + iterator intermediate; + + Destructor(iterator &it) noexcept : iter(std::addressof(it)), end(it) { } + void commit() noexcept { iter = std::addressof(end); } + void freeze() noexcept + { + intermediate = *iter; + iter = std::addressof(intermediate); + } + ~Destructor() noexcept + { + for (const int step = *iter < end ? 1 : -1; *iter != end;) { + std::advance(*iter, step); + (*iter)->~T(); + } + } + } destroyer(d_first); + + const iterator d_last = d_first + n; + // Note: use pair and explicitly copy iterators from it to prevent + // accidental reference semantics instead of copy. equivalent to: + // + // auto [overlapBegin, overlapEnd] = std::minmax(d_last, first); + auto pair = std::minmax(d_last, first); + + // overlap area between [d_first, d_first + n) and [first, first + n) or an + // uninitialized memory area between the two ranges + iterator overlapBegin = pair.first; + iterator overlapEnd = pair.second; + + // move construct elements in uninitialized region + while (d_first != overlapBegin) { + // account for std::reverse_iterator, cannot use new(d_first) directly + new (std::addressof(*d_first)) T(std::move_if_noexcept(*first)); + ++d_first; + ++first; + } + + // cannot commit but have to stop - there might be an overlap region + // which we don't want to delete (because it's part of existing data) + destroyer.freeze(); + + // move assign elements in overlap region + while (d_first != d_last) { + *d_first = std::move_if_noexcept(*first); + ++d_first; + ++first; + } + + Q_ASSERT(d_first == destroyer.end + n); + destroyer.commit(); // can commit here as ~T() below does not throw + + while (first != overlapEnd) + (--first)->~T(); +} + +/*! + \internal + + Relocates a range [first, n) to [d_first, n) taking care of potential memory + overlaps. This is a generic equivalent of memmove. + + If an exception is thrown during the relocation, all the relocated elements + are destroyed and [first, n) may contain valid but unspecified values, + including moved-from values (basic exception safety). +*/ +template +void q_relocate_overlap_n(T *first, N n, T *d_first) +{ + static_assert(std::is_nothrow_destructible_v, + "This algorithm requires that T has a non-throwing destructor"); + + if (n == N(0) || first == d_first || first == nullptr || d_first == nullptr) + return; + + if constexpr (QTypeInfo::isRelocatable) { + std::memmove(static_cast(d_first), static_cast(first), n * sizeof(T)); + } else { // generic version has to be used + if (d_first < first) { + q_relocate_overlap_n_left_move(first, n, d_first); + } else { // first < d_first + auto rfirst = std::make_reverse_iterator(first + n); + auto rd_first = std::make_reverse_iterator(d_first + n); + q_relocate_overlap_n_left_move(rfirst, n, rd_first); + } + } +} + +template +struct ArrowProxy +{ + T t; + T *operator->() noexcept { return &t; } +}; + +template +using IfIsInputIterator = typename std::enable_if< + std::is_convertible::iterator_category, std::input_iterator_tag>::value, + bool>::type; + +template +using IfIsForwardIterator = typename std::enable_if< + std::is_convertible::iterator_category, std::forward_iterator_tag>::value, + bool>::type; + +template +using IfIsNotForwardIterator = typename std::enable_if< + !std::is_convertible::iterator_category, std::forward_iterator_tag>::value, + bool>::type; + +template = true> +void reserveIfForwardIterator(Container *, InputIterator, InputIterator) +{ +} + +template = true> +void reserveIfForwardIterator(Container *c, ForwardIterator f, ForwardIterator l) +{ + c->reserve(static_cast(std::distance(f, l))); +} + +template +using KeyAndValueTest = decltype( + std::declval().key(), + std::declval().value() +); + +template +using FirstAndSecondTest = decltype( + (*std::declval()).first, + (*std::declval()).second +); + +template +using IfAssociativeIteratorHasKeyAndValue = + std::enable_if_t, bool>; + +template +using IfAssociativeIteratorHasFirstAndSecond = + std::enable_if_t< + std::conjunction_v< + std::negation>, + qxp::is_detected + >, bool>; + +template +using MoveBackwardsTest = decltype( + std::declval().operator--() +); + +template +using IfIteratorCanMoveBackwards = + std::enable_if_t, bool>; + +template +using IfIsNotSame = + typename std::enable_if::value, bool>::type; + +template +using IfIsNotConvertible = typename std::enable_if::value, bool>::type; + +template +auto sequential_erase_if(Container &c, Predicate &pred) +{ + // This is remove_if() modified to perform the find_if step on + // const_iterators to avoid shared container detaches if nothing needs to + // be removed. We cannot run remove_if after find_if: doing so would apply + // the predicate to the first matching element twice! + + const auto cbegin = c.cbegin(); + const auto cend = c.cend(); + const auto t_it = std::find_if(cbegin, cend, pred); + auto result = std::distance(cbegin, t_it); + if (result == c.size()) + return result - result; // `0` of the right type + + // now detach: + const auto e = c.end(); + + auto it = std::next(c.begin(), result); + auto dest = it; + + // Loop Invariants: + // - it != e + // - [next(it), e[ still to be checked + // - [c.begin(), dest[ are result + while (++it != e) { + if (!pred(*it)) { + *dest = std::move(*it); + ++dest; + } + } + + result = std::distance(dest, e); + c.erase(dest, e); + return result; +} + +template +auto sequential_erase(Container &c, const T &t) +{ + // use the equivalence relation from http://eel.is/c++draft/list.erasure#1 + auto cmp = [&](auto &e) { return e == t; }; + return sequential_erase_if(c, cmp); // can't pass rvalues! +} + +template +auto sequential_erase_with_copy(Container &c, const T &t) +{ + using CopyProxy = std::conditional_t, T, const T &>; + return sequential_erase(c, CopyProxy(t)); +} + +template +auto sequential_erase_one(Container &c, const T &t) +{ + const auto cend = c.cend(); + const auto it = std::find(c.cbegin(), cend, t); + if (it == cend) + return false; + c.erase(it); + return true; +} + +template +qsizetype qset_erase_if(QSet &set, Predicate &pred) +{ + qsizetype result = 0; + auto it = set.begin(); + const auto e = set.end(); + while (it != e) { + if (pred(*it)) { + ++result; + it = set.erase(it); + } else { + ++it; + } + } + return result; +} + + +// Prerequisite: F is invocable on ArgTypes +template +struct is_invoke_result_explicitly_convertible : std::is_constructible> +{}; + +// is_invocable_r checks for implicit conversions, but we need to check +// for explicit conversions in remove_if. So, roll our own trait. +template +constexpr bool is_invocable_explicit_r_v = std::conjunction_v< + std::is_invocable, + is_invoke_result_explicitly_convertible +>; + +template +auto associative_erase_if(Container &c, Predicate &pred) +{ + // we support predicates callable with either Container::iterator + // or with std::pair + using Iterator = typename Container::iterator; + using Key = typename Container::key_type; + using Value = typename Container::mapped_type; + using KeyValuePair = std::pair; + + typename Container::size_type result = 0; + + auto it = c.begin(); + const auto e = c.end(); + while (it != e) { + if constexpr (is_invocable_explicit_r_v) { + if (pred(it)) { + it = c.erase(it); + ++result; + } else { + ++it; + } + } else if constexpr (is_invocable_explicit_r_v) { + KeyValuePair p(it.key(), it.value()); + if (pred(std::move(p))) { + it = c.erase(it); + ++result; + } else { + ++it; + } + } else { + static_assert(sizeof(Container) == 0, "Predicate has an incompatible signature"); + } + } + + return result; +} + +} // namespace QtPrivate + +QT_END_NAMESPACE + +#endif // QCONTAINERTOOLS_IMPL_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcontiguouscache.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcontiguouscache.h new file mode 100644 index 0000000000000000000000000000000000000000..e26908fadf98211dd0938d2aa2c8f79eb18cfd56 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcontiguouscache.h @@ -0,0 +1,438 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCONTIGUOUSCACHE_H +#define QCONTIGUOUSCACHE_H + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#undef QT_QCONTIGUOUSCACHE_DEBUG + + +struct Q_CORE_EXPORT QContiguousCacheData +{ + QBasicAtomicInt ref; + qsizetype alloc; + qsizetype count; + qsizetype start; + qsizetype offset; + + static QContiguousCacheData *allocateData(qsizetype size, qsizetype alignment); + static void freeData(QContiguousCacheData *data); + +#ifdef QT_QCONTIGUOUSCACHE_DEBUG + void dump() const; +#endif +}; + +template +struct QContiguousCacheTypedData : public QContiguousCacheData +{ + T array[1]; +}; + +template +class QContiguousCache { + static_assert(std::is_nothrow_destructible_v, "Types with throwing destructors are not supported in Qt containers."); + + typedef QContiguousCacheTypedData Data; + Data *d; +public: + // STL compatibility + typedef T value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef qptrdiff difference_type; + typedef qsizetype size_type; + + explicit QContiguousCache(qsizetype capacity = 0); + QContiguousCache(const QContiguousCache &v) : d(v.d) { d->ref.ref(); } + + inline ~QContiguousCache() { if (!d) return; if (!d->ref.deref()) freeData(d); } + + inline void detach() { if (d->ref.loadRelaxed() != 1) detach_helper(); } + inline bool isDetached() const { return d->ref.loadRelaxed() == 1; } + + QContiguousCache &operator=(const QContiguousCache &other); + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QContiguousCache) + void swap(QContiguousCache &other) noexcept { qt_ptr_swap(d, other.d); } + +#ifndef Q_QDOC + template + QTypeTraits::compare_eq_result operator==(const QContiguousCache &other) const + { + if (other.d == d) + return true; + if (other.d->start != d->start + || other.d->count != d->count + || other.d->offset != d->offset + || other.d->alloc != d->alloc) + return false; + for (qsizetype i = firstIndex(); i <= lastIndex(); ++i) + if (!(at(i) == other.at(i))) + return false; + return true; + } + template + QTypeTraits::compare_eq_result operator!=(const QContiguousCache &other) const + { return !(*this == other); } +#else + bool operator==(const QContiguousCache &other) const; + bool operator!=(const QContiguousCache &other) const; +#endif // Q_QDOC + + inline qsizetype capacity() const {return d->alloc; } + inline qsizetype count() const { return d->count; } + inline qsizetype size() const { return d->count; } + + inline bool isEmpty() const { return d->count == 0; } + inline bool isFull() const { return d->count == d->alloc; } + inline qsizetype available() const { return d->alloc - d->count; } + + void clear(); + void setCapacity(qsizetype size); + + const T &at(qsizetype pos) const; + T &operator[](qsizetype i); + const T &operator[](qsizetype i) const; + + void append(T &&value); + void append(const T &value); + void prepend(T &&value); + void prepend(const T &value); + void insert(qsizetype pos, T &&value); + void insert(qsizetype pos, const T &value); + + + inline bool containsIndex(qsizetype pos) const { return pos >= d->offset && pos - d->offset < d->count; } + inline qsizetype firstIndex() const { return d->offset; } + inline qsizetype lastIndex() const { return d->offset + d->count - 1; } + + inline const T &first() const { Q_ASSERT(!isEmpty()); return d->array[d->start]; } + inline const T &last() const { Q_ASSERT(!isEmpty()); return d->array[(d->start + d->count -1) % d->alloc]; } + inline T &first() { Q_ASSERT(!isEmpty()); detach(); return d->array[d->start]; } + inline T &last() { Q_ASSERT(!isEmpty()); detach(); return d->array[(d->start + d->count -1) % d->alloc]; } + + void removeFirst(); + T takeFirst(); + void removeLast(); + T takeLast(); + + // Use extra parentheses around max to avoid expanding it if it is a macro. + inline bool areIndexesValid() const + { return d->offset >= 0 && d->offset < (std::numeric_limits::max)() - d->count && (d->offset % d->alloc) == d->start; } + + inline void normalizeIndexes() { d->offset = d->start; } + +#ifdef QT_QCONTIGUOUSCACHE_DEBUG + void dump() const { d->dump(); } +#endif +private: + void detach_helper(); + + Data *allocateData(qsizetype aalloc); + void freeData(Data *x); +}; + +template +void QContiguousCache::detach_helper() +{ + Data *x = allocateData(d->alloc); + x->ref.storeRelaxed(1); + x->count = d->count; + x->start = d->start; + x->offset = d->offset; + x->alloc = d->alloc; + + T *dest = x->array + x->start; + T *src = d->array + d->start; + qsizetype oldcount = x->count; + while (oldcount--) { + new (dest) T(*src); + dest++; + if (dest == x->array + x->alloc) + dest = x->array; + src++; + if (src == d->array + d->alloc) + src = d->array; + } + + if (!d->ref.deref()) + freeData(d); + d = x; +} + +template +void QContiguousCache::setCapacity(qsizetype asize) +{ + Q_ASSERT(asize >= 0); + if (asize == d->alloc) + return; + detach(); + Data *x = allocateData(asize); + x->ref.storeRelaxed(1); + x->alloc = asize; + x->count = qMin(d->count, asize); + x->offset = d->offset + d->count - x->count; + if (asize) + x->start = x->offset % x->alloc; + else + x->start = 0; + + qsizetype oldcount = x->count; + if (oldcount) + { + T *dest = x->array + (x->start + x->count-1) % x->alloc; + T *src = d->array + (d->start + d->count-1) % d->alloc; + while (oldcount--) { + new (dest) T(*src); + if (dest == x->array) + dest = x->array + x->alloc; + dest--; + if (src == d->array) + src = d->array + d->alloc; + src--; + } + } + /* free old */ + freeData(d); + d = x; +} + +template +void QContiguousCache::clear() +{ + if (d->ref.loadRelaxed() == 1) { + if (QTypeInfo::isComplex) { + qsizetype oldcount = d->count; + T * i = d->array + d->start; + T * e = d->array + d->alloc; + while (oldcount--) { + i->~T(); + i++; + if (i == e) + i = d->array; + } + } + d->count = d->start = d->offset = 0; + } else { + Data *x = allocateData(d->alloc); + x->ref.storeRelaxed(1); + x->alloc = d->alloc; + x->count = x->start = x->offset = 0; + if (!d->ref.deref()) + freeData(d); + d = x; + } +} + +template +inline typename QContiguousCache::Data *QContiguousCache::allocateData(qsizetype aalloc) +{ + return static_cast(QContiguousCacheData::allocateData(sizeof(Data) + (aalloc - 1) * sizeof(T), alignof(Data))); +} + +template +QContiguousCache::QContiguousCache(qsizetype cap) +{ + Q_ASSERT(cap >= 0); + d = allocateData(cap); + d->ref.storeRelaxed(1); + d->alloc = cap; + d->count = d->start = d->offset = 0; +} + +template +QContiguousCache &QContiguousCache::operator=(const QContiguousCache &other) +{ + other.d->ref.ref(); + if (!d->ref.deref()) + freeData(d); + d = other.d; + return *this; +} + +template +void QContiguousCache::freeData(Data *x) +{ + if (QTypeInfo::isComplex) { + qsizetype oldcount = d->count; + T * i = d->array + d->start; + T * e = d->array + d->alloc; + while (oldcount--) { + i->~T(); + i++; + if (i == e) + i = d->array; + } + } + Data::freeData(x); +} +template +void QContiguousCache::append(T &&value) +{ + if (!d->alloc) + return; // zero capacity + detach(); + if (d->count == d->alloc) + (d->array + (d->start+d->count) % d->alloc)->~T(); + new (d->array + (d->start+d->count) % d->alloc) T(std::move(value)); + + if (d->count == d->alloc) { + d->start++; + d->start %= d->alloc; + d->offset++; + } else { + d->count++; + } +} + +template +void QContiguousCache::append(const T &value) +{ + if (!d->alloc) + return; // zero capacity + detach(); + if (d->count == d->alloc) + (d->array + (d->start+d->count) % d->alloc)->~T(); + new (d->array + (d->start+d->count) % d->alloc) T(value); + + if (d->count == d->alloc) { + d->start++; + d->start %= d->alloc; + d->offset++; + } else { + d->count++; + } +} + +template +void QContiguousCache::prepend(T &&value) +{ + if (!d->alloc) + return; // zero capacity + detach(); + if (d->start) + d->start--; + else + d->start = d->alloc-1; + d->offset--; + + if (d->count != d->alloc) + d->count++; + else + (d->array + d->start)->~T(); + + new (d->array + d->start) T(std::move(value)); +} + +template +void QContiguousCache::prepend(const T &value) +{ + if (!d->alloc) + return; // zero capacity + detach(); + if (d->start) + d->start--; + else + d->start = d->alloc-1; + d->offset--; + + if (d->count != d->alloc) + d->count++; + else + (d->array + d->start)->~T(); + + new (d->array + d->start) T(value); +} + +template +void QContiguousCache::insert(qsizetype pos, T &&value) +{ + Q_ASSERT_X(pos >= 0, "QContiguousCache::insert", "index out of range"); + if (!d->alloc) + return; // zero capacity + detach(); + if (containsIndex(pos)) { + d->array[pos % d->alloc] = std::move(value); + } else if (pos == d->offset-1) + prepend(value); + else if (pos == d->offset+d->count) + append(value); + else { + // we don't leave gaps. + clear(); + d->offset = pos; + d->start = pos % d->alloc; + d->count = 1; + new (d->array + d->start) T(std::move(value)); + } +} + +template +void QContiguousCache::insert(qsizetype pos, const T &value) +{ + return insert(pos, T(value)); +} +template +inline const T &QContiguousCache::at(qsizetype pos) const +{ Q_ASSERT_X(pos >= d->offset && pos - d->offset < d->count, "QContiguousCache::at", "index out of range"); return d->array[pos % d->alloc]; } +template +inline const T &QContiguousCache::operator[](qsizetype pos) const +{ return at(pos); } + +template +inline T &QContiguousCache::operator[](qsizetype pos) +{ + detach(); + if (!containsIndex(pos)) + insert(pos, T()); + return d->array[pos % d->alloc]; +} + +template +inline void QContiguousCache::removeFirst() +{ + Q_ASSERT(d->count > 0); + detach(); + d->count--; + if (QTypeInfo::isComplex) + (d->array + d->start)->~T(); + d->start = (d->start + 1) % d->alloc; + d->offset++; +} + +template +inline void QContiguousCache::removeLast() +{ + Q_ASSERT(d->count > 0); + detach(); + d->count--; + if (QTypeInfo::isComplex) + (d->array + (d->start + d->count) % d->alloc)->~T(); +} + +template +inline T QContiguousCache::takeFirst() +{ T t = std::move(first()); removeFirst(); return t; } + +template +inline T QContiguousCache::takeLast() +{ T t = std::move(last()); removeLast(); return t; } + +QT_END_NAMESPACE + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcoreapplication.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcoreapplication.h new file mode 100644 index 0000000000000000000000000000000000000000..81a03b272388e6a7733b2d28ab019bdbef5f48b7 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcoreapplication.h @@ -0,0 +1,282 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCOREAPPLICATION_H +#define QCOREAPPLICATION_H + +#include +#include +#ifndef QT_NO_QOBJECT +#include +#include +#include +#include +#else +#include +#endif +#include +#ifndef QT_NO_DEBUGSTREAM +#include +#endif + +#ifndef QT_NO_QOBJECT +#if defined(Q_OS_WIN) && !defined(tagMSG) +typedef struct tagMSG MSG; +#endif +#endif + +QT_BEGIN_NAMESPACE + + +class QCoreApplicationPrivate; +class QTranslator; +class QPostEventList; +class QAbstractEventDispatcher; +class QAbstractNativeEventFilter; +class QEventLoopLocker; + +#if QT_CONFIG(permissions) || defined(Q_QDOC) +class QPermission; +#endif + +#define qApp QCoreApplication::instance() + +class Q_CORE_EXPORT QCoreApplication +#ifndef QT_NO_QOBJECT + : public QObject +#endif +{ +#ifndef QT_NO_QOBJECT + Q_OBJECT + Q_PROPERTY(QString applicationName READ applicationName WRITE setApplicationName + NOTIFY applicationNameChanged) + Q_PROPERTY(QString applicationVersion READ applicationVersion WRITE setApplicationVersion + NOTIFY applicationVersionChanged) + Q_PROPERTY(QString organizationName READ organizationName WRITE setOrganizationName + NOTIFY organizationNameChanged) + Q_PROPERTY(QString organizationDomain READ organizationDomain WRITE setOrganizationDomain + NOTIFY organizationDomainChanged) + Q_PROPERTY(bool quitLockEnabled READ isQuitLockEnabled WRITE setQuitLockEnabled) +#endif + + Q_DECLARE_PRIVATE(QCoreApplication) + friend class QEventLoopLocker; +#if QT_CONFIG(permissions) + using RequestPermissionPrototype = void(*)(QPermission); +#endif + +public: + enum { ApplicationFlags = QT_VERSION + }; + + QCoreApplication(int &argc, char **argv +#ifndef Q_QDOC + , int = ApplicationFlags +#endif + ); + + ~QCoreApplication(); + + static QStringList arguments(); + + static void setAttribute(Qt::ApplicationAttribute attribute, bool on = true); + static bool testAttribute(Qt::ApplicationAttribute attribute); + + static void setOrganizationDomain(const QString &orgDomain); + static QString organizationDomain(); + static void setOrganizationName(const QString &orgName); + static QString organizationName(); + static void setApplicationName(const QString &application); + static QString applicationName(); + static void setApplicationVersion(const QString &version); + static QString applicationVersion(); + + static void setSetuidAllowed(bool allow); + static bool isSetuidAllowed(); + + static QCoreApplication *instance() noexcept { return self; } + +#ifndef QT_NO_QOBJECT + static int exec(); + static void processEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents); + static void processEvents(QEventLoop::ProcessEventsFlags flags, int maxtime); + static void processEvents(QEventLoop::ProcessEventsFlags flags, QDeadlineTimer deadline); + + static bool sendEvent(QObject *receiver, QEvent *event); + static void postEvent(QObject *receiver, QEvent *event, int priority = Qt::NormalEventPriority); + static void sendPostedEvents(QObject *receiver = nullptr, int event_type = 0); + static void removePostedEvents(QObject *receiver, int eventType = 0); + static QAbstractEventDispatcher *eventDispatcher(); + static void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher); + + virtual bool notify(QObject *, QEvent *); + + static bool startingUp(); + static bool closingDown(); +#endif + + static QString applicationDirPath(); + static QString applicationFilePath(); + static qint64 applicationPid() Q_DECL_CONST_FUNCTION; + +#if QT_CONFIG(permissions) || defined(Q_QDOC) + Qt::PermissionStatus checkPermission(const QPermission &permission); + +# ifdef Q_QDOC + template + void requestPermission(const QPermission &permission, const QObject *context, Functor functor); +# else + // requestPermission with context or receiver object; need to require here that receiver is the + // right type to avoid ambiguity with the private implementation function. + template ::value, + bool> = true> + void requestPermission(const QPermission &permission, + const typename QtPrivate::ContextTypeForFunctor::ContextType *receiver, + Functor &&func) + { + requestPermission(permission, + QtPrivate::makeCallableObject(std::forward(func)), + receiver); + } +# endif // Q_QDOC + +#ifndef QT_NO_CONTEXTLESS_CONNECT + #ifdef Q_QDOC + template + #else + // requestPermission to a functor or function pointer (without context) + template ::value, + bool> = true> + #endif + void requestPermission(const QPermission &permission, Functor &&func) + { + requestPermission(permission, nullptr, std::forward(func)); + } +#endif // QT_NO_CONTEXTLESS_CONNECT + +private: + // ### Qt 7: rename to requestPermissionImpl to avoid ambiguity + void requestPermission(const QPermission &permission, + QtPrivate::QSlotObjectBase *slotObj, const QObject *context); +public: + +#endif // QT_CONFIG(permission) + +#if QT_CONFIG(library) + static void setLibraryPaths(const QStringList &); + static QStringList libraryPaths(); + static void addLibraryPath(const QString &); + static void removeLibraryPath(const QString &); +#endif // QT_CONFIG(library) + +#ifndef QT_NO_TRANSLATION + static bool installTranslator(QTranslator * messageFile); + static bool removeTranslator(QTranslator * messageFile); +#endif + + static QString translate(const char * context, + const char * key, + const char * disambiguation = nullptr, + int n = -1); + + QT_DECLARE_NATIVE_INTERFACE_ACCESSOR(QCoreApplication) + +#ifndef QT_NO_QOBJECT + void installNativeEventFilter(QAbstractNativeEventFilter *filterObj); + void removeNativeEventFilter(QAbstractNativeEventFilter *filterObj); + + static bool isQuitLockEnabled(); + static void setQuitLockEnabled(bool enabled); + +public Q_SLOTS: + static void quit(); + static void exit(int retcode = 0); + +Q_SIGNALS: + void aboutToQuit(QPrivateSignal); + + void organizationNameChanged(); + void organizationDomainChanged(); + void applicationNameChanged(); + void applicationVersionChanged(); + +protected: + bool event(QEvent *) override; + + virtual bool compressEvent(QEvent *, QObject *receiver, QPostEventList *); +#endif // QT_NO_QOBJECT + +protected: + QCoreApplication(QCoreApplicationPrivate &p); + +#ifdef QT_NO_QOBJECT + QScopedPointer d_ptr; +#endif + +private: +#ifndef QT_NO_QOBJECT + static bool sendSpontaneousEvent(QObject *receiver, QEvent *event); + static bool notifyInternal2(QObject *receiver, QEvent *); + static bool forwardEvent(QObject *receiver, QEvent *event, QEvent *originatingEvent = nullptr); +#endif +#if QT_CONFIG(library) + static QStringList libraryPathsLocked(); +#endif + + static QCoreApplication *self; + + Q_DISABLE_COPY(QCoreApplication) + + friend class QApplication; + friend class QApplicationPrivate; + friend class QGuiApplication; + friend class QGuiApplicationPrivate; + friend class QWidget; + friend class QWidgetWindow; + friend class QWidgetPrivate; + friend class QWindowPrivate; +#ifndef QT_NO_QOBJECT + friend class QEventDispatcherUNIXPrivate; + friend class QCocoaEventDispatcherPrivate; + friend bool qt_sendSpontaneousEvent(QObject *, QEvent *); +#endif + friend Q_CORE_EXPORT QString qAppName(); + friend class QCommandLineParserPrivate; +}; + +#define Q_DECLARE_TR_FUNCTIONS(context) \ +public: \ + static inline QString tr(const char *sourceText, const char *disambiguation = nullptr, int n = -1) \ + { return QCoreApplication::translate(#context, sourceText, disambiguation, n); } \ +private: + +typedef void (*QtStartUpFunction)(); +typedef void (*QtCleanUpFunction)(); + +Q_CORE_EXPORT void qAddPreRoutine(QtStartUpFunction); +Q_CORE_EXPORT void qAddPostRoutine(QtCleanUpFunction); +Q_CORE_EXPORT void qRemovePostRoutine(QtCleanUpFunction); +Q_CORE_EXPORT QString qAppName(); // get application name + +#define Q_COREAPP_STARTUP_FUNCTION(AFUNC) \ + static void AFUNC ## _ctor_function() { \ + qAddPreRoutine(AFUNC); \ + } \ + Q_CONSTRUCTOR_FUNCTION(AFUNC ## _ctor_function) + +#ifndef QT_NO_QOBJECT +#if defined(Q_OS_WIN) && !defined(QT_NO_DEBUG_STREAM) +Q_CORE_EXPORT QString decodeMSG(const MSG &); +Q_CORE_EXPORT QDebug operator<<(QDebug, const MSG &); +#endif +#endif + +QT_END_NAMESPACE + +#include + +#endif // QCOREAPPLICATION_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcoreapplication_platform.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcoreapplication_platform.h new file mode 100644 index 0000000000000000000000000000000000000000..122c26f840f1d7b5861be5e195920f4cb54ae117 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcoreapplication_platform.h @@ -0,0 +1,69 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCOREAPPLICATION_PLATFORM_H +#define QCOREAPPLICATION_PLATFORM_H + +// +// W A R N I N G +// ------------- +// +// This file is part of the native interface APIs. Usage of +// this API may make your code source and binary incompatible +// with future versions of Qt. +// + +#include +#include +#include + +#if defined(Q_OS_ANDROID) || defined(Q_QDOC) +#include +#if QT_CONFIG(future) && !defined(QT_NO_QOBJECT) +#include +#include +#endif +#endif // #if defined(Q_OS_ANDROID) || defined(Q_QDOC) + +#if defined(Q_OS_ANDROID) +class _jobject; +typedef _jobject* jobject; +#endif + +QT_BEGIN_NAMESPACE + +namespace QNativeInterface +{ +#if defined(Q_OS_ANDROID) || defined(Q_QDOC) +struct Q_CORE_EXPORT QAndroidApplication +{ + QT_DECLARE_NATIVE_INTERFACE(QAndroidApplication, 1, QCoreApplication) +#ifdef Q_QDOC + static QJniObject context(); +#else + static QtJniTypes::Context context(); +#endif + static bool isActivityContext(); + static int sdkVersion(); + static void hideSplashScreen(int duration = 0); + +#if QT_CONFIG(future) && !defined(QT_NO_QOBJECT) + static QFuture runOnAndroidMainThread(const std::function &runnable, + const QDeadlineTimer timeout = QDeadlineTimer::Forever); + + template + std::enable_if_t && std::is_same_v, void>, + QFuture> static runOnAndroidMainThread(const T &runnable, + const QDeadlineTimer timeout = QDeadlineTimer::Forever) + { + std::function func = [runnable](){ runnable(); return QVariant(); }; + return static_cast>(runOnAndroidMainThread(func, timeout)); + } +#endif +}; +#endif +} + +QT_END_NAMESPACE + +#endif // QCOREAPPLICATION_PLATFORM_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcoreevent.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcoreevent.h new file mode 100644 index 0000000000000000000000000000000000000000..9bdd2819878a4867641c81c98c973c3cc26a9656 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcoreevent.h @@ -0,0 +1,410 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCOREEVENT_H +#define QCOREEVENT_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#define Q_EVENT_DISABLE_COPY(Class) \ +protected: \ + Class(const Class &) = default; \ + Class(Class &&) = delete; \ + Class &operator=(const Class &other) = default; \ + Class &operator=(Class &&) = delete + +#define Q_DECL_EVENT_COMMON(Class) \ + protected: \ + Class(const Class &); \ + Class(Class &&) = delete; \ + Class &operator=(const Class &other) = default; \ + Class &operator=(Class &&) = delete; \ + public: \ + Class* clone() const override; \ + ~Class() override; \ + private: + +#define Q_IMPL_EVENT_COMMON(Class) \ + Class::Class(const Class &) = default; \ + Class::~Class() = default; \ + Class* Class::clone() const \ + { \ + auto c = new Class(*this); \ + [[maybe_unused]] QEvent *e = c; \ + /* check that covariant return is safe to add */ \ + Q_ASSERT(reinterpret_cast(c) == reinterpret_cast(e)); \ + return c; \ + } + +class QEventPrivate; +class Q_CORE_EXPORT QEvent // event base class +{ + Q_GADGET + QDOC_PROPERTY(bool accepted READ isAccepted WRITE setAccepted) + + Q_EVENT_DISABLE_COPY(QEvent); +public: + enum Type { + /* + If you get a strange compiler error on the line with None, + it's probably because you're also including X11 headers, + which #define the symbol None. Put the X11 includes after + the Qt includes to solve this problem. + */ + None = 0, // invalid event + Timer = 1, // timer event + MouseButtonPress = 2, // mouse button pressed + MouseButtonRelease = 3, // mouse button released + MouseButtonDblClick = 4, // mouse button double click + MouseMove = 5, // mouse move + KeyPress = 6, // key pressed + KeyRelease = 7, // key released + FocusIn = 8, // keyboard focus received + FocusOut = 9, // keyboard focus lost + FocusAboutToChange = 23, // keyboard focus is about to be lost + Enter = 10, // mouse enters widget + Leave = 11, // mouse leaves widget + Paint = 12, // paint widget + Move = 13, // move widget + Resize = 14, // resize widget + Create = 15, // after widget creation + Destroy = 16, // during widget destruction + Show = 17, // widget is shown + Hide = 18, // widget is hidden + Close = 19, // request to close widget + Quit = 20, // request to quit application + ParentChange = 21, // object has been reparented + ParentAboutToChange = 131, // sent just before the parent change is done + ThreadChange = 22, // object has changed threads + WindowActivate = 24, // window was activated + WindowDeactivate = 25, // window was deactivated + ShowToParent = 26, // widget is shown to parent + HideToParent = 27, // widget is hidden to parent + Wheel = 31, // wheel event + WindowTitleChange = 33, // window title changed + WindowIconChange = 34, // icon changed + ApplicationWindowIconChange = 35, // application icon changed + ApplicationFontChange = 36, // application font changed + ApplicationLayoutDirectionChange = 37, // application layout direction changed + ApplicationPaletteChange = 38, // application palette changed + PaletteChange = 39, // widget palette changed + Clipboard = 40, // internal clipboard event + Speech = 42, // reserved for speech input + MetaCall = 43, // meta call event + SockAct = 50, // socket activation + WinEventAct = 132, // win event activation + DeferredDelete = 52, // deferred delete event + DragEnter = 60, // drag moves into widget + DragMove = 61, // drag moves in widget + DragLeave = 62, // drag leaves or is cancelled + Drop = 63, // actual drop + DragResponse = 64, // drag accepted/rejected + ChildAdded = 68, // new child widget + ChildPolished = 69, // polished child widget + ChildRemoved = 71, // deleted child widget + ShowWindowRequest = 73, // widget's window should be mapped + PolishRequest = 74, // widget should be polished + Polish = 75, // widget is polished + LayoutRequest = 76, // widget should be relayouted + UpdateRequest = 77, // widget should be repainted + UpdateLater = 78, // request update() later + + EmbeddingControl = 79, // ActiveX embedding + ActivateControl = 80, // ActiveX activation + DeactivateControl = 81, // ActiveX deactivation + ContextMenu = 82, // context popup menu + InputMethod = 83, // input method + TabletMove = 87, // Wacom tablet event + LocaleChange = 88, // the system locale changed + LanguageChange = 89, // the application language changed + LayoutDirectionChange = 90, // the layout direction changed + Style = 91, // internal style event + TabletPress = 92, // tablet press + TabletRelease = 93, // tablet release + OkRequest = 94, // CE (Ok) button pressed + HelpRequest = 95, // CE (?) button pressed + + IconDrag = 96, // proxy icon dragged + + FontChange = 97, // font has changed + EnabledChange = 98, // enabled state has changed + ActivationChange = 99, // window activation has changed + StyleChange = 100, // style has changed + IconTextChange = 101, // icon text has changed. Deprecated. + ModifiedChange = 102, // modified state has changed + MouseTrackingChange = 109, // mouse tracking state has changed + + WindowBlocked = 103, // window is about to be blocked modally + WindowUnblocked = 104, // windows modal blocking has ended + WindowStateChange = 105, + + ReadOnlyChange = 106, // readonly state has changed + + ToolTip = 110, + WhatsThis = 111, + StatusTip = 112, + + ActionChanged = 113, + ActionAdded = 114, + ActionRemoved = 115, + + FileOpen = 116, // file open request + + Shortcut = 117, // shortcut triggered + ShortcutOverride = 51, // shortcut override request + + WhatsThisClicked = 118, + + ToolBarChange = 120, // toolbar visibility toggled + + ApplicationActivate = 121, // deprecated. Use ApplicationStateChange instead. + ApplicationActivated = ApplicationActivate, // deprecated + ApplicationDeactivate = 122, // deprecated. Use ApplicationStateChange instead. + ApplicationDeactivated = ApplicationDeactivate, // deprecated + + QueryWhatsThis = 123, // query what's this widget help + EnterWhatsThisMode = 124, + LeaveWhatsThisMode = 125, + + ZOrderChange = 126, // child widget has had its z-order changed + + HoverEnter = 127, // mouse cursor enters a hover widget + HoverLeave = 128, // mouse cursor leaves a hover widget + HoverMove = 129, // mouse cursor move inside a hover widget + + // last event id used = 132 + +#ifdef QT_KEYPAD_NAVIGATION + EnterEditFocus = 150, // enter edit mode in keypad navigation + LeaveEditFocus = 151, // enter edit mode in keypad navigation +#endif + AcceptDropsChange = 152, + + ZeroTimerEvent = 154, // Used for Windows Zero timer events + + GraphicsSceneMouseMove = 155, // GraphicsView + GraphicsSceneMousePress = 156, + GraphicsSceneMouseRelease = 157, + GraphicsSceneMouseDoubleClick = 158, + GraphicsSceneContextMenu = 159, + GraphicsSceneHoverEnter = 160, + GraphicsSceneHoverMove = 161, + GraphicsSceneHoverLeave = 162, + GraphicsSceneHelp = 163, + GraphicsSceneDragEnter = 164, + GraphicsSceneDragMove = 165, + GraphicsSceneDragLeave = 166, + GraphicsSceneDrop = 167, + GraphicsSceneWheel = 168, + GraphicsSceneLeave = 220, + + KeyboardLayoutChange = 169, // keyboard layout changed + + DynamicPropertyChange = 170, // A dynamic property was changed through setProperty/property + + TabletEnterProximity = 171, + TabletLeaveProximity = 172, + + NonClientAreaMouseMove = 173, + NonClientAreaMouseButtonPress = 174, + NonClientAreaMouseButtonRelease = 175, + NonClientAreaMouseButtonDblClick = 176, + + MacSizeChange = 177, // when the Qt::WA_Mac{Normal,Small,Mini}Size changes + + ContentsRectChange = 178, // sent by QWidget::setContentsMargins (internal) + + MacGLWindowChange = 179, // Internal! the window of the GLWidget has changed + + FutureCallOut = 180, + + GraphicsSceneResize = 181, + GraphicsSceneMove = 182, + + CursorChange = 183, + ToolTipChange = 184, + + NetworkReplyUpdated = 185, // Internal for QNetworkReply + + GrabMouse = 186, + UngrabMouse = 187, + GrabKeyboard = 188, + UngrabKeyboard = 189, + + StateMachineSignal = 192, + StateMachineWrapped = 193, + + TouchBegin = 194, + TouchUpdate = 195, + TouchEnd = 196, + +#ifndef QT_NO_GESTURES + NativeGesture = 197, // QtGui native gesture +#endif + RequestSoftwareInputPanel = 199, + CloseSoftwareInputPanel = 200, + + WinIdChange = 203, +#ifndef QT_NO_GESTURES + Gesture = 198, + GestureOverride = 202, +#endif + ScrollPrepare = 204, + Scroll = 205, + + Expose = 206, + + InputMethodQuery = 207, + OrientationChange = 208, // Screen orientation has changed + + TouchCancel = 209, + + ThemeChange = 210, + + SockClose = 211, // socket closed + + PlatformPanel = 212, + + StyleAnimationUpdate = 213, // style animation target should be updated + ApplicationStateChange = 214, + + WindowChangeInternal = 215, // internal for QQuickWidget and texture-based widgets + ScreenChangeInternal = 216, + + PlatformSurface = 217, // Platform surface created or about to be destroyed + + Pointer = 218, // Qt 5: QQuickPointerEvent; Qt 6: unused so far + + TabletTrackingChange = 219, // tablet tracking state has changed + + // GraphicsSceneLeave = 220, + WindowAboutToChangeInternal = 221, // internal for QQuickWidget and texture-based widgets + + DevicePixelRatioChange = 222, + + ChildWindowAdded = 223, + ChildWindowRemoved = 224, + ParentWindowAboutToChange = 225, + ParentWindowChange = 226, + + // 512 reserved for Qt Jambi's MetaCall event + // 513 reserved for Qt Jambi's DeleteOnMainThread event + + User = 1000, // first user event id + MaxUser = 65535 // last user event id + }; + Q_ENUM(Type) + + explicit QEvent(Type type); + virtual ~QEvent(); + inline Type type() const { return static_cast(t); } + inline bool spontaneous() const { return m_spont; } + + inline virtual void setAccepted(bool accepted) { m_accept = accepted; } + inline bool isAccepted() const { return m_accept; } + + inline void accept() { m_accept = true; } + inline void ignore() { m_accept = false; } + + inline bool isInputEvent() const noexcept { return m_inputEvent; } + inline bool isPointerEvent() const noexcept { return m_pointerEvent; } + inline bool isSinglePointEvent() const noexcept { return m_singlePointEvent; } + + static int registerEventType(int hint = -1) noexcept; + + virtual QEvent *clone() const; + +protected: + QT_DEFINE_TAG_STRUCT(InputEventTag); + QEvent(Type type, InputEventTag) : QEvent(type) { m_inputEvent = true; } + QT_DEFINE_TAG_STRUCT(PointerEventTag); + QEvent(Type type, PointerEventTag) : QEvent(type, InputEventTag{}) { m_pointerEvent = true; } + QT_DEFINE_TAG_STRUCT(SinglePointEventTag); + QEvent(Type type, SinglePointEventTag) : QEvent(type, PointerEventTag{}) { m_singlePointEvent = true; } + quint16 t; + +private: + /* + We can assume that C++ types are 8-byte aligned, and we can't assume that compilers + coalesce data members from subclasses. Use bitfields to fill up to next 8-byte + aligned size, which is 16 bytes. That way we don't waste memory, and have plenty of room + for future flags. + Don't use bitfields for the most important flags, as that would generate more code, and + access is always inline. Bytes used are: + 8 vptr + 2 type + 3 bool flags => 3 bytes left, so 24 bits. However, compilers will word- + align the quint16s after the bools, so add another unused bool to fill that gap, which + leaves us with 16 bits. + */ + bool m_posted = false; + bool m_spont = false; + bool m_accept = true; + bool m_unused = false; + quint16 m_reserved : 13; + quint16 m_inputEvent : 1; + quint16 m_pointerEvent : 1; + quint16 m_singlePointEvent : 1; + + friend class QCoreApplication; + friend class QCoreApplicationPrivate; + friend class QThreadData; + friend class QApplication; + friend class QGraphicsScenePrivate; + // from QtTest: + // QtWebEngine event handling requires forwarding events as spontaneous. + // Impersonated QSpontaneKeyEvent in QtWebEngine to handle such cases. + friend class QSpontaneKeyEvent; + // needs this: + Q_ALWAYS_INLINE + void setSpontaneous() { m_spont = true; } +}; + +class Q_CORE_EXPORT QTimerEvent : public QEvent +{ + Q_DECL_EVENT_COMMON(QTimerEvent) +public: + explicit QTimerEvent(int timerId); + explicit QTimerEvent(Qt::TimerId timerId); + + int timerId() const { return qToUnderlying(id()); } + Qt::TimerId id() const { return m_id; } + +protected: + Qt::TimerId m_id; +}; + +class QObject; + +class Q_CORE_EXPORT QChildEvent : public QEvent +{ + Q_DECL_EVENT_COMMON(QChildEvent) +public: + QChildEvent(Type type, QObject *child); + + QObject *child() const { return c; } + bool added() const { return type() == ChildAdded; } + bool polished() const { return type() == ChildPolished; } + bool removed() const { return type() == ChildRemoved; } + +protected: + QObject *c; +}; + +class Q_CORE_EXPORT QDynamicPropertyChangeEvent : public QEvent +{ + Q_DECL_EVENT_COMMON(QDynamicPropertyChangeEvent) +public: + explicit QDynamicPropertyChangeEvent(const QByteArray &name); + + inline QByteArray propertyName() const { return n; } + +private: + QByteArray n; +}; + +QT_END_NAMESPACE + +#endif // QCOREEVENT_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qcryptographichash.h b/qt/6.8.1/msvc2022_64/include/QtCore/qcryptographichash.h new file mode 100644 index 0000000000000000000000000000000000000000..28602f7a6a61ff1267335be65df092b021f9d2fd --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qcryptographichash.h @@ -0,0 +1,117 @@ +// Copyright (C) 2021 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2013 Richard J. Moore . +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QCRYPTOGRAPHICHASH_H +#define QCRYPTOGRAPHICHASH_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + + +class QCryptographicHashPrivate; +class QIODevice; + +class Q_CORE_EXPORT QCryptographicHash +{ + Q_GADGET +public: + enum Algorithm { +#ifndef QT_CRYPTOGRAPHICHASH_ONLY_SHA1 + Md4, + Md5, +#endif + Sha1 = 2, +#ifndef QT_CRYPTOGRAPHICHASH_ONLY_SHA1 + Sha224, + Sha256, + Sha384, + Sha512, + + Keccak_224 = 7, + Keccak_256, + Keccak_384, + Keccak_512, + RealSha3_224 = 11, + RealSha3_256, + RealSha3_384, + RealSha3_512, +# ifndef QT_SHA3_KECCAK_COMPAT + Sha3_224 = RealSha3_224, + Sha3_256 = RealSha3_256, + Sha3_384 = RealSha3_384, + Sha3_512 = RealSha3_512, +# else + Sha3_224 = Keccak_224, + Sha3_256 = Keccak_256, + Sha3_384 = Keccak_384, + Sha3_512 = Keccak_512, +# endif + + Blake2b_160 = 15, + Blake2b_256, + Blake2b_384, + Blake2b_512, + Blake2s_128, + Blake2s_160, + Blake2s_224, + Blake2s_256, +#endif + NumAlgorithms + }; + Q_ENUM(Algorithm) + + explicit QCryptographicHash(Algorithm method); + QCryptographicHash(QCryptographicHash &&other) noexcept : d(std::exchange(other.d, nullptr)) {} + ~QCryptographicHash(); + + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QCryptographicHash) + void swap(QCryptographicHash &other) noexcept { qt_ptr_swap(d, other.d); } + + void reset() noexcept; + [[nodiscard]] Algorithm algorithm() const noexcept; + +#if QT_DEPRECATED_SINCE(6, 4) + QT_DEPRECATED_VERSION_X_6_4("Use the QByteArrayView overload instead") + void addData(const char *data, qsizetype length); +#endif +#if QT_CORE_REMOVED_SINCE(6, 3) + void addData(const QByteArray &data); +#endif + void addData(QByteArrayView data) noexcept; + bool addData(QIODevice *device); + + QByteArray result() const; + QByteArrayView resultView() const noexcept; + +#if QT_CORE_REMOVED_SINCE(6, 3) + static QByteArray hash(const QByteArray &data, Algorithm method); +#endif + static QByteArray hash(QByteArrayView data, Algorithm method); + + static QByteArrayView hashInto(QSpan buffer, QByteArrayView data, Algorithm method) noexcept + { return hashInto(as_writable_bytes(buffer), {&data, 1}, method); } + static QByteArrayView hashInto(QSpan buffer, QByteArrayView data, Algorithm method) noexcept + { return hashInto(as_writable_bytes(buffer), {&data, 1}, method); } + static QByteArrayView hashInto(QSpan buffer, QByteArrayView data, Algorithm method) noexcept + { return hashInto(buffer, {&data, 1}, method); } + static QByteArrayView hashInto(QSpan buffer, QSpan data, Algorithm method) noexcept + { return hashInto(as_writable_bytes(buffer), data, method); } + static QByteArrayView hashInto(QSpan buffer, QSpan data, Algorithm method) noexcept + { return hashInto(as_writable_bytes(buffer), data, method); } + static QByteArrayView hashInto(QSpan buffer, QSpan data, Algorithm method) noexcept; + + static int hashLength(Algorithm method); + static bool supportsAlgorithm(Algorithm method); +private: + Q_DISABLE_COPY(QCryptographicHash) + QCryptographicHashPrivate *d; +}; + +QT_END_NAMESPACE + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qdarwinhelpers.h b/qt/6.8.1/msvc2022_64/include/QtCore/qdarwinhelpers.h new file mode 100644 index 0000000000000000000000000000000000000000..b7d8ef0cd5fcfecf250cd12acb0e5ec12d215a2b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qdarwinhelpers.h @@ -0,0 +1,37 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTDARWINHELPERS_H +#define QTDARWINHELPERS_H + +#if 0 +#pragma qt_class(QtDarwinHelpers) +#pragma qt_sync_stop_processing +#endif + +/* + Utility macros and inline functions +*/ + +#ifndef Q_FORWARD_DECLARE_OBJC_CLASS +# ifdef __OBJC__ +# define Q_FORWARD_DECLARE_OBJC_CLASS(classname) @class classname +# else +# define Q_FORWARD_DECLARE_OBJC_CLASS(classname) class classname +# endif +#endif +#ifndef Q_FORWARD_DECLARE_CF_TYPE +# define Q_FORWARD_DECLARE_CF_TYPE(type) typedef const struct __ ## type * type ## Ref +#endif +#ifndef Q_FORWARD_DECLARE_MUTABLE_CF_TYPE +# define Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(type) typedef struct __ ## type * type ## Ref +#endif +#ifndef Q_FORWARD_DECLARE_CG_TYPE +# define Q_FORWARD_DECLARE_CG_TYPE(type) typedef const struct type *type##Ref +#endif +#ifndef Q_FORWARD_DECLARE_MUTABLE_CG_TYPE +# define Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(type) typedef struct type *type##Ref +#endif + + +#endif // QTDARWINHELPERS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qdatastream.h b/qt/6.8.1/msvc2022_64/include/QtCore/qdatastream.h new file mode 100644 index 0000000000000000000000000000000000000000..6c1f31ef7baa408af0b4f5e2b9526ca44504f87e --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qdatastream.h @@ -0,0 +1,691 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QDATASTREAM_H +#define QDATASTREAM_H + +#include +#include +#include +#include +#include + +#include // std::distance(), std::next() + +#ifdef Status +#error qdatastream.h must be included before any header file that defines Status +#endif + +QT_BEGIN_NAMESPACE + +#if QT_CORE_REMOVED_SINCE(6, 3) +class qfloat16; +#endif +class QByteArray; +class QDataStream; +class QIODevice; +class QString; + +#if !defined(QT_NO_DATASTREAM) +class QDataStreamPrivate; +namespace QtPrivate { +class StreamStateSaver; +template +QDataStream &readArrayBasedContainer(QDataStream &s, Container &c); +template +QDataStream &readListBasedContainer(QDataStream &s, Container &c); +template +QDataStream &readAssociativeContainer(QDataStream &s, Container &c); +template +QDataStream &writeSequentialContainer(QDataStream &s, const Container &c); +template +QDataStream &writeAssociativeContainer(QDataStream &s, const Container &c); +template +QDataStream &writeAssociativeMultiContainer(QDataStream &s, const Container &c); +} +class Q_CORE_EXPORT QDataStream : public QIODeviceBase +{ +public: + enum Version QT7_ONLY(: quint8) { + Qt_1_0 = 1, + Qt_2_0 = 2, + Qt_2_1 = 3, + Qt_3_0 = 4, + Qt_3_1 = 5, + Qt_3_3 = 6, + Qt_4_0 = 7, + Qt_4_1 = Qt_4_0, + Qt_4_2 = 8, + Qt_4_3 = 9, + Qt_4_4 = 10, + Qt_4_5 = 11, + Qt_4_6 = 12, + Qt_4_7 = Qt_4_6, + Qt_4_8 = Qt_4_7, + Qt_4_9 = Qt_4_8, + Qt_5_0 = 13, + Qt_5_1 = 14, + Qt_5_2 = 15, + Qt_5_3 = Qt_5_2, + Qt_5_4 = 16, + Qt_5_5 = Qt_5_4, + Qt_5_6 = 17, + Qt_5_7 = Qt_5_6, + Qt_5_8 = Qt_5_7, + Qt_5_9 = Qt_5_8, + Qt_5_10 = Qt_5_9, + Qt_5_11 = Qt_5_10, + Qt_5_12 = 18, + Qt_5_13 = 19, + Qt_5_14 = Qt_5_13, + Qt_5_15 = Qt_5_14, + Qt_6_0 = 20, + Qt_6_1 = Qt_6_0, + Qt_6_2 = Qt_6_0, + Qt_6_3 = Qt_6_0, + Qt_6_4 = Qt_6_0, + Qt_6_5 = Qt_6_0, + Qt_6_6 = 21, + Qt_6_7 = 22, + Qt_6_8 = Qt_6_7, + Qt_DefaultCompiledVersion = Qt_6_8 +#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0) +#error Add the datastream version for this Qt version and update Qt_DefaultCompiledVersion +#endif + }; + + enum ByteOrder { + BigEndian = QSysInfo::BigEndian, + LittleEndian = QSysInfo::LittleEndian + }; + + enum Status QT7_ONLY(: quint8) { + Ok, + ReadPastEnd, + ReadCorruptData, + WriteFailed, + SizeLimitExceeded, + }; + + enum FloatingPointPrecision QT7_ONLY(: quint8) { + SinglePrecision, + DoublePrecision + }; + + QDataStream(); + explicit QDataStream(QIODevice *); + QDataStream(QByteArray *, OpenMode flags); + QDataStream(const QByteArray &); + ~QDataStream(); + + QIODevice *device() const; + void setDevice(QIODevice *); + + bool atEnd() const; + + QT_CORE_INLINE_SINCE(6, 8) + Status status() const; + void setStatus(Status status); + void resetStatus(); + + QT_CORE_INLINE_SINCE(6, 8) + FloatingPointPrecision floatingPointPrecision() const; + void setFloatingPointPrecision(FloatingPointPrecision precision); + + ByteOrder byteOrder() const; + void setByteOrder(ByteOrder); + + int version() const; + void setVersion(int); + + QDataStream &operator>>(char &i); + QDataStream &operator>>(qint8 &i); + QDataStream &operator>>(quint8 &i); + QDataStream &operator>>(qint16 &i); + QDataStream &operator>>(quint16 &i); + QDataStream &operator>>(qint32 &i); + inline QDataStream &operator>>(quint32 &i); + QDataStream &operator>>(qint64 &i); + QDataStream &operator>>(quint64 &i); + QDataStream &operator>>(std::nullptr_t &ptr) { ptr = nullptr; return *this; } + + QDataStream &operator>>(bool &i); +#if QT_CORE_REMOVED_SINCE(6, 3) + QDataStream &operator>>(qfloat16 &f); +#endif + QDataStream &operator>>(float &f); + QDataStream &operator>>(double &f); + QDataStream &operator>>(char *&str); + QDataStream &operator>>(char16_t &c); + QDataStream &operator>>(char32_t &c); + + QDataStream &operator<<(char i); + QDataStream &operator<<(qint8 i); + QDataStream &operator<<(quint8 i); + QDataStream &operator<<(qint16 i); + QDataStream &operator<<(quint16 i); + QDataStream &operator<<(qint32 i); + inline QDataStream &operator<<(quint32 i); + QDataStream &operator<<(qint64 i); + QDataStream &operator<<(quint64 i); + QDataStream &operator<<(std::nullptr_t) { return *this; } +#if QT_CORE_REMOVED_SINCE(6, 8) || defined(Q_QDOC) + QDataStream &operator<<(bool i); +#endif +#if !defined(Q_QDOC) + // Disable implicit conversions to bool (e.g. for pointers) + template , bool> = true> + QDataStream &operator<<(T i) + { + return (*this << qint8(i)); + } +#endif +#if QT_CORE_REMOVED_SINCE(6, 3) + QDataStream &operator<<(qfloat16 f); +#endif + QDataStream &operator<<(float f); + QDataStream &operator<<(double f); + QDataStream &operator<<(const char *str); + QDataStream &operator<<(char16_t c); + QDataStream &operator<<(char32_t c); + +#if QT_DEPRECATED_SINCE(6, 11) + QT_DEPRECATED_VERSION_X_6_11("Use an overload that takes qint64 length.") + QDataStream &readBytes(char *&, uint &len); +#endif +#if QT_CORE_REMOVED_SINCE(6, 7) + QDataStream &writeBytes(const char *, uint len); + int skipRawData(int len); + int readRawData(char *, int len); + int writeRawData(const char *, int len); +#endif + QDataStream &readBytes(char *&, qint64 &len); + qint64 readRawData(char *, qint64 len); + QDataStream &writeBytes(const char *, qint64 len); + qint64 writeRawData(const char *, qint64 len); + qint64 skipRawData(qint64 len); + + void startTransaction(); + bool commitTransaction(); + void rollbackTransaction(); + void abortTransaction(); + + bool isDeviceTransactionStarted() const; +private: + Q_DISABLE_COPY(QDataStream) + + QScopedPointer d; + + QIODevice *dev = nullptr; + bool owndev = false; + bool noswap = QSysInfo::ByteOrder == QSysInfo::BigEndian; + quint8 fpPrecision = QDataStream::DoublePrecision; + quint8 q_status = Ok; +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED) + ByteOrder byteorder = BigEndian; + int ver = Qt_DefaultCompiledVersion; +#else + Version ver = Qt_DefaultCompiledVersion; +#endif + quint16 transactionDepth = 0; + +#if QT_CORE_REMOVED_SINCE(6, 7) + int readBlock(char *data, int len); +#endif + qint64 readBlock(char *data, qint64 len); + static inline qint64 readQSizeType(QDataStream &s); + static inline bool writeQSizeType(QDataStream &s, qint64 value); + static constexpr quint32 NullCode = 0xffffffffu; + static constexpr quint32 ExtendedSize = 0xfffffffeu; + + friend class QtPrivate::StreamStateSaver; + Q_CORE_EXPORT friend QDataStream &operator<<(QDataStream &out, const QString &str); + Q_CORE_EXPORT friend QDataStream &operator>>(QDataStream &in, QString &str); + Q_CORE_EXPORT friend QDataStream &operator<<(QDataStream &out, const QByteArray &ba); + Q_CORE_EXPORT friend QDataStream &operator>>(QDataStream &in, QByteArray &ba); + template + friend QDataStream &QtPrivate::readArrayBasedContainer(QDataStream &s, Container &c); + template + friend QDataStream &QtPrivate::readListBasedContainer(QDataStream &s, Container &c); + template + friend QDataStream &QtPrivate::readAssociativeContainer(QDataStream &s, Container &c); + template + friend QDataStream &QtPrivate::writeSequentialContainer(QDataStream &s, const Container &c); + template + friend QDataStream &QtPrivate::writeAssociativeContainer(QDataStream &s, const Container &c); + template + friend QDataStream &QtPrivate::writeAssociativeMultiContainer(QDataStream &s, + const Container &c); +}; + +namespace QtPrivate { + +class StreamStateSaver +{ + Q_DISABLE_COPY_MOVE(StreamStateSaver) +public: + inline StreamStateSaver(QDataStream *s) : stream(s), oldStatus(s->status()) + { + if (!stream->isDeviceTransactionStarted()) + stream->resetStatus(); + } + inline ~StreamStateSaver() + { + if (oldStatus != QDataStream::Ok) { + stream->resetStatus(); + stream->setStatus(oldStatus); + } + } + +private: + QDataStream *stream; + QDataStream::Status oldStatus; +}; + +template +QDataStream &readArrayBasedContainer(QDataStream &s, Container &c) +{ + StreamStateSaver stateSaver(&s); + + c.clear(); + qint64 size = QDataStream::readQSizeType(s); + qsizetype n = size; + if (size != n || size < 0) { + s.setStatus(QDataStream::SizeLimitExceeded); + return s; + } + c.reserve(n); + for (qsizetype i = 0; i < n; ++i) { + typename Container::value_type t; + s >> t; + if (s.status() != QDataStream::Ok) { + c.clear(); + break; + } + c.append(t); + } + + return s; +} + +template +QDataStream &readListBasedContainer(QDataStream &s, Container &c) +{ + StreamStateSaver stateSaver(&s); + + c.clear(); + qint64 size = QDataStream::readQSizeType(s); + qsizetype n = size; + if (size != n || size < 0) { + s.setStatus(QDataStream::SizeLimitExceeded); + return s; + } + for (qsizetype i = 0; i < n; ++i) { + typename Container::value_type t; + s >> t; + if (s.status() != QDataStream::Ok) { + c.clear(); + break; + } + c << t; + } + + return s; +} + +template +QDataStream &readAssociativeContainer(QDataStream &s, Container &c) +{ + StreamStateSaver stateSaver(&s); + + c.clear(); + qint64 size = QDataStream::readQSizeType(s); + qsizetype n = size; + if (size != n || size < 0) { + s.setStatus(QDataStream::SizeLimitExceeded); + return s; + } + for (qsizetype i = 0; i < n; ++i) { + typename Container::key_type k; + typename Container::mapped_type t; + s >> k >> t; + if (s.status() != QDataStream::Ok) { + c.clear(); + break; + } + c.insert(k, t); + } + + return s; +} + +template +QDataStream &writeSequentialContainer(QDataStream &s, const Container &c) +{ + if (!QDataStream::writeQSizeType(s, c.size())) + return s; + for (const typename Container::value_type &t : c) + s << t; + + return s; +} + +template +QDataStream &writeAssociativeContainer(QDataStream &s, const Container &c) +{ + if (!QDataStream::writeQSizeType(s, c.size())) + return s; + auto it = c.constBegin(); + auto end = c.constEnd(); + while (it != end) { + s << it.key() << it.value(); + ++it; + } + + return s; +} + +template +QDataStream &writeAssociativeMultiContainer(QDataStream &s, const Container &c) +{ + if (!QDataStream::writeQSizeType(s, c.size())) + return s; + auto it = c.constBegin(); + auto end = c.constEnd(); + while (it != end) { + const auto rangeStart = it++; + while (it != end && rangeStart.key() == it.key()) + ++it; + const qint64 last = std::distance(rangeStart, it) - 1; + for (qint64 i = last; i >= 0; --i) { + auto next = std::next(rangeStart, i); + s << next.key() << next.value(); + } + } + + return s; +} + +} // QtPrivate namespace + +template +using QDataStreamIfHasOStreamOperators = + std::enable_if_t...>, QDataStream &>; +template +using QDataStreamIfHasOStreamOperatorsContainer = + std::enable_if_t...>, QDataStream &>; + +template +using QDataStreamIfHasIStreamOperators = + std::enable_if_t...>, QDataStream &>; +template +using QDataStreamIfHasIStreamOperatorsContainer = + std::enable_if_t...>, QDataStream &>; + +/***************************************************************************** + QDataStream inline functions + *****************************************************************************/ + +inline QIODevice *QDataStream::device() const +{ return dev; } + +#if QT_CORE_INLINE_IMPL_SINCE(6, 8) +QDataStream::Status QDataStream::status() const +{ + return Status(q_status); +} + +QDataStream::FloatingPointPrecision QDataStream::floatingPointPrecision() const +{ + return FloatingPointPrecision(fpPrecision); +} +#endif // INLINE_SINCE 6.8 + +inline QDataStream::ByteOrder QDataStream::byteOrder() const +{ + if constexpr (QSysInfo::ByteOrder == QSysInfo::BigEndian) + return noswap ? BigEndian : LittleEndian; + return noswap ? LittleEndian : BigEndian; +} + +inline int QDataStream::version() const +{ return ver; } + +inline void QDataStream::setVersion(int v) +{ ver = Version(v); } + +qint64 QDataStream::readQSizeType(QDataStream &s) +{ + quint32 first; + s >> first; + if (first == NullCode) + return -1; + if (first < ExtendedSize || s.version() < QDataStream::Qt_6_7) + return qint64(first); + qint64 extendedLen; + s >> extendedLen; + return extendedLen; +} + +bool QDataStream::writeQSizeType(QDataStream &s, qint64 value) +{ + if (value < qint64(ExtendedSize)) { + s << quint32(value); + } else if (s.version() >= QDataStream::Qt_6_7) { + s << ExtendedSize << value; + } else if (value == qint64(ExtendedSize)) { + s << ExtendedSize; + } else { + s.setStatus(QDataStream::SizeLimitExceeded); // value is too big for old format + return false; + } + return true; +} + +inline QDataStream &QDataStream::operator>>(char &i) +{ return *this >> reinterpret_cast(i); } + +inline QDataStream &QDataStream::operator>>(quint8 &i) +{ return *this >> reinterpret_cast(i); } + +inline QDataStream &QDataStream::operator>>(quint16 &i) +{ return *this >> reinterpret_cast(i); } + +inline QDataStream &QDataStream::operator>>(quint32 &i) +{ return *this >> reinterpret_cast(i); } + +inline QDataStream &QDataStream::operator>>(quint64 &i) +{ return *this >> reinterpret_cast(i); } + +inline QDataStream &QDataStream::operator<<(char i) +{ return *this << qint8(i); } + +inline QDataStream &QDataStream::operator<<(quint8 i) +{ return *this << qint8(i); } + +inline QDataStream &QDataStream::operator<<(quint16 i) +{ return *this << qint16(i); } + +inline QDataStream &QDataStream::operator<<(quint32 i) +{ return *this << qint32(i); } + +inline QDataStream &QDataStream::operator<<(quint64 i) +{ return *this << qint64(i); } + +template +inline QDataStream &operator<<(QDataStream &s, QFlags e) +{ return s << typename QFlags::Int(e); } + +template +inline QDataStream &operator>>(QDataStream &s, QFlags &e) +{ + typename QFlags::Int i; + s >> i; + e = QFlag(i); + return s; +} + +template +typename std::enable_if_t::value, QDataStream &> +operator<<(QDataStream &s, const T &t) +{ return s << static_cast::type>(t); } + +template +typename std::enable_if_t::value, QDataStream &> +operator>>(QDataStream &s, T &t) +{ return s >> reinterpret_cast::type &>(t); } + +#ifndef Q_QDOC + +template +inline QDataStreamIfHasIStreamOperatorsContainer, T> operator>>(QDataStream &s, QList &v) +{ + return QtPrivate::readArrayBasedContainer(s, v); +} + +template +inline QDataStreamIfHasOStreamOperatorsContainer, T> operator<<(QDataStream &s, const QList &v) +{ + return QtPrivate::writeSequentialContainer(s, v); +} + +template +inline QDataStreamIfHasIStreamOperatorsContainer, T> operator>>(QDataStream &s, QSet &set) +{ + return QtPrivate::readListBasedContainer(s, set); +} + +template +inline QDataStreamIfHasOStreamOperatorsContainer, T> operator<<(QDataStream &s, const QSet &set) +{ + return QtPrivate::writeSequentialContainer(s, set); +} + +template +inline QDataStreamIfHasIStreamOperatorsContainer, Key, T> operator>>(QDataStream &s, QHash &hash) +{ + return QtPrivate::readAssociativeContainer(s, hash); +} + +template + +inline QDataStreamIfHasOStreamOperatorsContainer, Key, T> operator<<(QDataStream &s, const QHash &hash) +{ + return QtPrivate::writeAssociativeContainer(s, hash); +} + +template +inline QDataStreamIfHasIStreamOperatorsContainer, Key, T> operator>>(QDataStream &s, QMultiHash &hash) +{ + return QtPrivate::readAssociativeContainer(s, hash); +} + +template +inline QDataStreamIfHasOStreamOperatorsContainer, Key, T> operator<<(QDataStream &s, const QMultiHash &hash) +{ + return QtPrivate::writeAssociativeMultiContainer(s, hash); +} + +template +inline QDataStreamIfHasIStreamOperatorsContainer, Key, T> operator>>(QDataStream &s, QMap &map) +{ + return QtPrivate::readAssociativeContainer(s, map); +} + +template +inline QDataStreamIfHasOStreamOperatorsContainer, Key, T> operator<<(QDataStream &s, const QMap &map) +{ + return QtPrivate::writeAssociativeContainer(s, map); +} + +template +inline QDataStreamIfHasIStreamOperatorsContainer, Key, T> operator>>(QDataStream &s, QMultiMap &map) +{ + return QtPrivate::readAssociativeContainer(s, map); +} + +template +inline QDataStreamIfHasOStreamOperatorsContainer, Key, T> operator<<(QDataStream &s, const QMultiMap &map) +{ + return QtPrivate::writeAssociativeMultiContainer(s, map); +} + +template +inline QDataStreamIfHasIStreamOperators operator>>(QDataStream& s, std::pair &p) +{ + s >> p.first >> p.second; + return s; +} + +template +inline QDataStreamIfHasOStreamOperators operator<<(QDataStream& s, const std::pair &p) +{ + s << p.first << p.second; + return s; +} + +#else + +template +QDataStream &operator>>(QDataStream &s, QList &l); + +template +QDataStream &operator<<(QDataStream &s, const QList &l); + +template +QDataStream &operator>>(QDataStream &s, QSet &set); + +template +QDataStream &operator<<(QDataStream &s, const QSet &set); + +template +QDataStream &operator>>(QDataStream &s, QHash &hash); + +template +QDataStream &operator<<(QDataStream &s, const QHash &hash); + +template +QDataStream &operator>>(QDataStream &s, QMultiHash &hash); + +template +QDataStream &operator<<(QDataStream &s, const QMultiHash &hash); + +template +QDataStream &operator>>(QDataStream &s, QMap &map); + +template +QDataStream &operator<<(QDataStream &s, const QMap &map); + +template +QDataStream &operator>>(QDataStream &s, QMultiMap &map); + +template +QDataStream &operator<<(QDataStream &s, const QMultiMap &map); + +template +QDataStream &operator>>(QDataStream& s, std::pair &p); + +template +QDataStream &operator<<(QDataStream& s, const std::pair &p); + +#endif // Q_QDOC + +inline QDataStream &operator>>(QDataStream &s, QKeyCombination &combination) +{ + int combined; + s >> combined; + combination = QKeyCombination::fromCombined(combined); + return s; +} + +inline QDataStream &operator<<(QDataStream &s, QKeyCombination combination) +{ + return s << combination.toCombined(); +} + +#endif // QT_NO_DATASTREAM + +QT_END_NAMESPACE + +#endif // QDATASTREAM_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qdatetime.h b/qt/6.8.1/msvc2022_64/include/QtCore/qdatetime.h new file mode 100644 index 0000000000000000000000000000000000000000..1a835e4f03095daa0094422b09bad2f528ab241d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qdatetime.h @@ -0,0 +1,682 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// Copyright (C) 2021 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QDATETIME_H +#define QDATETIME_H + +#include +#include +#include +#include +#include +#include + +#include +#include + +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) +Q_FORWARD_DECLARE_CF_TYPE(CFDate); +Q_FORWARD_DECLARE_OBJC_CLASS(NSDate); +#endif + +QT_BEGIN_NAMESPACE + +class QTimeZone; +class QDateTime; + +class Q_CORE_EXPORT QDate +{ + explicit constexpr QDate(qint64 julianDay) : jd(julianDay) {} +public: + constexpr QDate() : jd(nullJd()) {} + QDate(int y, int m, int d); + QDate(int y, int m, int d, QCalendar cal); +#if __cpp_lib_chrono >= 201907L || defined(Q_QDOC) + QT_POST_CXX17_API_IN_EXPORTED_CLASS + Q_IMPLICIT constexpr QDate(std::chrono::year_month_day date) noexcept + : jd(date.ok() ? stdSysDaysToJulianDay(date) : nullJd()) + {} + + QT_POST_CXX17_API_IN_EXPORTED_CLASS + Q_IMPLICIT constexpr QDate(std::chrono::year_month_day_last date) noexcept + : jd(date.ok() ? stdSysDaysToJulianDay(date) : nullJd()) + {} + + QT_POST_CXX17_API_IN_EXPORTED_CLASS + Q_IMPLICIT constexpr QDate(std::chrono::year_month_weekday date) noexcept + : jd(date.ok() ? stdSysDaysToJulianDay(date) : nullJd()) + {} + + QT_POST_CXX17_API_IN_EXPORTED_CLASS + Q_IMPLICIT constexpr QDate(std::chrono::year_month_weekday_last date) noexcept + : jd(date.ok() ? stdSysDaysToJulianDay(date) : nullJd()) + {} + + QT_POST_CXX17_API_IN_EXPORTED_CLASS + static constexpr QDate fromStdSysDays(const std::chrono::sys_days &days) noexcept + { + return QDate(stdSysDaysToJulianDay(days)); + } + + QT_POST_CXX17_API_IN_EXPORTED_CLASS + constexpr std::chrono::sys_days toStdSysDays() const noexcept + { + const qint64 days = isValid() ? jd - unixEpochJd() : 0; + return std::chrono::sys_days(std::chrono::days(days)); + } +#endif + + constexpr bool isNull() const { return !isValid(); } + constexpr bool isValid() const { return jd >= minJd() && jd <= maxJd(); } + + // Gregorian-optimized: + int year() const; + int month() const; + int day() const; + int dayOfWeek() const; + int dayOfYear() const; + int daysInMonth() const; + int daysInYear() const; + int weekNumber(int *yearNum = nullptr) const; // ISO 8601, always Gregorian + + int year(QCalendar cal) const; + int month(QCalendar cal) const; + int day(QCalendar cal) const; + int dayOfWeek(QCalendar cal) const; + int dayOfYear(QCalendar cal) const; + int daysInMonth(QCalendar cal) const; + int daysInYear(QCalendar cal) const; + +#if QT_DEPRECATED_SINCE(6, 9) + QT_DEPRECATED_VERSION_X_6_9("Pass QTimeZone instead") + QDateTime startOfDay(Qt::TimeSpec spec, int offsetSeconds = 0) const; + QT_DEPRECATED_VERSION_X_6_9("Pass QTimeZone instead") + QDateTime endOfDay(Qt::TimeSpec spec, int offsetSeconds = 0) const; +#endif + + QDateTime startOfDay(const QTimeZone &zone) const; + QDateTime endOfDay(const QTimeZone &zone) const; + QDateTime startOfDay() const; + QDateTime endOfDay() const; + +#if QT_CONFIG(datestring) + QString toString(Qt::DateFormat format = Qt::TextDate) const; + QString toString(const QString &format) const; + QString toString(const QString &format, QCalendar cal) const + { return toString(qToStringViewIgnoringNull(format), cal); } + QString toString(QStringView format) const; + QString toString(QStringView format, QCalendar cal) const; +#endif + bool setDate(int year, int month, int day); // Gregorian-optimized + bool setDate(int year, int month, int day, QCalendar cal); + + void getDate(int *year, int *month, int *day) const; + + [[nodiscard]] QDate addDays(qint64 days) const; +#if __cpp_lib_chrono >= 201907L || defined(Q_QDOC) + QT_POST_CXX17_API_IN_EXPORTED_CLASS + [[nodiscard]] QDate addDuration(std::chrono::days days) const + { + return addDays(days.count()); + } +#endif + // Gregorian-optimized: + [[nodiscard]] QDate addMonths(int months) const; + [[nodiscard]] QDate addYears(int years) const; + [[nodiscard]] QDate addMonths(int months, QCalendar cal) const; + [[nodiscard]] QDate addYears(int years, QCalendar cal) const; + qint64 daysTo(QDate d) const; + + static QDate currentDate(); +#if QT_CONFIG(datestring) + // No DateFormat accepts a two-digit year, so no need for baseYear: + static QDate fromString(QStringView string, Qt::DateFormat format = Qt::TextDate); + static QDate fromString(const QString &string, Qt::DateFormat format = Qt::TextDate) + { return fromString(qToStringViewIgnoringNull(string), format); } + + // Accept calendar without over-ride of base year: + static QDate fromString(QStringView string, QStringView format, QCalendar cal) + { return fromString(string.toString(), format, QLocale::DefaultTwoDigitBaseYear, cal); } + QT_CORE_INLINE_SINCE(6, 7) + static QDate fromString(const QString &string, QStringView format, QCalendar cal); + static QDate fromString(const QString &string, const QString &format, QCalendar cal) + { return fromString(string, qToStringViewIgnoringNull(format), QLocale::DefaultTwoDigitBaseYear, cal); } + + // Overriding base year is likely more common than overriding calendar (and + // likely to get more so, as the legacy base drops ever further behind us). + static QDate fromString(QStringView string, QStringView format, + int baseYear = QLocale::DefaultTwoDigitBaseYear) + { return fromString(string.toString(), format, baseYear); } + static QDate fromString(QStringView string, QStringView format, + int baseYear, QCalendar cal) + { return fromString(string.toString(), format, baseYear, cal); } + static QDate fromString(const QString &string, QStringView format, + int baseYear = QLocale::DefaultTwoDigitBaseYear); + static QDate fromString(const QString &string, QStringView format, + int baseYear, QCalendar cal); + static QDate fromString(const QString &string, const QString &format, + int baseYear = QLocale::DefaultTwoDigitBaseYear) + { return fromString(string, qToStringViewIgnoringNull(format), baseYear); } + static QDate fromString(const QString &string, const QString &format, + int baseYear, QCalendar cal) + { return fromString(string, qToStringViewIgnoringNull(format), baseYear, cal); } +#endif + static bool isValid(int y, int m, int d); + static bool isLeapYear(int year); + + static constexpr inline QDate fromJulianDay(qint64 jd_) + { return jd_ >= minJd() && jd_ <= maxJd() ? QDate(jd_) : QDate() ; } + constexpr inline qint64 toJulianDay() const { return jd; } + +private: + // using extra parentheses around min to avoid expanding it if it is a macro + static constexpr inline qint64 nullJd() { return (std::numeric_limits::min)(); } + static constexpr inline qint64 minJd() { return Q_INT64_C(-784350574879); } + static constexpr inline qint64 maxJd() { return Q_INT64_C( 784354017364); } + static constexpr inline qint64 unixEpochJd() { return Q_INT64_C(2440588); } + +#if __cpp_lib_chrono >= 201907L +#if !QT_CORE_REMOVED_SINCE(6, 7) + QT_POST_CXX17_API_IN_EXPORTED_CLASS +#endif + static constexpr qint64 + stdSysDaysToJulianDay(const std::chrono::sys_days &days) noexcept + { + const auto epochDays = days.time_since_epoch().count(); + // minJd() and maxJd() fit into 40 bits. + if constexpr (sizeof(epochDays) * CHAR_BIT >= 41) { + constexpr auto top = maxJd() - unixEpochJd(); + constexpr auto bottom = minJd() - unixEpochJd(); + if (epochDays > top || epochDays < bottom) + return nullJd(); + } + return unixEpochJd() + epochDays; + } +#endif // __cpp_lib_chrono >= 201907L + + qint64 jd; + + friend class QDateTime; + friend class QDateTimeParser; + friend class QDateTimePrivate; + + friend constexpr bool comparesEqual(const QDate &lhs, const QDate &rhs) noexcept + { return lhs.jd == rhs.jd; } + friend constexpr Qt::strong_ordering + compareThreeWay(const QDate &lhs, const QDate &rhs) noexcept + { return Qt::compareThreeWay(lhs.jd, rhs.jd); } + Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE(QDate) + +#ifndef QT_NO_DATASTREAM + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, QDate); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDate &); +#endif +}; +Q_DECLARE_TYPEINFO(QDate, Q_RELOCATABLE_TYPE); + +class Q_CORE_EXPORT QTime +{ + explicit constexpr QTime(int ms) : mds(ms) + {} +public: + constexpr QTime(): mds(NullTime) + {} + QTime(int h, int m, int s = 0, int ms = 0); + + constexpr bool isNull() const { return mds == NullTime; } + bool isValid() const; + + int hour() const; + int minute() const; + int second() const; + int msec() const; +#if QT_CONFIG(datestring) + QString toString(Qt::DateFormat f = Qt::TextDate) const; + QString toString(const QString &format) const + { return toString(qToStringViewIgnoringNull(format)); } + QString toString(QStringView format) const; +#endif + bool setHMS(int h, int m, int s, int ms = 0); + + [[nodiscard]] QTime addSecs(int secs) const; + int secsTo(QTime t) const; + [[nodiscard]] QTime addMSecs(int ms) const; + int msecsTo(QTime t) const; + + static constexpr inline QTime fromMSecsSinceStartOfDay(int msecs) { return QTime(msecs); } + constexpr inline int msecsSinceStartOfDay() const { return mds == NullTime ? 0 : mds; } + + static QTime currentTime(); +#if QT_CONFIG(datestring) + static QTime fromString(QStringView string, Qt::DateFormat format = Qt::TextDate); + static QTime fromString(QStringView string, QStringView format) + { return fromString(string.toString(), format); } + static QTime fromString(const QString &string, QStringView format); + static QTime fromString(const QString &string, Qt::DateFormat format = Qt::TextDate) + { return fromString(qToStringViewIgnoringNull(string), format); } + static QTime fromString(const QString &string, const QString &format) + { return fromString(string, qToStringViewIgnoringNull(format)); } +#endif + static bool isValid(int h, int m, int s, int ms = 0); + +private: + enum TimeFlag { NullTime = -1 }; + constexpr inline int ds() const { return mds == -1 ? 0 : mds; } + int mds; + + friend constexpr bool comparesEqual(const QTime &lhs, const QTime &rhs) noexcept + { return lhs.mds == rhs.mds; } + friend constexpr Qt::strong_ordering + compareThreeWay(const QTime &lhs, const QTime &rhs) noexcept + { return Qt::compareThreeWay(lhs.mds, rhs.mds); } + Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE(QTime) + + friend class QDateTime; + friend class QDateTimePrivate; +#ifndef QT_NO_DATASTREAM + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, QTime); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QTime &); +#endif +}; +Q_DECLARE_TYPEINFO(QTime, Q_RELOCATABLE_TYPE); + +class QDateTimePrivate; + +class Q_CORE_EXPORT QDateTime +{ + struct ShortData { +#if QT_VERSION >= QT_VERSION_CHECK(7,0,0) || defined(QT_BOOTSTRAPPED) +# if Q_BYTE_ORDER == Q_LITTLE_ENDIAN + qint64 status : 8; +# endif + qint64 msecs : 56; + +# if Q_BYTE_ORDER == Q_BIG_ENDIAN + qint64 status : 8; +# endif +#else +# if Q_BYTE_ORDER == Q_LITTLE_ENDIAN + quintptr status : 8; +# endif + // note: this is only 24 bits on 32-bit systems... + qintptr msecs : sizeof(void *) * 8 - 8; + +# if Q_BYTE_ORDER == Q_BIG_ENDIAN + quintptr status : 8; +# endif +#endif + friend constexpr bool operator==(ShortData lhs, ShortData rhs) + { return lhs.status == rhs.status && lhs.msecs == rhs.msecs; } + }; + + union Data { + // To be of any use, we need at least 60 years around 1970, which + // is 1,893,456,000,000 ms. That requires 41 bits to store, plus + // the sign bit. With the status byte, the minimum size is 50 bits. + static constexpr bool CanBeSmall = sizeof(ShortData) * 8 > 50; + + Data() noexcept; + Data(const QTimeZone &); + Data(const Data &other) noexcept; + Data(Data &&other) noexcept; + Data &operator=(const Data &other) noexcept; + Data &operator=(Data &&other) noexcept { swap(other); return *this; } + ~Data(); + + void swap(Data &other) noexcept + { std::swap(data, other.data); } + + bool isShort() const; + inline void invalidate(); + void detach(); + QTimeZone timeZone() const; + + const QDateTimePrivate *operator->() const; + QDateTimePrivate *operator->(); + + QDateTimePrivate *d; + ShortData data; + }; + +public: + QDateTime() noexcept; + + enum class TransitionResolution { + Reject = 0, + RelativeToBefore, + RelativeToAfter, + PreferBefore, + PreferAfter, + PreferStandard, + PreferDaylightSaving, + // Closest match to behavior prior to introducing TransitionResolution: + LegacyBehavior = RelativeToBefore + }; + +#if QT_DEPRECATED_SINCE(6, 9) + QT_DEPRECATED_VERSION_X_6_9("Pass QTimeZone instead") + QDateTime(QDate date, QTime time, Qt::TimeSpec spec, int offsetSeconds = 0); +#endif +#if QT_CORE_REMOVED_SINCE(6, 7) + QDateTime(QDate date, QTime time, const QTimeZone &timeZone); + QDateTime(QDate date, QTime time); +#endif + QDateTime(QDate date, QTime time, const QTimeZone &timeZone, + TransitionResolution resolve = TransitionResolution::LegacyBehavior); + QDateTime(QDate date, QTime time, + TransitionResolution resolve = TransitionResolution::LegacyBehavior); + QDateTime(const QDateTime &other) noexcept; + QDateTime(QDateTime &&other) noexcept; + ~QDateTime(); + + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QDateTime) + QDateTime &operator=(const QDateTime &other) noexcept; + + void swap(QDateTime &other) noexcept { d.swap(other.d); } + + bool isNull() const; + bool isValid() const; + + QDate date() const; + QTime time() const; + Qt::TimeSpec timeSpec() const; + int offsetFromUtc() const; + QTimeZone timeRepresentation() const; +#if QT_CONFIG(timezone) + QTimeZone timeZone() const; +#endif // timezone + QString timeZoneAbbreviation() const; + bool isDaylightTime() const; + + qint64 toMSecsSinceEpoch() const; + qint64 toSecsSinceEpoch() const; + +#if QT_CORE_REMOVED_SINCE(6, 7) + void setDate(QDate date); + void setTime(QTime time); +#endif + void setDate(QDate date, TransitionResolution resolve = TransitionResolution::LegacyBehavior); + void setTime(QTime time, TransitionResolution resolve = TransitionResolution::LegacyBehavior); + +#if QT_DEPRECATED_SINCE(6, 9) + QT_DEPRECATED_VERSION_X_6_9("Use setTimeZone() instead") + void setTimeSpec(Qt::TimeSpec spec); + QT_DEPRECATED_VERSION_X_6_9("Use setTimeZone() instead") + void setOffsetFromUtc(int offsetSeconds); +#endif +#if QT_CORE_REMOVED_SINCE(6, 7) + void setTimeZone(const QTimeZone &toZone); +#endif + void setTimeZone(const QTimeZone &toZone, + TransitionResolution resolve = TransitionResolution::LegacyBehavior); + void setMSecsSinceEpoch(qint64 msecs); + void setSecsSinceEpoch(qint64 secs); + +#if QT_CONFIG(datestring) + QString toString(Qt::DateFormat format = Qt::TextDate) const; + QString toString(const QString &format) const; + QString toString(const QString &format, QCalendar cal) const + { return toString(qToStringViewIgnoringNull(format), cal); } + QString toString(QStringView format) const; + QString toString(QStringView format, QCalendar cal) const; +#endif + [[nodiscard]] QDateTime addDays(qint64 days) const; + [[nodiscard]] QDateTime addMonths(int months) const; + [[nodiscard]] QDateTime addYears(int years) const; + [[nodiscard]] QDateTime addSecs(qint64 secs) const; + [[nodiscard]] QDateTime addMSecs(qint64 msecs) const; + [[nodiscard]] QDateTime addDuration(std::chrono::milliseconds msecs) const + { + return addMSecs(msecs.count()); + } + +#if QT_DEPRECATED_SINCE(6, 9) + QT_DEPRECATED_VERSION_X_6_9("Use toTimeZone instead") + QDateTime toTimeSpec(Qt::TimeSpec spec) const; +#endif + QDateTime toLocalTime() const; + QDateTime toUTC() const; + QDateTime toOffsetFromUtc(int offsetSeconds) const; + QDateTime toTimeZone(const QTimeZone &toZone) const; + + qint64 daysTo(const QDateTime &) const; + qint64 secsTo(const QDateTime &) const; + qint64 msecsTo(const QDateTime &) const; + + static QDateTime currentDateTime(const QTimeZone &zone); + static QDateTime currentDateTime(); + static QDateTime currentDateTimeUtc(); +#if QT_CONFIG(datestring) + // No DateFormat accepts a two-digit year, so no need for baseYear: + static QDateTime fromString(QStringView string, Qt::DateFormat format = Qt::TextDate); + static QDateTime fromString(const QString &string, Qt::DateFormat format = Qt::TextDate) + { return fromString(qToStringViewIgnoringNull(string), format); } + + // Accept calendar without over-ride of base year: + static QDateTime fromString(QStringView string, QStringView format, QCalendar cal) + { return fromString(string.toString(), format, QLocale::DefaultTwoDigitBaseYear, cal); } + QT_CORE_INLINE_SINCE(6, 7) + static QDateTime fromString(const QString &string, QStringView format, QCalendar cal); + static QDateTime fromString(const QString &string, const QString &format, QCalendar cal) + { return fromString(string, qToStringViewIgnoringNull(format), QLocale::DefaultTwoDigitBaseYear, cal); } + + // Overriding base year is likely more common than overriding calendar (and + // likely to get more so, as the legacy base drops ever further behind us). + static QDateTime fromString(QStringView string, QStringView format, + int baseYear = QLocale::DefaultTwoDigitBaseYear) + { return fromString(string.toString(), format, baseYear); } + static QDateTime fromString(QStringView string, QStringView format, + int baseYear, QCalendar cal) + { return fromString(string.toString(), format, baseYear, cal); } + static QDateTime fromString(const QString &string, QStringView format, + int baseYear = QLocale::DefaultTwoDigitBaseYear); + static QDateTime fromString(const QString &string, QStringView format, + int baseYear, QCalendar cal); + static QDateTime fromString(const QString &string, const QString &format, + int baseYear = QLocale::DefaultTwoDigitBaseYear) + { return fromString(string, qToStringViewIgnoringNull(format), baseYear); } + static QDateTime fromString(const QString &string, const QString &format, + int baseYear, QCalendar cal) + { return fromString(string, qToStringViewIgnoringNull(format), baseYear, cal); } +#endif + +#if QT_DEPRECATED_SINCE(6, 9) + QT_DEPRECATED_VERSION_X_6_9("Pass QTimeZone instead of time-spec, offset") + static QDateTime fromMSecsSinceEpoch(qint64 msecs, Qt::TimeSpec spec, int offsetFromUtc = 0); + QT_DEPRECATED_VERSION_X_6_9("Pass QTimeZone instead of time-spec, offset") + static QDateTime fromSecsSinceEpoch(qint64 secs, Qt::TimeSpec spec, int offsetFromUtc = 0); +#endif + + static QDateTime fromMSecsSinceEpoch(qint64 msecs, const QTimeZone &timeZone); + static QDateTime fromSecsSinceEpoch(qint64 secs, const QTimeZone &timeZone); + static QDateTime fromMSecsSinceEpoch(qint64 msecs); + static QDateTime fromSecsSinceEpoch(qint64 secs); + + static qint64 currentMSecsSinceEpoch() noexcept; + static qint64 currentSecsSinceEpoch() noexcept; + +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) + static QDateTime fromCFDate(CFDateRef date); + CFDateRef toCFDate() const Q_DECL_CF_RETURNS_RETAINED; + static QDateTime fromNSDate(const NSDate *date); + NSDate *toNSDate() const Q_DECL_NS_RETURNS_AUTORELEASED; +#endif + + static QDateTime fromStdTimePoint( + std::chrono::time_point< + std::chrono::system_clock, + std::chrono::milliseconds + > time + ); + +#if __cpp_lib_chrono >= 201907L || defined(Q_QDOC) +#if __cpp_concepts >= 201907L || defined(Q_QDOC) +private: + // The duration type of the result of a clock_cast. + // This duration may differ from the duration of the input. + template + using system_clock_cast_duration = decltype( + std::chrono::clock_cast( + std::declval &>() + ).time_since_epoch() + ); + +public: + // Generic clock, as long as it's compatible with us (= system_clock) + template + static QDateTime fromStdTimePoint(const std::chrono::time_point &time) + requires + requires(const std::chrono::time_point &t) { + // the clock can be converted to system_clock + std::chrono::clock_cast(t); + // after the conversion to system_clock, the duration type + // we get is convertible to milliseconds + requires std::is_convertible_v< + system_clock_cast_duration, + std::chrono::milliseconds + >; + } + { + using namespace std::chrono; + const sys_time sysTime = clock_cast(time); + return fromStdTimePoint(sysTime); + } +#endif // __cpp_concepts + + // local_time + QT_POST_CXX17_API_IN_EXPORTED_CLASS + static QDateTime fromStdTimePoint(const std::chrono::local_time &time) + { + return fromStdLocalTime(time); + } + + QT_POST_CXX17_API_IN_EXPORTED_CLASS + static QDateTime fromStdLocalTime(const std::chrono::local_time &time) + { + QDateTime result(QDate(1970, 1, 1), QTime(0, 0, 0), TransitionResolution::LegacyBehavior); + return result.addMSecs(time.time_since_epoch().count()); + } + +#if QT_CONFIG(timezone) && (__cpp_lib_chrono >= 201907L || defined(Q_QDOC)) + // zoned_time. defined in qtimezone.h + QT_POST_CXX17_API_IN_EXPORTED_CLASS + static QDateTime fromStdZonedTime(const std::chrono::zoned_time< + std::chrono::milliseconds, + const std::chrono::time_zone * + > &time); +#endif // QT_CONFIG(timezone) + + QT_POST_CXX17_API_IN_EXPORTED_CLASS + std::chrono::sys_time toStdSysMilliseconds() const + { + const std::chrono::milliseconds duration(toMSecsSinceEpoch()); + return std::chrono::sys_time(duration); + } + + QT_POST_CXX17_API_IN_EXPORTED_CLASS + std::chrono::sys_seconds toStdSysSeconds() const + { + const std::chrono::seconds duration(toSecsSinceEpoch()); + return std::chrono::sys_seconds(duration); + } +#endif // __cpp_lib_chrono >= 201907L + + friend std::chrono::milliseconds operator-(const QDateTime &lhs, const QDateTime &rhs) + { + return std::chrono::milliseconds(rhs.msecsTo(lhs)); + } + + friend QDateTime operator+(const QDateTime &dateTime, std::chrono::milliseconds duration) + { + return dateTime.addMSecs(duration.count()); + } + + friend QDateTime operator+(std::chrono::milliseconds duration, const QDateTime &dateTime) + { + return dateTime + duration; + } + + QDateTime &operator+=(std::chrono::milliseconds duration) + { + *this = addMSecs(duration.count()); + return *this; + } + + friend QDateTime operator-(const QDateTime &dateTime, std::chrono::milliseconds duration) + { + return dateTime.addMSecs(-duration.count()); + } + + QDateTime &operator-=(std::chrono::milliseconds duration) + { + *this = addMSecs(-duration.count()); + return *this; + } + + // (1<<63) ms is 292277024.6 (average Gregorian) years, counted from the start of 1970, so + // Last is floor(1970 + 292277024.6); no year 0, so First is floor(1970 - 1 - 292277024.6) + enum class YearRange : qint32 { First = -292275056, Last = +292278994 }; + +private: + bool equals(const QDateTime &other) const; +#if QT_CORE_REMOVED_SINCE(6, 7) + bool precedes(const QDateTime &other) const; +#endif + friend class QDateTimePrivate; + + Data d; + + friend bool comparesEqual(const QDateTime &lhs, const QDateTime &rhs) + { return lhs.equals(rhs); } + friend Q_CORE_EXPORT Qt::weak_ordering + compareThreeWay(const QDateTime &lhs, const QDateTime &rhs); + Q_DECLARE_WEAKLY_ORDERED_NON_NOEXCEPT(QDateTime) + +#ifndef QT_NO_DATASTREAM + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QDateTime &); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDateTime &); +#endif + +#if !defined(QT_NO_DEBUG_STREAM) && QT_CONFIG(datestring) + friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QDateTime &); +#endif +}; +Q_DECLARE_SHARED(QDateTime) + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, QDate); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDate &); +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, QTime); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QTime &); +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QDateTime &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDateTime &); +#endif // QT_NO_DATASTREAM + +#if !defined(QT_NO_DEBUG_STREAM) && QT_CONFIG(datestring) +Q_CORE_EXPORT QDebug operator<<(QDebug, QDate); +Q_CORE_EXPORT QDebug operator<<(QDebug, QTime); +Q_CORE_EXPORT QDebug operator<<(QDebug, const QDateTime &); +#endif + +// QDateTime is not noexcept for now -- to be revised once +// timezone and calendaring support is added +Q_CORE_EXPORT size_t qHash(const QDateTime &key, size_t seed = 0); +Q_CORE_EXPORT size_t qHash(QDate key, size_t seed = 0) noexcept; +Q_CORE_EXPORT size_t qHash(QTime key, size_t seed = 0) noexcept; + +#if QT_CONFIG(datestring) && QT_CORE_INLINE_IMPL_SINCE(6, 7) +QDate QDate::fromString(const QString &string, QStringView format, QCalendar cal) +{ + return fromString(string, format, QLocale::DefaultTwoDigitBaseYear, cal); +} + +QDateTime QDateTime::fromString(const QString &string, QStringView format, QCalendar cal) +{ + return fromString(string, format, QLocale::DefaultTwoDigitBaseYear, cal); +} +#endif + +QT_END_NAMESPACE + +#endif // QDATETIME_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qdeadlinetimer.h b/qt/6.8.1/msvc2022_64/include/QtCore/qdeadlinetimer.h new file mode 100644 index 0000000000000000000000000000000000000000..cc520935bf00558592a3e105df5b88e6bee0bae9 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qdeadlinetimer.h @@ -0,0 +1,184 @@ +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QDEADLINETIMER_H +#define QDEADLINETIMER_H + +#include +#include +#include + +#ifdef max +// un-pollute the namespace. We need std::numeric_limits::max() and std::chrono::duration::max() +# undef max +#endif + +#include + +#include + +QT_BEGIN_NAMESPACE + +class Q_CORE_EXPORT QDeadlineTimer +{ +public: + enum class ForeverConstant { Forever }; + static constexpr ForeverConstant Forever = ForeverConstant::Forever; + + constexpr QDeadlineTimer() noexcept = default; + constexpr explicit QDeadlineTimer(Qt::TimerType type_) noexcept + : type(type_) {} + constexpr QDeadlineTimer(ForeverConstant, Qt::TimerType type_ = Qt::CoarseTimer) noexcept + : t1((std::numeric_limits::max)()), type(type_) {} + explicit QDeadlineTimer(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) noexcept; + + void swap(QDeadlineTimer &other) noexcept + { std::swap(t1, other.t1); std::swap(type, other.type); } + + constexpr bool isForever() const noexcept + { return t1 == (std::numeric_limits::max)(); } + bool hasExpired() const noexcept; + + Qt::TimerType timerType() const noexcept + { return Qt::TimerType(type & 0xff); } + void setTimerType(Qt::TimerType type); + + qint64 remainingTime() const noexcept; + qint64 remainingTimeNSecs() const noexcept; + void setRemainingTime(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) noexcept; + void setPreciseRemainingTime(qint64 secs, qint64 nsecs = 0, + Qt::TimerType type = Qt::CoarseTimer) noexcept; + + qint64 deadline() const noexcept Q_DECL_PURE_FUNCTION; + qint64 deadlineNSecs() const noexcept Q_DECL_PURE_FUNCTION; + void setDeadline(qint64 msecs, Qt::TimerType timerType = Qt::CoarseTimer) noexcept; + void setPreciseDeadline(qint64 secs, qint64 nsecs = 0, + Qt::TimerType type = Qt::CoarseTimer) noexcept; + + static QDeadlineTimer addNSecs(QDeadlineTimer dt, qint64 nsecs) noexcept Q_DECL_PURE_FUNCTION; + static QDeadlineTimer current(Qt::TimerType timerType = Qt::CoarseTimer) noexcept; + + friend Q_CORE_EXPORT QDeadlineTimer operator+(QDeadlineTimer dt, qint64 msecs); + friend QDeadlineTimer operator+(qint64 msecs, QDeadlineTimer dt) + { return dt + msecs; } + friend QDeadlineTimer operator-(QDeadlineTimer dt, qint64 msecs) + { return dt + (-msecs); } + friend qint64 operator-(QDeadlineTimer dt1, QDeadlineTimer dt2) + { return (dt1.deadlineNSecs() - dt2.deadlineNSecs()) / (1000 * 1000); } + QDeadlineTimer &operator+=(qint64 msecs) + { *this = *this + msecs; return *this; } + QDeadlineTimer &operator-=(qint64 msecs) + { *this = *this + (-msecs); return *this; } + + template + QDeadlineTimer(std::chrono::time_point deadline_, + Qt::TimerType type_ = Qt::CoarseTimer) : t2(0) + { setDeadline(deadline_, type_); } + template + QDeadlineTimer &operator=(std::chrono::time_point deadline_) + { setDeadline(deadline_); return *this; } + + template + void setDeadline(std::chrono::time_point tp, + Qt::TimerType type_ = Qt::CoarseTimer); + + template + std::chrono::time_point deadline() const; + + template + QDeadlineTimer(std::chrono::duration remaining, Qt::TimerType type_ = Qt::CoarseTimer) + : t2(0) + { setRemainingTime(remaining, type_); } + + template + QDeadlineTimer &operator=(std::chrono::duration remaining) + { setRemainingTime(remaining); return *this; } + + template + void setRemainingTime(std::chrono::duration remaining, Qt::TimerType type_ = Qt::CoarseTimer) + { + using namespace std::chrono; + if (remaining == remaining.max()) + *this = QDeadlineTimer(Forever, type_); + else + setPreciseRemainingTime(0, ceil(remaining).count(), type_); + } + + std::chrono::nanoseconds remainingTimeAsDuration() const noexcept + { + if (isForever()) + return std::chrono::nanoseconds::max(); + qint64 nsecs = rawRemainingTimeNSecs(); + if (nsecs <= 0) + return std::chrono::nanoseconds::zero(); + return std::chrono::nanoseconds(nsecs); + } + + template + friend QDeadlineTimer operator+(QDeadlineTimer dt, std::chrono::duration value) + { return QDeadlineTimer::addNSecs(dt, std::chrono::duration_cast(value).count()); } + template + friend QDeadlineTimer operator+(std::chrono::duration value, QDeadlineTimer dt) + { return dt + value; } + template + friend QDeadlineTimer operator+=(QDeadlineTimer &dt, std::chrono::duration value) + { return dt = dt + value; } + +private: + friend bool comparesEqual(const QDeadlineTimer &lhs, + const QDeadlineTimer &rhs) noexcept + { + return lhs.t1 == rhs.t1; + } + friend Qt::strong_ordering compareThreeWay(const QDeadlineTimer &lhs, + const QDeadlineTimer &rhs) noexcept + { + return Qt::compareThreeWay(lhs.t1, rhs.t1); + } + Q_DECLARE_STRONGLY_ORDERED(QDeadlineTimer) + + qint64 t1 = 0; +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) + unsigned t2 = 0; +#endif + unsigned type = Qt::CoarseTimer; + + qint64 rawRemainingTimeNSecs() const noexcept; +}; + +template +std::chrono::time_point QDeadlineTimer::deadline() const +{ + using namespace std::chrono; + if constexpr (std::is_same_v) { + auto val = duration_cast(nanoseconds(deadlineNSecs())); + return time_point(val); + } else { + auto val = nanoseconds(rawRemainingTimeNSecs()) + Clock::now(); + return time_point_cast(val); + } +} + +template +void QDeadlineTimer::setDeadline(std::chrono::time_point tp, Qt::TimerType type_) +{ + using namespace std::chrono; + if (tp == tp.max()) { + *this = Forever; + type = type_; + } else if constexpr (std::is_same_v) { + setPreciseDeadline(0, + duration_cast(tp.time_since_epoch()).count(), + type_); + } else { + setPreciseRemainingTime(0, duration_cast(tp - Clock::now()).count(), type_); + } +} + +Q_DECLARE_SHARED(QDeadlineTimer) + +QT_END_NAMESPACE + +QT_DECL_METATYPE_EXTERN(QDeadlineTimer, Q_CORE_EXPORT) + +#endif // QDEADLINETIMER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qdebug.h b/qt/6.8.1/msvc2022_64/include/QtCore/qdebug.h new file mode 100644 index 0000000000000000000000000000000000000000..0385838b8341f1cc55095942c24f976beea0a593 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qdebug.h @@ -0,0 +1,668 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QDEBUG_H +#define QDEBUG_H + +#if 0 +#pragma qt_class(QtDebug) +#endif + +#include +#include +#include +#include +#include +#include +#include + +// all these have already been included by various headers above, but don't rely on indirect includes: +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if !defined(QT_LEAN_HEADERS) || QT_LEAN_HEADERS < 1 +# include +# include +# include +# include +#endif + +QT_BEGIN_NAMESPACE + +class QT6_ONLY(Q_CORE_EXPORT) QDebug : public QIODeviceBase +{ + friend class QMessageLogger; + friend class QDebugStateSaver; + friend class QDebugStateSaverPrivate; + struct Stream { + enum { VerbosityShift = 29, VerbosityMask = 0x7 }; + + explicit Stream(QIODevice *device) + : ts(device) + {} + explicit Stream(QString *string) + : ts(string, WriteOnly) + {} + explicit Stream(QtMsgType t) + : ts(&buffer, WriteOnly), + type(t), + message_output(true) + {} + QTextStream ts; + QString buffer; + int ref = 1; + QtMsgType type = QtDebugMsg; + bool space = true; + bool noQuotes = false; + bool message_output = false; + int verbosity = DefaultVerbosity; + QMessageLogContext context; + } *stream; + + enum Latin1Content { ContainsBinary = 0, ContainsLatin1 }; + + QT7_ONLY(Q_CORE_EXPORT) void putUcs4(uint ucs4); + QT7_ONLY(Q_CORE_EXPORT) void putString(const QChar *begin, size_t length); + QT7_ONLY(Q_CORE_EXPORT) void putByteArray(const char *begin, size_t length, Latin1Content content); + QT7_ONLY(Q_CORE_EXPORT) void putTimeUnit(qint64 num, qint64 den); + QT7_ONLY(Q_CORE_EXPORT) void putInt128(const void *i); + QT7_ONLY(Q_CORE_EXPORT) void putUInt128(const void *i); +public: + explicit QDebug(QIODevice *device) : stream(new Stream(device)) {} + explicit QDebug(QString *string) : stream(new Stream(string)) {} + explicit QDebug(QtMsgType t) : stream(new Stream(t)) {} + QDebug(const QDebug &o) : stream(o.stream) { ++stream->ref; } + QDebug(QDebug &&other) noexcept : stream{std::exchange(other.stream, nullptr)} {} + inline QDebug &operator=(const QDebug &other); + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QDebug) + ~QDebug(); + void swap(QDebug &other) noexcept { qt_ptr_swap(stream, other.stream); } + + QT7_ONLY(Q_CORE_EXPORT) QDebug &resetFormat(); + + inline QDebug &space() { stream->space = true; stream->ts << ' '; return *this; } + inline QDebug &nospace() { stream->space = false; return *this; } + inline QDebug &maybeSpace() { if (stream->space) stream->ts << ' '; return *this; } + inline QDebug &verbosity(int verbosityLevel) { stream->verbosity = verbosityLevel; return *this; } + int verbosity() const { return stream->verbosity; } + void setVerbosity(int verbosityLevel) { stream->verbosity = verbosityLevel; } + enum VerbosityLevel { MinimumVerbosity = 0, DefaultVerbosity = 2, MaximumVerbosity = 7 }; + + bool autoInsertSpaces() const { return stream->space; } + void setAutoInsertSpaces(bool b) { stream->space = b; } + + [[nodiscard]] bool quoteStrings() const noexcept { return !stream->noQuotes; } + void setQuoteStrings(bool b) { stream->noQuotes = !b; } + + inline QDebug "e() { stream->noQuotes = false; return *this; } + inline QDebug &noquote() { stream->noQuotes = true; return *this; } + inline QDebug &maybeQuote(char c = '"') { if (!stream->noQuotes) stream->ts << c; return *this; } + + inline QDebug &operator<<(QChar t) { putUcs4(t.unicode()); return maybeSpace(); } + inline QDebug &operator<<(bool t) { stream->ts << (t ? "true" : "false"); return maybeSpace(); } + inline QDebug &operator<<(char t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(signed short t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(unsigned short t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(char16_t t) { return *this << QChar(t); } + inline QDebug &operator<<(char32_t t) { putUcs4(t); return maybeSpace(); } + inline QDebug &operator<<(signed int t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(unsigned int t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(signed long t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(unsigned long t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(qint64 t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(quint64 t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(qfloat16 t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(float t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(double t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(const char* t) { stream->ts << QString::fromUtf8(t); return maybeSpace(); } + inline QDebug &operator<<(const char16_t *t) { stream->ts << QStringView(t); return maybeSpace(); } + inline QDebug &operator<<(const QString & t) { putString(t.constData(), size_t(t.size())); return maybeSpace(); } + inline QDebug &operator<<(QStringView s) { putString(s.data(), size_t(s.size())); return maybeSpace(); } + inline QDebug &operator<<(QUtf8StringView s) { putByteArray(reinterpret_cast(s.data()), s.size(), ContainsBinary); return maybeSpace(); } + inline QDebug &operator<<(QLatin1StringView t) { putByteArray(t.latin1(), t.size(), ContainsLatin1); return maybeSpace(); } + inline QDebug &operator<<(const QByteArray & t) { putByteArray(t.constData(), t.size(), ContainsBinary); return maybeSpace(); } + inline QDebug &operator<<(QByteArrayView t) { putByteArray(t.constData(), t.size(), ContainsBinary); return maybeSpace(); } + inline QDebug &operator<<(const void * t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(std::nullptr_t) { stream->ts << "(nullptr)"; return maybeSpace(); } + inline QDebug &operator<<(std::nullopt_t) { stream->ts << "nullopt"; return maybeSpace(); } + inline QDebug &operator<<(QTextStreamFunction f) { + stream->ts << f; + return *this; + } + + inline QDebug &operator<<(QTextStreamManipulator m) + { stream->ts << m; return *this; } + +#ifdef Q_QDOC + template + QDebug &operator<<(const std::basic_string &s); + + template + QDebug &operator<<(std::basic_string_view s); +#else + template + QDebug &operator<<(const std::basic_string &s) + { return *this << QUtf8StringView(s); } + + template + QDebug &operator<<(std::basic_string_view s) + { return *this << QUtf8StringView(s); } + +#ifdef __cpp_char8_t + template + QDebug &operator<<(const std::basic_string &s) + { return *this << QUtf8StringView(s); } + + template + QDebug &operator<<(std::basic_string_view s) + { return *this << QUtf8StringView(s); } +#endif // __cpp_char8_t + + template + QDebug &operator<<(const std::basic_string &s) + { return *this << QStringView(s); } + + template + QDebug &operator<<(std::basic_string_view s) + { return *this << QStringView(s); } + + template + QDebug &operator<<(const std::basic_string &s) + { + if constexpr (sizeof(wchar_t) == 2) + return *this << QStringView(s); + else + return *this << QString::fromWCharArray(s.data(), s.size()); // ### optimize + } + + template + QDebug &operator<<(std::basic_string_view s) + { + if constexpr (sizeof(wchar_t) == 2) + return *this << QStringView(s); + else + return *this << QString::fromWCharArray(s.data(), s.size()); // ### optimize + } + + template + QDebug &operator<<(const std::basic_string &s) + { return *this << QString::fromUcs4(s.data(), s.size()); } + + template + QDebug &operator<<(std::basic_string_view s) + { return *this << QString::fromUcs4(s.data(), s.size()); } +#endif // !Q_QDOC + + template + QDebug &operator<<(std::chrono::duration duration) + { + stream->ts << duration.count(); + putTimeUnit(Period::num, Period::den); + return maybeSpace(); + } + +#ifdef QT_SUPPORTS_INT128 +private: + // Constrained templates so they only match q(u)int128 without conversions. + // Also keeps these operators out of the ABI. + template + using if_qint128 = std::enable_if_t, bool>; + template + using if_quint128 = std::enable_if_t, bool>; +public: + template = true> + QDebug &operator<<(T i128) { putInt128(&i128); return maybeSpace(); } + template = true> + QDebug &operator<<(T u128) { putUInt128(&u128); return maybeSpace(); } +#endif // QT_SUPPORTS_INT128 + +private: + template + static void streamTypeErased(QDebug &d, const void *obj) + { + d << *static_cast(obj); + } + using StreamTypeErased = void(*)(QDebug&, const void*); + QT7_ONLY(Q_CORE_EXPORT) static QString toStringImpl(StreamTypeErased s, const void *obj); +public: + template + static QString toString(const T &object) + { + return toStringImpl(&streamTypeErased, std::addressof(object)); + } +}; + +Q_DECLARE_SHARED(QDebug) + +class QDebugStateSaverPrivate; +class QDebugStateSaver +{ +public: + Q_NODISCARD_CTOR Q_CORE_EXPORT + QDebugStateSaver(QDebug &dbg); + Q_CORE_EXPORT + ~QDebugStateSaver(); +private: + Q_DISABLE_COPY(QDebugStateSaver) + QScopedPointer d; +}; + +class QNoDebug +{ +public: + inline QNoDebug &operator<<(QTextStreamFunction) { return *this; } + inline QNoDebug &operator<<(QTextStreamManipulator) { return *this; } + inline QNoDebug &space() { return *this; } + inline QNoDebug &nospace() { return *this; } + inline QNoDebug &maybeSpace() { return *this; } + inline QNoDebug "e() { return *this; } + inline QNoDebug &noquote() { return *this; } + inline QNoDebug &maybeQuote(const char = '"') { return *this; } + inline QNoDebug &verbosity(int) { return *this; } + + template + inline QNoDebug &operator<<(const T &) { return *this; } +}; + +inline QDebug &QDebug::operator=(const QDebug &other) +{ + QDebug{other}.swap(*this); + return *this; +} + +namespace QtPrivate { + +template +inline QDebug printSequentialContainer(QDebug debug, const char *which, const SequentialContainer &c) +{ + const QDebugStateSaver saver(debug); + debug.nospace() << which << '('; + typename SequentialContainer::const_iterator it = c.begin(), end = c.end(); + if (it != end) { + debug << *it; + ++it; + } + while (it != end) { + debug << ", " << *it; + ++it; + } + debug << ')'; + return debug; +} + +template +inline QDebug printAssociativeContainer(QDebug debug, const char *which, const AssociativeContainer &c) +{ + const QDebugStateSaver saver(debug); + debug.nospace() << which << "("; + for (typename AssociativeContainer::const_iterator it = c.constBegin(); + it != c.constEnd(); ++it) { + debug << '(' << it.key() << ", " << it.value() << ')'; + } + debug << ')'; + return debug; +} + +} // namespace QtPrivate + +template +using QDebugIfHasDebugStream = + std::enable_if_t...>, QDebug>; + +template +using QDebugIfHasDebugStreamContainer = + std::enable_if_t...>, QDebug>; + +#ifndef Q_QDOC + +template +inline QDebugIfHasDebugStreamContainer, T> operator<<(QDebug debug, const QList &vec) +{ + return QtPrivate::printSequentialContainer(std::move(debug), "QList", vec); +} + +template +inline QDebugIfHasDebugStream operator<<(QDebug debug, const QVarLengthArray &vec) +{ + return QtPrivate::printSequentialContainer(std::move(debug), "QVarLengthArray", vec); +} + +template +inline QDebugIfHasDebugStream operator<<(QDebug debug, const std::vector &vec) +{ + return QtPrivate::printSequentialContainer(std::move(debug), "std::vector", vec); +} + +template +inline QDebugIfHasDebugStream operator<<(QDebug debug, const std::list &vec) +{ + return QtPrivate::printSequentialContainer(std::move(debug), "std::list", vec); +} + +template +inline QDebugIfHasDebugStream operator<<(QDebug debug, std::initializer_list list) +{ + return QtPrivate::printSequentialContainer(std::move(debug), "std::initializer_list", list); +} + +template +inline QDebugIfHasDebugStream operator<<(QDebug debug, const std::map &map) +{ + return QtPrivate::printSequentialContainer(std::move(debug), "std::map", map); // yes, sequential: *it is std::pair +} + +template +inline QDebugIfHasDebugStream operator<<(QDebug debug, const std::multimap &map) +{ + return QtPrivate::printSequentialContainer(std::move(debug), "std::multimap", map); // yes, sequential: *it is std::pair +} + +template +inline QDebugIfHasDebugStreamContainer, Key, T> operator<<(QDebug debug, const QMap &map) +{ + return QtPrivate::printAssociativeContainer(std::move(debug), "QMap", map); +} + +template +inline QDebugIfHasDebugStreamContainer, Key, T> operator<<(QDebug debug, const QMultiMap &map) +{ + return QtPrivate::printAssociativeContainer(std::move(debug), "QMultiMap", map); +} + +template +inline QDebugIfHasDebugStreamContainer, Key, T> operator<<(QDebug debug, const QHash &hash) +{ + return QtPrivate::printAssociativeContainer(std::move(debug), "QHash", hash); +} + +template +inline QDebugIfHasDebugStreamContainer, Key, T> operator<<(QDebug debug, const QMultiHash &hash) +{ + return QtPrivate::printAssociativeContainer(std::move(debug), "QMultiHash", hash); +} + +template +inline QDebugIfHasDebugStream operator<<(QDebug debug, const std::optional &opt) +{ + if (!opt) + return debug << std::nullopt; + const QDebugStateSaver saver(debug); + debug.nospace() << "std::optional(" << *opt << ')'; + return debug; +} + +template +inline QDebugIfHasDebugStream operator<<(QDebug debug, const std::pair &pair) +{ + const QDebugStateSaver saver(debug); + debug.nospace() << "std::pair(" << pair.first << ',' << pair.second << ')'; + return debug; +} + +template +inline QDebugIfHasDebugStreamContainer, T> operator<<(QDebug debug, const QSet &set) +{ + return QtPrivate::printSequentialContainer(std::move(debug), "QSet", set); +} + +template +inline QDebugIfHasDebugStream operator<<(QDebug debug, const QContiguousCache &cache) +{ + const QDebugStateSaver saver(debug); + debug.nospace() << "QContiguousCache("; + for (qsizetype i = cache.firstIndex(); i <= cache.lastIndex(); ++i) { + debug << cache[i]; + if (i != cache.lastIndex()) + debug << ", "; + } + debug << ')'; + return debug; +} + +#else +template +QDebug operator<<(QDebug debug, const QList &list); + +template +QDebug operator<<(QDebug debug, const QVarLengthArray &array); + +template +QDebug operator<<(QDebug debug, const std::vector &vec); + +template +QDebug operator<<(QDebug debug, const std::list &vec); + +template +QDebug operator<<(QDebug debug, const std::map &map); + +template +QDebug operator<<(QDebug debug, const std::multimap &map); + +template +QDebug operator<<(QDebug debug, const QMap &map); + +template +QDebug operator<<(QDebug debug, const QMultiMap &map); + +template +QDebug operator<<(QDebug debug, const QHash &hash); + +template +QDebug operator<<(QDebug debug, const QMultiHash &hash); + +template +QDebug operator<<(QDebug debug, const QSet &set); + +template +QDebug operator<<(QDebug debug, const std::pair &pair); + +template +QDebug operator<<(QDebug debug, const QContiguousCache &cache); + +#endif // Q_QDOC + +template +inline QDebug operator<<(QDebug debug, const QSharedPointer &ptr) +{ + QDebugStateSaver saver(debug); + debug.nospace() << "QSharedPointer(" << ptr.data() << ")"; + return debug; +} + +template class QTaggedPointer; + +template +inline QDebug operator<<(QDebug debug, const QTaggedPointer &ptr) +{ + QDebugStateSaver saver(debug); + debug.nospace() << "QTaggedPointer(" << ptr.pointer() << ", " << ptr.tag() << ")"; + return debug; +} + +Q_CORE_EXPORT void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, uint value); + +template +void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, Int value) +{ + static_assert(std::is_unsigned_v, + "Cast value to an unsigned type before calling this function"); + const QDebugStateSaver saver(debug); + debug.resetFormat(); + debug.nospace() << "QFlags(" << Qt::hex << Qt::showbase; + bool needSeparator = false; + for (size_t i = 0; i < sizeofT * 8; ++i) { + if (value & (Int(1) << i)) { + if (needSeparator) + debug << '|'; + else + needSeparator = true; + debug << (Int(1) << i); + } + } + debug << ')'; +} + +#if !defined(QT_NO_QOBJECT) && !defined(Q_QDOC) +Q_CORE_EXPORT QDebug qt_QMetaEnum_debugOperator(QDebug&, qint64 value, const QMetaObject *meta, const char *name); +Q_CORE_EXPORT QDebug qt_QMetaEnum_flagDebugOperator(QDebug &dbg, quint64 value, const QMetaObject *meta, const char *name); + +template +typename std::enable_if::Value, QDebug>::type +operator<<(QDebug dbg, T value) +{ + const QMetaObject *obj = qt_getEnumMetaObject(value); + const char *name = qt_getEnumName(value); + return qt_QMetaEnum_debugOperator(dbg, static_cast::type>(value), obj, name); +} + +template::value, void>::type, + typename B = typename std::enable_if::type, + typename C = typename std::enable_if::Value, void>::type, + typename D = typename std::enable_if>::Value, void>::type> +inline QDebug operator<<(QDebug dbg, T value) +{ + typedef QFlags FlagsT; + const QMetaObject *obj = qt_getEnumMetaObject(FlagsT()); + const char *name = qt_getEnumName(FlagsT()); + return qt_QMetaEnum_debugOperator(dbg, typename FlagsT::Int(value), obj, name); +} + +template +inline typename std::enable_if< + QtPrivate::IsQEnumHelper::Value || QtPrivate::IsQEnumHelper >::Value, + QDebug>::type +qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags &flags) +{ + using UInt = typename QIntegerForSizeof::Unsigned; + const QMetaObject *obj = qt_getEnumMetaObject(T()); + const char *name = qt_getEnumName(T()); + return qt_QMetaEnum_flagDebugOperator(debug, UInt(flags.toInt()), obj, name); +} + +template +inline typename std::enable_if< + !QtPrivate::IsQEnumHelper::Value && !QtPrivate::IsQEnumHelper >::Value, + QDebug>::type +qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags &flags) +#else // !QT_NO_QOBJECT && !Q_QDOC +template +inline QDebug qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags &flags) +#endif +{ + using UInt = typename QIntegerForSizeof::Unsigned; + qt_QMetaEnum_flagDebugOperator(debug, sizeof(T), UInt(flags.toInt())); + return debug; +} + +template +inline QDebug operator<<(QDebug debug, const QFlags &flags) +{ + // We have to use an indirection otherwise specialisation of some other overload of the + // operator<< the compiler would try to instantiate QFlags for the std::enable_if + return qt_QMetaEnum_flagDebugOperator_helper(debug, flags); +} + +inline QDebug operator<<(QDebug debug, QKeyCombination combination) +{ + QDebugStateSaver saver(debug); + debug.nospace() << "QKeyCombination(" + << combination.keyboardModifiers() + << ", " + << combination.key() + << ")"; + return debug; +} + +#ifdef Q_OS_DARWIN + +// We provide QDebug stream operators for commonly used Core Foundation +// and Core Graphics types, as well as NSObject. Additional CF/CG types +// may be added by the user, using Q_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE. + +#define QT_FOR_EACH_CORE_FOUNDATION_TYPE(F) \ + F(CFArray) \ + F(CFURL) \ + F(CFData) \ + F(CFNumber) \ + F(CFDictionary) \ + F(CFLocale) \ + F(CFDate) \ + F(CFBoolean) \ + F(CFTimeZone) \ + +#define QT_FOR_EACH_MUTABLE_CORE_FOUNDATION_TYPE(F) \ + F(CFError) \ + F(CFBundle) \ + +#define QT_FOR_EACH_CORE_GRAPHICS_TYPE(F) \ + F(CGPath) \ + +#define QT_FOR_EACH_MUTABLE_CORE_GRAPHICS_TYPE(F) \ + F(CGColorSpace) \ + F(CGImage) \ + F(CGFont) \ + F(CGColor) \ + +#define QT_FORWARD_DECLARE_CF_TYPE(type) Q_FORWARD_DECLARE_CF_TYPE(type); +#define QT_FORWARD_DECLARE_MUTABLE_CF_TYPE(type) Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(type); +#define QT_FORWARD_DECLARE_CG_TYPE(type) Q_FORWARD_DECLARE_CG_TYPE(type); +#define QT_FORWARD_DECLARE_MUTABLE_CG_TYPE(type) Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(type); + +QT_END_NAMESPACE +Q_FORWARD_DECLARE_CF_TYPE(CFString); +struct objc_object; +Q_FORWARD_DECLARE_OBJC_CLASS(NSObject); +QT_FOR_EACH_CORE_FOUNDATION_TYPE(QT_FORWARD_DECLARE_CF_TYPE) +QT_FOR_EACH_MUTABLE_CORE_FOUNDATION_TYPE(QT_FORWARD_DECLARE_MUTABLE_CF_TYPE) +QT_FOR_EACH_CORE_GRAPHICS_TYPE(QT_FORWARD_DECLARE_CG_TYPE) +QT_FOR_EACH_MUTABLE_CORE_GRAPHICS_TYPE(QT_FORWARD_DECLARE_MUTABLE_CG_TYPE) +QT_BEGIN_NAMESPACE + +#define QT_FORWARD_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE(CFType) \ + Q_CORE_EXPORT QDebug operator<<(QDebug, CFType##Ref); + +#define Q_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE(CFType) \ + QDebug operator<<(QDebug debug, CFType##Ref ref) \ + { \ + if (!ref) \ + return debug << QT_STRINGIFY(CFType) "Ref(0x0)"; \ + if (CFStringRef description = CFCopyDescription(ref)) { \ + QDebugStateSaver saver(debug); \ + debug.noquote() << description; \ + CFRelease(description); \ + } \ + return debug; \ + } + +// Defined in qcore_mac_objc.mm +#if defined(__OBJC__) +Q_CORE_EXPORT QDebug operator<<(QDebug, id); +#endif +Q_CORE_EXPORT QDebug operator<<(QDebug, objc_object *); +Q_CORE_EXPORT QDebug operator<<(QDebug, const NSObject *); +Q_CORE_EXPORT QDebug operator<<(QDebug, CFStringRef); + +QT_FOR_EACH_CORE_FOUNDATION_TYPE(QT_FORWARD_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE) +QT_FOR_EACH_MUTABLE_CORE_FOUNDATION_TYPE(QT_FORWARD_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE) +QT_FOR_EACH_CORE_GRAPHICS_TYPE(QT_FORWARD_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE) +QT_FOR_EACH_MUTABLE_CORE_GRAPHICS_TYPE(QT_FORWARD_DECLARE_QDEBUG_OPERATOR_FOR_CF_TYPE) + +#undef QT_FORWARD_DECLARE_CF_TYPE +#undef QT_FORWARD_DECLARE_MUTABLE_CF_TYPE +#undef QT_FORWARD_DECLARE_CG_TYPE +#undef QT_FORWARD_DECLARE_MUTABLE_CG_TYPE + +#endif // Q_OS_DARWIN + +QT_END_NAMESPACE + +#endif // QDEBUG_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qdir.h b/qt/6.8.1/msvc2022_64/include/QtCore/qdir.h new file mode 100644 index 0000000000000000000000000000000000000000..4dbffbafa7ca180441d8a3b48300f49344ad0d8e --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qdir.h @@ -0,0 +1,266 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QDIR_H +#define QDIR_H + +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QDirIterator; +class QDirPrivate; + +class Q_CORE_EXPORT QDir +{ +public: + enum Filter { Dirs = 0x001, + Files = 0x002, + Drives = 0x004, + NoSymLinks = 0x008, + AllEntries = Dirs | Files | Drives, + TypeMask = 0x00f, + + Readable = 0x010, + Writable = 0x020, + Executable = 0x040, + PermissionMask = 0x070, + + Modified = 0x080, + Hidden = 0x100, + System = 0x200, + + AccessMask = 0x3F0, + + AllDirs = 0x400, + CaseSensitive = 0x800, + NoDot = 0x2000, + NoDotDot = 0x4000, + NoDotAndDotDot = NoDot | NoDotDot, + + NoFilter = -1 + }; + Q_DECLARE_FLAGS(Filters, Filter) + + enum SortFlag { Name = 0x00, + Time = 0x01, + Size = 0x02, + Unsorted = 0x03, + SortByMask = 0x03, + + DirsFirst = 0x04, + Reversed = 0x08, + IgnoreCase = 0x10, + DirsLast = 0x20, + LocaleAware = 0x40, + Type = 0x80, + NoSort = -1 + }; + Q_DECLARE_FLAGS(SortFlags, SortFlag) + + QDir(const QDir &); + QDir(const QString &path = QString()); + QDir(const QString &path, const QString &nameFilter, + SortFlags sort = SortFlags(Name | IgnoreCase), Filters filter = AllEntries); +#ifdef Q_QDOC + QDir(const std::filesystem::path &path); + QDir(const std::filesystem::path &path, const QString &nameFilter, + SortFlags sort = SortFlags(Name | IgnoreCase), Filters filter = AllEntries); +#elif QT_CONFIG(cxx17_filesystem) + template = 0> + QDir(const T &path) : QDir(QtPrivate::fromFilesystemPath(path)) + { + } + template = 0> + QDir(const T &path, const QString &nameFilter, + SortFlags sort = SortFlags(Name | IgnoreCase), Filters filter = AllEntries) + : QDir(QtPrivate::fromFilesystemPath(path), nameFilter, sort, filter) + { + } +#endif // QT_CONFIG(cxx17_filesystem) + ~QDir(); + + QDir &operator=(const QDir &); + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QDir) + + void swap(QDir &other) noexcept + { d_ptr.swap(other.d_ptr); } + + void setPath(const QString &path); +#ifdef Q_QDOC + void setPath(const std::filesystem::path &path); +#elif QT_CONFIG(cxx17_filesystem) + template = 0> + void setPath(const T &path) + { + setPath(QtPrivate::fromFilesystemPath(path)); + } +#endif // QT_CONFIG(cxx17_filesystem) + QString path() const; + QString absolutePath() const; + QString canonicalPath() const; +#if QT_CONFIG(cxx17_filesystem) || defined(Q_QDOC) + std::filesystem::path filesystemPath() const + { return QtPrivate::toFilesystemPath(path()); } + std::filesystem::path filesystemAbsolutePath() const + { return QtPrivate::toFilesystemPath(absolutePath()); } + std::filesystem::path filesystemCanonicalPath() const + { return QtPrivate::toFilesystemPath(canonicalPath()); } +#endif // QT_CONFIG(cxx17_filesystem) + +#ifndef QT_BOOTSTRAPPED + static void setSearchPaths(const QString &prefix, const QStringList &searchPaths); + static void addSearchPath(const QString &prefix, const QString &path); +#ifdef Q_QDOC + static void addSearchPath(const QString &prefix, const std::filesystem::path &path); +#elif QT_CONFIG(cxx17_filesystem) + template = 0> + static void addSearchPath(const QString &prefix, const T &path) + { + addSearchPath(prefix, QtPrivate::fromFilesystemPath(path)); + } +#endif // QT_CONFIG(cxx17_filesystem) + static QStringList searchPaths(const QString &prefix); +#endif // QT_BOOTSTRAPPED + + QString dirName() const; + QString filePath(const QString &fileName) const; + QString absoluteFilePath(const QString &fileName) const; + QString relativeFilePath(const QString &fileName) const; + + static QString toNativeSeparators(const QString &pathName); + static QString fromNativeSeparators(const QString &pathName); + + bool cd(const QString &dirName); + bool cdUp(); + + QStringList nameFilters() const; + void setNameFilters(const QStringList &nameFilters); + + Filters filter() const; + void setFilter(Filters filter); + SortFlags sorting() const; + void setSorting(SortFlags sort); + +#if QT_CORE_REMOVED_SINCE(6, 5) + uint count() const; +#endif + qsizetype count(QT6_DECL_NEW_OVERLOAD) const; + bool isEmpty(Filters filters = Filters(AllEntries | NoDotAndDotDot)) const; + +#if QT_CORE_REMOVED_SINCE(6, 5) && QT_POINTER_SIZE != 4 + QString operator[](int) const; +#endif + QString operator[](qsizetype) const; + + static QStringList nameFiltersFromString(const QString &nameFilter); + + QStringList entryList(Filters filters = NoFilter, SortFlags sort = NoSort) const; + QStringList entryList(const QStringList &nameFilters, Filters filters = NoFilter, + SortFlags sort = NoSort) const; + + QFileInfoList entryInfoList(Filters filters = NoFilter, SortFlags sort = NoSort) const; + QFileInfoList entryInfoList(const QStringList &nameFilters, Filters filters = NoFilter, + SortFlags sort = NoSort) const; + + bool mkdir(const QString &dirName) const; + bool mkdir(const QString &dirName, QFile::Permissions permissions) const; + bool rmdir(const QString &dirName) const; + bool mkpath(const QString &dirPath) const; + bool rmpath(const QString &dirPath) const; + + bool removeRecursively(); + + bool isReadable() const; + bool exists() const; + bool isRoot() const; + + static bool isRelativePath(const QString &path); + inline static bool isAbsolutePath(const QString &path) { return !isRelativePath(path); } + bool isRelative() const; + inline bool isAbsolute() const { return !isRelative(); } + bool makeAbsolute(); + +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator==(const QDir &dir) const; + inline bool operator!=(const QDir &dir) const { return !operator==(dir); } +#endif + + bool remove(const QString &fileName); + bool rename(const QString &oldName, const QString &newName); + bool exists(const QString &name) const; + + static QFileInfoList drives(); + + constexpr static inline QChar listSeparator() noexcept + { +#if defined(Q_OS_WIN) + return u';'; +#else + return u':'; +#endif + } + + static QChar separator() + { +#if defined(Q_OS_WIN) + return u'\\'; +#else + return u'/'; +#endif + } + + static bool setCurrent(const QString &path); + static inline QDir current() { return QDir(currentPath()); } + static QString currentPath(); + + static inline QDir home() { return QDir(homePath()); } + static QString homePath(); + static inline QDir root() { return QDir(rootPath()); } + static QString rootPath(); + static inline QDir temp() { return QDir(tempPath()); } + static QString tempPath(); + +#if QT_CONFIG(regularexpression) + static bool match(const QStringList &filters, const QString &fileName); + static bool match(const QString &filter, const QString &fileName); +#endif + + static QString cleanPath(const QString &path); + void refresh() const; + +protected: + explicit QDir(QDirPrivate &d); + + QSharedDataPointer d_ptr; + +private: + friend Q_CORE_EXPORT bool comparesEqual(const QDir &lhs, const QDir &rhs); + Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QDir) + friend class QDirIterator; + friend class QDirListing; + friend class QDirListingPrivate; + // Q_DECLARE_PRIVATE equivalent for shared data pointers + QDirPrivate *d_func(); + const QDirPrivate *d_func() const { return d_ptr.constData(); } +}; + +Q_DECLARE_SHARED(QDir) +Q_DECLARE_OPERATORS_FOR_FLAGS(QDir::Filters) +Q_DECLARE_OPERATORS_FOR_FLAGS(QDir::SortFlags) + +#ifndef QT_NO_DEBUG_STREAM +class QDebug; +Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters); +Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QDir &dir); +#endif + +QT_END_NAMESPACE + +#endif // QDIR_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qdiriterator.h b/qt/6.8.1/msvc2022_64/include/QtCore/qdiriterator.h new file mode 100644 index 0000000000000000000000000000000000000000..3ed19d769e15532f19846fa405454489616e0373 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qdiriterator.h @@ -0,0 +1,55 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QDIRITERATOR_H +#define QDIRITERATOR_H + +#include + +QT_BEGIN_NAMESPACE + +class QDirIteratorPrivate; +class Q_CORE_EXPORT QDirIterator +{ +public: + enum IteratorFlag { + NoIteratorFlags = 0x0, + FollowSymlinks = 0x1, + Subdirectories = 0x2 + }; + Q_DECLARE_FLAGS(IteratorFlags, IteratorFlag) + + QDirIterator(const QDir &dir, IteratorFlags flags = NoIteratorFlags); + QDirIterator(const QString &path, + IteratorFlags flags = NoIteratorFlags); + QDirIterator(const QString &path, + QDir::Filters filter, + IteratorFlags flags = NoIteratorFlags); + QDirIterator(const QString &path, + const QStringList &nameFilters, + QDir::Filters filters = QDir::NoFilter, + IteratorFlags flags = NoIteratorFlags); + + ~QDirIterator(); + + QString next(); + QFileInfo nextFileInfo(); + bool hasNext() const; + + QString fileName() const; + QString filePath() const; + QFileInfo fileInfo() const; + QString path() const; + +private: + Q_DISABLE_COPY(QDirIterator) + + QScopedPointer d; + friend class QDir; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QDirIterator::IteratorFlags) + +QT_END_NAMESPACE + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qdirlisting.h b/qt/6.8.1/msvc2022_64/include/QtCore/qdirlisting.h new file mode 100644 index 0000000000000000000000000000000000000000..e0512439ad362586d37ccd659def0e4a68f25703 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qdirlisting.h @@ -0,0 +1,170 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2024 Ahmad Samir +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QDIRLISTING_H +#define QDIRLISTING_H + +#include +#include +#include +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +class QDirListingPrivate; +class QFileInfo; +class QDir; +class QTimeZone; + +class QDirListing +{ +public: + enum class IteratorFlag { + Default = 0x000000, + ExcludeFiles = 0x000004, + ExcludeDirs = 0x000008, + ExcludeSpecial = 0x000010, + ResolveSymlinks = 0x000020, + FilesOnly = ExcludeDirs | ExcludeSpecial, + DirsOnly = ExcludeFiles | ExcludeSpecial, + IncludeHidden = 0x000040, + IncludeDotAndDotDot = 0x000080, + CaseSensitive = 0x000100, + Recursive = 0x000400, + FollowDirSymlinks = 0x000800, + }; + Q_DECLARE_FLAGS(IteratorFlags, IteratorFlag) + + Q_CORE_EXPORT explicit QDirListing(const QString &path, + IteratorFlags flags = IteratorFlag::Default); + Q_CORE_EXPORT explicit QDirListing(const QString &path, const QStringList &nameFilters, + IteratorFlags flags = IteratorFlag::Default); + + QDirListing(QDirListing &&other) noexcept + : d{std::exchange(other.d, nullptr)} {} + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QDirListing) + + void swap(QDirListing &other) noexcept { qt_ptr_swap(d, other.d); } + + Q_CORE_EXPORT ~QDirListing(); + + Q_CORE_EXPORT QString iteratorPath() const; + Q_CORE_EXPORT IteratorFlags iteratorFlags() const; + Q_CORE_EXPORT QStringList nameFilters() const; + + class DirEntry + { + friend class QDirListing; + QDirListingPrivate *dirListPtr = nullptr; + public: + Q_CORE_EXPORT QString fileName() const; + Q_CORE_EXPORT QString baseName() const; + Q_CORE_EXPORT QString completeBaseName() const; + Q_CORE_EXPORT QString suffix() const; + Q_CORE_EXPORT QString bundleName() const; + Q_CORE_EXPORT QString completeSuffix() const; + Q_CORE_EXPORT QString filePath() const; + Q_CORE_EXPORT bool isDir() const; + Q_CORE_EXPORT bool isFile() const; + Q_CORE_EXPORT bool isSymLink() const; + Q_CORE_EXPORT bool exists() const; + Q_CORE_EXPORT bool isHidden() const; + Q_CORE_EXPORT bool isReadable() const; + Q_CORE_EXPORT bool isWritable() const; + Q_CORE_EXPORT bool isExecutable() const; + Q_CORE_EXPORT QFileInfo fileInfo() const; + Q_CORE_EXPORT QString canonicalFilePath() const; + Q_CORE_EXPORT QString absoluteFilePath() const; + Q_CORE_EXPORT QString absolutePath() const; + Q_CORE_EXPORT qint64 size() const; + + QDateTime birthTime(const QTimeZone &tz) const + { return fileTime(QFileDevice::FileBirthTime, tz); } + QDateTime metadataChangeTime(const QTimeZone &tz) const + { return fileTime(QFileDevice::FileMetadataChangeTime, tz); } + QDateTime lastModified(const QTimeZone &tz) const + { return fileTime(QFileDevice::FileModificationTime, tz); } + QDateTime lastRead(const QTimeZone &tz) const + { return fileTime(QFileDevice::FileAccessTime, tz); } + Q_CORE_EXPORT QDateTime fileTime(QFileDevice::FileTime type, const QTimeZone &tz) const; + }; + + class sentinel + { + friend constexpr bool operator==(sentinel, sentinel) noexcept { return true; } + friend constexpr bool operator!=(sentinel, sentinel) noexcept { return false; } + }; + + class const_iterator + { + Q_DISABLE_COPY(const_iterator) + friend class QDirListing; + explicit const_iterator(QDirListingPrivate *dp) { dirEntry.dirListPtr = dp; } + DirEntry dirEntry; + public: + using iterator_category = std::input_iterator_tag; + using value_type = DirEntry; + using difference_type = qint64; + using pointer = const value_type *; + using reference = const value_type &; + + const_iterator() = default; + const_iterator(const_iterator &&) noexcept = default; + const_iterator &operator=(const_iterator &&) noexcept = default; + + reference operator*() const { return dirEntry; } + pointer operator->() const { return &dirEntry; } + const_iterator &operator++() { dirEntry = next(dirEntry); return *this; } + void operator++(int) { ++*this; }; // [iterator.concept.winc]/14 not required to return sth + private: + bool atEnd() const noexcept { return dirEntry.dirListPtr == nullptr; } + friend bool operator==(const const_iterator &lhs, sentinel) noexcept { return lhs.atEnd(); } +#ifndef __cpp_impl_three_way_comparison + friend bool operator!=(const const_iterator &lhs, sentinel) noexcept + { return !operator==(lhs, sentinel{}); } + friend bool operator==(sentinel, const const_iterator &rhs) noexcept + { return operator==(rhs, sentinel{}); } + friend bool operator!=(sentinel, const const_iterator &rhs) noexcept + { return !operator==(sentinel{}, rhs); } +#endif // __cpp_impl_three_way_comparison + }; + + Q_CORE_EXPORT const_iterator begin() const; + const_iterator cbegin() const { return begin(); } + sentinel end() const { return {}; } + sentinel cend() const { return end(); } + + // Qt compatibility + const_iterator constBegin() const { return begin(); } + sentinel constEnd() const { return end(); } + +private: + Q_DISABLE_COPY(QDirListing) + + Q_CORE_EXPORT static DirEntry next(DirEntry); + + // Private constructor that is used in deprecated code paths. + // `uint` instead of QDir::Filters and QDirIterator::IteratorFlags + // because qdir.h can't be included here; qdiriterator.h can't included + // either, because it includes qdir.h + Q_CORE_EXPORT QDirListing(const QString &path, const QStringList &nameFilters, uint dirFilters, + uint qdirIteratorFlags = 0); // QDirIterator::NoIteratorFlags == 0x0 + + QDirListingPrivate *d; + friend class QDir; + friend class QDirPrivate; + friend class QDirIteratorPrivate; + friend class QAbstractFileEngine; + friend class QFileInfoGatherer; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QDirListing::IteratorFlags) + +QT_END_NAMESPACE + +#endif // QDIRLISTING_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qeasingcurve.h b/qt/6.8.1/msvc2022_64/include/QtCore/qeasingcurve.h new file mode 100644 index 0000000000000000000000000000000000000000..465b60eaf84791b407fc3f97f5d4701f639f45e3 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qeasingcurve.h @@ -0,0 +1,106 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QEASINGCURVE_H +#define QEASINGCURVE_H + +#include + +QT_REQUIRE_CONFIG(easingcurve); + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QEasingCurvePrivate; +class QPointF; +class Q_CORE_EXPORT QEasingCurve +{ + Q_GADGET +public: + enum Type { + Linear, + InQuad, OutQuad, InOutQuad, OutInQuad, + InCubic, OutCubic, InOutCubic, OutInCubic, + InQuart, OutQuart, InOutQuart, OutInQuart, + InQuint, OutQuint, InOutQuint, OutInQuint, + InSine, OutSine, InOutSine, OutInSine, + InExpo, OutExpo, InOutExpo, OutInExpo, + InCirc, OutCirc, InOutCirc, OutInCirc, + InElastic, OutElastic, InOutElastic, OutInElastic, + InBack, OutBack, InOutBack, OutInBack, + InBounce, OutBounce, InOutBounce, OutInBounce, + InCurve, OutCurve, SineCurve, CosineCurve, + BezierSpline, TCBSpline, Custom, NCurveTypes + }; + Q_ENUM(Type) + + QEasingCurve(Type type = Linear); + QEasingCurve(const QEasingCurve &other); + ~QEasingCurve(); + + QEasingCurve &operator=(const QEasingCurve &other) + { if ( this != &other ) { QEasingCurve copy(other); swap(copy); } return *this; } + QEasingCurve(QEasingCurve &&other) noexcept : d_ptr(other.d_ptr) { other.d_ptr = nullptr; } + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QEasingCurve) + + void swap(QEasingCurve &other) noexcept { qt_ptr_swap(d_ptr, other.d_ptr); } + +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator==(const QEasingCurve &other) const; + inline bool operator!=(const QEasingCurve &other) const + { return !(this->operator==(other)); } +#endif + + qreal amplitude() const; + void setAmplitude(qreal amplitude); + + qreal period() const; + void setPeriod(qreal period); + + qreal overshoot() const; + void setOvershoot(qreal overshoot); + + void addCubicBezierSegment(const QPointF &c1, const QPointF &c2, const QPointF &endPoint); + void addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qreal b); + QList toCubicSpline() const; + + Type type() const; + void setType(Type type); + typedef qreal (*EasingFunction)(qreal progress); + void setCustomType(EasingFunction func); + EasingFunction customType() const; + + qreal valueForProgress(qreal progress) const; + +private: + QEasingCurvePrivate *d_ptr; +#ifndef QT_NO_DEBUG_STREAM + friend Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QEasingCurve &item); +#endif +#ifndef QT_NO_DATASTREAM + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QEasingCurve &); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QEasingCurve &); +#endif + friend Q_CORE_EXPORT bool + comparesEqual(const QEasingCurve &lhs, const QEasingCurve &rhs); +#if !QT_CORE_REMOVED_SINCE(6, 8) + Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QEasingCurve) +#endif +}; +Q_DECLARE_SHARED(QEasingCurve) + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QEasingCurve &item); +#endif + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QEasingCurve &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QEasingCurve &); +#endif + +QT_END_NAMESPACE + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qelapsedtimer.h b/qt/6.8.1/msvc2022_64/include/QtCore/qelapsedtimer.h new file mode 100644 index 0000000000000000000000000000000000000000..6004de7fe9dac05981c3fd4c32cb105da272f48f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qelapsedtimer.h @@ -0,0 +1,90 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QELAPSEDTIMER_H +#define QELAPSEDTIMER_H + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class Q_CORE_EXPORT QElapsedTimer +{ +public: + enum ClockType { + SystemTime, + MonotonicClock, + TickCounter Q_DECL_ENUMERATOR_DEPRECATED_X( + "Not supported anymore. Use PerformanceCounter instead."), + MachAbsoluteTime, + PerformanceCounter + }; + + // similar to std::chrono::*_clock + using Duration = std::chrono::nanoseconds; + using TimePoint = std::chrono::time_point; + + constexpr QElapsedTimer() = default; + + static ClockType clockType() noexcept; + static bool isMonotonic() noexcept; + + void start() noexcept; + qint64 restart() noexcept; + void invalidate() noexcept; + bool isValid() const noexcept; + + Duration durationElapsed() const noexcept; + qint64 nsecsElapsed() const noexcept; + qint64 elapsed() const noexcept; + bool hasExpired(qint64 timeout) const noexcept; + + qint64 msecsSinceReference() const noexcept; + Duration durationTo(const QElapsedTimer &other) const noexcept; + qint64 msecsTo(const QElapsedTimer &other) const noexcept; + qint64 secsTo(const QElapsedTimer &other) const noexcept; + friend bool Q_CORE_EXPORT operator<(const QElapsedTimer &lhs, const QElapsedTimer &rhs) noexcept; + +private: + friend bool comparesEqual(const QElapsedTimer &lhs, const QElapsedTimer &rhs) noexcept + { + return lhs.t1 == rhs.t1 && lhs.t2 == rhs.t2; + } + Q_DECLARE_EQUALITY_COMPARABLE(QElapsedTimer) + + friend Qt::strong_ordering compareThreeWay(const QElapsedTimer &lhs, + const QElapsedTimer &rhs) noexcept + { + return Qt::compareThreeWay(lhs.t1, rhs.t1); + } + +#if defined(__cpp_lib_three_way_comparison) + friend std::strong_ordering + operator<=>(const QElapsedTimer &lhs, const QElapsedTimer &rhs) noexcept + { + return compareThreeWay(lhs, rhs); + } +#else + friend bool operator>(const QElapsedTimer &lhs, const QElapsedTimer &rhs) noexcept + { + return is_gt(compareThreeWay(lhs, rhs)); + } + friend bool operator<=(const QElapsedTimer &lhs, const QElapsedTimer &rhs) noexcept + { + return is_lteq(compareThreeWay(lhs, rhs)); + } + friend bool operator>=(const QElapsedTimer &lhs, const QElapsedTimer &rhs) noexcept + { + return is_gteq(compareThreeWay(lhs, rhs)); + } +#endif // defined(__cpp_lib_three_way_comparison) + qint64 t1 = Q_INT64_C(0x8000000000000000); + qint64 t2 = Q_INT64_C(0x8000000000000000); +}; + +QT_END_NAMESPACE + +#endif // QELAPSEDTIMER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qendian.h b/qt/6.8.1/msvc2022_64/include/QtCore/qendian.h new file mode 100644 index 0000000000000000000000000000000000000000..75af8c242fadc74149e197c78bc688105f9b9efe --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qendian.h @@ -0,0 +1,408 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// Copyright (C) 2021 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QENDIAN_H +#define QENDIAN_H + +#if 0 +#pragma qt_class(QtEndian) +#endif + +#include +#include + +#include + +// include stdlib.h and hope that it defines __GLIBC__ for glibc-based systems +#include +#include + +#ifdef min // MSVC +#undef min +#undef max +#endif + +QT_BEGIN_NAMESPACE + +/* + * ENDIAN FUNCTIONS +*/ + +// Used to implement a type-safe and alignment-safe copy operation +// If you want to avoid the memcpy, you must write specializations for these functions +template Q_ALWAYS_INLINE void qToUnaligned(const T src, void *dest) +{ + // Using sizeof(T) inside memcpy function produces internal compiler error with + // MSVC2008/ARM in tst_endian -> use extra indirection to resolve size of T. + const size_t size = sizeof(T); +#if __has_builtin(__builtin_memcpy) + __builtin_memcpy +#else + memcpy +#endif + (dest, &src, size); +} + +template Q_ALWAYS_INLINE T qFromUnaligned(const void *src) +{ + T dest; + const size_t size = sizeof(T); +#if __has_builtin(__builtin_memcpy) + __builtin_memcpy +#else + memcpy +#endif + (&dest, src, size); + return dest; +} + +// These definitions are written so that they are recognized by most compilers +// as bswap and replaced with single instruction builtins if available. +inline constexpr quint64 qbswap_helper(quint64 source) +{ + return 0 + | ((source & Q_UINT64_C(0x00000000000000ff)) << 56) + | ((source & Q_UINT64_C(0x000000000000ff00)) << 40) + | ((source & Q_UINT64_C(0x0000000000ff0000)) << 24) + | ((source & Q_UINT64_C(0x00000000ff000000)) << 8) + | ((source & Q_UINT64_C(0x000000ff00000000)) >> 8) + | ((source & Q_UINT64_C(0x0000ff0000000000)) >> 24) + | ((source & Q_UINT64_C(0x00ff000000000000)) >> 40) + | ((source & Q_UINT64_C(0xff00000000000000)) >> 56); +} + +inline constexpr quint32 qbswap_helper(quint32 source) +{ + return 0 + | ((source & 0x000000ff) << 24) + | ((source & 0x0000ff00) << 8) + | ((source & 0x00ff0000) >> 8) + | ((source & 0xff000000) >> 24); +} + +inline constexpr quint16 qbswap_helper(quint16 source) +{ + return quint16( 0 + | ((source & 0x00ff) << 8) + | ((source & 0xff00) >> 8) ); +} + +inline constexpr quint8 qbswap_helper(quint8 source) +{ + return source; +} + +/* + * T qbswap(T source). + * Changes the byte order of a value from big-endian to little-endian or vice versa. + * This function can be used if you are not concerned about alignment issues, + * and it is therefore a bit more convenient and in most cases more efficient. +*/ +template >> +inline constexpr T qbswap(T source) +{ + return T(qbswap_helper(typename QIntegerForSizeof::Unsigned(source))); +} + +#ifdef QT_SUPPORTS_INT128 +// extra definitions for q(u)int128, in case std::is_integral_v<~~> == false +inline constexpr quint128 qbswap(quint128 source) +{ + quint128 result = {}; + result = qbswap_helper(quint64(source)); + result <<= 64; + result |= qbswap_helper(quint64(source >> 64)); + return result; +} + +inline constexpr qint128 qbswap(qint128 source) +{ + return qint128(qbswap(quint128(source))); +} +#endif + +// floating specializations +template +Float qbswapFloatHelper(Float source) +{ + // memcpy call in qFromUnaligned is recognized by optimizer as a correct way of type prunning + auto temp = qFromUnaligned::Unsigned>(&source); + temp = qbswap(temp); + return qFromUnaligned(&temp); +} + +inline qfloat16 qbswap(qfloat16 source) +{ + return qbswapFloatHelper(source); +} + +inline float qbswap(float source) +{ + return qbswapFloatHelper(source); +} + +inline double qbswap(double source) +{ + return qbswapFloatHelper(source); +} + +/* + * qbswap(const T src, const void *dest); + * Changes the byte order of \a src from big-endian to little-endian or vice versa + * and stores the result in \a dest. + * There is no alignment requirements for \a dest. +*/ +template inline void qbswap(const T src, void *dest) +{ + qToUnaligned(qbswap(src), dest); +} + +template void *qbswap(const void *source, qsizetype count, void *dest) noexcept; +template<> inline void *qbswap<1>(const void *source, qsizetype count, void *dest) noexcept +{ + return source != dest ? memcpy(dest, source, size_t(count)) : dest; +} +template<> Q_CORE_EXPORT void *qbswap<2>(const void *source, qsizetype count, void *dest) noexcept; +template<> Q_CORE_EXPORT void *qbswap<4>(const void *source, qsizetype count, void *dest) noexcept; +template<> Q_CORE_EXPORT void *qbswap<8>(const void *source, qsizetype count, void *dest) noexcept; + +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + +template inline constexpr T qToBigEndian(T source) +{ return source; } +template inline constexpr T qFromBigEndian(T source) +{ return source; } +template inline constexpr T qToLittleEndian(T source) +{ return qbswap(source); } +template inline constexpr T qFromLittleEndian(T source) +{ return qbswap(source); } +template inline void qToBigEndian(T src, void *dest) +{ qToUnaligned(src, dest); } +template inline void qToLittleEndian(T src, void *dest) +{ qbswap(src, dest); } + +template inline void qToBigEndian(const void *source, qsizetype count, void *dest) +{ if (source != dest) memcpy(dest, source, count * sizeof(T)); } +template inline void qToLittleEndian(const void *source, qsizetype count, void *dest) +{ qbswap(source, count, dest); } +template inline void qFromBigEndian(const void *source, qsizetype count, void *dest) +{ if (source != dest) memcpy(dest, source, count * sizeof(T)); } +template inline void qFromLittleEndian(const void *source, qsizetype count, void *dest) +{ qbswap(source, count, dest); } +#else // Q_LITTLE_ENDIAN + +template inline constexpr T qToBigEndian(T source) +{ return qbswap(source); } +template inline constexpr T qFromBigEndian(T source) +{ return qbswap(source); } +template inline constexpr T qToLittleEndian(T source) +{ return source; } +template inline constexpr T qFromLittleEndian(T source) +{ return source; } +template inline void qToBigEndian(T src, void *dest) +{ qbswap(src, dest); } +template inline void qToLittleEndian(T src, void *dest) +{ qToUnaligned(src, dest); } + +template inline void qToBigEndian(const void *source, qsizetype count, void *dest) +{ qbswap(source, count, dest); } +template inline void qToLittleEndian(const void *source, qsizetype count, void *dest) +{ if (source != dest) memcpy(dest, source, count * sizeof(T)); } +template inline void qFromBigEndian(const void *source, qsizetype count, void *dest) +{ qbswap(source, count, dest); } +template inline void qFromLittleEndian(const void *source, qsizetype count, void *dest) +{ if (source != dest) memcpy(dest, source, count * sizeof(T)); } +#endif // Q_BYTE_ORDER == Q_BIG_ENDIAN + + +/* T qFromLittleEndian(const void *src) + * This function will read a little-endian encoded value from \a src + * and return the value in host-endian encoding. + * There is no requirement that \a src must be aligned. +*/ +template inline T qFromLittleEndian(const void *src) +{ + return qFromLittleEndian(qFromUnaligned(src)); +} + +template <> inline quint8 qFromLittleEndian(const void *src) +{ return static_cast(src)[0]; } +template <> inline qint8 qFromLittleEndian(const void *src) +{ return static_cast(src)[0]; } + +/* This function will read a big-endian (also known as network order) encoded value from \a src + * and return the value in host-endian encoding. + * There is no requirement that \a src must be aligned. +*/ +template inline T qFromBigEndian(const void *src) +{ + return qFromBigEndian(qFromUnaligned(src)); +} + +template <> inline quint8 qFromBigEndian(const void *src) +{ return static_cast(src)[0]; } +template <> inline qint8 qFromBigEndian(const void *src) +{ return static_cast(src)[0]; } + +template +class QSpecialInteger +{ + typedef typename S::StorageType T; + T val; +public: + QSpecialInteger() = default; + explicit constexpr QSpecialInteger(T i) : val(S::toSpecial(i)) {} + + QSpecialInteger &operator =(T i) { val = S::toSpecial(i); return *this; } + operator T() const { return S::fromSpecial(val); } + + bool operator ==(QSpecialInteger i) const { return val == i.val; } + bool operator !=(QSpecialInteger i) const { return val != i.val; } + + QSpecialInteger &operator +=(T i) + { return (*this = S::fromSpecial(val) + i); } + QSpecialInteger &operator -=(T i) + { return (*this = S::fromSpecial(val) - i); } + QSpecialInteger &operator *=(T i) + { return (*this = S::fromSpecial(val) * i); } + QSpecialInteger &operator >>=(T i) + { return (*this = S::fromSpecial(val) >> i); } + QSpecialInteger &operator <<=(T i) + { return (*this = S::fromSpecial(val) << i); } + QSpecialInteger &operator /=(T i) + { return (*this = S::fromSpecial(val) / i); } + QSpecialInteger &operator %=(T i) + { return (*this = S::fromSpecial(val) % i); } + QSpecialInteger &operator |=(T i) + { return (*this = S::fromSpecial(val) | i); } + QSpecialInteger &operator &=(T i) + { return (*this = S::fromSpecial(val) & i); } + QSpecialInteger &operator ^=(T i) + { return (*this = S::fromSpecial(val) ^ i); } + QSpecialInteger &operator ++() + { return (*this = S::fromSpecial(val) + 1); } + QSpecialInteger &operator --() + { return (*this = S::fromSpecial(val) - 1); } + QSpecialInteger operator ++(int) + { + QSpecialInteger pre = *this; + *this += 1; + return pre; + } + QSpecialInteger operator --(int) + { + QSpecialInteger pre = *this; + *this -= 1; + return pre; + } + + static constexpr QSpecialInteger max() + { return QSpecialInteger((std::numeric_limits::max)()); } + static constexpr QSpecialInteger min() + { return QSpecialInteger((std::numeric_limits::min)()); } +}; + +template +class QLittleEndianStorageType { +public: + typedef T StorageType; + static constexpr T toSpecial(T source) { return qToLittleEndian(source); } + static constexpr T fromSpecial(T source) { return qFromLittleEndian(source); } +}; + +template +class QBigEndianStorageType { +public: + typedef T StorageType; + static constexpr T toSpecial(T source) { return qToBigEndian(source); } + static constexpr T fromSpecial(T source) { return qFromBigEndian(source); } +}; + +#ifdef Q_QDOC +template +class QLEInteger { +public: + explicit constexpr QLEInteger(T i); + QLEInteger &operator =(T i); + operator T() const; + bool operator ==(QLEInteger i) const; + bool operator !=(QLEInteger i) const; + QLEInteger &operator +=(T i); + QLEInteger &operator -=(T i); + QLEInteger &operator *=(T i); + QLEInteger &operator >>=(T i); + QLEInteger &operator <<=(T i); + QLEInteger &operator /=(T i); + QLEInteger &operator %=(T i); + QLEInteger &operator |=(T i); + QLEInteger &operator &=(T i); + QLEInteger &operator ^=(T i); + QLEInteger &operator ++(); + QLEInteger &operator --(); + QLEInteger operator ++(int); + QLEInteger operator --(int); + + static constexpr QLEInteger max(); + static constexpr QLEInteger min(); +}; + +template +class QBEInteger { +public: + explicit constexpr QBEInteger(T i); + QBEInteger &operator =(T i); + operator T() const; + bool operator ==(QBEInteger i) const; + bool operator !=(QBEInteger i) const; + QBEInteger &operator +=(T i); + QBEInteger &operator -=(T i); + QBEInteger &operator *=(T i); + QBEInteger &operator >>=(T i); + QBEInteger &operator <<=(T i); + QBEInteger &operator /=(T i); + QBEInteger &operator %=(T i); + QBEInteger &operator |=(T i); + QBEInteger &operator &=(T i); + QBEInteger &operator ^=(T i); + QBEInteger &operator ++(); + QBEInteger &operator --(); + QBEInteger operator ++(int); + QBEInteger operator --(int); + + static constexpr QBEInteger max(); + static constexpr QBEInteger min(); +}; +#else + +template +using QLEInteger = QSpecialInteger>; + +template +using QBEInteger = QSpecialInteger>; +#endif +template +class QTypeInfo > + : public QTypeInfoMerger, T> {}; + +template +class QTypeInfo > + : public QTypeInfoMerger, T> {}; + +typedef QLEInteger qint16_le; +typedef QLEInteger qint32_le; +typedef QLEInteger qint64_le; +typedef QLEInteger quint16_le; +typedef QLEInteger quint32_le; +typedef QLEInteger quint64_le; + +typedef QBEInteger qint16_be; +typedef QBEInteger qint32_be; +typedef QBEInteger qint64_be; +typedef QBEInteger quint16_be; +typedef QBEInteger quint32_be; +typedef QBEInteger quint64_be; + +QT_END_NAMESPACE + +#endif // QENDIAN_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qeventloop.h b/qt/6.8.1/msvc2022_64/include/QtCore/qeventloop.h new file mode 100644 index 0000000000000000000000000000000000000000..d9b2adb586afd117bb60c6a340b2bff31f9c7248 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qeventloop.h @@ -0,0 +1,97 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QEVENTLOOP_H +#define QEVENTLOOP_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QEventLoopLocker; +class QEventLoopPrivate; + +class Q_CORE_EXPORT QEventLoop : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QEventLoop) + friend class QEventLoopLocker; + +public: + explicit QEventLoop(QObject *parent = nullptr); + ~QEventLoop(); + + enum ProcessEventsFlag { + AllEvents = 0x00, + ExcludeUserInputEvents = 0x01, + ExcludeSocketNotifiers = 0x02, + WaitForMoreEvents = 0x04, + X11ExcludeTimers = 0x08, + EventLoopExec = 0x20, + DialogExec = 0x40, + ApplicationExec = 0x80, + }; + Q_DECLARE_FLAGS(ProcessEventsFlags, ProcessEventsFlag) + Q_FLAG(ProcessEventsFlags) + + bool processEvents(ProcessEventsFlags flags = AllEvents); + void processEvents(ProcessEventsFlags flags, int maximumTime); + void processEvents(ProcessEventsFlags flags, QDeadlineTimer deadline); + + int exec(ProcessEventsFlags flags = AllEvents); + bool isRunning() const; + + void wakeUp(); + + bool event(QEvent *event) override; + +public Q_SLOTS: + void exit(int returnCode = 0); + void quit(); +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QEventLoop::ProcessEventsFlags) + +class QEventLoopLockerPrivate; + +class QEventLoopLocker +{ +public: + Q_NODISCARD_CTOR Q_CORE_EXPORT QEventLoopLocker() noexcept; + Q_NODISCARD_CTOR Q_CORE_EXPORT explicit QEventLoopLocker(QEventLoop *loop) noexcept; + Q_NODISCARD_CTOR Q_CORE_EXPORT explicit QEventLoopLocker(QThread *thread) noexcept; + Q_CORE_EXPORT ~QEventLoopLocker(); + + Q_NODISCARD_CTOR QEventLoopLocker(QEventLoopLocker &&other) noexcept + : p{std::exchange(other.p, 0)} {} + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QEventLoopLocker) + + void swap(QEventLoopLocker &other) noexcept { std::swap(p, other.p); } + friend void swap(QEventLoopLocker &lhs, QEventLoopLocker &rhs) noexcept { lhs.swap(rhs); } + +private: + Q_DISABLE_COPY(QEventLoopLocker) + friend class QEventLoopLockerPrivate; + + // + // Private implementation details. + // Do not call from public inline API! + // + enum class Type : quintptr { + EventLoop, + Thread, + Application, + }; + explicit QEventLoopLocker(void *ptr, Type t) noexcept; + quintptr p; + static constexpr quintptr TypeMask = 0x3; + Type type() const { return Type(p & TypeMask); } + void *pointer() const { return reinterpret_cast(p & ~TypeMask); } + template + void visit(Func func) const; +}; + +QT_END_NAMESPACE + +#endif // QEVENTLOOP_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qexception.h b/qt/6.8.1/msvc2022_64/include/QtCore/qexception.h new file mode 100644 index 0000000000000000000000000000000000000000..9c489f245e0a249d5769788df3c68294b9fd21af --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qexception.h @@ -0,0 +1,87 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTCORE_QEXCEPTION_H +#define QTCORE_QEXCEPTION_H + +#include +#include + +#ifndef QT_NO_EXCEPTIONS +# include +#endif + +QT_REQUIRE_CONFIG(future); + +QT_BEGIN_NAMESPACE + + +#if !defined(QT_NO_EXCEPTIONS) || defined(Q_QDOC) + +class Q_CORE_EXPORT QException : public std::exception +{ +public: + ~QException() noexcept; + virtual void raise() const; + virtual QException *clone() const; +}; + +class QUnhandledExceptionPrivate; +class Q_CORE_EXPORT QUnhandledException final : public QException +{ +public: + QUnhandledException(std::exception_ptr exception = nullptr) noexcept; + ~QUnhandledException() noexcept override; + + QUnhandledException(QUnhandledException &&other) noexcept; + QUnhandledException(const QUnhandledException &other) noexcept; + + void swap(QUnhandledException &other) noexcept { d.swap(other.d); } + + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QUnhandledException) + QUnhandledException &operator=(const QUnhandledException &other) noexcept; + + void raise() const override; + QUnhandledException *clone() const override; + + std::exception_ptr exception() const; + +private: + QSharedDataPointer d; +}; + +namespace QtPrivate { + +class Q_CORE_EXPORT ExceptionStore +{ +public: + void setException(const QException &e); + void setException(std::exception_ptr e); + bool hasException() const; + std::exception_ptr exception() const; + void throwPossibleException(); + Q_NORETURN void rethrowException() const; + std::exception_ptr exceptionHolder; +}; + +} // namespace QtPrivate + +#else // QT_NO_EXCEPTIONS + +namespace QtPrivate { + +class Q_CORE_EXPORT ExceptionStore +{ +public: + ExceptionStore() { } + inline void throwPossibleException() {} + inline void rethrowException() const { } +}; + +} // namespace QtPrivate + +#endif // QT_NO_EXCEPTIONS + +QT_END_NAMESPACE + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qexceptionhandling.h b/qt/6.8.1/msvc2022_64/include/QtCore/qexceptionhandling.h new file mode 100644 index 0000000000000000000000000000000000000000..7ab69dd1ad78a913b88bb42d4410ae12cca491fb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qexceptionhandling.h @@ -0,0 +1,40 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QEXCEPTIONHANDLING_H +#define QEXCEPTIONHANDLING_H + +#include +#include +#include + +#if 0 +#pragma qt_class(QtExceptionHandling) +#pragma qt_sync_stop_processing +#endif + +QT_BEGIN_NAMESPACE + +/* These wrap try/catch so we can switch off exceptions later. + + Beware - do not use more than one QT_CATCH per QT_TRY, and do not use + the exception instance in the catch block. + If you can't live with those constraints, don't use these macros. + Use the QT_NO_EXCEPTIONS macro to protect your code instead. +*/ +Q_NORETURN Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qTerminate() noexcept; +#ifdef QT_NO_EXCEPTIONS +# define QT_TRY if (true) +# define QT_CATCH(A) else +# define QT_THROW(A) qt_noop() +# define QT_RETHROW qt_noop() +#else +# define QT_TRY try +# define QT_CATCH(A) catch (A) +# define QT_THROW(A) throw A +# define QT_RETHROW throw +#endif + +QT_END_NAMESPACE + +#endif // QEXCEPTIONHANDLING_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qfactoryinterface.h b/qt/6.8.1/msvc2022_64/include/QtCore/qfactoryinterface.h new file mode 100644 index 0000000000000000000000000000000000000000..3f62a81d4905fc3f275a973d913357b3a75929e8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qfactoryinterface.h @@ -0,0 +1,24 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QFACTORYINTERFACE_H +#define QFACTORYINTERFACE_H + +#include +#include + +QT_BEGIN_NAMESPACE + +struct Q_CORE_EXPORT QFactoryInterface +{ + virtual ~QFactoryInterface(); + virtual QStringList keys() const = 0; +}; + +#ifndef Q_QDOC +Q_DECLARE_INTERFACE(QFactoryInterface, "org.qt-project.Qt.QFactoryInterface") +#endif + +QT_END_NAMESPACE + +#endif // QFACTORYINTERFACE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qfile.h b/qt/6.8.1/msvc2022_64/include/QtCore/qfile.h new file mode 100644 index 0000000000000000000000000000000000000000..2b8a834f4127939e4389ffdb3dbbb3d3ce0623b3 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qfile.h @@ -0,0 +1,329 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QFILE_H +#define QFILE_H + +#include +#include +#include + +#if QT_CONFIG(cxx17_filesystem) +#include +#elif defined(Q_QDOC) +namespace std { + namespace filesystem { + class path { + }; + }; +}; +#endif + +#ifdef open +#error qfile.h must be included before any header file that defines open +#endif + +QT_BEGIN_NAMESPACE + +#if defined(Q_OS_WIN) || defined(Q_QDOC) + +#if QT_DEPRECATED_SINCE(6,6) +QT_DEPRECATED_VERSION_X_6_6("Use QNtfsPermissionCheckGuard RAII class instead.") +Q_CORE_EXPORT extern int qt_ntfs_permission_lookup; // defined in qfilesystemengine_win.cpp +#endif + +Q_CORE_EXPORT bool qEnableNtfsPermissionChecks() noexcept; +Q_CORE_EXPORT bool qDisableNtfsPermissionChecks() noexcept; +Q_CORE_EXPORT bool qAreNtfsPermissionChecksEnabled() noexcept; + +class QNtfsPermissionCheckGuard +{ + Q_DISABLE_COPY_MOVE(QNtfsPermissionCheckGuard) +public: + Q_NODISCARD_CTOR + QNtfsPermissionCheckGuard() + { + qEnableNtfsPermissionChecks(); + } + + ~QNtfsPermissionCheckGuard() + { + qDisableNtfsPermissionChecks(); + } +}; +#endif // Q_OS_WIN + +#if QT_CONFIG(cxx17_filesystem) +namespace QtPrivate { +inline QString fromFilesystemPath(const std::filesystem::path &path) +{ +#ifdef Q_OS_WIN + return QString::fromStdWString(path.native()); +#else + return QString::fromStdString(path.native()); +#endif +} + +inline std::filesystem::path toFilesystemPath(const QString &path) +{ + return std::filesystem::path(reinterpret_cast(path.cbegin()), + reinterpret_cast(path.cend())); +} + +// Both std::filesystem::path and QString (without QT_NO_CAST_FROM_ASCII) can be implicitly +// constructed from string literals so we force the std::fs::path parameter to only +// accept std::fs::path with no implicit conversions. +template +using ForceFilesystemPath = typename std::enable_if_t, int>; +} +#endif // QT_CONFIG(cxx17_filesystem) + +class QTemporaryFile; +class QFilePrivate; + +// ### Qt 7: remove this, and make constructors always explicit. +#if (QT_VERSION >= QT_VERSION_CHECK(6, 9, 0)) || defined(QT_EXPLICIT_QFILE_CONSTRUCTION_FROM_PATH) +# define QFILE_MAYBE_EXPLICIT explicit +#else +# define QFILE_MAYBE_EXPLICIT Q_IMPLICIT +#endif + +class Q_CORE_EXPORT QFile : public QFileDevice +{ +#ifndef QT_NO_QOBJECT + Q_OBJECT +#endif + Q_DECLARE_PRIVATE(QFile) + +public: + QFile(); + QFILE_MAYBE_EXPLICIT QFile(const QString &name); +#ifdef Q_QDOC + QFILE_MAYBE_EXPLICIT QFile(const std::filesystem::path &name); +#elif QT_CONFIG(cxx17_filesystem) + template = 0> + QFILE_MAYBE_EXPLICIT QFile(const T &name) : QFile(QtPrivate::fromFilesystemPath(name)) + { + } +#endif // QT_CONFIG(cxx17_filesystem) + +#ifndef QT_NO_QOBJECT + explicit QFile(QObject *parent); + QFile(const QString &name, QObject *parent); + +#ifdef Q_QDOC + QFile(const std::filesystem::path &path, QObject *parent); +#elif QT_CONFIG(cxx17_filesystem) + template = 0> + QFile(const T &path, QObject *parent) : QFile(QtPrivate::fromFilesystemPath(path), parent) + { + } +#endif // QT_CONFIG(cxx17_filesystem) +#endif // !QT_NO_QOBJECT + ~QFile(); + + QString fileName() const override; +#if QT_CONFIG(cxx17_filesystem) || defined(Q_QDOC) + std::filesystem::path filesystemFileName() const + { return QtPrivate::toFilesystemPath(fileName()); } +#endif + void setFileName(const QString &name); +#ifdef Q_QDOC + void setFileName(const std::filesystem::path &name); +#elif QT_CONFIG(cxx17_filesystem) + template = 0> + void setFileName(const T &name) + { + setFileName(QtPrivate::fromFilesystemPath(name)); + } +#endif // QT_CONFIG(cxx17_filesystem) + +#if defined(Q_OS_DARWIN) + // Mac always expects filenames in UTF-8... and decomposed... + static inline QByteArray encodeName(const QString &fileName) + { + return fileName.normalized(QString::NormalizationForm_D).toUtf8(); + } + static QString decodeName(const QByteArray &localFileName) + { + // note: duplicated in qglobal.cpp (qEnvironmentVariable) + return QString::fromUtf8(localFileName).normalized(QString::NormalizationForm_C); + } + static inline QString decodeName(const char *localFileName) + { + return QString::fromUtf8(localFileName).normalized(QString::NormalizationForm_C); + } +#else + static inline QByteArray encodeName(const QString &fileName) + { + return fileName.toLocal8Bit(); + } + static QString decodeName(const QByteArray &localFileName) + { + return QString::fromLocal8Bit(localFileName); + } + static inline QString decodeName(const char *localFileName) + { + return QString::fromLocal8Bit(localFileName); + } +#endif + + bool exists() const; + static bool exists(const QString &fileName); +#ifdef Q_QDOC + static bool exists(const std::filesystem::path &fileName); +#elif QT_CONFIG(cxx17_filesystem) + template = 0> + static bool exists(const T &fileName) + { + return exists(QtPrivate::fromFilesystemPath(fileName)); + } +#endif // QT_CONFIG(cxx17_filesystem) + + QString symLinkTarget() const; + static QString symLinkTarget(const QString &fileName); +#ifdef Q_QDOC + std::filesystem::path filesystemSymLinkTarget() const; + static std::filesystem::path filesystemSymLinkTarget(const std::filesystem::path &fileName); +#elif QT_CONFIG(cxx17_filesystem) + std::filesystem::path filesystemSymLinkTarget() const + { + return QtPrivate::toFilesystemPath(symLinkTarget()); + } + template = 0> + static std::filesystem::path filesystemSymLinkTarget(const T &fileName) + { + return QtPrivate::toFilesystemPath(symLinkTarget(QtPrivate::fromFilesystemPath(fileName))); + } +#endif // QT_CONFIG(cxx17_filesystem) + + bool remove(); + static bool remove(const QString &fileName); +#ifdef Q_QDOC + static bool remove(const std::filesystem::path &fileName); +#elif QT_CONFIG(cxx17_filesystem) + template = 0> + static bool remove(const T &fileName) + { + return remove(QtPrivate::fromFilesystemPath(fileName)); + } +#endif // QT_CONFIG(cxx17_filesystem) + + bool moveToTrash(); + static bool moveToTrash(const QString &fileName, QString *pathInTrash = nullptr); +#ifdef Q_QDOC + static bool moveToTrash(const std::filesystem::path &fileName, QString *pathInTrash = nullptr); +#elif QT_CONFIG(cxx17_filesystem) + template = 0> + static bool moveToTrash(const T &fileName, QString *pathInTrash = nullptr) + { + return moveToTrash(QtPrivate::fromFilesystemPath(fileName), pathInTrash); + } +#endif // QT_CONFIG(cxx17_filesystem) + + bool rename(const QString &newName); + static bool rename(const QString &oldName, const QString &newName); +#ifdef Q_QDOC + bool rename(const std::filesystem::path &newName); + static bool rename(const std::filesystem::path &oldName, + const std::filesystem::path &newName); +#elif QT_CONFIG(cxx17_filesystem) + template = 0> + bool rename(const T &newName) + { + return rename(QtPrivate::fromFilesystemPath(newName)); + } + template = 0> + static bool rename(const T &oldName, const T &newName) + { + return rename(QtPrivate::fromFilesystemPath(oldName), + QtPrivate::fromFilesystemPath(newName)); + } +#endif // QT_CONFIG(cxx17_filesystem) + + bool link(const QString &newName); + static bool link(const QString &fileName, const QString &newName); +#ifdef Q_QDOC + bool link(const std::filesystem::path &newName); + static bool link(const std::filesystem::path &fileName, + const std::filesystem::path &newName); +#elif QT_CONFIG(cxx17_filesystem) + template = 0> + bool link(const T &newName) + { + return link(QtPrivate::fromFilesystemPath(newName)); + } + template = 0> + static bool link(const T &fileName, const T &newName) + { + return link(QtPrivate::fromFilesystemPath(fileName), + QtPrivate::fromFilesystemPath(newName)); + } +#endif // QT_CONFIG(cxx17_filesystem) + + bool copy(const QString &newName); + static bool copy(const QString &fileName, const QString &newName); +#ifdef Q_QDOC + bool copy(const std::filesystem::path &newName); + static bool copy(const std::filesystem::path &fileName, + const std::filesystem::path &newName); +#elif QT_CONFIG(cxx17_filesystem) + template = 0> + bool copy(const T &newName) + { + return copy(QtPrivate::fromFilesystemPath(newName)); + } + template = 0> + static bool copy(const T &fileName, const T &newName) + { + return copy(QtPrivate::fromFilesystemPath(fileName), + QtPrivate::fromFilesystemPath(newName)); + } +#endif // QT_CONFIG(cxx17_filesystem) + + QFILE_MAYBE_NODISCARD bool open(OpenMode flags) override; + QFILE_MAYBE_NODISCARD bool open(OpenMode flags, Permissions permissions); + QFILE_MAYBE_NODISCARD bool open(FILE *f, OpenMode ioFlags, FileHandleFlags handleFlags=DontCloseHandle); + QFILE_MAYBE_NODISCARD bool open(int fd, OpenMode ioFlags, FileHandleFlags handleFlags=DontCloseHandle); + + qint64 size() const override; + + bool resize(qint64 sz) override; + static bool resize(const QString &filename, qint64 sz); + + Permissions permissions() const override; + static Permissions permissions(const QString &filename); + bool setPermissions(Permissions permissionSpec) override; + static bool setPermissions(const QString &filename, Permissions permissionSpec); +#ifdef Q_QDOC + static Permissions permissions(const std::filesystem::path &filename); + static bool setPermissions(const std::filesystem::path &filename, Permissions permissionSpec); +#elif QT_CONFIG(cxx17_filesystem) + template = 0> + static Permissions permissions(const T &filename) + { + return permissions(QtPrivate::fromFilesystemPath(filename)); + } + template = 0> + static bool setPermissions(const T &filename, Permissions permissionSpec) + { + return setPermissions(QtPrivate::fromFilesystemPath(filename), permissionSpec); + } +#endif // QT_CONFIG(cxx17_filesystem) + +protected: +#ifdef QT_NO_QOBJECT + QFile(QFilePrivate &dd); +#else + QFile(QFilePrivate &dd, QObject *parent = nullptr); +#endif + +private: + friend class QTemporaryFile; + Q_DISABLE_COPY(QFile) +}; + +QT_END_NAMESPACE + +#endif // QFILE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qfiledevice.h b/qt/6.8.1/msvc2022_64/include/QtCore/qfiledevice.h new file mode 100644 index 0000000000000000000000000000000000000000..c37185bf339638ee1c5fa88472f59f7ec7592ee8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qfiledevice.h @@ -0,0 +1,136 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QFILEDEVICE_H +#define QFILEDEVICE_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QDateTime; +class QFileDevicePrivate; + +#if !defined(QT_USE_NODISCARD_FILE_OPEN) && !defined(QT_NO_USE_NODISCARD_FILE_OPEN) +# if QT_VERSION < QT_VERSION_CHECK(6, 10, 0) +# define QT_NO_USE_NODISCARD_FILE_OPEN +# else +# define QT_USE_NODISCARD_FILE_OPEN +# endif +#endif + +#if defined(QT_USE_NODISCARD_FILE_OPEN) && defined(QT_NO_USE_NODISCARD_FILE_OPEN) +#error "Inconsistent macro definition for nodiscard QFile::open" +#elif defined(QT_USE_NODISCARD_FILE_OPEN) +#define QFILE_MAYBE_NODISCARD [[nodiscard]] +#else /* QT_NO_USE_NODISCARD_FILE_OPEN */ +#define QFILE_MAYBE_NODISCARD +#endif + +class Q_CORE_EXPORT QFileDevice : public QIODevice +{ +#ifndef QT_NO_QOBJECT + Q_OBJECT +#endif + Q_DECLARE_PRIVATE(QFileDevice) + +public: + enum FileError { + NoError = 0, + ReadError = 1, + WriteError = 2, + FatalError = 3, + ResourceError = 4, + OpenError = 5, + AbortError = 6, + TimeOutError = 7, + UnspecifiedError = 8, + RemoveError = 9, + RenameError = 10, + PositionError = 11, + ResizeError = 12, + PermissionsError = 13, + CopyError = 14 + }; + + enum FileTime { + FileAccessTime, + FileBirthTime, + FileMetadataChangeTime, + FileModificationTime + }; + + enum Permission { + ReadOwner = 0x4000, WriteOwner = 0x2000, ExeOwner = 0x1000, + ReadUser = 0x0400, WriteUser = 0x0200, ExeUser = 0x0100, + ReadGroup = 0x0040, WriteGroup = 0x0020, ExeGroup = 0x0010, + ReadOther = 0x0004, WriteOther = 0x0002, ExeOther = 0x0001 + }; + Q_DECLARE_FLAGS(Permissions, Permission) + + enum FileHandleFlag { + AutoCloseHandle = 0x0001, + DontCloseHandle = 0 + }; + Q_DECLARE_FLAGS(FileHandleFlags, FileHandleFlag) + + ~QFileDevice(); + + FileError error() const; + void unsetError(); + + void close() override; + + bool isSequential() const override; + + int handle() const; + virtual QString fileName() const; + + qint64 pos() const override; + bool seek(qint64 offset) override; + bool atEnd() const override; + bool flush(); + + qint64 size() const override; + + virtual bool resize(qint64 sz); + virtual Permissions permissions() const; + virtual bool setPermissions(Permissions permissionSpec); + + enum MemoryMapFlag { + NoOptions = 0, + MapPrivateOption = 0x0001 + }; + Q_DECLARE_FLAGS(MemoryMapFlags, MemoryMapFlag) + + uchar *map(qint64 offset, qint64 size, MemoryMapFlags flags = NoOptions); + bool unmap(uchar *address); + + QDateTime fileTime(QFileDevice::FileTime time) const; + bool setFileTime(const QDateTime &newDate, QFileDevice::FileTime fileTime); + +protected: + QFileDevice(); +#ifdef QT_NO_QOBJECT + QFileDevice(QFileDevicePrivate &dd); +#else + explicit QFileDevice(QObject *parent); + QFileDevice(QFileDevicePrivate &dd, QObject *parent = nullptr); +#endif + + qint64 readData(char *data, qint64 maxlen) override; + qint64 writeData(const char *data, qint64 len) override; + qint64 readLineData(char *data, qint64 maxlen) override; + +private: + Q_DISABLE_COPY(QFileDevice) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QFileDevice::Permissions) +Q_DECLARE_OPERATORS_FOR_FLAGS(QFileDevice::FileHandleFlags) +Q_DECLARE_OPERATORS_FOR_FLAGS(QFileDevice::MemoryMapFlags) + +QT_END_NAMESPACE + +#endif // QFILEDEVICE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qfileinfo.h b/qt/6.8.1/msvc2022_64/include/QtCore/qfileinfo.h new file mode 100644 index 0000000000000000000000000000000000000000..435602e75752049881a017ec930327569c07bf5f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qfileinfo.h @@ -0,0 +1,200 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QFILEINFO_H +#define QFILEINFO_H + +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + + +class QDir; +class QDirIteratorPrivate; +class QFileInfoPrivate; + +class Q_CORE_EXPORT QFileInfo +{ + friend class QDirIteratorPrivate; + friend class QDirListingPrivate; + friend class QFileInfoPrivate; +public: + explicit QFileInfo(QFileInfoPrivate *d); + +#ifdef QT_IMPLICIT_QFILEINFO_CONSTRUCTION +#define QFILEINFO_MAYBE_EXPLICIT Q_IMPLICIT +#else +#define QFILEINFO_MAYBE_EXPLICIT explicit +#endif + + QFileInfo(); + QFILEINFO_MAYBE_EXPLICIT QFileInfo(const QString &file); + QFILEINFO_MAYBE_EXPLICIT QFileInfo(const QFileDevice &file); + QFILEINFO_MAYBE_EXPLICIT QFileInfo(const QDir &dir, const QString &file); + QFileInfo(const QFileInfo &fileinfo); +#ifdef Q_QDOC + QFileInfo(const std::filesystem::path &file); + QFileInfo(const QDir &dir, const std::filesystem::path &file); +#elif QT_CONFIG(cxx17_filesystem) + template = 0> + QFILEINFO_MAYBE_EXPLICIT QFileInfo(const T &file) : QFileInfo(QtPrivate::fromFilesystemPath(file)) { } + + template = 0> + QFILEINFO_MAYBE_EXPLICIT QFileInfo(const QDir &dir, const T &file) : QFileInfo(dir, QtPrivate::fromFilesystemPath(file)) + { + } +#endif // QT_CONFIG(cxx17_filesystem) + +#undef QFILEINFO_MAYBE_EXPLICIT + + ~QFileInfo(); + + QFileInfo &operator=(const QFileInfo &fileinfo); + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QFileInfo) + + void swap(QFileInfo &other) noexcept + { d_ptr.swap(other.d_ptr); } + +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator==(const QFileInfo &fileinfo) const; + inline bool operator!=(const QFileInfo &fileinfo) const { return !(operator==(fileinfo)); } +#endif + + void setFile(const QString &file); + void setFile(const QFileDevice &file); + void setFile(const QDir &dir, const QString &file); +#ifdef Q_QDOC + void setFile(const std::filesystem::path &file); +#elif QT_CONFIG(cxx17_filesystem) + template = 0> + void setFile(const T &file) { setFile(QtPrivate::fromFilesystemPath(file)); } +#endif // QT_CONFIG(cxx17_filesystem) + + bool exists() const; + static bool exists(const QString &file); + void refresh(); + + QString filePath() const; + QString absoluteFilePath() const; + QString canonicalFilePath() const; +#if QT_CONFIG(cxx17_filesystem) || defined(Q_QDOC) + std::filesystem::path filesystemFilePath() const + { return QtPrivate::toFilesystemPath(filePath()); } + std::filesystem::path filesystemAbsoluteFilePath() const + { return QtPrivate::toFilesystemPath(absoluteFilePath()); } + std::filesystem::path filesystemCanonicalFilePath() const + { return QtPrivate::toFilesystemPath(canonicalFilePath()); } +#endif // QT_CONFIG(cxx17_filesystem) + QString fileName() const; + QString baseName() const; + QString completeBaseName() const; + QString suffix() const; + QString bundleName() const; + QString completeSuffix() const; + + QString path() const; + QString absolutePath() const; + QString canonicalPath() const; +#if QT_CONFIG(cxx17_filesystem) || defined(Q_QDOC) + std::filesystem::path filesystemPath() const { return QtPrivate::toFilesystemPath(path()); } + std::filesystem::path filesystemAbsolutePath() const + { return QtPrivate::toFilesystemPath(absolutePath()); } + std::filesystem::path filesystemCanonicalPath() const + { return QtPrivate::toFilesystemPath(canonicalPath()); } +#endif // QT_CONFIG(cxx17_filesystem) + QDir dir() const; + QDir absoluteDir() const; + + bool isReadable() const; + bool isWritable() const; + bool isExecutable() const; + bool isHidden() const; + bool isNativePath() const; + + bool isRelative() const; + inline bool isAbsolute() const { return !isRelative(); } + bool makeAbsolute(); + + bool isFile() const; + bool isDir() const; + bool isSymLink() const; + bool isSymbolicLink() const; + bool isShortcut() const; + bool isAlias() const; + bool isJunction() const; + bool isRoot() const; + bool isBundle() const; + + QString symLinkTarget() const; + QString readSymLink() const; + QString junctionTarget() const; + +#if QT_CONFIG(cxx17_filesystem) || defined(Q_QDOC) + std::filesystem::path filesystemSymLinkTarget() const + { return QtPrivate::toFilesystemPath(symLinkTarget()); } + + std::filesystem::path filesystemReadSymLink() const + { return QtPrivate::toFilesystemPath(readSymLink()); } + + std::filesystem::path filesystemJunctionTarget() const + { return QtPrivate::toFilesystemPath(junctionTarget()); } +#endif // QT_CONFIG(cxx17_filesystem) + + QString owner() const; + uint ownerId() const; + QString group() const; + uint groupId() const; + + bool permission(QFile::Permissions permissions) const; + QFile::Permissions permissions() const; + + qint64 size() const; + + QDateTime birthTime() const { return fileTime(QFile::FileBirthTime); } + QDateTime metadataChangeTime() const { return fileTime(QFile::FileMetadataChangeTime); } + QDateTime lastModified() const { return fileTime(QFile::FileModificationTime); } + QDateTime lastRead() const { return fileTime(QFile::FileAccessTime); } + QDateTime fileTime(QFile::FileTime time) const; + + QDateTime birthTime(const QTimeZone &tz) const { return fileTime(QFile::FileBirthTime, tz); } + QDateTime metadataChangeTime(const QTimeZone &tz) const { return fileTime(QFile::FileMetadataChangeTime, tz); } + QDateTime lastModified(const QTimeZone &tz) const { return fileTime(QFile::FileModificationTime, tz); } + QDateTime lastRead(const QTimeZone &tz) const { return fileTime(QFile::FileAccessTime, tz); } + QDateTime fileTime(QFile::FileTime time, const QTimeZone &tz) const; + + bool caching() const; + void setCaching(bool on); + void stat(); + +protected: + QSharedDataPointer d_ptr; + +private: + friend Q_CORE_EXPORT bool comparesEqual(const QFileInfo &lhs, const QFileInfo &rhs); + Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QFileInfo) + QFileInfoPrivate* d_func(); + inline const QFileInfoPrivate* d_func() const + { + return d_ptr.constData(); + } +}; + +Q_DECLARE_SHARED(QFileInfo) + +typedef QList QFileInfoList; + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QFileInfo &); +#endif + +QT_END_NAMESPACE + +QT_DECL_METATYPE_EXTERN(QFileInfo, Q_CORE_EXPORT) + +#endif // QFILEINFO_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qfileselector.h b/qt/6.8.1/msvc2022_64/include/QtCore/qfileselector.h new file mode 100644 index 0000000000000000000000000000000000000000..f5252a3cd3ca2cbffc2926a8312b06493f8929d6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qfileselector.h @@ -0,0 +1,34 @@ +// Copyright (C) 2013 BlackBerry Limited. All rights reserved. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QFILESELECTOR_H +#define QFILESELECTOR_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QFileSelectorPrivate; +class Q_CORE_EXPORT QFileSelector : public QObject +{ + Q_OBJECT +public: + explicit QFileSelector(QObject *parent = nullptr); + ~QFileSelector(); + + QString select(const QString &filePath) const; + QUrl select(const QUrl &filePath) const; + + QStringList extraSelectors() const; + void setExtraSelectors(const QStringList &list); + + QStringList allSelectors() const; + +private: + Q_DECLARE_PRIVATE(QFileSelector) +}; + +QT_END_NAMESPACE + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qfilesystemwatcher.h b/qt/6.8.1/msvc2022_64/include/QtCore/qfilesystemwatcher.h new file mode 100644 index 0000000000000000000000000000000000000000..478149f3ed4ddea12b99026d0a7a52807b3a6c7e --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qfilesystemwatcher.h @@ -0,0 +1,41 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QFILESYSTEMWATCHER_H +#define QFILESYSTEMWATCHER_H + +#include + +QT_REQUIRE_CONFIG(filesystemwatcher); + +QT_BEGIN_NAMESPACE + + +class QFileSystemWatcherPrivate; + +class Q_CORE_EXPORT QFileSystemWatcher : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QFileSystemWatcher) + +public: + QFileSystemWatcher(QObject *parent = nullptr); + QFileSystemWatcher(const QStringList &paths, QObject *parent = nullptr); + ~QFileSystemWatcher(); + + bool addPath(const QString &file); + QStringList addPaths(const QStringList &files); + bool removePath(const QString &file); + QStringList removePaths(const QStringList &files); + + QStringList files() const; + QStringList directories() const; + +Q_SIGNALS: + void fileChanged(const QString &path, QPrivateSignal); + void directoryChanged(const QString &path, QPrivateSignal); +}; + +QT_END_NAMESPACE + +#endif // QFILESYSTEMWATCHER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qflags.h b/qt/6.8.1/msvc2022_64/include/QtCore/qflags.h new file mode 100644 index 0000000000000000000000000000000000000000..bcc483a21f378d454ee115be7d7d2e10413d12e5 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qflags.h @@ -0,0 +1,255 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QFLAGS_H +#define QFLAGS_H + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QDataStream; + +class QFlag +{ + int i; +public: + constexpr inline Q_IMPLICIT QFlag(int value) noexcept : i(value) {} + constexpr inline Q_IMPLICIT operator int() const noexcept { return i; } + +#if !defined(Q_CC_MSVC) + // Microsoft Visual Studio has buggy behavior when it comes to + // unsigned enums: even if the enum is unsigned, the enum tags are + // always signed +# if !defined(__LP64__) && !defined(Q_QDOC) + constexpr inline Q_IMPLICIT QFlag(long value) noexcept : i(int(value)) {} + constexpr inline Q_IMPLICIT QFlag(ulong value) noexcept : i(int(long(value))) {} +# endif + constexpr inline Q_IMPLICIT QFlag(uint value) noexcept : i(int(value)) {} + constexpr inline Q_IMPLICIT QFlag(short value) noexcept : i(int(value)) {} + constexpr inline Q_IMPLICIT QFlag(ushort value) noexcept : i(int(uint(value))) {} + constexpr inline Q_IMPLICIT operator uint() const noexcept { return uint(i); } +#endif +}; +Q_DECLARE_TYPEINFO(QFlag, Q_PRIMITIVE_TYPE); + +class QIncompatibleFlag +{ + int i; +public: + constexpr inline explicit QIncompatibleFlag(int i) noexcept; + constexpr inline Q_IMPLICIT operator int() const noexcept { return i; } +}; +Q_DECLARE_TYPEINFO(QIncompatibleFlag, Q_PRIMITIVE_TYPE); + +constexpr inline QIncompatibleFlag::QIncompatibleFlag(int value) noexcept : i(value) {} + + +template +class QFlags +{ + static_assert((sizeof(Enum) <= sizeof(int)), + "QFlags uses an int as storage, so an enum with underlying " + "long long will overflow."); + static_assert((std::is_enum::value), "QFlags is only usable on enumeration types."); + +public: +#if defined(Q_CC_MSVC) || defined(Q_QDOC) + // see above for MSVC + // the definition below is too complex for qdoc + typedef int Int; +#else + typedef typename std::conditional< + std::is_unsigned::type>::value, + unsigned int, + signed int + >::type Int; +#endif + typedef Enum enum_type; + // compiler-generated copy/move ctor/assignment operators are fine! + constexpr inline QFlags() noexcept : i(0) {} + constexpr inline Q_IMPLICIT QFlags(Enum flags) noexcept : i(Int(flags)) {} + constexpr inline Q_IMPLICIT QFlags(QFlag flag) noexcept : i(flag) {} + + constexpr inline QFlags(std::initializer_list flags) noexcept + : i(initializer_list_helper(flags.begin(), flags.end())) {} + + constexpr static inline QFlags fromInt(Int i) noexcept { return QFlags(QFlag(i)); } + constexpr inline Int toInt() const noexcept { return i; } + +#ifndef QT_TYPESAFE_FLAGS + constexpr inline QFlags &operator&=(int mask) noexcept { i &= mask; return *this; } + constexpr inline QFlags &operator&=(uint mask) noexcept { i &= mask; return *this; } +#endif + constexpr inline QFlags &operator&=(QFlags mask) noexcept { i &= mask.i; return *this; } + constexpr inline QFlags &operator&=(Enum mask) noexcept { i &= Int(mask); return *this; } + constexpr inline QFlags &operator|=(QFlags other) noexcept { i |= other.i; return *this; } + constexpr inline QFlags &operator|=(Enum other) noexcept { i |= Int(other); return *this; } + constexpr inline QFlags &operator^=(QFlags other) noexcept { i ^= other.i; return *this; } + constexpr inline QFlags &operator^=(Enum other) noexcept { i ^= Int(other); return *this; } + +#ifdef QT_TYPESAFE_FLAGS + constexpr inline explicit operator Int() const noexcept { return i; } + constexpr inline explicit operator bool() const noexcept { return i; } + // For some reason, moc goes through QFlag in order to read/write + // properties of type QFlags; so a conversion to QFlag is also + // needed here. (It otherwise goes through a QFlags->int->QFlag + // conversion sequence.) + constexpr inline explicit operator QFlag() const noexcept { return QFlag(i); } +#else + constexpr inline Q_IMPLICIT operator Int() const noexcept { return i; } + constexpr inline bool operator!() const noexcept { return !i; } +#endif + + constexpr inline QFlags operator|(QFlags other) const noexcept { return QFlags(QFlag(i | other.i)); } + constexpr inline QFlags operator|(Enum other) const noexcept { return QFlags(QFlag(i | Int(other))); } + constexpr inline QFlags operator^(QFlags other) const noexcept { return QFlags(QFlag(i ^ other.i)); } + constexpr inline QFlags operator^(Enum other) const noexcept { return QFlags(QFlag(i ^ Int(other))); } +#ifndef QT_TYPESAFE_FLAGS + constexpr inline QFlags operator&(int mask) const noexcept { return QFlags(QFlag(i & mask)); } + constexpr inline QFlags operator&(uint mask) const noexcept { return QFlags(QFlag(i & mask)); } +#endif + constexpr inline QFlags operator&(QFlags other) const noexcept { return QFlags(QFlag(i & other.i)); } + constexpr inline QFlags operator&(Enum other) const noexcept { return QFlags(QFlag(i & Int(other))); } + constexpr inline QFlags operator~() const noexcept { return QFlags(QFlag(~i)); } + + constexpr inline void operator+(QFlags other) const noexcept = delete; + constexpr inline void operator+(Enum other) const noexcept = delete; + constexpr inline void operator+(int other) const noexcept = delete; + constexpr inline void operator-(QFlags other) const noexcept = delete; + constexpr inline void operator-(Enum other) const noexcept = delete; + constexpr inline void operator-(int other) const noexcept = delete; + + constexpr inline bool testFlag(Enum flag) const noexcept { return testFlags(flag); } + constexpr inline bool testFlags(QFlags flags) const noexcept { return flags.i ? ((i & flags.i) == flags.i) : i == Int(0); } + constexpr inline bool testAnyFlag(Enum flag) const noexcept { return testAnyFlags(flag); } + constexpr inline bool testAnyFlags(QFlags flags) const noexcept { return (i & flags.i) != Int(0); } + constexpr inline QFlags &setFlag(Enum flag, bool on = true) noexcept + { + return on ? (*this |= flag) : (*this &= ~QFlags(flag)); + } + + friend constexpr inline bool operator==(QFlags lhs, QFlags rhs) noexcept + { return lhs.i == rhs.i; } + friend constexpr inline bool operator!=(QFlags lhs, QFlags rhs) noexcept + { return lhs.i != rhs.i; } + friend constexpr inline bool operator==(QFlags lhs, Enum rhs) noexcept + { return lhs == QFlags(rhs); } + friend constexpr inline bool operator!=(QFlags lhs, Enum rhs) noexcept + { return lhs != QFlags(rhs); } + friend constexpr inline bool operator==(Enum lhs, QFlags rhs) noexcept + { return QFlags(lhs) == rhs; } + friend constexpr inline bool operator!=(Enum lhs, QFlags rhs) noexcept + { return QFlags(lhs) != rhs; } + +#ifdef QT_TYPESAFE_FLAGS + // Provide means of comparing flags against a literal 0; opt-in + // because otherwise they're ambiguous against operator==(int,int) + // after a QFlags->int conversion. + friend constexpr inline bool operator==(QFlags flags, QtPrivate::CompareAgainstLiteralZero) noexcept + { return flags.i == Int(0); } + friend constexpr inline bool operator!=(QFlags flags, QtPrivate::CompareAgainstLiteralZero) noexcept + { return flags.i != Int(0); } + friend constexpr inline bool operator==(QtPrivate::CompareAgainstLiteralZero, QFlags flags) noexcept + { return Int(0) == flags.i; } + friend constexpr inline bool operator!=(QtPrivate::CompareAgainstLiteralZero, QFlags flags) noexcept + { return Int(0) != flags.i; } +#endif + +private: + constexpr static inline Int initializer_list_helper(typename std::initializer_list::const_iterator it, + typename std::initializer_list::const_iterator end) + noexcept + { + return (it == end ? Int(0) : (Int(*it) | initializer_list_helper(it + 1, end))); + } + + Int i; +}; + +#ifndef Q_MOC_RUN +#define Q_DECLARE_FLAGS(Flags, Enum)\ +typedef QFlags Flags; +#endif + +#ifdef QT_TYPESAFE_FLAGS + +// These are opt-in, for backwards compatibility +#define QT_DECLARE_TYPESAFE_OPERATORS_FOR_FLAGS_ENUM(Flags) \ +[[maybe_unused]] \ +constexpr inline Flags operator~(Flags::enum_type e) noexcept \ +{ return ~Flags(e); } \ +[[maybe_unused]] \ +constexpr inline void operator|(Flags::enum_type f1, int f2) noexcept = delete; +#else +#define QT_DECLARE_TYPESAFE_OPERATORS_FOR_FLAGS_ENUM(Flags) \ +[[maybe_unused]] \ +constexpr inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) noexcept \ +{ return QIncompatibleFlag(int(f1) | f2); } +#endif + +#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags) \ +[[maybe_unused]] \ +constexpr inline QFlags operator|(Flags::enum_type f1, Flags::enum_type f2) noexcept \ +{ return QFlags(f1) | f2; } \ +[[maybe_unused]] \ +constexpr inline QFlags operator|(Flags::enum_type f1, QFlags f2) noexcept \ +{ return f2 | f1; } \ +[[maybe_unused]] \ +constexpr inline QFlags operator&(Flags::enum_type f1, Flags::enum_type f2) noexcept \ +{ return QFlags(f1) & f2; } \ +[[maybe_unused]] \ +constexpr inline QFlags operator&(Flags::enum_type f1, QFlags f2) noexcept \ +{ return f2 & f1; } \ +[[maybe_unused]] \ +constexpr inline QFlags operator^(Flags::enum_type f1, Flags::enum_type f2) noexcept \ +{ return QFlags(f1) ^ f2; } \ +[[maybe_unused]] \ +constexpr inline QFlags operator^(Flags::enum_type f1, QFlags f2) noexcept \ +{ return f2 ^ f1; } \ +constexpr inline void operator+(Flags::enum_type f1, Flags::enum_type f2) noexcept = delete; \ +constexpr inline void operator+(Flags::enum_type f1, QFlags f2) noexcept = delete; \ +constexpr inline void operator+(int f1, QFlags f2) noexcept = delete; \ +constexpr inline void operator-(Flags::enum_type f1, Flags::enum_type f2) noexcept = delete; \ +constexpr inline void operator-(Flags::enum_type f1, QFlags f2) noexcept = delete; \ +constexpr inline void operator-(int f1, QFlags f2) noexcept = delete; \ +constexpr inline void operator+(int f1, Flags::enum_type f2) noexcept = delete; \ +constexpr inline void operator+(Flags::enum_type f1, int f2) noexcept = delete; \ +constexpr inline void operator-(int f1, Flags::enum_type f2) noexcept = delete; \ +constexpr inline void operator-(Flags::enum_type f1, int f2) noexcept = delete; \ +QT_DECLARE_TYPESAFE_OPERATORS_FOR_FLAGS_ENUM(Flags) + +// restore bit-wise enum-enum operators deprecated in C++20, +// but used in a few places in the API +#if __cplusplus > 201702L // assume compilers don't warn if in C++17 mode + // in C++20 mode, provide user-defined operators to override the deprecated operations: +# define Q_DECLARE_MIXED_ENUM_OPERATOR(op, Ret, LHS, RHS) \ + [[maybe_unused]] \ + constexpr inline Ret operator op (LHS lhs, RHS rhs) noexcept \ + { return static_cast(qToUnderlying(lhs) op qToUnderlying(rhs)); } \ + /* end */ +#else + // in C++17 mode, statically-assert that this compiler's result of the + // operation is the same that the C++20 version would produce: +# define Q_DECLARE_MIXED_ENUM_OPERATOR(op, Ret, LHS, RHS) \ + static_assert(std::is_same_v() op std::declval()), Ret>); +#endif + +#define Q_DECLARE_MIXED_ENUM_OPERATORS(Ret, Flags, Enum) \ + Q_DECLARE_MIXED_ENUM_OPERATOR(|, Ret, Flags, Enum) \ + Q_DECLARE_MIXED_ENUM_OPERATOR(&, Ret, Flags, Enum) \ + Q_DECLARE_MIXED_ENUM_OPERATOR(^, Ret, Flags, Enum) \ + /* end */ + +#define Q_DECLARE_MIXED_ENUM_OPERATORS_SYMMETRIC(Ret, Flags, Enum) \ + Q_DECLARE_MIXED_ENUM_OPERATORS(Ret, Flags, Enum) \ + Q_DECLARE_MIXED_ENUM_OPERATORS(Ret, Enum, Flags) \ + /* end */ + + +QT_END_NAMESPACE + +#endif // QFLAGS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qfloat16.h b/qt/6.8.1/msvc2022_64/include/QtCore/qfloat16.h new file mode 100644 index 0000000000000000000000000000000000000000..70a7e21f9752ae6a3ea81c739843d67a8b524c33 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qfloat16.h @@ -0,0 +1,549 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// Copyright (C) 2016 by Southwest Research Institute (R) +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QFLOAT16_H +#define QFLOAT16_H + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__AVX2__) && !defined(__F16C__) +// All processors that support AVX2 do support F16C too, so we could enable the +// feature unconditionally if __AVX2__ is defined. However, all currently +// supported compilers except Microsoft's are able to define __F16C__ on their +// own when the user enables the feature, so we'll trust them. +# if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG) +# define __F16C__ 1 +# endif +#endif + +#if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__) +#include +#endif + +QT_BEGIN_NAMESPACE + +#if 0 +#pragma qt_class(QFloat16) +#pragma qt_no_master_include +#endif + +#ifndef QT_NO_DATASTREAM +class QDataStream; +#endif +class QTextStream; + +class qfloat16 +{ + struct Wrap + { + // To let our private constructor work, without other code seeing + // ambiguity when constructing from int, double &c. + quint16 b16; + constexpr inline explicit Wrap(int value) : b16(quint16(value)) {} + }; + + template + using if_type_is_integral = std::enable_if_t>, bool>; + +public: + using NativeType = QtPrivate::NativeFloat16Type; + + static constexpr bool IsNative = QFLOAT16_IS_NATIVE; + using NearestFloat = std::conditional_t; + + constexpr inline qfloat16() noexcept : b16(0) {} + explicit qfloat16(Qt::Initialization) noexcept { } + +#if QFLOAT16_IS_NATIVE + constexpr inline qfloat16(NativeType f) : nf(f) {} + constexpr operator NativeType() const noexcept { return nf; } +#else + inline qfloat16(float f) noexcept; + inline operator float() const noexcept; +#endif + template && !std::is_same_v>> + constexpr explicit qfloat16(T value) noexcept : qfloat16(NearestFloat(value)) {} + + // Support for qIs{Inf,NaN,Finite}: + bool isInf() const noexcept { return (b16 & 0x7fff) == 0x7c00; } + bool isNaN() const noexcept { return (b16 & 0x7fff) > 0x7c00; } + bool isFinite() const noexcept { return (b16 & 0x7fff) < 0x7c00; } + Q_CORE_EXPORT int fpClassify() const noexcept; + // Can't specialize std::copysign() for qfloat16 + qfloat16 copySign(qfloat16 sign) const noexcept + { return qfloat16(Wrap((sign.b16 & 0x8000) | (b16 & 0x7fff))); } + // Support for std::numeric_limits + +#ifdef __STDCPP_FLOAT16_T__ +private: + using Bounds = std::numeric_limits; +public: + static constexpr qfloat16 _limit_epsilon() noexcept { return Bounds::epsilon(); } + static constexpr qfloat16 _limit_min() noexcept { return Bounds::min(); } + static constexpr qfloat16 _limit_denorm_min() noexcept { return Bounds::denorm_min(); } + static constexpr qfloat16 _limit_max() noexcept { return Bounds::max(); } + static constexpr qfloat16 _limit_lowest() noexcept { return Bounds::lowest(); } + static constexpr qfloat16 _limit_infinity() noexcept { return Bounds::infinity(); } + static constexpr qfloat16 _limit_quiet_NaN() noexcept { return Bounds::quiet_NaN(); } +#if QT_CONFIG(signaling_nan) + static constexpr qfloat16 _limit_signaling_NaN() noexcept { return Bounds::signaling_NaN(); } +#endif +#else + static constexpr qfloat16 _limit_epsilon() noexcept { return qfloat16(Wrap(0x1400)); } + static constexpr qfloat16 _limit_min() noexcept { return qfloat16(Wrap(0x400)); } + static constexpr qfloat16 _limit_denorm_min() noexcept { return qfloat16(Wrap(1)); } + static constexpr qfloat16 _limit_max() noexcept { return qfloat16(Wrap(0x7bff)); } + static constexpr qfloat16 _limit_lowest() noexcept { return qfloat16(Wrap(0xfbff)); } + static constexpr qfloat16 _limit_infinity() noexcept { return qfloat16(Wrap(0x7c00)); } + static constexpr qfloat16 _limit_quiet_NaN() noexcept { return qfloat16(Wrap(0x7e00)); } +#if QT_CONFIG(signaling_nan) + static constexpr qfloat16 _limit_signaling_NaN() noexcept { return qfloat16(Wrap(0x7d00)); } +#endif +#endif + inline constexpr bool isNormal() const noexcept + { return (b16 & 0x7c00) && (b16 & 0x7c00) != 0x7c00; } +private: + // ABI note: Qt 6's qfloat16 began with just a quint16 member so it ended + // up passed in general purpose registers in any function call taking + // qfloat16 by value (it has trivial copy constructors). This means the + // integer member in the anonymous union below must remain until a + // binary-incompatible version of Qt. If you remove it, on platforms using + // the System V ABI for C, the native type is passed in FP registers. + union { + quint16 b16; +#if QFLOAT16_IS_NATIVE + NativeType nf; +#endif + }; + constexpr inline explicit qfloat16(Wrap nibble) noexcept : +#if QFLOAT16_IS_NATIVE && defined(__cpp_lib_bit_cast) + nf(std::bit_cast(nibble.b16)) +#else + b16(nibble.b16) +#endif + {} + + Q_CORE_EXPORT static const quint32 mantissatable[]; + Q_CORE_EXPORT static const quint32 exponenttable[]; + Q_CORE_EXPORT static const quint32 offsettable[]; + Q_CORE_EXPORT static const quint16 basetable[]; + Q_CORE_EXPORT static const quint16 shifttable[]; + Q_CORE_EXPORT static const quint32 roundtable[]; + + friend bool qIsNull(qfloat16 f) noexcept; + + friend inline qfloat16 operator-(qfloat16 a) noexcept + { + qfloat16 f; + f.b16 = a.b16 ^ quint16(0x8000); + return f; + } + + friend inline qfloat16 operator+(qfloat16 a, qfloat16 b) noexcept { return qfloat16(static_cast(a) + static_cast(b)); } + friend inline qfloat16 operator-(qfloat16 a, qfloat16 b) noexcept { return qfloat16(static_cast(a) - static_cast(b)); } + friend inline qfloat16 operator*(qfloat16 a, qfloat16 b) noexcept { return qfloat16(static_cast(a) * static_cast(b)); } + friend inline qfloat16 operator/(qfloat16 a, qfloat16 b) noexcept { return qfloat16(static_cast(a) / static_cast(b)); } + + friend size_t qHash(qfloat16 key, size_t seed = 0) noexcept + { return qHash(float(key), seed); } // 6.4 algorithm, so keep using it; ### Qt 7: fix QTBUG-116077 + +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wfloat-conversion") + +#define QF16_MAKE_ARITH_OP_FP(FP, OP) \ + friend inline FP operator OP(qfloat16 lhs, FP rhs) noexcept { return static_cast(lhs) OP rhs; } \ + friend inline FP operator OP(FP lhs, qfloat16 rhs) noexcept { return lhs OP static_cast(rhs); } +#define QF16_MAKE_ARITH_OP_EQ_FP(FP, OP_EQ, OP) \ + friend inline qfloat16& operator OP_EQ(qfloat16& lhs, FP rhs) noexcept \ + { lhs = qfloat16(NearestFloat(static_cast(lhs) OP rhs)); return lhs; } +#define QF16_MAKE_ARITH_OP(FP) \ + QF16_MAKE_ARITH_OP_FP(FP, +) \ + QF16_MAKE_ARITH_OP_FP(FP, -) \ + QF16_MAKE_ARITH_OP_FP(FP, *) \ + QF16_MAKE_ARITH_OP_FP(FP, /) \ + QF16_MAKE_ARITH_OP_EQ_FP(FP, +=, +) \ + QF16_MAKE_ARITH_OP_EQ_FP(FP, -=, -) \ + QF16_MAKE_ARITH_OP_EQ_FP(FP, *=, *) \ + QF16_MAKE_ARITH_OP_EQ_FP(FP, /=, /) + + QF16_MAKE_ARITH_OP(long double) + QF16_MAKE_ARITH_OP(double) + QF16_MAKE_ARITH_OP(float) +#if QFLOAT16_IS_NATIVE + QF16_MAKE_ARITH_OP(NativeType) +#endif +#undef QF16_MAKE_ARITH_OP +#undef QF16_MAKE_ARITH_OP_FP + +#define QF16_MAKE_ARITH_OP_INT(OP) \ + friend inline double operator OP(qfloat16 lhs, int rhs) noexcept { return static_cast(lhs) OP rhs; } \ + friend inline double operator OP(int lhs, qfloat16 rhs) noexcept { return lhs OP static_cast(rhs); } + + QF16_MAKE_ARITH_OP_INT(+) + QF16_MAKE_ARITH_OP_INT(-) + QF16_MAKE_ARITH_OP_INT(*) + QF16_MAKE_ARITH_OP_INT(/) +#undef QF16_MAKE_ARITH_OP_INT + +QT_WARNING_DISABLE_FLOAT_COMPARE + +#if QFLOAT16_IS_NATIVE +# define QF16_CONSTEXPR constexpr +# define QF16_PARTIALLY_ORDERED Q_DECLARE_PARTIALLY_ORDERED_LITERAL_TYPE +#else +# define QF16_CONSTEXPR +# define QF16_PARTIALLY_ORDERED Q_DECLARE_PARTIALLY_ORDERED +#endif + + friend QF16_CONSTEXPR bool comparesEqual(const qfloat16 &lhs, const qfloat16 &rhs) noexcept + { return static_cast(lhs) == static_cast(rhs); } + friend QF16_CONSTEXPR + Qt::partial_ordering compareThreeWay(const qfloat16 &lhs, const qfloat16 &rhs) noexcept + { return Qt::compareThreeWay(static_cast(lhs), static_cast(rhs)); } + QF16_PARTIALLY_ORDERED(qfloat16) + +#define QF16_MAKE_ORDER_OP_FP(FP) \ + friend QF16_CONSTEXPR bool comparesEqual(const qfloat16 &lhs, FP rhs) noexcept \ + { return static_cast(lhs) == rhs; } \ + friend QF16_CONSTEXPR \ + Qt::partial_ordering compareThreeWay(const qfloat16 &lhs, FP rhs) noexcept \ + { return Qt::compareThreeWay(static_cast(lhs), rhs); } \ + QF16_PARTIALLY_ORDERED(qfloat16, FP) + + QF16_MAKE_ORDER_OP_FP(long double) + QF16_MAKE_ORDER_OP_FP(double) + QF16_MAKE_ORDER_OP_FP(float) +#if QFLOAT16_IS_NATIVE + QF16_MAKE_ORDER_OP_FP(qfloat16::NativeType) +#endif +#undef QF16_MAKE_ORDER_OP_FP + + template = true> + friend QF16_CONSTEXPR bool comparesEqual(const qfloat16 &lhs, T rhs) noexcept + { return static_cast(lhs) == static_cast(rhs); } + template = true> + friend QF16_CONSTEXPR Qt::partial_ordering compareThreeWay(const qfloat16 &lhs, T rhs) noexcept + { return Qt::compareThreeWay(static_cast(lhs), static_cast(rhs)); } + + QF16_PARTIALLY_ORDERED(qfloat16, qint8) + QF16_PARTIALLY_ORDERED(qfloat16, quint8) + QF16_PARTIALLY_ORDERED(qfloat16, qint16) + QF16_PARTIALLY_ORDERED(qfloat16, quint16) + QF16_PARTIALLY_ORDERED(qfloat16, qint32) + QF16_PARTIALLY_ORDERED(qfloat16, quint32) + QF16_PARTIALLY_ORDERED(qfloat16, long) + QF16_PARTIALLY_ORDERED(qfloat16, unsigned long) + QF16_PARTIALLY_ORDERED(qfloat16, qint64) + QF16_PARTIALLY_ORDERED(qfloat16, quint64) +#ifdef QT_SUPPORTS_INT128 + QF16_PARTIALLY_ORDERED(qfloat16, qint128) + QF16_PARTIALLY_ORDERED(qfloat16, quint128) +#endif + +#undef QF16_PARTIALLY_ORDERED +#undef QF16_CONSTEXPR + +QT_WARNING_POP + +#ifndef QT_NO_DATASTREAM + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &ds, qfloat16 f); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &ds, qfloat16 &f); +#endif + friend Q_CORE_EXPORT QTextStream &operator<<(QTextStream &ts, qfloat16 f); + friend Q_CORE_EXPORT QTextStream &operator>>(QTextStream &ts, qfloat16 &f); +}; + +Q_DECLARE_TYPEINFO(qfloat16, Q_PRIMITIVE_TYPE); + +Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *, const float *, qsizetype length) noexcept; +Q_CORE_EXPORT void qFloatFromFloat16(float *, const qfloat16 *, qsizetype length) noexcept; + +// Complement qnumeric.h: +[[nodiscard]] inline bool qIsInf(qfloat16 f) noexcept { return f.isInf(); } +[[nodiscard]] inline bool qIsNaN(qfloat16 f) noexcept { return f.isNaN(); } +[[nodiscard]] inline bool qIsFinite(qfloat16 f) noexcept { return f.isFinite(); } +[[nodiscard]] inline int qFpClassify(qfloat16 f) noexcept { return f.fpClassify(); } +// [[nodiscard]] quint32 qFloatDistance(qfloat16 a, qfloat16 b); + +[[nodiscard]] inline qfloat16 qSqrt(qfloat16 f) +{ +#if defined(__cpp_lib_extended_float) && defined(__STDCPP_FLOAT16_T__) && 0 + // https://wg21.link/p1467 - disabled until tested + using namespace std; + return sqrt(f); +#elif QFLOAT16_IS_NATIVE && defined(__HAVE_FLOAT16) && __HAVE_FLOAT16 + // This C library (glibc) has sqrtf16(). + return sqrtf16(f); +#else + bool mathUpdatesErrno = true; +# if defined(__NO_MATH_ERRNO__) || defined(_M_FP_FAST) + mathUpdatesErrno = false; +# elif defined(math_errhandling) + mathUpdatesErrno = (math_errhandling & MATH_ERRNO); +# endif + + // We don't need to set errno to EDOM if (f >= 0 && f != -0 && !isnan(f)) + // (or if we don't care about errno in the first place). We can merge the + // NaN check with by negating and inverting: !(0 > f), and leaving zero to + // sqrtf(). + if (!mathUpdatesErrno || !(0 > f)) { +# if defined(__AVX512FP16__) + __m128h v = _mm_set_sh(f); + v = _mm_sqrt_sh(v, v); + return _mm_cvtsh_h(v); +# endif + } + + // WG14's N2601 does not provide a way to tell which types an + // implementation supports, so we assume it doesn't and fall back to FP32 + float f32 = float(f); + f32 = sqrtf(f32); + return qfloat16::NearestFloat(f32); +#endif +} + +// The remainder of these utility functions complement qglobal.h +[[nodiscard]] inline int qRound(qfloat16 d) noexcept +{ return qRound(static_cast(d)); } + +[[nodiscard]] inline qint64 qRound64(qfloat16 d) noexcept +{ return qRound64(static_cast(d)); } + +[[nodiscard]] inline bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept +{ + qfloat16::NearestFloat f1 = static_cast(p1); + qfloat16::NearestFloat f2 = static_cast(p2); + // The significand precision for IEEE754 half precision is + // 11 bits (10 explicitly stored), or approximately 3 decimal + // digits. In selecting the fuzzy comparison factor of 102.5f + // (that is, (2^10+1)/10) below, we effectively select a + // window of about 1 (least significant) decimal digit about + // which the two operands can vary and still return true. + return (qAbs(f1 - f2) * 102.5f <= qMin(qAbs(f1), qAbs(f2))); +} + +/*! + \internal +*/ +[[nodiscard]] inline bool qFuzzyIsNull(qfloat16 f) noexcept +{ + return qAbs(f) < 0.00976f; // 1/102.5 to 3 significant digits; see qFuzzyCompare() +} + +[[nodiscard]] inline bool qIsNull(qfloat16 f) noexcept +{ + return (f.b16 & static_cast(0x7fff)) == 0; +} + +inline int qIntCast(qfloat16 f) noexcept +{ return int(static_cast(f)); } + +#if !defined(Q_QDOC) && !QFLOAT16_IS_NATIVE +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wc99-extensions") +QT_WARNING_DISABLE_GCC("-Wold-style-cast") +inline qfloat16::qfloat16(float f) noexcept +{ +#if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__) + __m128 packsingle = _mm_set_ss(f); + __m128i packhalf = _mm_cvtps_ph(packsingle, 0); + b16 = _mm_extract_epi16(packhalf, 0); +#elif defined (__ARM_FP16_FORMAT_IEEE) + __fp16 f16 = __fp16(f); + memcpy(&b16, &f16, sizeof(quint16)); +#else + quint32 u; + memcpy(&u, &f, sizeof(quint32)); + const quint32 signAndExp = u >> 23; + const quint16 base = basetable[signAndExp]; + const quint16 shift = shifttable[signAndExp]; + const quint32 round = roundtable[signAndExp]; + quint32 mantissa = (u & 0x007fffff); + if ((signAndExp & 0xff) == 0xff) { + if (mantissa) // keep nan from truncating to inf + mantissa = qMax(1U << shift, mantissa); + } else { + // Round half to even. First round up by adding one in the most + // significant bit we'll be discarding: + mantissa += round; + // If the last bit we'll be keeping is now set, but all later bits are + // clear, we were at half and shouldn't have rounded up; decrement will + // clear this last kept bit. Any later set bit hides the decrement. + if (mantissa & (1 << shift)) + --mantissa; + } + + // We use add as the mantissa may overflow causing + // the exp part to shift exactly one value. + b16 = quint16(base + (mantissa >> shift)); +#endif +} +QT_WARNING_POP + +inline qfloat16::operator float() const noexcept +{ +#if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__) + __m128i packhalf = _mm_cvtsi32_si128(b16); + __m128 packsingle = _mm_cvtph_ps(packhalf); + return _mm_cvtss_f32(packsingle); +#elif defined (__ARM_FP16_FORMAT_IEEE) + __fp16 f16; + memcpy(&f16, &b16, sizeof(quint16)); + return float(f16); +#else + quint32 u = mantissatable[offsettable[b16 >> 10] + (b16 & 0x3ff)] + + exponenttable[b16 >> 10]; + float f; + memcpy(&f, &u, sizeof(quint32)); + return f; +#endif +} +#endif // Q_QDOC and non-native + +/* + qHypot compatibility; see ../kernel/qmath.h +*/ +namespace QtPrivate { +template <> struct QHypotType +{ + using type = qfloat16; +}; +template struct QHypotType +{ + using type = std::conditional_t, R, double>; +}; +template struct QHypotType : QHypotType +{ +}; +} + +// Avoid passing qfloat16 to std::hypot(), while ensuring return types +// consistent with the above: +inline auto qHypot(qfloat16 x, qfloat16 y) +{ +#if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__) || QFLOAT16_IS_NATIVE + return QtPrivate::QHypotHelper(x).add(y).result(); +#else + return qfloat16(qHypot(float(x), float(y))); +#endif +} + +// in ../kernel/qmath.h +template auto qHypot(F first, Fs... rest); + +template typename QtPrivate::QHypotType::type +qHypot(T x, qfloat16 y) +{ + if constexpr (std::is_floating_point_v) + return qHypot(x, float(y)); + else + return qHypot(qfloat16(x), y); +} +template auto qHypot(qfloat16 x, T y) +{ + return qHypot(y, x); +} + +#if defined(__cpp_lib_hypot) && __cpp_lib_hypot >= 201603L // Expected to be true +// If any are not qfloat16, convert each qfloat16 to float: +/* (The following splits the some-but-not-all-qfloat16 cases up, using + (X|Y|Z)&~(X&Y&Z) = X ? ~(Y&Z) : Y|Z = X&~(Y&Z) | ~X&Y | ~X&~Y&Z, + into non-overlapping cases, to avoid ambiguity.) */ +template && std::is_same_v), int>::type = 0> +auto qHypot(qfloat16 x, Ty y, Tz z) { return qHypot(qfloat16::NearestFloat(x), y, z); } +template , int>::type = 0> +auto qHypot(Tx x, qfloat16 y, Tz z) { return qHypot(x, qfloat16::NearestFloat(y), z); } +template && !std::is_same_v, int>::type = 0> +auto qHypot(Tx x, Ty y, qfloat16 z) { return qHypot(x, y, qfloat16::NearestFloat(z)); } + +// If all are qfloat16, stay with qfloat16 (albeit via float, if no native support): +inline auto qHypot(qfloat16 x, qfloat16 y, qfloat16 z) +{ +#if (defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__)) || QFLOAT16_IS_NATIVE + return QtPrivate::QHypotHelper(x).add(y).add(z).result(); +#else + return qfloat16(qHypot(float(x), float(y), float(z))); +#endif +} +#endif // 3-arg std::hypot() is available + +QT_END_NAMESPACE + +namespace std { +template<> +class numeric_limits : public numeric_limits +{ +public: + /* + Treat quint16 b16 as if it were: + uint S: 1; // b16 >> 15 (sign); can be set for zero + uint E: 5; // (b16 >> 10) & 0x1f (offset exponent) + uint M: 10; // b16 & 0x3ff (adjusted mantissa) + + for E == 0: magnitude is M / 2.^{24} + for 0 < E < 31: magnitude is (1. + M / 2.^{10}) * 2.^{E - 15) + for E == 31: not finite + */ + static constexpr int digits = 11; + static constexpr int min_exponent = -13; + static constexpr int max_exponent = 16; + + static constexpr int digits10 = 3; + static constexpr int max_digits10 = 5; + static constexpr int min_exponent10 = -4; + static constexpr int max_exponent10 = 4; + + static constexpr QT_PREPEND_NAMESPACE(qfloat16) epsilon() + { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_epsilon(); } + static constexpr QT_PREPEND_NAMESPACE(qfloat16) (min)() + { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_min(); } + static constexpr QT_PREPEND_NAMESPACE(qfloat16) denorm_min() + { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_denorm_min(); } + static constexpr QT_PREPEND_NAMESPACE(qfloat16) (max)() + { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_max(); } + static constexpr QT_PREPEND_NAMESPACE(qfloat16) lowest() + { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_lowest(); } + static constexpr QT_PREPEND_NAMESPACE(qfloat16) infinity() + { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_infinity(); } + static constexpr QT_PREPEND_NAMESPACE(qfloat16) quiet_NaN() + { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_quiet_NaN(); } +#if QT_CONFIG(signaling_nan) + static constexpr QT_PREPEND_NAMESPACE(qfloat16) signaling_NaN() + { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_signaling_NaN(); } +#else + static constexpr bool has_signaling_NaN = false; +#endif +}; + +template<> class numeric_limits + : public numeric_limits {}; +template<> class numeric_limits + : public numeric_limits {}; +template<> class numeric_limits + : public numeric_limits {}; + +// Adding overloads to std isn't allowed, so we can't extend this to support +// for fpclassify(), isnormal() &c. (which, furthermore, are macros on MinGW). +} // namespace std + +#endif // QFLOAT16_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qforeach.h b/qt/6.8.1/msvc2022_64/include/QtCore/qforeach.h new file mode 100644 index 0000000000000000000000000000000000000000..33f76ed39494c9720aaab7f06a6077b3e328f902 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qforeach.h @@ -0,0 +1,84 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// Copyright (C) 2019 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QFOREACH_H +#define QFOREACH_H + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#if 0 +#pragma qt_class(QForeach) +#pragma qt_sync_stop_processing +#endif + +#ifndef QT_NO_FOREACH + +namespace QtPrivate { + +template +class QForeachContainer { + Q_DISABLE_COPY_MOVE(QForeachContainer) +public: + QForeachContainer(const T &t) : c(t), i(std::as_const(c).begin()), e(std::as_const(c).end()) {} + QForeachContainer(T &&t) : c(std::move(t)), i(std::as_const(c).begin()), e(std::as_const(c).end()) {} + + T c; + typename T::const_iterator i, e; +}; + +// Containers that have a detach function are considered shared, and are OK in a foreach loop +template ().detach())> +inline void warnIfContainerIsNotShared(int) {} + +#if QT_DEPRECATED_SINCE(6, 0) +// Other containers will copy themselves if used in foreach, this use is deprecated +template +QT_DEPRECATED_VERSION_X_6_0("Do not use foreach/Q_FOREACH with containers which are not implicitly shared. " + "Prefer using a range-based for loop with these containers: `for (const auto &it : container)`, " + "keeping in mind that range-based for doesn't copy the container as Q_FOREACH does") +inline void warnIfContainerIsNotShared(...) {} +#endif + +template +QForeachContainer::type> qMakeForeachContainer(T &&t) +{ + warnIfContainerIsNotShared::type>(0); + return QForeachContainer::type>(std::forward(t)); +} + +} + +// Use C++17 if statement with initializer. User's code ends up in a else so +// scoping of different ifs is not broken +#define Q_FOREACH_IMPL(variable, name, container) \ + for (auto name = QtPrivate::qMakeForeachContainer(container); name.i != name.e; ++name.i) \ + if (variable = *name.i; false) {} else + +#define Q_FOREACH_JOIN(A, B) Q_FOREACH_JOIN_IMPL(A, B) +#define Q_FOREACH_JOIN_IMPL(A, B) A ## B + +#define Q_FOREACH(variable, container) \ + Q_FOREACH_IMPL(variable, Q_FOREACH_JOIN(_container_, __LINE__), container) +#endif // QT_NO_FOREACH + +#define Q_FOREVER for(;;) +#ifndef QT_NO_KEYWORDS +# ifndef QT_NO_FOREACH +# ifndef foreach +# define foreach Q_FOREACH +# endif +# endif // QT_NO_FOREACH +# ifndef forever +# define forever Q_FOREVER +# endif +#endif + +QT_END_NAMESPACE + +#endif /* QFOREACH_H */ diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qfunctionaltools_impl.h b/qt/6.8.1/msvc2022_64/include/QtCore/qfunctionaltools_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..506d9ae61896d24ba4e8c140ab6555b8951e3085 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qfunctionaltools_impl.h @@ -0,0 +1,77 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#if 0 +#pragma qt_sync_skip_header_check +#pragma qt_sync_stop_processing +#endif + +#ifndef QFUNCTIONALTOOLS_IMPL_H +#define QFUNCTIONALTOOLS_IMPL_H + +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtPrivate { + +namespace detail { + +#define FOR_EACH_CVREF(op) \ + op(&) \ + op(const &) \ + op(&&) \ + op(const &&) \ + /* end */ + + +template +struct StorageByValue +{ + Object o; +#define MAKE_GETTER(cvref) \ + constexpr Object cvref object() cvref noexcept \ + { return static_cast(o); } + FOR_EACH_CVREF(MAKE_GETTER) +#undef MAKE_GETTER +}; + +template +struct StorageEmptyBaseClassOptimization : Object +{ + StorageEmptyBaseClassOptimization() = default; + StorageEmptyBaseClassOptimization(Object &&o) + : Object(std::move(o)) + {} + StorageEmptyBaseClassOptimization(const Object &o) + : Object(o) + {} + +#define MAKE_GETTER(cvref) \ + constexpr Object cvref object() cvref noexcept \ + { return static_cast(*this); } + FOR_EACH_CVREF(MAKE_GETTER) +#undef MAKE_GETTER +}; +} // namespace detail + +template +using CompactStorage = typename std::conditional_t< + std::conjunction_v< + std::is_empty, + std::negation> + >, + detail::StorageEmptyBaseClassOptimization, + detail::StorageByValue + >; + +} // namespace QtPrivate + +#undef FOR_EACH_CVREF + +QT_END_NAMESPACE + +#endif // QFUNCTIONALTOOLS_IMPL_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qfunctionpointer.h b/qt/6.8.1/msvc2022_64/include/QtCore/qfunctionpointer.h new file mode 100644 index 0000000000000000000000000000000000000000..496d4f3148de88cf0186025cb625a4d641b9fb12 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qfunctionpointer.h @@ -0,0 +1,23 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QFUNCTIONPOINTER_H +#define QFUNCTIONPOINTER_H + +#include + +#if 0 +#pragma qt_class(QFunctionPointer) +#endif + +#if defined(__cplusplus) + +QT_BEGIN_NAMESPACE + +typedef void (*QFunctionPointer)(); + +QT_END_NAMESPACE + +#endif // __cplusplus + +#endif // QFUNCTIONPOINTER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qfuture.h b/qt/6.8.1/msvc2022_64/include/QtCore/qfuture.h new file mode 100644 index 0000000000000000000000000000000000000000..b6f3d033011d32d66c3cffe45daf901b51e734e4 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qfuture.h @@ -0,0 +1,550 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QFUTURE_H +#define QFUTURE_H + +#include + +#include +#include +#include + +#include + +#include + +QT_REQUIRE_CONFIG(future); + +QT_BEGIN_NAMESPACE + +template +class QFutureWatcher; + +template +class QFuture +{ + static_assert (std::is_move_constructible_v + || std::is_same_v, + "A move-constructible type or type void is required"); +public: + QFuture() + : d(QFutureInterface::canceledResult()) + { } + + template> + explicit QFuture(QFutureInterface *p) // internal + : d(*p) + { } + + template> + explicit QFuture(QFutureInterfaceBase *p) // internal + : d(*p) + { + } + + template> + explicit QFuture(const QFuture &other) : d(other.d) + { + } + + template> + QFuture &operator=(const QFuture &other) + { + d = other.d; + return *this; + } + +#if defined(Q_QDOC) + ~QFuture() { } + QFuture(const QFuture &) { } + QFuture & operator=(const QFuture &) { } +#endif + + void cancel() { d.cancel(); } + bool isCanceled() const { return d.isCanceled(); } + +#if QT_DEPRECATED_SINCE(6, 0) + QT_DEPRECATED_VERSION_X_6_0("Use setSuspended() instead.") + void setPaused(bool paused) { d.setSuspended(paused); } + + QT_DEPRECATED_VERSION_X_6_0("Use isSuspending() or isSuspended() instead.") + bool isPaused() const + { +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED + return d.isPaused(); +QT_WARNING_POP + } + + QT_DEPRECATED_VERSION_X_6_0("Use toggleSuspended() instead.") + void togglePaused() { d.toggleSuspended(); } + + QT_DEPRECATED_VERSION_X_6_0("Use suspend() instead.") + void pause() { suspend(); } +#endif + bool isSuspending() const { return d.isSuspending(); } + bool isSuspended() const { return d.isSuspended(); } + void setSuspended(bool suspend) { d.setSuspended(suspend); } + void suspend() { setSuspended(true); } + void resume() { setSuspended(false); } + void toggleSuspended() { d.toggleSuspended(); } + + bool isStarted() const { return d.isStarted(); } + bool isFinished() const { return d.isFinished(); } + bool isRunning() const { return d.isRunning(); } + + int resultCount() const { return d.resultCount(); } + int progressValue() const { return d.progressValue(); } + int progressMinimum() const { return d.progressMinimum(); } + int progressMaximum() const { return d.progressMaximum(); } + QString progressText() const { return d.progressText(); } + void waitForFinished() { d.waitForFinished(); } + + template> + inline T result() const; + + template> + inline T resultAt(int index) const; + + template> + bool isResultReadyAt(int resultIndex) const { return d.isResultReadyAt(resultIndex); } + + template> + QList results() const { return d.results(); } + + template> + T takeResult() { return d.takeResult(); } + +#if 0 + // TODO: Enable and make it return a QList, when QList is fixed to support move-only types + template> + std::vector takeResults() { return d.takeResults(); } +#endif + + bool isValid() const { return d.isValid(); } + + template + using ResultType = typename QtPrivate::ResultTypeHelper::ResultType; + + template + QFuture> then(Function &&function); + + template + QFuture> then(QtFuture::Launch policy, Function &&function); + + template + QFuture> then(QThreadPool *pool, Function &&function); + + template + QFuture> then(QObject *context, Function &&function); + +#ifndef QT_NO_EXCEPTIONS + template::HasExtraArgs>> + QFuture onFailed(Function &&handler); + + template::HasExtraArgs>> + QFuture onFailed(QObject *context, Function &&handler); +#endif + + template>> + QFuture onCanceled(Function &&handler); + + template>> + QFuture onCanceled(QObject *context, Function &&handler); + +#if !defined(Q_QDOC) + template>> + auto unwrap(); +#else + template + QFuture unwrap(); +#endif + + class const_iterator + { + public: + static_assert(!std::is_same_v, + "It isn't possible to define QFuture::const_iterator"); + + typedef std::bidirectional_iterator_tag iterator_category; + typedef qptrdiff difference_type; + typedef T value_type; + typedef const T *pointer; + typedef const T &reference; + + inline const_iterator() {} + inline const_iterator(QFuture const * const _future, int _index) + : future(_future), index(advanceIndex(_index, 0)) { } + inline const_iterator(const const_iterator &o) : future(o.future), index(o.index) {} + inline const_iterator &operator=(const const_iterator &o) + { future = o.future; index = o.index; return *this; } + inline const T &operator*() const { return future->d.resultReference(index); } + inline const T *operator->() const { return future->d.resultPointer(index); } + inline const_iterator &operator++() + { index = advanceIndex(index, 1); return *this; } + inline const_iterator &operator--() + { index = advanceIndex(index, -1); return *this; } + inline const_iterator operator++(int) + { + const_iterator r = *this; + index = advanceIndex(index, 1); + return r; + } + inline const_iterator operator--(int) + { + const_iterator r = *this; + index = advanceIndex(index, -1); + return r; + } + inline const_iterator operator+(int j) const + { return const_iterator(future, advanceIndex(index, j)); } + inline const_iterator operator-(int j) const + { return const_iterator(future, advanceIndex(index, -j)); } + inline const_iterator &operator+=(int j) + { index = advanceIndex(index, j); return *this; } + inline const_iterator &operator-=(int j) + { index = advanceIndex(index, -j); return *this; } + friend inline const_iterator operator+(int j, const_iterator k) + { return const_iterator(k.future, k.advanceIndex(k.index, j)); } + + private: + friend bool comparesEqual(const const_iterator &lhs, const const_iterator &rhs) noexcept + { + return lhs.index == rhs.index; + } + Q_DECLARE_EQUALITY_COMPARABLE(const_iterator) + + /*! \internal + + Advances the iterator index \a idx \a n steps, waits for the + result at the target index, and returns the target index. + + The index may be -1, indicating the end iterator, either + as the argument or as the return value. The end iterator + may be decremented. + + The caller is responsible for not advancing the iterator + before begin() or past end(), with the exception that + attempting to advance a non-end iterator past end() for + a running future is allowed and will return the end iterator. + + Note that n == 0 is valid and will wait for the result + at the given index. + */ + int advanceIndex(int idx, int n) const + { + // The end iterator can be decremented, leave as-is for other cases + if (idx == -1 && n >= 0) + return idx; + + // Special case for decrementing the end iterator: wait for + // finished to get the total result count. + if (idx == -1 && future->isRunning()) + future->d.waitForFinished(); + + // Wait for result at target index + const int targetIndex = (idx == -1) ? future->resultCount() + n : idx + n; + future->d.waitForResult(targetIndex); + + // After waiting there is either a result or the end was reached + return (targetIndex < future->resultCount()) ? targetIndex : -1; + } + + QFuture const * future; + int index; + }; + friend class const_iterator; + typedef const_iterator ConstIterator; + + template> + const_iterator begin() const { return const_iterator(this, 0); } + + template> + const_iterator constBegin() const { return const_iterator(this, 0); } + + template> + const_iterator end() const { return const_iterator(this, -1); } + + template> + const_iterator constEnd() const { return const_iterator(this, -1); } + +private: + friend class QFutureWatcher; + + template + friend class QFuture; + + friend class QFutureInterfaceBase; + + template + friend class QtPrivate::Continuation; + + template + friend class QtPrivate::CanceledHandler; + +#ifndef QT_NO_EXCEPTIONS + template + friend class QtPrivate::FailureHandler; +#endif + + template + friend struct QtPrivate::WhenAnyContext; + + friend struct QtPrivate::UnwrapHandler; + + using QFuturePrivate = + std::conditional_t, QFutureInterfaceBase, QFutureInterface>; + +#ifdef QFUTURE_TEST +public: +#endif + mutable QFuturePrivate d; +}; + +template +template +inline T QFuture::result() const +{ + d.waitForResult(0); + return d.resultReference(0); +} + +template +template +inline T QFuture::resultAt(int index) const +{ + d.waitForResult(index); + return d.resultReference(index); +} + +template +inline QFuture QFutureInterface::future() +{ + return QFuture(this); +} + +template +template +QFuture::template ResultType> QFuture::then(Function &&function) +{ + return then(QtFuture::Launch::Sync, std::forward(function)); +} + +template +template +QFuture::template ResultType> +QFuture::then(QtFuture::Launch policy, Function &&function) +{ + QFutureInterface> promise(QFutureInterfaceBase::State::Pending); + QtPrivate::Continuation, ResultType, T>::create( + std::forward(function), this, promise, policy); + return promise.future(); +} + +template +template +QFuture::template ResultType> QFuture::then(QThreadPool *pool, + Function &&function) +{ + QFutureInterface> promise(QFutureInterfaceBase::State::Pending); + QtPrivate::Continuation, ResultType, T>::create( + std::forward(function), this, promise, pool); + return promise.future(); +} + +template +template +QFuture::template ResultType> QFuture::then(QObject *context, + Function &&function) +{ + QFutureInterface> promise(QFutureInterfaceBase::State::Pending); + QtPrivate::Continuation, ResultType, T>::create( + std::forward(function), this, promise, context); + return promise.future(); +} + +#ifndef QT_NO_EXCEPTIONS +template +template +QFuture QFuture::onFailed(Function &&handler) +{ + QFutureInterface promise(QFutureInterfaceBase::State::Pending); + QtPrivate::FailureHandler, T>::create(std::forward(handler), + this, promise); + return promise.future(); +} + +template +template +QFuture QFuture::onFailed(QObject *context, Function &&handler) +{ + QFutureInterface promise(QFutureInterfaceBase::State::Pending); + QtPrivate::FailureHandler, T>::create(std::forward(handler), + this, promise, context); + return promise.future(); +} + +#endif + +template +template +QFuture QFuture::onCanceled(Function &&handler) +{ + QFutureInterface promise(QFutureInterfaceBase::State::Pending); + QtPrivate::CanceledHandler, T>::create(std::forward(handler), + this, promise); + return promise.future(); +} + +template +template +QFuture QFuture::onCanceled(QObject *context, Function &&handler) +{ + QFutureInterface promise(QFutureInterfaceBase::State::Pending); + QtPrivate::CanceledHandler, T>::create(std::forward(handler), + this, promise, context); + return promise.future(); +} + +template +template +auto QFuture::unwrap() +{ + if constexpr (QtPrivate::isQFutureV::type>) + return QtPrivate::UnwrapHandler::unwrapImpl(this).unwrap(); + else + return QtPrivate::UnwrapHandler::unwrapImpl(this); +} + +inline QFuture QFutureInterface::future() +{ + return QFuture(this); +} + +template +QFutureInterfaceBase QFutureInterfaceBase::get(const QFuture &future) +{ + return future.d; +} + +namespace QtPrivate +{ + +template +struct MetaTypeQFutureHelper> +{ + static bool registerConverter() { + if constexpr (std::is_same_v) + return false; + + return QMetaType::registerConverter, QFuture>( + [](const QFuture &future) { return QFuture(future); }); + } +}; + +} // namespace QtPrivate + +namespace QtFuture { + +#ifndef Q_QDOC + +template::value_type, + std::enable_if_t, + QtPrivate::IsRandomAccessible, + QtPrivate::isQFuture>, + int> = 0> +QFuture whenAll(InputIt first, InputIt last) +{ + return QtPrivate::whenAllImpl(first, last); +} + +template::value_type, + std::enable_if_t, + QtPrivate::isQFuture>, + int> = 0> +QFuture> whenAll(InputIt first, InputIt last) +{ + return QtPrivate::whenAllImpl, InputIt, ValueType>(first, last); +} + +template, + QtPrivate::NotEmpty, + QtPrivate::isQFuture>...>, + int> = 0> +QFuture whenAll(Futures &&... futures) +{ + return QtPrivate::whenAllImpl(std::forward(futures)...); +} + +template, + QtPrivate::isQFuture>...>, + int> = 0> +QFuture...>>> whenAll(Futures &&... futures) +{ + return QtPrivate::whenAllImpl...>>, Futures...>( + std::forward(futures)...); +} + +template::value_type, + std::enable_if_t, + QtPrivate::isQFuture>, + int> = 0> +QFuture::type>> whenAny(InputIt first, + InputIt last) +{ + return QtPrivate::whenAnyImpl(first, last); +} + +template, + QtPrivate::isQFuture>...>, + int> = 0> +QFuture...>> whenAny(Futures &&... futures) +{ + return QtPrivate::whenAnyImpl(std::forward(futures)...); +} + +#else + +template +QFuture whenAll(InputIt first, InputIt last); + +template +QFuture whenAll(Futures &&... futures); + +template +QFuture> whenAny(InputIt first, InputIt last); + +template +QFuture...>> whenAny(Futures &&... futures); + +#endif // Q_QDOC + +#if QT_DEPRECATED_SINCE(6, 10) +#if defined(Q_QDOC) +static QFuture makeReadyFuture() +#else +template +QT_DEPRECATED_VERSION_X(6, 10, "Use makeReadyVoidFuture() instead.") +static QFuture makeReadyFuture() +#endif +{ + return makeReadyVoidFuture(); +} +#endif // QT_DEPRECATED_SINCE(6, 10) + +} // namespace QtFuture + +Q_DECLARE_SEQUENTIAL_ITERATOR(Future) + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE_TEMPLATE_1ARG(QFuture) + +#endif // QFUTURE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qfuture_impl.h b/qt/6.8.1/msvc2022_64/include/QtCore/qfuture_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..8b880e8f6a4b90b92934742304d688089c31e90d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qfuture_impl.h @@ -0,0 +1,1202 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QFUTURE_H +#error Do not include qfuture_impl.h directly +#endif + +#if 0 +#pragma qt_sync_skip_header_check +#pragma qt_sync_stop_processing +#endif + +#include +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +// +// forward declarations +// +template +class QFuture; +template +class QFutureInterface; +template +class QPromise; + +namespace QtFuture { + +enum class Launch { Sync, Async, Inherit }; + +template +struct WhenAnyResult +{ + qsizetype index = -1; + QFuture future; +}; + +// Deduction guide +template +WhenAnyResult(qsizetype, const QFuture &) -> WhenAnyResult; +} + +namespace QtPrivate { + +template +using EnableForVoid = std::enable_if_t>; + +template +using EnableForNonVoid = std::enable_if_t>; + +template +struct ResultTypeHelper +{ +}; + +// The callable takes an argument of type Arg +template +struct ResultTypeHelper< + F, Arg, typename std::enable_if_t, QFuture>>> +{ + using ResultType = std::invoke_result_t, std::decay_t>; +}; + +// The callable takes an argument of type QFuture +template +struct ResultTypeHelper< + F, Arg, typename std::enable_if_t, QFuture>>> +{ + using ResultType = std::invoke_result_t, QFuture>; +}; + +// The callable takes an argument of type QFuture +template +struct ResultTypeHelper< + F, void, typename std::enable_if_t, QFuture>>> +{ + using ResultType = std::invoke_result_t, QFuture>; +}; + +// The callable doesn't take argument +template +struct ResultTypeHelper< + F, void, typename std::enable_if_t, QFuture>>> +{ + using ResultType = std::invoke_result_t>; +}; + +// Helpers to remove QPrivateSignal argument from the list of arguments + +template +inline constexpr bool IsPrivateSignalArg = false; + +template +inline constexpr bool IsPrivateSignalArg + >> = true; + +template +auto cutTuple(Tuple &&t, std::index_sequence) +{ + return std::make_tuple(std::get(t)...); +} + +template +auto createTuple(Arg &&arg, Args &&... args) +{ + using TupleType = std::tuple, std::decay_t...>; + constexpr auto Size = sizeof...(Args); // One less than the size of all arguments + if constexpr (QtPrivate::IsPrivateSignalArg>) { + if constexpr (Size == 1) { + return std::forward(arg); + } else { + return cutTuple(std::make_tuple(std::forward(arg), std::forward(args)...), + std::make_index_sequence()); + } + } else { + return std::make_tuple(std::forward(arg), std::forward(args)...); + } +} + +// Helpers to resolve argument types of callables. + +template +using FilterLastPrivateSignalArg = + std::conditional_t<(sizeof...(Args) > 0), + std::invoke_result_t), Arg, Args...>, + std::conditional_t, void, Arg>>; + +template +struct ArgsType; + +template +struct ArgsType +{ + using First = Arg; + using PromiseType = void; + using IsPromise = std::false_type; + static const bool HasExtraArgs = (sizeof...(Args) > 0); + using AllArgs = FilterLastPrivateSignalArg, std::decay_t...>; + + template + static const bool CanInvokeWithArgs = std::is_invocable_v; +}; + +template +struct ArgsType &, Args...> +{ + using First = QPromise &; + using PromiseType = Arg; + using IsPromise = std::true_type; + static const bool HasExtraArgs = (sizeof...(Args) > 0); + using AllArgs = FilterLastPrivateSignalArg, std::decay_t...>; + + template + static const bool CanInvokeWithArgs = std::is_invocable_v &, Args...>; +}; + +template<> +struct ArgsType<> +{ + using First = void; + using PromiseType = void; + using IsPromise = std::false_type; + static const bool HasExtraArgs = false; + using AllArgs = void; + + template + static const bool CanInvokeWithArgs = std::is_invocable_v; +}; + +template +struct ArgResolver : ArgResolver::operator())> +{ +}; + +template +struct ArgResolver> : ArgResolver::operator())> +{ +}; + +template +struct ArgResolver : public ArgsType +{ +}; + +template +struct ArgResolver : public ArgsType +{ +}; + +template +struct ArgResolver : public ArgsType +{ +}; + +template +struct ArgResolver : public ArgsType +{ +}; + +template +struct ArgResolver : public ArgsType +{ +}; + +template +struct ArgResolver : public ArgsType +{ +}; + +template +struct ArgResolver : public ArgsType +{ +}; + +template +struct ArgResolver : public ArgsType +{ +}; + +template +struct ArgResolver : public ArgsType +{ +}; + +template +struct ArgResolver : public ArgsType +{ +}; + +template +struct ArgResolver : public ArgsType +{ +}; + +template +using EnableIfInvocable = std::enable_if_t< + QtPrivate::ArgResolver::template CanInvokeWithArgs>; + +template +inline constexpr bool isQFutureV = false; + +template +inline constexpr bool isQFutureV> = true; + +template +using isQFuture = std::bool_constant>; + +template +struct Future +{ +}; + +template +struct Future> +{ + using type = T; +}; + +template +using NotEmpty = std::bool_constant<(sizeof...(Args) > 0)>; + +template +using IsRandomAccessible = + std::is_convertible()))>>::iterator_category, + std::random_access_iterator_tag>; + +template +using HasInputIterator = + std::is_convertible()))>>::iterator_category, + std::input_iterator_tag>; + +template +using IsForwardIterable = + std::is_convertible::iterator_category, + std::forward_iterator_tag>; + +template +class Continuation +{ + Q_DISABLE_COPY_MOVE(Continuation) +public: + template + Continuation(F &&func, const QFuture &f, QPromise &&p) + : promise(std::move(p)), parentFuture(f), function(std::forward(func)) + { + } + virtual ~Continuation() = default; + + bool execute(); + + template + static void create(F &&func, QFuture *f, QFutureInterface &fi, + QtFuture::Launch policy); + + template + static void create(F &&func, QFuture *f, QFutureInterface &fi, + QThreadPool *pool); + + template + static void create(F &&func, QFuture *f, QFutureInterface &fi, + QObject *context); + +private: + void fulfillPromiseWithResult(); + void fulfillVoidPromise(); + void fulfillPromiseWithVoidResult(); + + template + void fulfillPromise(Args &&... args); + +protected: + virtual void runImpl() = 0; + + void runFunction(); + +protected: + QPromise promise; + QFuture parentFuture; + Function function; +}; + +template +class SyncContinuation final : public Continuation +{ +public: + template + SyncContinuation(F &&func, const QFuture &f, QPromise &&p) + : Continuation(std::forward(func), f, + std::move(p)) + { + } + + ~SyncContinuation() override = default; + +private: + void runImpl() override { this->runFunction(); } +}; + +template +class AsyncContinuation final : public QRunnable, + public Continuation +{ +public: + template + AsyncContinuation(F &&func, const QFuture &f, QPromise &&p, + QThreadPool *pool = nullptr) + : Continuation(std::forward(func), f, + std::move(p)), + threadPool(pool) + { + } + + ~AsyncContinuation() override = default; + +private: + void runImpl() override // from Continuation + { + QThreadPool *pool = threadPool ? threadPool : QThreadPool::globalInstance(); + pool->start(this); + } + + void run() override // from QRunnable + { + this->runFunction(); + } + +private: + QThreadPool *threadPool; +}; + +#ifndef QT_NO_EXCEPTIONS + +template +class FailureHandler +{ +public: + template + static void create(F &&function, QFuture *future, + const QFutureInterface &fi); + + template + static void create(F &&function, QFuture *future, QFutureInterface &fi, + QObject *context); + + template + FailureHandler(F &&func, const QFuture &f, QPromise &&p) + : promise(std::move(p)), parentFuture(f), handler(std::forward(func)) + { + } + +public: + void run(); + +private: + template + void handleException(); + void handleAllExceptions(); + +private: + QPromise promise; + QFuture parentFuture; + Function handler; +}; + +#endif + +template +void Continuation::runFunction() +{ + promise.start(); + + Q_ASSERT(parentFuture.isFinished()); + +#ifndef QT_NO_EXCEPTIONS + try { +#endif + if constexpr (!std::is_void_v) { + if constexpr (std::is_void_v) { + fulfillPromiseWithVoidResult(); + } else if constexpr (std::is_invocable_v) { + fulfillPromiseWithResult(); + } else { + // This assert normally should never fail, this is to make sure + // that nothing unexpected happened. + static_assert(std::is_invocable_v>, + "The continuation is not invocable with the provided arguments"); + fulfillPromise(parentFuture); + } + } else { + if constexpr (std::is_void_v) { + if constexpr (std::is_invocable_v>) + function(parentFuture); + else + function(); + } else if constexpr (std::is_invocable_v) { + fulfillVoidPromise(); + } else { + // This assert normally should never fail, this is to make sure + // that nothing unexpected happened. + static_assert(std::is_invocable_v>, + "The continuation is not invocable with the provided arguments"); + function(parentFuture); + } + } +#ifndef QT_NO_EXCEPTIONS + } catch (...) { + promise.setException(std::current_exception()); + } +#endif + promise.finish(); +} + +template +bool Continuation::execute() +{ + Q_ASSERT(parentFuture.isFinished()); + + if (parentFuture.d.isChainCanceled()) { +#ifndef QT_NO_EXCEPTIONS + if (parentFuture.d.hasException()) { + // If the continuation doesn't take a QFuture argument, propagate the exception + // to the caller, by reporting it. If the continuation takes a QFuture argument, + // the user may want to catch the exception inside the continuation, to not + // interrupt the continuation chain, so don't report anything yet. + if constexpr (!std::is_invocable_v, QFuture>) { + promise.start(); + promise.setException(parentFuture.d.exceptionStore().exception()); + promise.finish(); + return false; + } + } else +#endif + { + promise.start(); + promise.future().cancel(); + promise.finish(); + return false; + } + } + + runImpl(); + return true; +} + +// Workaround for keeping move-only lambdas inside std::function +template +struct ContinuationWrapper +{ + ContinuationWrapper(Function &&f) : function(std::move(f)) { } + ContinuationWrapper(const ContinuationWrapper &other) + : function(std::move(const_cast(other).function)) + { + Q_ASSERT_X(false, "QFuture", "Continuation shouldn't be copied"); + } + ContinuationWrapper(ContinuationWrapper &&other) = default; + ContinuationWrapper &operator=(ContinuationWrapper &&) = default; + + void operator()(const QFutureInterfaceBase &parentData) { function(parentData); } + +private: + Function function; +}; + +template +template +void Continuation::create(F &&func, + QFuture *f, + QFutureInterface &fi, + QtFuture::Launch policy) +{ + Q_ASSERT(f); + + QThreadPool *pool = nullptr; + + bool launchAsync = (policy == QtFuture::Launch::Async); + if (policy == QtFuture::Launch::Inherit) { + launchAsync = f->d.launchAsync(); + + // If the parent future was using a custom thread pool, inherit it as well. + if (launchAsync && f->d.threadPool()) { + pool = f->d.threadPool(); + fi.setThreadPool(pool); + } + } + + fi.setLaunchAsync(launchAsync); + + auto continuation = [func = std::forward(func), fi, promise_ = QPromise(fi), pool, + launchAsync](const QFutureInterfaceBase &parentData) mutable { + const auto parent = QFutureInterface(parentData).future(); + Continuation *continuationJob = nullptr; + if (launchAsync) { + auto asyncJob = new AsyncContinuation( + std::forward(func), parent, std::move(promise_), pool); + fi.setRunnable(asyncJob); + continuationJob = asyncJob; + } else { + continuationJob = new SyncContinuation( + std::forward(func), parent, std::move(promise_)); + } + + bool isLaunched = continuationJob->execute(); + // If continuation is successfully launched, AsyncContinuation will be deleted + // by the QThreadPool which has started it. Synchronous continuation will be + // executed immediately, so it's safe to always delete it here. + if (!(launchAsync && isLaunched)) { + delete continuationJob; + continuationJob = nullptr; + } + }; + f->d.setContinuation(ContinuationWrapper(std::move(continuation)), fi.d); +} + +template +template +void Continuation::create(F &&func, + QFuture *f, + QFutureInterface &fi, + QThreadPool *pool) +{ + Q_ASSERT(f); + + fi.setLaunchAsync(true); + fi.setThreadPool(pool); + + auto continuation = [func = std::forward(func), promise_ = QPromise(fi), + pool](const QFutureInterfaceBase &parentData) mutable { + const auto parent = QFutureInterface(parentData).future(); + auto continuationJob = new AsyncContinuation( + std::forward(func), parent, std::move(promise_), pool); + bool isLaunched = continuationJob->execute(); + // If continuation is successfully launched, AsyncContinuation will be deleted + // by the QThreadPool which has started it. + if (!isLaunched) { + delete continuationJob; + continuationJob = nullptr; + } + }; + f->d.setContinuation(ContinuationWrapper(std::move(continuation)), fi.d); +} + +template +void watchContinuation(const QObject *context, Continuation &&c, QFutureInterfaceBase &fi) +{ + using Prototype = typename QtPrivate::Callable::Function; + watchContinuationImpl(context, + QtPrivate::makeCallableObject(std::forward(c)), + fi); +} + +template +template +void Continuation::create(F &&func, + QFuture *f, + QFutureInterface &fi, + QObject *context) +{ + Q_ASSERT(f); + Q_ASSERT(context); + + // When the context object is destroyed, the signal-slot connection is broken and the + // continuation callback is destroyed. The promise that is created in the capture list is + // destroyed and, if it is not yet finished, cancelled. + auto continuation = [func = std::forward(func), parent = *f, + promise_ = QPromise(fi)]() mutable { + SyncContinuation continuationJob( + std::forward(func), parent, std::move(promise_)); + continuationJob.execute(); + }; + + QtPrivate::watchContinuation(context, std::move(continuation), f->d); +} + +template +void Continuation::fulfillPromiseWithResult() +{ + if constexpr (std::is_copy_constructible_v) + fulfillPromise(parentFuture.result()); + else + fulfillPromise(parentFuture.takeResult()); +} + +template +void Continuation::fulfillVoidPromise() +{ + if constexpr (std::is_copy_constructible_v) + function(parentFuture.result()); + else + function(parentFuture.takeResult()); +} + +template +void Continuation::fulfillPromiseWithVoidResult() +{ + if constexpr (std::is_invocable_v>) + fulfillPromise(parentFuture); + else + fulfillPromise(); +} + +template +template +void Continuation::fulfillPromise(Args &&... args) +{ + promise.addResult(std::invoke(function, std::forward(args)...)); +} + +template +void fulfillPromise(QPromise &promise, QFuture &future) +{ + if constexpr (!std::is_void_v) { + if constexpr (std::is_copy_constructible_v) + promise.addResult(future.result()); + else + promise.addResult(future.takeResult()); + } +} + +template +void fulfillPromise(QPromise &promise, Function &&handler) +{ + if constexpr (std::is_void_v) + handler(); + else + promise.addResult(handler()); +} + +#ifndef QT_NO_EXCEPTIONS + +template +template +void FailureHandler::create(F &&function, QFuture *future, + const QFutureInterface &fi) +{ + Q_ASSERT(future); + + auto failureContinuation = [function = std::forward(function), promise_ = QPromise(fi)]( + const QFutureInterfaceBase &parentData) mutable { + const auto parent = QFutureInterface(parentData).future(); + FailureHandler failureHandler(std::forward(function), + parent, std::move(promise_)); + failureHandler.run(); + }; + + future->d.setContinuation(ContinuationWrapper(std::move(failureContinuation))); +} + +template +template +void FailureHandler::create(F &&function, QFuture *future, + QFutureInterface &fi, + QObject *context) +{ + Q_ASSERT(future); + Q_ASSERT(context); + auto failureContinuation = [function = std::forward(function), + parent = *future, promise_ = QPromise(fi)]() mutable { + FailureHandler failureHandler( + std::forward(function), parent, std::move(promise_)); + failureHandler.run(); + }; + + QtPrivate::watchContinuation(context, std::move(failureContinuation), future->d); +} + +template +void FailureHandler::run() +{ + Q_ASSERT(parentFuture.isFinished()); + + promise.start(); + + if (parentFuture.d.hasException()) { + using ArgType = typename QtPrivate::ArgResolver::First; + if constexpr (std::is_void_v) { + handleAllExceptions(); + } else { + handleException(); + } + } else if (parentFuture.d.isChainCanceled()) { + promise.future().cancel(); + } else { + QtPrivate::fulfillPromise(promise, parentFuture); + } + promise.finish(); +} + +template +template +void FailureHandler::handleException() +{ + try { + Q_ASSERT(parentFuture.d.hasException()); + parentFuture.d.exceptionStore().rethrowException(); + } catch (const ArgType &e) { + try { + // Handle exceptions matching with the handler's argument type + if constexpr (std::is_void_v) + handler(e); + else + promise.addResult(handler(e)); + } catch (...) { + promise.setException(std::current_exception()); + } + } catch (...) { + // Exception doesn't match with handler's argument type, propagate + // the exception to be handled later. + promise.setException(std::current_exception()); + } +} + +template +void FailureHandler::handleAllExceptions() +{ + try { + Q_ASSERT(parentFuture.d.hasException()); + parentFuture.d.exceptionStore().rethrowException(); + } catch (...) { + try { + QtPrivate::fulfillPromise(promise, std::forward(handler)); + } catch (...) { + promise.setException(std::current_exception()); + } + } +} + +#endif // QT_NO_EXCEPTIONS + +template +class CanceledHandler +{ +public: + template + static void create(F &&handler, QFuture *future, QFutureInterface &fi) + { + Q_ASSERT(future); + + auto canceledContinuation = [promise = QPromise(fi), handler = std::forward(handler)]( + const QFutureInterfaceBase &parentData) mutable { + auto parentFuture = QFutureInterface(parentData).future(); + run(std::forward(handler), parentFuture, std::move(promise)); + }; + future->d.setContinuation(ContinuationWrapper(std::move(canceledContinuation))); + } + + template + static void create(F &&handler, QFuture *future, QFutureInterface &fi, + QObject *context) + { + Q_ASSERT(future); + Q_ASSERT(context); + auto canceledContinuation = [handler = std::forward(handler), + parentFuture = *future, promise = QPromise(fi)]() mutable { + run(std::forward(handler), parentFuture, std::move(promise)); + }; + + QtPrivate::watchContinuation(context, std::move(canceledContinuation), future->d); + } + + template + static void run(F &&handler, QFuture &parentFuture, QPromise &&promise) + { + promise.start(); + + if (parentFuture.isCanceled()) { +#ifndef QT_NO_EXCEPTIONS + if (parentFuture.d.hasException()) { + // Propagate the exception to the result future + promise.setException(parentFuture.d.exceptionStore().exception()); + } else { + try { +#endif + QtPrivate::fulfillPromise(promise, std::forward(handler)); +#ifndef QT_NO_EXCEPTIONS + } catch (...) { + promise.setException(std::current_exception()); + } + } +#endif + } else { + QtPrivate::fulfillPromise(promise, parentFuture); + } + + promise.finish(); + } +}; + +struct UnwrapHandler +{ + template + static auto unwrapImpl(T *outer) + { + Q_ASSERT(outer); + + using ResultType = typename QtPrivate::Future>::type; + using NestedType = typename QtPrivate::Future::type; + QFutureInterface promise(QFutureInterfaceBase::State::Pending); + + outer->then([promise](const QFuture &outerFuture) mutable { + // We use the .then([](QFuture outerFuture) {...}) version + // (where outerFuture == *outer), to propagate the exception if the + // outer future has failed. + Q_ASSERT(outerFuture.isFinished()); +#ifndef QT_NO_EXCEPTIONS + if (outerFuture.d.hasException()) { + promise.reportStarted(); + promise.reportException(outerFuture.d.exceptionStore().exception()); + promise.reportFinished(); + return; + } +#endif + + promise.reportStarted(); + ResultType nestedFuture = outerFuture.result(); + + nestedFuture.then([promise] (const QFuture &nested) mutable { +#ifndef QT_NO_EXCEPTIONS + if (nested.d.hasException()) { + promise.reportException(nested.d.exceptionStore().exception()); + } else +#endif + { + if constexpr (!std::is_void_v) + promise.reportResults(nested.results()); + } + promise.reportFinished(); + }).onCanceled([promise] () mutable { + promise.reportCanceled(); + promise.reportFinished(); + }); + }).onCanceled([promise]() mutable { + // propagate the cancellation of the outer future + promise.reportStarted(); + promise.reportCanceled(); + promise.reportFinished(); + }); + return promise.future(); + } +}; + +template +QFuture makeReadyRangeFutureImpl(const QList &values) +{ + QFutureInterface promise; + promise.reportStarted(); + promise.reportResults(values); + promise.reportFinished(); + return promise.future(); +} + +} // namespace QtPrivate + +namespace QtFuture { + +template +using ArgsType = typename QtPrivate::ArgResolver::AllArgs; + +template> +static QFuture> connect(Sender *sender, Signal signal) +{ + using ArgsType = ArgsType; + QFutureInterface promise; + promise.reportStarted(); + if (!sender) { + promise.reportCanceled(); + promise.reportFinished(); + return promise.future(); + } + + using Connections = std::pair; + auto connections = std::make_shared(); + + if constexpr (std::is_void_v) { + connections->first = + QObject::connect(sender, signal, sender, [promise, connections]() mutable { + QObject::disconnect(connections->first); + QObject::disconnect(connections->second); + promise.reportFinished(); + }); + } else if constexpr (QtPrivate::ArgResolver::HasExtraArgs) { + connections->first = QObject::connect(sender, signal, sender, + [promise, connections](auto... values) mutable { + QObject::disconnect(connections->first); + QObject::disconnect(connections->second); + promise.reportResult(QtPrivate::createTuple( + std::move(values)...)); + promise.reportFinished(); + }); + } else { + connections->first = QObject::connect(sender, signal, sender, + [promise, connections](ArgsType value) mutable { + QObject::disconnect(connections->first); + QObject::disconnect(connections->second); + promise.reportResult(value); + promise.reportFinished(); + }); + } + + if (!connections->first) { + promise.reportCanceled(); + promise.reportFinished(); + return promise.future(); + } + + connections->second = + QObject::connect(sender, &QObject::destroyed, sender, [promise, connections]() mutable { + QObject::disconnect(connections->first); + QObject::disconnect(connections->second); + promise.reportCanceled(); + promise.reportFinished(); + }); + + return promise.future(); +} + +template +using if_container_with_input_iterators = + std::enable_if_t::value, bool>; + +template +using ContainedType = + typename std::iterator_traits()))>::value_type; + +template = true> +static QFuture> makeReadyRangeFuture(Container &&container) +{ + // handle QList separately, because reportResults() takes a QList + // as an input + using ValueType = ContainedType; + if constexpr (std::is_convertible_v, QList>) { + return QtPrivate::makeReadyRangeFutureImpl(container); + } else { + return QtPrivate::makeReadyRangeFutureImpl(QList{std::cbegin(container), + std::cend(container)}); + } +} + +template +static QFuture makeReadyRangeFuture(std::initializer_list values) +{ + return QtPrivate::makeReadyRangeFutureImpl(QList{values}); +} + +template +static QFuture> makeReadyValueFuture(T &&value) +{ + QFutureInterface> promise; + promise.reportStarted(); + promise.reportResult(std::forward(value)); + promise.reportFinished(); + + return promise.future(); +} + +Q_CORE_EXPORT QFuture makeReadyVoidFuture(); // implemented in qfutureinterface.cpp + +#if QT_DEPRECATED_SINCE(6, 10) +template> +QT_DEPRECATED_VERSION_X(6, 10, "Use makeReadyValueFuture() instead.") +static QFuture> makeReadyFuture(T &&value) +{ + return makeReadyValueFuture(std::forward(value)); +} + +// the void specialization is moved to the end of qfuture.h, because it now +// uses makeReadyVoidFuture() and required QFuture to be defined. + +template +QT_DEPRECATED_VERSION_X(6, 10, "Use makeReadyRangeFuture() instead.") +static QFuture makeReadyFuture(const QList &values) +{ + return makeReadyRangeFuture(values); +} +#endif // QT_DEPRECATED_SINCE(6, 10) + +#ifndef QT_NO_EXCEPTIONS + +template +static QFuture makeExceptionalFuture(std::exception_ptr exception) +{ + QFutureInterface promise; + promise.reportStarted(); + promise.reportException(exception); + promise.reportFinished(); + + return promise.future(); +} + +template +static QFuture makeExceptionalFuture(const QException &exception) +{ + try { + exception.raise(); + } catch (...) { + return makeExceptionalFuture(std::current_exception()); + } + Q_UNREACHABLE(); +} + +#endif // QT_NO_EXCEPTIONS + +} // namespace QtFuture + +namespace QtPrivate { + +template +struct WhenAllContext +{ + using ValueType = typename ResultFutures::value_type; + + explicit WhenAllContext(qsizetype size) : remaining(size) {} + + template + void checkForCompletion(qsizetype index, T &&future) + { + futures[index] = std::forward(future); + const auto oldRemaining = remaining.fetchAndSubRelaxed(1); + Q_ASSERT(oldRemaining > 0); + if (oldRemaining <= 1) { // that was the last one + promise.addResult(futures); + promise.finish(); + } + } + + QAtomicInteger remaining; + QPromise promise; + ResultFutures futures; +}; + +template +struct WhenAnyContext +{ + using ValueType = ResultType; + + template> + void checkForCompletion(qsizetype, T &&result) + { + if (!ready.fetchAndStoreRelaxed(true)) { + promise.addResult(std::forward(result)); + promise.finish(); + } + } + + QAtomicInt ready = false; + QPromise promise; +}; + +template +void addCompletionHandlersImpl(const std::shared_ptr &context, + const std::tuple &t) +{ + auto future = std::get(t); + using ResultType = typename ContextType::ValueType; + // Need context=context so that the compiler does not infer the captured variable's type as 'const' + future.then([context=context](const std::tuple_element_t> &f) { + context->checkForCompletion(Index, ResultType { std::in_place_index, f }); + }).onCanceled([context=context, future]() { + context->checkForCompletion(Index, ResultType { std::in_place_index, future }); + }); + + if constexpr (Index != 0) + addCompletionHandlersImpl(context, t); +} + +template +void addCompletionHandlers(const std::shared_ptr &context, const std::tuple &t) +{ + constexpr qsizetype size = std::tuple_size>::value; + addCompletionHandlersImpl(context, t); +} + +template +QFuture whenAllImpl(InputIt first, InputIt last) +{ + const qsizetype size = std::distance(first, last); + if (size == 0) + return QtFuture::makeReadyValueFuture(OutputSequence()); + + const auto context = std::make_shared>(size); + context->futures.resize(size); + context->promise.start(); + + qsizetype idx = 0; + for (auto it = first; it != last; ++it, ++idx) { + // Need context=context so that the compiler does not infer the captured variable's type as 'const' + it->then([context=context, idx](const ValueType &f) { + context->checkForCompletion(idx, f); + }).onCanceled([context=context, idx, f = *it] { + context->checkForCompletion(idx, f); + }); + } + return context->promise.future(); +} + +template +QFuture whenAllImpl(Futures &&... futures) +{ + constexpr qsizetype size = sizeof...(Futures); + const auto context = std::make_shared>(size); + context->futures.resize(size); + context->promise.start(); + + QtPrivate::addCompletionHandlers(context, std::make_tuple(std::forward(futures)...)); + + return context->promise.future(); +} + +template +QFuture::type>> whenAnyImpl(InputIt first, + InputIt last) +{ + using PackagedType = typename Future::type; + using ResultType = QtFuture::WhenAnyResult; + + const qsizetype size = std::distance(first, last); + if (size == 0) { + return QtFuture::makeReadyValueFuture( + QtFuture::WhenAnyResult { qsizetype(-1), QFuture() }); + } + + const auto context = std::make_shared>(); + context->promise.start(); + + qsizetype idx = 0; + for (auto it = first; it != last; ++it, ++idx) { + // Need context=context so that the compiler does not infer the captured variable's type as 'const' + it->then([context=context, idx](const ValueType &f) { + context->checkForCompletion(idx, QtFuture::WhenAnyResult { idx, f }); + }).onCanceled([context=context, idx, f = *it] { + context->checkForCompletion(idx, QtFuture::WhenAnyResult { idx, f }); + }); + } + return context->promise.future(); +} + +template +QFuture...>> whenAnyImpl(Futures &&... futures) +{ + using ResultType = std::variant...>; + + const auto context = std::make_shared>(); + context->promise.start(); + + QtPrivate::addCompletionHandlers(context, std::make_tuple(std::forward(futures)...)); + + return context->promise.future(); +} + +} // namespace QtPrivate + +QT_END_NAMESPACE diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qfutureinterface.h b/qt/6.8.1/msvc2022_64/include/QtCore/qfutureinterface.h new file mode 100644 index 0000000000000000000000000000000000000000..72fbbf52dec7fa96174b7d7f7dff6975eae229b8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qfutureinterface.h @@ -0,0 +1,511 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QFUTUREINTERFACE_H +#define QFUTUREINTERFACE_H + +#include +#include +#ifndef QT_NO_EXCEPTIONS +#include +#endif + +#include + +QT_REQUIRE_CONFIG(future); + +QT_FORWARD_DECLARE_CLASS(QRunnable) +QT_FORWARD_DECLARE_CLASS(QException) +QT_BEGIN_NAMESPACE + + +template class QFuture; +class QThreadPool; +class QFutureInterfaceBase; +class QFutureInterfaceBasePrivate; +class QFutureWatcherBase; +class QFutureWatcherBasePrivate; + +namespace QtPrivate { +template +class Continuation; + +class ExceptionStore; + +template +class CanceledHandler; + +#ifndef QT_NO_EXCEPTIONS +template +class FailureHandler; +#endif + +void Q_CORE_EXPORT watchContinuationImpl(const QObject *context, + QtPrivate::QSlotObjectBase *slotObj, + QFutureInterfaceBase &fi); +} + +class Q_CORE_EXPORT QFutureInterfaceBase +{ +public: + enum State { + NoState = 0x00, + Running = 0x01, + Started = 0x02, + Finished = 0x04, + Canceled = 0x08, + Suspending = 0x10, + Suspended = 0x20, + Throttled = 0x40, + // Pending means that the future depends on another one, which is not finished yet + Pending = 0x80, + }; + + QFutureInterfaceBase(State initialState = NoState); + QFutureInterfaceBase(const QFutureInterfaceBase &other); + QFutureInterfaceBase(QFutureInterfaceBase &&other) noexcept + : d(std::exchange(other.d, nullptr)) {} + QFutureInterfaceBase &operator=(const QFutureInterfaceBase &other); + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QFutureInterfaceBase) + virtual ~QFutureInterfaceBase(); + + // reporting functions available to the engine author: + void reportStarted(); + void reportFinished(); + void reportCanceled(); +#ifndef QT_NO_EXCEPTIONS + void reportException(const QException &e); +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) + void reportException(std::exception_ptr e); +#else + void reportException(const std::exception_ptr &e); +#endif +#endif + void reportResultsReady(int beginIndex, int endIndex); + + void setRunnable(QRunnable *runnable); + void setThreadPool(QThreadPool *pool); + QThreadPool *threadPool() const; + void setFilterMode(bool enable); + void setProgressRange(int minimum, int maximum); + int progressMinimum() const; + int progressMaximum() const; + bool isProgressUpdateNeeded() const; + void setProgressValue(int progressValue); + int progressValue() const; + void setProgressValueAndText(int progressValue, const QString &progressText); + QString progressText() const; + + void setExpectedResultCount(int resultCount); + int expectedResultCount(); + int resultCount() const; + + bool queryState(State state) const; + bool isRunning() const; + bool isStarted() const; + bool isCanceled() const; + bool isFinished() const; +#if QT_DEPRECATED_SINCE(6, 0) + QT_DEPRECATED_VERSION_X_6_0("Use isSuspending() or isSuspended() instead.") + bool isPaused() const; + + QT_DEPRECATED_VERSION_X_6_0("Use setSuspended() instead.") + void setPaused(bool paused) { setSuspended(paused); } + + QT_DEPRECATED_VERSION_X_6_0("Use toggleSuspended() instead.") + void togglePaused() { toggleSuspended(); } +#endif + bool isSuspending() const; + bool isSuspended() const; + bool isThrottled() const; + bool isResultReadyAt(int index) const; + bool isValid() const; + int loadState() const; + + void cancel(); + void cancelAndFinish() { cancel(CancelMode::CancelAndFinish); } + + void setSuspended(bool suspend); + void toggleSuspended(); + void reportSuspended() const; + void setThrottled(bool enable); + + void waitForFinished(); + bool waitForNextResult(); + void waitForResult(int resultIndex); + void waitForResume(); + void suspendIfRequested(); + + QMutex &mutex() const; + bool hasException() const; + QtPrivate::ExceptionStore &exceptionStore(); + QtPrivate::ResultStoreBase &resultStoreBase(); + const QtPrivate::ResultStoreBase &resultStoreBase() const; + + inline bool operator==(const QFutureInterfaceBase &other) const { return d == other.d; } + inline bool operator!=(const QFutureInterfaceBase &other) const { return d != other.d; } + + // ### Qt 7: inline + void swap(QFutureInterfaceBase &other) noexcept; + + template + static QFutureInterfaceBase get(const QFuture &future); // implemented in qfuture.h + + bool isChainCanceled() const; + +protected: + // ### Qt 7: remove const from refT/derefT + bool refT() const noexcept; + bool derefT() const noexcept; + void reset(); + void rethrowPossibleException(); +public: + +#ifndef QFUTURE_TEST +private: +#endif + QFutureInterfaceBasePrivate *d; + +private: + friend class QFutureWatcherBase; + friend class QFutureWatcherBasePrivate; + + template + friend class QtPrivate::Continuation; + + template + friend class QtPrivate::CanceledHandler; + +#ifndef QT_NO_EXCEPTIONS + template + friend class QtPrivate::FailureHandler; +#endif + + friend Q_CORE_EXPORT void QtPrivate::watchContinuationImpl( + const QObject *context, QtPrivate::QSlotObjectBase *slotObj, QFutureInterfaceBase &fi); + + template + friend class QPromise; + +protected: + void setContinuation(std::function func); + void setContinuation(std::function func, + QFutureInterfaceBasePrivate *continuationFutureData); + void cleanContinuation(); + void runContinuation() const; + + void setLaunchAsync(bool value); + bool launchAsync() const; + + bool isRunningOrPending() const; + + enum class CancelMode { CancelOnly, CancelAndFinish }; + void cancel(CancelMode mode); +}; + +inline void swap(QFutureInterfaceBase &lhs, QFutureInterfaceBase &rhs) noexcept +{ + lhs.swap(rhs); +} + +template +class QFutureInterface : public QFutureInterfaceBase +{ +public: + QFutureInterface(State initialState = NoState) + : QFutureInterfaceBase(initialState) + { + refT(); + } + QFutureInterface(const QFutureInterface &other) + : QFutureInterfaceBase(other) + { + refT(); + } + QFutureInterface(const QFutureInterfaceBase &dd) : QFutureInterfaceBase(dd) { refT(); } + QFutureInterface(QFutureInterfaceBase &&dd) noexcept : QFutureInterfaceBase(std::move(dd)) { refT(); } + QFutureInterface &operator=(const QFutureInterface &other) + { + QFutureInterface copy(other); + swap(copy); + return *this; + } + QFutureInterface(QFutureInterface &&other) = default; + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QFutureInterface) + + ~QFutureInterface() + { + if (!derefT() && !hasException()) + resultStoreBase().template clear(); + } + + static QFutureInterface canceledResult() + { return QFutureInterface(State(Started | Finished | Canceled)); } + + inline QFuture future(); // implemented in qfuture.h + + template , bool> = true> + inline bool reportAndEmplaceResult(int index, Args&&...args); + inline bool reportResult(const T *result, int index = -1); + inline bool reportAndMoveResult(T &&result, int index = -1); + inline bool reportResult(T &&result, int index = -1); + inline bool reportResult(const T &result, int index = -1); + inline bool reportResults(const QList &results, int beginIndex = -1, int count = -1); + inline bool reportFinished(const T *result); + void reportFinished() + { + QFutureInterfaceBase::reportFinished(); + QFutureInterfaceBase::runContinuation(); + } + + inline const T &resultReference(int index) const; + inline const T *resultPointer(int index) const; + inline QList results(); + + T takeResult(); +#if 0 + // TODO: Enable and make it return a QList, when QList is fixed to support move-only types + std::vector takeResults(); +#endif + +#ifndef QT_NO_EXCEPTIONS + void reportException(const std::exception_ptr &e) + { + if (hasException()) + return; + + resultStoreBase().template clear(); + QFutureInterfaceBase::reportException(e); + } + void reportException(const QException &e) + { + if (hasException()) + return; + + resultStoreBase().template clear(); + QFutureInterfaceBase::reportException(e); + } +#endif +}; + +template +inline bool QFutureInterface::reportResult(const T *result, int index) +{ + QMutexLocker locker{&mutex()}; + if (this->queryState(Canceled) || this->queryState(Finished)) + return false; + + Q_ASSERT(!hasException()); + QtPrivate::ResultStoreBase &store = resultStoreBase(); + + const int resultCountBefore = store.count(); + const int insertIndex = store.addResult(index, result); + if (insertIndex == -1) + return false; + if (store.filterMode()) { + this->reportResultsReady(resultCountBefore, store.count()); + } else { + this->reportResultsReady(insertIndex, insertIndex + 1); + } + return true; +} + +template +template, bool>> +bool QFutureInterface::reportAndEmplaceResult(int index, Args&&...args) +{ + QMutexLocker locker{&mutex()}; + if (queryState(Canceled) || queryState(Finished)) + return false; + + Q_ASSERT(!hasException()); + QtPrivate::ResultStoreBase &store = resultStoreBase(); + + const int oldResultCount = store.count(); + const int insertIndex = store.emplaceResult(index, std::forward(args)...); + // Let's make sure it's not in pending results. + if (insertIndex != -1 && (!store.filterMode() || oldResultCount < store.count())) + reportResultsReady(insertIndex, store.count()); + return insertIndex != -1; +} + +template +bool QFutureInterface::reportAndMoveResult(T &&result, int index) +{ + return reportAndEmplaceResult(index, std::move(result)); +} + +template +bool QFutureInterface::reportResult(T &&result, int index) +{ + return reportAndMoveResult(std::move(result), index); +} + +template +inline bool QFutureInterface::reportResult(const T &result, int index) +{ + return reportResult(&result, index); +} + +template +inline bool QFutureInterface::reportResults(const QList &_results, int beginIndex, int count) +{ + QMutexLocker locker{&mutex()}; + if (this->queryState(Canceled) || this->queryState(Finished)) + return false; + + Q_ASSERT(!hasException()); + auto &store = resultStoreBase(); + + const int resultCountBefore = store.count(); + const int insertIndex = store.addResults(beginIndex, &_results, count); + if (insertIndex == -1) + return false; + if (store.filterMode()) { + this->reportResultsReady(resultCountBefore, store.count()); + } else { + this->reportResultsReady(insertIndex, insertIndex + _results.size()); + } + return true; +} + +template +inline bool QFutureInterface::reportFinished(const T *result) +{ + bool resultReported = false; + if (result) + resultReported = reportResult(result); + reportFinished(); + return resultReported; +} + +template +inline const T &QFutureInterface::resultReference(int index) const +{ + Q_ASSERT(!hasException()); + + QMutexLocker locker{&mutex()}; + return resultStoreBase().resultAt(index).template value(); +} + +template +inline const T *QFutureInterface::resultPointer(int index) const +{ + Q_ASSERT(!hasException()); + + QMutexLocker locker{&mutex()}; + return resultStoreBase().resultAt(index).template pointer(); +} + +template +inline QList QFutureInterface::results() +{ + if (this->isCanceled()) { + rethrowPossibleException(); + return QList(); + } + + QFutureInterfaceBase::waitForResult(-1); + + QList res; + QMutexLocker locker{&mutex()}; + + QtPrivate::ResultIteratorBase it = resultStoreBase().begin(); + while (it != resultStoreBase().end()) { + res.append(it.value()); + ++it; + } + + return res; +} + +template +T QFutureInterface::takeResult() +{ + Q_ASSERT(isValid()); + + // Note: we wait for all, this is intentional, + // not to mess with other unready results. + waitForResult(-1); + + Q_ASSERT(!hasException()); + + const QMutexLocker locker{&mutex()}; + QtPrivate::ResultIteratorBase position = resultStoreBase().resultAt(0); + T ret(std::move_if_noexcept(position.value())); + reset(); + resultStoreBase().template clear(); + + return ret; +} + +#if 0 +template +std::vector QFutureInterface::takeResults() +{ + Q_ASSERT(isValid()); + + waitForResult(-1); + + Q_ASSERT(!hasException()); + + std::vector res; + res.reserve(resultCount()); + + const QMutexLocker locker{&mutex()}; + + QtPrivate::ResultIteratorBase it = resultStoreBase().begin(); + for (auto endIt = resultStoreBase().end(); it != endIt; ++it) + res.push_back(std::move_if_noexcept(it.value())); + + reset(); + resultStoreBase().template clear(); + + return res; +} +#endif + +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wweak-vtables") // QTBUG-125115 + +template <> +class QFutureInterface : public QFutureInterfaceBase +{ +public: + explicit QFutureInterface(State initialState = NoState) + : QFutureInterfaceBase(initialState) + { } + + QFutureInterface(const QFutureInterfaceBase &dd) : QFutureInterfaceBase(dd) { } + + static QFutureInterface canceledResult() + { return QFutureInterface(State(Started | Finished | Canceled)); } + + + inline QFuture future(); // implemented in qfuture.h + + bool reportResult(const void *, int) { return false; } + bool reportResults(const QList &, int) { return false; } + bool reportFinished(const void *) + { + reportFinished(); + return false; + } + void reportFinished() + { + QFutureInterfaceBase::reportFinished(); + QFutureInterfaceBase::runContinuation(); + } +}; + +QT_WARNING_POP // Clang -Wweak-vtables + +template +inline void swap(QFutureInterface &a, QFutureInterface &b) noexcept +{ + a.swap(b); +} + +QT_END_NAMESPACE + +#endif // QFUTUREINTERFACE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qfuturesynchronizer.h b/qt/6.8.1/msvc2022_64/include/QtCore/qfuturesynchronizer.h new file mode 100644 index 0000000000000000000000000000000000000000..1127c02ff7fd22d6e1328204f93915df1023984e --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qfuturesynchronizer.h @@ -0,0 +1,79 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QFUTURESYNCHRONIZER_H +#define QFUTURESYNCHRONIZER_H + +#include + +QT_REQUIRE_CONFIG(future); + +QT_BEGIN_NAMESPACE + + +template +class QFutureSynchronizer +{ + Q_DISABLE_COPY(QFutureSynchronizer) + +public: + Q_NODISCARD_CTOR QFutureSynchronizer() : m_cancelOnWait(false) { } + Q_NODISCARD_CTOR_X("Use future.waitForFinished() instead.") + explicit QFutureSynchronizer(QFuture future) + : m_cancelOnWait(false) + { addFuture(std::move(future)); } + ~QFutureSynchronizer() { waitForFinished(); } + + void setFuture(QFuture future) + { + waitForFinished(); + m_futures.clear(); + addFuture(std::move(future)); + } + + void addFuture(QFuture future) + { + m_futures.append(std::move(future)); + } + + void waitForFinished() + { + if (m_cancelOnWait) { + for (int i = 0; i < m_futures.size(); ++i) { + m_futures[i].cancel(); + } + } + + for (int i = 0; i < m_futures.size(); ++i) { + m_futures[i].waitForFinished(); + } + } + + void clearFutures() + { + m_futures.clear(); + } + + QList > futures() const + { + return m_futures; + } + + void setCancelOnWait(bool enabled) + { + m_cancelOnWait = enabled; + } + + bool cancelOnWait() const + { + return m_cancelOnWait; + } + +protected: + QList> m_futures; + bool m_cancelOnWait; +}; + +QT_END_NAMESPACE + +#endif // QFUTURESYNCHRONIZER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qfuturewatcher.h b/qt/6.8.1/msvc2022_64/include/QtCore/qfuturewatcher.h new file mode 100644 index 0000000000000000000000000000000000000000..f47179f982230a870ce5e3f3cbb74a02c4282ae9 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qfuturewatcher.h @@ -0,0 +1,187 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QFUTUREWATCHER_H +#define QFUTUREWATCHER_H + +#include +#include + +QT_REQUIRE_CONFIG(future); + +QT_BEGIN_NAMESPACE + + +class QEvent; + +class QFutureWatcherBasePrivate; +class Q_CORE_EXPORT QFutureWatcherBase : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QFutureWatcherBase) + +public: + explicit QFutureWatcherBase(QObject *parent = nullptr); + // de-inline dtor + + int progressValue() const; + int progressMinimum() const; + int progressMaximum() const; + QString progressText() const; + + bool isStarted() const; + bool isFinished() const; + bool isRunning() const; + bool isCanceled() const; +#if QT_DEPRECATED_SINCE(6, 0) + QT_DEPRECATED_VERSION_X_6_0("Use isSuspending() or isSuspended() instead.") + bool isPaused() const; +#endif + bool isSuspending() const; + bool isSuspended() const; + + void waitForFinished(); + + void setPendingResultsLimit(int limit); + + bool event(QEvent *event) override; + +Q_SIGNALS: + void started(); + void finished(); + void canceled(); +#if QT_DEPRECATED_SINCE(6, 0) + QT_DEPRECATED_VERSION_X_6_0("Use suspending() instead.") + void paused(); +#endif + void suspending(); + void suspended(); + void resumed(); + void resultReadyAt(int resultIndex); + void resultsReadyAt(int beginIndex, int endIndex); + void progressRangeChanged(int minimum, int maximum); + void progressValueChanged(int progressValue); + void progressTextChanged(const QString &progressText); + +public Q_SLOTS: + void cancel(); + void setSuspended(bool suspend); + void suspend(); + void resume(); + void toggleSuspended(); + +#if QT_DEPRECATED_SINCE(6, 0) + QT_DEPRECATED_VERSION_X_6_0("Use setSuspended() instead.") + void setPaused(bool paused); + + QT_DEPRECATED_VERSION_X_6_0("Use suspend() instead.") + void pause(); + + QT_DEPRECATED_VERSION_X_6_0("Use toggleSuspended() instead.") + void togglePaused(); +#endif + +protected: + void connectNotify (const QMetaMethod &signal) override; + void disconnectNotify (const QMetaMethod &signal) override; + + // called from setFuture() implemented in template sub-classes + void connectOutputInterface(); + void disconnectOutputInterface(bool pendingAssignment = false); + +private: + // implemented in the template sub-classes + virtual const QFutureInterfaceBase &futureInterface() const = 0; + virtual QFutureInterfaceBase &futureInterface() = 0; +}; + +template +class QFutureWatcher : public QFutureWatcherBase +{ +public: + explicit QFutureWatcher(QObject *_parent = nullptr) + : QFutureWatcherBase(_parent) + { } + ~QFutureWatcher() + { disconnectOutputInterface(); } + + void setFuture(const QFuture &future); + QFuture future() const + { return m_future; } + + template> + T result() const { return m_future.result(); } + + template> + T resultAt(int index) const { return m_future.resultAt(index); } + +#ifdef Q_QDOC + int progressValue() const; + int progressMinimum() const; + int progressMaximum() const; + QString progressText() const; + + bool isStarted() const; + bool isFinished() const; + bool isRunning() const; + bool isCanceled() const; +#if QT_DEPRECATED_SINCE(6, 0) + bool isPaused() const; +#endif + bool isSuspending() const; + bool isSuspended() const; + + void waitForFinished(); + + void setPendingResultsLimit(int limit); + +Q_SIGNALS: + void started(); + void finished(); + void canceled(); +#if QT_DEPRECATED_SINCE(6, 0) + void paused(); +#endif + void suspending(); + void suspended(); + void resumed(); + void resultReadyAt(int resultIndex); + void resultsReadyAt(int beginIndex, int endIndex); + void progressRangeChanged(int minimum, int maximum); + void progressValueChanged(int progressValue); + void progressTextChanged(const QString &progressText); + +public Q_SLOTS: + void cancel(); + void setSuspended(bool suspend); + void suspend(); + void resume(); + void toggleSuspended(); +#if QT_DEPRECATED_SINCE(6, 0) + void setPaused(bool paused); + void pause(); + void togglePaused(); +#endif // QT_DEPRECATED_SINCE(6, 0) + +#endif // Q_QDOC + +private: + QFuture m_future; + const QFutureInterfaceBase &futureInterface() const override { return m_future.d; } + QFutureInterfaceBase &futureInterface() override { return m_future.d; } +}; + +template +Q_INLINE_TEMPLATE void QFutureWatcher::setFuture(const QFuture &_future) +{ + if (_future.d == m_future.d) + return; + + disconnectOutputInterface(true); + m_future = _future; + connectOutputInterface(); +} + +QT_END_NAMESPACE + +#endif // QFUTUREWATCHER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qgenericatomic.h b/qt/6.8.1/msvc2022_64/include/QtCore/qgenericatomic.h new file mode 100644 index 0000000000000000000000000000000000000000..c41d2505962d0cf686739ad577825ede5f97d7f5 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qgenericatomic.h @@ -0,0 +1,38 @@ +// Copyright (C) 2011 Thiago Macieira +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QGENERICATOMIC_H +#define QGENERICATOMIC_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#if 0 +// silence syncqt warnings +QT_END_NAMESPACE +#pragma qt_sync_skip_header_check +#pragma qt_sync_stop_processing +#endif + +template struct QAtomicOpsSupport +{ + enum { IsSupported = (Size == sizeof(int) || Size == sizeof(qptrdiff)) }; +}; + +template struct QAtomicAdditiveType +{ + typedef T AdditiveT; + static const int AddScale = 1; +}; +template struct QAtomicAdditiveType +{ + typedef qptrdiff AdditiveT; + static const int AddScale = sizeof(T); +}; + +QT_END_NAMESPACE +#endif // QGENERICATOMIC_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qglobal.h b/qt/6.8.1/msvc2022_64/include/QtCore/qglobal.h new file mode 100644 index 0000000000000000000000000000000000000000..0cf314c53fa53ff7324ad57f3b150e2ce3e50c46 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qglobal.h @@ -0,0 +1,75 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2019 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QGLOBAL_H +#define QGLOBAL_H + +#if 0 +#pragma qt_class(QtGlobal) +#endif + +#ifdef __cplusplus +# include +# include +# include +# include +#endif +#ifndef __ASSEMBLER__ +# include +# include +# include +#endif + +#include +#include +#include + +#include + +#include +#include +#include + +#ifndef __ASSEMBLER__ +# include +# include +# include +#endif /* !__ASSEMBLER__ */ +#include + +#if defined(__cplusplus) + +#include + +// We need to keep QTypeInfo, QSysInfo, QFlags, qDebug & family in qglobal.h for compatibility with Qt 4. +// Be careful when changing the order of these files. +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if QT_CONFIG(version_tagging) +#include +#endif +#endif /* __cplusplus */ + +#endif /* QGLOBAL_H */ diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qglobalstatic.h b/qt/6.8.1/msvc2022_64/include/QtCore/qglobalstatic.h new file mode 100644 index 0000000000000000000000000000000000000000..0d3c0bf4bc19d4946ab3e137a9ae2a96cb873e43 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qglobalstatic.h @@ -0,0 +1,128 @@ +// Copyright (C) 2021 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QGLOBALSTATIC_H +#define QGLOBALSTATIC_H + +#include +#include +#include + +#include // for bootstrapped (no thread) builds +#include + +QT_BEGIN_NAMESPACE + +namespace QtGlobalStatic { +enum GuardValues { + Destroyed = -2, + Initialized = -1, + Uninitialized = 0, + Initializing = 1 +}; + +template union Holder +{ + using Type = typename QGS::QGS_Type; + using PlainType = std::remove_cv_t; + + static constexpr bool ConstructionIsNoexcept = noexcept(QGS::innerFunction(nullptr)); + Q_CONSTINIT static inline QBasicAtomicInteger guard = { QtGlobalStatic::Uninitialized }; + + // union's sole member + PlainType storage; + + Holder() noexcept(ConstructionIsNoexcept) + { + QGS::innerFunction(pointer()); + guard.storeRelaxed(QtGlobalStatic::Initialized); + } + + ~Holder() + { + // TSAN does not support atomic_thread_fence and GCC complains: + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97868 + // https://github.com/google/sanitizers/issues/1352 +QT_WARNING_PUSH +#if defined(Q_CC_GNU_ONLY) && Q_CC_GNU >= 1100 +QT_WARNING_DISABLE_GCC("-Wtsan") +#endif + // import changes to *pointer() by other threads before running ~PlainType(): + std::atomic_thread_fence(std::memory_order_acquire); +QT_WARNING_POP + pointer()->~PlainType(); + guard.storeRelease(QtGlobalStatic::Destroyed); + } + + PlainType *pointer() noexcept + { + return &storage; + } + + Q_DISABLE_COPY_MOVE(Holder) +}; +} + +template struct QGlobalStatic +{ + using Type = typename Holder::Type; + + bool isDestroyed() const noexcept { return guardValue() <= QtGlobalStatic::Destroyed; } + bool exists() const noexcept { return guardValue() == QtGlobalStatic::Initialized; } + operator Type *() + { + if (isDestroyed()) + return nullptr; + return instance(); + } + Type *operator()() + { + if (isDestroyed()) + return nullptr; + return instance(); + } + Type *operator->() + { + Q_ASSERT_X(!isDestroyed(), Q_FUNC_INFO, + "The global static was used after being destroyed"); + return instance(); + } + Type &operator*() + { + Q_ASSERT_X(!isDestroyed(), Q_FUNC_INFO, + "The global static was used after being destroyed"); + return *instance(); + } + +protected: + static Type *instance() noexcept(Holder::ConstructionIsNoexcept) + { + static Holder holder; + return holder.pointer(); + } + static QtGlobalStatic::GuardValues guardValue() noexcept + { + return QtGlobalStatic::GuardValues(Holder::guard.loadAcquire()); + } +}; + +#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \ + QT_WARNING_PUSH \ + QT_WARNING_DISABLE_CLANG("-Wunevaluated-expression") \ + namespace { struct Q_QGS_ ## NAME { \ + typedef TYPE QGS_Type; \ + static void innerFunction(void *pointer) \ + noexcept(noexcept(std::remove_cv_t ARGS)) \ + { \ + new (pointer) QGS_Type ARGS; \ + } \ + }; } \ + Q_CONSTINIT static QGlobalStatic> NAME; \ + QT_WARNING_POP + /**/ + +#define Q_GLOBAL_STATIC(TYPE, NAME, ...) \ + Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, (__VA_ARGS__)) + +QT_END_NAMESPACE +#endif // QGLOBALSTATIC_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qhash.h b/qt/6.8.1/msvc2022_64/include/QtCore/qhash.h new file mode 100644 index 0000000000000000000000000000000000000000..83424a6e877dd85c332e364f0c1634c66623cf69 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qhash.h @@ -0,0 +1,2558 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QHASH_H +#define QHASH_H + +#include +#include +#include +#include +#include +#include +#include + +#include +#include // for std::hash + +class tst_QHash; // for befriending + +QT_BEGIN_NAMESPACE + +struct QHashDummyValue +{ + bool operator==(const QHashDummyValue &) const noexcept { return true; } +}; + +namespace QHashPrivate { + +template +constexpr inline bool HasQHashOverload = false; + +template +constexpr inline bool HasQHashOverload(), std::declval())), size_t> +>> = true; + +template +constexpr inline bool HasStdHashSpecializationWithSeed = false; + +template +constexpr inline bool HasStdHashSpecializationWithSeed()(std::declval(), std::declval())), size_t> +>> = true; + +template +constexpr inline bool HasStdHashSpecializationWithoutSeed = false; + +template +constexpr inline bool HasStdHashSpecializationWithoutSeed()(std::declval())), size_t> +>> = true; + +template +size_t calculateHash(const T &t, size_t seed = 0) +{ + if constexpr (HasQHashOverload) { + return qHash(t, seed); + } else if constexpr (HasStdHashSpecializationWithSeed) { + return std::hash()(t, seed); + } else if constexpr (HasStdHashSpecializationWithoutSeed) { + Q_UNUSED(seed); + return std::hash()(t); + } else { + static_assert(sizeof(T) == 0, "The key type must have a qHash overload or a std::hash specialization"); + return 0; + } +} + +template +struct Node +{ + using KeyType = Key; + using ValueType = T; + + Key key; + T value; + template + static void createInPlace(Node *n, Key &&k, Args &&... args) + { new (n) Node{ std::move(k), T(std::forward(args)...) }; } + template + static void createInPlace(Node *n, const Key &k, Args &&... args) + { new (n) Node{ Key(k), T(std::forward(args)...) }; } + template + void emplaceValue(Args &&... args) + { + value = T(std::forward(args)...); + } + T &&takeValue() noexcept(std::is_nothrow_move_assignable_v) + { + return std::move(value); + } + bool valuesEqual(const Node *other) const { return value == other->value; } +}; + +template +struct Node { + using KeyType = Key; + using ValueType = QHashDummyValue; + + Key key; + template + static void createInPlace(Node *n, Key &&k, Args &&...) + { new (n) Node{ std::move(k) }; } + template + static void createInPlace(Node *n, const Key &k, Args &&...) + { new (n) Node{ k }; } + template + void emplaceValue(Args &&...) + { + } + ValueType takeValue() { return QHashDummyValue(); } + bool valuesEqual(const Node *) const { return true; } +}; + +template +struct MultiNodeChain +{ + T value; + MultiNodeChain *next = nullptr; + ~MultiNodeChain() + { + } + qsizetype free() noexcept(std::is_nothrow_destructible_v) + { + qsizetype nEntries = 0; + MultiNodeChain *e = this; + while (e) { + MultiNodeChain *n = e->next; + ++nEntries; + delete e; + e = n; + } + return nEntries; + } + bool contains(const T &val) const noexcept + { + const MultiNodeChain *e = this; + while (e) { + if (e->value == val) + return true; + e = e->next; + } + return false; + } +}; + +template +struct MultiNode +{ + using KeyType = Key; + using ValueType = T; + using Chain = MultiNodeChain; + + Key key; + Chain *value; + + template + static void createInPlace(MultiNode *n, Key &&k, Args &&... args) + { new (n) MultiNode(std::move(k), new Chain{ T(std::forward(args)...), nullptr }); } + template + static void createInPlace(MultiNode *n, const Key &k, Args &&... args) + { new (n) MultiNode(k, new Chain{ T(std::forward(args)...), nullptr }); } + + MultiNode(const Key &k, Chain *c) + : key(k), + value(c) + {} + MultiNode(Key &&k, Chain *c) noexcept(std::is_nothrow_move_assignable_v) + : key(std::move(k)), + value(c) + {} + + MultiNode(MultiNode &&other) + : key(other.key), + value(std::exchange(other.value, nullptr)) + { + } + + MultiNode(const MultiNode &other) + : key(other.key) + { + Chain *c = other.value; + Chain **e = &value; + while (c) { + Chain *chain = new Chain{ c->value, nullptr }; + *e = chain; + e = &chain->next; + c = c->next; + } + } + ~MultiNode() + { + if (value) + value->free(); + } + static qsizetype freeChain(MultiNode *n) noexcept(std::is_nothrow_destructible_v) + { + qsizetype size = n->value->free(); + n->value = nullptr; + return size; + } + template + void insertMulti(Args &&... args) + { + Chain *e = new Chain{ T(std::forward(args)...), nullptr }; + e->next = std::exchange(value, e); + } + template + void emplaceValue(Args &&... args) + { + value->value = T(std::forward(args)...); + } +}; + +template +constexpr bool isRelocatable() +{ + return QTypeInfo::isRelocatable && QTypeInfo::isRelocatable; +} + +struct SpanConstants { + static constexpr size_t SpanShift = 7; + static constexpr size_t NEntries = (1 << SpanShift); + static constexpr size_t LocalBucketMask = (NEntries - 1); + static constexpr size_t UnusedEntry = 0xff; + + static_assert ((NEntries & LocalBucketMask) == 0, "NEntries must be a power of two."); +}; + +// Regular hash tables consist of a list of buckets that can store Nodes. But simply allocating one large array of buckets +// would waste a lot of memory. To avoid this, we split the vector of buckets up into a vector of Spans. Each Span represents +// NEntries buckets. To quickly find the correct Span that holds a bucket, NEntries must be a power of two. +// +// Inside each Span, there is an offset array that represents the actual buckets. offsets contains either an index into the +// actual storage space for the Nodes (the 'entries' member) or 0xff (UnusedEntry) to flag that the bucket is empty. +// As we have only 128 entries per Span, the offset array can be represented using an unsigned char. This trick makes the hash +// table have a very small memory overhead compared to many other implementations. +template +struct Span { + // Entry is a slot available for storing a Node. The Span holds a pointer to + // an array of Entries. Upon construction of the array, those entries are + // unused, and nextFree() is being used to set up a singly linked list + // of free entries. + // When a node gets inserted, the first free entry is being picked, removed + // from the singly linked list and the Node gets constructed in place. + struct Entry { + struct { alignas(Node) unsigned char data[sizeof(Node)]; } storage; + + unsigned char &nextFree() { return *reinterpret_cast(&storage); } + Node &node() { return *reinterpret_cast(&storage); } + }; + + unsigned char offsets[SpanConstants::NEntries]; + Entry *entries = nullptr; + unsigned char allocated = 0; + unsigned char nextFree = 0; + Span() noexcept + { + memset(offsets, SpanConstants::UnusedEntry, sizeof(offsets)); + } + ~Span() + { + freeData(); + } + void freeData() noexcept(std::is_nothrow_destructible::value) + { + if (entries) { + if constexpr (!std::is_trivially_destructible::value) { + for (auto o : offsets) { + if (o != SpanConstants::UnusedEntry) + entries[o].node().~Node(); + } + } + delete[] entries; + entries = nullptr; + } + } + Node *insert(size_t i) + { + Q_ASSERT(i < SpanConstants::NEntries); + Q_ASSERT(offsets[i] == SpanConstants::UnusedEntry); + if (nextFree == allocated) + addStorage(); + unsigned char entry = nextFree; + Q_ASSERT(entry < allocated); + nextFree = entries[entry].nextFree(); + offsets[i] = entry; + return &entries[entry].node(); + } + void erase(size_t bucket) noexcept(std::is_nothrow_destructible::value) + { + Q_ASSERT(bucket < SpanConstants::NEntries); + Q_ASSERT(offsets[bucket] != SpanConstants::UnusedEntry); + + unsigned char entry = offsets[bucket]; + offsets[bucket] = SpanConstants::UnusedEntry; + + entries[entry].node().~Node(); + entries[entry].nextFree() = nextFree; + nextFree = entry; + } + size_t offset(size_t i) const noexcept + { + return offsets[i]; + } + bool hasNode(size_t i) const noexcept + { + return (offsets[i] != SpanConstants::UnusedEntry); + } + Node &at(size_t i) noexcept + { + Q_ASSERT(i < SpanConstants::NEntries); + Q_ASSERT(offsets[i] != SpanConstants::UnusedEntry); + + return entries[offsets[i]].node(); + } + const Node &at(size_t i) const noexcept + { + Q_ASSERT(i < SpanConstants::NEntries); + Q_ASSERT(offsets[i] != SpanConstants::UnusedEntry); + + return entries[offsets[i]].node(); + } + Node &atOffset(size_t o) noexcept + { + Q_ASSERT(o < allocated); + + return entries[o].node(); + } + const Node &atOffset(size_t o) const noexcept + { + Q_ASSERT(o < allocated); + + return entries[o].node(); + } + void moveLocal(size_t from, size_t to) noexcept + { + Q_ASSERT(offsets[from] != SpanConstants::UnusedEntry); + Q_ASSERT(offsets[to] == SpanConstants::UnusedEntry); + offsets[to] = offsets[from]; + offsets[from] = SpanConstants::UnusedEntry; + } + void moveFromSpan(Span &fromSpan, size_t fromIndex, size_t to) noexcept(std::is_nothrow_move_constructible_v) + { + Q_ASSERT(to < SpanConstants::NEntries); + Q_ASSERT(offsets[to] == SpanConstants::UnusedEntry); + Q_ASSERT(fromIndex < SpanConstants::NEntries); + Q_ASSERT(fromSpan.offsets[fromIndex] != SpanConstants::UnusedEntry); + if (nextFree == allocated) + addStorage(); + Q_ASSERT(nextFree < allocated); + offsets[to] = nextFree; + Entry &toEntry = entries[nextFree]; + nextFree = toEntry.nextFree(); + + size_t fromOffset = fromSpan.offsets[fromIndex]; + fromSpan.offsets[fromIndex] = SpanConstants::UnusedEntry; + Entry &fromEntry = fromSpan.entries[fromOffset]; + + if constexpr (isRelocatable()) { + memcpy(&toEntry, &fromEntry, sizeof(Entry)); + } else { + new (&toEntry.node()) Node(std::move(fromEntry.node())); + fromEntry.node().~Node(); + } + fromEntry.nextFree() = fromSpan.nextFree; + fromSpan.nextFree = static_cast(fromOffset); + } + + void addStorage() + { + Q_ASSERT(allocated < SpanConstants::NEntries); + Q_ASSERT(nextFree == allocated); + // the hash table should always be between 25 and 50% full + // this implies that we on average have between 32 and 64 entries + // in here. More exactly, we have a binominal distribution of the amount of + // occupied entries. + // For a 25% filled table, the average is 32 entries, with a 95% chance that we have between + // 23 and 41 entries. + // For a 50% filled table, the average is 64 entries, with a 95% chance that we have between + // 53 and 75 entries. + // Since we only resize the table once it's 50% filled and we want to avoid copies of + // data where possible, we initially allocate 48 entries, then resize to 80 entries, after that + // resize by increments of 16. That way, we usually only get one resize of the table + // while filling it. + size_t alloc; + static_assert(SpanConstants::NEntries % 8 == 0); + if (!allocated) + alloc = SpanConstants::NEntries / 8 * 3; + else if (allocated == SpanConstants::NEntries / 8 * 3) + alloc = SpanConstants::NEntries / 8 * 5; + else + alloc = allocated + SpanConstants::NEntries/8; + Entry *newEntries = new Entry[alloc]; + // we only add storage if the previous storage was fully filled, so + // simply copy the old data over + if constexpr (isRelocatable()) { + if (allocated) + memcpy(newEntries, entries, allocated * sizeof(Entry)); + } else { + for (size_t i = 0; i < allocated; ++i) { + new (&newEntries[i].node()) Node(std::move(entries[i].node())); + entries[i].node().~Node(); + } + } + for (size_t i = allocated; i < alloc; ++i) { + newEntries[i].nextFree() = uchar(i + 1); + } + delete[] entries; + entries = newEntries; + allocated = uchar(alloc); + } +}; + +// QHash uses a power of two growth policy. +namespace GrowthPolicy { +inline constexpr size_t bucketsForCapacity(size_t requestedCapacity) noexcept +{ + constexpr int SizeDigits = std::numeric_limits::digits; + + // We want to use at minimum a full span (128 entries), so we hardcode it for any requested + // capacity <= 64. Any capacity above that gets rounded to a later power of two. + if (requestedCapacity <= 64) + return SpanConstants::NEntries; + + // Same as + // qNextPowerOfTwo(2 * requestedCapacity); + // + // but ensuring neither our multiplication nor the function overflow. + // Additionally, the maximum memory allocation is 2^31-1 or 2^63-1 bytes + // (limited by qsizetype and ptrdiff_t). + int count = qCountLeadingZeroBits(requestedCapacity); + if (count < 2) + return (std::numeric_limits::max)(); // will cause std::bad_alloc + return size_t(1) << (SizeDigits - count + 1); +} +inline constexpr size_t bucketForHash(size_t nBuckets, size_t hash) noexcept +{ + return hash & (nBuckets - 1); +} +} // namespace GrowthPolicy + +template +struct iterator; + +template +struct Data +{ + using Key = typename Node::KeyType; + using T = typename Node::ValueType; + using Span = QHashPrivate::Span; + using iterator = QHashPrivate::iterator; + + QtPrivate::RefCount ref = {{1}}; + size_t size = 0; + size_t numBuckets = 0; + size_t seed = 0; + Span *spans = nullptr; + + static constexpr size_t maxNumBuckets() noexcept + { + return (std::numeric_limits::max)() / sizeof(Span); + } + + struct Bucket { + Span *span; + size_t index; + + Bucket(Span *s, size_t i) noexcept + : span(s), index(i) + {} + Bucket(const Data *d, size_t bucket) noexcept + : span(d->spans + (bucket >> SpanConstants::SpanShift)), + index(bucket & SpanConstants::LocalBucketMask) + {} + Bucket(iterator it) noexcept + : Bucket(it.d, it.bucket) + {} + + size_t toBucketIndex(const Data *d) const noexcept + { + return ((span - d->spans) << SpanConstants::SpanShift) | index; + } + iterator toIterator(const Data *d) const noexcept { return iterator{d, toBucketIndex(d)}; } + void advanceWrapped(const Data *d) noexcept + { + advance_impl(d, d->spans); + } + void advance(const Data *d) noexcept + { + advance_impl(d, nullptr); + } + bool isUnused() const noexcept + { + return !span->hasNode(index); + } + size_t offset() const noexcept + { + return span->offset(index); + } + Node &nodeAtOffset(size_t offset) + { + return span->atOffset(offset); + } + Node *node() + { + return &span->at(index); + } + Node *insert() const + { + return span->insert(index); + } + + private: + friend bool operator==(Bucket lhs, Bucket rhs) noexcept + { + return lhs.span == rhs.span && lhs.index == rhs.index; + } + friend bool operator!=(Bucket lhs, Bucket rhs) noexcept { return !(lhs == rhs); } + + void advance_impl(const Data *d, Span *whenAtEnd) noexcept + { + Q_ASSERT(span); + ++index; + if (Q_UNLIKELY(index == SpanConstants::NEntries)) { + index = 0; + ++span; + if (span - d->spans == ptrdiff_t(d->numBuckets >> SpanConstants::SpanShift)) + span = whenAtEnd; + } + } + }; + + static auto allocateSpans(size_t numBuckets) + { + struct R { + Span *spans; + size_t nSpans; + }; + + constexpr qptrdiff MaxSpanCount = (std::numeric_limits::max)() / sizeof(Span); + constexpr size_t MaxBucketCount = MaxSpanCount << SpanConstants::SpanShift; + + if (numBuckets > MaxBucketCount) { + Q_CHECK_PTR(false); + Q_UNREACHABLE(); // no exceptions and no assertions -> no error reporting + } + + size_t nSpans = numBuckets >> SpanConstants::SpanShift; + return R{ new Span[nSpans], nSpans }; + } + + Data(size_t reserve = 0) + { + numBuckets = GrowthPolicy::bucketsForCapacity(reserve); + spans = allocateSpans(numBuckets).spans; + seed = QHashSeed::globalSeed(); + } + + void reallocationHelper(const Data &other, size_t nSpans, bool resized) + { + for (size_t s = 0; s < nSpans; ++s) { + const Span &span = other.spans[s]; + for (size_t index = 0; index < SpanConstants::NEntries; ++index) { + if (!span.hasNode(index)) + continue; + const Node &n = span.at(index); + auto it = resized ? findBucket(n.key) : Bucket { spans + s, index }; + Q_ASSERT(it.isUnused()); + Node *newNode = it.insert(); + new (newNode) Node(n); + } + } + } + + Data(const Data &other) : size(other.size), numBuckets(other.numBuckets), seed(other.seed) + { + auto r = allocateSpans(numBuckets); + spans = r.spans; + reallocationHelper(other, r.nSpans, false); + } + Data(const Data &other, size_t reserved) : size(other.size), seed(other.seed) + { + numBuckets = GrowthPolicy::bucketsForCapacity(qMax(size, reserved)); + spans = allocateSpans(numBuckets).spans; + size_t otherNSpans = other.numBuckets >> SpanConstants::SpanShift; + reallocationHelper(other, otherNSpans, numBuckets != other.numBuckets); + } + + static Data *detached(Data *d) + { + if (!d) + return new Data; + Data *dd = new Data(*d); + if (!d->ref.deref()) + delete d; + return dd; + } + static Data *detached(Data *d, size_t size) + { + if (!d) + return new Data(size); + Data *dd = new Data(*d, size); + if (!d->ref.deref()) + delete d; + return dd; + } + + void clear() + { + delete[] spans; + spans = nullptr; + size = 0; + numBuckets = 0; + } + + iterator detachedIterator(iterator other) const noexcept + { + return iterator{this, other.bucket}; + } + + iterator begin() const noexcept + { + iterator it{ this, 0 }; + if (it.isUnused()) + ++it; + return it; + } + + constexpr iterator end() const noexcept + { + return iterator(); + } + + void rehash(size_t sizeHint = 0) + { + if (sizeHint == 0) + sizeHint = size; + size_t newBucketCount = GrowthPolicy::bucketsForCapacity(sizeHint); + + Span *oldSpans = spans; + size_t oldBucketCount = numBuckets; + spans = allocateSpans(newBucketCount).spans; + numBuckets = newBucketCount; + size_t oldNSpans = oldBucketCount >> SpanConstants::SpanShift; + + for (size_t s = 0; s < oldNSpans; ++s) { + Span &span = oldSpans[s]; + for (size_t index = 0; index < SpanConstants::NEntries; ++index) { + if (!span.hasNode(index)) + continue; + Node &n = span.at(index); + auto it = findBucket(n.key); + Q_ASSERT(it.isUnused()); + Node *newNode = it.insert(); + new (newNode) Node(std::move(n)); + } + span.freeData(); + } + delete[] oldSpans; + } + + size_t nextBucket(size_t bucket) const noexcept + { + ++bucket; + if (bucket == numBuckets) + bucket = 0; + return bucket; + } + + float loadFactor() const noexcept + { + return float(size)/numBuckets; + } + bool shouldGrow() const noexcept + { + return size >= (numBuckets >> 1); + } + + template Bucket findBucket(const K &key) const noexcept + { + static_assert(std::is_same_v, K> || + QHashHeterogeneousSearch, K>::value); + Q_ASSERT(numBuckets > 0); + size_t hash = QHashPrivate::calculateHash(key, seed); + Bucket bucket(this, GrowthPolicy::bucketForHash(numBuckets, hash)); + // loop over the buckets until we find the entry we search for + // or an empty slot, in which case we know the entry doesn't exist + while (true) { + size_t offset = bucket.offset(); + if (offset == SpanConstants::UnusedEntry) { + return bucket; + } else { + Node &n = bucket.nodeAtOffset(offset); + if (qHashEquals(n.key, key)) + return bucket; + } + bucket.advanceWrapped(this); + } + } + + template Node *findNode(const K &key) const noexcept + { + auto bucket = findBucket(key); + if (bucket.isUnused()) + return nullptr; + return bucket.node(); + } + + struct InsertionResult + { + iterator it; + bool initialized; + }; + + template InsertionResult findOrInsert(const K &key) noexcept + { + Bucket it(static_cast(nullptr), 0); + if (numBuckets > 0) { + it = findBucket(key); + if (!it.isUnused()) + return { it.toIterator(this), true }; + } + if (shouldGrow()) { + rehash(size + 1); + it = findBucket(key); // need to get a new iterator after rehashing + } + Q_ASSERT(it.span != nullptr); + Q_ASSERT(it.isUnused()); + it.insert(); + ++size; + return { it.toIterator(this), false }; + } + + void erase(Bucket bucket) noexcept(std::is_nothrow_destructible::value) + { + Q_ASSERT(bucket.span->hasNode(bucket.index)); + bucket.span->erase(bucket.index); + --size; + + // re-insert the following entries to avoid holes + Bucket next = bucket; + while (true) { + next.advanceWrapped(this); + size_t offset = next.offset(); + if (offset == SpanConstants::UnusedEntry) + return; + size_t hash = QHashPrivate::calculateHash(next.nodeAtOffset(offset).key, seed); + Bucket newBucket(this, GrowthPolicy::bucketForHash(numBuckets, hash)); + while (true) { + if (newBucket == next) { + // nothing to do, item is at the right plae + break; + } else if (newBucket == bucket) { + // move into the hole we created earlier + if (next.span == bucket.span) { + bucket.span->moveLocal(next.index, bucket.index); + } else { + // move between spans, more expensive + bucket.span->moveFromSpan(*next.span, next.index, bucket.index); + } + bucket = next; + break; + } + newBucket.advanceWrapped(this); + } + } + } + + ~Data() + { + delete [] spans; + } +}; + +template +struct iterator { + using Span = QHashPrivate::Span; + + const Data *d = nullptr; + size_t bucket = 0; + + size_t span() const noexcept { return bucket >> SpanConstants::SpanShift; } + size_t index() const noexcept { return bucket & SpanConstants::LocalBucketMask; } + inline bool isUnused() const noexcept { return !d->spans[span()].hasNode(index()); } + + inline Node *node() const noexcept + { + Q_ASSERT(!isUnused()); + return &d->spans[span()].at(index()); + } + bool atEnd() const noexcept { return !d; } + + iterator operator++() noexcept + { + while (true) { + ++bucket; + if (bucket == d->numBuckets) { + d = nullptr; + bucket = 0; + break; + } + if (!isUnused()) + break; + } + return *this; + } + bool operator==(iterator other) const noexcept + { return d == other.d && bucket == other.bucket; } + bool operator!=(iterator other) const noexcept + { return !(*this == other); } +}; + + + +} // namespace QHashPrivate + +template +class QHash +{ + using Node = QHashPrivate::Node; + using Data = QHashPrivate::Data; + friend class QSet; + friend class QMultiHash; + friend tst_QHash; + + Data *d = nullptr; + +public: + using key_type = Key; + using mapped_type = T; + using value_type = T; + using size_type = qsizetype; + using difference_type = qsizetype; + using reference = T &; + using const_reference = const T &; + + inline QHash() noexcept = default; + inline QHash(std::initializer_list > list) + : d(new Data(list.size())) + { + for (typename std::initializer_list >::const_iterator it = list.begin(); it != list.end(); ++it) + insert(it->first, it->second); + } + QHash(const QHash &other) noexcept + : d(other.d) + { + if (d) + d->ref.ref(); + } + ~QHash() + { + static_assert(std::is_nothrow_destructible_v, "Types with throwing destructors are not supported in Qt containers."); + static_assert(std::is_nothrow_destructible_v, "Types with throwing destructors are not supported in Qt containers."); + + if (d && !d->ref.deref()) + delete d; + } + + QHash &operator=(const QHash &other) noexcept(std::is_nothrow_destructible::value) + { + if (d != other.d) { + Data *o = other.d; + if (o) + o->ref.ref(); + if (d && !d->ref.deref()) + delete d; + d = o; + } + return *this; + } + + QHash(QHash &&other) noexcept + : d(std::exchange(other.d, nullptr)) + { + } + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QHash) +#ifdef Q_QDOC + template + QHash(InputIterator f, InputIterator l); +#else + template = true> + QHash(InputIterator f, InputIterator l) + : QHash() + { + QtPrivate::reserveIfForwardIterator(this, f, l); + for (; f != l; ++f) + insert(f.key(), f.value()); + } + + template = true> + QHash(InputIterator f, InputIterator l) + : QHash() + { + QtPrivate::reserveIfForwardIterator(this, f, l); + for (; f != l; ++f) { + auto &&e = *f; + using V = decltype(e); + insert(std::forward(e).first, std::forward(e).second); + } + } +#endif + void swap(QHash &other) noexcept { qt_ptr_swap(d, other.d); } + +#ifndef Q_QDOC + template + QTypeTraits::compare_eq_result_container operator==(const QHash &other) const noexcept + { + if (d == other.d) + return true; + if (size() != other.size()) + return false; + + for (const_iterator it = other.begin(); it != other.end(); ++it) { + const_iterator i = find(it.key()); + if (i == end() || !i.i.node()->valuesEqual(it.i.node())) + return false; + } + // all values must be the same as size is the same + return true; + } + template + QTypeTraits::compare_eq_result_container operator!=(const QHash &other) const noexcept + { return !(*this == other); } +#else + bool operator==(const QHash &other) const; + bool operator!=(const QHash &other) const; +#endif // Q_QDOC + + inline qsizetype size() const noexcept { return d ? qsizetype(d->size) : 0; } + inline bool isEmpty() const noexcept { return !d || d->size == 0; } + + inline qsizetype capacity() const noexcept { return d ? qsizetype(d->numBuckets >> 1) : 0; } + void reserve(qsizetype size) + { + // reserve(0) is used in squeeze() + if (size && (this->capacity() >= size)) + return; + if (isDetached()) + d->rehash(size); + else + d = Data::detached(d, size_t(size)); + } + inline void squeeze() + { + if (capacity()) + reserve(0); + } + + inline void detach() { if (!d || d->ref.isShared()) d = Data::detached(d); } + inline bool isDetached() const noexcept { return d && !d->ref.isShared(); } + bool isSharedWith(const QHash &other) const noexcept { return d == other.d; } + + void clear() noexcept(std::is_nothrow_destructible::value) + { + if (d && !d->ref.deref()) + delete d; + d = nullptr; + } + + bool remove(const Key &key) + { + return removeImpl(key); + } +private: + template bool removeImpl(const K &key) + { + if (isEmpty()) // prevents detaching shared null + return false; + auto it = d->findBucket(key); + size_t bucket = it.toBucketIndex(d); + detach(); + it = typename Data::Bucket(d, bucket); // reattach in case of detach + + if (it.isUnused()) + return false; + d->erase(it); + return true; + } + +public: + template + qsizetype removeIf(Predicate pred) + { + return QtPrivate::associative_erase_if(*this, pred); + } + + T take(const Key &key) + { + return takeImpl(key); + } +private: + template T takeImpl(const K &key) + { + if (isEmpty()) // prevents detaching shared null + return T(); + auto it = d->findBucket(key); + size_t bucket = it.toBucketIndex(d); + detach(); + it = typename Data::Bucket(d, bucket); // reattach in case of detach + + if (it.isUnused()) + return T(); + T value = it.node()->takeValue(); + d->erase(it); + return value; + } + +public: + bool contains(const Key &key) const noexcept + { + if (!d) + return false; + return d->findNode(key) != nullptr; + } + qsizetype count(const Key &key) const noexcept + { + return contains(key) ? 1 : 0; + } + +private: + const Key *keyImpl(const T &value) const noexcept + { + if (d) { + const_iterator i = begin(); + while (i != end()) { + if (i.value() == value) + return &i.key(); + ++i; + } + } + + return nullptr; + } + +public: + Key key(const T &value) const noexcept + { + if (auto *k = keyImpl(value)) + return *k; + else + return Key(); + } + Key key(const T &value, const Key &defaultKey) const noexcept + { + if (auto *k = keyImpl(value)) + return *k; + else + return defaultKey; + } + +private: + template + T *valueImpl(const K &key) const noexcept + { + if (d) { + Node *n = d->findNode(key); + if (n) + return &n->value; + } + return nullptr; + } +public: + T value(const Key &key) const noexcept + { + if (T *v = valueImpl(key)) + return *v; + else + return T(); + } + + T value(const Key &key, const T &defaultValue) const noexcept + { + if (T *v = valueImpl(key)) + return *v; + else + return defaultValue; + } + + T &operator[](const Key &key) + { + return operatorIndexImpl(key); + } +private: + template T &operatorIndexImpl(const K &key) + { + const auto copy = isDetached() ? QHash() : *this; // keep 'key' alive across the detach + detach(); + auto result = d->findOrInsert(key); + Q_ASSERT(!result.it.atEnd()); + if (!result.initialized) + Node::createInPlace(result.it.node(), Key(key), T()); + return result.it.node()->value; + } + +public: + const T operator[](const Key &key) const noexcept + { + return value(key); + } + + QList keys() const { return QList(keyBegin(), keyEnd()); } + QList keys(const T &value) const + { + QList res; + const_iterator i = begin(); + while (i != end()) { + if (i.value() == value) + res.append(i.key()); + ++i; + } + return res; + } + QList values() const { return QList(begin(), end()); } + + class const_iterator; + + class iterator + { + using piter = typename QHashPrivate::iterator; + friend class const_iterator; + friend class QHash; + friend class QSet; + piter i; + explicit inline iterator(piter it) noexcept : i(it) { } + + public: + typedef std::forward_iterator_tag iterator_category; + typedef qptrdiff difference_type; + typedef T value_type; + typedef T *pointer; + typedef T &reference; + + constexpr iterator() noexcept = default; + + inline const Key &key() const noexcept { return i.node()->key; } + inline T &value() const noexcept { return i.node()->value; } + inline T &operator*() const noexcept { return i.node()->value; } + inline T *operator->() const noexcept { return &i.node()->value; } + inline bool operator==(const iterator &o) const noexcept { return i == o.i; } + inline bool operator!=(const iterator &o) const noexcept { return i != o.i; } + + inline iterator &operator++() noexcept + { + ++i; + return *this; + } + inline iterator operator++(int) noexcept + { + iterator r = *this; + ++i; + return r; + } + + inline bool operator==(const const_iterator &o) const noexcept { return i == o.i; } + inline bool operator!=(const const_iterator &o) const noexcept { return i != o.i; } + }; + friend class iterator; + + class const_iterator + { + using piter = typename QHashPrivate::iterator; + friend class iterator; + friend class QHash; + friend class QSet; + piter i; + explicit inline const_iterator(piter it) : i(it) { } + + public: + typedef std::forward_iterator_tag iterator_category; + typedef qptrdiff difference_type; + typedef T value_type; + typedef const T *pointer; + typedef const T &reference; + + constexpr const_iterator() noexcept = default; + inline const_iterator(const iterator &o) noexcept : i(o.i) { } + + inline const Key &key() const noexcept { return i.node()->key; } + inline const T &value() const noexcept { return i.node()->value; } + inline const T &operator*() const noexcept { return i.node()->value; } + inline const T *operator->() const noexcept { return &i.node()->value; } + inline bool operator==(const const_iterator &o) const noexcept { return i == o.i; } + inline bool operator!=(const const_iterator &o) const noexcept { return i != o.i; } + + inline const_iterator &operator++() noexcept + { + ++i; + return *this; + } + inline const_iterator operator++(int) noexcept + { + const_iterator r = *this; + ++i; + return r; + } + }; + friend class const_iterator; + + class key_iterator + { + const_iterator i; + + public: + typedef typename const_iterator::iterator_category iterator_category; + typedef qptrdiff difference_type; + typedef Key value_type; + typedef const Key *pointer; + typedef const Key &reference; + + key_iterator() noexcept = default; + explicit key_iterator(const_iterator o) noexcept : i(o) { } + + const Key &operator*() const noexcept { return i.key(); } + const Key *operator->() const noexcept { return &i.key(); } + bool operator==(key_iterator o) const noexcept { return i == o.i; } + bool operator!=(key_iterator o) const noexcept { return i != o.i; } + + inline key_iterator &operator++() noexcept { ++i; return *this; } + inline key_iterator operator++(int) noexcept { return key_iterator(i++);} + const_iterator base() const noexcept { return i; } + }; + + typedef QKeyValueIterator const_key_value_iterator; + typedef QKeyValueIterator key_value_iterator; + + // STL style + inline iterator begin() { detach(); return iterator(d->begin()); } + inline const_iterator begin() const noexcept { return d ? const_iterator(d->begin()): const_iterator(); } + inline const_iterator cbegin() const noexcept { return d ? const_iterator(d->begin()): const_iterator(); } + inline const_iterator constBegin() const noexcept { return d ? const_iterator(d->begin()): const_iterator(); } + inline iterator end() noexcept { return iterator(); } + inline const_iterator end() const noexcept { return const_iterator(); } + inline const_iterator cend() const noexcept { return const_iterator(); } + inline const_iterator constEnd() const noexcept { return const_iterator(); } + inline key_iterator keyBegin() const noexcept { return key_iterator(begin()); } + inline key_iterator keyEnd() const noexcept { return key_iterator(end()); } + inline key_value_iterator keyValueBegin() { return key_value_iterator(begin()); } + inline key_value_iterator keyValueEnd() { return key_value_iterator(end()); } + inline const_key_value_iterator keyValueBegin() const noexcept { return const_key_value_iterator(begin()); } + inline const_key_value_iterator constKeyValueBegin() const noexcept { return const_key_value_iterator(begin()); } + inline const_key_value_iterator keyValueEnd() const noexcept { return const_key_value_iterator(end()); } + inline const_key_value_iterator constKeyValueEnd() const noexcept { return const_key_value_iterator(end()); } + auto asKeyValueRange() & { return QtPrivate::QKeyValueRange(*this); } + auto asKeyValueRange() const & { return QtPrivate::QKeyValueRange(*this); } + auto asKeyValueRange() && { return QtPrivate::QKeyValueRange(std::move(*this)); } + auto asKeyValueRange() const && { return QtPrivate::QKeyValueRange(std::move(*this)); } + + iterator erase(const_iterator it) + { + Q_ASSERT(it != constEnd()); + detach(); + // ensure a valid iterator across the detach: + iterator i = iterator{d->detachedIterator(it.i)}; + typename Data::Bucket bucket(i.i); + + d->erase(bucket); + if (bucket.toBucketIndex(d) == d->numBuckets - 1 || bucket.isUnused()) + ++i; + return i; + } + + std::pair equal_range(const Key &key) + { + return equal_range_impl(*this, key); + } + std::pair equal_range(const Key &key) const noexcept + { + return equal_range_impl(*this, key); + } +private: + template static auto equal_range_impl(Hash &self, const K &key) + { + auto first = self.find(key); + auto second = first; + if (second != decltype(first){}) + ++second; + return std::make_pair(first, second); + } + + template iterator findImpl(const K &key) + { + if (isEmpty()) // prevents detaching shared null + return end(); + auto it = d->findBucket(key); + size_t bucket = it.toBucketIndex(d); + detach(); + it = typename Data::Bucket(d, bucket); // reattach in case of detach + if (it.isUnused()) + return end(); + return iterator(it.toIterator(d)); + } + template const_iterator constFindImpl(const K &key) const noexcept + { + if (isEmpty()) + return end(); + auto it = d->findBucket(key); + if (it.isUnused()) + return end(); + return const_iterator({d, it.toBucketIndex(d)}); + } + +public: + typedef iterator Iterator; + typedef const_iterator ConstIterator; + inline qsizetype count() const noexcept { return d ? qsizetype(d->size) : 0; } + iterator find(const Key &key) + { + return findImpl(key); + } + const_iterator find(const Key &key) const noexcept + { + return constFindImpl(key); + } + const_iterator constFind(const Key &key) const noexcept + { + return find(key); + } + iterator insert(const Key &key, const T &value) + { + return emplace(key, value); + } + + void insert(const QHash &hash) + { + if (d == hash.d || !hash.d) + return; + if (!d) { + *this = hash; + return; + } + + detach(); + + for (auto it = hash.begin(); it != hash.end(); ++it) + emplace(it.key(), it.value()); + } + + template + iterator emplace(const Key &key, Args &&... args) + { + Key copy = key; // Needs to be explicit for MSVC 2019 + return emplace(std::move(copy), std::forward(args)...); + } + + template + iterator emplace(Key &&key, Args &&... args) + { + if (isDetached()) { + if (d->shouldGrow()) // Construct the value now so that no dangling references are used + return emplace_helper(std::move(key), T(std::forward(args)...)); + return emplace_helper(std::move(key), std::forward(args)...); + } + // else: we must detach + const auto copy = *this; // keep 'args' alive across the detach/growth + detach(); + return emplace_helper(std::move(key), std::forward(args)...); + } + + float load_factor() const noexcept { return d ? d->loadFactor() : 0; } + static float max_load_factor() noexcept { return 0.5; } + size_t bucket_count() const noexcept { return d ? d->numBuckets : 0; } + static size_t max_bucket_count() noexcept { return Data::maxNumBuckets(); } + + inline bool empty() const noexcept { return isEmpty(); } + +private: + template + iterator emplace_helper(Key &&key, Args &&... args) + { + auto result = d->findOrInsert(key); + if (!result.initialized) + Node::createInPlace(result.it.node(), std::move(key), std::forward(args)...); + else + result.it.node()->emplaceValue(std::forward(args)...); + return iterator(result.it); + } + + template + using if_heterogeneously_searchable = QHashPrivate::if_heterogeneously_searchable_with; + + template + using if_key_constructible_from = std::enable_if_t, bool>; + +public: + template = true> + bool remove(const K &key) + { + return removeImpl(key); + } + template = true> + T take(const K &key) + { + return takeImpl(key); + } + template = true> + bool contains(const K &key) const + { + return d ? d->findNode(key) != nullptr : false; + } + template = true> + qsizetype count(const K &key) const + { + return contains(key) ? 1 : 0; + } + template = true> + T value(const K &key) const noexcept + { + if (auto *v = valueImpl(key)) + return *v; + else + return T(); + } + template = true> + T value(const K &key, const T &defaultValue) const noexcept + { + if (auto *v = valueImpl(key)) + return *v; + else + return defaultValue; + } + template = true, if_key_constructible_from = true> + T &operator[](const K &key) + { + return operatorIndexImpl(key); + } + template = true> + const T operator[](const K &key) const noexcept + { + return value(key); + } + template = true> + std::pair + equal_range(const K &key) + { + return equal_range_impl(*this, key); + } + template = true> + std::pair + equal_range(const K &key) const noexcept + { + return equal_range_impl(*this, key); + } + template = true> + iterator find(const K &key) + { + return findImpl(key); + } + template = true> + const_iterator find(const K &key) const noexcept + { + return constFindImpl(key); + } + template = true> + const_iterator constFind(const K &key) const noexcept + { + return find(key); + } +}; + + +template +class QMultiHash +{ + using Node = QHashPrivate::MultiNode; + using Data = QHashPrivate::Data; + using Chain = QHashPrivate::MultiNodeChain; + + Data *d = nullptr; + qsizetype m_size = 0; + +public: + using key_type = Key; + using mapped_type = T; + using value_type = T; + using size_type = qsizetype; + using difference_type = qsizetype; + using reference = T &; + using const_reference = const T &; + + QMultiHash() noexcept = default; + inline QMultiHash(std::initializer_list > list) + : d(new Data(list.size())) + { + for (typename std::initializer_list >::const_iterator it = list.begin(); it != list.end(); ++it) + insert(it->first, it->second); + } +#ifdef Q_QDOC + template + QMultiHash(InputIterator f, InputIterator l); +#else + template = true> + QMultiHash(InputIterator f, InputIterator l) + { + QtPrivate::reserveIfForwardIterator(this, f, l); + for (; f != l; ++f) + insert(f.key(), f.value()); + } + + template = true> + QMultiHash(InputIterator f, InputIterator l) + { + QtPrivate::reserveIfForwardIterator(this, f, l); + for (; f != l; ++f) { + auto &&e = *f; + using V = decltype(e); + insert(std::forward(e).first, std::forward(e).second); + } + } +#endif + QMultiHash(const QMultiHash &other) noexcept + : d(other.d), m_size(other.m_size) + { + if (d) + d->ref.ref(); + } + ~QMultiHash() + { + static_assert(std::is_nothrow_destructible_v, "Types with throwing destructors are not supported in Qt containers."); + static_assert(std::is_nothrow_destructible_v, "Types with throwing destructors are not supported in Qt containers."); + + if (d && !d->ref.deref()) + delete d; + } + + QMultiHash &operator=(const QMultiHash &other) noexcept(std::is_nothrow_destructible::value) + { + if (d != other.d) { + Data *o = other.d; + if (o) + o->ref.ref(); + if (d && !d->ref.deref()) + delete d; + d = o; + m_size = other.m_size; + } + return *this; + } + QMultiHash(QMultiHash &&other) noexcept + : d(std::exchange(other.d, nullptr)), + m_size(std::exchange(other.m_size, 0)) + { + } + QMultiHash &operator=(QMultiHash &&other) noexcept(std::is_nothrow_destructible::value) + { + QMultiHash moved(std::move(other)); + swap(moved); + return *this; + } + + explicit QMultiHash(const QHash &other) + : QMultiHash(other.begin(), other.end()) + {} + + explicit QMultiHash(QHash &&other) + { + unite(std::move(other)); + } + + void swap(QMultiHash &other) noexcept + { + qt_ptr_swap(d, other.d); + std::swap(m_size, other.m_size); + } + +#ifndef Q_QDOC + template + QTypeTraits::compare_eq_result_container operator==(const QMultiHash &other) const noexcept + { + if (d == other.d) + return true; + if (m_size != other.m_size) + return false; + if (m_size == 0) + return true; + // equal size, and both non-zero size => d pointers allocated for both + Q_ASSERT(d); + Q_ASSERT(other.d); + if (d->size != other.d->size) + return false; + for (auto it = other.d->begin(); it != other.d->end(); ++it) { + auto *n = d->findNode(it.node()->key); + if (!n) + return false; + Chain *e = it.node()->value; + while (e) { + Chain *oe = n->value; + while (oe) { + if (oe->value == e->value) + break; + oe = oe->next; + } + if (!oe) + return false; + e = e->next; + } + } + // all values must be the same as size is the same + return true; + } + template + QTypeTraits::compare_eq_result_container operator!=(const QMultiHash &other) const noexcept + { return !(*this == other); } +#else + bool operator==(const QMultiHash &other) const; + bool operator!=(const QMultiHash &other) const; +#endif // Q_QDOC + + inline qsizetype size() const noexcept { return m_size; } + + inline bool isEmpty() const noexcept { return !m_size; } + + inline qsizetype capacity() const noexcept { return d ? qsizetype(d->numBuckets >> 1) : 0; } + void reserve(qsizetype size) + { + // reserve(0) is used in squeeze() + if (size && (this->capacity() >= size)) + return; + if (isDetached()) + d->rehash(size); + else + d = Data::detached(d, size_t(size)); + } + inline void squeeze() { reserve(0); } + + inline void detach() { if (!d || d->ref.isShared()) d = Data::detached(d); } + inline bool isDetached() const noexcept { return d && !d->ref.isShared(); } + bool isSharedWith(const QMultiHash &other) const noexcept { return d == other.d; } + + void clear() noexcept(std::is_nothrow_destructible::value) + { + if (d && !d->ref.deref()) + delete d; + d = nullptr; + m_size = 0; + } + + qsizetype remove(const Key &key) + { + return removeImpl(key); + } +private: + template qsizetype removeImpl(const K &key) + { + if (isEmpty()) // prevents detaching shared null + return 0; + auto it = d->findBucket(key); + size_t bucket = it.toBucketIndex(d); + detach(); + it = typename Data::Bucket(d, bucket); // reattach in case of detach + + if (it.isUnused()) + return 0; + qsizetype n = Node::freeChain(it.node()); + m_size -= n; + Q_ASSERT(m_size >= 0); + d->erase(it); + return n; + } + +public: + template + qsizetype removeIf(Predicate pred) + { + return QtPrivate::associative_erase_if(*this, pred); + } + + T take(const Key &key) + { + return takeImpl(key); + } +private: + template T takeImpl(const K &key) + { + if (isEmpty()) // prevents detaching shared null + return T(); + auto it = d->findBucket(key); + size_t bucket = it.toBucketIndex(d); + detach(); + it = typename Data::Bucket(d, bucket); // reattach in case of detach + + if (it.isUnused()) + return T(); + Chain *e = it.node()->value; + Q_ASSERT(e); + T t = std::move(e->value); + if (e->next) { + it.node()->value = e->next; + delete e; + } else { + // erase() deletes the values. + d->erase(it); + } + --m_size; + Q_ASSERT(m_size >= 0); + return t; + } + +public: + bool contains(const Key &key) const noexcept + { + if (!d) + return false; + return d->findNode(key) != nullptr; + } + +private: + const Key *keyImpl(const T &value) const noexcept + { + if (d) { + auto i = d->begin(); + while (i != d->end()) { + Chain *e = i.node()->value; + if (e->contains(value)) + return &i.node()->key; + ++i; + } + } + + return nullptr; + } +public: + Key key(const T &value) const noexcept + { + if (auto *k = keyImpl(value)) + return *k; + else + return Key(); + } + Key key(const T &value, const Key &defaultKey) const noexcept + { + if (auto *k = keyImpl(value)) + return *k; + else + return defaultKey; + } + +private: + template + T *valueImpl(const K &key) const noexcept + { + if (d) { + Node *n = d->findNode(key); + if (n) { + Q_ASSERT(n->value); + return &n->value->value; + } + } + return nullptr; + } +public: + T value(const Key &key) const noexcept + { + if (auto *v = valueImpl(key)) + return *v; + else + return T(); + } + T value(const Key &key, const T &defaultValue) const noexcept + { + if (auto *v = valueImpl(key)) + return *v; + else + return defaultValue; + } + + T &operator[](const Key &key) + { + return operatorIndexImpl(key); + } +private: + template T &operatorIndexImpl(const K &key) + { + const auto copy = isDetached() ? QMultiHash() : *this; // keep 'key' alive across the detach + detach(); + auto result = d->findOrInsert(key); + Q_ASSERT(!result.it.atEnd()); + if (!result.initialized) { + Node::createInPlace(result.it.node(), Key(key), T()); + ++m_size; + } + return result.it.node()->value->value; + } + +public: + const T operator[](const Key &key) const noexcept + { + return value(key); + } + + QList uniqueKeys() const + { + QList res; + if (d) { + auto i = d->begin(); + while (i != d->end()) { + res.append(i.node()->key); + ++i; + } + } + return res; + } + + QList keys() const { return QList(keyBegin(), keyEnd()); } + QList keys(const T &value) const + { + QList res; + const_iterator i = begin(); + while (i != end()) { + if (i.value() == value) + res.append(i.key()); + ++i; + } + return res; + } + + QList values() const { return QList(begin(), end()); } + QList values(const Key &key) const + { + return valuesImpl(key); + } +private: + template QList valuesImpl(const K &key) const + { + QList values; + if (d) { + Node *n = d->findNode(key); + if (n) { + Chain *e = n->value; + while (e) { + values.append(e->value); + e = e->next; + } + } + } + return values; + } + +public: + class const_iterator; + + class iterator + { + using piter = typename QHashPrivate::iterator; + friend class const_iterator; + friend class QMultiHash; + piter i; + Chain **e = nullptr; + explicit inline iterator(piter it, Chain **entry = nullptr) noexcept : i(it), e(entry) + { + if (!it.atEnd() && !e) { + e = &it.node()->value; + Q_ASSERT(e && *e); + } + } + + public: + typedef std::forward_iterator_tag iterator_category; + typedef qptrdiff difference_type; + typedef T value_type; + typedef T *pointer; + typedef T &reference; + + constexpr iterator() noexcept = default; + + inline const Key &key() const noexcept { return i.node()->key; } + inline T &value() const noexcept { return (*e)->value; } + inline T &operator*() const noexcept { return (*e)->value; } + inline T *operator->() const noexcept { return &(*e)->value; } + inline bool operator==(const iterator &o) const noexcept { return e == o.e; } + inline bool operator!=(const iterator &o) const noexcept { return e != o.e; } + + inline iterator &operator++() noexcept { + Q_ASSERT(e && *e); + e = &(*e)->next; + Q_ASSERT(e); + if (!*e) { + ++i; + e = i.atEnd() ? nullptr : &i.node()->value; + } + return *this; + } + inline iterator operator++(int) noexcept { + iterator r = *this; + ++(*this); + return r; + } + + inline bool operator==(const const_iterator &o) const noexcept { return e == o.e; } + inline bool operator!=(const const_iterator &o) const noexcept { return e != o.e; } + }; + friend class iterator; + + class const_iterator + { + using piter = typename QHashPrivate::iterator; + friend class iterator; + friend class QMultiHash; + piter i; + Chain **e = nullptr; + explicit inline const_iterator(piter it, Chain **entry = nullptr) noexcept : i(it), e(entry) + { + if (!it.atEnd() && !e) { + e = &it.node()->value; + Q_ASSERT(e && *e); + } + } + + public: + typedef std::forward_iterator_tag iterator_category; + typedef qptrdiff difference_type; + typedef T value_type; + typedef const T *pointer; + typedef const T &reference; + + constexpr const_iterator() noexcept = default; + inline const_iterator(const iterator &o) noexcept : i(o.i), e(o.e) { } + + inline const Key &key() const noexcept { return i.node()->key; } + inline T &value() const noexcept { return (*e)->value; } + inline T &operator*() const noexcept { return (*e)->value; } + inline T *operator->() const noexcept { return &(*e)->value; } + inline bool operator==(const const_iterator &o) const noexcept { return e == o.e; } + inline bool operator!=(const const_iterator &o) const noexcept { return e != o.e; } + + inline const_iterator &operator++() noexcept { + Q_ASSERT(e && *e); + e = &(*e)->next; + Q_ASSERT(e); + if (!*e) { + ++i; + e = i.atEnd() ? nullptr : &i.node()->value; + } + return *this; + } + inline const_iterator operator++(int) noexcept + { + const_iterator r = *this; + ++(*this); + return r; + } + }; + friend class const_iterator; + + class key_iterator + { + const_iterator i; + + public: + typedef typename const_iterator::iterator_category iterator_category; + typedef qptrdiff difference_type; + typedef Key value_type; + typedef const Key *pointer; + typedef const Key &reference; + + key_iterator() noexcept = default; + explicit key_iterator(const_iterator o) noexcept : i(o) { } + + const Key &operator*() const noexcept { return i.key(); } + const Key *operator->() const noexcept { return &i.key(); } + bool operator==(key_iterator o) const noexcept { return i == o.i; } + bool operator!=(key_iterator o) const noexcept { return i != o.i; } + + inline key_iterator &operator++() noexcept { ++i; return *this; } + inline key_iterator operator++(int) noexcept { return key_iterator(i++);} + const_iterator base() const noexcept { return i; } + }; + + typedef QKeyValueIterator const_key_value_iterator; + typedef QKeyValueIterator key_value_iterator; + + // STL style + inline iterator begin() { detach(); return iterator(d->begin()); } + inline const_iterator begin() const noexcept { return d ? const_iterator(d->begin()): const_iterator(); } + inline const_iterator cbegin() const noexcept { return d ? const_iterator(d->begin()): const_iterator(); } + inline const_iterator constBegin() const noexcept { return d ? const_iterator(d->begin()): const_iterator(); } + inline iterator end() noexcept { return iterator(); } + inline const_iterator end() const noexcept { return const_iterator(); } + inline const_iterator cend() const noexcept { return const_iterator(); } + inline const_iterator constEnd() const noexcept { return const_iterator(); } + inline key_iterator keyBegin() const noexcept { return key_iterator(begin()); } + inline key_iterator keyEnd() const noexcept { return key_iterator(end()); } + inline key_value_iterator keyValueBegin() noexcept { return key_value_iterator(begin()); } + inline key_value_iterator keyValueEnd() noexcept { return key_value_iterator(end()); } + inline const_key_value_iterator keyValueBegin() const noexcept { return const_key_value_iterator(begin()); } + inline const_key_value_iterator constKeyValueBegin() const noexcept { return const_key_value_iterator(begin()); } + inline const_key_value_iterator keyValueEnd() const noexcept { return const_key_value_iterator(end()); } + inline const_key_value_iterator constKeyValueEnd() const noexcept { return const_key_value_iterator(end()); } + auto asKeyValueRange() & { return QtPrivate::QKeyValueRange(*this); } + auto asKeyValueRange() const & { return QtPrivate::QKeyValueRange(*this); } + auto asKeyValueRange() && { return QtPrivate::QKeyValueRange(std::move(*this)); } + auto asKeyValueRange() const && { return QtPrivate::QKeyValueRange(std::move(*this)); } + + iterator detach(const_iterator it) + { + auto i = it.i; + Chain **e = it.e; + if (d->ref.isShared()) { + // need to store iterator position before detaching + qsizetype n = 0; + Chain *entry = i.node()->value; + while (entry != *it.e) { + ++n; + entry = entry->next; + } + Q_ASSERT(entry); + detach_helper(); + + i = d->detachedIterator(i); + e = &i.node()->value; + while (n) { + e = &(*e)->next; + --n; + } + Q_ASSERT(e && *e); + } + return iterator(i, e); + } + + iterator erase(const_iterator it) + { + Q_ASSERT(d); + iterator iter = detach(it); + iterator i = iter; + Chain *e = *i.e; + Chain *next = e->next; + *i.e = next; + delete e; + if (!next) { + if (i.e == &i.i.node()->value) { + // last remaining entry, erase + typename Data::Bucket bucket(i.i); + d->erase(bucket); + if (bucket.toBucketIndex(d) == d->numBuckets - 1 || bucket.isUnused()) + i = iterator(++iter.i); + else // 'i' currently has a nullptr chain. So, we must recreate it + i = iterator(bucket.toIterator(d)); + } else { + i = iterator(++iter.i); + } + } + --m_size; + Q_ASSERT(m_size >= 0); + return i; + } + + // more Qt + typedef iterator Iterator; + typedef const_iterator ConstIterator; + inline qsizetype count() const noexcept { return size(); } + +private: + template iterator findImpl(const K &key) + { + if (isEmpty()) + return end(); + auto it = d->findBucket(key); + size_t bucket = it.toBucketIndex(d); + detach(); + it = typename Data::Bucket(d, bucket); // reattach in case of detach + + if (it.isUnused()) + return end(); + return iterator(it.toIterator(d)); + } + template const_iterator constFindImpl(const K &key) const noexcept + { + if (isEmpty()) + return end(); + auto it = d->findBucket(key); + if (it.isUnused()) + return constEnd(); + return const_iterator(it.toIterator(d)); + } +public: + iterator find(const Key &key) + { + return findImpl(key); + } + const_iterator constFind(const Key &key) const noexcept + { + return constFindImpl(key); + } + const_iterator find(const Key &key) const noexcept + { + return constFindImpl(key); + } + + iterator insert(const Key &key, const T &value) + { + return emplace(key, value); + } + + template + iterator emplace(const Key &key, Args &&... args) + { + return emplace(Key(key), std::forward(args)...); + } + + template + iterator emplace(Key &&key, Args &&... args) + { + if (isDetached()) { + if (d->shouldGrow()) // Construct the value now so that no dangling references are used + return emplace_helper(std::move(key), T(std::forward(args)...)); + return emplace_helper(std::move(key), std::forward(args)...); + } + // else: we must detach + const auto copy = *this; // keep 'args' alive across the detach/growth + detach(); + return emplace_helper(std::move(key), std::forward(args)...); + } + + + float load_factor() const noexcept { return d ? d->loadFactor() : 0; } + static float max_load_factor() noexcept { return 0.5; } + size_t bucket_count() const noexcept { return d ? d->numBuckets : 0; } + static size_t max_bucket_count() noexcept { return Data::maxNumBuckets(); } + + inline bool empty() const noexcept { return isEmpty(); } + + inline iterator replace(const Key &key, const T &value) + { + return emplaceReplace(key, value); + } + + template + iterator emplaceReplace(const Key &key, Args &&... args) + { + return emplaceReplace(Key(key), std::forward(args)...); + } + + template + iterator emplaceReplace(Key &&key, Args &&... args) + { + if (isDetached()) { + if (d->shouldGrow()) // Construct the value now so that no dangling references are used + return emplaceReplace_helper(std::move(key), T(std::forward(args)...)); + return emplaceReplace_helper(std::move(key), std::forward(args)...); + } + // else: we must detach + const auto copy = *this; // keep 'args' alive across the detach/growth + detach(); + return emplaceReplace_helper(std::move(key), std::forward(args)...); + } + + inline QMultiHash &operator+=(const QMultiHash &other) + { this->unite(other); return *this; } + inline QMultiHash operator+(const QMultiHash &other) const + { QMultiHash result = *this; result += other; return result; } + + bool contains(const Key &key, const T &value) const noexcept + { + return containsImpl(key, value); + } +private: + template bool containsImpl(const K &key, const T &value) const noexcept + { + if (isEmpty()) + return false; + auto n = d->findNode(key); + if (n == nullptr) + return false; + return n->value->contains(value); + } + +public: + qsizetype remove(const Key &key, const T &value) + { + return removeImpl(key, value); + } +private: + template qsizetype removeImpl(const K &key, const T &value) + { + if (isEmpty()) // prevents detaching shared null + return 0; + auto it = d->findBucket(key); + size_t bucket = it.toBucketIndex(d); + detach(); + it = typename Data::Bucket(d, bucket); // reattach in case of detach + + if (it.isUnused()) + return 0; + qsizetype n = 0; + Chain **e = &it.node()->value; + while (*e) { + Chain *entry = *e; + if (entry->value == value) { + *e = entry->next; + delete entry; + ++n; + } else { + e = &entry->next; + } + } + if (!it.node()->value) + d->erase(it); + m_size -= n; + Q_ASSERT(m_size >= 0); + return n; + } + +public: + qsizetype count(const Key &key) const noexcept + { + return countImpl(key); + } +private: + template qsizetype countImpl(const K &key) const noexcept + { + if (!d) + return 0; + auto it = d->findBucket(key); + if (it.isUnused()) + return 0; + qsizetype n = 0; + Chain *e = it.node()->value; + while (e) { + ++n; + e = e->next; + } + + return n; + } + +public: + qsizetype count(const Key &key, const T &value) const noexcept + { + return countImpl(key, value); + } +private: + template qsizetype countImpl(const K &key, const T &value) const noexcept + { + if (!d) + return 0; + auto it = d->findBucket(key); + if (it.isUnused()) + return 0; + qsizetype n = 0; + Chain *e = it.node()->value; + while (e) { + if (e->value == value) + ++n; + e = e->next; + } + + return n; + } + + template iterator findImpl(const K &key, const T &value) + { + if (isEmpty()) + return end(); + const auto copy = isDetached() ? QMultiHash() : *this; // keep 'key'/'value' alive across the detach + detach(); + auto it = constFind(key, value); + return iterator(it.i, it.e); + } + template const_iterator constFindImpl(const K &key, const T &value) const noexcept + { + const_iterator i(constFind(key)); + const_iterator end(constEnd()); + while (i != end && i.key() == key) { + if (i.value() == value) + return i; + ++i; + } + return end; + } + +public: + iterator find(const Key &key, const T &value) + { + return findImpl(key, value); + } + + const_iterator constFind(const Key &key, const T &value) const noexcept + { + return constFindImpl(key, value); + } + const_iterator find(const Key &key, const T &value) const noexcept + { + return constFind(key, value); + } + + QMultiHash &unite(const QMultiHash &other) + { + if (isEmpty()) { + *this = other; + } else if (other.isEmpty()) { + ; + } else { + QMultiHash copy(other); + detach(); + for (auto cit = copy.cbegin(); cit != copy.cend(); ++cit) + insert(cit.key(), *cit); + } + return *this; + } + + QMultiHash &unite(const QHash &other) + { + for (auto cit = other.cbegin(); cit != other.cend(); ++cit) + insert(cit.key(), *cit); + return *this; + } + + QMultiHash &unite(QHash &&other) + { + if (!other.isDetached()) { + unite(other); + return *this; + } + auto it = other.d->begin(); + for (const auto end = other.d->end(); it != end; ++it) + emplace(std::move(it.node()->key), std::move(it.node()->takeValue())); + other.clear(); + return *this; + } + + std::pair equal_range(const Key &key) + { + return equal_range_impl(key); + } +private: + template std::pair equal_range_impl(const K &key) + { + const auto copy = isDetached() ? QMultiHash() : *this; // keep 'key' alive across the detach + detach(); + auto pair = std::as_const(*this).equal_range(key); + return {iterator(pair.first.i), iterator(pair.second.i)}; + } + +public: + std::pair equal_range(const Key &key) const noexcept + { + return equal_range_impl(key); + } +private: + template std::pair equal_range_impl(const K &key) const noexcept + { + if (!d) + return {end(), end()}; + + auto bucket = d->findBucket(key); + if (bucket.isUnused()) + return {end(), end()}; + auto it = bucket.toIterator(d); + auto end = it; + ++end; + return {const_iterator(it), const_iterator(end)}; + } + + void detach_helper() + { + if (!d) { + d = new Data; + return; + } + Data *dd = new Data(*d); + if (!d->ref.deref()) + delete d; + d = dd; + } + + template + iterator emplace_helper(Key &&key, Args &&...args) + { + auto result = d->findOrInsert(key); + if (!result.initialized) + Node::createInPlace(result.it.node(), std::move(key), std::forward(args)...); + else + result.it.node()->insertMulti(std::forward(args)...); + ++m_size; + return iterator(result.it); + } + + template + iterator emplaceReplace_helper(Key &&key, Args &&...args) + { + auto result = d->findOrInsert(key); + if (!result.initialized) { + Node::createInPlace(result.it.node(), std::move(key), std::forward(args)...); + ++m_size; + } else { + result.it.node()->emplaceValue(std::forward(args)...); + } + return iterator(result.it); + } + + template + using if_heterogeneously_searchable = QHashPrivate::if_heterogeneously_searchable_with; + + template + using if_key_constructible_from = std::enable_if_t, bool>; + +public: + template = true> + qsizetype remove(const K &key) + { + return removeImpl(key); + } + template = true> + T take(const K &key) + { + return takeImpl(key); + } + template = true> + bool contains(const K &key) const noexcept + { + if (!d) + return false; + return d->findNode(key) != nullptr; + } + template = true> + T value(const K &key) const noexcept + { + if (auto *v = valueImpl(key)) + return *v; + else + return T(); + } + template = true> + T value(const K &key, const T &defaultValue) const noexcept + { + if (auto *v = valueImpl(key)) + return *v; + else + return defaultValue; + } + template = true, if_key_constructible_from = true> + T &operator[](const K &key) + { + return operatorIndexImpl(key); + } + template = true> + const T operator[](const K &key) const noexcept + { + return value(key); + } + template = true> + QList values(const K &key) + { + return valuesImpl(key); + } + template = true> + iterator find(const K &key) + { + return findImpl(key); + } + template = true> + const_iterator constFind(const K &key) const noexcept + { + return constFindImpl(key); + } + template = true> + const_iterator find(const K &key) const noexcept + { + return constFindImpl(key); + } + template = true> + bool contains(const K &key, const T &value) const noexcept + { + return containsImpl(key, value); + } + template = true> + qsizetype remove(const K &key, const T &value) + { + return removeImpl(key, value); + } + template = true> + qsizetype count(const K &key) const noexcept + { + return countImpl(key); + } + template = true> + qsizetype count(const K &key, const T &value) const noexcept + { + return countImpl(key, value); + } + template = true> + iterator find(const K &key, const T &value) + { + return findImpl(key, value); + } + template = true> + const_iterator constFind(const K &key, const T &value) const noexcept + { + return constFindImpl(key, value); + } + template = true> + const_iterator find(const K &key, const T &value) const noexcept + { + return constFind(key, value); + } + template = true> + std::pair + equal_range(const K &key) + { + return equal_range_impl(key); + } + template = true> + std::pair + equal_range(const K &key) const noexcept + { + return equal_range_impl(key); + } +}; + +Q_DECLARE_ASSOCIATIVE_FORWARD_ITERATOR(Hash) +Q_DECLARE_MUTABLE_ASSOCIATIVE_FORWARD_ITERATOR(Hash) +Q_DECLARE_ASSOCIATIVE_FORWARD_ITERATOR(MultiHash) +Q_DECLARE_MUTABLE_ASSOCIATIVE_FORWARD_ITERATOR(MultiHash) + +template +size_t qHash(const QHash &key, size_t seed = 0) + noexcept(noexcept(qHash(std::declval())) && noexcept(qHash(std::declval()))) +{ + size_t hash = 0; + for (auto it = key.begin(), end = key.end(); it != end; ++it) { + QtPrivate::QHashCombine combine; + size_t h = combine(seed, it.key()); + // use + to keep the result independent of the ordering of the keys + hash += combine(h, it.value()); + } + return hash; +} + +template +inline size_t qHash(const QMultiHash &key, size_t seed = 0) + noexcept(noexcept(qHash(std::declval())) && noexcept(qHash(std::declval()))) +{ + size_t hash = 0; + for (auto it = key.begin(), end = key.end(); it != end; ++it) { + QtPrivate::QHashCombine combine; + size_t h = combine(seed, it.key()); + // use + to keep the result independent of the ordering of the keys + hash += combine(h, it.value()); + } + return hash; +} + +template +qsizetype erase_if(QHash &hash, Predicate pred) +{ + return QtPrivate::associative_erase_if(hash, pred); +} + +template +qsizetype erase_if(QMultiHash &hash, Predicate pred) +{ + return QtPrivate::associative_erase_if(hash, pred); +} + +QT_END_NAMESPACE + +#endif // QHASH_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qhashfunctions.h b/qt/6.8.1/msvc2022_64/include/QtCore/qhashfunctions.h new file mode 100644 index 0000000000000000000000000000000000000000..3a844c9103bc296bf87da0f9ccfbf70353eec495 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qhashfunctions.h @@ -0,0 +1,436 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz +// Copyright (C) 2024 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QHASHFUNCTIONS_H +#define QHASHFUNCTIONS_H + +#include +#include + +#include // for std::accumulate +#include // for std::hash +#include // For std::pair + +#if 0 +#pragma qt_class(QHashFunctions) +#endif + +#if defined(Q_CC_MSVC) +#pragma warning( push ) +#pragma warning( disable : 4311 ) // disable pointer truncation warning +#pragma warning( disable : 4127 ) // conditional expression is constant +#endif + +QT_BEGIN_NAMESPACE + +class QBitArray; + +#if QT_DEPRECATED_SINCE(6,6) +QT_DEPRECATED_VERSION_X_6_6("Use QHashSeed instead") +Q_CORE_EXPORT int qGlobalQHashSeed(); +QT_DEPRECATED_VERSION_X_6_6("Use QHashSeed instead") +Q_CORE_EXPORT void qSetGlobalQHashSeed(int newSeed); +#endif + +struct QHashSeed +{ + constexpr QHashSeed(size_t d = 0) : data(d) {} + constexpr operator size_t() const noexcept { return data; } + + static Q_CORE_EXPORT QHashSeed globalSeed() noexcept; + static Q_CORE_EXPORT void setDeterministicGlobalSeed(); + static Q_CORE_EXPORT void resetRandomGlobalSeed(); +private: + size_t data; +}; + +// Whether, ∀ t of type T && ∀ seed, qHash(Key(t), seed) == qHash(t, seed) +template struct QHashHeterogeneousSearch : std::false_type {}; + +// Specializations +template <> struct QHashHeterogeneousSearch : std::true_type {}; +template <> struct QHashHeterogeneousSearch : std::true_type {}; +template <> struct QHashHeterogeneousSearch : std::true_type {}; +template <> struct QHashHeterogeneousSearch : std::true_type {}; +#ifndef Q_PROCESSOR_ARM +template <> struct QHashHeterogeneousSearch : std::true_type {}; +template <> struct QHashHeterogeneousSearch : std::true_type {}; +template <> struct QHashHeterogeneousSearch : std::true_type {}; +template <> struct QHashHeterogeneousSearch : std::true_type {}; +#endif + +namespace QHashPrivate { + +Q_DECL_CONST_FUNCTION constexpr size_t hash(size_t key, size_t seed) noexcept +{ + key ^= seed; + if constexpr (sizeof(size_t) == 4) { + key ^= key >> 16; + key *= UINT32_C(0x45d9f3b); + key ^= key >> 16; + key *= UINT32_C(0x45d9f3b); + key ^= key >> 16; + return key; + } else { + quint64 key64 = key; + key64 ^= key64 >> 32; + key64 *= UINT64_C(0xd6e8feb86659fd93); + key64 ^= key64 >> 32; + key64 *= UINT64_C(0xd6e8feb86659fd93); + key64 ^= key64 >> 32; + return size_t(key64); + } +} + +template static constexpr bool noexceptPairHash(); +} + +Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHashBits(const void *p, size_t size, size_t seed = 0) noexcept; + +// implementation below qHashMulti +template inline size_t qHash(const std::pair &key, size_t seed = 0) + noexcept(QHashPrivate::noexceptPairHash()); + +// C++ builtin types +Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(char key, size_t seed = 0) noexcept +{ return QHashPrivate::hash(size_t(key), seed); } +Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(uchar key, size_t seed = 0) noexcept +{ return QHashPrivate::hash(size_t(key), seed); } +Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(signed char key, size_t seed = 0) noexcept +{ return QHashPrivate::hash(size_t(key), seed); } +Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(ushort key, size_t seed = 0) noexcept +{ return QHashPrivate::hash(size_t(key), seed); } +Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(short key, size_t seed = 0) noexcept +{ return QHashPrivate::hash(size_t(key), seed); } +Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(uint key, size_t seed = 0) noexcept +{ return QHashPrivate::hash(size_t(key), seed); } +Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(int key, size_t seed = 0) noexcept +{ return QHashPrivate::hash(size_t(key), seed); } +Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(ulong key, size_t seed = 0) noexcept +{ return QHashPrivate::hash(size_t(key), seed); } +Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(long key, size_t seed = 0) noexcept +{ return QHashPrivate::hash(size_t(key), seed); } +Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(quint64 key, size_t seed = 0) noexcept +{ + if constexpr (sizeof(quint64) > sizeof(size_t)) + key ^= (key >> 32); + return QHashPrivate::hash(size_t(key), seed); +} +Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(qint64 key, size_t seed = 0) noexcept +{ + if constexpr (sizeof(qint64) > sizeof(size_t)) { + // Avoid QTBUG-116080: we XOR the top half with its own sign bit: + // - if the qint64 is in range of qint32, then signmask ^ high == 0 + // (for Qt 7 only) + // - if the qint64 is in range of quint32, then signmask == 0 and we + // do the same as the quint64 overload above + quint32 high = quint32(quint64(key) >> 32); + quint32 low = quint32(quint64(key)); + quint32 signmask = qint32(high) >> 31; // all zeroes or all ones + signmask = QT_VERSION_MAJOR > 6 ? signmask : 0; + low ^= signmask ^ high; + return qHash(low, seed); + } + return qHash(quint64(key), seed); +} +#ifdef QT_SUPPORTS_INT128 +constexpr size_t qHash(quint128 key, size_t seed = 0) noexcept +{ + return qHash(quint64(key + (key >> 64)), seed); +} +constexpr size_t qHash(qint128 key, size_t seed = 0) noexcept +{ + // Avoid QTBUG-116080: same as above, but with double the sizes and without + // the need for compatibility + quint64 high = quint64(quint128(key) >> 64); + quint64 low = quint64(quint128(key)); + quint64 signmask = qint64(high) >> 63; // all zeroes or all ones + low += signmask ^ high; + return qHash(low, seed); +} +#endif // QT_SUPPORTS_INT128 +Q_DECL_CONST_FUNCTION inline size_t qHash(float key, size_t seed = 0) noexcept +{ + // ensure -0 gets mapped to 0 + key += 0.0f; + uint k; + memcpy(&k, &key, sizeof(float)); + return QHashPrivate::hash(k, seed); +} +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION size_t qHash(double key, size_t seed = 0) noexcept; +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION size_t qHash(long double key, size_t seed = 0) noexcept; +Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(wchar_t key, size_t seed = 0) noexcept +{ return QHashPrivate::hash(size_t(key), seed); } +Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(char16_t key, size_t seed = 0) noexcept +{ return QHashPrivate::hash(size_t(key), seed); } +Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(char32_t key, size_t seed = 0) noexcept +{ return QHashPrivate::hash(size_t(key), seed); } +#ifdef __cpp_char8_t +Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(char8_t key, size_t seed = 0) noexcept +{ return QHashPrivate::hash(size_t(key), seed); } +#endif +template inline size_t qHash(const T *key, size_t seed = 0) noexcept +{ + return qHash(reinterpret_cast(key), seed); +} +Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(std::nullptr_t, size_t seed = 0) noexcept +{ + return seed; +} +template , bool> = true> +Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(Enum e, size_t seed = 0) noexcept +{ return QHashPrivate::hash(qToUnderlying(e), seed); } + +// (some) Qt types +Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(const QChar key, size_t seed = 0) noexcept { return qHash(key.unicode(), seed); } + +#if QT_CORE_REMOVED_SINCE(6, 4) +Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(const QByteArray &key, size_t seed = 0) noexcept; +Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(const QByteArrayView &key, size_t seed = 0) noexcept; +#else +Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(QByteArrayView key, size_t seed = 0) noexcept; +inline Q_DECL_PURE_FUNCTION size_t qHash(const QByteArray &key, size_t seed = 0 + QT6_DECL_NEW_OVERLOAD_TAIL) noexcept +{ return qHash(qToByteArrayViewIgnoringNull(key), seed); } +#endif + +Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(QStringView key, size_t seed = 0) noexcept; +inline Q_DECL_PURE_FUNCTION size_t qHash(const QString &key, size_t seed = 0) noexcept +{ return qHash(QStringView{key}, seed); } +#ifndef QT_BOOTSTRAPPED +Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(const QBitArray &key, size_t seed = 0) noexcept; +#endif +Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(QLatin1StringView key, size_t seed = 0) noexcept; +Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(QKeyCombination key, size_t seed = 0) noexcept +{ return qHash(key.toCombined(), seed); } +Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qt_hash(QStringView key, uint chained = 0) noexcept; + +template +Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(QFlags flags, size_t seed = 0) noexcept +{ return qHash(flags.toInt(), seed); } + +// ### Qt 7: remove this "catch-all" overload logic, and require users +// to provide the two-argument version of qHash. +#if (QT_VERSION < QT_VERSION_CHECK(7, 0, 0)) +// Beware of moving this code from here. It needs to see all the +// declarations of qHash overloads for C++ fundamental types *before* +// its own declaration. +namespace QHashPrivate { +template +constexpr inline bool HasQHashSingleArgOverload = false; + +template +constexpr inline bool HasQHashSingleArgOverload())), size_t> +>> = true; +} + +// Add Args... to make this overload consistently a worse match than +// original 2-arg qHash overloads (QTBUG-126659) +template && sizeof...(Args) == 0 && !std::is_enum_v, bool> = true> +size_t qHash(const T &t, size_t seed, Args&&...) noexcept(noexcept(qHash(t))) +{ return qHash(t) ^ seed; } +#endif // < Qt 7 + +namespace QHashPrivate { + +namespace detail { +// approximates std::equality_comparable_with +template +struct is_equality_comparable_with : std::false_type {}; + +template +struct is_equality_comparable_with() == std::declval())), + decltype(bool(std::declval() == std::declval())), + decltype(bool(std::declval() != std::declval())), + decltype(bool(std::declval() != std::declval())) + >> + : std::true_type {}; +} + +template struct HeterogeneouslySearchableWithHelper + : std::conjunction< + // if Key and T are not the same (member already exists) + std::negation>, + // but are comparable amongst each other + detail::is_equality_comparable_with, + // and supports heteregenous hashing + QHashHeterogeneousSearch + > {}; + +template +using HeterogeneouslySearchableWith = HeterogeneouslySearchableWithHelper< + q20::remove_cvref_t, + q20::remove_cvref_t +>; + +template +using if_heterogeneously_searchable_with = std::enable_if_t< + QHashPrivate::HeterogeneouslySearchableWith::value, + bool>; + +} + +template +bool qHashEquals(const T &a, const T &b) +{ + return a == b; +} + +template = true> +bool qHashEquals(const T1 &a, const T2 &b) +{ + return a == b; +} + +namespace QtPrivate { + +struct QHashCombine +{ + typedef size_t result_type; + template + constexpr result_type operator()(size_t seed, const T &t) const noexcept(noexcept(qHash(t))) + // combiner taken from N3876 / boost::hash_combine + { return seed ^ (qHash(t) + 0x9e3779b9 + (seed << 6) + (seed >> 2)) ; } +}; + +struct QHashCombineCommutative +{ + // QHashCombine is a good hash combiner, but is not commutative, + // ie. it depends on the order of the input elements. That is + // usually what we want: {0,1,3} should hash differently than + // {1,3,0}. Except when it isn't (e.g. for QSet and + // QHash). Therefore, provide a commutative combiner, too. + typedef size_t result_type; + template + constexpr result_type operator()(size_t seed, const T &t) const noexcept(noexcept(qHash(t))) + { return seed + qHash(t); } // don't use xor! +}; + +template +using QHashMultiReturnType = decltype( + std::declval< std::enable_if_t<(sizeof...(T) > 0)> >(), + (qHash(std::declval()), ...), + size_t{} +); + +// workaround for a MSVC ICE, +// https://developercommunity.visualstudio.com/content/problem/996540/internal-compiler-error-on-msvc-1924-when-doing-sf.html +template +inline constexpr bool QNothrowHashableHelper_v = noexcept(qHash(std::declval())); + +template +struct QNothrowHashable : std::false_type {}; + +template +struct QNothrowHashable>> : std::true_type {}; + +template +constexpr inline bool QNothrowHashable_v = QNothrowHashable::value; + +} // namespace QtPrivate + +template +constexpr +#ifdef Q_QDOC +size_t +#else +QtPrivate::QHashMultiReturnType +#endif +qHashMulti(size_t seed, const T &... args) + noexcept(std::conjunction_v...>) +{ + QtPrivate::QHashCombine hash; + return ((seed = hash(seed, args)), ...), seed; +} + +template +constexpr +#ifdef Q_QDOC +size_t +#else +QtPrivate::QHashMultiReturnType +#endif +qHashMultiCommutative(size_t seed, const T &... args) + noexcept(std::conjunction_v...>) +{ + QtPrivate::QHashCombineCommutative hash; + return ((seed = hash(seed, args)), ...), seed; +} + +template +inline size_t qHashRange(InputIterator first, InputIterator last, size_t seed = 0) + noexcept(noexcept(qHash(*first))) // assume iterator operations don't throw +{ + return std::accumulate(first, last, seed, QtPrivate::QHashCombine()); +} + +template +inline size_t qHashRangeCommutative(InputIterator first, InputIterator last, size_t seed = 0) + noexcept(noexcept(qHash(*first))) // assume iterator operations don't throw +{ + return std::accumulate(first, last, seed, QtPrivate::QHashCombineCommutative()); +} + +namespace QHashPrivate { +template static constexpr bool noexceptPairHash() +{ + size_t seed = 0; + return noexcept(qHash(std::declval(), seed)) && noexcept(qHash(std::declval(), seed)); +} +} // QHashPrivate + +template inline size_t qHash(const std::pair &key, size_t seed) + noexcept(QHashPrivate::noexceptPairHash()) +{ + return qHashMulti(seed, key.first, key.second); +} + +#define QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH(Class, Arguments) \ + QT_BEGIN_INCLUDE_NAMESPACE \ + namespace std { \ + template <> \ + struct hash< QT_PREPEND_NAMESPACE(Class) > { \ + using argument_type = QT_PREPEND_NAMESPACE(Class); \ + using result_type = size_t; \ + size_t operator()(Arguments s) const \ + noexcept(QT_PREPEND_NAMESPACE( \ + QtPrivate::QNothrowHashable_v)) \ + { \ + /* this seeds qHash with the result of */ \ + /* std::hash applied to an int, to reap */ \ + /* any protection against predictable hash */ \ + /* values the std implementation may provide */ \ + using QT_PREPEND_NAMESPACE(qHash); \ + return qHash(s, qHash(std::hash{}(0))); \ + } \ + }; \ + } \ + QT_END_INCLUDE_NAMESPACE \ + /*end*/ + +#define QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH_BY_CREF(Class) \ + QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH(Class, const argument_type &) +#define QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH_BY_VALUE(Class) \ + QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH(Class, argument_type) + +QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH_BY_CREF(QString) +QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH_BY_VALUE(QStringView) +QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH_BY_VALUE(QLatin1StringView) +QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH_BY_VALUE(QByteArrayView) +QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH_BY_CREF(QByteArray) +#ifndef QT_BOOTSTRAPPED +QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH_BY_CREF(QBitArray) +#endif + +QT_END_NAMESPACE + +#if defined(Q_CC_MSVC) +#pragma warning( pop ) +#endif + +#endif // QHASHFUNCTIONS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qidentityproxymodel.h b/qt/6.8.1/msvc2022_64/include/QtCore/qidentityproxymodel.h new file mode 100644 index 0000000000000000000000000000000000000000..23e0eff3a794babf87fb26daf4b33339adb1dc48 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qidentityproxymodel.h @@ -0,0 +1,63 @@ +// Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + + +#ifndef QIDENTITYPROXYMODEL_H +#define QIDENTITYPROXYMODEL_H + +#include + +QT_REQUIRE_CONFIG(identityproxymodel); + +QT_BEGIN_NAMESPACE + + +class QIdentityProxyModelPrivate; + +class Q_CORE_EXPORT QIdentityProxyModel : public QAbstractProxyModel +{ + Q_OBJECT +public: + explicit QIdentityProxyModel(QObject* parent = nullptr); + ~QIdentityProxyModel(); + + int columnCount(const QModelIndex& parent = QModelIndex()) const override; + QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override; + QModelIndex mapFromSource(const QModelIndex& sourceIndex) const override; + QModelIndex mapToSource(const QModelIndex& proxyIndex) const override; + QModelIndex parent(const QModelIndex& child) const override; + using QObject::parent; + int rowCount(const QModelIndex& parent = QModelIndex()) const override; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override; + QModelIndex sibling(int row, int column, const QModelIndex &idx) const override; + + QItemSelection mapSelectionFromSource(const QItemSelection& selection) const override; + QItemSelection mapSelectionToSource(const QItemSelection& selection) const override; + QModelIndexList match(const QModelIndex& start, int role, const QVariant& value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const override; + void setSourceModel(QAbstractItemModel* sourceModel) override; + + bool insertColumns(int column, int count, const QModelIndex& parent = QModelIndex()) override; + bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex()) override; + bool removeColumns(int column, int count, const QModelIndex& parent = QModelIndex()) override; + bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override; + bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override; + bool moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild) override; + + bool handleSourceLayoutChanges() const; + bool handleSourceDataChanges() const; + +protected: + QIdentityProxyModel(QIdentityProxyModelPrivate &dd, QObject* parent); + void setHandleSourceLayoutChanges(bool); + void setHandleSourceDataChanges(bool); + +private: + Q_DECLARE_PRIVATE(QIdentityProxyModel) + Q_DISABLE_COPY(QIdentityProxyModel) +}; + +QT_END_NAMESPACE + +#endif // QIDENTITYPROXYMODEL_H + diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qiodevice.h b/qt/6.8.1/msvc2022_64/include/QtCore/qiodevice.h new file mode 100644 index 0000000000000000000000000000000000000000..d21a9d374123c0b75796ddbaf3b3a89c356c83e4 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qiodevice.h @@ -0,0 +1,148 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QIODEVICE_H +#define QIODEVICE_H + +#include +#include +#ifndef QT_NO_QOBJECT +#include +#else +#include +#include +#endif +#include + +#ifdef open +#error qiodevice.h must be included before any header file that defines open +#endif + +QT_BEGIN_NAMESPACE + + +class QByteArray; +class QIODevicePrivate; + +class Q_CORE_EXPORT QIODevice +#ifndef QT_NO_QOBJECT + : public QObject, +#else + : +#endif + public QIODeviceBase +{ +#ifndef QT_NO_QOBJECT + Q_OBJECT +#endif +public: + QIODevice(); +#ifndef QT_NO_QOBJECT + explicit QIODevice(QObject *parent); +#endif + virtual ~QIODevice(); + + QIODeviceBase::OpenMode openMode() const; + + void setTextModeEnabled(bool enabled); + bool isTextModeEnabled() const; + + bool isOpen() const; + bool isReadable() const; + bool isWritable() const; + virtual bool isSequential() const; + + int readChannelCount() const; + int writeChannelCount() const; + int currentReadChannel() const; + void setCurrentReadChannel(int channel); + int currentWriteChannel() const; + void setCurrentWriteChannel(int channel); + + virtual bool open(QIODeviceBase::OpenMode mode); + virtual void close(); + + // ### Qt 7 - QTBUG-76492: pos() and seek() should not be virtual, and + // ### seek() should call a virtual seekData() function. + virtual qint64 pos() const; + virtual qint64 size() const; + virtual bool seek(qint64 pos); + virtual bool atEnd() const; + virtual bool reset(); + + virtual qint64 bytesAvailable() const; + virtual qint64 bytesToWrite() const; + + qint64 read(char *data, qint64 maxlen); + QByteArray read(qint64 maxlen); + QByteArray readAll(); + qint64 readLine(char *data, qint64 maxlen); + QByteArray readLine(qint64 maxlen = 0); + virtual bool canReadLine() const; + + void startTransaction(); + void commitTransaction(); + void rollbackTransaction(); + bool isTransactionStarted() const; + + qint64 write(const char *data, qint64 len); + qint64 write(const char *data); + qint64 write(const QByteArray &data); + + qint64 peek(char *data, qint64 maxlen); + QByteArray peek(qint64 maxlen); + qint64 skip(qint64 maxSize); + + virtual bool waitForReadyRead(int msecs); + virtual bool waitForBytesWritten(int msecs); + + void ungetChar(char c); + bool putChar(char c); + bool getChar(char *c); + + QString errorString() const; + +#ifndef QT_NO_QOBJECT +Q_SIGNALS: + void readyRead(); + void channelReadyRead(int channel); + void bytesWritten(qint64 bytes); + void channelBytesWritten(int channel, qint64 bytes); + void aboutToClose(); + void readChannelFinished(); +#endif + +protected: +#ifdef QT_NO_QOBJECT + QIODevice(QIODevicePrivate &dd); +#else + QIODevice(QIODevicePrivate &dd, QObject *parent = nullptr); +#endif + virtual qint64 readData(char *data, qint64 maxlen) = 0; + virtual qint64 readLineData(char *data, qint64 maxlen); + virtual qint64 skipData(qint64 maxSize); + virtual qint64 writeData(const char *data, qint64 len) = 0; + + void setOpenMode(QIODeviceBase::OpenMode openMode); + + void setErrorString(const QString &errorString); + +#ifdef QT_NO_QOBJECT + QScopedPointer d_ptr; +#endif + +private: + Q_DECLARE_PRIVATE(QIODevice) + Q_DISABLE_COPY(QIODevice) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QIODevice::OpenMode) + +#if !defined(QT_NO_DEBUG_STREAM) +class QDebug; +Q_CORE_EXPORT QDebug operator<<(QDebug debug, QIODevice::OpenMode modes); +#endif + +QT_END_NAMESPACE + +#endif // QIODEVICE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qiodevicebase.h b/qt/6.8.1/msvc2022_64/include/QtCore/qiodevicebase.h new file mode 100644 index 0000000000000000000000000000000000000000..55fda6da4b05f55c14a7e817698a5f8684818016 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qiodevicebase.h @@ -0,0 +1,33 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QIODEVICEBASE_H +#define QIODEVICEBASE_H + +#include + +QT_BEGIN_NAMESPACE + +class QIODeviceBase +{ +protected: + ~QIODeviceBase() = default; +public: + enum OpenModeFlag { + NotOpen = 0x0000, + ReadOnly = 0x0001, + WriteOnly = 0x0002, + ReadWrite = ReadOnly | WriteOnly, + Append = 0x0004, + Truncate = 0x0008, + Text = 0x0010, + Unbuffered = 0x0020, + NewOnly = 0x0040, + ExistingOnly = 0x0080 + }; + Q_DECLARE_FLAGS(OpenMode, OpenModeFlag) +}; + +QT_END_NAMESPACE + +#endif // QIODEVICEBASE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qitemselectionmodel.h b/qt/6.8.1/msvc2022_64/include/QtCore/qitemselectionmodel.h new file mode 100644 index 0000000000000000000000000000000000000000..8395285f7256ad6775fd3ff7a902a6270ea1d7b8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qitemselectionmodel.h @@ -0,0 +1,207 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QITEMSELECTIONMODEL_H +#define QITEMSELECTIONMODEL_H + +#include + +#include +#include +#include + +QT_REQUIRE_CONFIG(itemmodel); + +QT_BEGIN_NAMESPACE + +class Q_CORE_EXPORT QItemSelectionRange +{ + +public: + QItemSelectionRange() = default; + QItemSelectionRange(const QModelIndex &topL, const QModelIndex &bottomR) : tl(topL), br(bottomR) {} + explicit QItemSelectionRange(const QModelIndex &index) : tl(index), br(tl) {} + + void swap(QItemSelectionRange &other) noexcept + { + tl.swap(other.tl); + br.swap(other.br); + } + + inline int top() const { return tl.row(); } + inline int left() const { return tl.column(); } + inline int bottom() const { return br.row(); } + inline int right() const { return br.column(); } + inline int width() const { return br.column() - tl.column() + 1; } + inline int height() const { return br.row() - tl.row() + 1; } + + inline const QPersistentModelIndex &topLeft() const { return tl; } + inline const QPersistentModelIndex &bottomRight() const { return br; } + inline QModelIndex parent() const { return tl.parent(); } + inline const QAbstractItemModel *model() const { return tl.model(); } + + inline bool contains(const QModelIndex &index) const + { + return (parent() == index.parent() + && tl.row() <= index.row() && tl.column() <= index.column() + && br.row() >= index.row() && br.column() >= index.column()); + } + + inline bool contains(int row, int column, const QModelIndex &parentIndex) const + { + return (parent() == parentIndex + && tl.row() <= row && tl.column() <= column + && br.row() >= row && br.column() >= column); + } + + bool intersects(const QItemSelectionRange &other) const; + QItemSelectionRange intersected(const QItemSelectionRange &other) const; + +#if QT_CORE_REMOVED_SINCE(6, 8) + inline bool operator==(const QItemSelectionRange &other) const + { return comparesEqual(*this, other); } + inline bool operator!=(const QItemSelectionRange &other) const + { return !operator==(other); } +#endif + inline bool isValid() const + { + return (tl.isValid() && br.isValid() && tl.parent() == br.parent() + && top() <= bottom() && left() <= right()); + } + + bool isEmpty() const; + + QModelIndexList indexes() const; + +private: + friend bool comparesEqual(const QItemSelectionRange &lhs, + const QItemSelectionRange &rhs) noexcept + { + return comparesEqual(lhs.tl, rhs.tl) && comparesEqual(lhs.br, rhs.br); + } + Q_DECLARE_EQUALITY_COMPARABLE(QItemSelectionRange) + QPersistentModelIndex tl, br; +}; +Q_DECLARE_TYPEINFO(QItemSelectionRange, Q_RELOCATABLE_TYPE); + +class QItemSelection; +class QItemSelectionModelPrivate; + +class Q_CORE_EXPORT QItemSelectionModel : public QObject +{ + Q_OBJECT + Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelChanged + BINDABLE bindableModel) + Q_PROPERTY(bool hasSelection READ hasSelection NOTIFY selectionChanged STORED false + DESIGNABLE false) + Q_PROPERTY(QModelIndex currentIndex READ currentIndex NOTIFY currentChanged STORED false + DESIGNABLE false) + Q_PROPERTY(QItemSelection selection READ selection NOTIFY selectionChanged STORED false + DESIGNABLE false) + Q_PROPERTY(QModelIndexList selectedIndexes READ selectedIndexes NOTIFY selectionChanged + STORED false DESIGNABLE false) + + Q_DECLARE_PRIVATE(QItemSelectionModel) + +public: + + enum SelectionFlag { + NoUpdate = 0x0000, + Clear = 0x0001, + Select = 0x0002, + Deselect = 0x0004, + Toggle = 0x0008, + Current = 0x0010, + Rows = 0x0020, + Columns = 0x0040, + SelectCurrent = Select | Current, + ToggleCurrent = Toggle | Current, + ClearAndSelect = Clear | Select + }; + + Q_DECLARE_FLAGS(SelectionFlags, SelectionFlag) + Q_FLAG(SelectionFlags) + + explicit QItemSelectionModel(QAbstractItemModel *model = nullptr); + explicit QItemSelectionModel(QAbstractItemModel *model, QObject *parent); + virtual ~QItemSelectionModel(); + + QModelIndex currentIndex() const; + + Q_INVOKABLE bool isSelected(const QModelIndex &index) const; + Q_INVOKABLE bool isRowSelected(int row, const QModelIndex &parent = QModelIndex()) const; + Q_INVOKABLE bool isColumnSelected(int column, const QModelIndex &parent = QModelIndex()) const; + + Q_INVOKABLE bool rowIntersectsSelection(int row, const QModelIndex &parent = QModelIndex()) const; + Q_INVOKABLE bool columnIntersectsSelection(int column, const QModelIndex &parent = QModelIndex()) const; + + bool hasSelection() const; + + QModelIndexList selectedIndexes() const; + Q_INVOKABLE QModelIndexList selectedRows(int column = 0) const; + Q_INVOKABLE QModelIndexList selectedColumns(int row = 0) const; + const QItemSelection selection() const; + + const QAbstractItemModel *model() const; + QAbstractItemModel *model(); + QBindable bindableModel(); + + void setModel(QAbstractItemModel *model); + +public Q_SLOTS: + virtual void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command); + virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command); + virtual void select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command); + virtual void clear(); + virtual void reset(); + + void clearSelection(); + virtual void clearCurrentIndex(); + +Q_SIGNALS: + void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); + void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); + void currentRowChanged(const QModelIndex ¤t, const QModelIndex &previous); + void currentColumnChanged(const QModelIndex ¤t, const QModelIndex &previous); + void modelChanged(QAbstractItemModel *model); + +protected: + QItemSelectionModel(QItemSelectionModelPrivate &dd, QAbstractItemModel *model); + void emitSelectionChanged(const QItemSelection &newSelection, const QItemSelection &oldSelection); + +private: + Q_DISABLE_COPY(QItemSelectionModel) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QItemSelectionModel::SelectionFlags) + +// We export each out-of-line method individually to prevent MSVC from +// exporting the whole QList class. +class QItemSelection : public QList +{ +public: + using QList::QList; + Q_CORE_EXPORT QItemSelection(const QModelIndex &topLeft, const QModelIndex &bottomRight); + + // reusing QList::swap() here is OK! + + Q_CORE_EXPORT void select(const QModelIndex &topLeft, const QModelIndex &bottomRight); + Q_CORE_EXPORT bool contains(const QModelIndex &index) const; + Q_CORE_EXPORT QModelIndexList indexes() const; + Q_CORE_EXPORT void merge(const QItemSelection &other, QItemSelectionModel::SelectionFlags command); + Q_CORE_EXPORT static void split(const QItemSelectionRange &range, + const QItemSelectionRange &other, + QItemSelection *result); +}; +Q_DECLARE_SHARED(QItemSelection) + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QItemSelectionRange &); +#endif + +QT_END_NAMESPACE + +QT_DECL_METATYPE_EXTERN(QItemSelectionRange, Q_CORE_EXPORT) +QT_DECL_METATYPE_EXTERN(QItemSelection, Q_CORE_EXPORT) + +#endif // QITEMSELECTIONMODEL_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qiterable.h b/qt/6.8.1/msvc2022_64/include/QtCore/qiterable.h new file mode 100644 index 0000000000000000000000000000000000000000..af236885bfee61bf6d1cece20b21ada727c5afd4 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qiterable.h @@ -0,0 +1,516 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QITERABLE_H +#define QITERABLE_H + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtPrivate { + template + class QConstPreservingPointer + { + enum Tag : bool { Const, Mutable }; + QTaggedPointer m_pointer; + + public: + Q_NODISCARD_CTOR QConstPreservingPointer(std::nullptr_t) : m_pointer(nullptr, Const) {} + + Q_NODISCARD_CTOR QConstPreservingPointer(const void *pointer, qsizetype alignment) + : m_pointer(reinterpret_cast(const_cast(pointer)), Const) + { + Q_UNUSED(alignment); + Q_ASSERT(alignment > qsizetype(alignof(Storage))); + } + + Q_NODISCARD_CTOR QConstPreservingPointer(void *pointer, qsizetype alignment) + : m_pointer(reinterpret_cast(pointer), Mutable) + { + Q_UNUSED(alignment); + Q_ASSERT(alignment > qsizetype(alignof(Storage))); + } + + template + Q_NODISCARD_CTOR QConstPreservingPointer(const InputType *pointer) + : m_pointer(reinterpret_cast(const_cast(pointer)), Const) + { + static_assert(alignof(InputType) >= alignof(Storage)); + } + + template + Q_NODISCARD_CTOR QConstPreservingPointer(InputType *pointer) + : m_pointer(reinterpret_cast(pointer), Mutable) + { + static_assert(alignof(InputType) >= alignof(Storage)); + } + + Q_NODISCARD_CTOR QConstPreservingPointer() = default; + + const Type *constPointer() const + { + return reinterpret_cast(m_pointer.data()); + } + + Type *mutablePointer() const + { + return m_pointer.tag() == Mutable ? reinterpret_cast(m_pointer.data()) : nullptr; + } + }; +} + +template +class QTaggedIterator : public Iterator +{ +public: + using iterator_category = IteratorCategory; + QTaggedIterator(Iterator &&it) : Iterator(std::move(it)) + { + const QMetaContainer metaContainer = this->metaContainer(); + if constexpr (std::is_base_of_v) { + if (!metaContainer.hasRandomAccessIterator()) { + qFatal("You cannot use this iterator as a random access iterator"); + this->clearIterator(); + } + } + + if constexpr (std::is_base_of_v) { + if (!metaContainer.hasBidirectionalIterator()) { + qFatal("You cannot use this iterator as a bidirectional iterator"); + this->clearIterator(); + } + } + + if constexpr (std::is_base_of_v) { + if (!metaContainer.hasForwardIterator()) { + qFatal("You cannot use this iterator as a forward iterator"); + this->clearIterator(); + } + } + + if constexpr (std::is_base_of_v) { + if (!metaContainer.hasInputIterator()) { + qFatal("You cannot use this iterator as an input iterator"); + this->clearIterator(); + } + } + } + + bool operator==(const QTaggedIterator &o) const { return Iterator::operator==(o); } + bool operator!=(const QTaggedIterator &o) const { return Iterator::operator!=(o); } + QTaggedIterator &operator++() { Iterator::operator++(); return *this; } + QTaggedIterator operator++(int x) { return QTaggedIterator(Iterator::operator++(x)); } + QTaggedIterator &operator--() { Iterator::operator--(); return *this; } + QTaggedIterator operator--(int x) { return QTaggedIterator(Iterator::operator--(x)); } + QTaggedIterator &operator+=(qsizetype j) { Iterator::operator+=(j); return *this; } + QTaggedIterator &operator-=(qsizetype j) { Iterator::operator-=(j); return *this; } + QTaggedIterator operator+(qsizetype j) const { return QTaggedIterator(Iterator::operator+(j)); } + QTaggedIterator operator-(qsizetype j) const { return QTaggedIterator(Iterator::operator-(j)); } + qsizetype operator-(const QTaggedIterator &j) const { return Iterator::operator-(j); } + + bool operator<(const QTaggedIterator &j) { return operator-(j) < 0; } + bool operator>=(const QTaggedIterator &j) { return !operator<(j); } + bool operator>(const QTaggedIterator &j) { return operator-(j) > 0; } + bool operator<=(const QTaggedIterator &j) { return !operator>(j); } + + friend inline QTaggedIterator operator+(qsizetype j, const QTaggedIterator &k) { return k + j; } +}; + +template +class QIterable; + +template +class QBaseIterator +{ +private: + QtPrivate::QConstPreservingPointer> m_iterable; + void *m_iterator = nullptr; + +protected: + QBaseIterator() = default; + QBaseIterator(const QIterable *iterable, void *iterator) + : m_iterable(iterable), m_iterator(iterator) + {} + + QBaseIterator(QIterable *iterable, void *iterator) + : m_iterable(iterable), m_iterator(iterator) + {} + + QBaseIterator(QBaseIterator &&other) + : m_iterable(std::move(other.m_iterable)), m_iterator(std::move(other.m_iterator)) + { + other.m_iterator = nullptr; + } + + QBaseIterator(const QBaseIterator &other) + : m_iterable(other.m_iterable) + { + initIterator(other.m_iterator); + } + + ~QBaseIterator() { clearIterator(); } + + QBaseIterator &operator=(QBaseIterator &&other) + { + if (this != &other) { + clearIterator(); + m_iterable = std::move(other.m_iterable); + m_iterator = std::move(other.m_iterator); + other.m_iterator = nullptr; + } + return *this; + } + + QBaseIterator &operator=(const QBaseIterator &other) + { + if (this != &other) { + clearIterator(); + m_iterable = other.m_iterable; + initIterator(other.m_iterator); + } + return *this; + } + + QIterable *mutableIterable() const + { + return m_iterable.mutablePointer(); + } + + const QIterable *constIterable() const + { + return m_iterable.constPointer(); + } + + void initIterator(const void *copy) + { + if (!copy) + return; + if (auto *mutableIt = mutableIterable()) { + m_iterator = metaContainer().begin(mutableIt->mutableIterable()); + metaContainer().copyIterator(m_iterator, copy); + } else if (auto *constIt = constIterable()) { + m_iterator = metaContainer().constBegin(constIt->constIterable()); + metaContainer().copyConstIterator(m_iterator, copy); + } + } + + void clearIterator() + { + if (!m_iterator) + return; + if (mutableIterable()) + metaContainer().destroyIterator(m_iterator); + else + metaContainer().destroyConstIterator(m_iterator); + } + +public: + void *mutableIterator() { return m_iterator; } + const void *constIterator() const { return m_iterator; } + Container metaContainer() const { return constIterable()->m_metaContainer; } +}; + +template +struct QIterator : public QBaseIterator +{ +public: + using difference_type = qsizetype; + + explicit QIterator(QIterable *iterable, void *iterator) + : QBaseIterator(iterable, iterator) + { + Q_ASSERT(iterable != nullptr); + } + + bool operator==(const QIterator &o) const + { + return this->metaContainer().compareIterator(this->constIterator(), o.constIterator()); + } + + bool operator!=(const QIterator &o) const + { + return !this->metaContainer().compareIterator(this->constIterator(), o.constIterator()); + } + + QIterator &operator++() + { + this->metaContainer().advanceIterator(this->mutableIterator(), 1); + return *this; + } + + QIterator operator++(int) + { + QIterable *iterable = this->mutableIterable(); + const Container metaContainer = this->metaContainer(); + QIterator result(iterable, metaContainer.begin(iterable->mutableIterable())); + metaContainer.copyIterator(result.mutableIterator(), this->constIterator()); + metaContainer.advanceIterator(this->mutableIterator(), 1); + return result; + } + + QIterator &operator--() + { + this->metaContainer().advanceIterator(this->mutableIterator(), -1); + return *this; + } + + QIterator operator--(int) + { + QIterable *iterable = this->mutableIterable(); + const Container metaContainer = this->metaContainer(); + QIterator result(iterable, metaContainer.begin(iterable->mutableIterable())); + metaContainer.copyIterator(result.mutableIterator(), this->constIterator()); + metaContainer.advanceIterator(this->mutableIterator(), -1); + return result; + } + + QIterator &operator+=(qsizetype j) + { + this->metaContainer().advanceIterator(this->mutableIterator(), j); + return *this; + } + + QIterator &operator-=(qsizetype j) + { + this->metaContainer().advanceIterator(this->mutableIterator(), -j); + return *this; + } + + QIterator operator+(qsizetype j) const + { + QIterable *iterable = this->mutableIterable(); + const Container metaContainer = this->metaContainer(); + QIterator result(iterable, metaContainer.begin(iterable->mutableIterable())); + metaContainer.copyIterator(result.mutableIterator(), this->constIterator()); + metaContainer.advanceIterator(result.mutableIterator(), j); + return result; + } + + QIterator operator-(qsizetype j) const + { + QIterable *iterable = this->mutableIterable(); + const Container metaContainer = this->metaContainer(); + QIterator result(iterable, metaContainer.begin(iterable->mutableIterable())); + metaContainer.copyIterator(result.mutableIterator(), this->constIterator()); + metaContainer.advanceIterator(result.mutableIterator(), -j); + return result; + } + + qsizetype operator-(const QIterator &j) const + { + return this->metaContainer().diffIterator(this->constIterator(), j.constIterator()); + } + + friend inline QIterator operator+(qsizetype j, const QIterator &k) { return k + j; } +}; + +template +struct QConstIterator : public QBaseIterator +{ +public: + using difference_type = qsizetype; + + explicit QConstIterator(const QIterable *iterable, void *iterator) + : QBaseIterator(iterable, iterator) + { + } + + bool operator==(const QConstIterator &o) const + { + return this->metaContainer().compareConstIterator( + this->constIterator(), o.constIterator()); + } + + bool operator!=(const QConstIterator &o) const + { + return !this->metaContainer().compareConstIterator( + this->constIterator(), o.constIterator()); + } + + QConstIterator &operator++() + { + this->metaContainer().advanceConstIterator(this->mutableIterator(), 1); + return *this; + } + + QConstIterator operator++(int) + { + const Container metaContainer = this->metaContainer(); + QConstIterator result(this->constIterable(), metaContainer.constBegin( + this->constIterable()->constIterable())); + metaContainer.copyConstIterator(result.mutableIterator(), this->constIterator()); + metaContainer.advanceConstIterator(this->mutableIterator(), 1); + return result; + } + + QConstIterator &operator--() + { + this->metaContainer().advanceConstIterator(this->mutableIterator(), -1); + return *this; + } + + QConstIterator operator--(int) + { + const Container metaContainer = this->metaContainer(); + QConstIterator result(this->constIterable(), metaContainer.constBegin( + this->constIterable()->constIterable())); + metaContainer.copyConstIterator(result.mutableIterator(), this->constIterator()); + metaContainer.advanceConstIterator(this->mutableIterator(), -1); + return result; + } + + QConstIterator &operator+=(qsizetype j) + { + this->metaContainer().advanceConstIterator(this->mutableIterator(), j); + return *this; + } + + QConstIterator &operator-=(qsizetype j) + { + this->metaContainer().advanceConstIterator(this->mutableIterator(), -j); + return *this; + } + + QConstIterator operator+(qsizetype j) const + { + const Container metaContainer = this->metaContainer(); + QConstIterator result( + this->constIterable(), + metaContainer.constBegin(this->constIterable()->constIterable())); + metaContainer.copyConstIterator(result.mutableIterator(), this->constIterator()); + metaContainer.advanceConstIterator(result.mutableIterator(), j); + return result; + } + + QConstIterator operator-(qsizetype j) const + { + const Container metaContainer = this->metaContainer(); + QConstIterator result(this->constIterable(), metaContainer.constBegin( + this->constIterable()->constIterable())); + metaContainer.copyConstIterator(result.mutableIterator(), this->constIterator()); + metaContainer.advanceConstIterator(result.mutableIterator(), -j); + return result; + } + + qsizetype operator-(const QConstIterator &j) const + { + return this->metaContainer().diffIterator(this->constIterator(), j.constIterator()); + } + + friend inline QConstIterator operator+(qsizetype j, const QConstIterator &k) + { + return k + j; + } +}; + +template +class QIterable +{ + friend class QBaseIterator; + +protected: + uint m_revision = 0; + QtPrivate::QConstPreservingPointer m_iterable; + Container m_metaContainer; + +public: + template + QIterable(const Container &metaContainer, const T *p) + : m_iterable(p), m_metaContainer(metaContainer) + { + } + + template + QIterable(const Container &metaContainer, T *p) + : m_iterable(p), m_metaContainer(metaContainer) + { + } + + template + QIterable(const Container &metaContainer, Pointer iterable) + : m_iterable(iterable), m_metaContainer(metaContainer) + { + } + + QIterable(const Container &metaContainer, qsizetype alignment, const void *p) + : m_iterable(p, alignment), m_metaContainer(metaContainer) + { + } + + QIterable(const Container &metaContainer, qsizetype alignment, void *p) + : m_iterable(p, alignment), m_metaContainer(metaContainer) + { + } + + bool canInputIterate() const + { + return m_metaContainer.hasInputIterator(); + } + + bool canForwardIterate() const + { + return m_metaContainer.hasForwardIterator(); + } + + bool canReverseIterate() const + { + return m_metaContainer.hasBidirectionalIterator(); + } + + bool canRandomAccessIterate() const + { + return m_metaContainer.hasRandomAccessIterator(); + } + + const void *constIterable() const { return m_iterable.constPointer(); } + void *mutableIterable() { return m_iterable.mutablePointer(); } + + QConstIterator constBegin() const + { + return QConstIterator(this, m_metaContainer.constBegin(constIterable())); + } + + QConstIterator constEnd() const + { + return QConstIterator(this, m_metaContainer.constEnd(constIterable())); + } + + QIterator mutableBegin() + { + return QIterator(this, m_metaContainer.begin(mutableIterable())); + } + + QIterator mutableEnd() + { + return QIterator(this, m_metaContainer.end(mutableIterable())); + } + + qsizetype size() const + { + const void *container = constIterable(); + if (m_metaContainer.hasSize()) + return m_metaContainer.size(container); + if (!m_metaContainer.hasConstIterator()) + return -1; + + const void *begin = m_metaContainer.constBegin(container); + const void *end = m_metaContainer.constEnd(container); + const qsizetype size = m_metaContainer.diffConstIterator(end, begin); + m_metaContainer.destroyConstIterator(begin); + m_metaContainer.destroyConstIterator(end); + return size; + } + + Container metaContainer() const + { + return m_metaContainer; + } +}; + +QT_END_NAMESPACE + +#endif // QITERABLE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qiterator.h b/qt/6.8.1/msvc2022_64/include/QtCore/qiterator.h new file mode 100644 index 0000000000000000000000000000000000000000..745467cc76cf66bdbc89c2fbc340555e62655720 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qiterator.h @@ -0,0 +1,319 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QITERATOR_H +#define QITERATOR_H + +#include +#include + +QT_BEGIN_NAMESPACE + +#if !defined(QT_NO_JAVA_STYLE_ITERATORS) + +#ifdef Q_QDOC +#define Q_DISABLE_BACKWARD_ITERATOR +#else +#define Q_DISABLE_BACKWARD_ITERATOR \ + template = true> +#endif + +#define Q_DECLARE_SEQUENTIAL_ITERATOR(C) \ +\ +template \ +class Q##C##Iterator \ +{ \ + typedef typename Q##C::const_iterator const_iterator; \ + Q##C c; \ + const_iterator i; \ +public: \ + inline Q##C##Iterator(const Q##C &container) \ + : c(container), i(c.constBegin()) {} \ + inline Q##C##Iterator &operator=(const Q##C &container) \ + { c = container; i = c.constBegin(); return *this; } \ + inline void toFront() { i = c.constBegin(); } \ + inline void toBack() { i = c.constEnd(); } \ + inline bool hasNext() const { return i != c.constEnd(); } \ + inline const T &next() { return *i++; } \ + inline const T &peekNext() const { return *i; } \ + Q_DISABLE_BACKWARD_ITERATOR \ + inline bool hasPrevious() const { return i != c.constBegin(); } \ + Q_DISABLE_BACKWARD_ITERATOR \ + inline const T &previous() { return *--i; } \ + Q_DISABLE_BACKWARD_ITERATOR \ + inline const T &peekPrevious() const { const_iterator p = i; return *--p; } \ + inline bool findNext(const T &t) \ + { while (i != c.constEnd()) if (*i++ == t) return true; return false; } \ + Q_DISABLE_BACKWARD_ITERATOR \ + inline bool findPrevious(const T &t) \ + { while (i != c.constBegin()) if (*(--i) == t) return true; \ + return false; } \ +}; + +#define Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(C) \ +\ +template \ +class QMutable##C##Iterator \ +{ \ + typedef typename Q##C::iterator iterator; \ + typedef typename Q##C::const_iterator const_iterator; \ + Q##C *c; \ + iterator i, n; \ + inline bool item_exists() const { return const_iterator(n) != c->constEnd(); } \ +public: \ + inline QMutable##C##Iterator(Q##C &container) \ + : c(&container) \ + { i = c->begin(); n = c->end(); } \ + inline QMutable##C##Iterator &operator=(Q##C &container) \ + { c = &container; i = c->begin(); n = c->end(); return *this; } \ + inline void toFront() { i = c->begin(); n = c->end(); } \ + inline void toBack() { i = c->end(); n = i; } \ + inline bool hasNext() const { return c->constEnd() != const_iterator(i); } \ + inline T &next() { n = i++; return *n; } \ + inline T &peekNext() const { return *i; } \ + Q_DISABLE_BACKWARD_ITERATOR \ + inline bool hasPrevious() const { return c->constBegin() != const_iterator(i); } \ + Q_DISABLE_BACKWARD_ITERATOR \ + inline T &previous() { n = --i; return *n; } \ + Q_DISABLE_BACKWARD_ITERATOR \ + inline T &peekPrevious() const { iterator p = i; return *--p; } \ + inline void remove() \ + { if (c->constEnd() != const_iterator(n)) { i = c->erase(n); n = c->end(); } } \ + inline void setValue(const T &t) const { if (c->constEnd() != const_iterator(n)) *n = t; } \ + inline T &value() { Q_ASSERT(item_exists()); return *n; } \ + inline const T &value() const { Q_ASSERT(item_exists()); return *n; } \ + inline void insert(const T &t) { n = i = c->insert(i, t); ++i; } \ + inline bool findNext(const T &t) \ + { while (c->constEnd() != const_iterator(n = i)) if (*i++ == t) return true; return false; } \ + Q_DISABLE_BACKWARD_ITERATOR \ + inline bool findPrevious(const T &t) \ + { while (c->constBegin() != const_iterator(i)) if (*(n = --i) == t) return true; \ + n = c->end(); return false; } \ +}; + +#define Q_DECLARE_ASSOCIATIVE_ITERATOR(C) \ +\ +template \ +class Q##C##Iterator \ +{ \ + typedef typename Q##C::const_iterator const_iterator; \ + Q##C c; \ + const_iterator i, n; \ + inline bool item_exists() const { return n != c.constEnd(); } \ +public: \ + typedef const_iterator Item; \ + inline Q##C##Iterator(const Q##C &container) \ + : c(container), i(c.constBegin()), n(c.constEnd()) {} \ + inline Q##C##Iterator &operator=(const Q##C &container) \ + { c = container; i = c.constBegin(); n = c.constEnd(); return *this; } \ + inline void toFront() { i = c.constBegin(); n = c.constEnd(); } \ + inline void toBack() { i = c.constEnd(); n = c.constEnd(); } \ + inline bool hasNext() const { return i != c.constEnd(); } \ + inline Item next() { n = i++; return n; } \ + inline Item peekNext() const { return i; } \ + Q_DISABLE_BACKWARD_ITERATOR \ + inline bool hasPrevious() const { return i != c.constBegin(); } \ + Q_DISABLE_BACKWARD_ITERATOR \ + inline Item previous() { n = --i; return n; } \ + Q_DISABLE_BACKWARD_ITERATOR \ + inline Item peekPrevious() const { const_iterator p = i; return --p; } \ + inline const T &value() const { Q_ASSERT(item_exists()); return *n; } \ + inline const Key &key() const { Q_ASSERT(item_exists()); return n.key(); } \ + inline bool findNext(const T &t) \ + { while ((n = i) != c.constEnd()) if (*i++ == t) return true; return false; } \ + Q_DISABLE_BACKWARD_ITERATOR \ + inline bool findPrevious(const T &t) \ + { while (i != c.constBegin()) if (*(n = --i) == t) return true; \ + n = c.constEnd(); return false; } \ +}; + +#define Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(C) \ +\ +template \ +class QMutable##C##Iterator \ +{ \ + typedef typename Q##C::iterator iterator; \ + typedef typename Q##C::const_iterator const_iterator; \ + Q##C *c; \ + iterator i, n; \ + inline bool item_exists() const { return const_iterator(n) != c->constEnd(); } \ +public: \ + typedef iterator Item; \ + inline QMutable##C##Iterator(Q##C &container) \ + : c(&container) \ + { i = c->begin(); n = c->end(); } \ + inline QMutable##C##Iterator &operator=(Q##C &container) \ + { c = &container; i = c->begin(); n = c->end(); return *this; } \ + inline void toFront() { i = c->begin(); n = c->end(); } \ + inline void toBack() { i = c->end(); n = c->end(); } \ + inline bool hasNext() const { return const_iterator(i) != c->constEnd(); } \ + inline Item next() { n = i++; return n; } \ + inline Item peekNext() const { return i; } \ + Q_DISABLE_BACKWARD_ITERATOR \ + inline bool hasPrevious() const { return const_iterator(i) != c->constBegin(); } \ + Q_DISABLE_BACKWARD_ITERATOR \ + inline Item previous() { n = --i; return n; } \ + Q_DISABLE_BACKWARD_ITERATOR \ + inline Item peekPrevious() const { iterator p = i; return --p; } \ + inline void remove() \ + { if (const_iterator(n) != c->constEnd()) { i = c->erase(n); n = c->end(); } } \ + inline void setValue(const T &t) { if (const_iterator(n) != c->constEnd()) *n = t; } \ + inline T &value() { Q_ASSERT(item_exists()); return *n; } \ + inline const T &value() const { Q_ASSERT(item_exists()); return *n; } \ + inline const Key &key() const { Q_ASSERT(item_exists()); return n.key(); } \ + inline bool findNext(const T &t) \ + { while (const_iterator(n = i) != c->constEnd()) if (*i++ == t) return true; return false; } \ + Q_DISABLE_BACKWARD_ITERATOR \ + inline bool findPrevious(const T &t) \ + { while (const_iterator(i) != c->constBegin()) if (*(n = --i) == t) return true; \ + n = c->end(); return false; } \ +}; + +#define Q_DECLARE_ASSOCIATIVE_FORWARD_ITERATOR(C) \ +\ +template \ +class Q##C##Iterator \ +{ \ + typedef typename Q##C::const_iterator const_iterator; \ + Q##C c; \ + const_iterator i, n; \ + inline bool item_exists() const { return n != c.constEnd(); } \ +public: \ + typedef const_iterator Item; \ + inline Q##C##Iterator(const Q##C &container) \ + : c(container), i(c.constBegin()), n(c.constEnd()) {} \ + inline Q##C##Iterator &operator=(const Q##C &container) \ + { c = container; i = c.constBegin(); n = c.constEnd(); return *this; } \ + inline void toFront() { i = c.constBegin(); n = c.constEnd(); } \ + inline void toBack() { i = c.constEnd(); n = c.constEnd(); } \ + inline bool hasNext() const { return i != c.constEnd(); } \ + inline Item next() { n = i++; return n; } \ + inline Item peekNext() const { return i; } \ + inline const T &value() const { Q_ASSERT(item_exists()); return *n; } \ + inline const Key &key() const { Q_ASSERT(item_exists()); return n.key(); } \ + inline bool findNext(const T &t) \ + { while ((n = i) != c.constEnd()) if (*i++ == t) return true; return false; } \ +}; + +#define Q_DECLARE_MUTABLE_ASSOCIATIVE_FORWARD_ITERATOR(C) \ +\ +template \ +class QMutable##C##Iterator \ +{ \ + typedef typename Q##C::iterator iterator; \ + typedef typename Q##C::const_iterator const_iterator; \ + Q##C *c; \ + iterator i, n; \ + inline bool item_exists() const { return const_iterator(n) != c->constEnd(); } \ +public: \ + typedef iterator Item; \ + inline QMutable##C##Iterator(Q##C &container) \ + : c(&container) \ + { i = c->begin(); n = c->end(); } \ + inline QMutable##C##Iterator &operator=(Q##C &container) \ + { c = &container; i = c->begin(); n = c->end(); return *this; } \ + inline void toFront() { i = c->begin(); n = c->end(); } \ + inline void toBack() { i = c->end(); n = c->end(); } \ + inline bool hasNext() const { return const_iterator(i) != c->constEnd(); } \ + inline Item next() { n = i++; return n; } \ + inline Item peekNext() const { return i; } \ + inline void remove() \ + { if (const_iterator(n) != c->constEnd()) { i = c->erase(n); n = c->end(); } } \ + inline void setValue(const T &t) { if (const_iterator(n) != c->constEnd()) *n = t; } \ + inline T &value() { Q_ASSERT(item_exists()); return *n; } \ + inline const T &value() const { Q_ASSERT(item_exists()); return *n; } \ + inline const Key &key() const { Q_ASSERT(item_exists()); return n.key(); } \ + inline bool findNext(const T &t) \ + { while (const_iterator(n = i) != c->constEnd()) if (*i++ == t) return true; return false; } \ +}; + + +#else // QT_NO_JAVA_STYLE_ITERATORS +#define Q_DECLARE_SEQUENTIAL_ITERATOR(C) +#define Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(C) +#define Q_DECLARE_ASSOCIATIVE_ITERATOR(C) +#define Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(C) +#define Q_DECLARE_ASSOCIATIVE_FORWARD_ITERATOR(C) +#define Q_DECLARE_MUTABLE_ASSOCIATIVE_FORWARD_ITERATOR(C) +#endif // QT_NO_JAVA_STYLE_ITERATORS + +template +class QKeyValueIterator +{ +public: + typedef typename Iterator::iterator_category iterator_category; + typedef typename Iterator::difference_type difference_type; + typedef std::pair value_type; + typedef const value_type &reference; + + QKeyValueIterator() = default; + constexpr explicit QKeyValueIterator(Iterator o) noexcept(std::is_nothrow_move_constructible::value) + : i(std::move(o)) {} + + std::pair operator*() const { + return std::pair(i.key(), i.value()); + } + + using pointer = QtPrivate::ArrowProxy; + + pointer operator->() const { + return pointer{std::pair(i.key(), i.value())}; + } + + friend bool operator==(QKeyValueIterator lhs, QKeyValueIterator rhs) noexcept { return lhs.i == rhs.i; } + friend bool operator!=(QKeyValueIterator lhs, QKeyValueIterator rhs) noexcept { return lhs.i != rhs.i; } + + inline QKeyValueIterator &operator++() { ++i; return *this; } + inline QKeyValueIterator operator++(int) { return QKeyValueIterator(i++);} + inline QKeyValueIterator &operator--() { --i; return *this; } + inline QKeyValueIterator operator--(int) { return QKeyValueIterator(i--); } + Iterator base() const { return i; } + +private: + Iterator i; +}; + +namespace QtPrivate { + +template +class QKeyValueRangeStorage +{ +protected: + Map m_map; +public: + explicit QKeyValueRangeStorage(const Map &map) : m_map(map) {} + explicit QKeyValueRangeStorage(Map &&map) : m_map(std::move(map)) {} +}; + +template +class QKeyValueRangeStorage +{ +protected: + Map &m_map; +public: + explicit QKeyValueRangeStorage(Map &map) : m_map(map) {} +}; + +template +class QKeyValueRange : public QKeyValueRangeStorage +{ +public: + using QKeyValueRangeStorage::QKeyValueRangeStorage; + auto begin() { return this->m_map.keyValueBegin(); } + auto begin() const { return this->m_map.keyValueBegin(); } + auto end() { return this->m_map.keyValueEnd(); } + auto end() const { return this->m_map.keyValueEnd(); } +}; + +template +QKeyValueRange(Map &) -> QKeyValueRange; + +template , bool> = false> +QKeyValueRange(Map &&) -> QKeyValueRange>; + +} // namespace QtPrivate + + +QT_END_NAMESPACE + +#endif // QITERATOR_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qjsonarray.h b/qt/6.8.1/msvc2022_64/include/QtCore/qjsonarray.h new file mode 100644 index 0000000000000000000000000000000000000000..307e7974d89ada4d4d60f0c38f3af5420d714dbc --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qjsonarray.h @@ -0,0 +1,339 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QJSONARRAY_H +#define QJSONARRAY_H + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QDebug; +typedef QList QVariantList; + +class Q_CORE_EXPORT QJsonArray +{ +public: + QJsonArray(); + + QJsonArray(std::initializer_list args); + + ~QJsonArray(); + + QJsonArray(const QJsonArray &other) noexcept; + QJsonArray &operator =(const QJsonArray &other) noexcept; + + QJsonArray(QJsonArray &&other) noexcept; + + QJsonArray &operator =(QJsonArray &&other) noexcept + { + swap(other); + return *this; + } + + static QJsonArray fromStringList(const QStringList &list); + static QJsonArray fromVariantList(const QVariantList &list); + QVariantList toVariantList() const; + + qsizetype size() const; + inline qsizetype count() const { return size(); } + + bool isEmpty() const; + QJsonValue at(qsizetype i) const; + QJsonValue first() const; + QJsonValue last() const; + + void prepend(const QJsonValue &value); + void append(const QJsonValue &value); + void removeAt(qsizetype i); + QJsonValue takeAt(qsizetype i); + inline void removeFirst() { removeAt(0); } + inline void removeLast() { removeAt(size() - 1); } + + void insert(qsizetype i, const QJsonValue &value); + void replace(qsizetype i, const QJsonValue &value); + + bool contains(const QJsonValue &element) const; + QJsonValueRef operator[](qsizetype i); + QJsonValue operator[](qsizetype i) const; + +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator==(const QJsonArray &other) const; + bool operator!=(const QJsonArray &other) const; +#endif + void swap(QJsonArray &other) noexcept + { + a.swap(other.a); + } + + class const_iterator; + + class iterator { + public: + typedef std::random_access_iterator_tag iterator_category; + typedef qsizetype difference_type; + typedef QJsonValue value_type; + typedef QJsonValueRef reference; + typedef QJsonValueRef *pointer; + + inline iterator() : item(static_cast(nullptr), 0) { } + explicit inline iterator(QJsonArray *array, qsizetype index) : item(array, index) { } + + constexpr iterator(const iterator &other) = default; + iterator &operator=(const iterator &other) + { + item.rebind(other.item); + return *this; + } + + inline QJsonValueRef operator*() const { return item; } + inline const QJsonValueConstRef *operator->() const { return &item; } + inline QJsonValueRef *operator->() { return &item; } + inline QJsonValueRef operator[](qsizetype j) const { return *(*this + j); } + +#if QT_CORE_REMOVED_SINCE(6, 8) + inline bool operator==(const iterator &o) const + { return item.d == o.item.d && item.index == o.item.index; } + inline bool operator!=(const iterator &o) const { return !operator==(o); } + inline bool operator<(const iterator &other) const + { Q_ASSERT(item.d == other.item.d); return item.index < other.item.index; } + inline bool operator<=(const iterator &other) const + { Q_ASSERT(item.d == other.item.d); return item.index <= other.item.index; } + inline bool operator>(const iterator &other) const { return !operator<=(other); } + inline bool operator>=(const iterator &other) const { return !operator<(other); } + inline bool operator==(const const_iterator &o) const + { return item.d == o.item.d && item.index == o.item.index; } + inline bool operator!=(const const_iterator &o) const { return !operator==(o); } + inline bool operator<(const const_iterator &other) const + { Q_ASSERT(item.d == other.item.d); return item.index < other.item.index; } + inline bool operator<=(const const_iterator &other) const + { Q_ASSERT(item.d == other.item.d); return item.index <= other.item.index; } + inline bool operator>(const const_iterator &other) const { return !operator<=(other); } + inline bool operator>=(const const_iterator &other) const { return !operator<(other); } +#endif + inline iterator &operator++() { ++item.index; return *this; } + inline iterator operator++(int) { iterator n = *this; ++item.index; return n; } + inline iterator &operator--() { item.index--; return *this; } + inline iterator operator--(int) { iterator n = *this; item.index--; return n; } + inline iterator &operator+=(qsizetype j) { item.index += quint64(j); return *this; } + inline iterator &operator-=(qsizetype j) { item.index -= quint64(j); return *this; } + inline iterator operator+(qsizetype j) const { iterator r = *this; return r += j; } + inline iterator operator-(qsizetype j) const { return operator+(-j); } + inline qsizetype operator-(iterator j) const { return item.index - j.item.index; } + + private: + // Helper functions + static bool comparesEqual_helper(const iterator &lhs, const iterator &rhs) noexcept + { + return lhs.item.d == rhs.item.d && lhs.item.index == rhs.item.index; + } + + static bool comparesEqual_helper(const iterator &lhs, const const_iterator &rhs) noexcept + { + return lhs.item.d == rhs.item.d && lhs.item.index == rhs.item.index; + } + + static Qt::strong_ordering compareThreeWay_helper(const iterator &lhs, + const iterator &rhs) + { + Q_ASSERT(lhs.item.d == rhs.item.d); + return Qt::compareThreeWay(lhs.item.index, rhs.item.index); + } + + static Qt::strong_ordering compareThreeWay_helper(const iterator &lhs, + const const_iterator &rhs) + { + Q_ASSERT(lhs.item.d == rhs.item.d); + return Qt::compareThreeWay(lhs.item.index, rhs.item.index); + } + + // Compare friends + friend bool comparesEqual(const iterator &lhs, const iterator &rhs) noexcept + { + return comparesEqual_helper(lhs, rhs); + } + friend Qt::strong_ordering compareThreeWay(const iterator &lhs, + const iterator &rhs) + { + return compareThreeWay_helper(lhs, rhs); + } + Q_DECLARE_STRONGLY_ORDERED_NON_NOEXCEPT(iterator) + friend bool comparesEqual(const iterator &lhs, const const_iterator &rhs) noexcept + { + return comparesEqual_helper(lhs, rhs); + } + friend Qt::strong_ordering compareThreeWay(const iterator &lhs, + const const_iterator &rhs) + { + return compareThreeWay_helper(lhs, rhs); + } + Q_DECLARE_STRONGLY_ORDERED_NON_NOEXCEPT(iterator, const_iterator) + + QJsonValueRef item; + friend class QJsonArray; + }; + friend class iterator; + + class const_iterator { + public: + typedef std::random_access_iterator_tag iterator_category; + typedef qptrdiff difference_type; + typedef QJsonValue value_type; + typedef const QJsonValueRef reference; + typedef const QJsonValueRef *pointer; + + inline const_iterator() : item(static_cast(nullptr), 0) { } + explicit inline const_iterator(const QJsonArray *array, qsizetype index) + : item(const_cast(array), index) { } + inline const_iterator(const iterator &o) : item(o.item) { } + + constexpr const_iterator(const const_iterator &other) = default; + const_iterator &operator=(const const_iterator &other) + { + item.rebind(other.item); + return *this; + } + + inline const QJsonValueConstRef operator*() const { return item; } + inline const QJsonValueConstRef *operator->() const { return &item; } + + inline QJsonValueConstRef operator[](qsizetype j) const { return *(*this + j); } +#if QT_CORE_REMOVED_SINCE(6, 8) + inline bool operator==(const const_iterator &o) const + { return item.d == o.item.d && item.index == o.item.index; } + inline bool operator!=(const const_iterator &o) const { return !operator==(o); } + inline bool operator<(const const_iterator &other) const + { Q_ASSERT(item.d == other.item.d); return item.index < other.item.index; } + inline bool operator<=(const const_iterator &other) const + { Q_ASSERT(item.d == other.item.d); return item.index <= other.item.index; } + inline bool operator>(const const_iterator &other) const { return !operator<=(other); } + inline bool operator>=(const const_iterator &other) const { return !operator<(other); } +#endif + inline const_iterator &operator++() { ++item.index; return *this; } + inline const_iterator operator++(int) { const_iterator n = *this; ++item.index; return n; } + inline const_iterator &operator--() { item.index--; return *this; } + inline const_iterator operator--(int) { const_iterator n = *this; item.index--; return n; } + inline const_iterator &operator+=(qsizetype j) { item.index += quint64(j); return *this; } + inline const_iterator &operator-=(qsizetype j) { item.index -= quint64(j); return *this; } + inline const_iterator operator+(qsizetype j) const { const_iterator r = *this; return r += j; } + inline const_iterator operator-(qsizetype j) const { return operator+(-j); } + inline qsizetype operator-(const_iterator j) const { return item.index - j.item.index; } + + private: + // Helper functions + static bool comparesEqual_helper(const const_iterator &lhs, + const const_iterator &rhs) noexcept + { + return lhs.item.d == rhs.item.d && lhs.item.index == rhs.item.index; + } + static Qt::strong_ordering compareThreeWay_helper(const const_iterator &lhs, + const const_iterator &rhs) + { + Q_ASSERT(lhs.item.d == rhs.item.d); + return Qt::compareThreeWay(lhs.item.index, rhs.item.index); + } + + // Compare friends + friend bool comparesEqual(const const_iterator &lhs, const const_iterator &rhs) noexcept + { + return comparesEqual_helper(lhs, rhs); + } + friend Qt::strong_ordering compareThreeWay(const const_iterator &lhs, + const const_iterator &rhs) + { + return compareThreeWay_helper(lhs, rhs); + } + Q_DECLARE_STRONGLY_ORDERED_NON_NOEXCEPT(const_iterator) + QJsonValueConstRef item; + friend class QJsonArray; + }; + friend class const_iterator; + + // stl style + inline iterator begin() { detach(); return iterator(this, 0); } + inline const_iterator begin() const { return const_iterator(this, 0); } + inline const_iterator constBegin() const { return const_iterator(this, 0); } + inline const_iterator cbegin() const { return const_iterator(this, 0); } + inline iterator end() { detach(); return iterator(this, size()); } + inline const_iterator end() const { return const_iterator(this, size()); } + inline const_iterator constEnd() const { return const_iterator(this, size()); } + inline const_iterator cend() const { return const_iterator(this, size()); } + iterator insert(iterator before, const QJsonValue &value) + { insert(before.item.index, value); return before; } + iterator erase(iterator it) + { removeAt(it.item.index); return it; } + + // more Qt + typedef iterator Iterator; + typedef const_iterator ConstIterator; + + // convenience + inline QJsonArray operator+(const QJsonValue &v) const + { QJsonArray n = *this; n += v; return n; } + inline QJsonArray &operator+=(const QJsonValue &v) + { append(v); return *this; } + inline QJsonArray &operator<< (const QJsonValue &v) + { append(v); return *this; } + + // stl compatibility + inline void push_back(const QJsonValue &t) { append(t); } + inline void push_front(const QJsonValue &t) { prepend(t); } + inline void pop_front() { removeFirst(); } + inline void pop_back() { removeLast(); } + inline bool empty() const { return isEmpty(); } + typedef qsizetype size_type; + typedef QJsonValue value_type; + typedef value_type *pointer; + typedef const value_type *const_pointer; + typedef QJsonValueRef reference; + typedef QJsonValue const_reference; + typedef qsizetype difference_type; + +private: + friend class QJsonValue; + friend class QJsonValueConstRef; + friend class QJsonValueRef; + friend class QJsonPrivate::Value; + friend class QJsonDocument; + friend class QCborArray; + friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonArray &); + + friend Q_CORE_EXPORT bool comparesEqual(const QJsonArray &lhs, + const QJsonArray &rhs); + + friend Q_CORE_EXPORT bool comparesEqual(const QJsonArray &lhs, + const QJsonValue &rhs); + Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QJsonArray) + Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QJsonArray, QJsonValue) + + QJsonArray(QCborContainerPrivate *array); + bool detach(qsizetype reserve = 0); + + QExplicitlySharedDataPointer a; +}; + +Q_DECLARE_SHARED(QJsonArray) + +#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0) || defined(QT_BOOTSTRAPPED) +inline QJsonValueConstRef::QJsonValueConstRef(QJsonArray *a, qsizetype idx) + : d(a ? a->a.data() : nullptr), is_object(false), index(idx) +{} +#endif + +Q_CORE_EXPORT size_t qHash(const QJsonArray &array, size_t seed = 0); + +#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY) +Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonArray &); +#endif + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QJsonArray &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QJsonArray &); +#endif + +QT_END_NAMESPACE + +#endif // QJSONARRAY_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qjsondocument.h b/qt/6.8.1/msvc2022_64/include/QtCore/qjsondocument.h new file mode 100644 index 0000000000000000000000000000000000000000..e9b751db24c8acd2125a2986b987976485e915f4 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qjsondocument.h @@ -0,0 +1,134 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QJSONDOCUMENT_H +#define QJSONDOCUMENT_H + +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QDebug; +class QCborValue; + +namespace QJsonPrivate { class Parser; } + +struct Q_CORE_EXPORT QJsonParseError +{ + enum ParseError { + NoError = 0, + UnterminatedObject, + MissingNameSeparator, + UnterminatedArray, + MissingValueSeparator, + IllegalValue, + TerminationByNumber, + IllegalNumber, + IllegalEscapeSequence, + IllegalUTF8String, + UnterminatedString, + MissingObject, + DeepNesting, + DocumentTooLarge, + GarbageAtEnd + }; + + QString errorString() const; + + int offset = -1; + ParseError error = NoError; +}; + +class QJsonDocumentPrivate; +class Q_CORE_EXPORT QJsonDocument +{ +public: +#ifdef Q_LITTLE_ENDIAN + static const uint BinaryFormatTag = ('q') | ('b' << 8) | ('j' << 16) | ('s' << 24); +#else + static const uint BinaryFormatTag = ('q' << 24) | ('b' << 16) | ('j' << 8) | ('s'); +#endif + + QJsonDocument(); + explicit QJsonDocument(const QJsonObject &object); + explicit QJsonDocument(const QJsonArray &array); + ~QJsonDocument(); + + QJsonDocument(const QJsonDocument &other); + QJsonDocument &operator =(const QJsonDocument &other); + + QJsonDocument(QJsonDocument &&other) noexcept; + + QJsonDocument &operator =(QJsonDocument &&other) noexcept + { + swap(other); + return *this; + } + + void swap(QJsonDocument &other) noexcept; + + static QJsonDocument fromVariant(const QVariant &variant); + QVariant toVariant() const; + + enum JsonFormat { + Indented, + Compact + }; + + static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error = nullptr); + +#if !defined(QT_JSON_READONLY) || defined(Q_QDOC) + QByteArray toJson(JsonFormat format = Indented) const; +#endif + + bool isEmpty() const; + bool isArray() const; + bool isObject() const; + + QJsonObject object() const; + QJsonArray array() const; + + void setObject(const QJsonObject &object); + void setArray(const QJsonArray &array); + + const QJsonValue operator[](const QString &key) const; + const QJsonValue operator[](QStringView key) const; + const QJsonValue operator[](QLatin1StringView key) const; + const QJsonValue operator[](qsizetype i) const; +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator==(const QJsonDocument &other) const; + bool operator!=(const QJsonDocument &other) const { return !operator==(other); } +#endif + bool isNull() const; + +private: + friend class QJsonValue; + friend class QJsonPrivate::Parser; + friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonDocument &); + friend Q_CORE_EXPORT bool comparesEqual(const QJsonDocument &lhs, + const QJsonDocument &rhs) noexcept; + Q_DECLARE_EQUALITY_COMPARABLE(QJsonDocument) + + QJsonDocument(const QCborValue &data); + + std::unique_ptr d; +}; + +Q_DECLARE_SHARED(QJsonDocument) + +#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY) +Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonDocument &); +#endif + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QJsonDocument &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QJsonDocument &); +#endif + +QT_END_NAMESPACE + +#endif // QJSONDOCUMENT_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qjsonobject.h b/qt/6.8.1/msvc2022_64/include/QtCore/qjsonobject.h new file mode 100644 index 0000000000000000000000000000000000000000..76db429f276310d93d98e9ee2580fad08e976ec2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qjsonobject.h @@ -0,0 +1,380 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QJSONOBJECT_H +#define QJSONOBJECT_H + +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QDebug; + +class QCborContainerPrivate; + +class Q_CORE_EXPORT QJsonObject +{ +public: + QJsonObject(); + + QJsonObject(std::initializer_list > args); + + ~QJsonObject(); + + QJsonObject(const QJsonObject &other) noexcept; + QJsonObject &operator =(const QJsonObject &other) noexcept; + + QJsonObject(QJsonObject &&other) noexcept; + + QJsonObject &operator =(QJsonObject &&other) noexcept + { + swap(other); + return *this; + } + + void swap(QJsonObject &other) noexcept + { + o.swap(other.o); + } + + static QJsonObject fromVariantMap(const QVariantMap &map); + QVariantMap toVariantMap() const; + static QJsonObject fromVariantHash(const QVariantHash &map); + QVariantHash toVariantHash() const; + + QStringList keys() const; + qsizetype size() const; + inline qsizetype count() const { return size(); } + inline qsizetype length() const { return size(); } + bool isEmpty() const; + + QJsonValue value(const QString &key) const; + QJsonValue operator[] (const QString &key) const; + QJsonValueRef operator[] (const QString &key); + QJsonValue value(QStringView key) const; + QJsonValue value(QLatin1StringView key) const; + QJsonValue operator[] (QStringView key) const { return value(key); } + QJsonValue operator[] (QLatin1StringView key) const { return value(key); } + QJsonValueRef operator[] (QStringView key); + QJsonValueRef operator[] (QLatin1StringView key); + + void remove(const QString &key); + QJsonValue take(const QString &key); + bool contains(const QString &key) const; + void remove(QStringView key); + void remove(QLatin1StringView key); + QJsonValue take(QStringView key); + QJsonValue take(QLatin1StringView key); + bool contains(QStringView key) const; + bool contains(QLatin1StringView key) const; + +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator==(const QJsonObject &other) const; + bool operator!=(const QJsonObject &other) const; +#endif + class const_iterator; + + class iterator + { + friend class const_iterator; + friend class QJsonObject; + QJsonValueRef item; + + public: + typedef std::random_access_iterator_tag iterator_category; + typedef qsizetype difference_type; + typedef QJsonValue value_type; + typedef QJsonValueRef reference; + typedef QJsonValueRef *pointer; + + inline iterator() : item(static_cast(nullptr), 0) { } + inline iterator(QJsonObject *obj, qsizetype index) : item(obj, index) { } + + constexpr iterator(const iterator &other) = default; + iterator &operator=(const iterator &other) + { + item.rebind(other.item); + return *this; + } + + inline QString key() const { return item.objectKey(); } + inline QJsonValueRef value() const { return item; } + inline QJsonValueRef operator*() const { return item; } + inline const QJsonValueConstRef *operator->() const { return &item; } + inline QJsonValueRef *operator->() { return &item; } + inline QJsonValueRef operator[](qsizetype j) const { return *(*this + j); } +#if QT_CORE_REMOVED_SINCE(6, 8) + inline bool operator==(const iterator &other) const + { return item.d == other.item.d && item.index == other.item.index; } + inline bool operator!=(const iterator &other) const { return !operator==(other); } + bool operator<(const iterator& other) const + { Q_ASSERT(item.d == other.item.d); return item.index < other.item.index; } + bool operator<=(const iterator& other) const + { Q_ASSERT(item.d == other.item.d); return item.index <= other.item.index; } + bool operator>(const iterator& other) const { return !operator<=(other); } + bool operator>=(const iterator& other) const { return !operator<(other); } +#endif + inline iterator &operator++() { ++item.index; return *this; } + inline iterator operator++(int) { iterator r = *this; ++item.index; return r; } + inline iterator &operator--() { --item.index; return *this; } + inline iterator operator--(int) { iterator r = *this; --item.index; return r; } + inline iterator operator+(qsizetype j) const { iterator r = *this; return r += j; } + inline iterator operator-(qsizetype j) const { return operator+(-j); } + inline iterator &operator+=(qsizetype j) { item.index += quint64(j); return *this; } + inline iterator &operator-=(qsizetype j) { item.index -= quint64(j); return *this; } + qsizetype operator-(iterator j) const { return item.index - j.item.index; } + + public: +#if QT_CORE_REMOVED_SINCE(6, 8) + inline bool operator==(const const_iterator &other) const + { return item.d == other.item.d && item.index == other.item.index; } + inline bool operator!=(const const_iterator &other) const { return !operator==(other); } + bool operator<(const const_iterator& other) const + { Q_ASSERT(item.d == other.item.d); return item.index < other.item.index; } + bool operator<=(const const_iterator& other) const + { Q_ASSERT(item.d == other.item.d); return item.index <= other.item.index; } + bool operator>(const const_iterator& other) const { return operator<=(other); } + bool operator>=(const const_iterator& other) const { return operator<(other); } +#endif + private: + // Helper functions + static bool comparesEqual_helper(const iterator &lhs, const iterator &rhs) noexcept + { + return lhs.item.d == rhs.item.d && lhs.item.index == rhs.item.index; + } + static bool comparesEqual_helper(const iterator &lhs, const const_iterator &rhs) noexcept + { + return lhs.item.d == rhs.item.d && lhs.item.index == rhs.item.index; + } + + static Qt::strong_ordering compareThreeWay_helper(const iterator &lhs, + const iterator &rhs) + { + Q_ASSERT(lhs.item.d == rhs.item.d); + return Qt::compareThreeWay(lhs.item.index, rhs.item.index); + } + static Qt::strong_ordering compareThreeWay_helper(const iterator &lhs, + const const_iterator &rhs) + { + Q_ASSERT(lhs.item.d == rhs.item.d); + return Qt::compareThreeWay(lhs.item.index, rhs.item.index); + } + + // Compare friends + friend bool comparesEqual(const iterator &lhs, const iterator &rhs) noexcept + { + return comparesEqual_helper(lhs, rhs); + } + friend Qt::strong_ordering compareThreeWay(const iterator &lhs, + const iterator &rhs) + { + return compareThreeWay_helper(lhs, rhs); + } + Q_DECLARE_STRONGLY_ORDERED_NON_NOEXCEPT(iterator) + + friend bool comparesEqual(const iterator &lhs, const const_iterator &rhs) noexcept + { + return comparesEqual_helper(lhs, rhs); + } + friend Qt::strong_ordering compareThreeWay(const iterator &lhs, + const const_iterator &rhs) + { + return compareThreeWay_helper(lhs, rhs); + } + Q_DECLARE_STRONGLY_ORDERED_NON_NOEXCEPT(iterator, const_iterator) + }; + friend class iterator; + + class const_iterator + { + friend class iterator; + QJsonValueConstRef item; + + public: + typedef std::random_access_iterator_tag iterator_category; + typedef qsizetype difference_type; + typedef QJsonValue value_type; + typedef const QJsonValueConstRef reference; + typedef const QJsonValueConstRef *pointer; + + inline const_iterator() : item(static_cast(nullptr), 0) { } + inline const_iterator(const QJsonObject *obj, qsizetype index) + : item(const_cast(obj), index) { } + inline const_iterator(const iterator &other) + : item(other.item) { } + + constexpr const_iterator(const const_iterator &other) = default; + const_iterator &operator=(const const_iterator &other) + { + item.rebind(other.item); + return *this; + } + + inline QString key() const { return item.objectKey(); } + inline QJsonValueConstRef value() const { return item; } + inline const QJsonValueConstRef operator*() const { return item; } + inline const QJsonValueConstRef *operator->() const { return &item; } + inline QJsonValueConstRef operator[](qsizetype j) const { return *(*this + j); } +#if QT_CORE_REMOVED_SINCE(6, 8) + inline bool operator==(const const_iterator &other) const + { return item.d == other.item.d && item.index == other.item.index; } + inline bool operator!=(const const_iterator &other) const { return !operator==(other); } + bool operator<(const const_iterator& other) const + { Q_ASSERT(item.d == other.item.d); return item.index < other.item.index; } + bool operator<=(const const_iterator& other) const + { Q_ASSERT(item.d == other.item.d); return item.index <= other.item.index; } + bool operator>(const const_iterator& other) const { return !operator<=(other); } + bool operator>=(const const_iterator& other) const { return !operator<(other); } +#endif + inline const_iterator &operator++() { ++item.index; return *this; } + inline const_iterator operator++(int) { const_iterator r = *this; ++item.index; return r; } + inline const_iterator &operator--() { --item.index; return *this; } + inline const_iterator operator--(int) { const_iterator r = *this; --item.index; return r; } + inline const_iterator operator+(qsizetype j) const { const_iterator r = *this; return r += j; } + inline const_iterator operator-(qsizetype j) const { return operator+(-j); } + inline const_iterator &operator+=(qsizetype j) { item.index += quint64(j); return *this; } + inline const_iterator &operator-=(qsizetype j) { item.index -= quint64(j); return *this; } + qsizetype operator-(const_iterator j) const { return item.index - j.item.index; } +#if QT_CORE_REMOVED_SINCE(6, 8) + inline bool operator==(const iterator &other) const + { return item.d == other.item.d && item.index == other.item.index; } + inline bool operator!=(const iterator &other) const { return !operator==(other); } + bool operator<(const iterator& other) const + { Q_ASSERT(item.d == other.item.d); return item.index < other.item.index; } + bool operator<=(const iterator& other) const + { Q_ASSERT(item.d == other.item.d); return item.index <= other.item.index; } + bool operator>(const iterator& other) const { return !operator<=(other); } + bool operator>=(const iterator& other) const { return !operator<(other); } +#endif + + private: + // Helper functions + static bool comparesEqual_helper(const const_iterator &lhs, + const const_iterator &rhs) noexcept + { + return lhs.item.d == rhs.item.d && lhs.item.index == rhs.item.index; + } + static Qt::strong_ordering compareThreeWay_helper(const const_iterator &lhs, + const const_iterator &rhs) + { + Q_ASSERT(lhs.item.d == rhs.item.d); + return Qt::compareThreeWay(lhs.item.index, rhs.item.index); + } + + // Compare friends + friend bool comparesEqual(const const_iterator &lhs, const const_iterator &rhs) noexcept + { + return comparesEqual_helper(lhs, rhs); + } + friend Qt::strong_ordering compareThreeWay(const const_iterator &lhs, + const const_iterator &rhs) + { + return compareThreeWay_helper(lhs, rhs); + } + Q_DECLARE_STRONGLY_ORDERED_NON_NOEXCEPT(const_iterator) + }; + friend class const_iterator; + + // STL style + inline iterator begin() { detach(); return iterator(this, 0); } + inline const_iterator begin() const { return const_iterator(this, 0); } + inline const_iterator constBegin() const { return const_iterator(this, 0); } + inline iterator end() { detach(); return iterator(this, size()); } + inline const_iterator end() const { return const_iterator(this, size()); } + inline const_iterator constEnd() const { return const_iterator(this, size()); } + iterator erase(iterator it); + + // more Qt + typedef iterator Iterator; + typedef const_iterator ConstIterator; + iterator find(const QString &key); + const_iterator find(const QString &key) const { return constFind(key); } + const_iterator constFind(const QString &key) const; + iterator insert(const QString &key, const QJsonValue &value); + iterator find(QStringView key); + iterator find(QLatin1StringView key); + const_iterator find(QStringView key) const { return constFind(key); } + const_iterator find(QLatin1StringView key) const { return constFind(key); } + const_iterator constFind(QStringView key) const; + const_iterator constFind(QLatin1StringView key) const; + iterator insert(QStringView key, const QJsonValue &value); + iterator insert(QLatin1StringView key, const QJsonValue &value); + + // STL compatibility + typedef QJsonValue mapped_type; + typedef QString key_type; + typedef qsizetype size_type; + + inline bool empty() const { return isEmpty(); } + +private: + friend Q_CORE_EXPORT bool comparesEqual(const QJsonObject &lhs, + const QJsonObject &rhs); + friend bool comparesEqual(const QJsonObject &lhs, const QJsonValue &rhs) + { + return comparesEqual(lhs, rhs.toObject()); + } + friend bool comparesEqual(const QJsonObject &lhs, const QJsonValueConstRef &rhs) + { + return comparesEqual(lhs, rhs.toObject()); + } + Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QJsonObject) + Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QJsonObject, QJsonValue) + Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QJsonObject, QJsonValueConstRef) + friend class QJsonValue; + friend class QJsonDocument; + friend class QJsonPrivate::Value; + friend class QJsonValueConstRef; + friend class QJsonValueRef; + friend class QCborMap; + friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonObject &); + + QJsonObject(QCborContainerPrivate *object); + bool detach(qsizetype reserve = 0); + + template QJsonValue valueImpl(T key) const; + template QJsonValueRef atImpl(T key); + template void removeImpl(T key); + template QJsonValue takeImpl(T key); + template bool containsImpl(T key) const; + template iterator findImpl(T key); + template const_iterator constFindImpl(T key) const; + template iterator insertImpl(T key, const QJsonValue &value); + +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED) + QString keyAt(qsizetype i) const; + QJsonValue valueAt(qsizetype i) const; + void setValueAt(qsizetype i, const QJsonValue &val); +#endif + void removeAt(qsizetype i); + template iterator insertAt(qsizetype i, T key, const QJsonValue &val, bool exists); + + QExplicitlySharedDataPointer o; +}; + +Q_DECLARE_SHARED(QJsonObject) + +#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0) || defined(QT_BOOTSTRAPPED) +inline QJsonValueConstRef::QJsonValueConstRef(QJsonObject *o, qsizetype idx) + : d(o ? o->o.data() : nullptr), is_object(true), index(idx) +{} +#endif + +Q_CORE_EXPORT size_t qHash(const QJsonObject &object, size_t seed = 0); + +#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY) +Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonObject &); +#endif + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QJsonObject &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QJsonObject &); +#endif + +QT_END_NAMESPACE + +#endif // QJSONOBJECT_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qjsonvalue.h b/qt/6.8.1/msvc2022_64/include/QtCore/qjsonvalue.h new file mode 100644 index 0000000000000000000000000000000000000000..30d0350f3e14149ff78e9fb595a69b7e7aba4b73 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qjsonvalue.h @@ -0,0 +1,328 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QJSONVALUE_H +#define QJSONVALUE_H + +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QVariant; +class QJsonArray; +class QJsonObject; +class QCborContainerPrivate; + +namespace QJsonPrivate { +class Value; +} + +class Q_CORE_EXPORT QJsonValue +{ +public: + enum Type { + Null = 0x0, + Bool = 0x1, + Double = 0x2, + String = 0x3, + Array = 0x4, + Object = 0x5, + Undefined = 0x80 + }; + + QJsonValue(Type = Null); + QJsonValue(bool b); + QJsonValue(double n); + QJsonValue(int n); + QJsonValue(qint64 v); + QJsonValue(const QString &s); + QJsonValue(QLatin1StringView s); +#ifndef QT_NO_CAST_FROM_ASCII + QT_ASCII_CAST_WARN inline QJsonValue(const char *s) + : QJsonValue(QString::fromUtf8(s)) {} +#endif + QJsonValue(const QJsonArray &a); + QJsonValue(QJsonArray &&a) noexcept; + QJsonValue(const QJsonObject &o); + QJsonValue(QJsonObject &&o) noexcept; + + ~QJsonValue(); + + QJsonValue(const QJsonValue &other) noexcept; + QJsonValue &operator =(const QJsonValue &other) noexcept; + + QJsonValue(QJsonValue &&other) noexcept; + + QJsonValue &operator =(QJsonValue &&other) noexcept + { + swap(other); + return *this; + } + + void swap(QJsonValue &other) noexcept; + + static QJsonValue fromVariant(const QVariant &variant); + QVariant toVariant() const; + + Type type() const; + inline bool isNull() const { return type() == Null; } + inline bool isBool() const { return type() == Bool; } + inline bool isDouble() const { return type() == Double; } + inline bool isString() const { return type() == String; } + inline bool isArray() const { return type() == Array; } + inline bool isObject() const { return type() == Object; } + inline bool isUndefined() const { return type() == Undefined; } + + bool toBool(bool defaultValue = false) const; + int toInt(int defaultValue = 0) const; + qint64 toInteger(qint64 defaultValue = 0) const; + double toDouble(double defaultValue = 0) const; + QString toString() const; + QString toString(const QString &defaultValue) const; + QJsonArray toArray() const; + QJsonArray toArray(const QJsonArray &defaultValue) const; + QJsonObject toObject() const; + QJsonObject toObject(const QJsonObject &defaultValue) const; + + const QJsonValue operator[](const QString &key) const; + const QJsonValue operator[](QStringView key) const; + const QJsonValue operator[](QLatin1StringView key) const; + const QJsonValue operator[](qsizetype i) const; + +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator==(const QJsonValue &other) const; + bool operator!=(const QJsonValue &other) const; +#endif + +private: + friend Q_CORE_EXPORT bool comparesEqual(const QJsonValue &lhs, + const QJsonValue &rhs); + Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QJsonValue) + + // avoid implicit conversions from char * to bool + QJsonValue(const void *) = delete; + friend class QJsonPrivate::Value; + friend class QJsonArray; + friend class QJsonObject; + friend class QCborValue; + friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonValue &); + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QJsonValue &); + + QCborValue value; + + // Assert binary compatibility with pre-5.15 QJsonValue + static_assert(sizeof(QExplicitlySharedDataPointer) == sizeof(void *)); + static_assert(sizeof(QCborValue::Type) == sizeof(QJsonValue::Type)); +}; + +Q_DECLARE_SHARED(QJsonValue) + +class QJsonValueConstRef +{ +public: + QJsonValueConstRef(const QJsonValueConstRef &) = default; + QJsonValueConstRef &operator=(const QJsonValueConstRef &) = delete; + inline operator QJsonValue() const { return concrete(*this); } + + Q_CORE_EXPORT QVariant toVariant() const; + QJsonValue::Type type() const { return concreteType(*this); } + bool isNull() const { return type() == QJsonValue::Null; } + bool isBool() const { return type() == QJsonValue::Bool; } + bool isDouble() const { return type() == QJsonValue::Double; } + bool isString() const { return type() == QJsonValue::String; } + bool isArray() const { return type() == QJsonValue::Array; } + bool isObject() const { return type() == QJsonValue::Object; } + bool isUndefined() const { return type() == QJsonValue::Undefined; } + + bool toBool(bool defaultValue = false) const + { return concreteBool(*this, defaultValue); } + int toInt(int defaultValue = 0) const + { return int(concreteInt(*this, defaultValue, true)); } + qint64 toInteger(qint64 defaultValue = 0) const + { return concreteInt(*this, defaultValue, false); } + double toDouble(double defaultValue = 0) const + { return concreteDouble(*this, defaultValue); } + QString toString(const QString &defaultValue = {}) const + { return concreteString(*this, defaultValue); } + Q_CORE_EXPORT QJsonArray toArray() const; + Q_CORE_EXPORT QJsonObject toObject() const; + + const QJsonValue operator[](QStringView key) const { return concrete(*this)[key]; } + const QJsonValue operator[](QLatin1StringView key) const { return concrete(*this)[key]; } + const QJsonValue operator[](qsizetype i) const { return concrete(*this)[i]; } + +protected: + friend bool comparesEqual(const QJsonValueConstRef &lhs, + const QJsonValueConstRef &rhs) + { + return comparesEqual(concrete(lhs), concrete(rhs)); + } + friend bool comparesEqual(const QJsonValueConstRef &lhs, + const QJsonValue &rhs) + { + return comparesEqual(concrete(lhs), rhs); + } + Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QJsonValueConstRef) + Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QJsonValueConstRef, QJsonValue) + + Q_CORE_EXPORT static QJsonValue::Type + concreteType(QJsonValueConstRef self) noexcept Q_DECL_PURE_FUNCTION; + Q_CORE_EXPORT static bool + concreteBool(QJsonValueConstRef self, bool defaultValue) noexcept Q_DECL_PURE_FUNCTION; + Q_CORE_EXPORT static qint64 + concreteInt(QJsonValueConstRef self, qint64 defaultValue, bool clamp) noexcept Q_DECL_PURE_FUNCTION; + Q_CORE_EXPORT static double + concreteDouble(QJsonValueConstRef self, double defaultValue) noexcept Q_DECL_PURE_FUNCTION; + Q_CORE_EXPORT static QString concreteString(QJsonValueConstRef self, const QString &defaultValue); + Q_CORE_EXPORT static QJsonValue concrete(QJsonValueConstRef self) noexcept; + + // for iterators + Q_CORE_EXPORT static QString objectKey(QJsonValueConstRef self); + QString objectKey() const { return objectKey(*this); } + +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED) + QJsonValueConstRef(QJsonArray *array, qsizetype idx) + : a(array), is_object(false), index(static_cast(idx)) {} + QJsonValueConstRef(QJsonObject *object, qsizetype idx) + : o(object), is_object(true), index(static_cast(idx)) {} + + void rebind(QJsonValueConstRef other) + { + Q_ASSERT(is_object == other.is_object); + if (is_object) + o = other.o; + else + a = other.a; + index = other.index; + } + + union { + QJsonArray *a; + QJsonObject *o; + void *d; + }; + quint64 is_object : 1; + quint64 index : 63; +#else + constexpr QJsonValueConstRef(QCborContainerPrivate *d, size_t index, bool is_object) + : d(d), is_object(is_object), index(index) + {} + + // implemented in qjsonarray.h & qjsonobject.h, to get their d + QJsonValueConstRef(QJsonArray *array, qsizetype idx); + QJsonValueConstRef(QJsonObject *object, qsizetype idx); + + void rebind(QJsonValueConstRef other) + { + d = other.d; + index = other.index; + } + + QCborContainerPrivate *d = nullptr; + size_t is_object : 1; + size_t index : std::numeric_limits::digits - 1; +#endif + + friend class QJsonArray; + friend class QJsonObject; + friend class QJsonPrivate::Value; +}; + +QT_WARNING_PUSH +QT6_ONLY(QT_WARNING_DISABLE_MSVC(4275)) // non dll-interface class 'QJsonValueConstRef' used as base for dll-interface class 'QJsonValueRef' +class QT6_ONLY(Q_CORE_EXPORT) QJsonValueRef : public QJsonValueConstRef +{ +public: + QJsonValueRef(const QJsonValueRef &) = default; + QT7_ONLY(Q_CORE_EXPORT) QJsonValueRef &operator = (const QJsonValue &val); + QT7_ONLY(Q_CORE_EXPORT) QJsonValueRef &operator = (const QJsonValueRef &val); + +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED) + // retained for binary compatibility (due to the Q_CORE_EXPORT) because at + // least one compiler emits and exports all inlines in an exported class + + QJsonValueRef(QJsonArray *array, qsizetype idx) + : QJsonValueConstRef(array, idx) {} + QJsonValueRef(QJsonObject *object, qsizetype idx) + : QJsonValueConstRef(object, idx) {} + + operator QJsonValue() const { return toValue(); } + + QVariant toVariant() const; + inline QJsonValue::Type type() const { return QJsonValueConstRef::type(); } + inline bool isNull() const { return type() == QJsonValue::Null; } + inline bool isBool() const { return type() == QJsonValue::Bool; } + inline bool isDouble() const { return type() == QJsonValue::Double; } + inline bool isString() const { return type() == QJsonValue::String; } + inline bool isArray() const { return type() == QJsonValue::Array; } + inline bool isObject() const { return type() == QJsonValue::Object; } + inline bool isUndefined() const { return type() == QJsonValue::Undefined; } + + inline bool toBool(bool defaultValue = false) const { return QJsonValueConstRef::toBool(defaultValue); } + inline int toInt(int defaultValue = 0) const { return QJsonValueConstRef::toInt(defaultValue); } + inline qint64 toInteger(qint64 defaultValue = 0) const { return QJsonValueConstRef::toInteger(defaultValue); } + inline double toDouble(double defaultValue = 0) const { return QJsonValueConstRef::toDouble(defaultValue); } + inline QString toString(const QString &defaultValue = {}) const { return QJsonValueConstRef::toString(defaultValue); } + QJsonArray toArray() const; + QJsonObject toObject() const; + + const QJsonValue operator[](QStringView key) const { return QJsonValueConstRef::operator[](key); } + const QJsonValue operator[](QLatin1StringView key) const { return QJsonValueConstRef::operator[](key); } + const QJsonValue operator[](qsizetype i) const { return QJsonValueConstRef::operator[](i); } + +#if QT_CORE_REMOVED_SINCE(6, 8) + inline bool operator==(const QJsonValue &other) const { return comparesEqual(*this, other); } + inline bool operator!=(const QJsonValue &other) const { return !comparesEqual(*this, other); } +#endif + +private: + friend bool comparesEqual(const QJsonValueRef &lhs, const QJsonValueRef &rhs) + { + return comparesEqual(QJsonValue(lhs), QJsonValue(rhs)); + } + friend bool comparesEqual(const QJsonValueRef &lhs, const QJsonValueConstRef &rhs) + { + return comparesEqual(QJsonValue(lhs), QJsonValue(rhs)); + } + Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QJsonValueRef) + Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QJsonValueRef, QJsonValueConstRef) + + QJsonValue toValue() const; +#else + using QJsonValueConstRef::operator[]; + Q_CORE_EXPORT QJsonValueRef operator[](QAnyStringView key); + Q_CORE_EXPORT QJsonValueRef operator[](qsizetype i); + +private: + using QJsonValueConstRef::QJsonValueConstRef; +#endif // < Qt 7 + + QT7_ONLY(Q_CORE_EXPORT) void detach(); + friend class QJsonArray; + friend class QJsonObject; +}; +QT_WARNING_POP + +inline QJsonValue QCborValueConstRef::toJsonValue() const +{ + return concrete().toJsonValue(); +} + +Q_CORE_EXPORT size_t qHash(const QJsonValue &value, size_t seed = 0); + +#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY) +Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonValue &); +#endif + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QJsonValue &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QJsonValue &); +#endif + +QT_END_NAMESPACE + +#endif // QJSONVALUE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qlatin1stringmatcher.h b/qt/6.8.1/msvc2022_64/include/QtCore/qlatin1stringmatcher.h new file mode 100644 index 0000000000000000000000000000000000000000..31ee3c8690ccc9d01a16127a8bb76daed1544282 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qlatin1stringmatcher.h @@ -0,0 +1,181 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QLATIN1STRINGMATCHER_H +#define QLATIN1STRINGMATCHER_H + +#include +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtPrivate { +template constexpr inline bool isLatin1OrUtf16View = false; +template <> constexpr inline bool isLatin1OrUtf16View = true; +template <> constexpr inline bool isLatin1OrUtf16View = true; + +template::value_type>, + class BinaryPredicate = std::equal_to<>> +class q_boyer_moore_searcher_hashed_needle +{ +public: + constexpr q_boyer_moore_searcher_hashed_needle(RandomIt1 pat_first, RandomIt1 pat_last) + : m_skiptable{} + { + const size_t n = std::distance(pat_first, pat_last); + constexpr auto uchar_max = (std::numeric_limits::max)(); + uchar max = n > uchar_max ? uchar_max : uchar(n); + q20::fill(std::begin(m_skiptable), std::end(m_skiptable), max); + + RandomIt1 pattern = pat_first; + pattern += n - max; + while (max--) + m_skiptable[uchar(*pattern++)] = max; + } + + template + constexpr auto operator()(RandomIt2 first, RandomIt2 last, RandomIt1 pat_first, + RandomIt1 pat_last) const + { + struct R + { + RandomIt2 begin, end; + }; + Hash hf; + BinaryPredicate pred; + auto pat_length = std::distance(pat_first, pat_last); + if (pat_length == 0) + return R{ first, first }; + + const qsizetype pl_minus_one = qsizetype(pat_length - 1); + RandomIt2 current = first + pl_minus_one; + + while (current < last) { + qsizetype skip = m_skiptable[hf(*current)]; + if (!skip) { + // possible match + while (skip < pat_length) { + if (!pred(hf(*(current - skip)), uchar(pat_first[pl_minus_one - skip]))) + break; + skip++; + } + if (skip > pl_minus_one) { // we have a match + auto match = current - skip + 1; + return R{ match, match + pat_length }; + } + + // If we don't have a match we are a bit inefficient as we only skip by one + // when we have the non matching char in the string. + if (m_skiptable[hf(*(current - skip))] == pat_length) + skip = pat_length - skip; + else + skip = 1; + } + current += skip; + } + + return R{ last, last }; + } + +private: + alignas(16) uchar m_skiptable[256]; +}; + +struct QCaseSensitiveLatin1Hash +{ + constexpr QCaseSensitiveLatin1Hash() = default; + + constexpr std::size_t operator()(char c) const noexcept { return std::size_t(uchar(c)); } +}; + +struct QCaseInsensitiveLatin1Hash +{ + constexpr QCaseInsensitiveLatin1Hash() = default; + + constexpr std::size_t operator()(char c) const noexcept + { + return std::size_t(latin1Lower[uchar(c)]); + } + + static int difference(char lhs, char rhs) + { + return int(latin1Lower[uchar(lhs)]) - int(latin1Lower[uchar(rhs)]); + } + + static auto matcher(char ch) + { + return [sought = latin1Lower[uchar(ch)]](char other) { + return latin1Lower[uchar(other)] == sought; + }; + } + +private: + static constexpr uchar latin1Lower[256] = { + 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, + 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f, + 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x5b,0x5c,0x5d,0x5e,0x5f, + 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f, + 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f, + 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f, + 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f, + 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf, + 0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf, + // 0xd7 (multiplication sign) and 0xdf (sz ligature) complicate life + 0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef, + 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xd7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xdf, + 0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef, + 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff + }; +}; +} + +class QLatin1StringMatcher +{ +public: + Q_CORE_EXPORT QLatin1StringMatcher() noexcept; + Q_CORE_EXPORT explicit QLatin1StringMatcher( + QLatin1StringView pattern, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; + Q_CORE_EXPORT ~QLatin1StringMatcher() noexcept; + + Q_CORE_EXPORT void setPattern(QLatin1StringView pattern) noexcept; + Q_CORE_EXPORT QLatin1StringView pattern() const noexcept; + Q_CORE_EXPORT void setCaseSensitivity(Qt::CaseSensitivity cs) noexcept; + Q_CORE_EXPORT Qt::CaseSensitivity caseSensitivity() const noexcept; + + Q_CORE_EXPORT qsizetype indexIn(QLatin1StringView haystack, qsizetype from = 0) const noexcept; + Q_CORE_EXPORT qsizetype indexIn(QStringView haystack, qsizetype from = 0) const noexcept; + +private: + void setSearcher() noexcept; + void freeSearcher() noexcept; + + QLatin1StringView m_pattern; + Qt::CaseSensitivity m_cs; + typedef QtPrivate::q_boyer_moore_searcher_hashed_needle + CaseSensitiveSearcher; + typedef QtPrivate::q_boyer_moore_searcher_hashed_needle + CaseInsensitiveSearcher; + union { + CaseSensitiveSearcher m_caseSensitiveSearcher; + CaseInsensitiveSearcher m_caseInsensitiveSearcher; + }; + + template + qsizetype indexIn_helper(String haystack, qsizetype from) const noexcept; + + char m_foldBuffer[256]; +}; + +QT_END_NAMESPACE + +#endif // QLATIN1MATCHER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qlatin1stringview.h b/qt/6.8.1/msvc2022_64/include/QtCore/qlatin1stringview.h new file mode 100644 index 0000000000000000000000000000000000000000..d17a9284e606b420f36fb95d443c810ebda2232b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qlatin1stringview.h @@ -0,0 +1,385 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2019 Intel Corporation. +// Copyright (C) 2019 Mail.ru Group. +// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QLATIN1STRINGVIEW_H +#define QLATIN1STRINGVIEW_H + +#include +#include +#include +#include +#include +#include + +#if 0 +// Workaround for generating forward headers +#pragma qt_class(QLatin1String) +#pragma qt_class(QLatin1StringView) +#endif + +QT_BEGIN_NAMESPACE + +class QString; + +#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0) || defined(QT_BOOTSTRAPPED) || defined(Q_QDOC) +# define Q_L1S_VIEW_IS_PRIMARY +class QLatin1StringView +#else +class QLatin1String +#endif +{ +public: +#ifdef Q_L1S_VIEW_IS_PRIMARY + constexpr QLatin1StringView() noexcept {} + constexpr QLatin1StringView(std::nullptr_t) noexcept : QLatin1StringView() {} + constexpr explicit QLatin1StringView(const char *s) noexcept + : QLatin1StringView(s, s ? qsizetype(QtPrivate::lengthHelperPointer(s)) : 0) {} + constexpr QLatin1StringView(const char *f, const char *l) + : QLatin1StringView(f, qsizetype(l - f)) {} + constexpr QLatin1StringView(const char *s, qsizetype sz) noexcept : m_data(s), m_size(sz) {} + explicit QLatin1StringView(const QByteArray &s) noexcept + : QLatin1StringView{s.begin(), s.size()} {} + constexpr explicit QLatin1StringView(QByteArrayView s) noexcept + : QLatin1StringView(s.constData(), s.size()) {} +#else + constexpr QLatin1String() noexcept : m_size(0), m_data(nullptr) {} + Q_WEAK_OVERLOAD + constexpr QLatin1String(std::nullptr_t) noexcept : QLatin1String() {} + constexpr explicit QLatin1String(const char *s) noexcept + : m_size(s ? qsizetype(QtPrivate::lengthHelperPointer(s)) : 0), m_data(s) {} + constexpr QLatin1String(const char *f, const char *l) + : QLatin1String(f, qsizetype(l - f)) {} + constexpr QLatin1String(const char *s, qsizetype sz) noexcept : m_size(sz), m_data(s) {} + explicit QLatin1String(const QByteArray &s) noexcept : QLatin1String(s.begin(), s.size()) {} + constexpr explicit QLatin1String(QByteArrayView s) noexcept : m_size(s.size()), m_data(s.data()) {} +#endif // !Q_L1S_VIEW_IS_PRIMARY + + inline QString toString() const; + + constexpr const char *latin1() const noexcept { return m_data; } + constexpr qsizetype size() const noexcept { return m_size; } + constexpr const char *data() const noexcept { return m_data; } + [[nodiscard]] constexpr const char *constData() const noexcept { return data(); } + [[nodiscard]] constexpr const char *constBegin() const noexcept { return begin(); } + [[nodiscard]] constexpr const char *constEnd() const noexcept { return end(); } + + [[nodiscard]] constexpr QLatin1Char first() const { return front(); } + [[nodiscard]] constexpr QLatin1Char last() const { return back(); } + + [[nodiscard]] constexpr qsizetype length() const noexcept { return size(); } + + constexpr bool isNull() const noexcept { return !data(); } + constexpr bool isEmpty() const noexcept { return !size(); } + + [[nodiscard]] constexpr bool empty() const noexcept { return size() == 0; } + + template + [[nodiscard]] inline QString arg(Args &&...args) const; + + [[nodiscard]] constexpr QLatin1Char at(qsizetype i) const + { + Q_ASSERT(i >= 0); + Q_ASSERT(i < size()); + return QLatin1Char(m_data[i]); + } + [[nodiscard]] constexpr QLatin1Char operator[](qsizetype i) const { return at(i); } + + [[nodiscard]] constexpr QLatin1Char front() const { return at(0); } + [[nodiscard]] constexpr QLatin1Char back() const { return at(size() - 1); } + + [[nodiscard]] int compare(QStringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::compareStrings(*this, other, cs); } + [[nodiscard]] int compare(QLatin1StringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::compareStrings(*this, other, cs); } + [[nodiscard]] inline int compare(QUtf8StringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + [[nodiscard]] constexpr int compare(QChar c) const noexcept + { return isEmpty() ? -1 : front() == c ? int(size() > 1) : uchar(m_data[0]) - c.unicode(); } + [[nodiscard]] int compare(QChar c, Qt::CaseSensitivity cs) const noexcept + { return QtPrivate::compareStrings(*this, QStringView(&c, 1), cs); } + + [[nodiscard]] bool startsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::startsWith(*this, s, cs); } + [[nodiscard]] bool startsWith(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::startsWith(*this, s, cs); } + [[nodiscard]] constexpr bool startsWith(QChar c) const noexcept + { return !isEmpty() && front() == c; } + [[nodiscard]] bool startsWith(QChar c, Qt::CaseSensitivity cs) const noexcept + { return QtPrivate::startsWith(*this, QStringView(&c, 1), cs); } + + [[nodiscard]] bool endsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::endsWith(*this, s, cs); } + [[nodiscard]] bool endsWith(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::endsWith(*this, s, cs); } + [[nodiscard]] constexpr bool endsWith(QChar c) const noexcept + { return !isEmpty() && back() == c; } + [[nodiscard]] bool endsWith(QChar c, Qt::CaseSensitivity cs) const noexcept + { return QtPrivate::endsWith(*this, QStringView(&c, 1), cs); } + + [[nodiscard]] qsizetype indexOf(QStringView s, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::findString(*this, from, s, cs); } + [[nodiscard]] qsizetype indexOf(QLatin1StringView s, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::findString(*this, from, s, cs); } + [[nodiscard]] qsizetype indexOf(QChar c, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::findString(*this, from, QStringView(&c, 1), cs); } + + [[nodiscard]] bool contains(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return indexOf(s, 0, cs) != -1; } + [[nodiscard]] bool contains(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return indexOf(s, 0, cs) != -1; } + [[nodiscard]] bool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return indexOf(QStringView(&c, 1), 0, cs) != -1; } + + [[nodiscard]] qsizetype lastIndexOf(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return lastIndexOf(s, size(), cs); } + [[nodiscard]] qsizetype lastIndexOf(QStringView s, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::lastIndexOf(*this, from, s, cs); } + [[nodiscard]] qsizetype lastIndexOf(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return lastIndexOf(s, size(), cs); } + [[nodiscard]] qsizetype lastIndexOf(QLatin1StringView s, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::lastIndexOf(*this, from, s, cs); } + [[nodiscard]] qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return lastIndexOf(c, -1, cs); } + [[nodiscard]] qsizetype lastIndexOf(QChar c, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::lastIndexOf(*this, from, QStringView(&c, 1), cs); } + + [[nodiscard]] qsizetype count(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const + { return QtPrivate::count(*this, str, cs); } + [[nodiscard]] qsizetype count(QLatin1StringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const + { return QtPrivate::count(*this, str, cs); } + [[nodiscard]] qsizetype count(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::count(*this, ch, cs); } + + [[nodiscard]] short toShort(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral(QByteArrayView(*this), ok, base); } + [[nodiscard]] ushort toUShort(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral(QByteArrayView(*this), ok, base); } + [[nodiscard]] int toInt(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral(QByteArrayView(*this), ok, base); } + [[nodiscard]] uint toUInt(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral(QByteArrayView(*this), ok, base); } + [[nodiscard]] long toLong(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral(QByteArrayView(*this), ok, base); } + [[nodiscard]] ulong toULong(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral(QByteArrayView(*this), ok, base); } + [[nodiscard]] qlonglong toLongLong(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral(QByteArrayView(*this), ok, base); } + [[nodiscard]] qulonglong toULongLong(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral(QByteArrayView(*this), ok, base); } + [[nodiscard]] float toFloat(bool *ok = nullptr) const + { + const auto r = QtPrivate::toFloat(*this); + if (ok) + *ok = bool(r); + return r.value_or(0.0f); + } + [[nodiscard]] double toDouble(bool *ok = nullptr) const + { + const auto r = QtPrivate::toDouble(*this); + if (ok) + *ok = bool(r); + return r.value_or(0.0); + } + + using value_type = const char; + using pointer = value_type*; + using const_pointer = pointer; + using reference = value_type&; + using const_reference = reference; + using iterator = value_type*; + using const_iterator = iterator; + using difference_type = qsizetype; // violates Container concept requirements + using size_type = qsizetype; // violates Container concept requirements + + constexpr const_iterator begin() const noexcept { return data(); } + constexpr const_iterator cbegin() const noexcept { return data(); } + constexpr const_iterator end() const noexcept { return data() + size(); } + constexpr const_iterator cend() const noexcept { return data() + size(); } + + using reverse_iterator = std::reverse_iterator; + using const_reverse_iterator = reverse_iterator; + + const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } + const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } + const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } + const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } + + [[nodiscard]] constexpr qsizetype max_size() const noexcept { return maxSize(); } + + [[nodiscard]] static constexpr qsizetype maxSize() noexcept + { + // -1 to deal with the pointer one-past-the-end; + return QtPrivate::MaxAllocSize - 1; + } + + [[nodiscard]] constexpr QLatin1StringView mid(qsizetype pos, qsizetype n = -1) const + { + using namespace QtPrivate; + auto result = QContainerImplHelper::mid(size(), &pos, &n); + return result == QContainerImplHelper::Null ? QLatin1StringView() + : QLatin1StringView(m_data + pos, n); + } + [[nodiscard]] constexpr QLatin1StringView left(qsizetype n) const + { + if (size_t(n) >= size_t(size())) + n = size(); + return {m_data, n}; + } + [[nodiscard]] constexpr QLatin1StringView right(qsizetype n) const + { + if (size_t(n) >= size_t(size())) + n = size(); + return {m_data + m_size - n, n}; + } + + [[nodiscard]] constexpr QLatin1StringView sliced(qsizetype pos) const + { verify(pos, 0); return {m_data + pos, m_size - pos}; } + [[nodiscard]] constexpr QLatin1StringView sliced(qsizetype pos, qsizetype n) const + { verify(pos, n); return {m_data + pos, n}; } + [[nodiscard]] constexpr QLatin1StringView first(qsizetype n) const + { verify(0, n); return sliced(0, n); } + [[nodiscard]] constexpr QLatin1StringView last(qsizetype n) const + { verify(0, n); return sliced(size() - n, n); } + [[nodiscard]] constexpr QLatin1StringView chopped(qsizetype n) const + { verify(0, n); return sliced(0, size() - n); } + + constexpr QLatin1StringView &slice(qsizetype pos) + { *this = sliced(pos); return *this; } + constexpr QLatin1StringView &slice(qsizetype pos, qsizetype n) + { *this = sliced(pos, n); return *this; } + + constexpr void chop(qsizetype n) + { verify(0, n); m_size -= n; } + constexpr void truncate(qsizetype n) + { verify(0, n); m_size = n; } + + [[nodiscard]] QLatin1StringView trimmed() const noexcept { return QtPrivate::trimmed(*this); } + + template + [[nodiscard]] constexpr auto tokenize(Needle &&needle, Flags...flags) const + noexcept(noexcept(qTokenize(std::declval(), + std::forward(needle), flags...))) + -> decltype(qTokenize(*this, std::forward(needle), flags...)) + { return qTokenize(*this, std::forward(needle), flags...); } + + friend bool comparesEqual(const QLatin1StringView &s1, const QLatin1StringView &s2) noexcept + { return s1.size() == s2.size() && QtPrivate::equalStrings(s1, s2); } + friend Qt::strong_ordering + compareThreeWay(const QLatin1StringView &s1, const QLatin1StringView &s2) noexcept + { + const int res = QtPrivate::compareStrings(s1, s2); + return Qt::compareThreeWay(res, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QLatin1StringView) + + // QChar <> QLatin1StringView + friend bool comparesEqual(const QLatin1StringView &lhs, QChar rhs) noexcept + { return lhs.size() == 1 && rhs == lhs.front(); } + friend Qt::strong_ordering + compareThreeWay(const QLatin1StringView &lhs, QChar rhs) noexcept + { + // negate, as the helper function expects QChar as lhs + const int res = -compare_helper(&rhs, 1, lhs); + return Qt::compareThreeWay(res, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QLatin1StringView, QChar) + + // QStringView <> QLatin1StringView + friend bool comparesEqual(const QLatin1StringView &lhs, const QStringView &rhs) noexcept + { return lhs.size() == rhs.size() && QtPrivate::equalStrings(lhs, rhs); } + friend Qt::strong_ordering + compareThreeWay(const QLatin1StringView &lhs, const QStringView &rhs) noexcept + { + const int res = QtPrivate::compareStrings(lhs, rhs); + return Qt::compareThreeWay(res, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QLatin1StringView, QStringView) + + // Reversed helper methods for QStringView <> QLatin1StringView comparison. + // If we do not provide them explicitly, QStringView <> QByteArrayView + // overloads will be selected, which will provide wrong results, because + // they will convert from utf-8 + friend bool comparesEqual(const QStringView &lhs, const QLatin1StringView &rhs) noexcept + { return comparesEqual(rhs, lhs); } + friend Qt::strong_ordering + compareThreeWay(const QStringView &lhs, const QLatin1StringView &rhs) noexcept + { return QtOrderingPrivate::reversed(compareThreeWay(rhs, lhs)); } + +private: + friend bool comparesEqual(const QLatin1StringView &lhs, const QByteArrayView &rhs) noexcept + { return equal_helper(lhs, rhs.data(), rhs.size()); } + friend Qt::strong_ordering + compareThreeWay(const QLatin1StringView &lhs, const QByteArrayView &rhs) noexcept + { + const int res = compare_helper(lhs, rhs.data(), rhs.size()); + return Qt::compareThreeWay(res, 0); + } + + // Reversed helper methods for QByteArrayView <> QLatin1StringView comparison. + // If we do not provide them explicitly, QByteArrayView <> QByteArrayView + // overloads will be selected, which will provide wrong results + friend bool comparesEqual(const QByteArrayView &lhs, const QLatin1StringView &rhs) noexcept + { return comparesEqual(rhs, lhs); } + friend Qt::strong_ordering + compareThreeWay(const QByteArrayView &lhs, const QLatin1StringView &rhs) noexcept + { return QtOrderingPrivate::reversed(compareThreeWay(rhs, lhs)); } + +public: +#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) + Q_DECLARE_STRONGLY_ORDERED(QLatin1StringView, QByteArrayView, QT_ASCII_CAST_WARN) + Q_DECLARE_STRONGLY_ORDERED(QLatin1StringView, QByteArray, QT_ASCII_CAST_WARN) + Q_DECLARE_STRONGLY_ORDERED(QLatin1StringView, const char *, QT_ASCII_CAST_WARN) +#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) + +private: + Q_ALWAYS_INLINE constexpr void verify([[maybe_unused]] qsizetype pos, + [[maybe_unused]] qsizetype n = 1) const + { + Q_ASSERT(pos >= 0); + Q_ASSERT(pos <= size()); + Q_ASSERT(n >= 0); + Q_ASSERT(n <= size() - pos); + } + static int compare_helper(const QLatin1StringView &s1, const char *s2) noexcept + { return compare_helper(s1, s2, qstrlen(s2)); } + Q_CORE_EXPORT static bool equal_helper(QLatin1StringView s1, const char *s2, qsizetype len) noexcept; + Q_CORE_EXPORT static int compare_helper(const QLatin1StringView &s1, const char *s2, qsizetype len) noexcept; + Q_CORE_EXPORT static int compare_helper(const QChar *data1, qsizetype length1, + QLatin1StringView s2, + Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0) || defined(QT_BOOTSTRAPPED) + const char *m_data = nullptr; + qsizetype m_size = 0; +#else + qsizetype m_size; + const char *m_data; +#endif +}; +#ifdef Q_L1S_VIEW_IS_PRIMARY +Q_DECLARE_TYPEINFO(QLatin1StringView, Q_RELOCATABLE_TYPE); +#else +Q_DECLARE_TYPEINFO(QLatin1String, Q_RELOCATABLE_TYPE); +#endif + +namespace Qt { +inline namespace Literals { +inline namespace StringLiterals { + +constexpr inline QLatin1StringView operator""_L1(const char *str, size_t size) noexcept +{ + return {str, qsizetype(size)}; +} + +} // StringLiterals +} // Literals +} // Qt + +QT_END_NAMESPACE + +#ifdef Q_L1S_VIEW_IS_PRIMARY +# undef Q_L1S_VIEW_IS_PRIMARY +#endif + +#endif // QLATIN1STRINGVIEW_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qlibrary.h b/qt/6.8.1/msvc2022_64/include/QtCore/qlibrary.h new file mode 100644 index 0000000000000000000000000000000000000000..d8eb346211e320c54de32aba7844dde8ae1ede03 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qlibrary.h @@ -0,0 +1,74 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QLIBRARY_H +#define QLIBRARY_H + +#include +#include + +QT_REQUIRE_CONFIG(library); + +QT_BEGIN_NAMESPACE + +class QLibraryPrivate; + +class Q_CORE_EXPORT QLibrary : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString fileName READ fileName WRITE setFileName) + Q_PROPERTY(LoadHints loadHints READ loadHints WRITE setLoadHints) +public: + enum LoadHint { + ResolveAllSymbolsHint = 0x01, + ExportExternalSymbolsHint = 0x02, + LoadArchiveMemberHint = 0x04, + PreventUnloadHint = 0x08, + DeepBindHint = 0x10 + }; + Q_DECLARE_FLAGS(LoadHints, LoadHint) + Q_ENUM(LoadHint) + Q_FLAG(LoadHints) + + explicit QLibrary(QObject *parent = nullptr); + explicit QLibrary(const QString &fileName, QObject *parent = nullptr); + explicit QLibrary(const QString &fileName, int verNum, QObject *parent = nullptr); + explicit QLibrary(const QString &fileName, const QString &version, QObject *parent = nullptr); + ~QLibrary(); + + QFunctionPointer resolve(const char *symbol); + static QFunctionPointer resolve(const QString &fileName, const char *symbol); + static QFunctionPointer resolve(const QString &fileName, int verNum, const char *symbol); + static QFunctionPointer resolve(const QString &fileName, const QString &version, const char *symbol); + + bool load(); + bool unload(); + bool isLoaded() const; + + static bool isLibrary(const QString &fileName); + + void setFileName(const QString &fileName); + QString fileName() const; + + void setFileNameAndVersion(const QString &fileName, int verNum); + void setFileNameAndVersion(const QString &fileName, const QString &version); + QString errorString() const; + + void setLoadHints(LoadHints hints); + LoadHints loadHints() const; + +private: + enum LoadStatusTag { + NotLoaded, + Loaded + }; + + QTaggedPointer d = nullptr; + Q_DISABLE_COPY(QLibrary) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QLibrary::LoadHints) + +QT_END_NAMESPACE + +#endif //QLIBRARY_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qlibraryinfo.h b/qt/6.8.1/msvc2022_64/include/QtCore/qlibraryinfo.h new file mode 100644 index 0000000000000000000000000000000000000000..c904391cfd082854e5e17824e44c47757fe310a1 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qlibraryinfo.h @@ -0,0 +1,67 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QLIBRARYINFO_H +#define QLIBRARYINFO_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class Q_CORE_EXPORT QLibraryInfo +{ +public: + static const char *build() noexcept; + + [[nodiscard]] static bool isDebugBuild() noexcept Q_DECL_CONST_FUNCTION; + [[nodiscard]] static bool isSharedBuild() noexcept Q_DECL_CONST_FUNCTION; + +#ifndef QT_BOOTSTRAPPED + static QVersionNumber version() noexcept Q_DECL_CONST_FUNCTION; +#endif + + enum LibraryPath { + PrefixPath = 0, + DocumentationPath, + HeadersPath, + LibrariesPath, + LibraryExecutablesPath, + BinariesPath, + PluginsPath, + QmlImportsPath, + Qml2ImportsPath = QmlImportsPath, + ArchDataPath, + DataPath, + TranslationsPath, + ExamplesPath, + TestsPath, + // Insert new values above this line + // Please read the comments in qconfig.cpp.in before adding + SettingsPath = 100 + }; + static QString path(LibraryPath p); + static QStringList paths(LibraryPath p); +#if QT_DEPRECATED_SINCE(6, 0) + using LibraryLocation = LibraryPath; + QT_DEPRECATED_VERSION_X_6_0("Use path()") + static QString location(LibraryLocation location) + { return path(location); } +#endif + static QStringList platformPluginArguments(const QString &platformName); + +private: + QLibraryInfo(); +}; + +#if QT_DEPRECATED_SINCE(6, 9) + +QT_DEPRECATED_VERSION_X_6_9("Use QLibraryInfo::isSharedBuild() instead.") +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qSharedBuild() noexcept; + +#endif + +QT_END_NAMESPACE + +#endif // QLIBRARYINFO_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qline.h b/qt/6.8.1/msvc2022_64/include/QtCore/qline.h new file mode 100644 index 0000000000000000000000000000000000000000..a8a66e39e8f04aa4d0d27ea3891f5c70d712a58b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qline.h @@ -0,0 +1,433 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QLINE_H +#define QLINE_H + +#include + +QT_BEGIN_NAMESPACE + +class QLineF; + +/******************************************************************************* + * class QLine + *******************************************************************************/ + +class Q_CORE_EXPORT QLine +{ +public: + constexpr inline QLine(); + constexpr inline QLine(const QPoint &pt1, const QPoint &pt2); + constexpr inline QLine(int x1, int y1, int x2, int y2); + + constexpr inline bool isNull() const; + + constexpr inline QPoint p1() const; + constexpr inline QPoint p2() const; + + constexpr inline int x1() const; + constexpr inline int y1() const; + + constexpr inline int x2() const; + constexpr inline int y2() const; + + constexpr inline int dx() const; + constexpr inline int dy() const; + + inline void translate(const QPoint &p); + inline void translate(int dx, int dy); + + [[nodiscard]] constexpr inline QLine translated(const QPoint &p) const; + [[nodiscard]] constexpr inline QLine translated(int dx, int dy) const; + + [[nodiscard]] constexpr inline QPoint center() const; + + inline void setP1(const QPoint &p1); + inline void setP2(const QPoint &p2); + inline void setPoints(const QPoint &p1, const QPoint &p2); + inline void setLine(int x1, int y1, int x2, int y2); + +#if QT_CORE_REMOVED_SINCE(6, 8) + constexpr inline bool operator==(const QLine &d) const noexcept; + constexpr inline bool operator!=(const QLine &d) const noexcept { return !operator==(d); } +#endif + + [[nodiscard]] constexpr inline QLineF toLineF() const noexcept; + +private: + friend constexpr bool comparesEqual(const QLine &lhs, const QLine &rhs) noexcept + { return lhs.pt1 == rhs.pt1 && lhs.pt2 == rhs.pt2; } +#if !QT_CORE_REMOVED_SINCE(6, 8) + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QLine) +#endif + + QPoint pt1, pt2; +}; +Q_DECLARE_TYPEINFO(QLine, Q_PRIMITIVE_TYPE); + +/******************************************************************************* + * class QLine inline members + *******************************************************************************/ + +constexpr inline QLine::QLine() { } + +constexpr inline QLine::QLine(const QPoint &pt1_, const QPoint &pt2_) : pt1(pt1_), pt2(pt2_) { } + +constexpr inline QLine::QLine(int x1pos, int y1pos, int x2pos, int y2pos) : pt1(QPoint(x1pos, y1pos)), pt2(QPoint(x2pos, y2pos)) { } + +constexpr inline bool QLine::isNull() const +{ + return pt1 == pt2; +} + +constexpr inline int QLine::x1() const +{ + return pt1.x(); +} + +constexpr inline int QLine::y1() const +{ + return pt1.y(); +} + +constexpr inline int QLine::x2() const +{ + return pt2.x(); +} + +constexpr inline int QLine::y2() const +{ + return pt2.y(); +} + +constexpr inline QPoint QLine::p1() const +{ + return pt1; +} + +constexpr inline QPoint QLine::p2() const +{ + return pt2; +} + +constexpr inline int QLine::dx() const +{ + return pt2.x() - pt1.x(); +} + +constexpr inline int QLine::dy() const +{ + return pt2.y() - pt1.y(); +} + +inline void QLine::translate(const QPoint &point) +{ + pt1 += point; + pt2 += point; +} + +inline void QLine::translate(int adx, int ady) +{ + this->translate(QPoint(adx, ady)); +} + +constexpr inline QLine QLine::translated(const QPoint &p) const +{ + return QLine(pt1 + p, pt2 + p); +} + +constexpr inline QLine QLine::translated(int adx, int ady) const +{ + return translated(QPoint(adx, ady)); +} + +constexpr inline QPoint QLine::center() const +{ + return QPoint(int((qint64(pt1.x()) + pt2.x()) / 2), int((qint64(pt1.y()) + pt2.y()) / 2)); +} + +inline void QLine::setP1(const QPoint &aP1) +{ + pt1 = aP1; +} + +inline void QLine::setP2(const QPoint &aP2) +{ + pt2 = aP2; +} + +inline void QLine::setPoints(const QPoint &aP1, const QPoint &aP2) +{ + pt1 = aP1; + pt2 = aP2; +} + +inline void QLine::setLine(int aX1, int aY1, int aX2, int aY2) +{ + pt1 = QPoint(aX1, aY1); + pt2 = QPoint(aX2, aY2); +} + +#if QT_CORE_REMOVED_SINCE(6, 8) +constexpr inline bool QLine::operator==(const QLine &d) const noexcept +{ + return comparesEqual(*this, d); +} +#endif + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug d, const QLine &p); +#endif + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QLine &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QLine &); +#endif + +/******************************************************************************* + * class QLineF + *******************************************************************************/ +class Q_CORE_EXPORT QLineF +{ +public: + + enum IntersectionType { NoIntersection, BoundedIntersection, UnboundedIntersection }; + using IntersectType = IntersectionType; // deprecated name + + constexpr inline QLineF(); + constexpr inline QLineF(const QPointF &pt1, const QPointF &pt2); + constexpr inline QLineF(qreal x1, qreal y1, qreal x2, qreal y2); + constexpr inline QLineF(const QLine &line) : pt1(line.p1()), pt2(line.p2()) { } + + [[nodiscard]] static QLineF fromPolar(qreal length, qreal angle); + + constexpr bool isNull() const; + + constexpr inline QPointF p1() const; + constexpr inline QPointF p2() const; + + constexpr inline qreal x1() const; + constexpr inline qreal y1() const; + + constexpr inline qreal x2() const; + constexpr inline qreal y2() const; + + constexpr inline qreal dx() const; + constexpr inline qreal dy() const; + + qreal length() const; + void setLength(qreal len); + + qreal angle() const; + void setAngle(qreal angle); + + qreal angleTo(const QLineF &l) const; + + [[nodiscard]] QLineF unitVector() const; + [[nodiscard]] constexpr inline QLineF normalVector() const; + + IntersectionType intersects(const QLineF &l, QPointF *intersectionPoint = nullptr) const; + + constexpr inline QPointF pointAt(qreal t) const; + inline void translate(const QPointF &p); + inline void translate(qreal dx, qreal dy); + + [[nodiscard]] constexpr inline QLineF translated(const QPointF &p) const; + [[nodiscard]] constexpr inline QLineF translated(qreal dx, qreal dy) const; + + [[nodiscard]] constexpr inline QPointF center() const; + + inline void setP1(const QPointF &p1); + inline void setP2(const QPointF &p2); + inline void setPoints(const QPointF &p1, const QPointF &p2); + inline void setLine(qreal x1, qreal y1, qreal x2, qreal y2); + +#if QT_CORE_REMOVED_SINCE(6, 8) + constexpr inline bool operator==(const QLineF &d) const; + constexpr inline bool operator!=(const QLineF &d) const { return !operator==(d); } +#endif + + constexpr QLine toLine() const; + +private: + friend constexpr bool comparesEqual(const QLineF &lhs, const QLineF &rhs) noexcept + { return lhs.pt1 == rhs.pt1 && lhs.pt2 == rhs.pt2; } +#if !QT_CORE_REMOVED_SINCE(6, 8) + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QLineF) +#endif + + friend constexpr bool comparesEqual(const QLineF &lhs, const QLine &rhs) noexcept + { return comparesEqual(lhs, rhs.toLineF()); } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QLineF, QLine) + + friend constexpr bool qFuzzyCompare(const QLineF &lhs, const QLineF &rhs) noexcept + { return qFuzzyCompare(lhs.pt1, rhs.pt1) && qFuzzyCompare(lhs.pt2, rhs.pt2); } + + friend constexpr bool qFuzzyIsNull(const QLineF &line) noexcept + { return qFuzzyCompare(line.pt1, line.pt2); } + + QPointF pt1, pt2; +}; +Q_DECLARE_TYPEINFO(QLineF, Q_PRIMITIVE_TYPE); + +/******************************************************************************* + * class QLineF inline members + *******************************************************************************/ + +constexpr inline QLineF::QLineF() +{ +} + +constexpr inline QLineF::QLineF(const QPointF &apt1, const QPointF &apt2) + : pt1(apt1), pt2(apt2) +{ +} + +constexpr inline QLineF::QLineF(qreal x1pos, qreal y1pos, qreal x2pos, qreal y2pos) + : pt1(x1pos, y1pos), pt2(x2pos, y2pos) +{ +} + +constexpr inline qreal QLineF::x1() const +{ + return pt1.x(); +} + +constexpr inline qreal QLineF::y1() const +{ + return pt1.y(); +} + +constexpr inline qreal QLineF::x2() const +{ + return pt2.x(); +} + +constexpr inline qreal QLineF::y2() const +{ + return pt2.y(); +} + +constexpr inline bool QLineF::isNull() const +{ + return qFuzzyCompare(pt1, pt2); +} + +constexpr inline QPointF QLineF::p1() const +{ + return pt1; +} + +constexpr inline QPointF QLineF::p2() const +{ + return pt2; +} + +constexpr inline qreal QLineF::dx() const +{ + return pt2.x() - pt1.x(); +} + +constexpr inline qreal QLineF::dy() const +{ + return pt2.y() - pt1.y(); +} + +constexpr inline QLineF QLineF::normalVector() const +{ + return QLineF(p1(), p1() + QPointF(dy(), -dx())); +} + +inline void QLineF::translate(const QPointF &point) +{ + pt1 += point; + pt2 += point; +} + +inline void QLineF::translate(qreal adx, qreal ady) +{ + this->translate(QPointF(adx, ady)); +} + +constexpr inline QLineF QLineF::translated(const QPointF &p) const +{ + return QLineF(pt1 + p, pt2 + p); +} + +constexpr inline QLineF QLineF::translated(qreal adx, qreal ady) const +{ + return translated(QPointF(adx, ady)); +} + +constexpr inline QPointF QLineF::center() const +{ + return QPointF(0.5 * pt1.x() + 0.5 * pt2.x(), 0.5 * pt1.y() + 0.5 * pt2.y()); +} + +inline void QLineF::setLength(qreal len) +{ + Q_ASSERT(qIsFinite(len)); + const qreal oldLength = length(); + Q_ASSERT(qIsFinite(oldLength)); + // Scale len by dx() / length() and dy() / length(), two O(1) quantities, + // rather than scaling dx() and dy() by len / length(), which might overflow. + if (oldLength > 0) + pt2 = QPointF(pt1.x() + len * (dx() / oldLength), pt1.y() + len * (dy() / oldLength)); +} + +constexpr inline QPointF QLineF::pointAt(qreal t) const +{ + return QPointF(pt1.x() + (pt2.x() - pt1.x()) * t, pt1.y() + (pt2.y() - pt1.y()) * t); +} + +constexpr inline QLineF QLine::toLineF() const noexcept { return *this; } + +constexpr inline QLine QLineF::toLine() const +{ + return QLine(pt1.toPoint(), pt2.toPoint()); +} + + +inline void QLineF::setP1(const QPointF &aP1) +{ + pt1 = aP1; +} + +inline void QLineF::setP2(const QPointF &aP2) +{ + pt2 = aP2; +} + +inline void QLineF::setPoints(const QPointF &aP1, const QPointF &aP2) +{ + pt1 = aP1; + pt2 = aP2; +} + +inline void QLineF::setLine(qreal aX1, qreal aY1, qreal aX2, qreal aY2) +{ + pt1 = QPointF(aX1, aY1); + pt2 = QPointF(aX2, aY2); +} + +#if QT_CORE_REMOVED_SINCE(6, 8) +constexpr inline bool QLineF::operator==(const QLineF &d) const +{ + return comparesEqual(*this, d); +} +#endif + + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug d, const QLineF &p); +#endif + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QLineF &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QLineF &); +#endif + +QT_END_NAMESPACE + +#endif // QLINE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qlist.h b/qt/6.8.1/msvc2022_64/include/QtCore/qlist.h new file mode 100644 index 0000000000000000000000000000000000000000..c62bb4e9c506488ae7728912071c198926cbe1ea --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qlist.h @@ -0,0 +1,1028 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2019 Intel Corporation +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QLIST_H +#define QLIST_H + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +class tst_QList; + +QT_BEGIN_NAMESPACE + +namespace QtPrivate { + template qsizetype indexOf(const QList &list, const U &u, qsizetype from) noexcept; + template qsizetype lastIndexOf(const QList &list, const U &u, qsizetype from) noexcept; +} + +template struct QListSpecialMethodsBase +{ +protected: + ~QListSpecialMethodsBase() = default; + + using Self = QList; + Self *self() { return static_cast(this); } + const Self *self() const { return static_cast(this); } + +public: + template + qsizetype indexOf(const AT &t, qsizetype from = 0) const noexcept; + template + qsizetype lastIndexOf(const AT &t, qsizetype from = -1) const noexcept; + + template + bool contains(const AT &t) const noexcept + { + return self()->indexOf(t) != -1; + } +}; +template struct QListSpecialMethods : QListSpecialMethodsBase +{ +protected: + ~QListSpecialMethods() = default; +public: + using QListSpecialMethodsBase::indexOf; + using QListSpecialMethodsBase::lastIndexOf; + using QListSpecialMethodsBase::contains; +}; +template <> struct QListSpecialMethods; +template <> struct QListSpecialMethods; + +#if !defined(QT_STRICT_QLIST_ITERATORS) && (QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)) && !defined(Q_OS_WIN) +#define QT_STRICT_QLIST_ITERATORS +#endif + +#ifdef Q_QDOC // define QVector for QDoc +template class QVector : public QList {}; +#endif + +template +class QList +#ifndef Q_QDOC + : public QListSpecialMethods +#endif +{ + using Data = QTypedArrayData; + using DataOps = QArrayDataOps; + using DataPointer = QArrayDataPointer; + class DisableRValueRefs {}; + + friend class ::tst_QList; + + DataPointer d; + + template friend qsizetype QtPrivate::indexOf(const QList &list, const U &u, qsizetype from) noexcept; + template friend qsizetype QtPrivate::lastIndexOf(const QList &list, const U &u, qsizetype from) noexcept; + // This alias prevents the QtPrivate namespace from being exposed into the docs. + template + using if_input_iterator = QtPrivate::IfIsInputIterator; + +public: + using Type = T; + using value_type = T; + using pointer = T *; + using const_pointer = const T *; + using reference = T &; + using const_reference = const T &; + using size_type = qsizetype; + using difference_type = qptrdiff; +#ifndef Q_QDOC + using parameter_type = typename DataPointer::parameter_type; + using rvalue_ref = typename std::conditional::type; +#else // simplified aliases for QDoc + using parameter_type = const T &; + using rvalue_ref = T &&; +#endif + + class const_iterator; + class iterator { + friend class QList; + friend class const_iterator; + T *i = nullptr; +#ifdef QT_STRICT_QLIST_ITERATORS + inline constexpr explicit iterator(T *n) : i(n) {} +#endif + + public: + using difference_type = qsizetype; + using value_type = T; +#ifdef QT_COMPILER_HAS_LWG3346 + using iterator_concept = std::contiguous_iterator_tag; +#endif + using element_type = value_type; + using iterator_category = std::random_access_iterator_tag; + using pointer = T *; + using reference = T &; + + inline constexpr iterator() = default; +#ifndef QT_STRICT_QLIST_ITERATORS + inline constexpr explicit iterator(T *n) : i(n) {} +#endif + inline T &operator*() const { return *i; } + inline T *operator->() const { return i; } + inline T &operator[](qsizetype j) const { return *(i + j); } + inline constexpr bool operator==(iterator o) const { return i == o.i; } + inline constexpr bool operator!=(iterator o) const { return i != o.i; } + inline constexpr bool operator<(iterator other) const { return i < other.i; } + inline constexpr bool operator<=(iterator other) const { return i <= other.i; } + inline constexpr bool operator>(iterator other) const { return i > other.i; } + inline constexpr bool operator>=(iterator other) const { return i >= other.i; } + inline constexpr bool operator==(const_iterator o) const { return i == o.i; } + inline constexpr bool operator!=(const_iterator o) const { return i != o.i; } + inline constexpr bool operator<(const_iterator other) const { return i < other.i; } + inline constexpr bool operator<=(const_iterator other) const { return i <= other.i; } + inline constexpr bool operator>(const_iterator other) const { return i > other.i; } + inline constexpr bool operator>=(const_iterator other) const { return i >= other.i; } + inline constexpr bool operator==(pointer p) const { return i == p; } + inline constexpr bool operator!=(pointer p) const { return i != p; } + inline iterator &operator++() { ++i; return *this; } + inline iterator operator++(int) { auto copy = *this; ++*this; return copy; } + inline iterator &operator--() { --i; return *this; } + inline iterator operator--(int) { auto copy = *this; --*this; return copy; } + inline qsizetype operator-(iterator j) const { return i - j.i; } +#if QT_DEPRECATED_SINCE(6, 3) && !defined(QT_STRICT_QLIST_ITERATORS) + QT_DEPRECATED_VERSION_X_6_3("Use operator* or operator-> rather than relying on " + "the implicit conversion between a QList/QVector::iterator " + "and a raw pointer") + inline operator T*() const { return i; } + + template std::enable_if_t, iterator> + &operator+=(Int j) { i+=j; return *this; } + template std::enable_if_t, iterator> + &operator-=(Int j) { i-=j; return *this; } + template std::enable_if_t, iterator> + operator+(Int j) const { return iterator(i+j); } + template std::enable_if_t, iterator> + operator-(Int j) const { return iterator(i-j); } + template friend std::enable_if_t, iterator> + operator+(Int j, iterator k) { return k + j; } +#else + inline iterator &operator+=(qsizetype j) { i += j; return *this; } + inline iterator &operator-=(qsizetype j) { i -= j; return *this; } + inline iterator operator+(qsizetype j) const { return iterator(i + j); } + inline iterator operator-(qsizetype j) const { return iterator(i - j); } + friend inline iterator operator+(qsizetype j, iterator k) { return k + j; } +#endif + }; + + class const_iterator { + friend class QList; + friend class iterator; + const T *i = nullptr; +#ifdef QT_STRICT_QLIST_ITERATORS + inline constexpr explicit const_iterator(const T *n) : i(n) {} +#endif + + public: + using difference_type = qsizetype; + using value_type = T; +#ifdef QT_COMPILER_HAS_LWG3346 + using iterator_concept = std::contiguous_iterator_tag; +#endif + using element_type = const value_type; + using iterator_category = std::random_access_iterator_tag; + using pointer = const T *; + using reference = const T &; + + inline constexpr const_iterator() = default; +#ifndef QT_STRICT_QLIST_ITERATORS + inline constexpr explicit const_iterator(const T *n) : i(n) {} +#endif + inline constexpr const_iterator(iterator o): i(o.i) {} + inline const T &operator*() const { return *i; } + inline const T *operator->() const { return i; } + inline const T &operator[](qsizetype j) const { return *(i + j); } + inline constexpr bool operator==(const_iterator o) const { return i == o.i; } + inline constexpr bool operator!=(const_iterator o) const { return i != o.i; } + inline constexpr bool operator<(const_iterator other) const { return i < other.i; } + inline constexpr bool operator<=(const_iterator other) const { return i <= other.i; } + inline constexpr bool operator>(const_iterator other) const { return i > other.i; } + inline constexpr bool operator>=(const_iterator other) const { return i >= other.i; } + inline constexpr bool operator==(iterator o) const { return i == o.i; } + inline constexpr bool operator!=(iterator o) const { return i != o.i; } + inline constexpr bool operator<(iterator other) const { return i < other.i; } + inline constexpr bool operator<=(iterator other) const { return i <= other.i; } + inline constexpr bool operator>(iterator other) const { return i > other.i; } + inline constexpr bool operator>=(iterator other) const { return i >= other.i; } + inline constexpr bool operator==(pointer p) const { return i == p; } + inline constexpr bool operator!=(pointer p) const { return i != p; } + inline const_iterator &operator++() { ++i; return *this; } + inline const_iterator operator++(int) { auto copy = *this; ++*this; return copy; } + inline const_iterator &operator--() { --i; return *this; } + inline const_iterator operator--(int) { auto copy = *this; --*this; return copy; } + inline qsizetype operator-(const_iterator j) const { return i - j.i; } +#if QT_DEPRECATED_SINCE(6, 3) && !defined(QT_STRICT_QLIST_ITERATORS) + QT_DEPRECATED_VERSION_X_6_3("Use operator* or operator-> rather than relying on " + "the implicit conversion between a QList/QVector::const_iterator " + "and a raw pointer") + inline operator const T*() const { return i; } + + template std::enable_if_t, const_iterator> + &operator+=(Int j) { i+=j; return *this; } + template std::enable_if_t, const_iterator> + &operator-=(Int j) { i-=j; return *this; } + template std::enable_if_t, const_iterator> + operator+(Int j) const { return const_iterator(i+j); } + template std::enable_if_t, const_iterator> + operator-(Int j) const { return const_iterator(i-j); } + template friend std::enable_if_t, const_iterator> + operator+(Int j, const_iterator k) { return k + j; } +#else + inline const_iterator &operator+=(qsizetype j) { i += j; return *this; } + inline const_iterator &operator-=(qsizetype j) { i -= j; return *this; } + inline const_iterator operator+(qsizetype j) const { return const_iterator(i + j); } + inline const_iterator operator-(qsizetype j) const { return const_iterator(i - j); } + friend inline const_iterator operator+(qsizetype j, const_iterator k) { return k + j; } +#endif + }; + using Iterator = iterator; + using ConstIterator = const_iterator; + using reverse_iterator = std::reverse_iterator; + using const_reverse_iterator = std::reverse_iterator; + +private: + void resize_internal(qsizetype i); + bool isValidIterator(const_iterator i) const + { + const std::less less = {}; + return !less(d->end(), i.i) && !less(i.i, d->begin()); + } + + void verify([[maybe_unused]] qsizetype pos = 0, [[maybe_unused]] qsizetype n = 1) const + { + Q_ASSERT(pos >= 0); + Q_ASSERT(pos <= size()); + Q_ASSERT(n >= 0); + Q_ASSERT(n <= size() - pos); + } +public: + QList(DataPointer dd) noexcept + : d(dd) + { + } + +public: + QList() = default; + explicit QList(qsizetype size) + : d(size) + { + if (size) + d->appendInitialize(size); + } + QList(qsizetype size, parameter_type t) + : d(size) + { + if (size) + d->copyAppend(size, t); + } + + inline QList(std::initializer_list args) + : d(qsizetype(args.size())) + { + if (args.size()) + d->copyAppend(args.begin(), args.end()); + } + + QList &operator=(std::initializer_list args) + { + return assign(args); + } + + template = true> + QList(InputIterator i1, InputIterator i2) + { + if constexpr (!std::is_convertible_v::iterator_category, std::forward_iterator_tag>) { + std::copy(i1, i2, std::back_inserter(*this)); + } else { + const auto distance = std::distance(i1, i2); + if (distance) { + d = DataPointer(qsizetype(distance)); + // appendIteratorRange can deal with contiguous iterators on its own, + // this is an optimization for C++17 code. + if constexpr (std::is_same_v, iterator> || + std::is_same_v, const_iterator>) { + d->copyAppend(i1.i, i2.i); + } else { + d->appendIteratorRange(i1, i2); + } + } + } + } + + // This constructor is here for compatibility with QStringList in Qt 5, that has a QStringList(const QString &) constructor + template && std::is_convertible_v>> + inline explicit QList(const String &str) + { append(str); } + + QList(qsizetype size, Qt::Initialization) + : d(size) + { + if (size) + d->appendUninitialized(size); + } + + // compiler-generated special member functions are fine! + + void swap(QList &other) noexcept { d.swap(other.d); } + +#ifndef Q_QDOC + template + QTypeTraits::compare_eq_result_container operator==(const QList &other) const + { + if (size() != other.size()) + return false; + if (begin() == other.begin()) + return true; + + // do element-by-element comparison + return std::equal(begin(), end(), other.begin(), other.end()); + } + template + QTypeTraits::compare_eq_result_container operator!=(const QList &other) const + { + return !(*this == other); + } + + template + QTypeTraits::compare_lt_result_container operator<(const QList &other) const + noexcept(noexcept(std::lexicographical_compare::const_iterator, + typename QList::const_iterator>( + std::declval>().begin(), std::declval>().end(), + other.begin(), other.end()))) + { + return std::lexicographical_compare(begin(), end(), + other.begin(), other.end()); + } + + template + QTypeTraits::compare_lt_result_container operator>(const QList &other) const + noexcept(noexcept(other < std::declval>())) + { + return other < *this; + } + + template + QTypeTraits::compare_lt_result_container operator<=(const QList &other) const + noexcept(noexcept(other < std::declval>())) + { + return !(other < *this); + } + + template + QTypeTraits::compare_lt_result_container operator>=(const QList &other) const + noexcept(noexcept(std::declval>() < other)) + { + return !(*this < other); + } +#else + bool operator==(const QList &other) const; + bool operator!=(const QList &other) const; + bool operator<(const QList &other) const; + bool operator>(const QList &other) const; + bool operator<=(const QList &other) const; + bool operator>=(const QList &other) const; +#endif // Q_QDOC + + static constexpr qsizetype maxSize() { return Data::maxSize(); } + qsizetype size() const noexcept { return d->size; } + qsizetype count() const noexcept { return size(); } + qsizetype length() const noexcept { return size(); } + + inline bool isEmpty() const noexcept { return d->size == 0; } + + void resize(qsizetype size) + { + resize_internal(size); + if (size > this->size()) + d->appendInitialize(size); + } + void resize(qsizetype size, parameter_type c) + { + resize_internal(size); + if (size > this->size()) + d->copyAppend(size - this->size(), c); + } + void resizeForOverwrite(qsizetype size) + { + resize_internal(size); + if (size > this->size()) + d->appendUninitialized(size); + } + + inline qsizetype capacity() const { return qsizetype(d->constAllocatedCapacity()); } + void reserve(qsizetype size); + inline void squeeze(); + + void detach() { d.detach(); } + bool isDetached() const noexcept { return !d->isShared(); } + + inline bool isSharedWith(const QList &other) const { return d == other.d; } + + pointer data() { detach(); return d->data(); } + const_pointer data() const noexcept { return d->data(); } + const_pointer constData() const noexcept { return d->data(); } + void clear() { + if (!size()) + return; + if (d->needsDetach()) { + // must allocate memory + DataPointer detached(d.allocatedCapacity()); + d.swap(detached); + } else { + d->truncate(0); + } + } + + const_reference at(qsizetype i) const noexcept + { + Q_ASSERT_X(size_t(i) < size_t(d->size), "QList::at", "index out of range"); + return data()[i]; + } + reference operator[](qsizetype i) + { + Q_ASSERT_X(size_t(i) < size_t(d->size), "QList::operator[]", "index out of range"); + // don't detach() here, we detach in data below: + return data()[i]; + } + const_reference operator[](qsizetype i) const noexcept { return at(i); } + void append(parameter_type t) { emplaceBack(t); } + void append(const_iterator i1, const_iterator i2); + void append(rvalue_ref t) + { + if constexpr (DataPointer::pass_parameter_by_value) { + Q_UNUSED(t); + } else { + emplaceBack(std::move(t)); + } + } + void append(const QList &l) + { + append(l.constBegin(), l.constEnd()); + } + void append(QList &&l); + void prepend(rvalue_ref t) { + if constexpr (DataPointer::pass_parameter_by_value) { + Q_UNUSED(t); + } else { + emplaceFront(std::move(t)); + } + } + void prepend(parameter_type t) { emplaceFront(t); } + + template + inline reference emplaceBack(Args &&... args); + + template + inline reference emplaceFront(Args&&... args); + + iterator insert(qsizetype i, parameter_type t) + { return emplace(i, t); } + iterator insert(qsizetype i, qsizetype n, parameter_type t); + iterator insert(const_iterator before, parameter_type t) + { + Q_ASSERT_X(isValidIterator(before), "QList::insert", "The specified iterator argument 'before' is invalid"); + return insert(before, 1, t); + } + iterator insert(const_iterator before, qsizetype n, parameter_type t) + { + Q_ASSERT_X(isValidIterator(before), "QList::insert", "The specified iterator argument 'before' is invalid"); + return insert(std::distance(constBegin(), before), n, t); + } + iterator insert(const_iterator before, rvalue_ref t) + { + Q_ASSERT_X(isValidIterator(before), "QList::insert", "The specified iterator argument 'before' is invalid"); + return insert(std::distance(constBegin(), before), std::move(t)); + } + iterator insert(qsizetype i, rvalue_ref t) { + if constexpr (DataPointer::pass_parameter_by_value) { + Q_UNUSED(i); + Q_UNUSED(t); + return end(); + } else { + return emplace(i, std::move(t)); + } + } + + QList &assign(qsizetype n, parameter_type t) + { + Q_ASSERT(n >= 0); + return fill(t, n); + } + + template = true> + QList &assign(InputIterator first, InputIterator last) + { d.assign(first, last); return *this; } + + QList &assign(std::initializer_list l) + { return assign(l.begin(), l.end()); } + + template + iterator emplace(const_iterator before, Args&&... args) + { + Q_ASSERT_X(isValidIterator(before), "QList::emplace", "The specified iterator argument 'before' is invalid"); + return emplace(std::distance(constBegin(), before), std::forward(args)...); + } + + template + iterator emplace(qsizetype i, Args&&... args); +#if 0 + template< class InputIt > + iterator insert( const_iterator pos, InputIt first, InputIt last ); + iterator insert( const_iterator pos, std::initializer_list ilist ); +#endif + void replace(qsizetype i, parameter_type t) + { + Q_ASSERT_X(i >= 0 && i < d->size, "QList::replace", "index out of range"); + DataPointer oldData; + d.detach(&oldData); + d.data()[i] = t; + } + void replace(qsizetype i, rvalue_ref t) + { + if constexpr (DataPointer::pass_parameter_by_value) { + Q_UNUSED(i); + Q_UNUSED(t); + } else { + Q_ASSERT_X(i >= 0 && i < d->size, "QList::replace", "index out of range"); + DataPointer oldData; + d.detach(&oldData); + d.data()[i] = std::move(t); + } + } + + void remove(qsizetype i, qsizetype n = 1); + void removeFirst() noexcept; + void removeLast() noexcept; + value_type takeFirst() { Q_ASSERT(!isEmpty()); value_type v = std::move(first()); d->eraseFirst(); return v; } + value_type takeLast() { Q_ASSERT(!isEmpty()); value_type v = std::move(last()); d->eraseLast(); return v; } + + QList &fill(parameter_type t, qsizetype size = -1); + +#ifndef Q_QDOC + using QListSpecialMethods::contains; + using QListSpecialMethods::indexOf; + using QListSpecialMethods::lastIndexOf; +#else + template + qsizetype indexOf(const AT &t, qsizetype from = 0) const noexcept; + template + qsizetype lastIndexOf(const AT &t, qsizetype from = -1) const noexcept; + template + bool contains(const AT &t) const noexcept; +#endif + + template + qsizetype count(const AT &t) const noexcept + { + return qsizetype(std::count(data(), data() + size(), t)); + } + + void removeAt(qsizetype i) { remove(i); } + template + qsizetype removeAll(const AT &t) + { + return QtPrivate::sequential_erase_with_copy(*this, t); + } + + template + bool removeOne(const AT &t) + { + return QtPrivate::sequential_erase_one(*this, t); + } + + template + qsizetype removeIf(Predicate pred) + { + return QtPrivate::sequential_erase_if(*this, pred); + } + + T takeAt(qsizetype i) { T t = std::move((*this)[i]); remove(i); return t; } + void move(qsizetype from, qsizetype to) + { + Q_ASSERT_X(from >= 0 && from < size(), "QList::move(qsizetype, qsizetype)", "'from' is out-of-range"); + Q_ASSERT_X(to >= 0 && to < size(), "QList::move(qsizetype, qsizetype)", "'to' is out-of-range"); + if (from == to) // don't detach when no-op + return; + detach(); + T * const b = d->begin(); + if (from < to) + std::rotate(b + from, b + from + 1, b + to + 1); + else + std::rotate(b + to, b + from, b + from + 1); + } + + // STL-style + iterator begin() { detach(); return iterator(d->begin()); } + iterator end() { detach(); return iterator(d->end()); } + + const_iterator begin() const noexcept { return const_iterator(d->constBegin()); } + const_iterator end() const noexcept { return const_iterator(d->constEnd()); } + const_iterator cbegin() const noexcept { return const_iterator(d->constBegin()); } + const_iterator cend() const noexcept { return const_iterator(d->constEnd()); } + const_iterator constBegin() const noexcept { return const_iterator(d->constBegin()); } + const_iterator constEnd() const noexcept { return const_iterator(d->constEnd()); } + reverse_iterator rbegin() { return reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } + const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } + const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } + const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } + + iterator erase(const_iterator begin, const_iterator end); + inline iterator erase(const_iterator pos) { return erase(pos, pos+1); } + + // more Qt + inline T& first() { Q_ASSERT(!isEmpty()); return *begin(); } + inline const T &first() const noexcept { Q_ASSERT(!isEmpty()); return *begin(); } + inline const T &constFirst() const noexcept { Q_ASSERT(!isEmpty()); return *begin(); } + inline T& last() { Q_ASSERT(!isEmpty()); return *(end()-1); } + inline const T &last() const noexcept { Q_ASSERT(!isEmpty()); return *(end()-1); } + inline const T &constLast() const noexcept { Q_ASSERT(!isEmpty()); return *(end()-1); } + inline bool startsWith(parameter_type t) const { return !isEmpty() && first() == t; } + inline bool endsWith(parameter_type t) const { return !isEmpty() && last() == t; } + QList mid(qsizetype pos, qsizetype len = -1) const; + + QList first(qsizetype n) const + { verify(0, n); return QList(begin(), begin() + n); } + QList last(qsizetype n) const + { verify(0, n); return QList(end() - n, end()); } + QList sliced(qsizetype pos) const + { verify(pos, 0); return QList(begin() + pos, end()); } + QList sliced(qsizetype pos, qsizetype n) const + { verify(pos, n); return QList(begin() + pos, begin() + pos + n); } + + T value(qsizetype i) const { return value(i, T()); } + T value(qsizetype i, parameter_type defaultValue) const; + + void swapItemsAt(qsizetype i, qsizetype j) { + Q_ASSERT_X(i >= 0 && i < size() && j >= 0 && j < size(), + "QList::swap", "index out of range"); + detach(); + qSwap(d->begin()[i], d->begin()[j]); + } + + // STL compatibility + inline void push_back(parameter_type t) { append(t); } + void push_back(rvalue_ref t) { append(std::move(t)); } + void push_front(rvalue_ref t) { prepend(std::move(t)); } + inline void push_front(parameter_type t) { prepend(t); } + void pop_back() noexcept { removeLast(); } + void pop_front() noexcept { removeFirst(); } + + template + reference emplace_back(Args&&... args) { return emplaceBack(std::forward(args)...); } + + inline bool empty() const noexcept + { return d->size == 0; } + inline reference front() { return first(); } + inline const_reference front() const noexcept { return first(); } + inline reference back() { return last(); } + inline const_reference back() const noexcept { return last(); } + void shrink_to_fit() { squeeze(); } + constexpr qsizetype max_size() const noexcept + { + return maxSize(); + } + + // comfort + QList &operator+=(const QList &l) { append(l); return *this; } + QList &operator+=(QList &&l) { append(std::move(l)); return *this; } + inline QList operator+(const QList &l) const & + { QList n = *this; n += l; return n; } + QList operator+(const QList &l) && + { return std::move(*this += l); } + inline QList operator+(QList &&l) const & + { QList n = *this; n += std::move(l); return n; } + QList operator+(QList &&l) && + { return std::move(*this += std::move(l)); } + inline QList &operator+=(parameter_type t) + { append(t); return *this; } + inline QList &operator<< (parameter_type t) + { append(t); return *this; } + inline QList &operator<<(const QList &l) + { *this += l; return *this; } + inline QList &operator<<(QList &&l) + { *this += std::move(l); return *this; } + inline QList &operator+=(rvalue_ref t) + { append(std::move(t)); return *this; } + inline QList &operator<<(rvalue_ref t) + { append(std::move(t)); return *this; } + + // Consider deprecating in 6.4 or later + static QList fromList(const QList &list) noexcept { return list; } + QList toList() const noexcept { return *this; } + + static inline QList fromVector(const QList &vector) noexcept { return vector; } + inline QList toVector() const noexcept { return *this; } + + template + static QList fromReadOnlyData(const T (&t)[N]) noexcept + { + return QList({ nullptr, const_cast(t), N }); + } +}; + +template ::value_type, + QtPrivate::IfIsInputIterator = true> +QList(InputIterator, InputIterator) -> QList; + +template +inline void QList::resize_internal(qsizetype newSize) +{ + Q_ASSERT(newSize >= 0); + + if (d->needsDetach() || newSize > capacity() - d.freeSpaceAtBegin()) { + d.detachAndGrow(QArrayData::GrowsAtEnd, newSize - d.size, nullptr, nullptr); + } else if (newSize < size()) { + d->truncate(newSize); + } +} + +template +void QList::reserve(qsizetype asize) +{ + // capacity() == 0 for immutable data, so this will force a detaching below + if (asize <= capacity() - d.freeSpaceAtBegin()) { + if (d->flags() & Data::CapacityReserved) + return; // already reserved, don't shrink + if (!d->isShared()) { + // accept current allocation, don't shrink + d->setFlag(Data::CapacityReserved); + return; + } + } + + DataPointer detached(qMax(asize, size())); + detached->copyAppend(d->begin(), d->end()); + if (detached.d_ptr()) + detached->setFlag(Data::CapacityReserved); + d.swap(detached); +} + +template +inline void QList::squeeze() +{ + if (!d.isMutable()) + return; + if (d->needsDetach() || size() < capacity()) { + // must allocate memory + DataPointer detached(size()); + if (size()) { + if (d.needsDetach()) + detached->copyAppend(d.data(), d.data() + d.size); + else + detached->moveAppend(d.data(), d.data() + d.size); + } + d.swap(detached); + } + // We're detached so this is fine + d->clearFlag(Data::CapacityReserved); +} + +template +inline void QList::remove(qsizetype i, qsizetype n) +{ + Q_ASSERT_X(size_t(i) + size_t(n) <= size_t(d->size), "QList::remove", "index out of range"); + Q_ASSERT_X(n >= 0, "QList::remove", "invalid count"); + + if (n == 0) + return; + + d.detach(); + d->erase(d->begin() + i, n); +} + +template +inline void QList::removeFirst() noexcept +{ + Q_ASSERT(!isEmpty()); + d.detach(); + d->eraseFirst(); +} + +template +inline void QList::removeLast() noexcept +{ + Q_ASSERT(!isEmpty()); + d.detach(); + d->eraseLast(); +} + + +template +inline T QList::value(qsizetype i, parameter_type defaultValue) const +{ + return size_t(i) < size_t(d->size) ? at(i) : defaultValue; +} + +template +inline void QList::append(const_iterator i1, const_iterator i2) +{ + d->growAppend(i1.i, i2.i); +} + +template +inline void QList::append(QList &&other) +{ + Q_ASSERT(&other != this); + if (other.isEmpty()) + return; + if (other.d->needsDetach() || !std::is_nothrow_move_constructible_v) + return append(other); + + // due to precondition &other != this, we can unconditionally modify 'this' + d.detachAndGrow(QArrayData::GrowsAtEnd, other.size(), nullptr, nullptr); + Q_ASSERT(d.freeSpaceAtEnd() >= other.size()); + d->moveAppend(other.d->begin(), other.d->end()); +} + +template +template +inline typename QList::reference QList::emplaceFront(Args &&... args) +{ + d->emplace(0, std::forward(args)...); + return *d.begin(); +} + + +template +inline typename QList::iterator +QList::insert(qsizetype i, qsizetype n, parameter_type t) +{ + Q_ASSERT_X(size_t(i) <= size_t(d->size), "QList::insert", "index out of range"); + Q_ASSERT_X(n >= 0, "QList::insert", "invalid count"); + if (Q_LIKELY(n)) + d->insert(i, n, t); + return begin() + i; +} + +template +template +typename QList::iterator +QList::emplace(qsizetype i, Args&&... args) +{ + Q_ASSERT_X(i >= 0 && i <= d->size, "QList::insert", "index out of range"); + d->emplace(i, std::forward(args)...); + return begin() + i; +} + +template +template +inline typename QList::reference QList::emplaceBack(Args &&... args) +{ + d->emplace(d->size, std::forward(args)...); + return *(end() - 1); +} + +template +typename QList::iterator QList::erase(const_iterator abegin, const_iterator aend) +{ + Q_ASSERT_X(isValidIterator(abegin), "QList::erase", "The specified iterator argument 'abegin' is invalid"); + Q_ASSERT_X(isValidIterator(aend), "QList::erase", "The specified iterator argument 'aend' is invalid"); + Q_ASSERT(aend >= abegin); + + qsizetype i = std::distance(constBegin(), abegin); + qsizetype n = std::distance(abegin, aend); + remove(i, n); + + return begin() + i; +} + +template +inline QList &QList::fill(parameter_type t, qsizetype newSize) +{ + if (newSize == -1) + newSize = size(); + if (d->needsDetach() || newSize > capacity()) { + // must allocate memory + DataPointer detached(d->detachCapacity(newSize)); + detached->copyAppend(newSize, t); + d.swap(detached); + } else { + // we're detached + const T copy(t); + d->assign(d.begin(), d.begin() + qMin(size(), newSize), t); + if (newSize > size()) { + d->copyAppend(newSize - size(), copy); + } else if (newSize < size()) { + d->truncate(newSize); + } + } + return *this; +} + +namespace QtPrivate { +template +qsizetype indexOf(const QList &vector, const U &u, qsizetype from) noexcept +{ + if (from < 0) + from = qMax(from + vector.size(), qsizetype(0)); + if (from < vector.size()) { + auto n = vector.begin() + from - 1; + auto e = vector.end(); + while (++n != e) + if (*n == u) + return qsizetype(n - vector.begin()); + } + return -1; +} + +template +qsizetype lastIndexOf(const QList &vector, const U &u, qsizetype from) noexcept +{ + if (from < 0) + from += vector.d->size; + else if (from >= vector.size()) + from = vector.size() - 1; + if (from >= 0) { + auto b = vector.begin(); + auto n = vector.begin() + from + 1; + while (n != b) { + if (*--n == u) + return qsizetype(n - b); + } + } + return -1; +} +} + +template +template +qsizetype QListSpecialMethodsBase::indexOf(const AT &t, qsizetype from) const noexcept +{ + return QtPrivate::indexOf(*self(), t, from); +} + +template +template +qsizetype QListSpecialMethodsBase::lastIndexOf(const AT &t, qsizetype from) const noexcept +{ + return QtPrivate::lastIndexOf(*self(), t, from); +} + +template +inline QList QList::mid(qsizetype pos, qsizetype len) const +{ + qsizetype p = pos; + qsizetype l = len; + using namespace QtPrivate; + switch (QContainerImplHelper::mid(d.size, &p, &l)) { + case QContainerImplHelper::Null: + case QContainerImplHelper::Empty: + return QList(); + case QContainerImplHelper::Full: + return *this; + case QContainerImplHelper::Subset: + break; + } + + // Allocate memory + DataPointer copied(l); + copied->copyAppend(data() + p, data() + p + l); + return copied; +} + +Q_DECLARE_SEQUENTIAL_ITERATOR(List) +Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(List) + +template +size_t qHash(const QList &key, size_t seed = 0) + noexcept(noexcept(qHashRange(key.cbegin(), key.cend(), seed))) +{ + return qHashRange(key.cbegin(), key.cend(), seed); +} + +template +qsizetype erase(QList &list, const AT &t) +{ + return QtPrivate::sequential_erase(list, t); +} + +template +qsizetype erase_if(QList &list, Predicate pred) +{ + return QtPrivate::sequential_erase_if(list, pred); +} + +// ### Qt 7 char32_t +QList QStringView::toUcs4() const { return QtPrivate::convertToUcs4(*this); } + +QT_END_NAMESPACE + +#include +#include + +#endif // QLIST_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qlocale.h b/qt/6.8.1/msvc2022_64/include/QtCore/qlocale.h new file mode 100644 index 0000000000000000000000000000000000000000..fe251cf6967e0d6ca1637ce2602c15be4575a4f2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qlocale.h @@ -0,0 +1,1208 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QLOCALE_H +#define QLOCALE_H + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QCalendar; +class QDataStream; +class QDate; +class QDateTime; +class QLocale; +class QTime; +class QVariant; +class QTextStream; +class QTextStreamPrivate; + +class QLocalePrivate; + +Q_CORE_EXPORT size_t qHash(const QLocale &key, size_t seed = 0) noexcept; + +class Q_CORE_EXPORT QLocale +{ + Q_GADGET + friend class QString; + friend class QByteArray; + friend class QIntValidator; + friend class QDoubleValidatorPrivate; + friend class QTextStream; + friend class QTextStreamPrivate; + +public: + static constexpr int DefaultTwoDigitBaseYear = 1900; + +// see qlocale_data_p.h for more info on generated data +// GENERATED PART STARTS HERE + enum Language : ushort { + AnyLanguage = 0, + C = 1, + Abkhazian = 2, + Afar = 3, + Afrikaans = 4, + Aghem = 5, + Akan = 6, + Akkadian = 7, + Akoose = 8, + Albanian = 9, + AmericanSignLanguage = 10, + Amharic = 11, + AncientEgyptian = 12, + AncientGreek = 13, + Arabic = 14, + Aragonese = 15, + Aramaic = 16, + Armenian = 17, + Assamese = 18, + Asturian = 19, + Asu = 20, + Atsam = 21, + Avaric = 22, + Avestan = 23, + Aymara = 24, + Azerbaijani = 25, + Bafia = 26, + Balinese = 27, + Bambara = 28, + Bamun = 29, + Bangla = 30, + Basaa = 31, + Bashkir = 32, + Basque = 33, + BatakToba = 34, + Belarusian = 35, + Bemba = 36, + Bena = 37, + Bhojpuri = 38, + Bislama = 39, + Blin = 40, + Bodo = 41, + Bosnian = 42, + Breton = 43, + Buginese = 44, + Bulgarian = 45, + Burmese = 46, + Cantonese = 47, + Catalan = 48, + Cebuano = 49, + CentralAtlasTamazight = 50, + CentralKurdish = 51, + Chakma = 52, + Chamorro = 53, + Chechen = 54, + Cherokee = 55, + Chickasaw = 56, + Chiga = 57, + Chinese = 58, + Church = 59, + Chuvash = 60, + Colognian = 61, + Coptic = 62, + Cornish = 63, + Corsican = 64, + Cree = 65, + Croatian = 66, + Czech = 67, + Danish = 68, + Divehi = 69, + Dogri = 70, + Duala = 71, + Dutch = 72, + Dzongkha = 73, + Embu = 74, + English = 75, + Erzya = 76, + Esperanto = 77, + Estonian = 78, + Ewe = 79, + Ewondo = 80, + Faroese = 81, + Fijian = 82, + Filipino = 83, + Finnish = 84, + French = 85, + Friulian = 86, + Fulah = 87, + Gaelic = 88, + Ga = 89, + Galician = 90, + Ganda = 91, + Geez = 92, + Georgian = 93, + German = 94, + Gothic = 95, + Greek = 96, + Guarani = 97, + Gujarati = 98, + Gusii = 99, + Haitian = 100, + Hausa = 101, + Hawaiian = 102, + Hebrew = 103, + Herero = 104, + Hindi = 105, + HiriMotu = 106, + Hungarian = 107, + Icelandic = 108, + Ido = 109, + Igbo = 110, + InariSami = 111, + Indonesian = 112, + Ingush = 113, + Interlingua = 114, + Interlingue = 115, + Inuktitut = 116, + Inupiaq = 117, + Irish = 118, + Italian = 119, + Japanese = 120, + Javanese = 121, + Jju = 122, + JolaFonyi = 123, + Kabuverdianu = 124, + Kabyle = 125, + Kako = 126, + Kalaallisut = 127, + Kalenjin = 128, + Kamba = 129, + Kannada = 130, + Kanuri = 131, + Kashmiri = 132, + Kazakh = 133, + Kenyang = 134, + Khmer = 135, + Kiche = 136, + Kikuyu = 137, + Kinyarwanda = 138, + Komi = 139, + Kongo = 140, + Konkani = 141, + Korean = 142, + Koro = 143, + KoyraboroSenni = 144, + KoyraChiini = 145, + Kpelle = 146, + Kuanyama = 147, + Kurdish = 148, + Kwasio = 149, + Kyrgyz = 150, + Lakota = 151, + Langi = 152, + Lao = 153, + Latin = 154, + Latvian = 155, + Lezghian = 156, + Limburgish = 157, + Lingala = 158, + LiteraryChinese = 159, + Lithuanian = 160, + Lojban = 161, + LowerSorbian = 162, + LowGerman = 163, + LubaKatanga = 164, + LuleSami = 165, + Luo = 166, + Luxembourgish = 167, + Luyia = 168, + Macedonian = 169, + Machame = 170, + Maithili = 171, + MakhuwaMeetto = 172, + Makonde = 173, + Malagasy = 174, + Malayalam = 175, + Malay = 176, + Maltese = 177, + Mandingo = 178, + Manipuri = 179, + Manx = 180, + Maori = 181, + Mapuche = 182, + Marathi = 183, + Marshallese = 184, + Masai = 185, + Mazanderani = 186, + Mende = 187, + Meru = 188, + Meta = 189, + Mohawk = 190, + Mongolian = 191, + Morisyen = 192, + Mundang = 193, + Muscogee = 194, + Nama = 195, + NauruLanguage = 196, + Navajo = 197, + Ndonga = 198, + Nepali = 199, + Newari = 200, + Ngiemboon = 201, + Ngomba = 202, + NigerianPidgin = 203, + Nko = 204, + NorthernLuri = 205, + NorthernSami = 206, + NorthernSotho = 207, + NorthNdebele = 208, + NorwegianBokmal = 209, + NorwegianNynorsk = 210, + Nuer = 211, + Nyanja = 212, + Nyankole = 213, + Occitan = 214, + Odia = 215, + Ojibwa = 216, + OldIrish = 217, + OldNorse = 218, + OldPersian = 219, + Oromo = 220, + Osage = 221, + Ossetic = 222, + Pahlavi = 223, + Palauan = 224, + Pali = 225, + Papiamento = 226, + Pashto = 227, + Persian = 228, + Phoenician = 229, + Polish = 230, + Portuguese = 231, + Prussian = 232, + Punjabi = 233, + Quechua = 234, + Romanian = 235, + Romansh = 236, + Rombo = 237, + Rundi = 238, + Russian = 239, + Rwa = 240, + Saho = 241, + Sakha = 242, + Samburu = 243, + Samoan = 244, + Sango = 245, + Sangu = 246, + Sanskrit = 247, + Santali = 248, + Sardinian = 249, + Saurashtra = 250, + Sena = 251, + Serbian = 252, + Shambala = 253, + Shona = 254, + SichuanYi = 255, + Sicilian = 256, + Sidamo = 257, + Silesian = 258, + Sindhi = 259, + Sinhala = 260, + SkoltSami = 261, + Slovak = 262, + Slovenian = 263, + Soga = 264, + Somali = 265, + SouthernKurdish = 266, + SouthernSami = 267, + SouthernSotho = 268, + SouthNdebele = 269, + Spanish = 270, + StandardMoroccanTamazight = 271, + Sundanese = 272, + Swahili = 273, + Swati = 274, + Swedish = 275, + SwissGerman = 276, + Syriac = 277, + Tachelhit = 278, + Tahitian = 279, + TaiDam = 280, + Taita = 281, + Tajik = 282, + Tamil = 283, + Taroko = 284, + Tasawaq = 285, + Tatar = 286, + Telugu = 287, + Teso = 288, + Thai = 289, + Tibetan = 290, + Tigre = 291, + Tigrinya = 292, + TokelauLanguage = 293, + TokPisin = 294, + Tongan = 295, + Tsonga = 296, + Tswana = 297, + Turkish = 298, + Turkmen = 299, + TuvaluLanguage = 300, + Tyap = 301, + Ugaritic = 302, + Ukrainian = 303, + UpperSorbian = 304, + Urdu = 305, + Uyghur = 306, + Uzbek = 307, + Vai = 308, + Venda = 309, + Vietnamese = 310, + Volapuk = 311, + Vunjo = 312, + Walloon = 313, + Walser = 314, + Warlpiri = 315, + Welsh = 316, + WesternBalochi = 317, + WesternFrisian = 318, + Wolaytta = 319, + Wolof = 320, + Xhosa = 321, + Yangben = 322, + Yiddish = 323, + Yoruba = 324, + Zarma = 325, + Zhuang = 326, + Zulu = 327, + Kaingang = 328, + Nheengatu = 329, + Haryanvi = 330, + NorthernFrisian = 331, + Rajasthani = 332, + Moksha = 333, + TokiPona = 334, + Pijin = 335, + Obolo = 336, + Baluchi = 337, + Ligurian = 338, + Rohingya = 339, + Torwali = 340, + Anii = 341, + Kangri = 342, + Venetian = 343, + Kuvi = 344, + + Afan = Oromo, + Bengali = Bangla, + Bhutani = Dzongkha, + Byelorussian = Belarusian, + Cambodian = Khmer, + CentralMoroccoTamazight = CentralAtlasTamazight, + Chewa = Nyanja, + Frisian = WesternFrisian, + Greenlandic = Kalaallisut, + Inupiak = Inupiaq, + Kirghiz = Kyrgyz, + Kurundi = Rundi, + Kwanyama = Kuanyama, + Navaho = Navajo, + Oriya = Odia, + RhaetoRomance = Romansh, + Uighur = Uyghur, + Uigur = Uyghur, + Walamo = Wolaytta, + + LastLanguage = Kuvi + }; + + enum Script : ushort { + AnyScript = 0, + AdlamScript = 1, + AhomScript = 2, + AnatolianHieroglyphsScript = 3, + ArabicScript = 4, + ArmenianScript = 5, + AvestanScript = 6, + BalineseScript = 7, + BamumScript = 8, + BanglaScript = 9, + BassaVahScript = 10, + BatakScript = 11, + BhaiksukiScript = 12, + BopomofoScript = 13, + BrahmiScript = 14, + BrailleScript = 15, + BugineseScript = 16, + BuhidScript = 17, + CanadianAboriginalScript = 18, + CarianScript = 19, + CaucasianAlbanianScript = 20, + ChakmaScript = 21, + ChamScript = 22, + CherokeeScript = 23, + CopticScript = 24, + CuneiformScript = 25, + CypriotScript = 26, + CyrillicScript = 27, + DeseretScript = 28, + DevanagariScript = 29, + DuployanScript = 30, + EgyptianHieroglyphsScript = 31, + ElbasanScript = 32, + EthiopicScript = 33, + FraserScript = 34, + GeorgianScript = 35, + GlagoliticScript = 36, + GothicScript = 37, + GranthaScript = 38, + GreekScript = 39, + GujaratiScript = 40, + GurmukhiScript = 41, + HangulScript = 42, + HanScript = 43, + HanunooScript = 44, + HanWithBopomofoScript = 45, + HatranScript = 46, + HebrewScript = 47, + HiraganaScript = 48, + ImperialAramaicScript = 49, + InscriptionalPahlaviScript = 50, + InscriptionalParthianScript = 51, + JamoScript = 52, + JapaneseScript = 53, + JavaneseScript = 54, + KaithiScript = 55, + KannadaScript = 56, + KatakanaScript = 57, + KayahLiScript = 58, + KharoshthiScript = 59, + KhmerScript = 60, + KhojkiScript = 61, + KhudawadiScript = 62, + KoreanScript = 63, + LannaScript = 64, + LaoScript = 65, + LatinScript = 66, + LepchaScript = 67, + LimbuScript = 68, + LinearAScript = 69, + LinearBScript = 70, + LycianScript = 71, + LydianScript = 72, + MahajaniScript = 73, + MalayalamScript = 74, + MandaeanScript = 75, + ManichaeanScript = 76, + MarchenScript = 77, + MeiteiMayekScript = 78, + MendeScript = 79, + MeroiticCursiveScript = 80, + MeroiticScript = 81, + ModiScript = 82, + MongolianScript = 83, + MroScript = 84, + MultaniScript = 85, + MyanmarScript = 86, + NabataeanScript = 87, + NewaScript = 88, + NewTaiLueScript = 89, + NkoScript = 90, + OdiaScript = 91, + OghamScript = 92, + OlChikiScript = 93, + OldHungarianScript = 94, + OldItalicScript = 95, + OldNorthArabianScript = 96, + OldPermicScript = 97, + OldPersianScript = 98, + OldSouthArabianScript = 99, + OrkhonScript = 100, + OsageScript = 101, + OsmanyaScript = 102, + PahawhHmongScript = 103, + PalmyreneScript = 104, + PauCinHauScript = 105, + PhagsPaScript = 106, + PhoenicianScript = 107, + PollardPhoneticScript = 108, + PsalterPahlaviScript = 109, + RejangScript = 110, + RunicScript = 111, + SamaritanScript = 112, + SaurashtraScript = 113, + SharadaScript = 114, + ShavianScript = 115, + SiddhamScript = 116, + SignWritingScript = 117, + SimplifiedHanScript = 118, + SinhalaScript = 119, + SoraSompengScript = 120, + SundaneseScript = 121, + SylotiNagriScript = 122, + SyriacScript = 123, + TagalogScript = 124, + TagbanwaScript = 125, + TaiLeScript = 126, + TaiVietScript = 127, + TakriScript = 128, + TamilScript = 129, + TangutScript = 130, + TeluguScript = 131, + ThaanaScript = 132, + ThaiScript = 133, + TibetanScript = 134, + TifinaghScript = 135, + TirhutaScript = 136, + TraditionalHanScript = 137, + UgariticScript = 138, + VaiScript = 139, + VarangKshitiScript = 140, + YiScript = 141, + HanifiScript = 142, + + BengaliScript = BanglaScript, + MendeKikakuiScript = MendeScript, + OriyaScript = OdiaScript, + SimplifiedChineseScript = SimplifiedHanScript, + TraditionalChineseScript = TraditionalHanScript, + + LastScript = HanifiScript + }; + + // ### Qt 7: Rename to Territory + enum Country : ushort { + AnyTerritory = 0, + Afghanistan = 1, + AlandIslands = 2, + Albania = 3, + Algeria = 4, + AmericanSamoa = 5, + Andorra = 6, + Angola = 7, + Anguilla = 8, + Antarctica = 9, + AntiguaAndBarbuda = 10, + Argentina = 11, + Armenia = 12, + Aruba = 13, + AscensionIsland = 14, + Australia = 15, + Austria = 16, + Azerbaijan = 17, + Bahamas = 18, + Bahrain = 19, + Bangladesh = 20, + Barbados = 21, + Belarus = 22, + Belgium = 23, + Belize = 24, + Benin = 25, + Bermuda = 26, + Bhutan = 27, + Bolivia = 28, + BosniaAndHerzegovina = 29, + Botswana = 30, + BouvetIsland = 31, + Brazil = 32, + BritishIndianOceanTerritory = 33, + BritishVirginIslands = 34, + Brunei = 35, + Bulgaria = 36, + BurkinaFaso = 37, + Burundi = 38, + Cambodia = 39, + Cameroon = 40, + Canada = 41, + CanaryIslands = 42, + CapeVerde = 43, + CaribbeanNetherlands = 44, + CaymanIslands = 45, + CentralAfricanRepublic = 46, + CeutaAndMelilla = 47, + Chad = 48, + Chile = 49, + China = 50, + ChristmasIsland = 51, + ClippertonIsland = 52, + CocosIslands = 53, + Colombia = 54, + Comoros = 55, + CongoBrazzaville = 56, + CongoKinshasa = 57, + CookIslands = 58, + CostaRica = 59, + Croatia = 60, + Cuba = 61, + Curacao = 62, + Cyprus = 63, + Czechia = 64, + Denmark = 65, + DiegoGarcia = 66, + Djibouti = 67, + Dominica = 68, + DominicanRepublic = 69, + Ecuador = 70, + Egypt = 71, + ElSalvador = 72, + EquatorialGuinea = 73, + Eritrea = 74, + Estonia = 75, + Eswatini = 76, + Ethiopia = 77, + Europe = 78, + EuropeanUnion = 79, + FalklandIslands = 80, + FaroeIslands = 81, + Fiji = 82, + Finland = 83, + France = 84, + FrenchGuiana = 85, + FrenchPolynesia = 86, + FrenchSouthernTerritories = 87, + Gabon = 88, + Gambia = 89, + Georgia = 90, + Germany = 91, + Ghana = 92, + Gibraltar = 93, + Greece = 94, + Greenland = 95, + Grenada = 96, + Guadeloupe = 97, + Guam = 98, + Guatemala = 99, + Guernsey = 100, + GuineaBissau = 101, + Guinea = 102, + Guyana = 103, + Haiti = 104, + HeardAndMcDonaldIslands = 105, + Honduras = 106, + HongKong = 107, + Hungary = 108, + Iceland = 109, + India = 110, + Indonesia = 111, + Iran = 112, + Iraq = 113, + Ireland = 114, + IsleOfMan = 115, + Israel = 116, + Italy = 117, + IvoryCoast = 118, + Jamaica = 119, + Japan = 120, + Jersey = 121, + Jordan = 122, + Kazakhstan = 123, + Kenya = 124, + Kiribati = 125, + Kosovo = 126, + Kuwait = 127, + Kyrgyzstan = 128, + Laos = 129, + LatinAmerica = 130, + Latvia = 131, + Lebanon = 132, + Lesotho = 133, + Liberia = 134, + Libya = 135, + Liechtenstein = 136, + Lithuania = 137, + Luxembourg = 138, + Macao = 139, + Macedonia = 140, + Madagascar = 141, + Malawi = 142, + Malaysia = 143, + Maldives = 144, + Mali = 145, + Malta = 146, + MarshallIslands = 147, + Martinique = 148, + Mauritania = 149, + Mauritius = 150, + Mayotte = 151, + Mexico = 152, + Micronesia = 153, + Moldova = 154, + Monaco = 155, + Mongolia = 156, + Montenegro = 157, + Montserrat = 158, + Morocco = 159, + Mozambique = 160, + Myanmar = 161, + Namibia = 162, + NauruTerritory = 163, + Nepal = 164, + Netherlands = 165, + NewCaledonia = 166, + NewZealand = 167, + Nicaragua = 168, + Nigeria = 169, + Niger = 170, + Niue = 171, + NorfolkIsland = 172, + NorthernMarianaIslands = 173, + NorthKorea = 174, + Norway = 175, + Oman = 176, + OutlyingOceania = 177, + Pakistan = 178, + Palau = 179, + PalestinianTerritories = 180, + Panama = 181, + PapuaNewGuinea = 182, + Paraguay = 183, + Peru = 184, + Philippines = 185, + Pitcairn = 186, + Poland = 187, + Portugal = 188, + PuertoRico = 189, + Qatar = 190, + Reunion = 191, + Romania = 192, + Russia = 193, + Rwanda = 194, + SaintBarthelemy = 195, + SaintHelena = 196, + SaintKittsAndNevis = 197, + SaintLucia = 198, + SaintMartin = 199, + SaintPierreAndMiquelon = 200, + SaintVincentAndGrenadines = 201, + Samoa = 202, + SanMarino = 203, + SaoTomeAndPrincipe = 204, + SaudiArabia = 205, + Senegal = 206, + Serbia = 207, + Seychelles = 208, + SierraLeone = 209, + Singapore = 210, + SintMaarten = 211, + Slovakia = 212, + Slovenia = 213, + SolomonIslands = 214, + Somalia = 215, + SouthAfrica = 216, + SouthGeorgiaAndSouthSandwichIslands = 217, + SouthKorea = 218, + SouthSudan = 219, + Spain = 220, + SriLanka = 221, + Sudan = 222, + Suriname = 223, + SvalbardAndJanMayen = 224, + Sweden = 225, + Switzerland = 226, + Syria = 227, + Taiwan = 228, + Tajikistan = 229, + Tanzania = 230, + Thailand = 231, + TimorLeste = 232, + Togo = 233, + TokelauTerritory = 234, + Tonga = 235, + TrinidadAndTobago = 236, + TristanDaCunha = 237, + Tunisia = 238, + Turkey = 239, + Turkmenistan = 240, + TurksAndCaicosIslands = 241, + TuvaluTerritory = 242, + Uganda = 243, + Ukraine = 244, + UnitedArabEmirates = 245, + UnitedKingdom = 246, + UnitedStatesOutlyingIslands = 247, + UnitedStates = 248, + UnitedStatesVirginIslands = 249, + Uruguay = 250, + Uzbekistan = 251, + Vanuatu = 252, + VaticanCity = 253, + Venezuela = 254, + Vietnam = 255, + WallisAndFutuna = 256, + WesternSahara = 257, + World = 258, + Yemen = 259, + Zambia = 260, + Zimbabwe = 261, + + AnyCountry = AnyTerritory, + Bonaire = CaribbeanNetherlands, + BosniaAndHerzegowina = BosniaAndHerzegovina, + CuraSao = Curacao, + CzechRepublic = Czechia, + DemocraticRepublicOfCongo = CongoKinshasa, + DemocraticRepublicOfKorea = NorthKorea, + EastTimor = TimorLeste, + LatinAmericaAndTheCaribbean = LatinAmerica, + Macau = Macao, + NauruCountry = NauruTerritory, + PeoplesRepublicOfCongo = CongoBrazzaville, + RepublicOfKorea = SouthKorea, + RussianFederation = Russia, + SaintVincentAndTheGrenadines = SaintVincentAndGrenadines, + SouthGeorgiaAndTheSouthSandwichIslands = SouthGeorgiaAndSouthSandwichIslands, + SvalbardAndJanMayenIslands = SvalbardAndJanMayen, + Swaziland = Eswatini, + SyrianArabRepublic = Syria, + TokelauCountry = TokelauTerritory, + TuvaluCountry = TuvaluTerritory, + UnitedStatesMinorOutlyingIslands = UnitedStatesOutlyingIslands, + VaticanCityState = VaticanCity, + WallisAndFutunaIslands = WallisAndFutuna, + + LastTerritory = Zimbabwe, + LastCountry = LastTerritory + }; +// GENERATED PART ENDS HERE + + using Territory = Country; // ### Qt 7: reverse + + Q_ENUM(Language) + Q_ENUM(Country) + Q_ENUM(Script) + + enum MeasurementSystem { + MetricSystem, + ImperialUSSystem, + ImperialUKSystem, + ImperialSystem = ImperialUSSystem // Qt 4 compatibility + }; + Q_ENUM(MeasurementSystem) + + enum FormatType { LongFormat, ShortFormat, NarrowFormat }; + Q_ENUM(FormatType) + enum NumberOption { + DefaultNumberOptions = 0x0, + OmitGroupSeparator = 0x01, + RejectGroupSeparator = 0x02, + OmitLeadingZeroInExponent = 0x04, + RejectLeadingZeroInExponent = 0x08, + IncludeTrailingZeroesAfterDot = 0x10, + RejectTrailingZeroesAfterDot = 0x20 + }; + Q_DECLARE_FLAGS(NumberOptions, NumberOption) + Q_FLAG(NumberOptions) + + enum FloatingPointPrecisionOption { + FloatingPointShortest = -128 + }; + + enum class TagSeparator : char { Dash = '-', Underscore = '_' }; + Q_ENUM(TagSeparator) + + enum CurrencySymbolFormat { + CurrencyIsoCode, + CurrencySymbol, + CurrencyDisplayName + }; + Q_ENUM(CurrencySymbolFormat) + + enum DataSizeFormat { + // Single-bit values, for internal use. + DataSizeBase1000 = 1, // use factors of 1000 instead of IEC's 1024; + DataSizeSIQuantifiers = 2, // use SI quantifiers instead of IEC ones. + + // Flags values for use in API: + DataSizeIecFormat = 0, // base 1024, KiB, MiB, GiB, ... + DataSizeTraditionalFormat = DataSizeSIQuantifiers, // base 1024, kB, MB, GB, ... + DataSizeSIFormat = DataSizeBase1000 | DataSizeSIQuantifiers // base 1000, kB, MB, GB, ... + }; + Q_DECLARE_FLAGS(DataSizeFormats, DataSizeFormat) + Q_FLAG(DataSizeFormats) + + QLocale(); + QT_CORE_INLINE_SINCE(6, 4) + explicit QLocale(const QString &name); + explicit QLocale(QStringView name); + QLocale(Language language, Territory territory); + QLocale(Language language, Script script = AnyScript, Territory territory = AnyTerritory); + QLocale(const QLocale &other) noexcept; + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QLocale) + QLocale &operator=(const QLocale &other) noexcept; + ~QLocale(); + + void swap(QLocale &other) noexcept { d.swap(other.d); } + + Language language() const; + Script script() const; + Territory territory() const; +#if QT_DEPRECATED_SINCE(6, 6) + QT_DEPRECATED_VERSION_X_6_6("Use territory() instead") + Country country() const; +#endif + +#if QT_CORE_REMOVED_SINCE(6, 7) + QString name() const; + QString bcp47Name() const; +#endif + QString name(TagSeparator separator = TagSeparator::Underscore) const; + QString bcp47Name(TagSeparator separator = TagSeparator::Dash) const; + + QString nativeLanguageName() const; + QString nativeTerritoryName() const; +#if QT_DEPRECATED_SINCE(6, 6) + QT_DEPRECATED_VERSION_X_6_6("Use nativeTerritoryName() instead") + QString nativeCountryName() const; +#endif + + short toShort(const QString &s, bool *ok = nullptr) const + { return toShort(qToStringViewIgnoringNull(s), ok); } + ushort toUShort(const QString &s, bool *ok = nullptr) const + { return toUShort(qToStringViewIgnoringNull(s), ok); } + int toInt(const QString &s, bool *ok = nullptr) const + { return toInt(qToStringViewIgnoringNull(s), ok); } + uint toUInt(const QString &s, bool *ok = nullptr) const + { return toUInt(qToStringViewIgnoringNull(s), ok); } + long toLong(const QString &s, bool *ok = nullptr) const + { return toLong(qToStringViewIgnoringNull(s), ok); } + ulong toULong(const QString &s, bool *ok = nullptr) const + { return toULong(qToStringViewIgnoringNull(s), ok); } + qlonglong toLongLong(const QString &s, bool *ok = nullptr) const + { return toLongLong(qToStringViewIgnoringNull(s), ok); } + qulonglong toULongLong(const QString &s, bool *ok = nullptr) const + { return toULongLong(qToStringViewIgnoringNull(s), ok); } + float toFloat(const QString &s, bool *ok = nullptr) const + { return toFloat(qToStringViewIgnoringNull(s), ok); } + double toDouble(const QString &s, bool *ok = nullptr) const + { return toDouble(qToStringViewIgnoringNull(s), ok); } + + short toShort(QStringView s, bool *ok = nullptr) const; + ushort toUShort(QStringView s, bool *ok = nullptr) const; + int toInt(QStringView s, bool *ok = nullptr) const; + uint toUInt(QStringView s, bool *ok = nullptr) const; + long toLong(QStringView s, bool *ok = nullptr) const; + ulong toULong(QStringView s, bool *ok = nullptr) const; + qlonglong toLongLong(QStringView s, bool *ok = nullptr) const; + qulonglong toULongLong(QStringView s, bool *ok = nullptr) const; + float toFloat(QStringView s, bool *ok = nullptr) const; + double toDouble(QStringView s, bool *ok = nullptr) const; + + QString toString(qlonglong i) const; + QString toString(qulonglong i) const; + QString toString(long i) const { return toString(qlonglong(i)); } + QString toString(ulong i) const { return toString(qulonglong(i)); } + QString toString(short i) const { return toString(qlonglong(i)); } + QString toString(ushort i) const { return toString(qulonglong(i)); } + QString toString(int i) const { return toString(qlonglong(i)); } + QString toString(uint i) const { return toString(qulonglong(i)); } + QString toString(double f, char format = 'g', int precision = 6) const; + QString toString(float f, char format = 'g', int precision = 6) const + { return toString(double(f), format, precision); } + + // (Can't inline first two: passing by value doesn't work when only forward-declared.) + QString toString(QDate date, const QString &format) const; + QString toString(QTime time, const QString &format) const; + QString toString(const QDateTime &dateTime, const QString &format) const + { return toString(dateTime, qToStringViewIgnoringNull(format)); } + QString toString(QDate date, QStringView format) const; + QString toString(QTime time, QStringView format) const; + QString toString(const QDateTime &dateTime, QStringView format) const; + QString toString(QDate date, FormatType format = LongFormat) const; + QString toString(QTime time, FormatType format = LongFormat) const; + QString toString(const QDateTime &dateTime, FormatType format = LongFormat) const; + /* We can't pass a default for QCalendar (its declaration mentions + * QLocale::FormatType, so it has to #include this header, which thus can't + * #include its, so we can't instantiate QCalendar() as default). This + * precludes any default for format, too. + */ + QString toString(QDate date, QStringView format, QCalendar cal) const; + QString toString(QDate date, FormatType format, QCalendar cal) const; + QString toString(const QDateTime &dateTime, FormatType format, QCalendar cal) const; + QString toString(const QDateTime &dateTime, QStringView format, QCalendar cal) const; + + QString dateFormat(FormatType format = LongFormat) const; + QString timeFormat(FormatType format = LongFormat) const; + QString dateTimeFormat(FormatType format = LongFormat) const; + // QCalendar's header has to #include QLocale's, preventing the reverse, so + // QCalendar parameters can't have defaults here. +#if QT_CONFIG(datestring) + QTime toTime(const QString &string, FormatType = LongFormat) const; + QTime toTime(const QString &string, const QString &format) const; +# if QT_CORE_REMOVED_SINCE(6, 7) + QDate toDate(const QString &string, FormatType = LongFormat) const; + QDate toDate(const QString &string, const QString &format) const; + QDateTime toDateTime(const QString &string, FormatType format = LongFormat) const; + QDateTime toDateTime(const QString &string, const QString &format) const; + // Calendar-aware API + QDate toDate(const QString &string, FormatType format, QCalendar cal) const; + QDate toDate(const QString &string, const QString &format, QCalendar cal) const; + QDateTime toDateTime(const QString &string, FormatType format, QCalendar cal) const; + QDateTime toDateTime(const QString &string, const QString &format, QCalendar cal) const; +# endif + QDate toDate(const QString &string, FormatType = LongFormat, + int baseYear = DefaultTwoDigitBaseYear) const; + QDate toDate(const QString &string, const QString &format, + int baseYear = DefaultTwoDigitBaseYear) const; + QDateTime toDateTime(const QString &string, FormatType format = LongFormat, + int baseYear = DefaultTwoDigitBaseYear) const; + QDateTime toDateTime(const QString &string, const QString &format, + int baseYear = DefaultTwoDigitBaseYear) const; + // Calendar-aware API + QDate toDate(const QString &string, FormatType format, QCalendar cal, + int baseYear = DefaultTwoDigitBaseYear) const; + QDate toDate(const QString &string, const QString &format, QCalendar cal, + int baseYear = DefaultTwoDigitBaseYear) const; + QDateTime toDateTime(const QString &string, FormatType format, QCalendar cal, + int baseYear = DefaultTwoDigitBaseYear) const; + QDateTime toDateTime(const QString &string, const QString &format, QCalendar cal, + int baseYear = DefaultTwoDigitBaseYear) const; +#endif + + QString decimalPoint() const; + QString groupSeparator() const; + QString percent() const; + QString zeroDigit() const; + QString negativeSign() const; + QString positiveSign() const; + QString exponential() const; + + QString monthName(int, FormatType format = LongFormat) const; + QString standaloneMonthName(int, FormatType format = LongFormat) const; + QString dayName(int, FormatType format = LongFormat) const; + QString standaloneDayName(int, FormatType format = LongFormat) const; + + Qt::DayOfWeek firstDayOfWeek() const; + QList weekdays() const; + + QString amText() const; + QString pmText() const; + + MeasurementSystem measurementSystem() const; + QLocale collation() const; + Qt::LayoutDirection textDirection() const; + + QString toUpper(const QString &str) const; + QString toLower(const QString &str) const; + + QString currencySymbol(CurrencySymbolFormat = CurrencySymbol) const; + QString toCurrencyString(qlonglong, const QString &symbol = QString()) const; + QString toCurrencyString(qulonglong, const QString &symbol = QString()) const; + QString toCurrencyString(short i, const QString &symbol = QString()) const + { return toCurrencyString(qlonglong(i), symbol); } + QString toCurrencyString(ushort i, const QString &symbol = QString()) const + { return toCurrencyString(qulonglong(i), symbol); } + QString toCurrencyString(int i, const QString &symbol = QString()) const + { return toCurrencyString(qlonglong(i), symbol); } + QString toCurrencyString(uint i, const QString &symbol = QString()) const + { return toCurrencyString(qulonglong(i), symbol); } + QString toCurrencyString(double, const QString &symbol = QString(), int precision = -1) const; + QString toCurrencyString(float i, const QString &symbol = QString(), int precision = -1) const + { return toCurrencyString(double(i), symbol, precision); } + + QString formattedDataSize(qint64 bytes, int precision = 2, DataSizeFormats format = DataSizeIecFormat) const; + +#if QT_CORE_REMOVED_SINCE(6, 7) + QStringList uiLanguages() const; +#endif + QStringList uiLanguages(TagSeparator separator = TagSeparator::Dash) const; + + enum LanguageCodeType { + ISO639Part1 = 1 << 0, + ISO639Part2B = 1 << 1, + ISO639Part2T = 1 << 2, + ISO639Part3 = 1 << 3, + LegacyLanguageCode = 1 << 15, + + ISO639Part2 = ISO639Part2B | ISO639Part2T, + ISO639Alpha2 = ISO639Part1, + ISO639Alpha3 = ISO639Part2 | ISO639Part3, + ISO639 = ISO639Alpha2 | ISO639Alpha3, + + AnyLanguageCode = -1 + }; + Q_DECLARE_FLAGS(LanguageCodeTypes, LanguageCodeType) + Q_FLAG(LanguageCodeTypes) + +#if QT_CORE_REMOVED_SINCE(6, 3) + static QString languageToCode(Language language); + static Language codeToLanguage(QStringView languageCode) noexcept; +#endif + static QString languageToCode(Language language, LanguageCodeTypes codeTypes = AnyLanguageCode); + static Language codeToLanguage(QStringView languageCode, + LanguageCodeTypes codeTypes = AnyLanguageCode) noexcept; + static QString territoryToCode(Territory territory); + static Territory codeToTerritory(QStringView territoryCode) noexcept; +#if QT_DEPRECATED_SINCE(6, 6) + QT_DEPRECATED_VERSION_X_6_6("Use territoryToCode(Territory) instead") + static QString countryToCode(Country country); + QT_DEPRECATED_VERSION_X_6_6("Use codeToTerritory(QStringView) instead") + static Country codeToCountry(QStringView countryCode) noexcept; +#endif + static QString scriptToCode(Script script); + static Script codeToScript(QStringView scriptCode) noexcept; + + static QString languageToString(Language language); + static QString territoryToString(Territory territory); +#if QT_DEPRECATED_SINCE(6, 6) + QT_DEPRECATED_VERSION_X_6_6("Use territoryToString(Territory) instead") + static QString countryToString(Country country); +#endif + static QString scriptToString(Script script); + static void setDefault(const QLocale &locale); + + static QLocale c() { return QLocale(C); } + static QLocale system(); + + static QList matchingLocales(QLocale::Language language, QLocale::Script script, + QLocale::Territory territory); +#if QT_DEPRECATED_SINCE(6, 6) + QT_DEPRECATED_VERSION_X_6_6("Query territory() on each entry from matchingLocales() instead") + static QList countriesForLanguage(Language lang); +#endif + + void setNumberOptions(NumberOptions options); + NumberOptions numberOptions() const; + + enum QuotationStyle { StandardQuotation, AlternateQuotation }; + Q_ENUM(QuotationStyle) + QString quoteString(const QString &str, QuotationStyle style = StandardQuotation) const + { return quoteString(QStringView(str), style); } + QString quoteString(QStringView str, QuotationStyle style = StandardQuotation) const; + + QString createSeparatedList(const QStringList &strl) const; + +private: + QLocale(QLocalePrivate &dd); + bool equals(const QLocale &other) const noexcept; + friend class QLocalePrivate; + friend class QSystemLocale; + friend class QCalendarBackend; + friend class QRomanCalendar; + friend Q_CORE_EXPORT size_t qHash(const QLocale &key, size_t seed) noexcept; + + friend bool comparesEqual(const QLocale &lhs, const QLocale &rhs) noexcept + { + return lhs.equals(rhs); + } + Q_DECLARE_EQUALITY_COMPARABLE(QLocale) + + friend Q_CORE_EXPORT bool comparesEqual(const QLocale &lhs, Language rhs); + Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QLocale, Language) + + QSharedDataPointer d; +}; +Q_DECLARE_SHARED(QLocale) +Q_DECLARE_OPERATORS_FOR_FLAGS(QLocale::NumberOptions) +Q_DECLARE_OPERATORS_FOR_FLAGS(QLocale::LanguageCodeTypes) + +#if QT_CORE_INLINE_IMPL_SINCE(6, 4) +QLocale::QLocale(const QString &name) + : QLocale(qToStringViewIgnoringNull(name)) {} +#endif + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QLocale &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QLocale &); +#endif + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QLocale &); +#endif + +QT_END_NAMESPACE + +#endif // QLOCALE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qlockfile.h b/qt/6.8.1/msvc2022_64/include/QtCore/qlockfile.h new file mode 100644 index 0000000000000000000000000000000000000000..5a853305c70ed4675d50ac40cc7700ba223633ee --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qlockfile.h @@ -0,0 +1,58 @@ +// Copyright (C) 2013 David Faure +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QLOCKFILE_H +#define QLOCKFILE_H + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QLockFilePrivate; + +class Q_CORE_EXPORT QLockFile +{ +public: + QLockFile(const QString &fileName); + ~QLockFile(); + + QString fileName() const; + + bool lock(); + bool tryLock(int timeout); + void unlock(); + + void setStaleLockTime(int); + int staleLockTime() const; + + bool tryLock(std::chrono::milliseconds timeout = std::chrono::milliseconds::zero()); + + void setStaleLockTime(std::chrono::milliseconds value); + std::chrono::milliseconds staleLockTimeAsDuration() const; + + bool isLocked() const; + bool getLockInfo(qint64 *pid, QString *hostname, QString *appname) const; + bool removeStaleLockFile(); + + enum LockError { + NoError = 0, + LockFailedError = 1, + PermissionError = 2, + UnknownError = 3 + }; + LockError error() const; + +protected: + QScopedPointer d_ptr; + +private: + Q_DECLARE_PRIVATE(QLockFile) + Q_DISABLE_COPY(QLockFile) +}; + +QT_END_NAMESPACE + +#endif // QLOCKFILE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qlogging.h b/qt/6.8.1/msvc2022_64/include/QtCore/qlogging.h new file mode 100644 index 0000000000000000000000000000000000000000..f8effac0a43aede4c0f428dae6a000cafb3eb0b2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qlogging.h @@ -0,0 +1,203 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QLOGGING_H +#define QLOGGING_H + +#include +#include +#include +#include + +#if 0 +// header is automatically included in qglobal.h +#pragma qt_no_master_include +#pragma qt_class(QtLogging) +#endif + +QT_BEGIN_NAMESPACE + +/* + Forward declarations only. + + In order to use the qDebug() stream, you must #include +*/ +class QDebug; +class QNoDebug; + + +enum QtMsgType { + QtDebugMsg, + QT7_ONLY(QtInfoMsg,) + QtWarningMsg, + QtCriticalMsg, + QtFatalMsg, + QT6_ONLY(QtInfoMsg,) +#if QT_DEPRECATED_SINCE(6, 7) + QtSystemMsg Q_DECL_ENUMERATOR_DEPRECATED_X("Use QtCriticalMsg instead.") = QtCriticalMsg +#endif +}; + +class QInternalMessageLogContext; +class QMessageLogContext +{ + Q_DISABLE_COPY(QMessageLogContext) +public: + static constexpr int CurrentVersion = 2; + constexpr QMessageLogContext() noexcept = default; + constexpr QMessageLogContext(const char *fileName, int lineNumber, const char *functionName, const char *categoryName) noexcept + : line(lineNumber), file(fileName), function(functionName), category(categoryName) {} + + int version = CurrentVersion; + int line = 0; + const char *file = nullptr; + const char *function = nullptr; + const char *category = nullptr; + +private: + QMessageLogContext ©ContextFrom(const QMessageLogContext &logContext) noexcept; + + friend class QInternalMessageLogContext; + friend class QMessageLogger; +}; + +class QLoggingCategory; + +#if defined(Q_CC_MSVC_ONLY) +# define QT_MESSAGE_LOGGER_NORETURN +#else +# define QT_MESSAGE_LOGGER_NORETURN Q_NORETURN +#endif + +class Q_CORE_EXPORT QMessageLogger +{ + Q_DISABLE_COPY(QMessageLogger) +public: + constexpr QMessageLogger() : context() {} + constexpr QMessageLogger(const char *file, int line, const char *function) + : context(file, line, function, "default") {} + constexpr QMessageLogger(const char *file, int line, const char *function, const char *category) + : context(file, line, function, category) {} + + void debug(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); + void noDebug(const char *, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3) + {} + void info(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); + Q_DECL_COLD_FUNCTION + void warning(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); + Q_DECL_COLD_FUNCTION + void critical(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); + QT_MESSAGE_LOGGER_NORETURN Q_DECL_COLD_FUNCTION + void fatal(const char *msg, ...) const noexcept Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); + + typedef const QLoggingCategory &(*CategoryFunction)(); + + void debug(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + void debug(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + void info(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + void info(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + Q_DECL_COLD_FUNCTION + void warning(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + Q_DECL_COLD_FUNCTION + void warning(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + Q_DECL_COLD_FUNCTION + void critical(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + Q_DECL_COLD_FUNCTION + void critical(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + QT_MESSAGE_LOGGER_NORETURN Q_DECL_COLD_FUNCTION + void fatal(const QLoggingCategory &cat, const char *msg, ...) const noexcept Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + QT_MESSAGE_LOGGER_NORETURN Q_DECL_COLD_FUNCTION + void fatal(CategoryFunction catFunc, const char *msg, ...) const noexcept Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + +#ifndef QT_NO_DEBUG_STREAM + QDebug debug() const; + QDebug debug(const QLoggingCategory &cat) const; + QDebug debug(CategoryFunction catFunc) const; + QDebug info() const; + QDebug info(const QLoggingCategory &cat) const; + QDebug info(CategoryFunction catFunc) const; + Q_DECL_COLD_FUNCTION + QDebug warning() const; + Q_DECL_COLD_FUNCTION + QDebug warning(const QLoggingCategory &cat) const; + Q_DECL_COLD_FUNCTION + QDebug warning(CategoryFunction catFunc) const; + Q_DECL_COLD_FUNCTION + QDebug critical() const; + Q_DECL_COLD_FUNCTION + QDebug critical(const QLoggingCategory &cat) const; + Q_DECL_COLD_FUNCTION + QDebug critical(CategoryFunction catFunc) const; + Q_DECL_COLD_FUNCTION + QDebug fatal() const; + Q_DECL_COLD_FUNCTION + QDebug fatal(const QLoggingCategory &cat) const; + Q_DECL_COLD_FUNCTION + QDebug fatal(CategoryFunction catFunc) const; + + QNoDebug noDebug() const noexcept; +#endif // QT_NO_DEBUG_STREAM + +private: + QMessageLogContext context; +}; + +#undef QT_MESSAGE_LOGGER_NORETURN + +#if !defined(QT_MESSAGELOGCONTEXT) && !defined(QT_NO_MESSAGELOGCONTEXT) +# if defined(QT_NO_DEBUG) +# define QT_NO_MESSAGELOGCONTEXT +# else +# define QT_MESSAGELOGCONTEXT +# endif +#endif + +#ifdef QT_MESSAGELOGCONTEXT + #define QT_MESSAGELOG_FILE static_cast(__FILE__) + #define QT_MESSAGELOG_LINE __LINE__ + #define QT_MESSAGELOG_FUNC static_cast(Q_FUNC_INFO) +#else + #define QT_MESSAGELOG_FILE nullptr + #define QT_MESSAGELOG_LINE 0 + #define QT_MESSAGELOG_FUNC nullptr +#endif + +#define qDebug QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).debug +#define qInfo QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).info +#define qWarning QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).warning +#define qCritical QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).critical +#define qFatal QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).fatal + +#define QT_NO_QDEBUG_MACRO while (false) QMessageLogger().noDebug + +#if defined(QT_NO_DEBUG_OUTPUT) +# undef qDebug +# define qDebug QT_NO_QDEBUG_MACRO +#endif +#if defined(QT_NO_INFO_OUTPUT) +# undef qInfo +# define qInfo QT_NO_QDEBUG_MACRO +#endif +#if defined(QT_NO_WARNING_OUTPUT) +# undef qWarning +# define qWarning QT_NO_QDEBUG_MACRO +#endif + +Q_CORE_EXPORT void qt_message_output(QtMsgType, const QMessageLogContext &context, + const QString &message); + +Q_CORE_EXPORT Q_DECL_COLD_FUNCTION void qErrnoWarning(int code, const char *msg, ...); +Q_CORE_EXPORT Q_DECL_COLD_FUNCTION void qErrnoWarning(const char *msg, ...); + +typedef void (*QtMessageHandler)(QtMsgType, const QMessageLogContext &, const QString &); +Q_CORE_EXPORT QtMessageHandler qInstallMessageHandler(QtMessageHandler); + +Q_CORE_EXPORT void qSetMessagePattern(const QString &messagePattern); +Q_CORE_EXPORT QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, + const QString &buf); + +Q_DECL_COLD_FUNCTION +Q_CORE_EXPORT QString qt_error_string(int errorCode = -1); + +QT_END_NAMESPACE +#endif // QLOGGING_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qloggingcategory.h b/qt/6.8.1/msvc2022_64/include/QtCore/qloggingcategory.h new file mode 100644 index 0000000000000000000000000000000000000000..45463c22e319ada0c021130c86e2f4835d7952fa --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qloggingcategory.h @@ -0,0 +1,131 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QLOGGINGCATEGORY_H +#define QLOGGINGCATEGORY_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class Q_CORE_EXPORT QLoggingCategory +{ + Q_DISABLE_COPY(QLoggingCategory) +public: + explicit QLoggingCategory(const char *category, QtMsgType severityLevel = QtDebugMsg); + ~QLoggingCategory(); + + bool isEnabled(QtMsgType type) const; + void setEnabled(QtMsgType type, bool enable); + + bool isDebugEnabled() const { return bools.enabledDebug.loadRelaxed(); } + bool isInfoEnabled() const { return bools.enabledInfo.loadRelaxed(); } + bool isWarningEnabled() const { return bools.enabledWarning.loadRelaxed(); } + bool isCriticalEnabled() const { return bools.enabledCritical.loadRelaxed(); } + + const char *categoryName() const { return name; } + + // allows usage of both factory method and variable in qCX macros + QLoggingCategory &operator()() { return *this; } + const QLoggingCategory &operator()() const { return *this; } + + static QLoggingCategory *defaultCategory(); + + typedef void (*CategoryFilter)(QLoggingCategory*); + static CategoryFilter installFilter(CategoryFilter); + + static void setFilterRules(const QString &rules); + +private: + void init(const char *category, QtMsgType severityLevel); + + Q_DECL_UNUSED_MEMBER void *d; // reserved for future use + const char *name; + + struct AtomicBools { + QBasicAtomicInteger enabledDebug; + QBasicAtomicInteger enabledWarning; + QBasicAtomicInteger enabledCritical; + QBasicAtomicInteger enabledInfo; + }; + union { + AtomicBools bools; + QBasicAtomicInt enabled; + }; + Q_DECL_UNUSED_MEMBER bool placeholder[4]; // reserved for future use +}; + +namespace { // allow different TUs to have different QT_NO_xxx_OUTPUT +template struct QLoggingCategoryMacroHolder +{ + static const bool IsOutputEnabled; + const QLoggingCategory *category = nullptr; + bool control = false; + explicit QLoggingCategoryMacroHolder(const QLoggingCategory &cat) + { + if (IsOutputEnabled) + init(cat); + } + void init(const QLoggingCategory &cat) noexcept + { + category = &cat; + // same as: + // control = cat.isEnabled(Which); + // but without an out-of-line call + if constexpr (Which == QtDebugMsg) { + control = cat.isDebugEnabled(); + } else if constexpr (Which == QtInfoMsg) { + control = cat.isInfoEnabled(); + } else if constexpr (Which == QtWarningMsg) { + control = cat.isWarningEnabled(); + } else if constexpr (Which == QtCriticalMsg) { + control = cat.isCriticalEnabled(); + } else if constexpr (Which == QtFatalMsg) { + control = true; + } else { + static_assert(QtPrivate::value_dependent_false(), "Unknown Qt message type"); + } + } + const char *name() const { return category->categoryName(); } + explicit operator bool() const { return Q_UNLIKELY(control); } +}; + +template const bool QLoggingCategoryMacroHolder::IsOutputEnabled = true; +#if defined(QT_NO_DEBUG_OUTPUT) +template <> const bool QLoggingCategoryMacroHolder::IsOutputEnabled = false; +#endif +#if defined(QT_NO_INFO_OUTPUT) +template <> const bool QLoggingCategoryMacroHolder::IsOutputEnabled = false; +#endif +#if defined(QT_NO_WARNING_OUTPUT) +template <> const bool QLoggingCategoryMacroHolder::IsOutputEnabled = false; +#endif +} // unnamed namespace + +#define Q_DECLARE_LOGGING_CATEGORY(name) \ + const QLoggingCategory &name(); + +#define Q_DECLARE_EXPORTED_LOGGING_CATEGORY(name, export_macro) \ + export_macro Q_DECLARE_LOGGING_CATEGORY(name) + +#define Q_LOGGING_CATEGORY(name, ...) \ + const QLoggingCategory &name() \ + { \ + static const QLoggingCategory category(__VA_ARGS__); \ + return category; \ + } + +#define QT_MESSAGE_LOGGER_COMMON(category, level) \ + for (QLoggingCategoryMacroHolder qt_category((category)()); qt_category; qt_category.control = false) \ + QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, qt_category.name()) + +#define qCDebug(category, ...) QT_MESSAGE_LOGGER_COMMON(category, QtDebugMsg).debug(__VA_ARGS__) +#define qCInfo(category, ...) QT_MESSAGE_LOGGER_COMMON(category, QtInfoMsg).info(__VA_ARGS__) +#define qCWarning(category, ...) QT_MESSAGE_LOGGER_COMMON(category, QtWarningMsg).warning(__VA_ARGS__) +#define qCCritical(category, ...) QT_MESSAGE_LOGGER_COMMON(category, QtCriticalMsg).critical(__VA_ARGS__) +#define qCFatal(category, ...) QT_MESSAGE_LOGGER_COMMON(category, QtFatalMsg).fatal(__VA_ARGS__) + +QT_END_NAMESPACE + +#endif // QLOGGINGCATEGORY_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qmalloc.h b/qt/6.8.1/msvc2022_64/include/QtCore/qmalloc.h new file mode 100644 index 0000000000000000000000000000000000000000..35adb8cd844f5eec69aeb3d0057d0e27692ab9d2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qmalloc.h @@ -0,0 +1,26 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QMALLOC_H +#define QMALLOC_H + +#include +#include +#include + +#include // size_t + +#if 0 +#pragma qt_class(QtMalloc) +#pragma qt_sync_stop_processing +#endif + +QT_BEGIN_NAMESPACE + +Q_CORE_EXPORT void *qMallocAligned(size_t size, size_t alignment) Q_ALLOC_SIZE(1); +Q_CORE_EXPORT void *qReallocAligned(void *ptr, size_t size, size_t oldsize, size_t alignment) Q_ALLOC_SIZE(2); +Q_CORE_EXPORT void qFreeAligned(void *ptr); + +QT_END_NAMESPACE + +#endif // QMALLOC_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qmap.h b/qt/6.8.1/msvc2022_64/include/QtCore/qmap.h new file mode 100644 index 0000000000000000000000000000000000000000..4afa7881add8ff7c6ae9cdb190e2bb218a6c42e7 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qmap.h @@ -0,0 +1,1606 @@ +// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QMAP_H +#define QMAP_H + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +// common code shared between QMap and QMultimap +template +class QMapData : public QSharedData +{ +public: + using Map = AMap; + using Key = typename Map::key_type; + using T = typename Map::mapped_type; + using value_type = typename Map::value_type; + using size_type = typename Map::size_type; + using iterator = typename Map::iterator; + using const_iterator = typename Map::const_iterator; + + static_assert(std::is_nothrow_destructible_v, "Types with throwing destructors are not supported in Qt containers."); + static_assert(std::is_nothrow_destructible_v, "Types with throwing destructors are not supported in Qt containers."); + + Map m; + + QMapData() = default; + explicit QMapData(const Map &other) + : m(other) + {} + + explicit QMapData(Map &&other) + : m(std::move(other)) + {} + + // used in remove(); copies from source all the values not matching key. + // returns how many were NOT copied (removed). + size_type copyIfNotEquivalentTo(const Map &source, const Key &key) + { + Q_ASSERT(m.empty()); + + size_type result = 0; + const auto &keyCompare = source.key_comp(); + const auto filter = [&result, &key, &keyCompare](const auto &v) + { + if (!keyCompare(key, v.first) && !keyCompare(v.first, key)) { + // keys are equivalent (neither a found it + ++result; + return true; + } + return false; + }; + + std::remove_copy_if(source.cbegin(), source.cend(), + std::inserter(m, m.end()), + filter); + return result; + } + + // used in key(T), count(Key, T), find(key, T), etc; returns a + // comparator object suitable for algorithms with std::(multi)map + // iterators. + static auto valueIsEqualTo(const T &value) + { + return [&value](const auto &v) { return v.second == value; }; + } + + Key key(const T &value, const Key &defaultKey) const + { + auto i = std::find_if(m.cbegin(), + m.cend(), + valueIsEqualTo(value)); + if (i != m.cend()) + return i->first; + + return defaultKey; + } + + QList keys() const + { + QList result; + result.reserve(m.size()); + + const auto extractKey = [](const auto &v) { return v.first; }; + + std::transform(m.cbegin(), + m.cend(), + std::back_inserter(result), + extractKey); + return result; + } + + QList keys(const T &value) const + { + QList result; + result.reserve(m.size()); + // no std::transform_if... + for (const auto &v : m) { + if (v.second == value) + result.append(v.first); + } + result.shrink_to_fit(); + return result; + } + + QList values() const + { + QList result; + result.reserve(m.size()); + + const auto extractValue = [](const auto &v) { return v.second; }; + + std::transform(m.cbegin(), + m.cend(), + std::back_inserter(result), + extractValue); + return result; + } + + size_type count(const Key &key) const + { + return m.count(key); + } + + // Used in erase. Allocates a new QMapData and copies, from this->m, + // the elements not in the [first, last) range. The return contains + // the new QMapData and an iterator in its map pointing at the first + // element after the erase. + struct EraseResult { + QMapData *data; + iterator it; + }; + + EraseResult erase(const_iterator first, const_iterator last) const + { + EraseResult result; + result.data = new QMapData; + result.it = result.data->m.end(); + const auto newDataEnd = result.it; + + auto i = m.begin(); + const auto e = m.end(); + + // copy over all the elements before first + while (i != first) { + result.it = result.data->m.insert(newDataEnd, *i); + ++i; + } + + // skip until last + while (i != last) + ++i; + + // copy from last to the end + while (i != e) { + result.data->m.insert(newDataEnd, *i); + ++i; + } + + if (result.it != newDataEnd) + ++result.it; + + return result; + } +}; + +// +// QMap +// + +template +class QMap +{ + using Map = std::map; + using MapData = QMapData; + QtPrivate::QExplicitlySharedDataPointerV2 d; + + friend class QMultiMap; + +public: + using key_type = Key; + using mapped_type = T; + using difference_type = qptrdiff; + using size_type = qsizetype; + + QMap() = default; + + // implicitly generated special member functions are OK! + + void swap(QMap &other) noexcept + { + d.swap(other.d); + } + + QMap(std::initializer_list> list) + { + for (auto &p : list) + insert(p.first, p.second); + } + + explicit QMap(const std::map &other) + : d(other.empty() ? nullptr : new MapData(other)) + { + } + + explicit QMap(std::map &&other) + : d(other.empty() ? nullptr : new MapData(std::move(other))) + { + } + + std::map toStdMap() const & + { + if (d) + return d->m; + return {}; + } + + std::map toStdMap() && + { + if (d) { + if (d.isShared()) + return d->m; + else + return std::move(d->m); + } + + return {}; + } + +#ifndef Q_QDOC + template friend + QTypeTraits::compare_eq_result_container operator==(const QMap &lhs, const QMap &rhs) + { + if (lhs.d == rhs.d) + return true; + if (!lhs.d) + return rhs == lhs; + Q_ASSERT(lhs.d); + return rhs.d ? (lhs.d->m == rhs.d->m) : lhs.d->m.empty(); + } + + template friend + QTypeTraits::compare_eq_result_container operator!=(const QMap &lhs, const QMap &rhs) + { + return !(lhs == rhs); + } + // TODO: add the other comparison operators; std::map has them. +#else + friend bool operator==(const QMap &lhs, const QMap &rhs); + friend bool operator!=(const QMap &lhs, const QMap &rhs); +#endif // Q_QDOC + + size_type size() const { return d ? size_type(d->m.size()) : size_type(0); } + + bool isEmpty() const { return d ? d->m.empty() : true; } + + void detach() + { + if (d) + d.detach(); + else + d.reset(new MapData); + } + + bool isDetached() const noexcept + { + return d ? !d.isShared() : false; // false makes little sense, but that's shared_null's behavior... + } + + bool isSharedWith(const QMap &other) const noexcept + { + return d == other.d; // also this makes little sense? + } + + void clear() + { + if (!d) + return; + + if (!d.isShared()) + d->m.clear(); + else + d.reset(); + } + + size_type remove(const Key &key) + { + if (!d) + return 0; + + if (!d.isShared()) + return size_type(d->m.erase(key)); + + MapData *newData = new MapData; + size_type result = newData->copyIfNotEquivalentTo(d->m, key); + + d.reset(newData); + + return result; + } + + template + size_type removeIf(Predicate pred) + { + return QtPrivate::associative_erase_if(*this, pred); + } + + T take(const Key &key) + { + if (!d) + return T(); + + const auto copy = d.isShared() ? *this : QMap(); // keep `key` alive across the detach + // TODO: improve. There is no need of copying all the + // elements (the one to be removed can be skipped). + detach(); + + auto i = d->m.find(key); + if (i != d->m.end()) { + T result(std::move(i->second)); + d->m.erase(i); + return result; + } + return T(); + } + + bool contains(const Key &key) const + { + if (!d) + return false; + auto i = d->m.find(key); + return i != d->m.end(); + } + + Key key(const T &value, const Key &defaultKey = Key()) const + { + if (!d) + return defaultKey; + + return d->key(value, defaultKey); + } + + T value(const Key &key, const T &defaultValue = T()) const + { + if (!d) + return defaultValue; + const auto i = d->m.find(key); + if (i != d->m.cend()) + return i->second; + return defaultValue; + } + + T &operator[](const Key &key) + { + const auto copy = d.isShared() ? *this : QMap(); // keep `key` alive across the detach + detach(); + auto i = d->m.find(key); + if (i == d->m.end()) + i = d->m.insert({key, T()}).first; + return i->second; + } + + // CHANGE: return T, not const T! + T operator[](const Key &key) const + { + return value(key); + } + + QList keys() const + { + if (!d) + return {}; + return d->keys(); + } + + QList keys(const T &value) const + { + if (!d) + return {}; + return d->keys(value); + } + + QList values() const + { + if (!d) + return {}; + return d->values(); + } + + size_type count(const Key &key) const + { + if (!d) + return 0; + return d->count(key); + } + + size_type count() const + { + return size(); + } + + inline const Key &firstKey() const { Q_ASSERT(!isEmpty()); return constBegin().key(); } + inline const Key &lastKey() const { Q_ASSERT(!isEmpty()); return (--constEnd()).key(); } + + inline T &first() { Q_ASSERT(!isEmpty()); return *begin(); } + inline const T &first() const { Q_ASSERT(!isEmpty()); return *constBegin(); } + inline T &last() { Q_ASSERT(!isEmpty()); return *(--end()); } + inline const T &last() const { Q_ASSERT(!isEmpty()); return *(--constEnd()); } + + class const_iterator; + + class iterator + { + friend class QMap; + friend class const_iterator; + + typename Map::iterator i; + explicit iterator(typename Map::iterator it) : i(it) {} + public: + using iterator_category = std::bidirectional_iterator_tag; + using difference_type = qptrdiff; + using value_type = T; + using pointer = T *; + using reference = T &; + + iterator() = default; + + const Key &key() const { return i->first; } + T &value() const { return i->second; } + T &operator*() const { return i->second; } + T *operator->() const { return &i->second; } + friend bool operator==(const iterator &lhs, const iterator &rhs) { return lhs.i == rhs.i; } + friend bool operator!=(const iterator &lhs, const iterator &rhs) { return lhs.i != rhs.i; } + + iterator &operator++() + { + ++i; + return *this; + } + iterator operator++(int) + { + iterator r = *this; + ++i; + return r; + } + iterator &operator--() + { + --i; + return *this; + } + iterator operator--(int) + { + iterator r = *this; + --i; + return r; + } + +#if QT_DEPRECATED_SINCE(6, 0) + QT_DEPRECATED_VERSION_X_6_0("Use std::next; QMap iterators are not random access") + //! [qmap-op-it-plus-step] + friend iterator operator+(iterator it, difference_type j) { return std::next(it, j); } + + QT_DEPRECATED_VERSION_X_6_0("Use std::prev; QMap iterators are not random access") + //! [qmap-op-it-minus-step] + friend iterator operator-(iterator it, difference_type j) { return std::prev(it, j); } + + QT_DEPRECATED_VERSION_X_6_0("Use std::next or std::advance; QMap iterators are not random access") + iterator &operator+=(difference_type j) { std::advance(*this, j); return *this; } + + QT_DEPRECATED_VERSION_X_6_0("Use std::prev or std::advance; QMap iterators are not random access") + iterator &operator-=(difference_type j) { std::advance(*this, -j); return *this; } + + QT_DEPRECATED_VERSION_X_6_0("Use std::next; QMap iterators are not random access") + //! [qmap-op-step-plus-it] + friend iterator operator+(difference_type j, iterator it) { return std::next(it, j); } + + QT_DEPRECATED_VERSION_X_6_0("Use std::prev; QMap iterators are not random access") + //! [qmap-op-step-minus-it] + friend iterator operator-(difference_type j, iterator it) { return std::prev(it, j); } +#endif + }; + + class const_iterator + { + friend class QMap; + typename Map::const_iterator i; + explicit const_iterator(typename Map::const_iterator it) : i(it) {} + + public: + using iterator_category = std::bidirectional_iterator_tag; + using difference_type = qptrdiff; + using value_type = T; + using pointer = const T *; + using reference = const T &; + + const_iterator() = default; + Q_IMPLICIT const_iterator(const iterator &o) : i(o.i) {} + + const Key &key() const { return i->first; } + const T &value() const { return i->second; } + const T &operator*() const { return i->second; } + const T *operator->() const { return &i->second; } + friend bool operator==(const const_iterator &lhs, const const_iterator &rhs) { return lhs.i == rhs.i; } + friend bool operator!=(const const_iterator &lhs, const const_iterator &rhs) { return lhs.i != rhs.i; } + + const_iterator &operator++() + { + ++i; + return *this; + } + const_iterator operator++(int) + { + const_iterator r = *this; + ++i; + return r; + } + const_iterator &operator--() + { + --i; + return *this; + } + const_iterator operator--(int) + { + const_iterator r = *this; + --i; + return r; + } + +#if QT_DEPRECATED_SINCE(6, 0) + QT_DEPRECATED_VERSION_X_6_0("Use std::next; QMap iterators are not random access") + //! [qmap-op-it-plus-step-const] + friend const_iterator operator+(const_iterator it, difference_type j) { return std::next(it, j); } + + QT_DEPRECATED_VERSION_X_6_0("Use std::prev; QMap iterators are not random access") + //! [qmap-op-it-minus-step-const] + friend const_iterator operator-(const_iterator it, difference_type j) { return std::prev(it, j); } + + QT_DEPRECATED_VERSION_X_6_0("Use std::next or std::advance; QMap iterators are not random access") + const_iterator &operator+=(difference_type j) { std::advance(*this, j); return *this; } + + QT_DEPRECATED_VERSION_X_6_0("Use std::prev or std::advance; QMap iterators are not random access") + const_iterator &operator-=(difference_type j) { std::advance(*this, -j); return *this; } + + QT_DEPRECATED_VERSION_X_6_0("Use std::next; QMap iterators are not random access") + //! [qmap-op-step-plus-it-const] + friend const_iterator operator+(difference_type j, const_iterator it) { return std::next(it, j); } + + QT_DEPRECATED_VERSION_X_6_0("Use std::prev; QMap iterators are not random access") + //! [qmap-op-step-minus-it-const] + friend const_iterator operator-(difference_type j, const_iterator it) { return std::prev(it, j); } +#endif + }; + + class key_iterator + { + const_iterator i; + + public: + typedef typename const_iterator::iterator_category iterator_category; + typedef typename const_iterator::difference_type difference_type; + typedef Key value_type; + typedef const Key *pointer; + typedef const Key &reference; + + key_iterator() = default; + explicit key_iterator(const_iterator o) : i(o) { } + + const Key &operator*() const { return i.key(); } + const Key *operator->() const { return &i.key(); } + bool operator==(key_iterator o) const { return i == o.i; } + bool operator!=(key_iterator o) const { return i != o.i; } + + inline key_iterator &operator++() { ++i; return *this; } + inline key_iterator operator++(int) { return key_iterator(i++);} + inline key_iterator &operator--() { --i; return *this; } + inline key_iterator operator--(int) { return key_iterator(i--); } + const_iterator base() const { return i; } + }; + + typedef QKeyValueIterator const_key_value_iterator; + typedef QKeyValueIterator key_value_iterator; + + // STL style + iterator begin() { detach(); return iterator(d->m.begin()); } + const_iterator begin() const { if (!d) return const_iterator(); return const_iterator(d->m.cbegin()); } + const_iterator constBegin() const { return begin(); } + const_iterator cbegin() const { return begin(); } + iterator end() { detach(); return iterator(d->m.end()); } + const_iterator end() const { if (!d) return const_iterator(); return const_iterator(d->m.end()); } + const_iterator constEnd() const { return end(); } + const_iterator cend() const { return end(); } + key_iterator keyBegin() const { return key_iterator(begin()); } + key_iterator keyEnd() const { return key_iterator(end()); } + key_value_iterator keyValueBegin() { return key_value_iterator(begin()); } + key_value_iterator keyValueEnd() { return key_value_iterator(end()); } + const_key_value_iterator keyValueBegin() const { return const_key_value_iterator(begin()); } + const_key_value_iterator constKeyValueBegin() const { return const_key_value_iterator(begin()); } + const_key_value_iterator keyValueEnd() const { return const_key_value_iterator(end()); } + const_key_value_iterator constKeyValueEnd() const { return const_key_value_iterator(end()); } + auto asKeyValueRange() & { return QtPrivate::QKeyValueRange(*this); } + auto asKeyValueRange() const & { return QtPrivate::QKeyValueRange(*this); } + auto asKeyValueRange() && { return QtPrivate::QKeyValueRange(std::move(*this)); } + auto asKeyValueRange() const && { return QtPrivate::QKeyValueRange(std::move(*this)); } + + iterator erase(const_iterator it) + { + return erase(it, std::next(it)); + } + + iterator erase(const_iterator afirst, const_iterator alast) + { + if (!d) + return iterator(); + + if (!d.isShared()) + return iterator(d->m.erase(afirst.i, alast.i)); + + auto result = d->erase(afirst.i, alast.i); + d.reset(result.data); + return iterator(result.it); + } + + // more Qt + typedef iterator Iterator; + typedef const_iterator ConstIterator; + + iterator find(const Key &key) + { + const auto copy = d.isShared() ? *this : QMap(); // keep `key` alive across the detach + detach(); + return iterator(d->m.find(key)); + } + + const_iterator find(const Key &key) const + { + if (!d) + return const_iterator(); + return const_iterator(d->m.find(key)); + } + + const_iterator constFind(const Key &key) const + { + return find(key); + } + + iterator lowerBound(const Key &key) + { + const auto copy = d.isShared() ? *this : QMap(); // keep `key` alive across the detach + detach(); + return iterator(d->m.lower_bound(key)); + } + + const_iterator lowerBound(const Key &key) const + { + if (!d) + return const_iterator(); + return const_iterator(d->m.lower_bound(key)); + } + + iterator upperBound(const Key &key) + { + const auto copy = d.isShared() ? *this : QMap(); // keep `key` alive across the detach + detach(); + return iterator(d->m.upper_bound(key)); + } + + const_iterator upperBound(const Key &key) const + { + if (!d) + return const_iterator(); + return const_iterator(d->m.upper_bound(key)); + } + + iterator insert(const Key &key, const T &value) + { + const auto copy = d.isShared() ? *this : QMap(); // keep `key` alive across the detach + // TODO: improve. In case of assignment, why copying first? + detach(); + return iterator(d->m.insert_or_assign(key, value).first); + } + + iterator insert(const_iterator pos, const Key &key, const T &value) + { + // TODO: improve. In case of assignment, why copying first? + typename Map::const_iterator dpos; + const auto copy = d.isShared() ? *this : QMap(); // keep `key`/`value` alive across the detach + if (!d || d.isShared()) { + auto posDistance = d ? std::distance(d->m.cbegin(), pos.i) : 0; + detach(); + dpos = std::next(d->m.cbegin(), posDistance); + } else { + dpos = pos.i; + } + return iterator(d->m.insert_or_assign(dpos, key, value)); + } + + void insert(const QMap &map) + { + // TODO: improve. In case of assignment, why copying first? + if (map.isEmpty()) + return; + + detach(); + +#ifdef __cpp_lib_node_extract + auto copy = map.d->m; + copy.merge(std::move(d->m)); + d->m = std::move(copy); +#else + // this is a std::copy, but we can't use std::inserter (need insert_or_assign...). + // copy in reverse order, trying to make effective use of insertionHint. + auto insertionHint = d->m.end(); + auto mapIt = map.d->m.crbegin(); + auto end = map.d->m.crend(); + for (; mapIt != end; ++mapIt) + insertionHint = d->m.insert_or_assign(insertionHint, mapIt->first, mapIt->second); +#endif + } + + void insert(QMap &&map) + { + if (!map.d || map.d->m.empty()) + return; + + if (map.d.isShared()) { + // fall back to a regular copy + insert(map); + return; + } + + detach(); + +#ifdef __cpp_lib_node_extract + map.d->m.merge(std::move(d->m)); + *this = std::move(map); +#else + // same as above + auto insertionHint = d->m.end(); + auto mapIt = map.d->m.crbegin(); + auto end = map.d->m.crend(); + for (; mapIt != end; ++mapIt) + insertionHint = d->m.insert_or_assign(insertionHint, std::move(mapIt->first), std::move(mapIt->second)); +#endif + } + + // STL compatibility + inline bool empty() const + { + return isEmpty(); + } + + std::pair equal_range(const Key &akey) + { + const auto copy = d.isShared() ? *this : QMap(); // keep `key` alive across the detach + detach(); + auto result = d->m.equal_range(akey); + return {iterator(result.first), iterator(result.second)}; + } + + std::pair equal_range(const Key &akey) const + { + if (!d) + return {}; + auto result = d->m.equal_range(akey); + return {const_iterator(result.first), const_iterator(result.second)}; + } + +private: +#ifdef Q_QDOC + friend size_t qHash(const QMap &key, size_t seed = 0); +#else +# if defined(Q_CC_GHS) || defined (Q_CC_MSVC) + // GHS and MSVC tries to intantiate qHash() for the noexcept running into a + // non-SFINAE'ed hard error... Create an artificial SFINAE context as a + // work-around: + template , bool> = true> + friend QtPrivate::QHashMultiReturnType +# else + using M = QMap; + friend size_t +# endif + qHash(const M &key, size_t seed = 0) + noexcept(QHashPrivate::noexceptPairHash()) + { + if (!key.d) + return seed; + // don't use qHashRange to avoid its compile-time overhead: + return std::accumulate(key.d->m.begin(), key.d->m.end(), seed, + QtPrivate::QHashCombine{}); + } +#endif // !Q_QDOC +}; + +Q_DECLARE_ASSOCIATIVE_ITERATOR(Map) +Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(Map) + +template +qsizetype erase_if(QMap &map, Predicate pred) +{ + return QtPrivate::associative_erase_if(map, pred); +} + + +// +// QMultiMap +// + +template +class QMultiMap +{ + using Map = std::multimap; + using MapData = QMapData; + QtPrivate::QExplicitlySharedDataPointerV2 d; + +public: + using key_type = Key; + using mapped_type = T; + using difference_type = qptrdiff; + using size_type = qsizetype; + + QMultiMap() = default; + + // implicitly generated special member functions are OK! + + QMultiMap(std::initializer_list> list) + { + for (auto &p : list) + insert(p.first, p.second); + } + + void swap(QMultiMap &other) noexcept + { + d.swap(other.d); + } + + explicit QMultiMap(const QMap &other) + : d(other.isEmpty() ? nullptr : new MapData) + { + if (d) { + Q_ASSERT(other.d); + d->m.insert(other.d->m.begin(), + other.d->m.end()); + } + } + + explicit QMultiMap(QMap &&other) + : d(other.isEmpty() ? nullptr : new MapData) + { + if (d) { + Q_ASSERT(other.d); + if (other.d.isShared()) { + d->m.insert(other.d->m.begin(), + other.d->m.end()); + } else { +#ifdef __cpp_lib_node_extract + d->m.merge(std::move(other.d->m)); +#else + d->m.insert(std::make_move_iterator(other.d->m.begin()), + std::make_move_iterator(other.d->m.end())); +#endif + } + } + } + + explicit QMultiMap(const std::multimap &other) + : d(other.empty() ? nullptr : new MapData(other)) + { + } + + explicit QMultiMap(std::multimap &&other) + : d(other.empty() ? nullptr : new MapData(std::move(other))) + { + } + + // CHANGE: return type + Q_DECL_DEPRECATED_X("Use toStdMultiMap instead") + std::multimap toStdMap() const + { + return toStdMultiMap(); + } + + std::multimap toStdMultiMap() const & + { + if (d) + return d->m; + return {}; + } + + std::multimap toStdMultiMap() && + { + if (d) { + if (d.isShared()) + return d->m; + else + return std::move(d->m); + } + + return {}; + } + +#ifndef Q_QDOC + template friend + QTypeTraits::compare_eq_result_container operator==(const QMultiMap &lhs, const QMultiMap &rhs) + { + if (lhs.d == rhs.d) + return true; + if (!lhs.d) + return rhs == lhs; + Q_ASSERT(lhs.d); + return rhs.d ? (lhs.d->m == rhs.d->m) : lhs.d->m.empty(); + } + + template friend + QTypeTraits::compare_eq_result_container operator!=(const QMultiMap &lhs, const QMultiMap &rhs) + { + return !(lhs == rhs); + } + // TODO: add the other comparison operators; std::multimap has them. +#else + friend bool operator==(const QMultiMap &lhs, const QMultiMap &rhs); + friend bool operator!=(const QMultiMap &lhs, const QMultiMap &rhs); +#endif // Q_QDOC + + size_type size() const { return d ? size_type(d->m.size()) : size_type(0); } + + bool isEmpty() const { return d ? d->m.empty() : true; } + + void detach() + { + if (d) + d.detach(); + else + d.reset(new MapData); + } + + bool isDetached() const noexcept + { + return d ? !d.isShared() : false; // false makes little sense, but that's shared_null's behavior... + } + + bool isSharedWith(const QMultiMap &other) const noexcept + { + return d == other.d; // also this makes little sense? + } + + void clear() + { + if (!d) + return; + + if (!d.isShared()) + d->m.clear(); + else + d.reset(); + } + + size_type remove(const Key &key) + { + if (!d) + return 0; + + if (!d.isShared()) + return size_type(d->m.erase(key)); + + MapData *newData = new MapData; + size_type result = newData->copyIfNotEquivalentTo(d->m, key); + + d.reset(newData); + + return result; + } + + size_type remove(const Key &key, const T &value) + { + if (!d) + return 0; + + // key and value may belong to this map. As such, we need to copy + // them to ensure they stay valid throughout the iteration below + // (which may destroy them) + const Key keyCopy = key; + const T valueCopy = value; + + // TODO: improve. Copy over only the elements not to be removed. + detach(); + + size_type result = 0; + const auto &keyCompare = d->m.key_comp(); + + auto i = d->m.find(keyCopy); + const auto e = d->m.end(); + + while (i != e && !keyCompare(keyCopy, i->first)) { + if (i->second == valueCopy) { + i = d->m.erase(i); + ++result; + } else { + ++i; + } + } + + return result; + } + + template + size_type removeIf(Predicate pred) + { + return QtPrivate::associative_erase_if(*this, pred); + } + + T take(const Key &key) + { + if (!d) + return T(); + + const auto copy = d.isShared() ? *this : QMultiMap(); // keep `key` alive across the detach + + // TODO: improve. There is no need of copying all the + // elements (the one to be removed can be skipped). + detach(); + + auto i = d->m.find(key); + if (i != d->m.end()) { + T result(std::move(i->second)); + d->m.erase(i); + return result; + } + return T(); + } + + bool contains(const Key &key) const + { + if (!d) + return false; + auto i = d->m.find(key); + return i != d->m.end(); + } + + bool contains(const Key &key, const T &value) const + { + return find(key, value) != end(); + } + + Key key(const T &value, const Key &defaultKey = Key()) const + { + if (!d) + return defaultKey; + + return d->key(value, defaultKey); + } + + T value(const Key &key, const T &defaultValue = T()) const + { + if (!d) + return defaultValue; + const auto i = d->m.find(key); + if (i != d->m.cend()) + return i->second; + return defaultValue; + } + + QList keys() const + { + if (!d) + return {}; + return d->keys(); + } + + QList keys(const T &value) const + { + if (!d) + return {}; + return d->keys(value); + } + + QList uniqueKeys() const + { + QList result; + if (!d) + return result; + + result.reserve(size()); + + std::unique_copy(keyBegin(), keyEnd(), + std::back_inserter(result)); + + result.shrink_to_fit(); + return result; + } + + QList values() const + { + if (!d) + return {}; + return d->values(); + } + + QList values(const Key &key) const + { + QList result; + const auto range = equal_range(key); + result.reserve(std::distance(range.first, range.second)); + std::copy(range.first, range.second, std::back_inserter(result)); + return result; + } + + size_type count(const Key &key) const + { + if (!d) + return 0; + return d->count(key); + } + + size_type count(const Key &key, const T &value) const + { + if (!d) + return 0; + + // TODO: improve; no need of scanning the equal_range twice. + auto range = d->m.equal_range(key); + + return size_type(std::count_if(range.first, + range.second, + MapData::valueIsEqualTo(value))); + } + + inline const Key &firstKey() const { Q_ASSERT(!isEmpty()); return constBegin().key(); } + inline const Key &lastKey() const { Q_ASSERT(!isEmpty()); return std::next(constEnd(), -1).key(); } + + inline T &first() { Q_ASSERT(!isEmpty()); return *begin(); } + inline const T &first() const { Q_ASSERT(!isEmpty()); return *constBegin(); } + inline T &last() { Q_ASSERT(!isEmpty()); return *std::next(end(), -1); } + inline const T &last() const { Q_ASSERT(!isEmpty()); return *std::next(constEnd(), -1); } + + class const_iterator; + + class iterator + { + friend class QMultiMap; + friend class const_iterator; + + typename Map::iterator i; + explicit iterator(typename Map::iterator it) : i(it) {} + public: + using iterator_category = std::bidirectional_iterator_tag; + using difference_type = qptrdiff; + using value_type = T; + using pointer = T *; + using reference = T &; + + iterator() = default; + + const Key &key() const { return i->first; } + T &value() const { return i->second; } + T &operator*() const { return i->second; } + T *operator->() const { return &i->second; } + friend bool operator==(const iterator &lhs, const iterator &rhs) { return lhs.i == rhs.i; } + friend bool operator!=(const iterator &lhs, const iterator &rhs) { return lhs.i != rhs.i; } + + iterator &operator++() + { + ++i; + return *this; + } + iterator operator++(int) + { + iterator r = *this; + ++i; + return r; + } + iterator &operator--() + { + --i; + return *this; + } + iterator operator--(int) + { + iterator r = *this; + --i; + return r; + } + +#if QT_DEPRECATED_SINCE(6, 0) + QT_DEPRECATED_VERSION_X_6_0("Use std::next; QMultiMap iterators are not random access") + //! [qmultimap-op-it-plus-step] + friend iterator operator+(iterator it, difference_type j) { return std::next(it, j); } + + QT_DEPRECATED_VERSION_X_6_0("Use std::prev; QMultiMap iterators are not random access") + //! [qmultimap-op-it-minus-step] + friend iterator operator-(iterator it, difference_type j) { return std::prev(it, j); } + + QT_DEPRECATED_VERSION_X_6_0("Use std::next or std::advance; QMultiMap iterators are not random access") + iterator &operator+=(difference_type j) { std::advance(*this, j); return *this; } + + QT_DEPRECATED_VERSION_X_6_0("Use std::prev or std::advance; QMultiMap iterators are not random access") + iterator &operator-=(difference_type j) { std::advance(*this, -j); return *this; } + + QT_DEPRECATED_VERSION_X_6_0("Use std::next; QMultiMap iterators are not random access") + //! [qmultimap-op-step-plus-it] + friend iterator operator+(difference_type j, iterator it) { return std::next(it, j); } + + QT_DEPRECATED_VERSION_X_6_0("Use std::prev; QMultiMap iterators are not random access") + //! [qmultimap-op-step-minus-it] + friend iterator operator-(difference_type j, iterator it) { return std::prev(it, j); } +#endif + }; + + class const_iterator + { + friend class QMultiMap; + typename Map::const_iterator i; + explicit const_iterator(typename Map::const_iterator it) : i(it) {} + + public: + using iterator_category = std::bidirectional_iterator_tag; + using difference_type = qptrdiff; + using value_type = T; + using pointer = const T *; + using reference = const T &; + + const_iterator() = default; + Q_IMPLICIT const_iterator(const iterator &o) : i(o.i) {} + + const Key &key() const { return i->first; } + const T &value() const { return i->second; } + const T &operator*() const { return i->second; } + const T *operator->() const { return &i->second; } + friend bool operator==(const const_iterator &lhs, const const_iterator &rhs) { return lhs.i == rhs.i; } + friend bool operator!=(const const_iterator &lhs, const const_iterator &rhs) { return lhs.i != rhs.i; } + + const_iterator &operator++() + { + ++i; + return *this; + } + const_iterator operator++(int) + { + const_iterator r = *this; + ++i; + return r; + } + const_iterator &operator--() + { + --i; + return *this; + } + const_iterator operator--(int) + { + const_iterator r = *this; + --i; + return r; + } + +#if QT_DEPRECATED_SINCE(6, 0) + QT_DEPRECATED_VERSION_X_6_0("Use std::next; QMultiMap iterators are not random access") + //! [qmultimap-op-it-plus-step-const] + friend const_iterator operator+(const_iterator it, difference_type j) { return std::next(it, j); } + + QT_DEPRECATED_VERSION_X_6_0("Use std::prev; QMultiMap iterators are not random access") + //! [qmultimap-op-it-minus-step-const] + friend const_iterator operator-(const_iterator it, difference_type j) { return std::prev(it, j); } + + QT_DEPRECATED_VERSION_X_6_0("Use std::next or std::advance; QMultiMap iterators are not random access") + const_iterator &operator+=(difference_type j) { std::advance(*this, j); return *this; } + + QT_DEPRECATED_VERSION_X_6_0("Use std::prev or std::advance; QMultiMap iterators are not random access") + const_iterator &operator-=(difference_type j) { std::advance(*this, -j); return *this; } + + QT_DEPRECATED_VERSION_X_6_0("Use std::next; QMultiMap iterators are not random access") + //! [qmultimap-op-step-plus-it-const] + friend const_iterator operator+(difference_type j, const_iterator it) { return std::next(it, j); } + + QT_DEPRECATED_VERSION_X_6_0("Use std::prev; QMultiMap iterators are not random access") + //! [qmultimap-op-step-minus-it-const] + friend const_iterator operator-(difference_type j, const_iterator it) { return std::prev(it, j); } +#endif + }; + + class key_iterator + { + const_iterator i; + + public: + typedef typename const_iterator::iterator_category iterator_category; + typedef typename const_iterator::difference_type difference_type; + typedef Key value_type; + typedef const Key *pointer; + typedef const Key &reference; + + key_iterator() = default; + explicit key_iterator(const_iterator o) : i(o) { } + + const Key &operator*() const { return i.key(); } + const Key *operator->() const { return &i.key(); } + bool operator==(key_iterator o) const { return i == o.i; } + bool operator!=(key_iterator o) const { return i != o.i; } + + inline key_iterator &operator++() { ++i; return *this; } + inline key_iterator operator++(int) { return key_iterator(i++);} + inline key_iterator &operator--() { --i; return *this; } + inline key_iterator operator--(int) { return key_iterator(i--); } + const_iterator base() const { return i; } + }; + + typedef QKeyValueIterator const_key_value_iterator; + typedef QKeyValueIterator key_value_iterator; + + // STL style + iterator begin() { detach(); return iterator(d->m.begin()); } + const_iterator begin() const { if (!d) return const_iterator(); return const_iterator(d->m.cbegin()); } + const_iterator constBegin() const { return begin(); } + const_iterator cbegin() const { return begin(); } + iterator end() { detach(); return iterator(d->m.end()); } + const_iterator end() const { if (!d) return const_iterator(); return const_iterator(d->m.end()); } + const_iterator constEnd() const { return end(); } + const_iterator cend() const { return end(); } + key_iterator keyBegin() const { return key_iterator(begin()); } + key_iterator keyEnd() const { return key_iterator(end()); } + key_value_iterator keyValueBegin() { return key_value_iterator(begin()); } + key_value_iterator keyValueEnd() { return key_value_iterator(end()); } + const_key_value_iterator keyValueBegin() const { return const_key_value_iterator(begin()); } + const_key_value_iterator constKeyValueBegin() const { return const_key_value_iterator(begin()); } + const_key_value_iterator keyValueEnd() const { return const_key_value_iterator(end()); } + const_key_value_iterator constKeyValueEnd() const { return const_key_value_iterator(end()); } + auto asKeyValueRange() & { return QtPrivate::QKeyValueRange(*this); } + auto asKeyValueRange() const & { return QtPrivate::QKeyValueRange(*this); } + auto asKeyValueRange() && { return QtPrivate::QKeyValueRange(std::move(*this)); } + auto asKeyValueRange() const && { return QtPrivate::QKeyValueRange(std::move(*this)); } + + iterator erase(const_iterator it) + { + return erase(it, std::next(it)); + } + + iterator erase(const_iterator afirst, const_iterator alast) + { + if (!d) + return iterator(); + + if (!d.isShared()) + return iterator(d->m.erase(afirst.i, alast.i)); + + auto result = d->erase(afirst.i, alast.i); + d.reset(result.data); + return iterator(result.it); + } + + // more Qt + typedef iterator Iterator; + typedef const_iterator ConstIterator; + + size_type count() const + { + return size(); + } + + iterator find(const Key &key) + { + const auto copy = d.isShared() ? *this : QMultiMap(); // keep `key` alive across the detach + detach(); + return iterator(d->m.find(key)); + } + + const_iterator find(const Key &key) const + { + if (!d) + return const_iterator(); + return const_iterator(d->m.find(key)); + } + + const_iterator constFind(const Key &key) const + { + return find(key); + } + + iterator find(const Key &key, const T &value) + { + const auto copy = d.isShared() ? *this : QMultiMap(); // keep `key`/`value` alive across the detach + + detach(); + + auto range = d->m.equal_range(key); + auto i = std::find_if(range.first, range.second, + MapData::valueIsEqualTo(value)); + + if (i != range.second) + return iterator(i); + return iterator(d->m.end()); + } + + const_iterator find(const Key &key, const T &value) const + { + if (!d) + return const_iterator(); + + auto range = d->m.equal_range(key); + auto i = std::find_if(range.first, range.second, + MapData::valueIsEqualTo(value)); + + if (i != range.second) + return const_iterator(i); + return const_iterator(d->m.end()); + } + + const_iterator constFind(const Key &key, const T &value) const + { + return find(key, value); + } + + iterator lowerBound(const Key &key) + { + const auto copy = d.isShared() ? *this : QMultiMap(); // keep `key` alive across the detach + detach(); + return iterator(d->m.lower_bound(key)); + } + + const_iterator lowerBound(const Key &key) const + { + if (!d) + return const_iterator(); + return const_iterator(d->m.lower_bound(key)); + } + + iterator upperBound(const Key &key) + { + const auto copy = d.isShared() ? *this : QMultiMap(); // keep `key` alive across the detach + detach(); + return iterator(d->m.upper_bound(key)); + } + + const_iterator upperBound(const Key &key) const + { + if (!d) + return const_iterator(); + return const_iterator(d->m.upper_bound(key)); + } + + iterator insert(const Key &key, const T &value) + { + const auto copy = d.isShared() ? *this : QMultiMap(); // keep `key`/`value` alive across the detach + detach(); + // note that std::multimap inserts at the end of an equal_range for a key, + // QMultiMap at the beginning. + auto i = d->m.lower_bound(key); + return iterator(d->m.insert(i, {key, value})); + } + + iterator insert(const_iterator pos, const Key &key, const T &value) + { + const auto copy = d.isShared() ? *this : QMultiMap(); // keep `key`/`value` alive across the detach + typename Map::const_iterator dpos; + if (!d || d.isShared()) { + auto posDistance = d ? std::distance(d->m.cbegin(), pos.i) : 0; + detach(); + dpos = std::next(d->m.cbegin(), posDistance); + } else { + dpos = pos.i; + } + return iterator(d->m.insert(dpos, {key, value})); + } + +#if QT_DEPRECATED_SINCE(6, 0) + QT_DEPRECATED_VERSION_X_6_0("Use insert() instead") + iterator insertMulti(const Key &key, const T &value) + { + return insert(key, value); + } + QT_DEPRECATED_VERSION_X_6_0("Use insert() instead") + iterator insertMulti(const_iterator pos, const Key &key, const T &value) + { + return insert(pos, key, value); + } + + QT_DEPRECATED_VERSION_X_6_0("Use unite() instead") + void insert(const QMultiMap &map) + { + unite(map); + } + + QT_DEPRECATED_VERSION_X_6_0("Use unite() instead") + void insert(QMultiMap &&map) + { + unite(std::move(map)); + } +#endif + + iterator replace(const Key &key, const T &value) + { + const auto copy = d.isShared() ? *this : QMultiMap(); // keep `key`/`value` alive across the detach + + // TODO: improve. No need of copying and then overwriting. + detach(); + + // Similarly, improve here (e.g. lower_bound and hinted insert); + // there's no insert_or_assign on multimaps + auto i = d->m.find(key); + if (i != d->m.end()) + i->second = value; + else + i = d->m.insert({key, value}); + + return iterator(i); + } + + // STL compatibility + inline bool empty() const { return isEmpty(); } + + std::pair equal_range(const Key &akey) + { + const auto copy = d.isShared() ? *this : QMultiMap(); // keep `key` alive across the detach + detach(); + auto result = d->m.equal_range(akey); + return {iterator(result.first), iterator(result.second)}; + } + + std::pair equal_range(const Key &akey) const + { + if (!d) + return {}; + auto result = d->m.equal_range(akey); + return {const_iterator(result.first), const_iterator(result.second)}; + } + + QMultiMap &unite(const QMultiMap &other) + { + if (other.isEmpty()) + return *this; + + detach(); + + auto copy = other.d->m; +#ifdef __cpp_lib_node_extract + copy.merge(std::move(d->m)); +#else + copy.insert(std::make_move_iterator(d->m.begin()), + std::make_move_iterator(d->m.end())); +#endif + d->m = std::move(copy); + return *this; + } + + QMultiMap &unite(QMultiMap &&other) + { + if (!other.d || other.d->m.empty()) + return *this; + + if (other.d.isShared()) { + // fall back to a regular copy + unite(other); + return *this; + } + + detach(); + +#ifdef __cpp_lib_node_extract + other.d->m.merge(std::move(d->m)); +#else + other.d->m.insert(std::make_move_iterator(d->m.begin()), + std::make_move_iterator(d->m.end())); +#endif + *this = std::move(other); + return *this; + } +}; + +Q_DECLARE_ASSOCIATIVE_ITERATOR(MultiMap) +Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(MultiMap) + +template +QMultiMap operator+(const QMultiMap &lhs, const QMultiMap &rhs) +{ + auto result = lhs; + result += rhs; + return result; +} + +template +QMultiMap operator+=(QMultiMap &lhs, const QMultiMap &rhs) +{ + return lhs.unite(rhs); +} + +template +qsizetype erase_if(QMultiMap &map, Predicate pred) +{ + return QtPrivate::associative_erase_if(map, pred); +} + +QT_END_NAMESPACE + +#endif // QMAP_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qmargins.h b/qt/6.8.1/msvc2022_64/include/QtCore/qmargins.h new file mode 100644 index 0000000000000000000000000000000000000000..d57bf86cd6a486bad32d65f1a9a6a35a79b5d0b8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qmargins.h @@ -0,0 +1,546 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QMARGINS_H +#define QMARGINS_H + +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +QT_ENABLE_P0846_SEMANTICS_FOR(get) + +class QMarginsF; + +/***************************************************************************** + QMargins class + *****************************************************************************/ + +class QMargins +{ +public: + constexpr QMargins() noexcept; + constexpr QMargins(int left, int top, int right, int bottom) noexcept; + + constexpr bool isNull() const noexcept; + + constexpr int left() const noexcept; + constexpr int top() const noexcept; + constexpr int right() const noexcept; + constexpr int bottom() const noexcept; + + constexpr void setLeft(int left) noexcept; + constexpr void setTop(int top) noexcept; + constexpr void setRight(int right) noexcept; + constexpr void setBottom(int bottom) noexcept; + + constexpr QMargins &operator+=(const QMargins &margins) noexcept; + constexpr QMargins &operator-=(const QMargins &margins) noexcept; + constexpr QMargins &operator+=(int) noexcept; + constexpr QMargins &operator-=(int) noexcept; + constexpr QMargins &operator*=(int) noexcept; + constexpr QMargins &operator/=(int); + constexpr QMargins &operator*=(qreal) noexcept; + constexpr QMargins &operator/=(qreal); + + [[nodiscard]] constexpr inline QMarginsF toMarginsF() const noexcept; + +private: + int m_left; + int m_top; + int m_right; + int m_bottom; + + friend constexpr bool comparesEqual(const QMargins &lhs, const QMargins &rhs) noexcept + { + return lhs.m_left == rhs.m_left + && lhs.m_top == rhs.m_top + && lhs.m_right == rhs.m_right + && lhs.m_bottom == rhs.m_bottom; + } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QMargins) + + template = true, + std::enable_if_t, QMargins>, bool> = true> + friend constexpr decltype(auto) get(M &&m) noexcept + { + if constexpr (I == 0) + return q23::forward_like(m.m_left); + else if constexpr (I == 1) + return q23::forward_like(m.m_top); + else if constexpr (I == 2) + return q23::forward_like(m.m_right); + else if constexpr (I == 3) + return q23::forward_like(m.m_bottom); + } +}; + +Q_DECLARE_TYPEINFO(QMargins, Q_RELOCATABLE_TYPE); + +/***************************************************************************** + QMargins stream functions + *****************************************************************************/ +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QMargins &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QMargins &); +#endif + +/***************************************************************************** + QMargins inline functions + *****************************************************************************/ + +constexpr inline QMargins::QMargins() noexcept : m_left(0), m_top(0), m_right(0), m_bottom(0) {} + +constexpr inline QMargins::QMargins(int aleft, int atop, int aright, int abottom) noexcept + : m_left(aleft), m_top(atop), m_right(aright), m_bottom(abottom) {} + +constexpr inline bool QMargins::isNull() const noexcept +{ return m_left==0 && m_top==0 && m_right==0 && m_bottom==0; } + +constexpr inline int QMargins::left() const noexcept +{ return m_left; } + +constexpr inline int QMargins::top() const noexcept +{ return m_top; } + +constexpr inline int QMargins::right() const noexcept +{ return m_right; } + +constexpr inline int QMargins::bottom() const noexcept +{ return m_bottom; } + + +constexpr inline void QMargins::setLeft(int aleft) noexcept +{ m_left = aleft; } + +constexpr inline void QMargins::setTop(int atop) noexcept +{ m_top = atop; } + +constexpr inline void QMargins::setRight(int aright) noexcept +{ m_right = aright; } + +constexpr inline void QMargins::setBottom(int abottom) noexcept +{ m_bottom = abottom; } + +constexpr inline QMargins operator+(const QMargins &m1, const QMargins &m2) noexcept +{ + return QMargins(m1.left() + m2.left(), m1.top() + m2.top(), + m1.right() + m2.right(), m1.bottom() + m2.bottom()); +} + +constexpr inline QMargins operator-(const QMargins &m1, const QMargins &m2) noexcept +{ + return QMargins(m1.left() - m2.left(), m1.top() - m2.top(), + m1.right() - m2.right(), m1.bottom() - m2.bottom()); +} + +constexpr inline QMargins operator+(const QMargins &lhs, int rhs) noexcept +{ + return QMargins(lhs.left() + rhs, lhs.top() + rhs, + lhs.right() + rhs, lhs.bottom() + rhs); +} + +constexpr inline QMargins operator+(int lhs, const QMargins &rhs) noexcept +{ + return QMargins(rhs.left() + lhs, rhs.top() + lhs, + rhs.right() + lhs, rhs.bottom() + lhs); +} + +constexpr inline QMargins operator-(const QMargins &lhs, int rhs) noexcept +{ + return QMargins(lhs.left() - rhs, lhs.top() - rhs, + lhs.right() - rhs, lhs.bottom() - rhs); +} + +constexpr inline QMargins operator*(const QMargins &margins, int factor) noexcept +{ + return QMargins(margins.left() * factor, margins.top() * factor, + margins.right() * factor, margins.bottom() * factor); +} + +constexpr inline QMargins operator*(int factor, const QMargins &margins) noexcept +{ + return QMargins(margins.left() * factor, margins.top() * factor, + margins.right() * factor, margins.bottom() * factor); +} + +constexpr inline QMargins operator*(const QMargins &margins, qreal factor) noexcept +{ + return QMargins(qRound(margins.left() * factor), qRound(margins.top() * factor), + qRound(margins.right() * factor), qRound(margins.bottom() * factor)); +} + +constexpr inline QMargins operator*(qreal factor, const QMargins &margins) noexcept +{ + return QMargins(qRound(margins.left() * factor), qRound(margins.top() * factor), + qRound(margins.right() * factor), qRound(margins.bottom() * factor)); +} + +constexpr inline QMargins operator/(const QMargins &margins, int divisor) +{ + return QMargins(margins.left() / divisor, margins.top() / divisor, + margins.right() / divisor, margins.bottom() / divisor); +} + +constexpr inline QMargins operator/(const QMargins &margins, qreal divisor) +{ + return QMargins(qRound(margins.left() / divisor), qRound(margins.top() / divisor), + qRound(margins.right() / divisor), qRound(margins.bottom() / divisor)); +} + +constexpr inline QMargins operator|(const QMargins &m1, const QMargins &m2) noexcept +{ + return QMargins(qMax(m1.left(), m2.left()), qMax(m1.top(), m2.top()), + qMax(m1.right(), m2.right()), qMax(m1.bottom(), m2.bottom())); +} + +constexpr inline QMargins &QMargins::operator+=(const QMargins &margins) noexcept +{ + return *this = *this + margins; +} + +constexpr inline QMargins &QMargins::operator-=(const QMargins &margins) noexcept +{ + return *this = *this - margins; +} + +constexpr inline QMargins &QMargins::operator+=(int margin) noexcept +{ + m_left += margin; + m_top += margin; + m_right += margin; + m_bottom += margin; + return *this; +} + +constexpr inline QMargins &QMargins::operator-=(int margin) noexcept +{ + m_left -= margin; + m_top -= margin; + m_right -= margin; + m_bottom -= margin; + return *this; +} + +constexpr inline QMargins &QMargins::operator*=(int factor) noexcept +{ + return *this = *this * factor; +} + +constexpr inline QMargins &QMargins::operator/=(int divisor) +{ + return *this = *this / divisor; +} + +constexpr inline QMargins &QMargins::operator*=(qreal factor) noexcept +{ + return *this = *this * factor; +} + +constexpr inline QMargins &QMargins::operator/=(qreal divisor) +{ + return *this = *this / divisor; +} + +constexpr inline QMargins operator+(const QMargins &margins) noexcept +{ + return margins; +} + +constexpr inline QMargins operator-(const QMargins &margins) noexcept +{ + return QMargins(-margins.left(), -margins.top(), -margins.right(), -margins.bottom()); +} + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QMargins &); +#endif + +/***************************************************************************** + QMarginsF class + *****************************************************************************/ + +class QMarginsF +{ +public: + constexpr QMarginsF() noexcept; + constexpr QMarginsF(qreal left, qreal top, qreal right, qreal bottom) noexcept; + constexpr QMarginsF(const QMargins &margins) noexcept; + + constexpr bool isNull() const noexcept; + + constexpr qreal left() const noexcept; + constexpr qreal top() const noexcept; + constexpr qreal right() const noexcept; + constexpr qreal bottom() const noexcept; + + constexpr void setLeft(qreal aleft) noexcept; + constexpr void setTop(qreal atop) noexcept; + constexpr void setRight(qreal aright) noexcept; + constexpr void setBottom(qreal abottom) noexcept; + + constexpr QMarginsF &operator+=(const QMarginsF &margins) noexcept; + constexpr QMarginsF &operator-=(const QMarginsF &margins) noexcept; + constexpr QMarginsF &operator+=(qreal addend) noexcept; + constexpr QMarginsF &operator-=(qreal subtrahend) noexcept; + constexpr QMarginsF &operator*=(qreal factor) noexcept; + constexpr QMarginsF &operator/=(qreal divisor); + + constexpr inline QMargins toMargins() const noexcept; + +private: + qreal m_left; + qreal m_top; + qreal m_right; + qreal m_bottom; + + QT_WARNING_PUSH + QT_WARNING_DISABLE_FLOAT_COMPARE + friend constexpr bool qFuzzyCompare(const QMarginsF &lhs, const QMarginsF &rhs) noexcept + { + return ((!lhs.m_left || !rhs.m_left) ? qFuzzyIsNull(lhs.m_left - rhs.m_left) + : qFuzzyCompare(lhs.m_left, rhs.m_left)) + && ((!lhs.m_top || !rhs.m_top) ? qFuzzyIsNull(lhs.m_top - rhs.m_top) + : qFuzzyCompare(lhs.m_top, rhs.m_top)) + && ((!lhs.m_right || !rhs.m_right) ? qFuzzyIsNull(lhs.m_right - rhs.m_right) + : qFuzzyCompare(lhs.m_right, rhs.m_right)) + && ((!lhs.m_bottom || !rhs.m_bottom) ? qFuzzyIsNull(lhs.m_bottom - rhs.m_bottom) + : qFuzzyCompare(lhs.m_bottom, rhs.m_bottom)); + } + QT_WARNING_POP + friend constexpr bool qFuzzyIsNull(const QMarginsF &m) noexcept + { + return qFuzzyIsNull(m.m_left) && qFuzzyIsNull(m.m_top) + && qFuzzyIsNull(m.m_right) && qFuzzyIsNull(m.m_bottom); + } + + friend constexpr bool comparesEqual(const QMarginsF &lhs, const QMarginsF &rhs) noexcept + { + return qFuzzyCompare(lhs, rhs); + } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QMarginsF) + + friend constexpr bool comparesEqual(const QMarginsF &lhs, const QMargins &rhs) noexcept + { return comparesEqual(lhs, rhs.toMarginsF()); } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QMarginsF, QMargins) + + template = true, + std::enable_if_t, QMarginsF>, bool> = true> + friend constexpr decltype(auto) get(M &&m) noexcept + { + if constexpr (I == 0) + return q23::forward_like(m.m_left); + else if constexpr (I == 1) + return q23::forward_like(m.m_top); + else if constexpr (I == 2) + return q23::forward_like(m.m_right); + else if constexpr (I == 3) + return q23::forward_like(m.m_bottom); + } +}; + +Q_DECLARE_TYPEINFO(QMarginsF, Q_RELOCATABLE_TYPE); + +/***************************************************************************** + QMarginsF stream functions + *****************************************************************************/ + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QMarginsF &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QMarginsF &); +#endif + +/***************************************************************************** + QMarginsF inline functions + *****************************************************************************/ + +constexpr inline QMarginsF::QMarginsF() noexcept + : m_left(0), m_top(0), m_right(0), m_bottom(0) {} + +constexpr inline QMarginsF::QMarginsF(qreal aleft, qreal atop, qreal aright, qreal abottom) noexcept + : m_left(aleft), m_top(atop), m_right(aright), m_bottom(abottom) {} + +constexpr inline QMarginsF::QMarginsF(const QMargins &margins) noexcept + : m_left(margins.left()), m_top(margins.top()), m_right(margins.right()), m_bottom(margins.bottom()) {} + +constexpr inline bool QMarginsF::isNull() const noexcept +{ return qFuzzyIsNull(m_left) && qFuzzyIsNull(m_top) && qFuzzyIsNull(m_right) && qFuzzyIsNull(m_bottom); } + +constexpr inline qreal QMarginsF::left() const noexcept +{ return m_left; } + +constexpr inline qreal QMarginsF::top() const noexcept +{ return m_top; } + +constexpr inline qreal QMarginsF::right() const noexcept +{ return m_right; } + +constexpr inline qreal QMarginsF::bottom() const noexcept +{ return m_bottom; } + + +constexpr inline void QMarginsF::setLeft(qreal aleft) noexcept +{ m_left = aleft; } + +constexpr inline void QMarginsF::setTop(qreal atop) noexcept +{ m_top = atop; } + +constexpr inline void QMarginsF::setRight(qreal aright) noexcept +{ m_right = aright; } + +constexpr inline void QMarginsF::setBottom(qreal abottom) noexcept +{ m_bottom = abottom; } + +constexpr inline QMarginsF operator+(const QMarginsF &lhs, const QMarginsF &rhs) noexcept +{ + return QMarginsF(lhs.left() + rhs.left(), lhs.top() + rhs.top(), + lhs.right() + rhs.right(), lhs.bottom() + rhs.bottom()); +} + +constexpr inline QMarginsF operator-(const QMarginsF &lhs, const QMarginsF &rhs) noexcept +{ + return QMarginsF(lhs.left() - rhs.left(), lhs.top() - rhs.top(), + lhs.right() - rhs.right(), lhs.bottom() - rhs.bottom()); +} + +constexpr inline QMarginsF operator+(const QMarginsF &lhs, qreal rhs) noexcept +{ + return QMarginsF(lhs.left() + rhs, lhs.top() + rhs, + lhs.right() + rhs, lhs.bottom() + rhs); +} + +constexpr inline QMarginsF operator+(qreal lhs, const QMarginsF &rhs) noexcept +{ + return QMarginsF(rhs.left() + lhs, rhs.top() + lhs, + rhs.right() + lhs, rhs.bottom() + lhs); +} + +constexpr inline QMarginsF operator-(const QMarginsF &lhs, qreal rhs) noexcept +{ + return QMarginsF(lhs.left() - rhs, lhs.top() - rhs, + lhs.right() - rhs, lhs.bottom() - rhs); +} + +constexpr inline QMarginsF operator*(const QMarginsF &lhs, qreal rhs) noexcept +{ + return QMarginsF(lhs.left() * rhs, lhs.top() * rhs, + lhs.right() * rhs, lhs.bottom() * rhs); +} + +constexpr inline QMarginsF operator*(qreal lhs, const QMarginsF &rhs) noexcept +{ + return QMarginsF(rhs.left() * lhs, rhs.top() * lhs, + rhs.right() * lhs, rhs.bottom() * lhs); +} + +constexpr inline QMarginsF operator/(const QMarginsF &lhs, qreal divisor) +{ + Q_ASSERT(divisor < 0 || divisor > 0); + return QMarginsF(lhs.left() / divisor, lhs.top() / divisor, + lhs.right() / divisor, lhs.bottom() / divisor); +} + +constexpr inline QMarginsF operator|(const QMarginsF &m1, const QMarginsF &m2) noexcept +{ + return QMarginsF(qMax(m1.left(), m2.left()), qMax(m1.top(), m2.top()), + qMax(m1.right(), m2.right()), qMax(m1.bottom(), m2.bottom())); +} + +constexpr inline QMarginsF &QMarginsF::operator+=(const QMarginsF &margins) noexcept +{ + return *this = *this + margins; +} + +constexpr inline QMarginsF &QMarginsF::operator-=(const QMarginsF &margins) noexcept +{ + return *this = *this - margins; +} + +constexpr inline QMarginsF &QMarginsF::operator+=(qreal addend) noexcept +{ + m_left += addend; + m_top += addend; + m_right += addend; + m_bottom += addend; + return *this; +} + +constexpr inline QMarginsF &QMarginsF::operator-=(qreal subtrahend) noexcept +{ + m_left -= subtrahend; + m_top -= subtrahend; + m_right -= subtrahend; + m_bottom -= subtrahend; + return *this; +} + +constexpr inline QMarginsF &QMarginsF::operator*=(qreal factor) noexcept +{ + return *this = *this * factor; +} + +constexpr inline QMarginsF &QMarginsF::operator/=(qreal divisor) +{ + return *this = *this / divisor; +} + +constexpr inline QMarginsF operator+(const QMarginsF &margins) noexcept +{ + return margins; +} + +constexpr inline QMarginsF operator-(const QMarginsF &margins) noexcept +{ + return QMarginsF(-margins.left(), -margins.top(), -margins.right(), -margins.bottom()); +} + +constexpr QMarginsF QMargins::toMarginsF() const noexcept { return *this; } + +constexpr inline QMargins QMarginsF::toMargins() const noexcept +{ + return QMargins(qRound(m_left), qRound(m_top), qRound(m_right), qRound(m_bottom)); +} + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QMarginsF &); +#endif + +QT_END_NAMESPACE + +/***************************************************************************** + QMargins/QMarginsF tuple protocol + *****************************************************************************/ + +namespace std { + template <> + class tuple_size : public integral_constant {}; + template <> + class tuple_element<0, QT_PREPEND_NAMESPACE(QMargins)> { public: using type = int; }; + template <> + class tuple_element<1, QT_PREPEND_NAMESPACE(QMargins)> { public: using type = int; }; + template <> + class tuple_element<2, QT_PREPEND_NAMESPACE(QMargins)> { public: using type = int; }; + template <> + class tuple_element<3, QT_PREPEND_NAMESPACE(QMargins)> { public: using type = int; }; + + template <> + class tuple_size : public integral_constant {}; + template <> + class tuple_element<0, QT_PREPEND_NAMESPACE(QMarginsF)> { public: using type = QT_PREPEND_NAMESPACE(qreal); }; + template <> + class tuple_element<1, QT_PREPEND_NAMESPACE(QMarginsF)> { public: using type = QT_PREPEND_NAMESPACE(qreal); }; + template <> + class tuple_element<2, QT_PREPEND_NAMESPACE(QMarginsF)> { public: using type = QT_PREPEND_NAMESPACE(qreal); }; + template <> + class tuple_element<3, QT_PREPEND_NAMESPACE(QMarginsF)> { public: using type = QT_PREPEND_NAMESPACE(qreal); }; +} + +#endif // QMARGINS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qmath.h b/qt/6.8.1/msvc2022_64/include/QtCore/qmath.h new file mode 100644 index 0000000000000000000000000000000000000000..7bb115fbf6ec063af3a1323d664e17bbe07ad6f6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qmath.h @@ -0,0 +1,385 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QMATH_H +#define QMATH_H + +#if 0 +#pragma qt_class(QtMath) +#endif + +#include +#include + +#if __has_include() && __cplusplus > 201703L +#include +#endif + +#ifndef _USE_MATH_DEFINES +# define _USE_MATH_DEFINES +# define undef_USE_MATH_DEFINES +#endif + +#include + +#ifdef undef_USE_MATH_DEFINES +# undef _USE_MATH_DEFINES +# undef undef_USE_MATH_DEFINES +#endif + +QT_BEGIN_NAMESPACE + +#define QT_SINE_TABLE_SIZE 256 + +extern Q_CORE_EXPORT const qreal qt_sine_table[QT_SINE_TABLE_SIZE]; + +template int qCeil(T v) +{ + using std::ceil; + return int(ceil(v)); +} + +template int qFloor(T v) +{ + using std::floor; + return int(floor(v)); +} + +template auto qFabs(T v) +{ + using std::fabs; + return fabs(v); +} + +template auto qSin(T v) +{ + using std::sin; + return sin(v); +} + +template auto qCos(T v) +{ + using std::cos; + return cos(v); +} + +template auto qTan(T v) +{ + using std::tan; + return tan(v); +} + +template auto qAcos(T v) +{ + using std::acos; + return acos(v); +} + +template auto qAsin(T v) +{ + using std::asin; + return asin(v); +} + +template auto qAtan(T v) +{ + using std::atan; + return atan(v); +} + +template auto qAtan2(T1 y, T2 x) +{ + using std::atan2; + return atan2(y, x); +} + +template auto qSqrt(T v) +{ + using std::sqrt; + return sqrt(v); +} + +namespace QtPrivate { +template // For qfloat16 to specialize +struct QHypotType { using type = decltype(std::hypot(R(1), F(1))); }; + +// Implements hypot() without limiting number of arguments: +template +class QHypotHelper +{ + T scale, total; + template friend class QHypotHelper; + QHypotHelper(T first, T prior) : scale(first), total(prior) {} +public: + QHypotHelper(T first) : scale(qAbs(first)), total(1) {} + T result() const + { return qIsFinite(scale) ? scale > 0 ? scale * T(qSqrt(total)) : T(0) : scale; } + + template + auto add(F first, Fs... rest) const + { return add(first).add(rest...); } + + template::type> + QHypotHelper add(F next) const + { + if (qIsInf(scale) || (qIsNaN(scale) && !qIsInf(next))) + return QHypotHelper(scale, R(1)); + if (qIsNaN(next)) + return QHypotHelper(next, R(1)); + const R val = qAbs(next); + if (!(scale > 0) || qIsInf(next)) + return QHypotHelper(val, R(1)); + if (!(val > 0)) + return QHypotHelper(scale, total); + if (val > scale) { + const R ratio = scale / next; + return QHypotHelper(val, total * ratio * ratio + R(1)); + } + const R ratio = next / scale; + return QHypotHelper(scale, total + ratio * ratio); + } +}; +} // QtPrivate + +template +auto qHypot(F first, Fs... rest) +{ + return QtPrivate::QHypotHelper(first).add(rest...).result(); +} + +// However, where possible, use the standard library implementations: +template +auto qHypot(Tx x, Ty y) +{ + // C99 has hypot(), hence C++11 has std::hypot() + using std::hypot; + return hypot(x, y); +} + +#if defined(__cpp_lib_hypot) && __cpp_lib_hypot >= 201603L // Expected to be true +template +auto qHypot(Tx x, Ty y, Tz z) +{ + using std::hypot; + return hypot(x, y, z); +} +#endif // else: no need to over-ride the arbitrarily-many-arg form + +template auto qLn(T v) +{ + using std::log; + return log(v); +} + +template auto qExp(T v) +{ + using std::exp; + return exp(v); +} + +template auto qPow(T1 x, T2 y) +{ + using std::pow; + return pow(x, y); +} + +// TODO: use template variables (e.g. Qt::pi) for these once we have C++14 support: + +#ifndef M_E +#define M_E (2.7182818284590452354) +#endif + +#ifndef M_LOG2E +#define M_LOG2E (1.4426950408889634074) +#endif + +#ifndef M_LOG10E +#define M_LOG10E (0.43429448190325182765) +#endif + +#ifndef M_LN2 +#define M_LN2 (0.69314718055994530942) +#endif + +#ifndef M_LN10 +#define M_LN10 (2.30258509299404568402) +#endif + +#ifndef M_PI +#define M_PI (3.14159265358979323846) +#endif + +#ifndef M_PI_2 +#define M_PI_2 (1.57079632679489661923) +#endif + +#ifndef M_PI_4 +#define M_PI_4 (0.78539816339744830962) +#endif + +#ifndef M_1_PI +#define M_1_PI (0.31830988618379067154) +#endif + +#ifndef M_2_PI +#define M_2_PI (0.63661977236758134308) +#endif + +#ifndef M_2_SQRTPI +#define M_2_SQRTPI (1.12837916709551257390) +#endif + +#ifndef M_SQRT2 +#define M_SQRT2 (1.41421356237309504880) +#endif + +#ifndef M_SQRT1_2 +#define M_SQRT1_2 (0.70710678118654752440) +#endif + +inline qreal qFastSin(qreal x) +{ + int si = int(x * (0.5 * QT_SINE_TABLE_SIZE / M_PI)); // Would be more accurate with qRound, but slower. + qreal d = x - si * (2.0 * M_PI / QT_SINE_TABLE_SIZE); + int ci = si + QT_SINE_TABLE_SIZE / 4; + si &= QT_SINE_TABLE_SIZE - 1; + ci &= QT_SINE_TABLE_SIZE - 1; + return qt_sine_table[si] + (qt_sine_table[ci] - 0.5 * qt_sine_table[si] * d) * d; +} + +inline qreal qFastCos(qreal x) +{ + int ci = int(x * (0.5 * QT_SINE_TABLE_SIZE / M_PI)); // Would be more accurate with qRound, but slower. + qreal d = x - ci * (2.0 * M_PI / QT_SINE_TABLE_SIZE); + int si = ci + QT_SINE_TABLE_SIZE / 4; + si &= QT_SINE_TABLE_SIZE - 1; + ci &= QT_SINE_TABLE_SIZE - 1; + return qt_sine_table[si] - (qt_sine_table[ci] + 0.5 * qt_sine_table[si] * d) * d; +} + +constexpr inline float qDegreesToRadians(float degrees) +{ + return degrees * float(M_PI / 180); +} + +constexpr inline double qDegreesToRadians(double degrees) +{ + return degrees * (M_PI / 180); +} + +constexpr inline long double qDegreesToRadians(long double degrees) +{ + return degrees * (M_PI / 180); +} + +template , bool> = true> +constexpr inline double qDegreesToRadians(T degrees) +{ + return qDegreesToRadians(static_cast(degrees)); +} + +constexpr inline float qRadiansToDegrees(float radians) +{ + return radians * float(180 / M_PI); +} + +constexpr inline double qRadiansToDegrees(double radians) +{ + return radians * (180 / M_PI); +} + +constexpr inline long double qRadiansToDegrees(long double radians) +{ + return radians * (180 / M_PI); +} + +// A qRadiansToDegrees(Integral) overload isn't here; it's extremely +// questionable that someone is manipulating quantities in radians +// using integral datatypes... + +namespace QtPrivate { +constexpr inline quint32 qConstexprNextPowerOfTwo(quint32 v) +{ + v |= v >> 1; + v |= v >> 2; + v |= v >> 4; + v |= v >> 8; + v |= v >> 16; + ++v; + return v; +} + +constexpr inline quint64 qConstexprNextPowerOfTwo(quint64 v) +{ + v |= v >> 1; + v |= v >> 2; + v |= v >> 4; + v |= v >> 8; + v |= v >> 16; + v |= v >> 32; + ++v; + return v; +} + +constexpr inline quint32 qConstexprNextPowerOfTwo(qint32 v) +{ + return qConstexprNextPowerOfTwo(quint32(v)); +} + +constexpr inline quint64 qConstexprNextPowerOfTwo(qint64 v) +{ + return qConstexprNextPowerOfTwo(quint64(v)); +} +} // namespace QtPrivate + +constexpr inline quint32 qNextPowerOfTwo(quint32 v) +{ + Q_ASSERT(static_cast(v) >= 0); // There is a next power of two +#if defined(__cpp_lib_int_pow2) && __cpp_lib_int_pow2 >= 202002L + return std::bit_ceil(v + 1); +#elif defined(QT_HAS_BUILTIN_CLZ) + if (v == 0) + return 1; + return 2U << (31 ^ QAlgorithmsPrivate::qt_builtin_clz(v)); +#else + return QtPrivate::qConstexprNextPowerOfTwo(v); +#endif +} + +constexpr inline quint64 qNextPowerOfTwo(quint64 v) +{ + Q_ASSERT(static_cast(v) >= 0); // There is a next power of two +#if defined(__cpp_lib_int_pow2) && __cpp_lib_int_pow2 >= 202002L + return std::bit_ceil(v + 1); +#elif defined(QT_HAS_BUILTIN_CLZLL) + if (v == 0) + return 1; + return Q_UINT64_C(2) << (63 ^ QAlgorithmsPrivate::qt_builtin_clzll(v)); +#else + return QtPrivate::qConstexprNextPowerOfTwo(v); +#endif +} + +constexpr inline quint32 qNextPowerOfTwo(qint32 v) +{ + return qNextPowerOfTwo(quint32(v)); +} + +constexpr inline quint64 qNextPowerOfTwo(qint64 v) +{ + return qNextPowerOfTwo(quint64(v)); +} + +constexpr inline unsigned long qNextPowerOfTwo(unsigned long v) +{ + return qNextPowerOfTwo(QIntegerForSizeof::Unsigned(v)); +} + +constexpr inline unsigned long qNextPowerOfTwo(long v) +{ + return qNextPowerOfTwo(QIntegerForSizeof::Unsigned(v)); +} + +QT_END_NAMESPACE + +#endif // QMATH_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qmessageauthenticationcode.h b/qt/6.8.1/msvc2022_64/include/QtCore/qmessageauthenticationcode.h new file mode 100644 index 0000000000000000000000000000000000000000..3661e83313b06d76349040d1da6c51eeb78c01a0 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qmessageauthenticationcode.h @@ -0,0 +1,89 @@ +// Copyright (C) 2013 Ruslan Nigmatullin +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QMESSAGEAUTHENTICATIONCODE_H +#define QMESSAGEAUTHENTICATIONCODE_H + +#include + +QT_BEGIN_NAMESPACE + + +class QMessageAuthenticationCodePrivate; +class QIODevice; + +// implemented in qcryptographichash.cpp +class Q_CORE_EXPORT QMessageAuthenticationCode +{ +public: +#if QT_CORE_REMOVED_SINCE(6, 6) + explicit QMessageAuthenticationCode(QCryptographicHash::Algorithm method, + const QByteArray &key); +#endif + explicit QMessageAuthenticationCode(QCryptographicHash::Algorithm method, + QByteArrayView key = {}); + + QMessageAuthenticationCode(QMessageAuthenticationCode &&other) noexcept + : d{std::exchange(other.d, nullptr)} {} + ~QMessageAuthenticationCode(); + + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QMessageAuthenticationCode) + void swap(QMessageAuthenticationCode &other) noexcept + { qt_ptr_swap(d, other.d); } + + void reset() noexcept; + +#if QT_CORE_REMOVED_SINCE(6, 6) + void setKey(const QByteArray &key); +#endif + void setKey(QByteArrayView key) noexcept; + + void addData(const char *data, qsizetype length); +#if QT_CORE_REMOVED_SINCE(6, 6) + void addData(const QByteArray &data); +#endif + void addData(QByteArrayView data) noexcept; + bool addData(QIODevice *device); + + QByteArrayView resultView() const noexcept; + QByteArray result() const; + +#if QT_CORE_REMOVED_SINCE(6, 6) + static QByteArray hash(const QByteArray &message, const QByteArray &key, + QCryptographicHash::Algorithm method); +#endif + static QByteArray hash(QByteArrayView message, QByteArrayView key, + QCryptographicHash::Algorithm method); + + static QByteArrayView + hashInto(QSpan buffer, QByteArrayView message, QByteArrayView key, + QCryptographicHash::Algorithm method) noexcept + { return hashInto(as_writable_bytes(buffer), {&message, 1}, key, method); } + static QByteArrayView + hashInto(QSpan buffer, QByteArrayView message, QByteArrayView key, + QCryptographicHash::Algorithm method) noexcept + { return hashInto(as_writable_bytes(buffer), {&message, 1}, key, method); } + static QByteArrayView + hashInto(QSpan buffer, QByteArrayView message, + QByteArrayView key, QCryptographicHash::Algorithm method) noexcept + { return hashInto(buffer, {&message, 1}, key, method); } + static QByteArrayView + hashInto(QSpan buffer, QSpan messageParts, + QByteArrayView key, QCryptographicHash::Algorithm method) noexcept + { return hashInto(as_writable_bytes(buffer), messageParts, key, method); } + static QByteArrayView + hashInto(QSpan buffer, QSpan messageParts, + QByteArrayView key, QCryptographicHash::Algorithm method) noexcept + { return hashInto(as_writable_bytes(buffer), messageParts, key, method); } + static QByteArrayView + hashInto(QSpan buffer, QSpan message, + QByteArrayView key, QCryptographicHash::Algorithm method) noexcept; + +private: + Q_DISABLE_COPY(QMessageAuthenticationCode) + QMessageAuthenticationCodePrivate *d; +}; + +QT_END_NAMESPACE + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qmetacontainer.h b/qt/6.8.1/msvc2022_64/include/QtCore/qmetacontainer.h new file mode 100644 index 0000000000000000000000000000000000000000..78467a1881dc986ea9d0d617137285808fb7fcb8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qmetacontainer.h @@ -0,0 +1,1197 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QMETACONTAINER_H +#define QMETACONTAINER_H + +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QMetaType; +namespace QtPrivate { +class QMetaTypeInterface; +template +constexpr const QMetaTypeInterface *qMetaTypeInterfaceForType(); +} + +namespace QtMetaContainerPrivate { + +enum IteratorCapability : quint8 { + InputCapability = 1 << 0, + ForwardCapability = 1 << 1, + BiDirectionalCapability = 1 << 2, + RandomAccessCapability = 1 << 3, +}; + +Q_DECLARE_FLAGS(IteratorCapabilities, IteratorCapability) +Q_DECLARE_OPERATORS_FOR_FLAGS(IteratorCapabilities) + +enum AddRemoveCapability : quint8 { + CanAddAtBegin = 1 << 0, + CanRemoveAtBegin = 1 << 1, + CanAddAtEnd = 1 << 2, + CanRemoveAtEnd = 1 << 3 +}; +Q_DECLARE_FLAGS(AddRemoveCapabilities, AddRemoveCapability) +Q_DECLARE_OPERATORS_FOR_FLAGS(AddRemoveCapabilities) + +class QMetaContainerInterface +{ +public: + enum Position : quint8 { AtBegin, AtEnd, Unspecified }; + ushort revision = 0; + IteratorCapabilities iteratorCapabilities; + + using SizeFn = qsizetype(*)(const void *); + SizeFn sizeFn; + using ClearFn = void(*)(void *); + ClearFn clearFn; + + using CreateIteratorFn = void *(*)(void *, Position); + CreateIteratorFn createIteratorFn; + using DestroyIteratorFn = void(*)(const void *); + DestroyIteratorFn destroyIteratorFn; + using CompareIteratorFn = bool(*)(const void *, const void *); + CompareIteratorFn compareIteratorFn; + using CopyIteratorFn = void(*)(void *, const void *); + CopyIteratorFn copyIteratorFn; + using AdvanceIteratorFn = void(*)(void *, qsizetype); + AdvanceIteratorFn advanceIteratorFn; + using DiffIteratorFn = qsizetype(*)(const void *, const void *); + DiffIteratorFn diffIteratorFn; + + using CreateConstIteratorFn = void *(*)(const void *, Position); + CreateConstIteratorFn createConstIteratorFn; + DestroyIteratorFn destroyConstIteratorFn; + CompareIteratorFn compareConstIteratorFn; + CopyIteratorFn copyConstIteratorFn; + AdvanceIteratorFn advanceConstIteratorFn; + DiffIteratorFn diffConstIteratorFn; + + QMetaContainerInterface() = default; + + template + constexpr QMetaContainerInterface(const MetaContainer &) + : iteratorCapabilities(MetaContainer::getIteratorCapabilities()) + , sizeFn(MetaContainer::getSizeFn()) + , clearFn(MetaContainer::getClearFn()) + , createIteratorFn(MetaContainer::getCreateIteratorFn()) + , destroyIteratorFn(MetaContainer::getDestroyIteratorFn()) + , compareIteratorFn(MetaContainer::getCompareIteratorFn()) + , copyIteratorFn(MetaContainer::getCopyIteratorFn()) + , advanceIteratorFn(MetaContainer::getAdvanceIteratorFn()) + , diffIteratorFn(MetaContainer::getDiffIteratorFn()) + , createConstIteratorFn(MetaContainer::getCreateConstIteratorFn()) + , destroyConstIteratorFn(MetaContainer::getDestroyConstIteratorFn()) + , compareConstIteratorFn(MetaContainer::getCompareConstIteratorFn()) + , copyConstIteratorFn(MetaContainer::getCopyConstIteratorFn()) + , advanceConstIteratorFn(MetaContainer::getAdvanceConstIteratorFn()) + , diffConstIteratorFn(MetaContainer::getDiffConstIteratorFn()) + {} +}; + +class QMetaSequenceInterface : public QMetaContainerInterface +{ +public: + const QtPrivate::QMetaTypeInterface *valueMetaType; + AddRemoveCapabilities addRemoveCapabilities; + + using ValueAtIndexFn = void(*)(const void *, qsizetype, void *); + ValueAtIndexFn valueAtIndexFn; + using SetValueAtIndexFn = void(*)(void *, qsizetype, const void *); + SetValueAtIndexFn setValueAtIndexFn; + + using AddValueFn = void(*)(void *, const void *, Position); + AddValueFn addValueFn; + using RemoveValueFn = void(*)(void *, Position); + RemoveValueFn removeValueFn; + + using ValueAtIteratorFn = void(*)(const void *, void *); + ValueAtIteratorFn valueAtIteratorFn; + using SetValueAtIteratorFn = void(*)(const void *, const void *); + SetValueAtIteratorFn setValueAtIteratorFn; + using InsertValueAtIteratorFn = void(*)(void *, const void *, const void *); + InsertValueAtIteratorFn insertValueAtIteratorFn; + + ValueAtIteratorFn valueAtConstIteratorFn; + + using EraseValueAtIteratorFn = void(*)(void *, const void *); + EraseValueAtIteratorFn eraseValueAtIteratorFn; + + using EraseRangeAtIteratorFn = void(*)(void *, const void *, const void *); + EraseRangeAtIteratorFn eraseRangeAtIteratorFn; + + QMetaSequenceInterface() = default; + + template + constexpr QMetaSequenceInterface(const MetaSequence &m) + : QMetaContainerInterface(m) + , valueMetaType(MetaSequence::getValueMetaType()) + , addRemoveCapabilities(MetaSequence::getAddRemoveCapabilities()) + , valueAtIndexFn(MetaSequence::getValueAtIndexFn()) + , setValueAtIndexFn(MetaSequence::getSetValueAtIndexFn()) + , addValueFn(MetaSequence::getAddValueFn()) + , removeValueFn(MetaSequence::getRemoveValueFn()) + , valueAtIteratorFn(MetaSequence::getValueAtIteratorFn()) + , setValueAtIteratorFn(MetaSequence::getSetValueAtIteratorFn()) + , insertValueAtIteratorFn(MetaSequence::getInsertValueAtIteratorFn()) + , valueAtConstIteratorFn(MetaSequence::getValueAtConstIteratorFn()) + , eraseValueAtIteratorFn(MetaSequence::getEraseValueAtIteratorFn()) + , eraseRangeAtIteratorFn(MetaSequence::getEraseRangeAtIteratorFn()) + {} +}; + +class QMetaAssociationInterface : public QMetaContainerInterface +{ +public: + const QtPrivate::QMetaTypeInterface *keyMetaType; + const QtPrivate::QMetaTypeInterface *mappedMetaType; + + using InsertKeyFn = void(*)(void *, const void *); + InsertKeyFn insertKeyFn; + using RemoveKeyFn = void(*)(void *, const void *); + RemoveKeyFn removeKeyFn; + using ContainsKeyFn = bool(*)(const void *, const void *); + ContainsKeyFn containsKeyFn; + + using MappedAtKeyFn = void(*)(const void *, const void *, void *); + MappedAtKeyFn mappedAtKeyFn; + using SetMappedAtKeyFn = void(*)(void *, const void *, const void *); + SetMappedAtKeyFn setMappedAtKeyFn; + + using CreateIteratorAtKeyFn = void *(*)(void *, const void *); + CreateIteratorAtKeyFn createIteratorAtKeyFn; + using CreateConstIteratorAtKeyFn = void *(*)(const void *, const void *); + CreateConstIteratorAtKeyFn createConstIteratorAtKeyFn; + + using KeyAtIteratorFn = void(*)(const void *, void *); + KeyAtIteratorFn keyAtIteratorFn; + KeyAtIteratorFn keyAtConstIteratorFn; + + using MappedAtIteratorFn = void(*)(const void *, void *); + MappedAtIteratorFn mappedAtIteratorFn; + MappedAtIteratorFn mappedAtConstIteratorFn; + + using SetMappedAtIteratorFn = void(*)(const void *, const void *); + SetMappedAtIteratorFn setMappedAtIteratorFn; + + using EraseKeyAtIteratorFn = void(*)(void *, const void *); + EraseKeyAtIteratorFn eraseKeyAtIteratorFn; + + QMetaAssociationInterface() = default; + + template + constexpr QMetaAssociationInterface(const MetaAssociation &m) + : QMetaContainerInterface(m) + , keyMetaType(MetaAssociation::getKeyMetaType()) + , mappedMetaType(MetaAssociation::getMappedMetaType()) + , insertKeyFn(MetaAssociation::getInsertKeyFn()) + , removeKeyFn(MetaAssociation::getRemoveKeyFn()) + , containsKeyFn(MetaAssociation::getContainsKeyFn()) + , mappedAtKeyFn(MetaAssociation::getMappedAtKeyFn()) + , setMappedAtKeyFn(MetaAssociation::getSetMappedAtKeyFn()) + , createIteratorAtKeyFn(MetaAssociation::createIteratorAtKeyFn()) + , createConstIteratorAtKeyFn(MetaAssociation::createConstIteratorAtKeyFn()) + , keyAtIteratorFn(MetaAssociation::getKeyAtIteratorFn()) + , keyAtConstIteratorFn(MetaAssociation::getKeyAtConstIteratorFn()) + , mappedAtIteratorFn(MetaAssociation::getMappedAtIteratorFn()) + , mappedAtConstIteratorFn(MetaAssociation::getMappedAtConstIteratorFn()) + , setMappedAtIteratorFn(MetaAssociation::getSetMappedAtIteratorFn()) + , eraseKeyAtIteratorFn(MetaAssociation::getEraseKeyAtIteratorFn()) + {} +}; + +template +class QMetaContainerForContainer +{ + friend QMetaContainerInterface; + + template + static constexpr IteratorCapabilities capabilitiesForIterator() + { + using Tag = typename std::iterator_traits::iterator_category; + IteratorCapabilities caps {}; + if constexpr (std::is_base_of_v) + caps |= InputCapability; + if constexpr (std::is_base_of_v) + caps |= ForwardCapability; + if constexpr (std::is_base_of_v) + caps |= BiDirectionalCapability; + if constexpr (std::is_base_of_v) + caps |= RandomAccessCapability; + return caps; + } + + static constexpr IteratorCapabilities getIteratorCapabilities() + { + if constexpr (QContainerInfo::has_iterator_v && !std::is_const_v) + return capabilitiesForIterator>(); + else if constexpr (QContainerInfo::has_const_iterator_v) + return capabilitiesForIterator>(); + else + return {}; + } + + static constexpr QMetaContainerInterface::SizeFn getSizeFn() + { + if constexpr (QContainerInfo::has_size_v) { + return [](const void *c) -> qsizetype { return static_cast(c)->size(); }; + } else { + return nullptr; + } + } + + static constexpr QMetaContainerInterface::ClearFn getClearFn() + { + if constexpr (QContainerInfo::has_clear_v) { + return [](void *c) { return static_cast(c)->clear(); }; + } else { + return nullptr; + } + } + + static constexpr QMetaContainerInterface::CreateIteratorFn getCreateIteratorFn() + { + if constexpr (QContainerInfo::has_iterator_v && !std::is_const_v) { + return [](void *c, QMetaContainerInterface::Position p) -> void* { + using Iterator = QContainerInfo::iterator; + switch (p) { + case QMetaContainerInterface::Unspecified: + return new Iterator; + case QMetaContainerInterface::AtBegin: + return new Iterator(static_cast(c)->begin()); + case QMetaContainerInterface::AtEnd: + return new Iterator(static_cast(c)->end()); + } + return nullptr; + }; + } else { + return nullptr; + } + } + + static constexpr QMetaContainerInterface::DestroyIteratorFn getDestroyIteratorFn() + { + if constexpr (QContainerInfo::has_iterator_v && !std::is_const_v) { + return [](const void *i) { + using Iterator = QContainerInfo::iterator; + delete static_cast(i); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaContainerInterface::CompareIteratorFn getCompareIteratorFn() + { + if constexpr (QContainerInfo::has_iterator_v && !std::is_const_v) { + return [](const void *i, const void *j) { + using Iterator = QContainerInfo::iterator; + return *static_cast(i) == *static_cast(j); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaContainerInterface::CopyIteratorFn getCopyIteratorFn() + { + if constexpr (QContainerInfo::has_iterator_v && !std::is_const_v) { + return [](void *i, const void *j) { + using Iterator = QContainerInfo::iterator; + *static_cast(i) = *static_cast(j); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaContainerInterface::AdvanceIteratorFn getAdvanceIteratorFn() + { + if constexpr (QContainerInfo::has_iterator_v && !std::is_const_v) { + return [](void *i, qsizetype step) { + std::advance(*static_cast *>(i), step); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaContainerInterface::DiffIteratorFn getDiffIteratorFn() + { + if constexpr (QContainerInfo::has_iterator_v && !std::is_const_v) { + return [](const void *i, const void *j) -> qsizetype { + return std::distance(*static_cast *>(j), + *static_cast *>(i)); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaContainerInterface::CreateConstIteratorFn getCreateConstIteratorFn() + { + if constexpr (QContainerInfo::has_const_iterator_v) { + return [](const void *c, QMetaContainerInterface::Position p) -> void* { + using Iterator = QContainerInfo::const_iterator; + switch (p) { + case QMetaContainerInterface::Unspecified: + return new Iterator; + case QMetaContainerInterface::AtBegin: + return new Iterator(static_cast(c)->begin()); + case QMetaContainerInterface::AtEnd: + return new Iterator(static_cast(c)->end()); + } + return nullptr; + }; + } else { + return nullptr; + } + } + + static constexpr QMetaContainerInterface::DestroyIteratorFn getDestroyConstIteratorFn() + { + if constexpr (QContainerInfo::has_const_iterator_v) { + return [](const void *i) { + using Iterator = QContainerInfo::const_iterator; + delete static_cast(i); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaContainerInterface::CompareIteratorFn getCompareConstIteratorFn() + { + if constexpr (QContainerInfo::has_const_iterator_v) { + return [](const void *i, const void *j) { + using Iterator = QContainerInfo::const_iterator; + return *static_cast(i) == *static_cast(j); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaContainerInterface::CopyIteratorFn getCopyConstIteratorFn() + { + if constexpr (QContainerInfo::has_const_iterator_v) { + return [](void *i, const void *j) { + using Iterator = QContainerInfo::const_iterator; + *static_cast(i) = *static_cast(j); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaContainerInterface::AdvanceIteratorFn getAdvanceConstIteratorFn() + { + if constexpr (QContainerInfo::has_const_iterator_v) { + return [](void *i, qsizetype step) { + std::advance(*static_cast *>(i), step); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaContainerInterface::DiffIteratorFn getDiffConstIteratorFn() + { + if constexpr (QContainerInfo::has_const_iterator_v) { + return [](const void *i, const void *j) -> qsizetype { + return std::distance(*static_cast *>(j), + *static_cast *>(i)); + }; + } else { + return nullptr; + } + } + +protected: + + template + static constexpr EraseFn getEraseAtIteratorFn() + { + if constexpr (QContainerInfo::has_iterator_v + && QContainerInfo::can_erase_at_iterator_v && !std::is_const_v) { + return [](void *c, const void *i) { + static_cast(c)->erase(*static_cast *>(i)); + }; + } else { + return nullptr; + } + } +}; + +template +class QMetaSequenceForContainer : public QMetaContainerForContainer +{ + friend QMetaSequenceInterface; + + static constexpr const QtPrivate::QMetaTypeInterface *getValueMetaType() + { + if constexpr (QContainerInfo::has_value_type_v) + return QtPrivate::qMetaTypeInterfaceForType(); + else + return nullptr; + } + + static constexpr AddRemoveCapabilities getAddRemoveCapabilities() + { + AddRemoveCapabilities caps; + if constexpr (QContainerInfo::has_push_back_v) + caps |= CanAddAtEnd; + if constexpr (QContainerInfo::has_pop_back_v) + caps |= CanRemoveAtEnd; + if constexpr (QContainerInfo::has_push_front_v) + caps |= CanAddAtBegin; + if constexpr (QContainerInfo::has_pop_front_v) + caps |= CanRemoveAtBegin; + return caps; + } + + static constexpr QMetaSequenceInterface::ValueAtIndexFn getValueAtIndexFn() + { + if constexpr (QContainerInfo::has_at_index_v) { + return [](const void *c, qsizetype i, void *r) { + *static_cast *>(r) + = static_cast(c)->at(i); + }; + } else if constexpr (QContainerInfo::can_get_at_index_v) { + return [](const void *c, qsizetype i, void *r) { + *static_cast *>(r) + = (*static_cast(c))[i]; + }; + } else { + return nullptr; + } + } + + static constexpr QMetaSequenceInterface::SetValueAtIndexFn getSetValueAtIndexFn() + { + if constexpr (QContainerInfo::can_set_at_index_v) { + return [](void *c, qsizetype i, const void *e) { + (*static_cast(c))[i] + = *static_cast *>(e); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaSequenceInterface::AddValueFn getAddValueFn() + { + if constexpr (QContainerInfo::has_push_back_v) { + if constexpr (QContainerInfo::has_push_front_v) { + return [](void *c, const void *v, QMetaSequenceInterface::Position position) { + const auto &value = *static_cast *>(v); + switch (position) { + case QMetaSequenceInterface::AtBegin: + static_cast(c)->push_front(value); + break; + case QMetaSequenceInterface::AtEnd: + case QMetaSequenceInterface::Unspecified: + static_cast(c)->push_back(value); + break; + } + }; + } else { + return [](void *c, const void *v, QMetaSequenceInterface::Position position) { + const auto &value = *static_cast *>(v); + switch (position) { + case QMetaSequenceInterface::AtBegin: + break; + case QMetaSequenceInterface::AtEnd: + case QMetaSequenceInterface::Unspecified: + static_cast(c)->push_back(value); + break; + } + }; + } + } else if constexpr (QContainerInfo::has_push_front_v) { + return [](void *c, const void *v, QMetaSequenceInterface::Position position) { + const auto &value = *static_cast *>(v); + switch (position) { + case QMetaSequenceInterface::Unspecified: + case QMetaSequenceInterface::AtBegin: + static_cast(c)->push_front(value); + case QMetaSequenceInterface::AtEnd: + break; + } + }; + } else if constexpr (QContainerInfo::has_insert_v) { + return [](void *c, const void *v, QMetaSequenceInterface::Position position) { + if (position == QMetaSequenceInterface::Unspecified) { + static_cast(c)->insert( + *static_cast *>(v)); + } + }; + } else { + return nullptr; + } + } + + static constexpr QMetaSequenceInterface::RemoveValueFn getRemoveValueFn() + { + if constexpr (QContainerInfo::has_pop_back_v) { + if constexpr (QContainerInfo::has_pop_front_v) { + return [](void *c, QMetaSequenceInterface::Position position) { + switch (position) { + case QMetaSequenceInterface::AtBegin: + static_cast(c)->pop_front(); + break; + case QMetaSequenceInterface::AtEnd: + case QMetaSequenceInterface::Unspecified: + static_cast(c)->pop_back(); + break; + } + }; + } else { + return [](void *c, QMetaSequenceInterface::Position position) { + switch (position) { + case QMetaSequenceInterface::AtBegin: + break; + case QMetaSequenceInterface::Unspecified: + case QMetaSequenceInterface::AtEnd: + static_cast(c)->pop_back(); + break; + } + }; + } + } else if constexpr (QContainerInfo::has_pop_front_v) { + return [](void *c, QMetaSequenceInterface::Position position) { + switch (position) { + case QMetaSequenceInterface::Unspecified: + case QMetaSequenceInterface::AtBegin: + static_cast(c)->pop_front(); + break; + case QMetaSequenceInterface::AtEnd: + break; + } + }; + } else { + return nullptr; + } + } + + static constexpr QMetaSequenceInterface::ValueAtIteratorFn getValueAtIteratorFn() + { + if constexpr (QContainerInfo::has_iterator_v + && QContainerInfo::iterator_dereferences_to_value_v && !std::is_const_v) { + return [](const void *i, void *r) { + *static_cast *>(r) = + *(*static_cast *>(i)); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaSequenceInterface::SetValueAtIteratorFn getSetValueAtIteratorFn() + { + if constexpr (QContainerInfo::has_iterator_v + && QContainerInfo::can_set_value_at_iterator_v && !std::is_const_v) { + return [](const void *i, const void *e) { + *(*static_cast *>(i)) + = *static_cast *>(e); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaSequenceInterface::InsertValueAtIteratorFn getInsertValueAtIteratorFn() + { + if constexpr (QContainerInfo::has_iterator_v + && QContainerInfo::can_insert_value_at_iterator_v && !std::is_const_v) { + return [](void *c, const void *i, const void *e) { + static_cast(c)->insert( + *static_cast *>(i), + *static_cast *>(e)); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaSequenceInterface::ValueAtIteratorFn getValueAtConstIteratorFn() + { + if constexpr (QContainerInfo::has_const_iterator_v + && QContainerInfo::iterator_dereferences_to_value_v) { + return [](const void *i, void *r) { + *static_cast *>(r) = + *(*static_cast *>(i)); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaSequenceInterface::EraseValueAtIteratorFn getEraseValueAtIteratorFn() + { + return QMetaContainerForContainer::template getEraseAtIteratorFn< + QMetaSequenceInterface::EraseValueAtIteratorFn>(); + } + + static constexpr QMetaSequenceInterface::EraseRangeAtIteratorFn getEraseRangeAtIteratorFn() + { + if constexpr (QContainerInfo::has_iterator_v + && QContainerInfo::can_erase_range_at_iterator_v && !std::is_const_v) { + return [](void *c, const void *i, const void *j) { + static_cast(c)->erase(*static_cast *>(i), + *static_cast *>(j)); + }; + } else { + return nullptr; + } + } +}; + +template +class QMetaAssociationForContainer : public QMetaContainerForContainer +{ + friend QMetaAssociationInterface; + + static constexpr const QtPrivate::QMetaTypeInterface *getKeyMetaType() + { + if constexpr (QContainerInfo::has_key_type_v) + return QtPrivate::qMetaTypeInterfaceForType(); + else + return nullptr; + } + + static constexpr const QtPrivate::QMetaTypeInterface *getMappedMetaType() + { + if constexpr (QContainerInfo::has_mapped_type_v) + return QtPrivate::qMetaTypeInterfaceForType(); + else + return nullptr; + } + + static constexpr QMetaAssociationInterface::InsertKeyFn getInsertKeyFn() + { + if constexpr (QContainerInfo::can_insert_key_v) { + return [](void *c, const void *k) { + static_cast(c)->insert( + *static_cast *>(k)); + }; + } else if constexpr (QContainerInfo::can_insert_pair_v) { + return [](void *c, const void *k) { + static_cast(c)->insert( + {*static_cast *>(k), {}}); + }; + } else if constexpr (QContainerInfo::can_insert_key_mapped_v) { + return [](void *c, const void *k) { + static_cast(c)->insert( + *static_cast *>(k), {}); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaAssociationInterface::RemoveKeyFn getRemoveKeyFn() + { + if constexpr (QContainerInfo::can_erase_at_key_v) { + return [](void *c, const void *k) { + static_cast(c)->erase(*static_cast *>(k)); + }; + } else if constexpr (QContainerInfo::can_remove_at_key_v) { + return [](void *c, const void *k) { + static_cast(c)->remove(*static_cast *>(k)); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaAssociationInterface::ContainsKeyFn getContainsKeyFn() + { + if constexpr (QContainerInfo::has_contains_v) { + return [](const void *c, const void *k) { + return static_cast(c)->contains( + *static_cast *>(k)); + }; + } else if (QContainerInfo::has_find_v) { + return [](const void *c, const void *k) { + const C *container = static_cast(c); + return container->find( + *static_cast *>(k)) + != container->end(); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaAssociationInterface::MappedAtKeyFn getMappedAtKeyFn() + { + if constexpr (QContainerInfo::has_at_key_v) { + return [](const void *c, const void *k, void *r) { + *static_cast *>(r) + = static_cast(c)->at( + *static_cast *>(k)); + }; + } else if constexpr (QContainerInfo::can_get_at_key_v) { + return [](const void *c, const void *k, void *r) { + *static_cast *>(r) + = (*static_cast(c))[ + *static_cast *>(k)]; + }; + } else { + return nullptr; + } + } + + static constexpr QMetaAssociationInterface::SetMappedAtKeyFn getSetMappedAtKeyFn() + { + if constexpr (QContainerInfo::can_set_at_key_v) { + return [](void *c, const void *k, const void *m) { + (*static_cast(c))[*static_cast *>(k)] = + *static_cast *>(m); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaAssociationInterface::CreateIteratorAtKeyFn createIteratorAtKeyFn() + { + if constexpr (QContainerInfo::has_find_v) { + return [](void *c, const void *k) -> void* { + using Iterator = QContainerInfo::iterator; + return new Iterator(static_cast(c)->find( + *static_cast *>(k))); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaAssociationInterface::CreateConstIteratorAtKeyFn createConstIteratorAtKeyFn() + { + if constexpr (QContainerInfo::has_find_v) { + return [](const void *c, const void *k) -> void* { + using Iterator = QContainerInfo::const_iterator; + return new Iterator(static_cast(c)->find( + *static_cast *>(k))); + }; + } else { + return nullptr; + } + } + + template + static constexpr QMetaAssociationInterface::KeyAtIteratorFn keyAtIteratorFn() + { + if constexpr (QContainerInfo::iterator_has_key_v) { + return [](const void *i, void *k) { + *static_cast *>(k) + = static_cast(i)->key(); + }; + } else if constexpr (QContainerInfo::iterator_dereferences_to_value_v + && QContainerInfo::value_type_has_first_v) { + return [](const void *i, void *k) { + *static_cast *>(k) + = (*static_cast(i))->first; + }; + } else if constexpr (QContainerInfo::iterator_dereferences_to_key_v) { + return [](const void *i, void *k) { + *static_cast *>(k) + = *(*static_cast(i)); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaAssociationInterface::KeyAtIteratorFn getKeyAtIteratorFn() + { + return keyAtIteratorFn>(); + } + + static constexpr QMetaAssociationInterface::KeyAtIteratorFn getKeyAtConstIteratorFn() + { + return keyAtIteratorFn>(); + } + + template + static constexpr QMetaAssociationInterface::MappedAtIteratorFn mappedAtIteratorFn() + { + if constexpr (QContainerInfo::iterator_has_value_v) { + return [](const void *i, void *k) { + *static_cast *>(k) + = static_cast(i)->value(); + }; + } else if constexpr (QContainerInfo::iterator_dereferences_to_value_v + && QContainerInfo::value_type_has_second_v) { + return [](const void *i, void *k) { + *static_cast *>(k) + = (*static_cast(i))->second; + }; + } else if constexpr (QContainerInfo::iterator_dereferences_to_mapped_v) { + return [](const void *i, void *k) { + *static_cast *>(k) + = *static_cast(i); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaAssociationInterface::MappedAtIteratorFn getMappedAtIteratorFn() + { + return mappedAtIteratorFn>(); + } + + static constexpr QMetaAssociationInterface::MappedAtIteratorFn getMappedAtConstIteratorFn() + { + return mappedAtIteratorFn>(); + } + + static constexpr QMetaAssociationInterface::SetMappedAtIteratorFn getSetMappedAtIteratorFn() + { + if constexpr (QContainerInfo::can_set_mapped_at_iterator_v && !std::is_const_v) { + return [](const void *i, const void *m) { + *(*static_cast *>(i)) + = *static_cast *>(m); + }; + } else if constexpr (QContainerInfo::iterator_dereferences_to_value_v + && QContainerInfo::value_type_has_second_v) { + return [](const void *i, const void *m) { + (*static_cast *>(i))->second + = *static_cast *>(m); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaAssociationInterface::EraseKeyAtIteratorFn getEraseKeyAtIteratorFn() + { + return QMetaContainerForContainer::template getEraseAtIteratorFn< + QMetaAssociationInterface::EraseKeyAtIteratorFn>(); + } +}; + +} // namespace QtMetaContainerPrivate + +class Q_CORE_EXPORT QMetaContainer +{ +public: + QMetaContainer() = default; + explicit QMetaContainer(const QtMetaContainerPrivate::QMetaContainerInterface *d) : d_ptr(d) {} + + bool hasInputIterator() const; + bool hasForwardIterator() const; + bool hasBidirectionalIterator() const; + bool hasRandomAccessIterator() const; + + bool hasSize() const; + qsizetype size(const void *container) const; + + bool canClear() const; + void clear(void *container) const; + + bool hasIterator() const; + void *begin(void *container) const; + void *end(void *container) const; + void destroyIterator(const void *iterator) const; + bool compareIterator(const void *i, const void *j) const; + void copyIterator(void *target, const void *source) const; + void advanceIterator(void *iterator, qsizetype step) const; + qsizetype diffIterator(const void *i, const void *j) const; + + bool hasConstIterator() const; + void *constBegin(const void *container) const; + void *constEnd(const void *container) const; + void destroyConstIterator(const void *iterator) const; + bool compareConstIterator(const void *i, const void *j) const; + void copyConstIterator(void *target, const void *source) const; + void advanceConstIterator(void *iterator, qsizetype step) const; + qsizetype diffConstIterator(const void *i, const void *j) const; + +protected: + const QtMetaContainerPrivate::QMetaContainerInterface *d_ptr = nullptr; +}; + +class Q_CORE_EXPORT QMetaSequence : public QMetaContainer +{ +public: + QMetaSequence() = default; + explicit QMetaSequence(const QtMetaContainerPrivate::QMetaSequenceInterface *d) : QMetaContainer(d) {} + + template + static constexpr QMetaSequence fromContainer() + { + return QMetaSequence(&MetaSequence::value); + } + + QMetaType valueMetaType() const; + + bool isSortable() const; + bool canAddValueAtBegin() const; + void addValueAtBegin(void *container, const void *value) const; + bool canAddValueAtEnd() const; + void addValueAtEnd(void *container, const void *value) const; + bool canRemoveValueAtBegin() const; + void removeValueAtBegin(void *container) const; + bool canRemoveValueAtEnd() const; + void removeValueAtEnd(void *container) const; + + bool canGetValueAtIndex() const; + void valueAtIndex(const void *container, qsizetype index, void *result) const; + + bool canSetValueAtIndex() const; + void setValueAtIndex(void *container, qsizetype index, const void *value) const; + + bool canAddValue() const; + void addValue(void *container, const void *value) const; + + bool canRemoveValue() const; + void removeValue(void *container) const; + + bool canGetValueAtIterator() const; + void valueAtIterator(const void *iterator, void *result) const; + + bool canSetValueAtIterator() const; + void setValueAtIterator(const void *iterator, const void *value) const; + + bool canInsertValueAtIterator() const; + void insertValueAtIterator(void *container, const void *iterator, const void *value) const; + + bool canEraseValueAtIterator() const; + void eraseValueAtIterator(void *container, const void *iterator) const; + + bool canEraseRangeAtIterator() const; + void eraseRangeAtIterator(void *container, const void *iterator1, const void *iterator2) const; + + bool canGetValueAtConstIterator() const; + void valueAtConstIterator(const void *iterator, void *result) const; + + const QtMetaContainerPrivate::QMetaSequenceInterface *iface() const { return d(); } + +private: + friend bool comparesEqual(const QMetaSequence &lhs, const QMetaSequence &rhs) noexcept + { + return lhs.d() == rhs.d(); + } + Q_DECLARE_EQUALITY_COMPARABLE(QMetaSequence) + + template + struct MetaSequence + { + static constexpr const QtMetaContainerPrivate::QMetaSequenceInterface value + = QtMetaContainerPrivate::QMetaSequenceInterface( + QtMetaContainerPrivate::QMetaSequenceForContainer()); + }; + + const QtMetaContainerPrivate::QMetaSequenceInterface *d() const + { + return static_cast(d_ptr); + } +}; + +class Q_CORE_EXPORT QMetaAssociation : public QMetaContainer +{ +public: + QMetaAssociation() = default; + explicit QMetaAssociation(const QtMetaContainerPrivate::QMetaAssociationInterface *d) : QMetaContainer(d) {} + + template + static constexpr QMetaAssociation fromContainer() + { + return QMetaAssociation(&MetaAssociation::value); + } + + QMetaType keyMetaType() const; + QMetaType mappedMetaType() const; + + bool canInsertKey() const + { + if (auto iface = d()) + return iface->insertKeyFn; + return false; + } + void insertKey(void *container, const void *key) const + { + if (canInsertKey()) + d()->insertKeyFn(container, key); + } + + bool canRemoveKey() const + { + if (auto iface = d()) + return iface->removeKeyFn; + return false; + } + void removeKey(void *container, const void *key) const + { + if (canRemoveKey()) + d()->removeKeyFn(container, key); + } + + bool canContainsKey() const + { + if (auto iface = d()) + return iface->containsKeyFn; + return false; + } + bool containsKey(const void *container, const void *key) const + { + if (canContainsKey()) + return d()->containsKeyFn(container, key); + return false; + } + + + bool canGetMappedAtKey() const + { + if (auto iface = d()) + return iface->mappedAtKeyFn; + return false; + } + void mappedAtKey(const void *container, const void *key, void *mapped) const + { + if (canGetMappedAtKey()) + d()->mappedAtKeyFn(container, key, mapped); + } + + bool canSetMappedAtKey() const + { + if (auto iface = d()) + return iface->setMappedAtKeyFn; + return false; + } + void setMappedAtKey(void *container, const void *key, const void *mapped) const + { + if (canSetMappedAtKey()) + d()->setMappedAtKeyFn(container, key, mapped); + } + + bool canGetKeyAtIterator() const + { + if (auto iface = d()) + return iface->keyAtIteratorFn; + return false; + } + + void keyAtIterator(const void *iterator, void *key) const + { + if (canGetKeyAtIterator()) + d()->keyAtIteratorFn(iterator, key); + } + + bool canGetKeyAtConstIterator() const + { + if (auto iface = d()) + return iface->keyAtConstIteratorFn; + return false; + } + + void keyAtConstIterator(const void *iterator, void *key) const + { + if (canGetKeyAtConstIterator()) + d()->keyAtConstIteratorFn(iterator, key); + } + + bool canGetMappedAtIterator() const + { + if (auto iface = d()) + return iface->mappedAtIteratorFn; + return false; + } + + void mappedAtIterator(const void *iterator, void *mapped) const + { + if (canGetMappedAtIterator()) + d()->mappedAtIteratorFn(iterator, mapped); + } + + bool canGetMappedAtConstIterator() const + { + if (auto iface = d()) + return iface->mappedAtConstIteratorFn; + return false; + } + + void mappedAtConstIterator(const void *iterator, void *mapped) const + { + if (canGetMappedAtConstIterator()) + d()->mappedAtConstIteratorFn(iterator, mapped); + } + + bool canSetMappedAtIterator() const + { + if (auto iface = d()) + return iface->setMappedAtIteratorFn; + return false; + } + + void setMappedAtIterator(const void *iterator, const void *mapped) const + { + if (canSetMappedAtIterator()) + d()->setMappedAtIteratorFn(iterator, mapped); + } + + bool canCreateIteratorAtKey() const + { + if (auto iface = d()) + return iface->createIteratorAtKeyFn; + return false; + } + + void *createIteratorAtKey(void *container, const void *key) const + { + if (canCreateIteratorAtKey()) + return d()->createIteratorAtKeyFn(container, key); + return nullptr; + } + + bool canCreateConstIteratorAtKey() const + { + if (auto iface = d()) + return iface->createConstIteratorAtKeyFn; + return false; + } + + void *createConstIteratorAtKey(const void *container, const void *key) const + { + if (canCreateConstIteratorAtKey()) + return d()->createConstIteratorAtKeyFn(container, key); + return nullptr; + } + + const QtMetaContainerPrivate::QMetaAssociationInterface *iface() const { return d(); } + +private: + friend bool comparesEqual(const QMetaAssociation &lhs, const QMetaAssociation &rhs) noexcept + { + return lhs.d() == rhs.d(); + } + Q_DECLARE_EQUALITY_COMPARABLE(QMetaAssociation) + + template + struct MetaAssociation + { + static constexpr const QtMetaContainerPrivate::QMetaAssociationInterface value + = QtMetaContainerPrivate::QMetaAssociationInterface( + QtMetaContainerPrivate::QMetaAssociationForContainer()); + }; + + const QtMetaContainerPrivate::QMetaAssociationInterface *d() const + { + return static_cast(d_ptr); + } +}; + +QT_END_NAMESPACE + +#endif // QMETACONTAINER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qmetaobject.h b/qt/6.8.1/msvc2022_64/include/QtCore/qmetaobject.h new file mode 100644 index 0000000000000000000000000000000000000000..505d53ada557d2e575272e220884a759eca12e29 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qmetaobject.h @@ -0,0 +1,439 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2014 Olivier Goffart +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QMETAOBJECT_H +#define QMETAOBJECT_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QUntypedBindable; + +#define Q_METAMETHOD_INVOKE_MAX_ARGS 10 + +class Q_CORE_EXPORT QMetaMethod +{ +public: + constexpr inline QMetaMethod() : mobj(nullptr), data({ nullptr }) {} + + QByteArray methodSignature() const; + QByteArray name() const; + const char *typeName() const; + int returnType() const; + QMetaType returnMetaType() const; + int parameterCount() const; + int parameterType(int index) const; + QMetaType parameterMetaType(int index) const; + void getParameterTypes(int *types) const; + QList parameterTypes() const; + QByteArray parameterTypeName(int index) const; + QList parameterNames() const; + const char *tag() const; + enum Access { Private, Protected, Public }; + Access access() const; + enum MethodType { Method, Signal, Slot, Constructor }; + MethodType methodType() const; + enum Attributes { Compatibility = 0x1, Cloned = 0x2, Scriptable = 0x4 }; + int attributes() const; + int methodIndex() const; + int relativeMethodIndex() const; + int revision() const; + bool isConst() const; + + inline const QMetaObject *enclosingMetaObject() const { return mobj; } + +#if QT_VERSION <= QT_VERSION_CHECK(7, 0, 0) + bool invoke(QObject *object, + Qt::ConnectionType connectionType, + QGenericReturnArgument returnValue, + QGenericArgument val0 = QGenericArgument(nullptr), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) const; + inline bool invoke(QObject *object, + QGenericReturnArgument returnValue, + QGenericArgument val0 = QGenericArgument(nullptr), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) const + { + return invoke(object, Qt::AutoConnection, returnValue, + val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); + } + inline bool invoke(QObject *object, + Qt::ConnectionType connectionType, + QGenericArgument val0, + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) const + { + return invoke(object, connectionType, QGenericReturnArgument(), + val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); + } + inline bool invoke(QObject *object, + QGenericArgument val0, + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) const + { + return invoke(object, Qt::AutoConnection, QGenericReturnArgument(), + val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); + } + bool invokeOnGadget(void *gadget, + QGenericReturnArgument returnValue, + QGenericArgument val0 = QGenericArgument(nullptr), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) const; + inline bool invokeOnGadget(void *gadget, + QGenericArgument val0, + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) const + { + return invokeOnGadget(gadget, QGenericReturnArgument(), + val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); + } +#endif + + template +#ifdef Q_QDOC + bool +#else + QtPrivate::Invoke::IfNotOldStyleArgs +#endif + invoke(QObject *obj, Qt::ConnectionType c, QTemplatedMetaMethodReturnArgument r, + Args &&... arguments) const + { + auto h = QtPrivate::invokeMethodHelper(r, std::forward(arguments)...); + return invokeImpl(*this, obj, c, h.parameterCount(), h.parameters.data(), + h.typeNames.data(), h.metaTypes.data()); + } + + template +#ifdef Q_QDOC + bool +#else + QtPrivate::Invoke::IfNotOldStyleArgs +#endif + invoke(QObject *obj, Qt::ConnectionType c, Args &&... arguments) const + { + return invoke(obj, c, QTemplatedMetaMethodReturnArgument{}, std::forward(arguments)...); + } + + template +#ifdef Q_QDOC + bool +#else + QtPrivate::Invoke::IfNotOldStyleArgs +#endif + invoke(QObject *obj, QTemplatedMetaMethodReturnArgument r, Args &&... arguments) const + { + return invoke(obj, Qt::AutoConnection, r, std::forward(arguments)...); + } + + template +#ifdef Q_QDOC + bool +#else + QtPrivate::Invoke::IfNotOldStyleArgs +#endif + invoke(QObject *obj, Args &&... arguments) const + { + return invoke(obj, Qt::AutoConnection, std::forward(arguments)...); + } + + template +#ifdef Q_QDOC + bool +#else + QtPrivate::Invoke::IfNotOldStyleArgs +#endif + invokeOnGadget(void *gadget, QTemplatedMetaMethodReturnArgument r, Args &&... arguments) const + { + auto h = QtPrivate::invokeMethodHelper(r, std::forward(arguments)...); + return invokeImpl(*this, gadget, Qt::ConnectionType(-1), h.parameterCount(), + h.parameters.data(), h.typeNames.data(), h.metaTypes.data()); + } + + template +#ifdef Q_QDOC + bool +#else + QtPrivate::Invoke::IfNotOldStyleArgs +#endif + invokeOnGadget(void *gadget, Args &&... arguments) const + { + return invokeOnGadget(gadget, QTemplatedMetaMethodReturnArgument{}, std::forward(arguments)...); + } + + inline bool isValid() const { return mobj != nullptr; } + + template + static inline QMetaMethod fromSignal(PointerToMemberFunction signal) + { + typedef QtPrivate::FunctionPointer SignalType; + static_assert(QtPrivate::HasQ_OBJECT_Macro::Value, + "No Q_OBJECT in the class with the signal"); + return fromSignalImpl(&SignalType::Object::staticMetaObject, + reinterpret_cast(&signal)); + } + +private: + static bool invokeImpl(QMetaMethod self, void *target, Qt::ConnectionType, qsizetype paramCount, + const void *const *parameters, const char *const *typeNames, + const QtPrivate::QMetaTypeInterface *const *metaTypes); + static QMetaMethod fromSignalImpl(const QMetaObject *, void **); + static QMetaMethod fromRelativeMethodIndex(const QMetaObject *mobj, int index); + static QMetaMethod fromRelativeConstructorIndex(const QMetaObject *mobj, int index); + +protected: + struct Data { + enum { Size = 6 }; + + uint name() const { return d[0]; } + uint argc() const { return d[1]; } + uint parameters() const { return d[2]; } + uint tag() const { return d[3]; } + uint flags() const { return d[4]; } + uint metaTypeOffset() const { return d[5]; } + bool operator==(const Data &other) const { return d == other.d; } + + const uint *d; + }; +private: + constexpr QMetaMethod(const QMetaObject *metaObject, const Data &data_) + : mobj(metaObject), data(data_) + {} +protected: + + const QMetaObject *mobj; + Data data; + friend struct QMetaObject; + friend struct QMetaObjectPrivate; + friend class QObject; + +private: + friend bool comparesEqual(const QMetaMethod &lhs, const QMetaMethod &rhs) noexcept + { return lhs.data == rhs.data; } + Q_DECLARE_EQUALITY_COMPARABLE(QMetaMethod) +}; +Q_DECLARE_TYPEINFO(QMetaMethod, Q_RELOCATABLE_TYPE); + +class Q_CORE_EXPORT QMetaEnum +{ +public: + constexpr inline QMetaEnum() : mobj(nullptr), data({ nullptr }) {} + + const char *name() const; + const char *enumName() const; + QMetaType metaType() const; + + bool isFlag() const; + bool isScoped() const; + + int keyCount() const; + const char *key(int index) const; + int value(int index) const; + + const char *scope() const; + + int keyToValue(const char *key, bool *ok = nullptr) const; + const char *valueToKey(int value) const; + int keysToValue(const char *keys, bool *ok = nullptr) const; + QByteArray valueToKeys(int value) const; + + inline const QMetaObject *enclosingMetaObject() const { return mobj; } + + inline bool isValid() const { return name() != nullptr; } + + template + static QMetaEnum fromType() + { + static_assert(QtPrivate::IsQEnumHelper::Value, + "QMetaEnum::fromType only works with enums declared as " + "Q_ENUM, Q_ENUM_NS, Q_FLAG or Q_FLAG_NS"); + const QMetaObject *metaObject = qt_getEnumMetaObject(T()); + const char *name = qt_getEnumName(T()); + return metaObject->enumerator(metaObject->indexOfEnumerator(name)); + } + +private: + struct Data { + enum { Size = 5 }; + quint32 name() const { return d[0]; } + quint32 alias() const { return d[1]; } + quint32 flags() const { return d[2]; } + qint32 keyCount() const { return static_cast(d[3]); } + quint32 data() const { return d[4]; } + int index(const QMetaObject *mobj) const; + + const uint *d; + }; + + QMetaEnum(const QMetaObject *mobj, int index); + + const QMetaObject *mobj; + Data data; + friend struct QMetaObject; + friend struct QMetaObjectPrivate; +}; +Q_DECLARE_TYPEINFO(QMetaEnum, Q_RELOCATABLE_TYPE); + +class Q_CORE_EXPORT QMetaProperty +{ +public: + constexpr QMetaProperty() : mobj(nullptr), data({ nullptr }) {} + + const char *name() const; + const char *typeName() const; +#if QT_DEPRECATED_SINCE(6, 0) + QT_WARNING_PUSH + QT_WARNING_DISABLE_DEPRECATED + QT_DEPRECATED_VERSION_6_0 + QVariant::Type type() const + { int t = userType(); return t >= QMetaType::User ? QVariant::UserType : QVariant::Type(t); } + QT_WARNING_POP +#endif + int userType() const { return typeId(); } + int typeId() const { return metaType().id(); } + QMetaType metaType() const; + int propertyIndex() const; + int relativePropertyIndex() const; + + bool isReadable() const; + bool isWritable() const; + bool isResettable() const; + bool isDesignable() const; + bool isScriptable() const; + bool isStored() const; + bool isUser() const; + bool isConstant() const; + bool isFinal() const; + bool isRequired() const; + bool isBindable() const; + + bool isFlagType() const; + bool isEnumType() const; + QMetaEnum enumerator() const; + + bool hasNotifySignal() const; + QMetaMethod notifySignal() const; + int notifySignalIndex() const; + + int revision() const; + + QVariant read(const QObject *obj) const; + bool write(QObject *obj, const QVariant &value) const; + bool write(QObject *obj, QVariant &&value) const; + bool reset(QObject *obj) const; + + QUntypedBindable bindable(QObject *object) const; + + QVariant readOnGadget(const void *gadget) const; + bool writeOnGadget(void *gadget, const QVariant &value) const; + bool writeOnGadget(void *gadget, QVariant &&value) const; + bool resetOnGadget(void *gadget) const; + + bool hasStdCppSet() const; + bool isAlias() const; + inline bool isValid() const { return isReadable(); } + inline const QMetaObject *enclosingMetaObject() const { return mobj; } + +private: +#if QT_DEPRECATED_SINCE(6, 4) + QT_DEPRECATED_VERSION_X_6_4("obsolete, simply returns typeId()") + int registerPropertyType() const; +#endif + + struct Data { + enum { Size = 5 }; + + uint name() const { return d[0]; } + uint type() const { return d[1]; } + uint flags() const { return d[2]; } + uint notifyIndex() const { return d[3]; } + uint revision() const { return d[4]; } + + int index(const QMetaObject *mobj) const; + + const uint *d; + }; + + QMetaProperty(const QMetaObject *mobj, int index); + static Data getMetaPropertyData(const QMetaObject *mobj, int index); + + const QMetaObject *mobj; + Data data; + QMetaEnum menum; + friend struct QMetaObject; + friend struct QMetaObjectPrivate; +}; + +class Q_CORE_EXPORT QMetaClassInfo +{ +public: + constexpr inline QMetaClassInfo() : mobj(nullptr), data({ nullptr }) {} + const char *name() const; + const char *value() const; + inline const QMetaObject *enclosingMetaObject() const { return mobj; } + +private: + struct Data { + enum { Size = 2 }; + + uint name() const { return d[0]; } + uint value() const { return d[1]; } + + const uint *d; + }; + + const QMetaObject *mobj; + Data data; + friend struct QMetaObject; +}; +Q_DECLARE_TYPEINFO(QMetaClassInfo, Q_RELOCATABLE_TYPE); + +QT_END_NAMESPACE + +#endif // QMETAOBJECT_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qmetatype.h b/qt/6.8.1/msvc2022_64/include/QtCore/qmetatype.h new file mode 100644 index 0000000000000000000000000000000000000000..57428dece406ea1b508785ec163a1cbd22ae5956 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qmetatype.h @@ -0,0 +1,2704 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// Copyright (C) 2018 Intel Corporation. +// Copyright (C) 2014 Olivier Goffart +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QMETATYPE_H +#define QMETATYPE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef QT_NO_QOBJECT +#include +#endif +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef Bool +#error qmetatype.h must be included before any header file that defines Bool +#endif + +QT_BEGIN_NAMESPACE + +// from qcborcommon.h +enum class QCborSimpleType : quint8; + +template +struct QMetaTypeId2; + +template +inline constexpr int qMetaTypeId(); + +// F is a tuple: (QMetaType::TypeName, QMetaType::TypeNameID, RealType) +#define QT_FOR_EACH_STATIC_PRIMITIVE_NON_VOID_TYPE(F)\ + F(Bool, 1, bool) \ + F(Int, 2, int) \ + F(UInt, 3, uint) \ + F(LongLong, 4, qlonglong) \ + F(ULongLong, 5, qulonglong) \ + F(Double, 6, double) \ + F(Long, 32, long) \ + F(Short, 33, short) \ + F(Char, 34, char) \ + F(Char16, 56, char16_t) \ + F(Char32, 57, char32_t) \ + F(ULong, 35, ulong) \ + F(UShort, 36, ushort) \ + F(UChar, 37, uchar) \ + F(Float, 38, float) \ + F(SChar, 40, signed char) \ + F(Nullptr, 51, std::nullptr_t) \ + F(QCborSimpleType, 52, QCborSimpleType) \ + +#define QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(F) \ + QT_FOR_EACH_STATIC_PRIMITIVE_NON_VOID_TYPE(F) \ + F(Void, 43, void) \ + +#define QT_FOR_EACH_STATIC_PRIMITIVE_POINTER(F) \ + F(VoidStar, 31, void*) \ + +#if QT_CONFIG(easingcurve) +#define QT_FOR_EACH_STATIC_EASINGCURVE(F)\ + F(QEasingCurve, 29, QEasingCurve) +#else +#define QT_FOR_EACH_STATIC_EASINGCURVE(F) +#endif + +#if QT_CONFIG(itemmodel) +#define QT_FOR_EACH_STATIC_ITEMMODEL_CLASS(F)\ + F(QModelIndex, 42, QModelIndex) \ + F(QPersistentModelIndex, 50, QPersistentModelIndex) +#else +#define QT_FOR_EACH_STATIC_ITEMMODEL_CLASS(F) +#endif + +#if QT_CONFIG(regularexpression) +# define QT_FOR_EACH_STATIC_REGULAR_EXPRESSION(F) \ + F(QRegularExpression, 44, QRegularExpression) +#else +# define QT_FOR_EACH_STATIC_REGULAR_EXPRESSION(F) +#endif +#ifndef QT_NO_VARIANT +# define QT_FOR_EACH_STATIC_QVARIANT(F) \ + F(QVariant, 41, QVariant) +#else +# define QT_FOR_EACH_STATIC_QVARIANT(F) +#endif + +#define QT_FOR_EACH_STATIC_CORE_CLASS(F)\ + F(QChar, 7, QChar) \ + F(QString, 10, QString) \ + F(QByteArray, 12, QByteArray) \ + F(QBitArray, 13, QBitArray) \ + F(QDate, 14, QDate) \ + F(QTime, 15, QTime) \ + F(QDateTime, 16, QDateTime) \ + F(QUrl, 17, QUrl) \ + F(QLocale, 18, QLocale) \ + F(QRect, 19, QRect) \ + F(QRectF, 20, QRectF) \ + F(QSize, 21, QSize) \ + F(QSizeF, 22, QSizeF) \ + F(QLine, 23, QLine) \ + F(QLineF, 24, QLineF) \ + F(QPoint, 25, QPoint) \ + F(QPointF, 26, QPointF) \ + QT_FOR_EACH_STATIC_EASINGCURVE(F) \ + F(QUuid, 30, QUuid) \ + QT_FOR_EACH_STATIC_QVARIANT(F) \ + QT_FOR_EACH_STATIC_REGULAR_EXPRESSION(F) \ + F(QJsonValue, 45, QJsonValue) \ + F(QJsonObject, 46, QJsonObject) \ + F(QJsonArray, 47, QJsonArray) \ + F(QJsonDocument, 48, QJsonDocument) \ + F(QCborValue, 53, QCborValue) \ + F(QCborArray, 54, QCborArray) \ + F(QCborMap, 55, QCborMap) \ + F(Float16, 63, qfloat16) \ + QT_FOR_EACH_STATIC_ITEMMODEL_CLASS(F) + +#define QT_FOR_EACH_STATIC_CORE_POINTER(F)\ + F(QObjectStar, 39, QObject*) + +#ifndef QT_NO_VARIANT +# define QT_FOR_EACH_STATIC_CORE_QVARIANT_TEMPLATE(F) \ + F(QVariantMap, 8, QVariantMap) \ + F(QVariantList, 9, QVariantList) \ + F(QVariantHash, 28, QVariantHash) \ + F(QVariantPair, 58, QVariantPair) \ + /**/ +#else +# define QT_FOR_EACH_STATIC_CORE_QVARIANT_TEMPLATE(F) +#endif // QT_NO_VARIANT + +#define QT_FOR_EACH_STATIC_CORE_TEMPLATE(F) \ + QT_FOR_EACH_STATIC_CORE_QVARIANT_TEMPLATE(F) \ + F(QByteArrayList, 49, QByteArrayList) \ + F(QStringList, 11, QStringList) + +#if QT_CONFIG(shortcut) +#define QT_FOR_EACH_STATIC_KEYSEQUENCE_CLASS(F)\ + F(QKeySequence, 0x100b, QKeySequence) +#else +#define QT_FOR_EACH_STATIC_KEYSEQUENCE_CLASS(F) +#endif + +#define QT_FOR_EACH_STATIC_GUI_CLASS(F)\ + F(QFont, 0x1000, QFont) \ + F(QPixmap, 0x1001, QPixmap) \ + F(QBrush, 0x1002, QBrush) \ + F(QColor, 0x1003, QColor) \ + F(QPalette, 0x1004, QPalette) \ + F(QIcon, 0x1005, QIcon) \ + F(QImage, 0x1006, QImage) \ + F(QPolygon, 0x1007, QPolygon) \ + F(QRegion, 0x1008, QRegion) \ + F(QBitmap, 0x1009, QBitmap) \ + F(QCursor, 0x100a, QCursor) \ + QT_FOR_EACH_STATIC_KEYSEQUENCE_CLASS(F) \ + F(QPen, 0x100c, QPen) \ + F(QTextLength, 0x100d, QTextLength) \ + F(QTextFormat, 0x100e, QTextFormat) \ + F(QTransform, 0x1010, QTransform) \ + F(QMatrix4x4, 0x1011, QMatrix4x4) \ + F(QVector2D, 0x1012, QVector2D) \ + F(QVector3D, 0x1013, QVector3D) \ + F(QVector4D, 0x1014, QVector4D) \ + F(QQuaternion, 0x1015, QQuaternion) \ + F(QPolygonF, 0x1016, QPolygonF) \ + F(QColorSpace, 0x1017, QColorSpace) \ + + +#define QT_FOR_EACH_STATIC_WIDGETS_CLASS(F)\ + F(QSizePolicy, 0x2000, QSizePolicy) \ + +// F is a tuple: (QMetaType::TypeName, QMetaType::TypeNameID, AliasingType, "RealType") +#define QT_FOR_EACH_STATIC_ALIAS_TYPE(F)\ + F(ULong, -1, ulong, "unsigned long") \ + F(UInt, -1, uint, "unsigned int") \ + F(UShort, -1, ushort, "unsigned short") \ + F(UChar, -1, uchar, "unsigned char") \ + F(LongLong, -1, qlonglong, "long long") \ + F(ULongLong, -1, qulonglong, "unsigned long long") \ + F(SChar, -1, signed char, "qint8") \ + F(UChar, -1, uchar, "quint8") \ + F(Short, -1, short, "qint16") \ + F(UShort, -1, ushort, "quint16") \ + F(Int, -1, int, "qint32") \ + F(UInt, -1, uint, "quint32") \ + F(LongLong, -1, qlonglong, "qint64") \ + F(ULongLong, -1, qulonglong, "quint64") \ + F(QByteArrayList, -1, QByteArrayList, "QList") \ + F(QStringList, -1, QStringList, "QList") \ + QT_FOR_EACH_STATIC_VARIANT_ALIAS_TYPE(F) + +#ifndef QT_NO_VARIANT +#define QT_FOR_EACH_STATIC_VARIANT_ALIAS_TYPE(F) \ + F(QVariantList, -1, QVariantList, "QList") \ + F(QVariantMap, -1, QVariantMap, "QMap") \ + F(QVariantHash, -1, QVariantHash, "QHash") \ + F(QVariantPair, -1, QVariantPair, "QPair") \ + /**/ +#else +#define QT_FOR_EACH_STATIC_VARIANT_ALIAS_TYPE(F) +#endif + +#define QT_FOR_EACH_STATIC_TYPE(F)\ + QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(F)\ + QT_FOR_EACH_STATIC_PRIMITIVE_POINTER(F)\ + QT_FOR_EACH_STATIC_CORE_CLASS(F)\ + QT_FOR_EACH_STATIC_CORE_POINTER(F)\ + QT_FOR_EACH_STATIC_CORE_TEMPLATE(F)\ + QT_FOR_EACH_STATIC_GUI_CLASS(F)\ + QT_FOR_EACH_STATIC_WIDGETS_CLASS(F)\ + +#define QT_DEFINE_METATYPE_ID(TypeName, Id, Name) \ + TypeName = Id, + +#define QT_FOR_EACH_AUTOMATIC_TEMPLATE_1ARG(F) \ + F(QList) \ + F(QQueue) \ + F(QStack) \ + F(QSet) \ + /*end*/ + +#define QT_FOR_EACH_AUTOMATIC_TEMPLATE_2ARG(F) \ + F(QHash, class) \ + F(QMap, class) + +#define QT_FOR_EACH_AUTOMATIC_TEMPLATE_SMART_POINTER(F) \ + F(QSharedPointer) \ + F(QWeakPointer) \ + F(QPointer) + +class QDataStream; +struct QMetaObject; + +namespace QtPrivate +{ + +class QMetaTypeInterface; + +// MSVC is the only supported compiler that includes the type of a variable in +// its mangled form, so it's not binary-compatible to drop the const in +// QMetaTypeInterfaceWrapper::metaType for it, which means we must keep the +// mutable field until Qt 7. +#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0) || defined(QT_BOOTSTRAPPED) || !defined(Q_CC_MSVC) +# define QMTI_MUTABLE +using NonConstMetaTypeInterface = QMetaTypeInterface; +#else +# define QMTI_MUTABLE mutable +using NonConstMetaTypeInterface = const QMetaTypeInterface; +#endif + +class QMetaTypeInterface +{ +public: + + /* Revision: Can increase if new field are added, or if semantics changes + 0: Initial Revision + 1: the meaning of the NeedsDestruction flag changed + */ + static inline constexpr ushort CurrentRevision = 1; + + ushort revision; + ushort alignment; + uint size; + uint flags; + QMTI_MUTABLE QBasicAtomicInt typeId; + + using MetaObjectFn = const QMetaObject *(*)(const QMetaTypeInterface *); + MetaObjectFn metaObjectFn; + + const char *name; + + using DefaultCtrFn = void (*)(const QMetaTypeInterface *, void *); + DefaultCtrFn defaultCtr; + using CopyCtrFn = void (*)(const QMetaTypeInterface *, void *, const void *); + CopyCtrFn copyCtr; + using MoveCtrFn = void (*)(const QMetaTypeInterface *, void *, void *); + MoveCtrFn moveCtr; + using DtorFn = void (*)(const QMetaTypeInterface *, void *); + DtorFn dtor; + using EqualsFn = bool (*)(const QMetaTypeInterface *, const void *, const void *); + EqualsFn equals; + using LessThanFn = bool (*)(const QMetaTypeInterface *, const void *, const void *); + LessThanFn lessThan; + using DebugStreamFn = void (*)(const QMetaTypeInterface *, QDebug &, const void *); + DebugStreamFn debugStream; + using DataStreamOutFn = void (*)(const QMetaTypeInterface *, QDataStream &, const void *); + DataStreamOutFn dataStreamOut; + using DataStreamInFn = void (*)(const QMetaTypeInterface *, QDataStream &, void *); + DataStreamInFn dataStreamIn; + + using LegacyRegisterOp = void (*)(); + LegacyRegisterOp legacyRegisterOp; +}; +#undef QMTI_MUTABLE + +/*! + This template is used for implicit conversion from type From to type To. + \internal +*/ +template +To convertImplicit(const From& from) +{ + return from; +} + + template + struct SequentialValueTypeIsMetaType; + template + struct AssociativeValueTypeIsMetaType; + template + struct IsMetaTypePair; + template + struct MetaTypeSmartPointerHelper; + + template + struct IsQFlags : std::false_type {}; + + template + struct IsQFlags> : std::true_type {}; + + template + struct IsEnumOrFlags : std::disjunction, IsQFlags> {}; +} // namespace QtPrivate + +class Q_CORE_EXPORT QMetaType { +public: +#ifndef Q_QDOC + // The code that actually gets compiled. + enum Type { + // these are merged with QVariant + QT_FOR_EACH_STATIC_TYPE(QT_DEFINE_METATYPE_ID) + + FirstCoreType = Bool, + LastCoreType = Float16, + FirstGuiType = QFont, + LastGuiType = QColorSpace, + FirstWidgetsType = QSizePolicy, + LastWidgetsType = QSizePolicy, + HighestInternalId = LastWidgetsType, + + QReal = sizeof(qreal) == sizeof(double) ? Double : Float, + + UnknownType = 0, + User = 65536 + }; +#else + // If we are using QDoc it fakes the Type enum looks like this. + enum Type { + UnknownType = 0, Bool = 1, Int = 2, UInt = 3, LongLong = 4, ULongLong = 5, + Double = 6, Long = 32, Short = 33, Char = 34, ULong = 35, UShort = 36, + UChar = 37, Float = 38, + VoidStar = 31, + QChar = 7, QString = 10, QStringList = 11, QByteArray = 12, + QBitArray = 13, QDate = 14, QTime = 15, QDateTime = 16, QUrl = 17, + QLocale = 18, QRect = 19, QRectF = 20, QSize = 21, QSizeF = 22, + QLine = 23, QLineF = 24, QPoint = 25, QPointF = 26, + QEasingCurve = 29, QUuid = 30, QVariant = 41, QModelIndex = 42, + QPersistentModelIndex = 50, QRegularExpression = 44, + QJsonValue = 45, QJsonObject = 46, QJsonArray = 47, QJsonDocument = 48, + QByteArrayList = 49, QObjectStar = 39, SChar = 40, + Void = 43, + Nullptr = 51, + QVariantMap = 8, QVariantList = 9, QVariantHash = 28, QVariantPair = 58, + QCborSimpleType = 52, QCborValue = 53, QCborArray = 54, QCborMap = 55, + Char16 = 56, Char32 = 57, + Int128 = 59, UInt128 = 60, Float128 = 61, BFloat16 = 62, Float16 = 63, + + // Gui types + QFont = 0x1000, QPixmap = 0x1001, QBrush = 0x1002, QColor = 0x1003, QPalette = 0x1004, + QIcon = 0x1005, QImage = 0x1006, QPolygon = 0x1007, QRegion = 0x1008, QBitmap = 0x1009, + QCursor = 0x100a, QKeySequence = 0x100b, QPen = 0x100c, QTextLength = 0x100d, QTextFormat = 0x100e, + QTransform = 0x1010, QMatrix4x4 = 0x1011, QVector2D = 0x1012, + QVector3D = 0x1013, QVector4D = 0x1014, QQuaternion = 0x1015, QPolygonF = 0x1016, QColorSpace = 0x1017, + + // Widget types + QSizePolicy = 0x2000, + + // Start-point for client-code types: + User = 65536 + }; +#endif + + enum TypeFlag { + NeedsConstruction = 0x1, + NeedsDestruction = 0x2, + RelocatableType = 0x4, +#if QT_DEPRECATED_SINCE(6, 0) + MovableType Q_DECL_ENUMERATOR_DEPRECATED_X("Use RelocatableType instead.") = RelocatableType, +#endif + PointerToQObject = 0x8, + IsEnumeration = 0x10, + SharedPointerToQObject = 0x20, + WeakPointerToQObject = 0x40, + TrackingPointerToQObject = 0x80, + IsUnsignedEnumeration = 0x100, + IsGadget = 0x200, + PointerToGadget = 0x400, + IsPointer = 0x800, + IsQmlList =0x1000, // used in the QML engine to recognize QQmlListProperty and list + IsConst = 0x2000, + // since 6.5: + NeedsCopyConstruction = 0x4000, + NeedsMoveConstruction = 0x8000, + }; + Q_DECLARE_FLAGS(TypeFlags, TypeFlag) + + static void registerNormalizedTypedef(const QT_PREPEND_NAMESPACE(QByteArray) &normalizedTypeName, QMetaType type); + +#if QT_DEPRECATED_SINCE(6, 0) + QT_DEPRECATED_VERSION_6_0 + static int type(const char *typeName) + { return QMetaType::fromName(typeName).id(); } + QT_DEPRECATED_VERSION_6_0 + static int type(const QT_PREPEND_NAMESPACE(QByteArray) &typeName) + { return QMetaType::fromName(typeName).id(); } + QT_DEPRECATED_VERSION_6_0 + static const char *typeName(int type) + { return QMetaType(type).name(); } + QT_DEPRECATED_VERSION_6_0 + static int sizeOf(int type) + { return int(QMetaType(type).sizeOf()); } + QT_DEPRECATED_VERSION_6_0 + static TypeFlags typeFlags(int type) + { return QMetaType(type).flags(); } + QT_DEPRECATED_VERSION_6_0 + static const QMetaObject *metaObjectForType(int type) + { return QMetaType(type).metaObject(); } + QT_DEPRECATED_VERSION_6_0 + static void *create(int type, const void *copy = nullptr) + { return QMetaType(type).create(copy); } + QT_DEPRECATED_VERSION_6_0 + static void destroy(int type, void *data) + { return QMetaType(type).destroy(data); } + QT_DEPRECATED_VERSION_6_0 + static void *construct(int type, void *where, const void *copy) + { return QMetaType(type).construct(where, copy); } + QT_DEPRECATED_VERSION_6_0 + static void destruct(int type, void *where) + { return QMetaType(type).destruct(where); } +#endif + static bool isRegistered(int type); + + explicit QMetaType(int type); + explicit constexpr QMetaType(const QtPrivate::QMetaTypeInterface *d) : d_ptr(d) {} + constexpr QMetaType() = default; + + bool isValid() const; + bool isRegistered() const; + void registerType() const + { + // "register" is a reserved keyword + registerHelper(); + } +#if QT_CORE_REMOVED_SINCE(6, 1) || defined(Q_QDOC) + int id() const; +#else + // ### Qt 7: Remove traces of out of line version + // unused int parameter is used to avoid ODR violation + int id(int = 0) const + { + // keep in sync with the version in removed_api.cpp + return registerHelper(); + } +#endif + constexpr qsizetype sizeOf() const; + constexpr qsizetype alignOf() const; + constexpr TypeFlags flags() const; + constexpr const QMetaObject *metaObject() const; + constexpr const char *name() const; + + void *create(const void *copy = nullptr) const; + void destroy(void *data) const; + void *construct(void *where, const void *copy = nullptr) const; + void destruct(void *data) const; + QPartialOrdering compare(const void *lhs, const void *rhs) const; + bool equals(const void *lhs, const void *rhs) const; + + bool isDefaultConstructible() const noexcept { return d_ptr && isDefaultConstructible(d_ptr); } + bool isCopyConstructible() const noexcept { return d_ptr && isCopyConstructible(d_ptr); } + bool isMoveConstructible() const noexcept { return d_ptr && isMoveConstructible(d_ptr); } + bool isDestructible() const noexcept { return d_ptr && isDestructible(d_ptr); } + bool isEqualityComparable() const; + bool isOrdered() const; + +#ifndef QT_NO_DATASTREAM + bool save(QDataStream &stream, const void *data) const; + bool load(QDataStream &stream, void *data) const; + bool hasRegisteredDataStreamOperators() const; + +#if QT_DEPRECATED_SINCE(6, 0) + QT_DEPRECATED_VERSION_6_0 + static bool save(QDataStream &stream, int type, const void *data) + { return QMetaType(type).save(stream, data); } + QT_DEPRECATED_VERSION_6_0 + static bool load(QDataStream &stream, int type, void *data) + { return QMetaType(type).load(stream, data); } +#endif +#endif + + QMetaType underlyingType() const; + + template + constexpr static QMetaType fromType(); + static QMetaType fromName(QByteArrayView name); +private: + friend bool comparesEqual(const QMetaType &lhs, + const QMetaType &rhs) + { + if (lhs.d_ptr == rhs.d_ptr) + return true; + if (!lhs.d_ptr || !rhs.d_ptr) + return false; // one type is undefined, the other is defined + // avoid id call if we already have the id + const int aId = lhs.id(); + const int bId = rhs.id(); + return aId == bId; + } + Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QMetaType) +#ifndef QT_NO_DEBUG_STREAM +private: + friend Q_CORE_EXPORT QDebug operator<<(QDebug d, QMetaType m); +public: + bool debugStream(QDebug& dbg, const void *rhs); + bool hasRegisteredDebugStreamOperator() const; + +#if QT_DEPRECATED_SINCE(6, 0) + QT_DEPRECATED_VERSION_6_0 + static bool debugStream(QDebug& dbg, const void *rhs, int typeId) + { return QMetaType(typeId).debugStream(dbg, rhs); } + template + QT_DEPRECATED_VERSION_6_0 + static bool hasRegisteredDebugStreamOperator() + { return QMetaType::fromType().hasRegisteredDebugStreamOperator(); } + QT_DEPRECATED_VERSION_6_0 + static bool hasRegisteredDebugStreamOperator(int typeId) + { return QMetaType(typeId).hasRegisteredDebugStreamOperator(); } +#endif +#endif + + // type erased converter function + using ConverterFunction = std::function; + + // type erased mutable view, primarily for containers + using MutableViewFunction = std::function; + + // implicit conversion supported like double -> float + template + static bool registerConverter() + { + return registerConverter(QtPrivate::convertImplicit); + } + + // member function as in "QString QFont::toString() const" + template + static bool registerConverter(To(From::*function)() const) + { + static_assert((!QMetaTypeId2::IsBuiltIn || !QMetaTypeId2::IsBuiltIn), + "QMetaType::registerConverter: At least one of the types must be a custom type."); + + const QMetaType fromType = QMetaType::fromType(); + const QMetaType toType = QMetaType::fromType(); + auto converter = [function](const void *from, void *to) -> bool { + const From *f = static_cast(from); + To *t = static_cast(to); + *t = (f->*function)(); + return true; + }; + return registerConverterImpl(converter, fromType, toType); + } + + // member function + template + static bool registerMutableView(To(From::*function)()) + { + static_assert((!QMetaTypeId2::IsBuiltIn || !QMetaTypeId2::IsBuiltIn), + "QMetaType::registerMutableView: At least one of the types must be a custom type."); + + const QMetaType fromType = QMetaType::fromType(); + const QMetaType toType = QMetaType::fromType(); + auto view = [function](void *from, void *to) -> bool { + From *f = static_cast(from); + To *t = static_cast(to); + *t = (f->*function)(); + return true; + }; + return registerMutableViewImpl(view, fromType, toType); + } + + // member function as in "double QString::toDouble(bool *ok = nullptr) const" + template + static bool registerConverter(To(From::*function)(bool*) const) + { + static_assert((!QMetaTypeId2::IsBuiltIn || !QMetaTypeId2::IsBuiltIn), + "QMetaType::registerConverter: At least one of the types must be a custom type."); + + const QMetaType fromType = QMetaType::fromType(); + const QMetaType toType = QMetaType::fromType(); + auto converter = [function](const void *from, void *to) -> bool { + const From *f = static_cast(from); + To *t = static_cast(to); + bool result = true; + *t = (f->*function)(&result); + if (!result) + *t = To(); + return result; + }; + return registerConverterImpl(converter, fromType, toType); + } + + // functor or function pointer + template + static bool registerConverter(UnaryFunction function) + { + static_assert((!QMetaTypeId2::IsBuiltIn || !QMetaTypeId2::IsBuiltIn), + "QMetaType::registerConverter: At least one of the types must be a custom type."); + + const QMetaType fromType = QMetaType::fromType(); + const QMetaType toType = QMetaType::fromType(); + auto converter = [function = std::move(function)](const void *from, void *to) -> bool { + const From *f = static_cast(from); + To *t = static_cast(to); + auto &&r = function(*f); + if constexpr (std::is_same_v, std::optional>) { + if (!r) + return false; + *t = *std::forward(r); + } else { + *t = std::forward(r); + } + return true; + }; + return registerConverterImpl(std::move(converter), fromType, toType); + } + + // functor or function pointer + template + static bool registerMutableView(UnaryFunction function) + { + static_assert((!QMetaTypeId2::IsBuiltIn || !QMetaTypeId2::IsBuiltIn), + "QMetaType::registerMutableView: At least one of the types must be a custom type."); + + const QMetaType fromType = QMetaType::fromType(); + const QMetaType toType = QMetaType::fromType(); + auto view = [function = std::move(function)](void *from, void *to) -> bool { + From *f = static_cast(from); + To *t = static_cast(to); + *t = function(*f); + return true; + }; + return registerMutableViewImpl(std::move(view), fromType, toType); + } + +private: + template + static bool registerConverterImpl(ConverterFunction converter, QMetaType fromType, QMetaType toType) + { + if (registerConverterFunction(std::move(converter), fromType, toType)) { + static const auto unregister = qScopeGuard([=] { + unregisterConverterFunction(fromType, toType); + }); + return true; + } else { + return false; + } + } + + template + static bool registerMutableViewImpl(MutableViewFunction view, QMetaType fromType, QMetaType toType) + { + if (registerMutableViewFunction(std::move(view), fromType, toType)) { + static const auto unregister = qScopeGuard([=] { + unregisterMutableViewFunction(fromType, toType); + }); + return true; + } else { + return false; + } + } +public: + + static bool convert(QMetaType fromType, const void *from, QMetaType toType, void *to); + static bool canConvert(QMetaType fromType, QMetaType toType); + + static bool view(QMetaType fromType, void *from, QMetaType toType, void *to); + static bool canView(QMetaType fromType, QMetaType toType); +#if QT_DEPRECATED_SINCE(6, 0) + QT_DEPRECATED_VERSION_6_0 + static bool convert(const void *from, int fromTypeId, void *to, int toTypeId) + { return convert(QMetaType(fromTypeId), from, QMetaType(toTypeId), to); } + QT_DEPRECATED_VERSION_6_0 + static bool compare(const void *lhs, const void *rhs, int typeId, int *result) + { + QMetaType t(typeId); + auto c = t.compare(lhs, rhs); + if (c == QPartialOrdering::Unordered) { + *result = 0; + return false; + } else if (c == QPartialOrdering::Less) { + *result = -1; + return true; + } else if (c == QPartialOrdering::Equivalent) { + *result = 0; + return true; + } else { + *result = 1; + return true; + } + } + QT_DEPRECATED_VERSION_6_0 + static bool equals(const void *lhs, const void *rhs, int typeId, int *result) + { + QMetaType t(typeId); + if (!t.isEqualityComparable()) + return false; + *result = t.equals(lhs, rhs) ? 0 : -1; + return true; + } +#endif + + template + static bool hasRegisteredConverterFunction() + { + return hasRegisteredConverterFunction( + QMetaType::fromType(), QMetaType::fromType()); + } + + static bool hasRegisteredConverterFunction(QMetaType fromType, QMetaType toType); + + template + static bool hasRegisteredMutableViewFunction() + { + return hasRegisteredMutableViewFunction( + QMetaType::fromType(), QMetaType::fromType()); + } + + static bool hasRegisteredMutableViewFunction(QMetaType fromType, QMetaType toType); + +#ifndef Q_QDOC + template friend struct QtPrivate::SequentialValueTypeIsMetaType; + template friend struct QtPrivate::AssociativeValueTypeIsMetaType; + template friend struct QtPrivate::IsMetaTypePair; + template friend struct QtPrivate::MetaTypeSmartPointerHelper; +#endif + static bool registerConverterFunction(const ConverterFunction &f, QMetaType from, QMetaType to); + static void unregisterConverterFunction(QMetaType from, QMetaType to); + + static bool registerMutableViewFunction(const MutableViewFunction &f, QMetaType from, QMetaType to); + static void unregisterMutableViewFunction(QMetaType from, QMetaType to); + + static void unregisterMetaType(QMetaType type); + +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) + const QtPrivate::QMetaTypeInterface *iface() { return d_ptr; } +#endif + const QtPrivate::QMetaTypeInterface *iface() const { return d_ptr; } + +private: + static bool isDefaultConstructible(const QtPrivate::QMetaTypeInterface *) noexcept Q_DECL_PURE_FUNCTION; + static bool isCopyConstructible(const QtPrivate::QMetaTypeInterface *) noexcept Q_DECL_PURE_FUNCTION; + static bool isMoveConstructible(const QtPrivate::QMetaTypeInterface *) noexcept Q_DECL_PURE_FUNCTION; + static bool isDestructible(const QtPrivate::QMetaTypeInterface *) noexcept Q_DECL_PURE_FUNCTION; + +#if QT_CORE_REMOVED_SINCE(6, 5) + int idHelper() const; +#endif + static int registerHelper(const QtPrivate::QMetaTypeInterface *iface); + int registerHelper() const + { + // keep in sync with the QMetaType::id() version in removed_api.cpp + if (d_ptr) { + if (int id = d_ptr->typeId.loadRelaxed()) + return id; + return registerHelper(d_ptr); + } + return 0; + } + + friend int qRegisterMetaType(QMetaType meta); + + friend class QVariant; + const QtPrivate::QMetaTypeInterface *d_ptr = nullptr; +}; + +#undef QT_DEFINE_METATYPE_ID + +Q_DECLARE_OPERATORS_FOR_FLAGS(QMetaType::TypeFlags) + +#define QT_METATYPE_PRIVATE_DECLARE_TYPEINFO(C, F) \ + } \ + Q_DECLARE_TYPEINFO(QtMetaTypePrivate:: C, (F)); \ + namespace QtMetaTypePrivate { + + +namespace QtMetaTypePrivate { + +class QPairVariantInterfaceImpl +{ +public: + const void *_pair; + QMetaType _metaType_first; + QMetaType _metaType_second; + + typedef void (*getFunc)(const void * const *p, void *); + + getFunc _getFirst; + getFunc _getSecond; + + template + static void getFirstImpl(const void * const *pair, void *dataPtr) + { *static_cast(dataPtr) = static_cast(*pair)->first; } + template + static void getSecondImpl(const void * const *pair, void *dataPtr) + { *static_cast(dataPtr) = static_cast(*pair)->second; } + +public: + template QPairVariantInterfaceImpl(const T*p) + : _pair(p) + , _metaType_first(QMetaType::fromType()) + , _metaType_second(QMetaType::fromType()) + , _getFirst(getFirstImpl) + , _getSecond(getSecondImpl) + { + } + + constexpr QPairVariantInterfaceImpl() + : _pair(nullptr) + , _getFirst(nullptr) + , _getSecond(nullptr) + { + } + + inline void first(void *dataPtr) const { _getFirst(&_pair, dataPtr); } + inline void second(void *dataPtr) const { _getSecond(&_pair, dataPtr); } +}; +QT_METATYPE_PRIVATE_DECLARE_TYPEINFO(QPairVariantInterfaceImpl, Q_RELOCATABLE_TYPE) + +template +struct QPairVariantInterfaceConvertFunctor; + +template +struct QPairVariantInterfaceConvertFunctor > +{ + QPairVariantInterfaceImpl operator()(const std::pair& f) const + { + return QPairVariantInterfaceImpl(&f); + } +}; + +} + +class QObject; + +#define QT_FORWARD_DECLARE_SHARED_POINTER_TYPES_ITER(Name) \ + template class Name; \ + +QT_FOR_EACH_AUTOMATIC_TEMPLATE_SMART_POINTER(QT_FORWARD_DECLARE_SHARED_POINTER_TYPES_ITER) + +namespace QtPrivate +{ + namespace detail { + template + struct is_complete_helper + { + template + static auto check(U *) -> std::integral_constant; + static auto check(...) -> std::false_type; + using type = decltype(check(static_cast(nullptr))); + }; + } // namespace detail + + template + struct is_complete : detail::is_complete_helper, ODR_VIOLATION_PREVENTER>::type {}; + + template struct MetatypeDecay { using type = T; }; + template struct MetatypeDecay { using type = T; }; + template struct MetatypeDecay { using type = T; }; + + template struct IsPointerDeclaredOpaque : + std::disjunction, + std::is_function>> + {}; + template <> struct IsPointerDeclaredOpaque : std::true_type {}; + template <> struct IsPointerDeclaredOpaque : std::true_type {}; + + // Note: this does not check that T = U* isn't pointing to a + // forward-declared type. You may want to combine with + // checkTypeIsSuitableForMetaType(). + template + struct IsPointerToTypeDerivedFromQObject + { + enum { Value = false }; + }; + + // Specialize to avoid sizeof(void) warning + template<> + struct IsPointerToTypeDerivedFromQObject + { + enum { Value = false }; + }; + template<> + struct IsPointerToTypeDerivedFromQObject + { + enum { Value = false }; + }; + template<> + struct IsPointerToTypeDerivedFromQObject + { + enum { Value = true }; + }; + + template + struct IsPointerToTypeDerivedFromQObject + { + typedef qint8 yes_type; + typedef qint64 no_type; + +#ifndef QT_NO_QOBJECT + static yes_type checkType(QObject* ); + static yes_type checkType(const QObject* ); +#endif + static no_type checkType(...); + enum { Value = sizeof(checkType(static_cast(nullptr))) == sizeof(yes_type) }; + }; + + template + struct IsGadgetHelper { enum { IsRealGadget = false, IsGadgetOrDerivedFrom = false }; }; + + template + struct IsGadgetHelper + { + template + static char checkType(void (X::*)()); + static void *checkType(void (T::*)()); + enum { + IsRealGadget = sizeof(checkType(&T::qt_check_for_QGADGET_macro)) == sizeof(void *), + IsGadgetOrDerivedFrom = true + }; + }; + + template + using IsRealGadget = std::bool_constant::IsRealGadget>; + + template + struct IsPointerToGadgetHelper { enum { IsRealGadget = false, IsGadgetOrDerivedFrom = false }; }; + + template + struct IsPointerToGadgetHelper + { + using BaseType = T; + template + static char checkType(void (X::*)()); + static void *checkType(void (T::*)()); + enum { + IsRealGadget = !IsPointerToTypeDerivedFromQObject::Value && sizeof(checkType(&T::qt_check_for_QGADGET_macro)) == sizeof(void *), + IsGadgetOrDerivedFrom = !IsPointerToTypeDerivedFromQObject::Value + }; + }; + + + template char qt_getEnumMetaObject(const T&); + + template + struct IsQEnumHelper { + static const T &declval(); + // If the type was declared with Q_ENUM, the friend qt_getEnumMetaObject() declared in the + // Q_ENUM macro will be chosen by ADL, and the return type will be QMetaObject*. + // Otherwise the chosen overload will be the catch all template function + // qt_getEnumMetaObject(T) which returns 'char' + enum { Value = sizeof(qt_getEnumMetaObject(declval())) == sizeof(QMetaObject*) }; + }; + template<> struct IsQEnumHelper { enum { Value = false }; }; + + template + struct MetaObjectForType + { + static constexpr const QMetaObject *value() { return nullptr; } + using MetaObjectFn = const QMetaObject *(*)(const QMetaTypeInterface *); + static constexpr MetaObjectFn metaObjectFunction = nullptr; + }; +#ifndef QT_NO_QOBJECT + template + struct MetaObjectForType::Value>::type> + { + static constexpr const QMetaObject *value() { return &T::staticMetaObject; } + static constexpr const QMetaObject *metaObjectFunction(const QMetaTypeInterface *) { return &T::staticMetaObject; } + }; + template + struct MetaObjectForType::IsGadgetOrDerivedFrom>, + std::is_base_of + > + >> + { + static constexpr const QMetaObject *value() { return &T::staticMetaObject; } + static constexpr const QMetaObject *metaObjectFunction(const QMetaTypeInterface *) { return &T::staticMetaObject; } + }; + template + struct MetaObjectForType::IsGadgetOrDerivedFrom>::type> + { + static constexpr const QMetaObject *value() + { + return &IsPointerToGadgetHelper::BaseType::staticMetaObject; + } + static constexpr const QMetaObject *metaObjectFunction(const QMetaTypeInterface *) { return value(); } + }; + template + struct MetaObjectForType::Value>::type > + { + static constexpr const QMetaObject *value() { return qt_getEnumMetaObject(T()); } + static constexpr const QMetaObject *metaObjectFunction(const QMetaTypeInterface *) { return value(); } + }; +#endif + + template + struct IsSharedPointerToTypeDerivedFromQObject + { + enum { Value = false }; + }; + + template + struct IsSharedPointerToTypeDerivedFromQObject > : IsPointerToTypeDerivedFromQObject + { + }; + + template + struct IsWeakPointerToTypeDerivedFromQObject + { + enum { Value = false }; + }; + + template + struct IsWeakPointerToTypeDerivedFromQObject > : IsPointerToTypeDerivedFromQObject + { + }; + + template + struct IsTrackingPointerToTypeDerivedFromQObject + { + enum { Value = false }; + }; + + template + struct IsTrackingPointerToTypeDerivedFromQObject > + { + enum { Value = true }; + }; + + template + struct IsSequentialContainer + { + enum { Value = false }; + }; + + template + struct IsAssociativeContainer + { + enum { Value = false }; + }; + + template::Value> + struct SequentialContainerTransformationHelper + { + static bool registerConverter() + { + return false; + } + + static bool registerMutableView() + { + return false; + } + }; + + template::Defined> + struct SequentialValueTypeIsMetaType + { + static bool registerConverter() + { + return false; + } + + static bool registerMutableView() + { + return false; + } + }; + + template + struct SequentialContainerTransformationHelper : SequentialValueTypeIsMetaType + { + }; + + template::Value> + struct AssociativeContainerTransformationHelper + { + static bool registerConverter() + { + return false; + } + + static bool registerMutableView() + { + return false; + } + }; + + template::Defined> + struct AssociativeKeyTypeIsMetaType + { + static bool registerConverter() + { + return false; + } + + static bool registerMutableView() + { + return false; + } + }; + + template::Defined> + struct AssociativeMappedTypeIsMetaType + { + static bool registerConverter() + { + return false; + } + + static bool registerMutableView() + { + return false; + } + }; + + template + struct AssociativeContainerTransformationHelper : AssociativeKeyTypeIsMetaType + { + }; + + template::Defined + && QMetaTypeId2::Defined> + struct IsMetaTypePair + { + static bool registerConverter() + { + return false; + } + }; + + template + struct IsMetaTypePair + { + inline static bool registerConverter(); + }; + + template + struct IsPair + { + static bool registerConverter() + { + return false; + } + }; + template + struct IsPair > : IsMetaTypePair > {}; + + template + struct MetaTypePairHelper : IsPair {}; + + template + struct MetaTypeSmartPointerHelper + { + static bool registerConverter() { return false; } + }; + +#if QT_CONFIG(future) + template + struct MetaTypeQFutureHelper + { + static bool registerConverter() { return false; } + }; +#endif + + template static constexpr bool checkTypeIsSuitableForMetaType() + { + using T = typename MetatypeDecay::type; + static_assert(is_complete::value || std::is_void_v, + "Meta Types must be fully defined"); + static_assert(!std::is_reference_v, + "Meta Types cannot be non-const references or rvalue references."); + if constexpr (std::is_pointer_v && !IsPointerDeclaredOpaque::value) { + using Pointed = std::remove_pointer_t; + static_assert(is_complete::value, + "Pointer Meta Types must either point to fully-defined types " + "or be declared with Q_DECLARE_OPAQUE_POINTER(T *)"); + } + return true; + } + + Q_CORE_EXPORT bool isBuiltinType(const QByteArray &type); +} // namespace QtPrivate + +template ::Value ? QMetaType::PointerToQObject : + QtPrivate::IsRealGadget::value ? QMetaType::IsGadget : + QtPrivate::IsPointerToGadgetHelper::IsRealGadget ? QMetaType::PointerToGadget : + QtPrivate::IsQEnumHelper::Value ? QMetaType::IsEnumeration : 0> +struct QMetaTypeIdQObject +{ + enum { + Defined = 0 + }; +}; + +template +struct QMetaTypeId : public QMetaTypeIdQObject +{ +}; + +template +struct QMetaTypeId2 +{ + using NameAsArrayType = void; + enum { Defined = QMetaTypeId::Defined, IsBuiltIn=false }; + static inline constexpr int qt_metatype_id() { return QMetaTypeId::qt_metatype_id(); } +}; + +template +struct QMetaTypeId2 : QMetaTypeId2 {}; + +template +struct QMetaTypeId2 +{ + using NameAsArrayType = void; + enum { Defined = false, IsBuiltIn = false }; + static inline constexpr int qt_metatype_id() { return 0; } +}; + +namespace QtPrivate { + template ::Defined> + struct QMetaTypeIdHelper { + static inline constexpr int qt_metatype_id() + { return QMetaTypeId2::qt_metatype_id(); } + }; + template struct QMetaTypeIdHelper { + static inline constexpr int qt_metatype_id() + { return -1; } + }; + + // Function pointers don't derive from QObject + template + struct IsPointerToTypeDerivedFromQObject { enum { Value = false }; }; + + template + inline constexpr bool IsQmlListType = false; + + template::value> + constexpr bool IsUnsignedEnum = false; + template + constexpr bool IsUnsignedEnum = !std::is_signed_v>; + + template + struct QMetaTypeTypeFlags + { + enum { Flags = (QTypeInfo::isRelocatable ? QMetaType::RelocatableType : 0) + | ((!std::is_default_constructible_v || !QTypeInfo::isValueInitializationBitwiseZero) ? QMetaType::NeedsConstruction : 0) + | (!std::is_trivially_destructible_v ? QMetaType::NeedsDestruction : 0) + | (!std::is_trivially_copy_constructible_v ? QMetaType::NeedsCopyConstruction : 0) + | (!std::is_trivially_move_constructible_v ? QMetaType::NeedsMoveConstruction : 0) + | (IsPointerToTypeDerivedFromQObject::Value ? QMetaType::PointerToQObject : 0) + | (IsSharedPointerToTypeDerivedFromQObject::Value ? QMetaType::SharedPointerToQObject : 0) + | (IsWeakPointerToTypeDerivedFromQObject::Value ? QMetaType::WeakPointerToQObject : 0) + | (IsTrackingPointerToTypeDerivedFromQObject::Value ? QMetaType::TrackingPointerToQObject : 0) + | (IsEnumOrFlags::value ? QMetaType::IsEnumeration : 0) + | (IsGadgetHelper::IsGadgetOrDerivedFrom ? QMetaType::IsGadget : 0) + | (IsPointerToGadgetHelper::IsGadgetOrDerivedFrom ? QMetaType::PointerToGadget : 0) + | (std::is_pointer_v ? QMetaType::IsPointer : 0) + | (IsUnsignedEnum ? QMetaType::IsUnsignedEnumeration : 0) + | (IsQmlListType ? QMetaType::IsQmlList : 0) + | (std::is_const_v> ? QMetaType::IsConst : 0) + }; + }; + + template + struct MetaTypeDefinedHelper + { + enum DefinedType { Defined = defined }; + }; + + template + struct QSmartPointerConvertFunctor + { + QObject* operator()(const SmartPointer &p) const + { + return p.operator->(); + } + }; + + // hack to delay name lookup to instantiation time by making + // EnableInternalData a dependent name: + template + struct EnableInternalDataWrap; + + template + struct QSmartPointerConvertFunctor > + { + QObject* operator()(const QWeakPointer &p) const + { + return QtPrivate::EnableInternalDataWrap::internalData(p); + } + }; +} + +template +int qRegisterNormalizedMetaTypeImplementation(const QT_PREPEND_NAMESPACE(QByteArray) &normalizedTypeName) +{ +#ifndef QT_NO_QOBJECT + Q_ASSERT_X(normalizedTypeName == QMetaObject::normalizedType(normalizedTypeName.constData()), + "qRegisterNormalizedMetaType", + "qRegisterNormalizedMetaType was called with a not normalized type name, " + "please call qRegisterMetaType instead."); +#endif + + const QMetaType metaType = QMetaType::fromType(); + const int id = metaType.id(); + + QtPrivate::SequentialContainerTransformationHelper::registerConverter(); + QtPrivate::SequentialContainerTransformationHelper::registerMutableView(); + QtPrivate::AssociativeContainerTransformationHelper::registerConverter(); + QtPrivate::AssociativeContainerTransformationHelper::registerMutableView(); + QtPrivate::MetaTypePairHelper::registerConverter(); + QtPrivate::MetaTypeSmartPointerHelper::registerConverter(); +#if QT_CONFIG(future) + QtPrivate::MetaTypeQFutureHelper::registerConverter(); +#endif + + if (normalizedTypeName != metaType.name()) + QMetaType::registerNormalizedTypedef(normalizedTypeName, metaType); + + return id; +} + +// This primary template calls the -Implementation, like all other specialisations should. +// But the split allows to +// - in a header: +// - define a specialization of this template calling an out-of-line function +// (QT_DECL_METATYPE_EXTERN{,_TAGGED}) +// - in the .cpp file: +// - define the out-of-line wrapper to call the -Implementation +// (QT_IMPL_METATYPE_EXTERN{,_TAGGED}) +// The _TAGGED variants let you choose a tag (must be a C identifier) to disambiguate +// the out-of-line function; the non-_TAGGED variants use the passed class name as tag. +template +int qRegisterNormalizedMetaType(const QT_PREPEND_NAMESPACE(QByteArray) &normalizedTypeName) +{ + return qRegisterNormalizedMetaTypeImplementation(normalizedTypeName); +} + +#define QT_DECL_METATYPE_EXTERN_TAGGED(TYPE, TAG, EXPORT) \ + QT_BEGIN_NAMESPACE \ + EXPORT int qRegisterNormalizedMetaType_ ## TAG (const QByteArray &); \ + template <> inline int qRegisterNormalizedMetaType< TYPE >(const QByteArray &name) \ + { return qRegisterNormalizedMetaType_ ## TAG (name); } \ + QT_END_NAMESPACE \ + Q_DECLARE_METATYPE(TYPE) \ + /* end */ +#define QT_IMPL_METATYPE_EXTERN_TAGGED(TYPE, TAG) \ + int qRegisterNormalizedMetaType_ ## TAG (const QByteArray &name) \ + { return qRegisterNormalizedMetaTypeImplementation< TYPE >(name); } \ + /* end */ +#define QT_DECL_METATYPE_EXTERN(TYPE, EXPORT) \ + QT_DECL_METATYPE_EXTERN_TAGGED(TYPE, TYPE, EXPORT) +#define QT_IMPL_METATYPE_EXTERN(TYPE) \ + QT_IMPL_METATYPE_EXTERN_TAGGED(TYPE, TYPE) + +template +int qRegisterMetaType(const char *typeName) +{ +#ifdef QT_NO_QOBJECT + QT_PREPEND_NAMESPACE(QByteArray) normalizedTypeName = typeName; +#else + QT_PREPEND_NAMESPACE(QByteArray) normalizedTypeName = QMetaObject::normalizedType(typeName); +#endif + return qRegisterNormalizedMetaType(normalizedTypeName); +} + +template +inline constexpr int qMetaTypeId() +{ + if constexpr (bool(QMetaTypeId2::IsBuiltIn)) { + // this has the same result as the below code, but avoids asking the + // compiler to load a global variable whose value we know at compile + // time + return QMetaTypeId2::MetaType; + } else { + return QMetaType::fromType().id(); + } +} + +template +inline constexpr int qRegisterMetaType() +{ + int id = qMetaTypeId(); + return id; +} + +inline int qRegisterMetaType(QMetaType meta) +{ + return meta.registerHelper(); +} + +#ifndef QT_NO_QOBJECT +template +struct QMetaTypeIdQObject +{ + enum { + Defined = 1 + }; + + static int qt_metatype_id() + { + Q_CONSTINIT static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); + if (const int id = metatype_id.loadAcquire()) + return id; + const char *const cName = T::staticMetaObject.className(); + QByteArray typeName; + typeName.reserve(strlen(cName) + 1); + typeName.append(cName).append('*'); + const int newId = qRegisterNormalizedMetaType(typeName); + metatype_id.storeRelease(newId); + return newId; + } +}; + +template +struct QMetaTypeIdQObject +{ + enum { + Defined = std::is_default_constructible::value + }; + + static int qt_metatype_id() + { + Q_CONSTINIT static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); + if (const int id = metatype_id.loadAcquire()) + return id; + const char *const cName = T::staticMetaObject.className(); + const int newId = qRegisterNormalizedMetaType(cName); + metatype_id.storeRelease(newId); + return newId; + } +}; + +template +struct QMetaTypeIdQObject +{ + enum { + Defined = 1 + }; + + static int qt_metatype_id() + { + Q_CONSTINIT static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); + if (const int id = metatype_id.loadAcquire()) + return id; + const char *const cName = T::staticMetaObject.className(); + QByteArray typeName; + typeName.reserve(strlen(cName) + 1); + typeName.append(cName).append('*'); + const int newId = qRegisterNormalizedMetaType(typeName); + metatype_id.storeRelease(newId); + return newId; + } +}; + +template +struct QMetaTypeIdQObject +{ + enum { + Defined = 1 + }; + + static int qt_metatype_id() + { + Q_CONSTINIT static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); + if (const int id = metatype_id.loadAcquire()) + return id; + const char *eName = qt_getEnumName(T()); + const char *cName = qt_getEnumMetaObject(T())->className(); + QByteArray typeName; + typeName.reserve(strlen(cName) + 2 + strlen(eName)); + typeName.append(cName).append("::").append(eName); + const int newId = qRegisterNormalizedMetaType(typeName); + metatype_id.storeRelease(newId); + return newId; + } +}; +#endif + +#define Q_DECLARE_OPAQUE_POINTER(POINTER) \ + QT_BEGIN_NAMESPACE namespace QtPrivate { \ + template <> struct IsPointerDeclaredOpaque \ + : std::true_type {}; \ + } QT_END_NAMESPACE \ + /**/ + +#ifndef Q_MOC_RUN +#define Q_DECLARE_METATYPE(TYPE) Q_DECLARE_METATYPE_IMPL(TYPE) +#define Q_DECLARE_METATYPE_IMPL(TYPE) \ + QT_BEGIN_NAMESPACE \ + template <> \ + struct QMetaTypeId< TYPE > \ + { \ + enum { Defined = 1 }; \ + static_assert(QtPrivate::checkTypeIsSuitableForMetaType()); \ + static int qt_metatype_id() \ + { \ + Q_CONSTINIT static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \ + if (const int id = metatype_id.loadAcquire()) \ + return id; \ + constexpr auto arr = QtPrivate::typenameHelper(); \ + auto name = arr.data(); \ + if (QByteArrayView(name) == (#TYPE)) { \ + const int id = qRegisterNormalizedMetaType(name); \ + metatype_id.storeRelease(id); \ + return id; \ + } \ + const int newId = qRegisterMetaType< TYPE >(#TYPE); \ + metatype_id.storeRelease(newId); \ + return newId; \ + } \ + }; \ + QT_END_NAMESPACE +#endif // Q_MOC_RUN + +#define Q_DECLARE_BUILTIN_METATYPE(TYPE, METATYPEID, NAME) \ + QT_BEGIN_NAMESPACE \ + template<> struct QMetaTypeId2 \ + { \ + using NameAsArrayType = std::array; \ + enum { Defined = 1, IsBuiltIn = true, MetaType = METATYPEID }; \ + static inline constexpr int qt_metatype_id() { return METATYPEID; } \ + static constexpr NameAsArrayType nameAsArray = { #NAME }; \ + }; \ + QT_END_NAMESPACE + +#define QT_FORWARD_DECLARE_STATIC_TYPES_ITER(TypeName, TypeId, Name) \ + class Name; + +QT_FOR_EACH_STATIC_CORE_CLASS(QT_FORWARD_DECLARE_STATIC_TYPES_ITER) +QT_FOR_EACH_STATIC_GUI_CLASS(QT_FORWARD_DECLARE_STATIC_TYPES_ITER) +QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_FORWARD_DECLARE_STATIC_TYPES_ITER) + +#undef QT_FORWARD_DECLARE_STATIC_TYPES_ITER + +#define Q_DECLARE_METATYPE_TEMPLATE_1ARG(SINGLE_ARG_TEMPLATE) \ +QT_BEGIN_NAMESPACE \ +template \ +struct QMetaTypeId< SINGLE_ARG_TEMPLATE > \ +{ \ + enum { \ + Defined = QMetaTypeId2::Defined \ + }; \ + static int qt_metatype_id() \ + { \ + Q_CONSTINIT static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \ + if (const int id = metatype_id.loadRelaxed()) \ + return id; \ + const char *tName = QMetaType::fromType().name(); \ + Q_ASSERT(tName); \ + const size_t tNameLen = qstrlen(tName); \ + QByteArray typeName; \ + typeName.reserve(sizeof(#SINGLE_ARG_TEMPLATE) + 1 + tNameLen + 1 + 1); \ + typeName.append(#SINGLE_ARG_TEMPLATE, int(sizeof(#SINGLE_ARG_TEMPLATE)) - 1) \ + .append('<').append(tName, tNameLen); \ + typeName.append('>'); \ + const int newId = qRegisterNormalizedMetaType< SINGLE_ARG_TEMPLATE >(typeName); \ + metatype_id.storeRelease(newId); \ + return newId; \ + } \ +}; \ +QT_END_NAMESPACE + +#define Q_DECLARE_METATYPE_TEMPLATE_2ARG(DOUBLE_ARG_TEMPLATE) \ +QT_BEGIN_NAMESPACE \ +template \ +struct QMetaTypeId< DOUBLE_ARG_TEMPLATE > \ +{ \ + enum { \ + Defined = QMetaTypeId2::Defined && QMetaTypeId2::Defined \ + }; \ + static int qt_metatype_id() \ + { \ + Q_CONSTINIT static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \ + if (const int id = metatype_id.loadAcquire()) \ + return id; \ + const char *tName = QMetaType::fromType().name(); \ + const char *uName = QMetaType::fromType().name(); \ + Q_ASSERT(tName); \ + Q_ASSERT(uName); \ + const size_t tNameLen = qstrlen(tName); \ + const size_t uNameLen = qstrlen(uName); \ + QByteArray typeName; \ + typeName.reserve(sizeof(#DOUBLE_ARG_TEMPLATE) + 1 + tNameLen + 1 + uNameLen + 1 + 1); \ + typeName.append(#DOUBLE_ARG_TEMPLATE, int(sizeof(#DOUBLE_ARG_TEMPLATE)) - 1) \ + .append('<').append(tName, tNameLen).append(',').append(uName, uNameLen); \ + typeName.append('>'); \ + const int newId = qRegisterNormalizedMetaType< DOUBLE_ARG_TEMPLATE >(typeName); \ + metatype_id.storeRelease(newId); \ + return newId; \ + } \ +}; \ +QT_END_NAMESPACE + +namespace QtPrivate { + +template +struct SharedPointerMetaTypeIdHelper +{ + enum { + Defined = 0 + }; + static int qt_metatype_id() + { + return -1; + } +}; + +} + +#define Q_DECLARE_SMART_POINTER_METATYPE(SMART_POINTER) \ +QT_BEGIN_NAMESPACE \ +namespace QtPrivate { \ +template \ +struct SharedPointerMetaTypeIdHelper, true> \ +{ \ + enum { \ + Defined = 1 \ + }; \ + static int qt_metatype_id() \ + { \ + Q_CONSTINIT static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \ + if (const int id = metatype_id.loadAcquire()) \ + return id; \ + const char * const cName = T::staticMetaObject.className(); \ + QByteArray typeName; \ + typeName.reserve(sizeof(#SMART_POINTER) + 1 + strlen(cName) + 1); \ + typeName.append(#SMART_POINTER, int(sizeof(#SMART_POINTER)) - 1) \ + .append('<').append(cName).append('>'); \ + const int newId = qRegisterNormalizedMetaType< SMART_POINTER >(typeName); \ + metatype_id.storeRelease(newId); \ + return newId; \ + } \ +}; \ +template \ +struct MetaTypeSmartPointerHelper , \ + typename std::enable_if::Value && !std::is_const_v>::type> \ +{ \ + static bool registerConverter() \ + { \ + const QMetaType to = QMetaType(QMetaType::QObjectStar); \ + if (!QMetaType::hasRegisteredConverterFunction(QMetaType::fromType>(), to)) { \ + QtPrivate::QSmartPointerConvertFunctor > o; \ + return QMetaType::registerConverter, QObject*>(o); \ + } \ + return true; \ + } \ +}; \ +} \ +template \ +struct QMetaTypeId< SMART_POINTER > \ + : QtPrivate::SharedPointerMetaTypeIdHelper< SMART_POINTER, \ + QtPrivate::IsPointerToTypeDerivedFromQObject::Value> \ +{ \ +};\ +QT_END_NAMESPACE + +#define Q_DECLARE_SEQUENTIAL_CONTAINER_METATYPE(SINGLE_ARG_TEMPLATE) \ + QT_BEGIN_NAMESPACE \ + namespace QtPrivate { \ + template \ + struct IsSequentialContainer > \ + { \ + enum { Value = true }; \ + }; \ + } \ + QT_END_NAMESPACE \ + Q_DECLARE_METATYPE_TEMPLATE_1ARG(SINGLE_ARG_TEMPLATE) + +#define Q_DECLARE_SEQUENTIAL_CONTAINER_METATYPE_ITER(TEMPLATENAME) \ + Q_DECLARE_SEQUENTIAL_CONTAINER_METATYPE(TEMPLATENAME) + +QT_END_NAMESPACE + +QT_FOR_EACH_AUTOMATIC_TEMPLATE_1ARG(Q_DECLARE_SEQUENTIAL_CONTAINER_METATYPE_ITER) + +#undef Q_DECLARE_SEQUENTIAL_CONTAINER_METATYPE_ITER + +Q_DECLARE_SEQUENTIAL_CONTAINER_METATYPE(std::vector) +Q_DECLARE_SEQUENTIAL_CONTAINER_METATYPE(std::list) + +#define Q_DECLARE_ASSOCIATIVE_CONTAINER_METATYPE(TEMPLATENAME) \ + QT_BEGIN_NAMESPACE \ + namespace QtPrivate { \ + template \ + struct IsAssociativeContainer > \ + { \ + enum { Value = true }; \ + }; \ + } \ + QT_END_NAMESPACE \ + Q_DECLARE_METATYPE_TEMPLATE_2ARG(TEMPLATENAME) + +Q_DECLARE_ASSOCIATIVE_CONTAINER_METATYPE(QHash) +Q_DECLARE_ASSOCIATIVE_CONTAINER_METATYPE(QMap) +Q_DECLARE_ASSOCIATIVE_CONTAINER_METATYPE(std::map) + +Q_DECLARE_METATYPE_TEMPLATE_2ARG(std::pair) + +#define Q_DECLARE_METATYPE_TEMPLATE_SMART_POINTER_ITER(TEMPLATENAME) \ + Q_DECLARE_SMART_POINTER_METATYPE(TEMPLATENAME) + +QT_FOR_EACH_AUTOMATIC_TEMPLATE_SMART_POINTER(Q_DECLARE_METATYPE_TEMPLATE_SMART_POINTER_ITER) + +QT_BEGIN_NAMESPACE + +#undef Q_DECLARE_METATYPE_TEMPLATE_SMART_POINTER_ITER + +QT_END_NAMESPACE + +QT_FOR_EACH_STATIC_TYPE(Q_DECLARE_BUILTIN_METATYPE) + + +QT_BEGIN_NAMESPACE + +namespace QtPrivate { +// out-of-line helpers to reduce template code bloat ("SCARY") and improve compile times: +Q_CORE_EXPORT bool hasRegisteredConverterFunctionToPairVariantInterface(QMetaType m); +Q_CORE_EXPORT bool hasRegisteredConverterFunctionToIterableMetaSequence(QMetaType m); +Q_CORE_EXPORT bool hasRegisteredMutableViewFunctionToIterableMetaSequence(QMetaType m); +Q_CORE_EXPORT bool hasRegisteredConverterFunctionToIterableMetaAssociation(QMetaType m); +Q_CORE_EXPORT bool hasRegisteredMutableViewFunctionToIterableMetaAssociation(QMetaType m); +} + +template +inline bool QtPrivate::IsMetaTypePair::registerConverter() +{ + if (!QtPrivate::hasRegisteredConverterFunctionToPairVariantInterface(QMetaType::fromType())) { + QtMetaTypePrivate::QPairVariantInterfaceConvertFunctor o; + return QMetaType::registerConverter(o); + } + return true; +} + +namespace QtPrivate { + +template +struct QSequentialIterableConvertFunctor +{ + QIterable operator()(const From &f) const + { + return QIterable(QMetaSequence::fromContainer(), &f); + } +}; + +template +struct QSequentialIterableMutableViewFunctor +{ + QIterable operator()(From &f) const + { + return QIterable(QMetaSequence::fromContainer(), &f); + } +}; + +template +struct SequentialValueTypeIsMetaType +{ + static bool registerConverter() + { + if (!QtPrivate::hasRegisteredConverterFunctionToIterableMetaSequence(QMetaType::fromType())) { + QSequentialIterableConvertFunctor o; + return QMetaType::registerConverter>(o); + } + return true; + } + + static bool registerMutableView() + { + if (!QtPrivate::hasRegisteredMutableViewFunctionToIterableMetaSequence(QMetaType::fromType())) { + QSequentialIterableMutableViewFunctor o; + return QMetaType::registerMutableView>(o); + } + return true; + } +}; + +template +struct QAssociativeIterableConvertFunctor +{ + QIterable operator()(const From &f) const + { + return QIterable(QMetaAssociation::fromContainer(), &f); + } +}; + +template +struct QAssociativeIterableMutableViewFunctor +{ + QIterable operator()(From &f) const + { + return QIterable(QMetaAssociation::fromContainer(), &f); + } +}; + +// Mapped type can be omitted, for example in case of a set. +// However, if it is available, we want to instantiate the metatype here. +template +struct AssociativeKeyTypeIsMetaType : AssociativeMappedTypeIsMetaType +{ + static bool registerConverter() + { + if (!QtPrivate::hasRegisteredConverterFunctionToIterableMetaAssociation(QMetaType::fromType())) { + QAssociativeIterableConvertFunctor o; + return QMetaType::registerConverter>(o); + } + return true; + } + + static bool registerMutableView() + { + if (!QtPrivate::hasRegisteredMutableViewFunctionToIterableMetaAssociation(QMetaType::fromType())) { + QAssociativeIterableMutableViewFunctor o; + return QMetaType::registerMutableView>(o); + } + return true; + } +}; + +struct QTypeNormalizer +{ + char *output; + int len = 0; + char last = 0; + +private: + static constexpr bool is_ident_char(char s) + { + return ((s >= 'a' && s <= 'z') || (s >= 'A' && s <= 'Z') || (s >= '0' && s <= '9') + || s == '_'); + } + static constexpr bool is_space(char s) { return (s == ' ' || s == '\t' || s == '\n'); } + static constexpr bool is_number(char s) { return s >= '0' && s <= '9'; } + static constexpr bool starts_with_token(const char *b, const char *e, const char *token, + bool msvcKw = false) + { + while (b != e && *token && *b == *token) { + b++; + token++; + } + if (*token) + return false; +#ifdef Q_CC_MSVC + /// On MSVC, keywords like class or struct are not separated with spaces in constexpr + /// context + if (msvcKw && !is_ident_char(*b)) + return true; +#endif + Q_UNUSED(msvcKw); + return b == e || !is_ident_char(*b); + } + static constexpr bool skipToken(const char *&x, const char *e, const char *token, + bool msvcKw = false) + { + if (!starts_with_token(x, e, token, msvcKw)) + return false; + while (*token++) + x++; + while (x != e && is_space(*x)) + x++; + return true; + } + static constexpr const char *skipString(const char *x, const char *e) + { + char delim = *x; + x++; + while (x != e && *x != delim) { + if (*x == '\\') { + x++; + if (x == e) + return e; + } + x++; + } + if (x != e) + x++; + return x; + } + static constexpr const char *skipTemplate(const char *x, const char *e, bool stopAtComa = false) + { + int scopeDepth = 0; + int templateDepth = 0; + while (x != e) { + switch (*x) { + case '<': + if (!scopeDepth) + templateDepth++; + break; + case ',': + if (stopAtComa && !scopeDepth && !templateDepth) + return x; + break; + case '>': + if (!scopeDepth) + if (--templateDepth < 0) + return x; + break; + case '(': + case '[': + case '{': + scopeDepth++; + break; + case '}': + case ']': + case ')': + scopeDepth--; + break; + case '\'': + if (is_number(x[-1])) + break; + Q_FALLTHROUGH(); + case '\"': + x = skipString(x, e); + continue; + } + x++; + } + return x; + } + + constexpr void append(char x) + { + last = x; + len++; + if (output) + *output++ = x; + } + + constexpr void replaceLast(char x) + { + last = x; + if (output) + *(output - 1) = x; + } + + constexpr void appendStr(const char *x) + { + while (*x) + append(*x++); + } + + constexpr void normalizeIntegerTypes(const char *&begin, const char *end) + { + int numLong = 0; + int numSigned = 0; + int numUnsigned = 0; + int numInt = 0; + int numShort = 0; + int numChar = 0; + while (begin < end) { + if (skipToken(begin, end, "long")) { + numLong++; + continue; + } + if (skipToken(begin, end, "int")) { + numInt++; + continue; + } + if (skipToken(begin, end, "short")) { + numShort++; + continue; + } + if (skipToken(begin, end, "unsigned")) { + numUnsigned++; + continue; + } + if (skipToken(begin, end, "signed")) { + numSigned++; + continue; + } + if (skipToken(begin, end, "char")) { + numChar++; + continue; + } +#ifdef Q_CC_MSVC + if (skipToken(begin, end, "__int64")) { + numLong = 2; + continue; + } +#endif + break; + } + if (numLong == 2) + append('q'); // q(u)longlong + if (numSigned && numChar) + appendStr("signed "); + else if (numUnsigned) + appendStr("u"); + if (numChar) + appendStr("char"); + else if (numShort) + appendStr("short"); + else if (numLong == 1) + appendStr("long"); + else if (numLong == 2) + appendStr("longlong"); + else if (numUnsigned || numSigned || numInt) + appendStr("int"); + } + + constexpr void skipStructClassOrEnum(const char *&begin, const char *end) + { + // discard 'struct', 'class', and 'enum'; they are optional + // and we don't want them in the normalized signature + skipToken(begin, end, "struct", true) || skipToken(begin, end, "class", true) + || skipToken(begin, end, "enum", true); + } + + constexpr void skipQtNamespace(const char *&begin, const char *end) + { +#ifdef QT_NAMESPACE + const char *nsbeg = begin; + if (skipToken(nsbeg, end, QT_STRINGIFY(QT_NAMESPACE)) && nsbeg + 2 < end && nsbeg[0] == ':' + && nsbeg[1] == ':') { + begin = nsbeg + 2; + while (begin != end && is_space(*begin)) + begin++; + } +#else + Q_UNUSED(begin); + Q_UNUSED(end); +#endif + } + +public: +#if defined(Q_CC_CLANG) || defined (Q_CC_GNU) + // this is much simpler than the full type normalization below + // the reason is that the signature returned by Q_FUNC_INFO is already + // normalized to the largest degree, and we need to do only small adjustments + constexpr int normalizeTypeFromSignature(const char *begin, const char *end) + { + // bail out if there is an anonymous struct + std::string_view name(begin, end-begin); +#if defined (Q_CC_CLANG) + if (name.find("anonymous ") != std::string_view::npos) + return normalizeType(begin, end); +#endif + if (name.find("unnamed ") != std::string_view::npos) + return normalizeType(begin, end); + while (begin < end) { + if (*begin == ' ') { + if (last == ',' || last == '>' || last == '<' || last == '*' || last == '&') { + ++begin; + continue; + } + } + if (last == ' ') { + if (*begin == '*' || *begin == '&' || *begin == '(') { + replaceLast(*begin); + ++begin; + continue; + } + } + if (!is_ident_char(last)) { + skipStructClassOrEnum(begin, end); + if (begin == end) + break; + + skipQtNamespace(begin, end); + if (begin == end) + break; + + normalizeIntegerTypes(begin, end); + if (begin == end) + break; + } + append(*begin); + ++begin; + } + return len; + } +#else + // MSVC needs the full normalization, as it puts the const in a different + // place than we expect + constexpr int normalizeTypeFromSignature(const char *begin, const char *end) + { return normalizeType(begin, end); } +#endif + + constexpr int normalizeType(const char *begin, const char *end, bool adjustConst = true) + { + // Trim spaces + while (begin != end && is_space(*begin)) + begin++; + while (begin != end && is_space(*(end - 1))) + end--; + + // Convert 'char const *' into 'const char *'. Start at index 1, + // not 0, because 'const char *' is already OK. + const char *cst = begin + 1; + if (*begin == '\'' || *begin == '"') + cst = skipString(begin, end); + bool seenStar = false; + bool hasMiddleConst = false; + while (cst < end) { + if (*cst == '\"' || (*cst == '\'' && !is_number(cst[-1]))) { + cst = skipString(cst, end); + if (cst == end) + break; + } + + // We mustn't convert 'char * const *' into 'const char **' + // and we must beware of 'Bar'. + if (*cst == '&' || *cst == '*' || *cst == '[') { + seenStar = *cst != '&' || cst != (end - 1); + break; + } + if (*cst == '<') { + cst = skipTemplate(cst + 1, end); + if (cst == end) + break; + } + cst++; + const char *skipedCst = cst; + if (!is_ident_char(*(cst - 1)) && skipToken(skipedCst, end, "const")) { + const char *testEnd = end; + while (skipedCst < testEnd--) { + if (*testEnd == '*' || *testEnd == '[' + || (*testEnd == '&' && testEnd != (end - 1))) { + seenStar = true; + break; + } + if (*testEnd == '>') + break; + } + if (adjustConst && !seenStar) { + if (*(end - 1) == '&') + end--; + } else { + appendStr("const "); + } + normalizeType(begin, cst, false); + begin = skipedCst; + hasMiddleConst = true; + break; + } + } + if (skipToken(begin, end, "const")) { + if (adjustConst && !seenStar) { + if (*(end - 1) == '&') + end--; + } else { + appendStr("const "); + } + } + if (seenStar && adjustConst) { + const char *e = end; + if (*(end - 1) == '&' && *(end - 2) != '&') + e--; + while (begin != e && is_space(*(e - 1))) + e--; + const char *token = "tsnoc"; // 'const' reverse, to check if it ends with const + while (*token && begin != e && *(--e) == *token++) + ; + if (!*token && begin != e && !is_ident_char(*(e - 1))) { + while (begin != e && is_space(*(e - 1))) + e--; + end = e; + } + } + + skipStructClassOrEnum(begin, end); + skipQtNamespace(begin, end); + + if (skipToken(begin, end, "QVector")) { + // Replace QVector by QList + appendStr("QList"); + } + + if (skipToken(begin, end, "QPair")) { + // replace QPair by std::pair + appendStr("std::pair"); + } + + if (!hasMiddleConst) + // Normalize the integer types + normalizeIntegerTypes(begin, end); + + bool spaceSkiped = true; + while (begin != end) { + char c = *begin++; + if (is_space(c)) { + spaceSkiped = true; + } else if ((c == '\'' && !is_number(last)) || c == '\"') { + begin--; + auto x = skipString(begin, end); + while (begin < x) + append(*begin++); + } else { + if (spaceSkiped && is_ident_char(last) && is_ident_char(c)) + append(' '); + append(c); + spaceSkiped = false; + if (c == '<') { + do { + // template recursion + const char *tpl = skipTemplate(begin, end, true); + normalizeType(begin, tpl, false); + if (tpl == end) + return len; + append(*tpl); + begin = tpl; + } while (*begin++ == ','); + } + } + } + return len; + } +}; + +// Normalize the type between begin and end, and store the data in the output. Returns the length. +// The idea is to first run this function with nullptr as output to allocate the output with the +// size +constexpr int qNormalizeType(const char *begin, const char *end, char *output) +{ + return QTypeNormalizer { output }.normalizeType(begin, end); +} + +template +struct is_std_pair : std::false_type {}; + +template +struct is_std_pair> : std::true_type { + using T1 = T1_; + using T2 = T2_; +}; + +namespace TypeNameHelper { +template +constexpr auto typenameHelper() +{ + if constexpr (is_std_pair::value) { + using T1 = typename is_std_pair::T1; + using T2 = typename is_std_pair::T2; + std::remove_const_t::IsBuiltIn), typename QMetaTypeId2::NameAsArrayType, decltype(typenameHelper())>> t1Name {}; + std::remove_const_t::IsBuiltIn), typename QMetaTypeId2::NameAsArrayType, decltype(typenameHelper())>> t2Name {}; + if constexpr (bool (QMetaTypeId2::IsBuiltIn) ) { + t1Name = QMetaTypeId2::nameAsArray; + } else { + t1Name = typenameHelper(); + } + if constexpr (bool(QMetaTypeId2::IsBuiltIn)) { + t2Name = QMetaTypeId2::nameAsArray; + } else { + t2Name = typenameHelper(); + } + constexpr auto nonTypeDependentLen = sizeof("std::pair<,>"); + constexpr auto t1Len = t1Name.size() - 1; + constexpr auto t2Len = t2Name.size() - 1; + constexpr auto length = nonTypeDependentLen + t1Len + t2Len; + std::array result {}; + constexpr auto prefix = "std::pair<"; + int currentLength = 0; + for (; currentLength < int(sizeof("std::pair<") - 1); ++currentLength) + result[currentLength] = prefix[currentLength]; + for (int i = 0; i < int(t1Len); ++currentLength, ++i) + result[currentLength] = t1Name[i]; + result[currentLength++] = ','; + for (int i = 0; i < int(t2Len); ++currentLength, ++i) + result[currentLength] = t2Name[i]; + result[currentLength++] = '>'; + result[currentLength++] = '\0'; + return result; + } else { + constexpr auto prefix = sizeof( +#ifdef QT_NAMESPACE + QT_STRINGIFY(QT_NAMESPACE) "::" +#endif +#if defined(Q_CC_MSVC) && defined(Q_CC_CLANG) + "auto __cdecl QtPrivate::TypeNameHelper::typenameHelper(void) [T = " +#elif defined(Q_CC_MSVC) + "auto __cdecl QtPrivate::TypeNameHelper::typenameHelper<" +#elif defined(Q_CC_CLANG) + "auto QtPrivate::TypeNameHelper::typenameHelper() [T = " +#elif defined(Q_CC_GHS) + "auto QtPrivate::TypeNameHelper::typenameHelper()[with T=" +#else + "constexpr auto QtPrivate::TypeNameHelper::typenameHelper() [with T = " +#endif + ) - 1; +#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG) + constexpr int suffix = sizeof(">(void)"); +#else + constexpr int suffix = sizeof("]"); +#endif + +#if defined(Q_CC_GNU_ONLY) && Q_CC_GNU_ONLY < 804 + auto func = Q_FUNC_INFO; + const char *begin = func + prefix; + const char *end = func + sizeof(Q_FUNC_INFO) - suffix; + // This is an upper bound of the size since the normalized signature should always be smaller + constexpr int len = sizeof(Q_FUNC_INFO) - suffix - prefix; +#else + constexpr auto func = Q_FUNC_INFO; + constexpr const char *begin = func + prefix; + constexpr const char *end = func + sizeof(Q_FUNC_INFO) - suffix; + constexpr int len = QTypeNormalizer{ nullptr }.normalizeTypeFromSignature(begin, end); +#endif + std::array result {}; + QTypeNormalizer{ result.data() }.normalizeTypeFromSignature(begin, end); + return result; + } +} +} // namespace TypeNameHelper +using TypeNameHelper::typenameHelper; + +template +struct BuiltinMetaType : std::integral_constant +{ +}; +template +struct BuiltinMetaType::IsBuiltIn>> + : std::integral_constant::MetaType> +{ +}; + +template && !std::is_pointer_v)> +struct QEqualityOperatorForType +{ +QT_WARNING_PUSH +QT_WARNING_DISABLE_FLOAT_COMPARE + static bool equals(const QMetaTypeInterface *, const void *a, const void *b) + { return *reinterpret_cast(a) == *reinterpret_cast(b); } +QT_WARNING_POP +}; + +template +struct QEqualityOperatorForType +{ + static constexpr QMetaTypeInterface::EqualsFn equals = nullptr; +}; + +template && !std::is_pointer_v)> +struct QLessThanOperatorForType +{ + static bool lessThan(const QMetaTypeInterface *, const void *a, const void *b) + { return *reinterpret_cast(a) < *reinterpret_cast(b); } +}; + +template +struct QLessThanOperatorForType +{ + static constexpr QMetaTypeInterface::LessThanFn lessThan = nullptr; +}; + +template && !std::is_pointer_v)> +struct QDebugStreamOperatorForType +{ + static void debugStream(const QMetaTypeInterface *, QDebug &dbg, const void *a) + { dbg << *reinterpret_cast(a); } +}; + +template +struct QDebugStreamOperatorForType +{ + static constexpr QMetaTypeInterface::DebugStreamFn debugStream = nullptr; +}; + +template> +struct QDataStreamOperatorForType +{ + static constexpr QMetaTypeInterface::DataStreamOutFn dataStreamOut = nullptr; + static constexpr QMetaTypeInterface::DataStreamInFn dataStreamIn = nullptr; +}; + +#ifndef QT_NO_DATASTREAM +template +struct QDataStreamOperatorForType +{ + static void dataStreamOut(const QMetaTypeInterface *, QDataStream &ds, const void *a) + { ds << *reinterpret_cast(a); } + static void dataStreamIn(const QMetaTypeInterface *, QDataStream &ds, void *a) + { ds >> *reinterpret_cast(a); } +}; +#endif + +// Performance optimization: +// +// Don't add all these symbols to the dynamic symbol tables on ELF systems and +// on Darwin. Each library is going to have a copy anyway and QMetaType already +// copes with some of these being "hidden" (see QMetaType::idHelper()). We may +// as well let the linker know it can always use the local copy. +// +// This is currently not enabled for GCC due to +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106023 + +#if !defined(Q_OS_WIN) && defined(Q_CC_CLANG) +# pragma GCC visibility push(hidden) +#endif + +template +class QMetaTypeForType +{ +public: + static constexpr decltype(typenameHelper()) name = typenameHelper(); + static constexpr unsigned Flags = QMetaTypeTypeFlags::Flags; + + static constexpr QMetaTypeInterface::DefaultCtrFn getDefaultCtr() + { + if constexpr (std::is_default_constructible_v && !QTypeInfo::isValueInitializationBitwiseZero) { + return [](const QMetaTypeInterface *, void *addr) { new (addr) S(); }; + } else { + return nullptr; + } + } + + static constexpr QMetaTypeInterface::CopyCtrFn getCopyCtr() + { + if constexpr (std::is_copy_constructible_v && !std::is_trivially_copy_constructible_v) { + return [](const QMetaTypeInterface *, void *addr, const void *other) { + new (addr) S(*reinterpret_cast(other)); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaTypeInterface::MoveCtrFn getMoveCtr() + { + if constexpr (std::is_move_constructible_v && !std::is_trivially_move_constructible_v) { + return [](const QMetaTypeInterface *, void *addr, void *other) { + new (addr) S(std::move(*reinterpret_cast(other))); + }; + } else { + return nullptr; + } + } + + static constexpr QMetaTypeInterface::DtorFn getDtor() + { + if constexpr (std::is_destructible_v && !std::is_trivially_destructible_v) + return [](const QMetaTypeInterface *, void *addr) { + reinterpret_cast(addr)->~S(); + }; + else + return nullptr; + } + + static constexpr QMetaTypeInterface::LegacyRegisterOp getLegacyRegister() + { + if constexpr (QMetaTypeId2::Defined && !QMetaTypeId2::IsBuiltIn) { + return []() { QMetaTypeId2::qt_metatype_id(); }; + } else { + return nullptr; + } + } + + static constexpr const char *getName() + { + if constexpr (bool(QMetaTypeId2::IsBuiltIn)) { + return QMetaTypeId2::nameAsArray.data(); + } else { + return name.data(); + } + } +}; + +template +struct QMetaTypeInterfaceWrapper +{ + // if the type ID for T is known at compile-time, then we can declare + // the QMetaTypeInterface object const; otherwise, we declare it as + // non-const and the .typeId is updated by QMetaType::idHelper(). + static constexpr bool IsConstMetaTypeInterface = !!BuiltinMetaType::value; + using InterfaceType = std::conditional_t; + + static inline InterfaceType metaType = { + /*.revision=*/ QMetaTypeInterface::CurrentRevision, + /*.alignment=*/ alignof(T), + /*.size=*/ sizeof(T), + /*.flags=*/ QMetaTypeForType::Flags, + /*.typeId=*/ BuiltinMetaType::value, + /*.metaObjectFn=*/ MetaObjectForType::metaObjectFunction, + /*.name=*/ QMetaTypeForType::getName(), + /*.defaultCtr=*/ QMetaTypeForType::getDefaultCtr(), + /*.copyCtr=*/ QMetaTypeForType::getCopyCtr(), + /*.moveCtr=*/ QMetaTypeForType::getMoveCtr(), + /*.dtor=*/ QMetaTypeForType::getDtor(), + /*.equals=*/ QEqualityOperatorForType::equals, + /*.lessThan=*/ QLessThanOperatorForType::lessThan, + /*.debugStream=*/ QDebugStreamOperatorForType::debugStream, + /*.dataStreamOut=*/ QDataStreamOperatorForType::dataStreamOut, + /*.dataStreamIn=*/ QDataStreamOperatorForType::dataStreamIn, + /*.legacyRegisterOp=*/ QMetaTypeForType::getLegacyRegister() + }; +}; + +#if !defined(Q_OS_WIN) && defined(Q_CC_CLANG) +# pragma GCC visibility pop +#endif + +template<> +class QMetaTypeInterfaceWrapper +{ +public: + static constexpr QMetaTypeInterface metaType = + { + /*.revision=*/ 0, + /*.alignment=*/ 0, + /*.size=*/ 0, + /*.flags=*/ 0, + /*.typeId=*/ BuiltinMetaType::value, + /*.metaObjectFn=*/ nullptr, + /*.name=*/ "void", + /*.defaultCtr=*/ nullptr, + /*.copyCtr=*/ nullptr, + /*.moveCtr=*/ nullptr, + /*.dtor=*/ nullptr, + /*.equals=*/ nullptr, + /*.lessThan=*/ nullptr, + /*.debugStream=*/ nullptr, + /*.dataStreamOut=*/ nullptr, + /*.dataStreamIn=*/ nullptr, + /*.legacyRegisterOp=*/ nullptr + }; +}; + +/* + MSVC instantiates extern templates +(https://developercommunity.visualstudio.com/t/c11-extern-templates-doesnt-work-for-class-templat/157868) + + The INTEGRITY compiler apparently does too. + + On Windows (with other compilers or whenever MSVC is fixed), we can't declare + QMetaTypeInterfaceWrapper with __declspec(dllimport) because taking its + address is not a core constant expression. + */ +#if !defined(QT_BOOTSTRAPPED) && !defined(Q_CC_MSVC) && !defined(Q_OS_INTEGRITY) + +#ifdef QT_NO_DATA_RELOCATION +# define QT_METATYPE_DECLARE_EXTERN_TEMPLATE_ITER(TypeName, Id, Name) \ + extern template class Q_CORE_EXPORT QMetaTypeForType; +#else +# define QT_METATYPE_DECLARE_EXTERN_TEMPLATE_ITER(TypeName, Id, Name) \ + extern template class Q_CORE_EXPORT QMetaTypeForType; \ + extern template struct Q_CORE_EXPORT QMetaTypeInterfaceWrapper; +#endif + +QT_FOR_EACH_STATIC_PRIMITIVE_NON_VOID_TYPE(QT_METATYPE_DECLARE_EXTERN_TEMPLATE_ITER) +QT_FOR_EACH_STATIC_PRIMITIVE_POINTER(QT_METATYPE_DECLARE_EXTERN_TEMPLATE_ITER) +QT_FOR_EACH_STATIC_CORE_CLASS(QT_METATYPE_DECLARE_EXTERN_TEMPLATE_ITER) +QT_FOR_EACH_STATIC_CORE_POINTER(QT_METATYPE_DECLARE_EXTERN_TEMPLATE_ITER) +QT_FOR_EACH_STATIC_CORE_TEMPLATE(QT_METATYPE_DECLARE_EXTERN_TEMPLATE_ITER) +#undef QT_METATYPE_DECLARE_EXTERN_TEMPLATE_ITER +#endif + +template +struct qRemovePointerLike +{ + using type = std::remove_pointer_t; +}; + +#define Q_REMOVE_POINTER_LIKE_IMPL(Pointer) \ +template \ +struct qRemovePointerLike> \ +{ \ + using type = T; \ +}; + +QT_FOR_EACH_AUTOMATIC_TEMPLATE_SMART_POINTER(Q_REMOVE_POINTER_LIKE_IMPL) +template +using qRemovePointerLike_t = typename qRemovePointerLike::type; +#undef Q_REMOVE_POINTER_LIKE_IMPL + +template +struct TypeAndForceComplete +{ + using type = T; + using ForceComplete = ForceComplete_; +}; + +template +constexpr const QMetaTypeInterface *qMetaTypeInterfaceForType() +{ + // don't check the type is suitable here + using Ty = typename MetatypeDecay::type; + return &QMetaTypeInterfaceWrapper::metaType; +} + +template +constexpr const QMetaTypeInterface *qTryMetaTypeInterfaceForType() +{ + using T = typename TypeCompletePair::type; + using ForceComplete = typename TypeCompletePair::ForceComplete; + using Ty = typename MetatypeDecay::type; + using Tz = qRemovePointerLike_t; + + if constexpr (std::is_void_v) { + // early out to avoid expanding the rest of the templates + return &QMetaTypeInterfaceWrapper::metaType; + } else if constexpr (ForceComplete::value) { + checkTypeIsSuitableForMetaType(); + return &QMetaTypeInterfaceWrapper::metaType; + } else if constexpr (std::is_reference_v) { + return nullptr; + } else if constexpr (!is_complete::value) { + return nullptr; + } else { + // don't check the type is suitable here + return &QMetaTypeInterfaceWrapper::metaType; + } +} + +} // namespace QtPrivate + +template +constexpr QMetaType QMetaType::fromType() +{ + QtPrivate::checkTypeIsSuitableForMetaType(); + return QMetaType(QtPrivate::qMetaTypeInterfaceForType()); +} + +constexpr qsizetype QMetaType::sizeOf() const +{ + return d_ptr ? d_ptr->size : 0; +} + +constexpr qsizetype QMetaType::alignOf() const +{ + return d_ptr ? d_ptr->alignment : 0; +} + +constexpr QMetaType::TypeFlags QMetaType::flags() const +{ + return d_ptr ? TypeFlags(d_ptr->flags) : TypeFlags{}; +} + +constexpr const QMetaObject *QMetaType::metaObject() const +{ + return d_ptr && d_ptr->metaObjectFn ? d_ptr->metaObjectFn(d_ptr) : nullptr; +} + +template +constexpr const QtPrivate::QMetaTypeInterface *const qt_metaTypeArray[] = { + /* + Unique in qTryMetaTypeInterfaceForType does not have to be unique here + as we require _all_ types here to be actually complete. + We just want to have the additional type processing that exist in + QtPrivate::qTryMetaTypeInterfaceForType as opposed to the normal + QtPrivate::qMetaTypeInterfaceForType used in QMetaType::fromType + */ + QtPrivate::qTryMetaTypeInterfaceForType>()... +}; + +constexpr const char *QMetaType::name() const +{ + return d_ptr ? d_ptr->name : nullptr; +} + +template +constexpr const QtPrivate::QMetaTypeInterface *const qt_incomplete_metaTypeArray[] = { + QtPrivate::qTryMetaTypeInterfaceForType()... +}; + +inline size_t qHash(QMetaType type, size_t seed = 0) +{ + // We cannot use d_ptr here since the same type in different DLLs + // might result in different pointers! + return qHash(type.id(), seed); +} + +QT_END_NAMESPACE + +QT_DECL_METATYPE_EXTERN_TAGGED(QtMetaTypePrivate::QPairVariantInterfaceImpl, + QPairVariantInterfaceImpl, Q_CORE_EXPORT) + +#endif // QMETATYPE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qmimedata.h b/qt/6.8.1/msvc2022_64/include/QtCore/qmimedata.h new file mode 100644 index 0000000000000000000000000000000000000000..890c31f077c73b0ca83d5468fc3072361b7d3343 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qmimedata.h @@ -0,0 +1,61 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QMIMEDATA_H +#define QMIMEDATA_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QUrl; +class QMimeDataPrivate; + +class Q_CORE_EXPORT QMimeData : public QObject +{ + Q_OBJECT +public: + QMimeData(); + ~QMimeData(); + + QList urls() const; + void setUrls(const QList &urls); + bool hasUrls() const; + + QString text() const; + void setText(const QString &text); + bool hasText() const; + + QString html() const; + void setHtml(const QString &html); + bool hasHtml() const; + + QVariant imageData() const; + void setImageData(const QVariant &image); + bool hasImage() const; + + QVariant colorData() const; + void setColorData(const QVariant &color); + bool hasColor() const; + + QByteArray data(const QString &mimetype) const; + void setData(const QString &mimetype, const QByteArray &data); + void removeFormat(const QString &mimetype); + + virtual bool hasFormat(const QString &mimetype) const; + virtual QStringList formats() const; + + void clear(); + +protected: + virtual QVariant retrieveData(const QString &mimetype, QMetaType preferredType) const; + +private: + Q_DISABLE_COPY(QMimeData) + Q_DECLARE_PRIVATE(QMimeData) +}; + +QT_END_NAMESPACE + +#endif // QMIMEDATA_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qmimedatabase.h b/qt/6.8.1/msvc2022_64/include/QtCore/qmimedatabase.h new file mode 100644 index 0000000000000000000000000000000000000000..4519c4d0a2ff59210ee81eaf5339a6b55510b236 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qmimedatabase.h @@ -0,0 +1,59 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2015 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QMIMEDATABASE_H +#define QMIMEDATABASE_H + +#include + +QT_REQUIRE_CONFIG(mimetype); + +#include + +QT_BEGIN_NAMESPACE + +class QByteArray; +class QFileInfo; +class QIODevice; +class QUrl; + +class QMimeDatabasePrivate; +class Q_CORE_EXPORT QMimeDatabase +{ + Q_DISABLE_COPY(QMimeDatabase) + +public: + QMimeDatabase(); + ~QMimeDatabase(); + + QMimeType mimeTypeForName(const QString &nameOrAlias) const; + + enum MatchMode { + MatchDefault = 0x0, + MatchExtension = 0x1, + MatchContent = 0x2 + }; + + QMimeType mimeTypeForFile(const QString &fileName, MatchMode mode = MatchDefault) const; + QMimeType mimeTypeForFile(const QFileInfo &fileInfo, MatchMode mode = MatchDefault) const; + QList mimeTypesForFileName(const QString &fileName) const; + + QMimeType mimeTypeForData(const QByteArray &data) const; + QMimeType mimeTypeForData(QIODevice *device) const; + + QMimeType mimeTypeForUrl(const QUrl &url) const; + QMimeType mimeTypeForFileNameAndData(const QString &fileName, QIODevice *device) const; + QMimeType mimeTypeForFileNameAndData(const QString &fileName, const QByteArray &data) const; + + QString suffixForFileName(const QString &fileName) const; + + QList allMimeTypes() const; + +private: + QMimeDatabasePrivate *d; +}; + +QT_END_NAMESPACE + +#endif // QMIMEDATABASE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qmimetype.h b/qt/6.8.1/msvc2022_64/include/QtCore/qmimetype.h new file mode 100644 index 0000000000000000000000000000000000000000..efb179c47f3e68874ead3e76b582d4e36f50dc4b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qmimetype.h @@ -0,0 +1,104 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2015 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QMIMETYPE_H +#define QMIMETYPE_H + +#include + +QT_REQUIRE_CONFIG(mimetype); + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QMimeTypePrivate; +class QMimeType; + +Q_CORE_EXPORT size_t qHash(const QMimeType &key, size_t seed = 0) noexcept; + +class Q_CORE_EXPORT QMimeType +{ + Q_GADGET + Q_PROPERTY(bool valid READ isValid CONSTANT) + Q_PROPERTY(bool isDefault READ isDefault CONSTANT) + Q_PROPERTY(QString name READ name CONSTANT) + Q_PROPERTY(QString comment READ comment CONSTANT) + Q_PROPERTY(QString genericIconName READ genericIconName CONSTANT) + Q_PROPERTY(QString iconName READ iconName CONSTANT) + Q_PROPERTY(QStringList globPatterns READ globPatterns CONSTANT) + Q_PROPERTY(QStringList parentMimeTypes READ parentMimeTypes CONSTANT) + Q_PROPERTY(QStringList allAncestors READ allAncestors CONSTANT) + Q_PROPERTY(QStringList aliases READ aliases CONSTANT) + Q_PROPERTY(QStringList suffixes READ suffixes CONSTANT) + Q_PROPERTY(QString preferredSuffix READ preferredSuffix CONSTANT) + Q_PROPERTY(QString filterString READ filterString CONSTANT) + +public: + QMimeType(); + QMimeType(const QMimeType &other); + QMimeType &operator=(const QMimeType &other); + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QMimeType) + void swap(QMimeType &other) noexcept + { + d.swap(other.d); + } + explicit QMimeType(const QMimeTypePrivate &dd); + ~QMimeType(); +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator==(const QMimeType &other) const; + + inline bool operator!=(const QMimeType &other) const + { + return !operator==(other); + } +#endif + bool isValid() const; + + bool isDefault() const; + + QString name() const; + QString comment() const; + QString genericIconName() const; + QString iconName() const; + QStringList globPatterns() const; + QStringList parentMimeTypes() const; + QStringList allAncestors() const; + QStringList aliases() const; + QStringList suffixes() const; + QString preferredSuffix() const; + + Q_INVOKABLE bool inherits(const QString &mimeTypeName) const; + + QString filterString() const; + +protected: + friend class QMimeTypeParserBase; + friend class MimeTypeMapEntry; + friend class QMimeDatabasePrivate; + friend class QMimeXMLProvider; + friend class QMimeBinaryProvider; + friend class QMimeTypePrivate; + friend Q_CORE_EXPORT size_t qHash(const QMimeType &key, size_t seed) noexcept; + + QExplicitlySharedDataPointer d; + +private: + friend Q_CORE_EXPORT bool comparesEqual(const QMimeType &lhs, const QMimeType &rhs) noexcept; + Q_DECLARE_EQUALITY_COMPARABLE(QMimeType) +}; + +Q_DECLARE_SHARED(QMimeType) + +#ifndef QT_NO_DEBUG_STREAM +class QDebug; +Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QMimeType &mime); +#endif + +QT_END_NAMESPACE + +#endif // QMIMETYPE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qminmax.h b/qt/6.8.1/msvc2022_64/include/QtCore/qminmax.h new file mode 100644 index 0000000000000000000000000000000000000000..5f1ab8e9d9df0dc540f48478e4097e0e40aaf5c6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qminmax.h @@ -0,0 +1,67 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QMINMAX_H +#define QMINMAX_H + +#if 0 +#pragma qt_class(QtMinMax) +#pragma qt_sync_stop_processing +#endif + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +template +constexpr inline const T &qMin(const T &a, const T &b) { return (a < b) ? a : b; } +template +constexpr inline const T &qMax(const T &a, const T &b) { return (a < b) ? b : a; } +template +constexpr inline const T &qBound(const T &min, const T &val, const T &max) +{ + Q_ASSERT(!(max < min)); + return qMax(min, qMin(max, val)); +} +template +constexpr inline QTypeTraits::Promoted qMin(const T &a, const U &b) +{ + using P = QTypeTraits::Promoted; + P _a = a; + P _b = b; + return (_a < _b) ? _a : _b; +} +template +constexpr inline QTypeTraits::Promoted qMax(const T &a, const U &b) +{ + using P = QTypeTraits::Promoted; + P _a = a; + P _b = b; + return (_a < _b) ? _b : _a; +} +template +constexpr inline QTypeTraits::Promoted qBound(const T &min, const U &val, const T &max) +{ + Q_ASSERT(!(max < min)); + return qMax(min, qMin(max, val)); +} +template +constexpr inline QTypeTraits::Promoted qBound(const T &min, const T &val, const U &max) +{ + using P = QTypeTraits::Promoted; + Q_ASSERT(!(P(max) < P(min))); + return qMax(min, qMin(max, val)); +} +template +constexpr inline QTypeTraits::Promoted qBound(const U &min, const T &val, const T &max) +{ + using P = QTypeTraits::Promoted; + Q_ASSERT(!(P(max) < P(min))); + return qMax(min, qMin(max, val)); +} + +QT_END_NAMESPACE + +#endif // QMINMAX_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qmutex.h b/qt/6.8.1/msvc2022_64/include/QtCore/qmutex.h new file mode 100644 index 0000000000000000000000000000000000000000..2205203ac6fce573ab5bff4f54b422042ba02a41 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qmutex.h @@ -0,0 +1,333 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QMUTEX_H +#define QMUTEX_H + +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +#if QT_CONFIG(thread) || defined(Q_QDOC) + +#if defined(Q_OS_LINUX) || defined(Q_OS_WIN) // these platforms use futex +# define QT_MUTEX_LOCK_NOEXCEPT noexcept +#else +# define QT_MUTEX_LOCK_NOEXCEPT +#endif + +class QMutex; +class QRecursiveMutex; +class QMutexPrivate; + +class Q_CORE_EXPORT QBasicMutex +{ + Q_DISABLE_COPY_MOVE(QBasicMutex) +public: + constexpr QBasicMutex() + : d_ptr(nullptr) + {} + + // BasicLockable concept + inline void lock() QT_MUTEX_LOCK_NOEXCEPT { + QtTsan::mutexPreLock(this, 0u); + + if (!fastTryLock()) + lockInternal(); + + QtTsan::mutexPostLock(this, 0u, 0); + } + + // BasicLockable concept + inline void unlock() noexcept { + Q_ASSERT(d_ptr.loadRelaxed()); //mutex must be locked + + QtTsan::mutexPreUnlock(this, 0u); + + if (!fastTryUnlock()) + unlockInternal(); + + QtTsan::mutexPostUnlock(this, 0u); + } + + bool tryLock() noexcept { + unsigned tsanFlags = QtTsan::TryLock; + QtTsan::mutexPreLock(this, tsanFlags); + + const bool success = fastTryLock(); + + if (!success) + tsanFlags |= QtTsan::TryLockFailed; + QtTsan::mutexPostLock(this, tsanFlags, 0); + + return success; + } + + // Lockable concept + bool try_lock() noexcept { return tryLock(); } + +private: + inline bool fastTryLock() noexcept + { + if (d_ptr.loadRelaxed() != nullptr) + return false; + return d_ptr.testAndSetAcquire(nullptr, dummyLocked()); + } + inline bool fastTryUnlock() noexcept { + return d_ptr.testAndSetRelease(dummyLocked(), nullptr); + } + + void lockInternal() QT_MUTEX_LOCK_NOEXCEPT; + bool lockInternal(QDeadlineTimer timeout) QT_MUTEX_LOCK_NOEXCEPT; +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) + bool lockInternal(int timeout) QT_MUTEX_LOCK_NOEXCEPT; +#endif + void unlockInternal() noexcept; + void destroyInternal(QMutexPrivate *d); + + QBasicAtomicPointer d_ptr; + static inline QMutexPrivate *dummyLocked() { + return reinterpret_cast(quintptr(1)); + } + + friend class QMutex; + friend class QMutexPrivate; +}; + +class Q_CORE_EXPORT QMutex : public QBasicMutex +{ +public: + constexpr QMutex() = default; + ~QMutex() + { + QMutexPrivate *d = d_ptr.loadRelaxed(); + if (d) + destroyInternal(d); + } + +#ifdef Q_QDOC + inline void lock() QT_MUTEX_LOCK_NOEXCEPT; + inline void unlock() noexcept; + bool tryLock() noexcept; +#endif + + // Lockable concept + bool try_lock() noexcept { return tryLock(); } + + + using QBasicMutex::tryLock; + bool tryLock(int timeout) QT_MUTEX_LOCK_NOEXCEPT + { + return tryLock(QDeadlineTimer(timeout)); + } + + bool tryLock(QDeadlineTimer timeout) QT_MUTEX_LOCK_NOEXCEPT + { + unsigned tsanFlags = QtTsan::TryLock; + QtTsan::mutexPreLock(this, tsanFlags); + + bool success = fastTryLock(); + + if (success) { + QtTsan::mutexPostLock(this, tsanFlags, 0); + return success; + } + + success = lockInternal(timeout); + + if (!success) + tsanFlags |= QtTsan::TryLockFailed; + QtTsan::mutexPostLock(this, tsanFlags, 0); + + return success; + } + + // TimedLockable concept + template + bool try_lock_for(std::chrono::duration duration) + { + return tryLock(QDeadlineTimer(duration)); + } + + // TimedLockable concept + template + bool try_lock_until(std::chrono::time_point timePoint) + { + return tryLock(QDeadlineTimer(timePoint)); + } +}; + +class Q_CORE_EXPORT QRecursiveMutex +{ + Q_DISABLE_COPY_MOVE(QRecursiveMutex) + // written to by the thread that first owns 'mutex'; + // read during attempts to acquire ownership of 'mutex' from any other thread: + QAtomicPointer owner = nullptr; + // only ever accessed from the thread that owns 'mutex': + uint count = 0; + QMutex mutex; + +public: + constexpr QRecursiveMutex() = default; + ~QRecursiveMutex(); + + + // BasicLockable concept + void lock() QT_MUTEX_LOCK_NOEXCEPT + { tryLock(QDeadlineTimer(QDeadlineTimer::Forever)); } + QT_CORE_INLINE_SINCE(6, 6) + bool tryLock(int timeout) QT_MUTEX_LOCK_NOEXCEPT; + bool tryLock(QDeadlineTimer timer = {}) QT_MUTEX_LOCK_NOEXCEPT; + // BasicLockable concept + void unlock() noexcept; + + // Lockable concept + bool try_lock() QT_MUTEX_LOCK_NOEXCEPT { return tryLock(); } + + // TimedLockable concept + template + bool try_lock_for(std::chrono::duration duration) + { + return tryLock(QDeadlineTimer(duration)); + } + + // TimedLockable concept + template + bool try_lock_until(std::chrono::time_point timePoint) + { + return tryLock(QDeadlineTimer(timePoint)); + } +}; + +#if QT_CORE_INLINE_IMPL_SINCE(6, 6) +bool QRecursiveMutex::tryLock(int timeout) QT_MUTEX_LOCK_NOEXCEPT +{ + return tryLock(QDeadlineTimer(timeout)); +} +#endif + +template +class QMutexLocker +{ +public: + Q_NODISCARD_CTOR + inline explicit QMutexLocker(Mutex *mutex) QT_MUTEX_LOCK_NOEXCEPT + { + m_mutex = mutex; + if (Q_LIKELY(mutex)) { + mutex->lock(); + m_isLocked = true; + } + } + + Q_NODISCARD_CTOR + inline QMutexLocker(QMutexLocker &&other) noexcept + : m_mutex(std::exchange(other.m_mutex, nullptr)), + m_isLocked(std::exchange(other.m_isLocked, false)) + {} + + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QMutexLocker) + + inline ~QMutexLocker() + { + if (m_isLocked) + unlock(); + } + + inline bool isLocked() const noexcept + { + return m_isLocked; + } + + inline void unlock() noexcept + { + Q_ASSERT(m_isLocked); + m_mutex->unlock(); + m_isLocked = false; + } + + inline void relock() QT_MUTEX_LOCK_NOEXCEPT + { + Q_ASSERT(!m_isLocked); + m_mutex->lock(); + m_isLocked = true; + } + + inline void swap(QMutexLocker &other) noexcept + { + qt_ptr_swap(m_mutex, other.m_mutex); + std::swap(m_isLocked, other.m_isLocked); + } + + Mutex *mutex() const + { + return m_mutex; + } +private: + Q_DISABLE_COPY(QMutexLocker) + + Mutex *m_mutex; + bool m_isLocked = false; +}; + +#else // !QT_CONFIG(thread) && !Q_QDOC + +class QMutex +{ +public: + + constexpr QMutex() noexcept { } + + inline void lock() noexcept {} + inline bool tryLock(int timeout = 0) noexcept { Q_UNUSED(timeout); return true; } + inline bool try_lock() noexcept { return true; } + inline void unlock() noexcept {} + + template + inline bool try_lock_for(std::chrono::duration duration) noexcept + { + Q_UNUSED(duration); + return true; + } + + template + inline bool try_lock_until(std::chrono::time_point timePoint) noexcept + { + Q_UNUSED(timePoint); + return true; + } + +private: + Q_DISABLE_COPY(QMutex) +}; + +class QRecursiveMutex : public QMutex {}; + +template +class QMutexLocker +{ +public: + Q_NODISCARD_CTOR + inline explicit QMutexLocker(Mutex *) noexcept {} + inline ~QMutexLocker() noexcept {} + + inline void unlock() noexcept {} + void relock() noexcept {} + inline Mutex *mutex() const noexcept { return nullptr; } + +private: + Q_DISABLE_COPY(QMutexLocker) +}; + +typedef QMutex QBasicMutex; + +#endif // !QT_CONFIG(thread) && !Q_QDOC + +QT_END_NAMESPACE + +#endif // QMUTEX_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qnamespace.h b/qt/6.8.1/msvc2022_64/include/QtCore/qnamespace.h new file mode 100644 index 0000000000000000000000000000000000000000..3ab1a6163464e9f66b6db74a52b28ecdac1cddb0 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qnamespace.h @@ -0,0 +1,2023 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2020 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QNAMESPACE_H +#define QNAMESPACE_H + +#if 0 +#pragma qt_class(Qt) +#endif + +#include +#include +#include +#include + +#if defined(__OBJC__) && !defined(__cplusplus) +# warning "File built in Objective-C mode (.m), but using Qt requires Objective-C++ (.mm)" +#endif + +QT_BEGIN_NAMESPACE + +struct QMetaObject; + +namespace Qt { + Q_NAMESPACE_EXPORT(Q_CORE_EXPORT) + + enum GlobalColor { + color0, + color1, + black, + white, + darkGray, + gray, + lightGray, + red, + green, + blue, + cyan, + magenta, + yellow, + darkRed, + darkGreen, + darkBlue, + darkCyan, + darkMagenta, + darkYellow, + transparent + }; + + enum class ColorScheme { + Unknown, + Light, + Dark, + }; + + enum MouseButton { + NoButton = 0x00000000, + LeftButton = 0x00000001, + RightButton = 0x00000002, + MiddleButton = 0x00000004, + BackButton = 0x00000008, + XButton1 = BackButton, + ExtraButton1 = XButton1, + ForwardButton = 0x00000010, + XButton2 = ForwardButton, + ExtraButton2 = ForwardButton, + TaskButton = 0x00000020, + ExtraButton3 = TaskButton, + ExtraButton4 = 0x00000040, + ExtraButton5 = 0x00000080, + ExtraButton6 = 0x00000100, + ExtraButton7 = 0x00000200, + ExtraButton8 = 0x00000400, + ExtraButton9 = 0x00000800, + ExtraButton10 = 0x00001000, + ExtraButton11 = 0x00002000, + ExtraButton12 = 0x00004000, + ExtraButton13 = 0x00008000, + ExtraButton14 = 0x00010000, + ExtraButton15 = 0x00020000, + ExtraButton16 = 0x00040000, + ExtraButton17 = 0x00080000, + ExtraButton18 = 0x00100000, + ExtraButton19 = 0x00200000, + ExtraButton20 = 0x00400000, + ExtraButton21 = 0x00800000, + ExtraButton22 = 0x01000000, + ExtraButton23 = 0x02000000, + ExtraButton24 = 0x04000000, + AllButtons = 0x07ffffff, + MaxMouseButton = ExtraButton24, + // 4 high-order bits remain available for future use (0x08000000 through 0x40000000). + MouseButtonMask = 0xffffffff + }; + Q_DECLARE_FLAGS(MouseButtons, MouseButton) + Q_DECLARE_OPERATORS_FOR_FLAGS(MouseButtons) + + enum Orientation { + Horizontal = 0x1, + Vertical = 0x2 + }; + + Q_DECLARE_FLAGS(Orientations, Orientation) + Q_DECLARE_OPERATORS_FOR_FLAGS(Orientations) + + enum FocusPolicy { + NoFocus = 0, + TabFocus = 0x1, + ClickFocus = 0x2, + StrongFocus = TabFocus | ClickFocus | 0x8, + WheelFocus = StrongFocus | 0x4 + }; + + enum TabFocusBehavior { + NoTabFocus = 0x00, + TabFocusTextControls = 0x01, + TabFocusListControls = 0x02, + TabFocusAllControls = 0xff + }; + + enum SortOrder { + AscendingOrder, + DescendingOrder + }; + + enum SplitBehaviorFlags { + KeepEmptyParts = 0, + SkipEmptyParts = 0x1, + }; + Q_DECLARE_FLAGS(SplitBehavior, SplitBehaviorFlags) + Q_DECLARE_OPERATORS_FOR_FLAGS(SplitBehavior) + + enum TileRule { + StretchTile, + RepeatTile, + RoundTile + }; + + // Text formatting flags for QPainter::drawText and QLabel. + // The following two enums can be combined to one integer which + // is passed as 'flags' to QPainter::drawText, QFontMetrics::boundingRect and qt_format_text. + + enum AlignmentFlag { + AlignLeft = 0x0001, + AlignLeading = AlignLeft, + AlignRight = 0x0002, + AlignTrailing = AlignRight, + AlignHCenter = 0x0004, + AlignJustify = 0x0008, + AlignAbsolute = 0x0010, + AlignHorizontal_Mask = AlignLeft | AlignRight | AlignHCenter | AlignJustify | AlignAbsolute, + + AlignTop = 0x0020, + AlignBottom = 0x0040, + AlignVCenter = 0x0080, + AlignBaseline = 0x0100, + // Note that 0x100 will clash with Qt::TextSingleLine = 0x100 due to what the comment above + // this enum declaration states. However, since Qt::AlignBaseline is only used by layouts, + // it doesn't make sense to pass Qt::AlignBaseline to QPainter::drawText(), so there + // shouldn't really be any ambiguity between the two overlapping enum values. + AlignVertical_Mask = AlignTop | AlignBottom | AlignVCenter | AlignBaseline, + + AlignCenter = AlignVCenter | AlignHCenter + }; + + Q_DECLARE_FLAGS(Alignment, AlignmentFlag) + Q_DECLARE_OPERATORS_FOR_FLAGS(Alignment) + + enum TextFlag { + TextSingleLine = 0x0100, + TextDontClip = 0x0200, + TextExpandTabs = 0x0400, + TextShowMnemonic = 0x0800, + TextWordWrap = 0x1000, + TextWrapAnywhere = 0x2000, + TextDontPrint = 0x4000, + TextIncludeTrailingSpaces = 0x08000000, + TextHideMnemonic = 0x8000, + TextJustificationForced = 0x10000, + TextForceLeftToRight = 0x20000, + TextForceRightToLeft = 0x40000, + // Ensures that the longest variant is always used when computing the + // size of a multi-variant string. + TextLongestVariant = 0x80000 + }; + Q_DECLARE_MIXED_ENUM_OPERATORS_SYMMETRIC(int, AlignmentFlag, TextFlag) + + enum TextElideMode { + ElideLeft, + ElideRight, + ElideMiddle, + ElideNone + }; + Q_DECLARE_MIXED_ENUM_OPERATORS_SYMMETRIC(int, TextElideMode, TextFlag) + + enum WhiteSpaceMode { + WhiteSpaceNormal, + WhiteSpacePre, + WhiteSpaceNoWrap, + WhiteSpaceModeUndefined = -1 + }; + + enum HitTestAccuracy { ExactHit, FuzzyHit }; + + enum WindowType { + Widget = 0x00000000, + Window = 0x00000001, + Dialog = 0x00000002 | Window, + Sheet = 0x00000004 | Window, + Drawer = Sheet | Dialog, + Popup = 0x00000008 | Window, + Tool = Popup | Dialog, + ToolTip = Popup | Sheet, + SplashScreen = ToolTip | Dialog, + Desktop = 0x00000010 | Window, + SubWindow = 0x00000012, // Note QTBUG-115729 before using + ForeignWindow = 0x00000020 | Window, + CoverWindow = 0x00000040 | Window, + + WindowType_Mask = 0x000000ff, + MSWindowsFixedSizeDialogHint = 0x00000100, + MSWindowsOwnDC = 0x00000200, + BypassWindowManagerHint = 0x00000400, + X11BypassWindowManagerHint = BypassWindowManagerHint, + FramelessWindowHint = 0x00000800, + WindowTitleHint = 0x00001000, + WindowSystemMenuHint = 0x00002000, + WindowMinimizeButtonHint = 0x00004000, + WindowMaximizeButtonHint = 0x00008000, + WindowMinMaxButtonsHint = WindowMinimizeButtonHint | WindowMaximizeButtonHint, + WindowContextHelpButtonHint = 0x00010000, + WindowShadeButtonHint = 0x00020000, + WindowStaysOnTopHint = 0x00040000, + WindowTransparentForInput = 0x00080000, + WindowOverridesSystemGestures = 0x00100000, + WindowDoesNotAcceptFocus = 0x00200000, + MaximizeUsingFullscreenGeometryHint = 0x00400000, + + CustomizeWindowHint = 0x02000000, + WindowStaysOnBottomHint = 0x04000000, + WindowCloseButtonHint = 0x08000000, + MacWindowToolBarButtonHint = 0x10000000, + BypassGraphicsProxyWidget = 0x20000000, + NoDropShadowWindowHint = 0x40000000, + WindowFullscreenButtonHint = 0x80000000 + }; + + Q_DECLARE_FLAGS(WindowFlags, WindowType) + Q_DECLARE_OPERATORS_FOR_FLAGS(WindowFlags) + + enum WindowState { + WindowNoState = 0x00000000, + WindowMinimized = 0x00000001, + WindowMaximized = 0x00000002, + WindowFullScreen = 0x00000004, + WindowActive = 0x00000008 + }; + + Q_DECLARE_FLAGS(WindowStates, WindowState) + Q_DECLARE_OPERATORS_FOR_FLAGS(WindowStates) + + enum ApplicationState { + ApplicationSuspended = 0x00000000, + ApplicationHidden = 0x00000001, + ApplicationInactive = 0x00000002, + ApplicationActive = 0x00000004 + }; + + Q_DECLARE_FLAGS(ApplicationStates, ApplicationState) + + enum ScreenOrientation { + PrimaryOrientation = 0x00000000, + PortraitOrientation = 0x00000001, + LandscapeOrientation = 0x00000002, + InvertedPortraitOrientation = 0x00000004, + InvertedLandscapeOrientation = 0x00000008 + }; + + Q_DECLARE_FLAGS(ScreenOrientations, ScreenOrientation) + Q_DECLARE_OPERATORS_FOR_FLAGS(ScreenOrientations) + + enum WidgetAttribute { + WA_Disabled = 0, + WA_UnderMouse = 1, + WA_MouseTracking = 2, + // Formerly, 3 was WA_ContentsPropagated. + WA_OpaquePaintEvent = 4, + WA_StaticContents = 5, + WA_LaidOut = 7, + WA_PaintOnScreen = 8, + WA_NoSystemBackground = 9, + WA_UpdatesDisabled = 10, + WA_Mapped = 11, + // Formerly, 12 was WA_MacNoClickThrough. + WA_InputMethodEnabled = 14, + WA_WState_Visible = 15, + WA_WState_Hidden = 16, + + WA_ForceDisabled = 32, + WA_KeyCompression = 33, + WA_PendingMoveEvent = 34, + WA_PendingResizeEvent = 35, + WA_SetPalette = 36, + WA_SetFont = 37, + WA_SetCursor = 38, + WA_NoChildEventsFromChildren = 39, + WA_WindowModified = 41, + WA_Resized = 42, + WA_Moved = 43, + WA_PendingUpdate = 44, + WA_InvalidSize = 45, + // Formerly 46 was WA_MacBrushedMetal and WA_MacMetalStyle. + WA_CustomWhatsThis = 47, + WA_LayoutOnEntireRect = 48, + WA_OutsideWSRange = 49, + WA_GrabbedShortcut = 50, + WA_TransparentForMouseEvents = 51, + WA_PaintUnclipped = 52, + WA_SetWindowIcon = 53, + WA_NoMouseReplay = 54, + WA_DeleteOnClose = 55, + WA_RightToLeft = 56, + WA_SetLayoutDirection = 57, + WA_NoChildEventsForParent = 58, + WA_ForceUpdatesDisabled = 59, + + WA_WState_Created = 60, + WA_WState_CompressKeys = 61, + WA_WState_InPaintEvent = 62, + WA_WState_Reparented = 63, + WA_WState_ConfigPending = 64, + WA_WState_Polished = 66, + // Formerly, 67 was WA_WState_DND. + WA_WState_OwnSizePolicy = 68, + WA_WState_ExplicitShowHide = 69, + + WA_ShowModal = 70, // ## deprecated since since 4.5.1 but still in use :-( + WA_MouseNoMask = 71, + WA_NoMousePropagation = 73, // for now, might go away. + WA_Hover = 74, + WA_InputMethodTransparent = 75, // Don't reset IM when user clicks on this (for virtual keyboards on embedded) + WA_QuitOnClose = 76, + + WA_KeyboardFocusChange = 77, + + WA_AcceptDrops = 78, + WA_DropSiteRegistered = 79, // internal + + WA_WindowPropagation = 80, + + WA_NoX11EventCompression = 81, + WA_TintedBackground = 82, + WA_X11OpenGLOverlay = 83, + WA_AlwaysShowToolTips = 84, + WA_MacOpaqueSizeGrip = 85, + WA_SetStyle = 86, + + WA_SetLocale = 87, + WA_MacShowFocusRect = 88, + + WA_MacNormalSize = 89, // Mac only + WA_MacSmallSize = 90, // Mac only + WA_MacMiniSize = 91, // Mac only + + WA_LayoutUsesWidgetRect = 92, + WA_StyledBackground = 93, // internal + // Formerly, 94 was WA_MSWindowsUseDirect3D. + WA_CanHostQMdiSubWindowTitleBar = 95, // Internal + + WA_MacAlwaysShowToolWindow = 96, // Mac only + + WA_StyleSheet = 97, // internal + + WA_ShowWithoutActivating = 98, + + WA_X11BypassTransientForHint = 99, + + WA_NativeWindow = 100, + WA_DontCreateNativeAncestors = 101, + + // Formerly WA_MacVariableSize = 102, // Mac only + + WA_DontShowOnScreen = 103, + + // window types from http://standards.freedesktop.org/wm-spec/ + WA_X11NetWmWindowTypeDesktop = 104, + WA_X11NetWmWindowTypeDock = 105, + WA_X11NetWmWindowTypeToolBar = 106, + WA_X11NetWmWindowTypeMenu = 107, + WA_X11NetWmWindowTypeUtility = 108, + WA_X11NetWmWindowTypeSplash = 109, + WA_X11NetWmWindowTypeDialog = 110, + WA_X11NetWmWindowTypeDropDownMenu = 111, + WA_X11NetWmWindowTypePopupMenu = 112, + WA_X11NetWmWindowTypeToolTip = 113, + WA_X11NetWmWindowTypeNotification = 114, + WA_X11NetWmWindowTypeCombo = 115, + WA_X11NetWmWindowTypeDND = 116, + // Formerly, 117 was WA_MacFrameworkScaled. + WA_SetWindowModality = 118, + WA_WState_WindowOpacitySet = 119, // internal + WA_TranslucentBackground = 120, + + WA_AcceptTouchEvents = 121, + WA_WState_AcceptedTouchBeginEvent = 122, + WA_TouchPadAcceptSingleTouchEvents = 123, + + WA_X11DoNotAcceptFocus = 126, + // Formerly, 127 was WA_MacNoShadow + + WA_AlwaysStackOnTop = 128, + + WA_TabletTracking = 129, + + WA_ContentsMarginsRespectsSafeArea = 130, + + WA_StyleSheetTarget = 131, + + // Add new attributes before this line + WA_AttributeCount + }; + + enum ApplicationAttribute + { + // AA_ImmediateWidgetCreation = 0, + AA_QtQuickUseDefaultSizePolicy = 1, + AA_DontShowIconsInMenus = 2, + AA_NativeWindows = 3, + AA_DontCreateNativeWidgetSiblings = 4, + AA_PluginApplication = 5, + AA_DontUseNativeMenuBar = 6, + AA_MacDontSwapCtrlAndMeta = 7, + AA_Use96Dpi = 8, + AA_DisableNativeVirtualKeyboard = 9, + AA_DontUseNativeMenuWindows = 10, + AA_SynthesizeTouchForUnhandledMouseEvents = 11, + AA_SynthesizeMouseForUnhandledTouchEvents = 12, +#if QT_DEPRECATED_SINCE(6, 0) + AA_UseHighDpiPixmaps Q_DECL_ENUMERATOR_DEPRECATED_X( + "High-DPI pixmaps are always enabled. " \ + "This attribute no longer has any effect.") = 13, +#endif + AA_ForceRasterWidgets = 14, + AA_UseDesktopOpenGL = 15, + AA_UseOpenGLES = 16, + AA_UseSoftwareOpenGL = 17, + AA_ShareOpenGLContexts = 18, + AA_SetPalette = 19, +#if QT_DEPRECATED_SINCE(6, 0) + AA_EnableHighDpiScaling Q_DECL_ENUMERATOR_DEPRECATED_X( + "High-DPI scaling is always enabled. " \ + "This attribute no longer has any effect.") = 20, + AA_DisableHighDpiScaling Q_DECL_ENUMERATOR_DEPRECATED_X( + "High-DPI scaling is always enabled. " \ + "This attribute no longer has any effect.") = 21, +#endif + AA_UseStyleSheetPropagationInWidgetStyles = 22, + AA_DontUseNativeDialogs = 23, + AA_SynthesizeMouseForUnhandledTabletEvents = 24, + AA_CompressHighFrequencyEvents = 25, + AA_DontCheckOpenGLContextThreadAffinity = 26, + AA_DisableShaderDiskCache = 27, + AA_DontShowShortcutsInContextMenus = 28, + AA_CompressTabletEvents = 29, + // AA_DisableWindowContextHelpButton = 30, (in Qt 5) + AA_DisableSessionManager = 31, + + // Add new attributes before this line + AA_AttributeCount + }; + + + // Image conversion flags. The unusual ordering is caused by + // compatibility and default requirements. + + enum ImageConversionFlag { + ColorMode_Mask = 0x00000003, + AutoColor = 0x00000000, + ColorOnly = 0x00000003, + MonoOnly = 0x00000002, + // Reserved = 0x00000001, + + AlphaDither_Mask = 0x0000000c, + ThresholdAlphaDither = 0x00000000, + OrderedAlphaDither = 0x00000004, + DiffuseAlphaDither = 0x00000008, + NoAlpha = 0x0000000c, // Not supported + + Dither_Mask = 0x00000030, + DiffuseDither = 0x00000000, + OrderedDither = 0x00000010, + ThresholdDither = 0x00000020, + // ReservedDither = 0x00000030, + + DitherMode_Mask = 0x000000c0, + AutoDither = 0x00000000, + PreferDither = 0x00000040, + AvoidDither = 0x00000080, + + NoOpaqueDetection = 0x00000100, + NoFormatConversion = 0x00000200 + }; + Q_DECLARE_FLAGS(ImageConversionFlags, ImageConversionFlag) + Q_DECLARE_OPERATORS_FOR_FLAGS(ImageConversionFlags) + + enum BGMode { + TransparentMode, + OpaqueMode + }; + + enum Key { + // Unicode Basic Latin block (0x00-0x7f) + Key_Space = 0x20, + Key_Any = Key_Space, + Key_Exclam = 0x21, + Key_QuoteDbl = 0x22, + Key_NumberSign = 0x23, + Key_Dollar = 0x24, + Key_Percent = 0x25, + Key_Ampersand = 0x26, + Key_Apostrophe = 0x27, + Key_ParenLeft = 0x28, + Key_ParenRight = 0x29, + Key_Asterisk = 0x2a, + Key_Plus = 0x2b, + Key_Comma = 0x2c, + Key_Minus = 0x2d, + Key_Period = 0x2e, + Key_Slash = 0x2f, + Key_0 = 0x30, + Key_1 = 0x31, + Key_2 = 0x32, + Key_3 = 0x33, + Key_4 = 0x34, + Key_5 = 0x35, + Key_6 = 0x36, + Key_7 = 0x37, + Key_8 = 0x38, + Key_9 = 0x39, + Key_Colon = 0x3a, + Key_Semicolon = 0x3b, + Key_Less = 0x3c, + Key_Equal = 0x3d, + Key_Greater = 0x3e, + Key_Question = 0x3f, + Key_At = 0x40, + Key_A = 0x41, + Key_B = 0x42, + Key_C = 0x43, + Key_D = 0x44, + Key_E = 0x45, + Key_F = 0x46, + Key_G = 0x47, + Key_H = 0x48, + Key_I = 0x49, + Key_J = 0x4a, + Key_K = 0x4b, + Key_L = 0x4c, + Key_M = 0x4d, + Key_N = 0x4e, + Key_O = 0x4f, + Key_P = 0x50, + Key_Q = 0x51, + Key_R = 0x52, + Key_S = 0x53, + Key_T = 0x54, + Key_U = 0x55, + Key_V = 0x56, + Key_W = 0x57, + Key_X = 0x58, + Key_Y = 0x59, + Key_Z = 0x5a, + Key_BracketLeft = 0x5b, + Key_Backslash = 0x5c, + Key_BracketRight = 0x5d, + Key_AsciiCircum = 0x5e, + Key_Underscore = 0x5f, + Key_QuoteLeft = 0x60, + Key_BraceLeft = 0x7b, + Key_Bar = 0x7c, + Key_BraceRight = 0x7d, + Key_AsciiTilde = 0x7e, + + // Unicode Latin-1 Supplement block (0x80-0xff) + Key_nobreakspace = 0x0a0, + Key_exclamdown = 0x0a1, + Key_cent = 0x0a2, + Key_sterling = 0x0a3, + Key_currency = 0x0a4, + Key_yen = 0x0a5, + Key_brokenbar = 0x0a6, + Key_section = 0x0a7, + Key_diaeresis = 0x0a8, + Key_copyright = 0x0a9, + Key_ordfeminine = 0x0aa, + Key_guillemotleft = 0x0ab, // left angle quotation mark + Key_notsign = 0x0ac, + Key_hyphen = 0x0ad, + Key_registered = 0x0ae, + Key_macron = 0x0af, + Key_degree = 0x0b0, + Key_plusminus = 0x0b1, + Key_twosuperior = 0x0b2, + Key_threesuperior = 0x0b3, + Key_acute = 0x0b4, + Key_micro = 0x0b5, +#if QT_DEPRECATED_SINCE(6, 11) + Key_mu Q_DECL_ENUMERATOR_DEPRECATED_X("This key was misnamed, use Key_micro instead") + = Key_micro, +#endif + Key_paragraph = 0x0b6, + Key_periodcentered = 0x0b7, + Key_cedilla = 0x0b8, + Key_onesuperior = 0x0b9, + Key_masculine = 0x0ba, + Key_guillemotright = 0x0bb, // right angle quotation mark + Key_onequarter = 0x0bc, + Key_onehalf = 0x0bd, + Key_threequarters = 0x0be, + Key_questiondown = 0x0bf, + Key_Agrave = 0x0c0, + Key_Aacute = 0x0c1, + Key_Acircumflex = 0x0c2, + Key_Atilde = 0x0c3, + Key_Adiaeresis = 0x0c4, + Key_Aring = 0x0c5, + Key_AE = 0x0c6, + Key_Ccedilla = 0x0c7, + Key_Egrave = 0x0c8, + Key_Eacute = 0x0c9, + Key_Ecircumflex = 0x0ca, + Key_Ediaeresis = 0x0cb, + Key_Igrave = 0x0cc, + Key_Iacute = 0x0cd, + Key_Icircumflex = 0x0ce, + Key_Idiaeresis = 0x0cf, + Key_ETH = 0x0d0, + Key_Ntilde = 0x0d1, + Key_Ograve = 0x0d2, + Key_Oacute = 0x0d3, + Key_Ocircumflex = 0x0d4, + Key_Otilde = 0x0d5, + Key_Odiaeresis = 0x0d6, + Key_multiply = 0x0d7, + Key_Ooblique = 0x0d8, + Key_Ugrave = 0x0d9, + Key_Uacute = 0x0da, + Key_Ucircumflex = 0x0db, + Key_Udiaeresis = 0x0dc, + Key_Yacute = 0x0dd, + Key_THORN = 0x0de, + Key_ssharp = 0x0df, + Key_division = 0x0f7, + Key_ydiaeresis = 0x0ff, + + // The rest of the Unicode values are skipped here, + // so that we can represent them along with Qt::Keys + // in the same data type. The maximum Unicode value + // is 0x0010ffff, so we start our custom keys at + // 0x01000000 to not clash with the Unicode values, + // but still give plenty of room to grow. + + Key_Escape = 0x01000000, // misc keys + Key_Tab = 0x01000001, + Key_Backtab = 0x01000002, + Key_Backspace = 0x01000003, + Key_Return = 0x01000004, + Key_Enter = 0x01000005, + Key_Insert = 0x01000006, + Key_Delete = 0x01000007, + Key_Pause = 0x01000008, + Key_Print = 0x01000009, // print screen + Key_SysReq = 0x0100000a, + Key_Clear = 0x0100000b, + Key_Home = 0x01000010, // cursor movement + Key_End = 0x01000011, + Key_Left = 0x01000012, + Key_Up = 0x01000013, + Key_Right = 0x01000014, + Key_Down = 0x01000015, + Key_PageUp = 0x01000016, + Key_PageDown = 0x01000017, + Key_Shift = 0x01000020, // modifiers + Key_Control = 0x01000021, + Key_Meta = 0x01000022, + Key_Alt = 0x01000023, + Key_CapsLock = 0x01000024, + Key_NumLock = 0x01000025, + Key_ScrollLock = 0x01000026, + Key_F1 = 0x01000030, // function keys + Key_F2 = 0x01000031, + Key_F3 = 0x01000032, + Key_F4 = 0x01000033, + Key_F5 = 0x01000034, + Key_F6 = 0x01000035, + Key_F7 = 0x01000036, + Key_F8 = 0x01000037, + Key_F9 = 0x01000038, + Key_F10 = 0x01000039, + Key_F11 = 0x0100003a, + Key_F12 = 0x0100003b, + Key_F13 = 0x0100003c, + Key_F14 = 0x0100003d, + Key_F15 = 0x0100003e, + Key_F16 = 0x0100003f, + Key_F17 = 0x01000040, + Key_F18 = 0x01000041, + Key_F19 = 0x01000042, + Key_F20 = 0x01000043, + Key_F21 = 0x01000044, + Key_F22 = 0x01000045, + Key_F23 = 0x01000046, + Key_F24 = 0x01000047, + Key_F25 = 0x01000048, // F25 .. F35 only on X11 + Key_F26 = 0x01000049, + Key_F27 = 0x0100004a, + Key_F28 = 0x0100004b, + Key_F29 = 0x0100004c, + Key_F30 = 0x0100004d, + Key_F31 = 0x0100004e, + Key_F32 = 0x0100004f, + Key_F33 = 0x01000050, + Key_F34 = 0x01000051, + Key_F35 = 0x01000052, + Key_Super_L = 0x01000053, // extra keys + Key_Super_R = 0x01000054, + Key_Menu = 0x01000055, + Key_Hyper_L = 0x01000056, + Key_Hyper_R = 0x01000057, + Key_Help = 0x01000058, + Key_Direction_L = 0x01000059, + Key_Direction_R = 0x01000060, + + // International input method support (X keycode - 0xEE00, the + // definition follows Qt/Embedded 2.3.7) Only interesting if + // you are writing your own input method + + // International & multi-key character composition + Key_AltGr = 0x01001103, + Key_Multi_key = 0x01001120, // Multi-key character compose + Key_Codeinput = 0x01001137, + Key_SingleCandidate = 0x0100113c, + Key_MultipleCandidate = 0x0100113d, + Key_PreviousCandidate = 0x0100113e, + + // Misc Functions + Key_Mode_switch = 0x0100117e, // Character set switch + //Key_script_switch = 0x0100117e, // Alias for mode_switch + + // Japanese keyboard support + Key_Kanji = 0x01001121, // Kanji, Kanji convert + Key_Muhenkan = 0x01001122, // Cancel Conversion + //Key_Henkan_Mode = 0x01001123, // Start/Stop Conversion + Key_Henkan = 0x01001123, // Alias for Henkan_Mode + Key_Romaji = 0x01001124, // to Romaji + Key_Hiragana = 0x01001125, // to Hiragana + Key_Katakana = 0x01001126, // to Katakana + Key_Hiragana_Katakana = 0x01001127, // Hiragana/Katakana toggle + Key_Zenkaku = 0x01001128, // to Zenkaku + Key_Hankaku = 0x01001129, // to Hankaku + Key_Zenkaku_Hankaku = 0x0100112a, // Zenkaku/Hankaku toggle + Key_Touroku = 0x0100112b, // Add to Dictionary + Key_Massyo = 0x0100112c, // Delete from Dictionary + Key_Kana_Lock = 0x0100112d, // Kana Lock + Key_Kana_Shift = 0x0100112e, // Kana Shift + Key_Eisu_Shift = 0x0100112f, // Alphanumeric Shift + Key_Eisu_toggle = 0x01001130, // Alphanumeric toggle + //Key_Kanji_Bangou = 0x01001137, // Codeinput + //Key_Zen_Koho = 0x0100113d, // Multiple/All Candidate(s) + //Key_Mae_Koho = 0x0100113e, // Previous Candidate + + // Korean keyboard support + // + // In fact, many Korean users need only 2 keys, Key_Hangul and + // Key_Hangul_Hanja. But rest of the keys are good for future. + + Key_Hangul = 0x01001131, // Hangul start/stop(toggle) + Key_Hangul_Start = 0x01001132, // Hangul start + Key_Hangul_End = 0x01001133, // Hangul end, English start + Key_Hangul_Hanja = 0x01001134, // Start Hangul->Hanja Conversion + Key_Hangul_Jamo = 0x01001135, // Hangul Jamo mode + Key_Hangul_Romaja = 0x01001136, // Hangul Romaja mode + //Key_Hangul_Codeinput = 0x01001137, // Hangul code input mode + Key_Hangul_Jeonja = 0x01001138, // Jeonja mode + Key_Hangul_Banja = 0x01001139, // Banja mode + Key_Hangul_PreHanja = 0x0100113a, // Pre Hanja conversion + Key_Hangul_PostHanja = 0x0100113b, // Post Hanja conversion + //Key_Hangul_SingleCandidate = 0x0100113c, // Single candidate + //Key_Hangul_MultipleCandidate = 0x0100113d, // Multiple candidate + //Key_Hangul_PreviousCandidate = 0x0100113e, // Previous candidate + Key_Hangul_Special = 0x0100113f, // Special symbols + //Key_Hangul_switch = 0x0100117e, // Alias for mode_switch + + // dead keys (X keycode - 0xED00 to avoid the conflict) + Key_Dead_Grave = 0x01001250, + Key_Dead_Acute = 0x01001251, + Key_Dead_Circumflex = 0x01001252, + Key_Dead_Tilde = 0x01001253, + Key_Dead_Macron = 0x01001254, + Key_Dead_Breve = 0x01001255, + Key_Dead_Abovedot = 0x01001256, + Key_Dead_Diaeresis = 0x01001257, + Key_Dead_Abovering = 0x01001258, + Key_Dead_Doubleacute = 0x01001259, + Key_Dead_Caron = 0x0100125a, + Key_Dead_Cedilla = 0x0100125b, + Key_Dead_Ogonek = 0x0100125c, + Key_Dead_Iota = 0x0100125d, + Key_Dead_Voiced_Sound = 0x0100125e, + Key_Dead_Semivoiced_Sound = 0x0100125f, + Key_Dead_Belowdot = 0x01001260, + Key_Dead_Hook = 0x01001261, + Key_Dead_Horn = 0x01001262, + Key_Dead_Stroke = 0x01001263, + Key_Dead_Abovecomma = 0x01001264, + Key_Dead_Abovereversedcomma = 0x01001265, + Key_Dead_Doublegrave = 0x01001266, + Key_Dead_Belowring = 0x01001267, + Key_Dead_Belowmacron = 0x01001268, + Key_Dead_Belowcircumflex = 0x01001269, + Key_Dead_Belowtilde = 0x0100126a, + Key_Dead_Belowbreve = 0x0100126b, + Key_Dead_Belowdiaeresis = 0x0100126c, + Key_Dead_Invertedbreve = 0x0100126d, + Key_Dead_Belowcomma = 0x0100126e, + Key_Dead_Currency = 0x0100126f, + Key_Dead_a = 0x01001280, + Key_Dead_A = 0x01001281, + Key_Dead_e = 0x01001282, + Key_Dead_E = 0x01001283, + Key_Dead_i = 0x01001284, + Key_Dead_I = 0x01001285, + Key_Dead_o = 0x01001286, + Key_Dead_O = 0x01001287, + Key_Dead_u = 0x01001288, + Key_Dead_U = 0x01001289, + Key_Dead_Small_Schwa = 0x0100128a, + Key_Dead_Capital_Schwa = 0x0100128b, + Key_Dead_Greek = 0x0100128c, + Key_Dead_Lowline = 0x01001290, + Key_Dead_Aboveverticalline = 0x01001291, + Key_Dead_Belowverticalline = 0x01001292, + Key_Dead_Longsolidusoverlay = 0x01001293, + + // multimedia/internet keys - ignored by default - see QKeyEvent c'tor + Key_Back = 0x01000061, + Key_Forward = 0x01000062, + Key_Stop = 0x01000063, + Key_Refresh = 0x01000064, + Key_VolumeDown = 0x01000070, + Key_VolumeMute = 0x01000071, + Key_VolumeUp = 0x01000072, + Key_BassBoost = 0x01000073, + Key_BassUp = 0x01000074, + Key_BassDown = 0x01000075, + Key_TrebleUp = 0x01000076, + Key_TrebleDown = 0x01000077, + Key_MediaPlay = 0x01000080, + Key_MediaStop = 0x01000081, + Key_MediaPrevious = 0x01000082, + Key_MediaNext = 0x01000083, + Key_MediaRecord = 0x01000084, + Key_MediaPause = 0x01000085, + Key_MediaTogglePlayPause = 0x01000086, + Key_HomePage = 0x01000090, + Key_Favorites = 0x01000091, + Key_Search = 0x01000092, + Key_Standby = 0x01000093, + Key_OpenUrl = 0x01000094, + Key_LaunchMail = 0x010000a0, + Key_LaunchMedia = 0x010000a1, + Key_Launch0 = 0x010000a2, + Key_Launch1 = 0x010000a3, + Key_Launch2 = 0x010000a4, + Key_Launch3 = 0x010000a5, + Key_Launch4 = 0x010000a6, + Key_Launch5 = 0x010000a7, + Key_Launch6 = 0x010000a8, + Key_Launch7 = 0x010000a9, + Key_Launch8 = 0x010000aa, + Key_Launch9 = 0x010000ab, + Key_LaunchA = 0x010000ac, + Key_LaunchB = 0x010000ad, + Key_LaunchC = 0x010000ae, + Key_LaunchD = 0x010000af, + Key_LaunchE = 0x010000b0, + Key_LaunchF = 0x010000b1, + Key_MonBrightnessUp = 0x010000b2, + Key_MonBrightnessDown = 0x010000b3, + Key_KeyboardLightOnOff = 0x010000b4, + Key_KeyboardBrightnessUp = 0x010000b5, + Key_KeyboardBrightnessDown = 0x010000b6, + Key_PowerOff = 0x010000b7, + Key_WakeUp = 0x010000b8, + Key_Eject = 0x010000b9, + Key_ScreenSaver = 0x010000ba, + Key_WWW = 0x010000bb, + Key_Memo = 0x010000bc, + Key_LightBulb = 0x010000bd, + Key_Shop = 0x010000be, + Key_History = 0x010000bf, + Key_AddFavorite = 0x010000c0, + Key_HotLinks = 0x010000c1, + Key_BrightnessAdjust = 0x010000c2, + Key_Finance = 0x010000c3, + Key_Community = 0x010000c4, + Key_AudioRewind = 0x010000c5, // Media rewind + Key_BackForward = 0x010000c6, + Key_ApplicationLeft = 0x010000c7, + Key_ApplicationRight = 0x010000c8, + Key_Book = 0x010000c9, + Key_CD = 0x010000ca, + Key_Calculator = 0x010000cb, + Key_ToDoList = 0x010000cc, + Key_ClearGrab = 0x010000cd, + Key_Close = 0x010000ce, + Key_Copy = 0x010000cf, + Key_Cut = 0x010000d0, + Key_Display = 0x010000d1, // Output switch key + Key_DOS = 0x010000d2, + Key_Documents = 0x010000d3, + Key_Excel = 0x010000d4, + Key_Explorer = 0x010000d5, + Key_Game = 0x010000d6, + Key_Go = 0x010000d7, + Key_iTouch = 0x010000d8, + Key_LogOff = 0x010000d9, + Key_Market = 0x010000da, + Key_Meeting = 0x010000db, + Key_MenuKB = 0x010000dc, + Key_MenuPB = 0x010000dd, + Key_MySites = 0x010000de, + Key_News = 0x010000df, + Key_OfficeHome = 0x010000e0, + Key_Option = 0x010000e1, + Key_Paste = 0x010000e2, + Key_Phone = 0x010000e3, + Key_Calendar = 0x010000e4, + Key_Reply = 0x010000e5, + Key_Reload = 0x010000e6, + Key_RotateWindows = 0x010000e7, + Key_RotationPB = 0x010000e8, + Key_RotationKB = 0x010000e9, + Key_Save = 0x010000ea, + Key_Send = 0x010000eb, + Key_Spell = 0x010000ec, + Key_SplitScreen = 0x010000ed, + Key_Support = 0x010000ee, + Key_TaskPane = 0x010000ef, + Key_Terminal = 0x010000f0, + Key_Tools = 0x010000f1, + Key_Travel = 0x010000f2, + Key_Video = 0x010000f3, + Key_Word = 0x010000f4, + Key_Xfer = 0x010000f5, + Key_ZoomIn = 0x010000f6, + Key_ZoomOut = 0x010000f7, + Key_Away = 0x010000f8, + Key_Messenger = 0x010000f9, + Key_WebCam = 0x010000fa, + Key_MailForward = 0x010000fb, + Key_Pictures = 0x010000fc, + Key_Music = 0x010000fd, + Key_Battery = 0x010000fe, + Key_Bluetooth = 0x010000ff, + Key_WLAN = 0x01000100, + Key_UWB = 0x01000101, + Key_AudioForward = 0x01000102, // Media fast-forward + Key_AudioRepeat = 0x01000103, // Toggle repeat mode + Key_AudioRandomPlay = 0x01000104, // Toggle shuffle mode + Key_Subtitle = 0x01000105, + Key_AudioCycleTrack = 0x01000106, + Key_Time = 0x01000107, + Key_Hibernate = 0x01000108, + Key_View = 0x01000109, + Key_TopMenu = 0x0100010a, + Key_PowerDown = 0x0100010b, + Key_Suspend = 0x0100010c, + Key_ContrastAdjust = 0x0100010d, + + // We can remove these two for Qt 7: + Key_LaunchG = 0x0100010e, + Key_LaunchH = 0x0100010f, + + Key_TouchpadToggle = 0x01000110, + Key_TouchpadOn = 0x01000111, + Key_TouchpadOff = 0x01000112, + + Key_MicMute = 0x01000113, + + Key_Red = 0x01000114, + Key_Green = 0x01000115, + Key_Yellow = 0x01000116, + Key_Blue = 0x01000117, + + Key_ChannelUp = 0x01000118, + Key_ChannelDown = 0x01000119, + + Key_Guide = 0x0100011a, + Key_Info = 0x0100011b, + Key_Settings = 0x0100011c, + + Key_MicVolumeUp = 0x0100011d, + Key_MicVolumeDown = 0x0100011e, + + Key_New = 0x01000120, + Key_Open = 0x01000121, + Key_Find = 0x01000122, + Key_Undo = 0x01000123, + Key_Redo = 0x01000124, + + Key_MediaLast = 0x0100ffff, + + // Keypad navigation keys + Key_Select = 0x01010000, + Key_Yes = 0x01010001, + Key_No = 0x01010002, + + // Newer misc keys + Key_Cancel = 0x01020001, + Key_Printer = 0x01020002, + Key_Execute = 0x01020003, + Key_Sleep = 0x01020004, + Key_Play = 0x01020005, // Not the same as Key_MediaPlay + Key_Zoom = 0x01020006, + //Key_Jisho = 0x01020007, // IME: Dictionary key + //Key_Oyayubi_Left = 0x01020008, // IME: Left Oyayubi key + //Key_Oyayubi_Right = 0x01020009, // IME: Right Oyayubi key + Key_Exit = 0x0102000a, + + // Device keys + Key_Context1 = 0x01100000, + Key_Context2 = 0x01100001, + Key_Context3 = 0x01100002, + Key_Context4 = 0x01100003, + Key_Call = 0x01100004, // set absolute state to in a call (do not toggle state) + Key_Hangup = 0x01100005, // set absolute state to hang up (do not toggle state) + Key_Flip = 0x01100006, + Key_ToggleCallHangup = 0x01100007, // a toggle key for answering, or hanging up, based on current call state + Key_VoiceDial = 0x01100008, + Key_LastNumberRedial = 0x01100009, + + Key_Camera = 0x01100020, + Key_CameraFocus = 0x01100021, + + // WARNING: Do not add any keys in the range 0x01200000 to 0xffffffff, + // as those bits are reserved for the Qt::KeyboardModifier enum below. + + Key_unknown = 0x01ffffff + }; + + enum KeyboardModifier { + NoModifier = 0x00000000, + ShiftModifier = 0x02000000, + ControlModifier = 0x04000000, + AltModifier = 0x08000000, + MetaModifier = 0x10000000, + KeypadModifier = 0x20000000, + GroupSwitchModifier = 0x40000000, + // Do not extend the mask to include 0x01000000 + KeyboardModifierMask = 0xfe000000 + }; + Q_DECLARE_FLAGS(KeyboardModifiers, KeyboardModifier) + Q_DECLARE_OPERATORS_FOR_FLAGS(KeyboardModifiers) + + //shorter names for shortcuts + // The use of all-caps identifiers has the potential for clashing with + // user-defined or third-party macros. More so when the identifiers are not + // "namespace"-prefixed. This is considered bad practice and is why + // KeypadModifier was not added to the Modifier enum. + // ### Qt 7: consider deprecating in favor of KeyboardModifier. + enum Modifier { + META = Qt::MetaModifier, + SHIFT = Qt::ShiftModifier, + CTRL = Qt::ControlModifier, + ALT = Qt::AltModifier, + MODIFIER_MASK = KeyboardModifierMask, + }; + Q_DECLARE_FLAGS(Modifiers, Modifier) + Q_DECLARE_OPERATORS_FOR_FLAGS(Modifiers) + + enum ArrowType { + NoArrow, + UpArrow, + DownArrow, + LeftArrow, + RightArrow + }; + + enum PenStyle { // pen style + NoPen, + SolidLine, + DashLine, + DotLine, + DashDotLine, + DashDotDotLine, + CustomDashLine +#ifndef Q_MOC_RUN + , MPenStyle = 0x0f +#endif + }; + + enum PenCapStyle { // line endcap style + FlatCap = 0x00, + SquareCap = 0x10, + RoundCap = 0x20, + MPenCapStyle = 0x30 + }; + + enum PenJoinStyle { // line join style + MiterJoin = 0x00, + BevelJoin = 0x40, + RoundJoin = 0x80, + SvgMiterJoin = 0x100, + MPenJoinStyle = 0x1c0 + }; + + enum BrushStyle { // brush style + NoBrush, + SolidPattern, + Dense1Pattern, + Dense2Pattern, + Dense3Pattern, + Dense4Pattern, + Dense5Pattern, + Dense6Pattern, + Dense7Pattern, + HorPattern, + VerPattern, + CrossPattern, + BDiagPattern, + FDiagPattern, + DiagCrossPattern, + LinearGradientPattern, + RadialGradientPattern, + ConicalGradientPattern, + TexturePattern = 24 + }; + + enum SizeMode { + AbsoluteSize, + RelativeSize + }; + + enum UIEffect { + UI_General, + UI_AnimateMenu, + UI_FadeMenu, + UI_AnimateCombo, + UI_AnimateTooltip, + UI_FadeTooltip, + UI_AnimateToolBox + }; + + enum CursorShape { + ArrowCursor, + UpArrowCursor, + CrossCursor, + WaitCursor, + IBeamCursor, + SizeVerCursor, + SizeHorCursor, + SizeBDiagCursor, + SizeFDiagCursor, + SizeAllCursor, + BlankCursor, + SplitVCursor, + SplitHCursor, + PointingHandCursor, + ForbiddenCursor, + WhatsThisCursor, + BusyCursor, + OpenHandCursor, + ClosedHandCursor, + DragCopyCursor, + DragMoveCursor, + DragLinkCursor, + LastCursor = DragLinkCursor, + BitmapCursor = 24, + CustomCursor = 25 + }; + + enum TextFormat { + PlainText, + RichText, + AutoText, + MarkdownText + }; + + enum AspectRatioMode { + IgnoreAspectRatio, + KeepAspectRatio, + KeepAspectRatioByExpanding + }; + + enum DockWidgetArea { + LeftDockWidgetArea = 0x1, + RightDockWidgetArea = 0x2, + TopDockWidgetArea = 0x4, + BottomDockWidgetArea = 0x8, + + DockWidgetArea_Mask = 0xf, + AllDockWidgetAreas = DockWidgetArea_Mask, + NoDockWidgetArea = 0 + }; + enum DockWidgetAreaSizes { + NDockWidgetAreas = 4 + }; + + Q_DECLARE_FLAGS(DockWidgetAreas, DockWidgetArea) + Q_DECLARE_OPERATORS_FOR_FLAGS(DockWidgetAreas) + + enum ToolBarArea { + LeftToolBarArea = 0x1, + RightToolBarArea = 0x2, + TopToolBarArea = 0x4, + BottomToolBarArea = 0x8, + + ToolBarArea_Mask = 0xf, + AllToolBarAreas = ToolBarArea_Mask, + NoToolBarArea = 0 + }; + + enum ToolBarAreaSizes { + NToolBarAreas = 4 + }; + + Q_DECLARE_FLAGS(ToolBarAreas, ToolBarArea) + Q_DECLARE_OPERATORS_FOR_FLAGS(ToolBarAreas) + + enum DateFormat { + TextDate, // default Qt + ISODate, // ISO 8601 + RFC2822Date = 8, // RFC 2822 (+ 850 and 1036 during parsing) + ISODateWithMs + }; + + enum TimeSpec { + LocalTime, + UTC, + OffsetFromUTC, + TimeZone + }; + + enum DayOfWeek { + Monday = 1, + Tuesday = 2, + Wednesday = 3, + Thursday = 4, + Friday = 5, + Saturday = 6, + Sunday = 7 + }; + + enum ScrollBarPolicy { + ScrollBarAsNeeded, + ScrollBarAlwaysOff, + ScrollBarAlwaysOn + }; + + enum CaseSensitivity { + CaseInsensitive, + CaseSensitive + }; + + enum Corner { + TopLeftCorner = 0x00000, + TopRightCorner = 0x00001, + BottomLeftCorner = 0x00002, + BottomRightCorner = 0x00003 + }; + + enum Edge { + TopEdge = 0x00001, + LeftEdge = 0x00002, + RightEdge = 0x00004, + BottomEdge = 0x00008 + }; + + Q_DECLARE_FLAGS(Edges, Edge) + Q_DECLARE_OPERATORS_FOR_FLAGS(Edges) + + enum ConnectionType { + AutoConnection, + DirectConnection, + QueuedConnection, + BlockingQueuedConnection, + UniqueConnection = 0x80, + SingleShotConnection = 0x100, + }; + + enum ShortcutContext { + WidgetShortcut, + WindowShortcut, + ApplicationShortcut, + WidgetWithChildrenShortcut + }; + + enum FillRule { + OddEvenFill, + WindingFill + }; + + enum MaskMode { + MaskInColor, + MaskOutColor + }; + + enum ClipOperation { + NoClip, + ReplaceClip, + IntersectClip + }; + + // Shape = 0x1, BoundingRect = 0x2 + enum ItemSelectionMode { + ContainsItemShape = 0x0, + IntersectsItemShape = 0x1, + ContainsItemBoundingRect = 0x2, + IntersectsItemBoundingRect = 0x3 + }; + + enum ItemSelectionOperation { + ReplaceSelection, + AddToSelection + }; + + enum TransformationMode { + FastTransformation, + SmoothTransformation + }; + + enum Axis { + XAxis, + YAxis, + ZAxis + }; + + enum FocusReason { + MouseFocusReason, + TabFocusReason, + BacktabFocusReason, + ActiveWindowFocusReason, + PopupFocusReason, + ShortcutFocusReason, + MenuBarFocusReason, + OtherFocusReason, + NoFocusReason + }; + + enum ContextMenuPolicy { + NoContextMenu, + DefaultContextMenu, + ActionsContextMenu, + CustomContextMenu, + PreventContextMenu + }; + + enum class ContextMenuTrigger { + Press, + Release, + }; + + enum InputMethodQuery { + ImEnabled = 0x1, + ImCursorRectangle = 0x2, + ImFont = 0x4, + ImCursorPosition = 0x8, + ImSurroundingText = 0x10, + ImCurrentSelection = 0x20, + ImMaximumTextLength = 0x40, + ImAnchorPosition = 0x80, + ImHints = 0x100, + ImPreferredLanguage = 0x200, + + ImAbsolutePosition = 0x400, + ImTextBeforeCursor = 0x800, + ImTextAfterCursor = 0x1000, + ImEnterKeyType = 0x2000, + ImAnchorRectangle = 0x4000, + ImInputItemClipRectangle = 0x8000, + + ImReadOnly = 0x10000, + ImPlatformData = 0x80000000, + ImQueryInput = ImCursorRectangle | ImCursorPosition | ImSurroundingText | + ImCurrentSelection | ImAnchorRectangle | ImAnchorPosition, + ImQueryAll = 0xffffffff + }; + Q_DECLARE_FLAGS(InputMethodQueries, InputMethodQuery) + Q_DECLARE_OPERATORS_FOR_FLAGS(InputMethodQueries) + + enum InputMethodHint { + ImhNone = 0x0, + + ImhHiddenText = 0x1, + ImhSensitiveData = 0x2, + ImhNoAutoUppercase = 0x4, + ImhPreferNumbers = 0x8, + ImhPreferUppercase = 0x10, + ImhPreferLowercase = 0x20, + ImhNoPredictiveText = 0x40, + + ImhDate = 0x80, + ImhTime = 0x100, + + ImhPreferLatin = 0x200, + + ImhMultiLine = 0x400, + + ImhNoEditMenu = 0x800, + ImhNoTextHandles = 0x1000, + + ImhDigitsOnly = 0x10000, + ImhFormattedNumbersOnly = 0x20000, + ImhUppercaseOnly = 0x40000, + ImhLowercaseOnly = 0x80000, + ImhDialableCharactersOnly = 0x100000, + ImhEmailCharactersOnly = 0x200000, + ImhUrlCharactersOnly = 0x400000, + ImhLatinOnly = 0x800000, + + ImhExclusiveInputMask = 0xffff0000 + }; + Q_DECLARE_FLAGS(InputMethodHints, InputMethodHint) + Q_DECLARE_OPERATORS_FOR_FLAGS(InputMethodHints) + + enum EnterKeyType { + EnterKeyDefault, + EnterKeyReturn, + EnterKeyDone, + EnterKeyGo, + EnterKeySend, + EnterKeySearch, + EnterKeyNext, + EnterKeyPrevious + }; + + enum ToolButtonStyle { + ToolButtonIconOnly, + ToolButtonTextOnly, + ToolButtonTextBesideIcon, + ToolButtonTextUnderIcon, + ToolButtonFollowStyle + }; + + enum LayoutDirection { + LeftToRight, + RightToLeft, + // ### Qt 7: make auto the first one (with value 0) + LayoutDirectionAuto + }; + + enum AnchorPoint { + AnchorLeft = 0, + AnchorHorizontalCenter, + AnchorRight, + AnchorTop, + AnchorVerticalCenter, + AnchorBottom + }; + + enum FindChildOption { + FindDirectChildrenOnly = 0x0, + FindChildrenRecursively = 0x1 + }; + Q_DECLARE_FLAGS(FindChildOptions, FindChildOption) + + enum DropAction { + CopyAction = 0x1, + MoveAction = 0x2, + LinkAction = 0x4, + ActionMask = 0xff, + TargetMoveAction = 0x8002, + IgnoreAction = 0x0 + }; + Q_DECLARE_FLAGS(DropActions, DropAction) + Q_DECLARE_OPERATORS_FOR_FLAGS(DropActions) + + enum CheckState { + Unchecked, + PartiallyChecked, + Checked + }; + + enum ItemDataRole { + DisplayRole = 0, + DecorationRole = 1, + EditRole = 2, + ToolTipRole = 3, + StatusTipRole = 4, + WhatsThisRole = 5, + // Metadata + FontRole = 6, + TextAlignmentRole = 7, + BackgroundRole = 8, + ForegroundRole = 9, + CheckStateRole = 10, + // Accessibility + AccessibleTextRole = 11, + AccessibleDescriptionRole = 12, + // More general purpose + SizeHintRole = 13, + InitialSortOrderRole = 14, + // Internal UiLib roles. Start worrying when public roles go that high. + DisplayPropertyRole = 27, + DecorationPropertyRole = 28, + ToolTipPropertyRole = 29, + StatusTipPropertyRole = 30, + WhatsThisPropertyRole = 31, + // Reserved + UserRole = 0x0100 + }; + + enum ItemFlag { + NoItemFlags = 0, + ItemIsSelectable = 1, + ItemIsEditable = 2, + ItemIsDragEnabled = 4, + ItemIsDropEnabled = 8, + ItemIsUserCheckable = 16, + ItemIsEnabled = 32, + ItemIsAutoTristate = 64, + ItemNeverHasChildren = 128, + ItemIsUserTristate = 256 + }; + Q_DECLARE_FLAGS(ItemFlags, ItemFlag) + Q_DECLARE_OPERATORS_FOR_FLAGS(ItemFlags) + + enum MatchFlag { + MatchExactly = 0, + MatchContains = 1, + MatchStartsWith = 2, + MatchEndsWith = 3, + MatchRegularExpression = 4, + MatchWildcard = 5, + MatchFixedString = 8, + MatchTypeMask = 0x0F, + MatchCaseSensitive = 16, + MatchWrap = 32, + MatchRecursive = 64 + }; + Q_DECLARE_FLAGS(MatchFlags, MatchFlag) + Q_DECLARE_OPERATORS_FOR_FLAGS(MatchFlags) + + typedef void * HANDLE; + + enum WindowModality { + NonModal, + WindowModal, + ApplicationModal + }; + + enum TextInteractionFlag { + NoTextInteraction = 0, + TextSelectableByMouse = 1, + TextSelectableByKeyboard = 2, + LinksAccessibleByMouse = 4, + LinksAccessibleByKeyboard = 8, + TextEditable = 16, + + TextEditorInteraction = TextSelectableByMouse | TextSelectableByKeyboard | TextEditable, + TextBrowserInteraction = TextSelectableByMouse | LinksAccessibleByMouse | LinksAccessibleByKeyboard + }; + Q_DECLARE_FLAGS(TextInteractionFlags, TextInteractionFlag) + Q_DECLARE_OPERATORS_FOR_FLAGS(TextInteractionFlags) + + enum EventPriority { + HighEventPriority = 1, + NormalEventPriority = 0, + LowEventPriority = -1 + }; + + enum SizeHint { + MinimumSize, + PreferredSize, + MaximumSize, + MinimumDescent, + NSizeHints + }; + + enum WindowFrameSection { + NoSection, + LeftSection, // For resize + TopLeftSection, + TopSection, + TopRightSection, + RightSection, + BottomRightSection, + BottomSection, + BottomLeftSection, + TitleBarArea // For move + }; + + enum class Initialization { + Uninitialized + }; + inline constexpr Initialization Uninitialized = Initialization::Uninitialized; + + inline QT_DEFINE_TAG(Disambiguated); + + enum CoordinateSystem { + DeviceCoordinates, + LogicalCoordinates + }; + + enum TouchPointState { + TouchPointUnknownState = 0x00, + TouchPointPressed = 0x01, + TouchPointMoved = 0x02, + TouchPointStationary = 0x04, + TouchPointReleased = 0x08 + }; + Q_DECLARE_FLAGS(TouchPointStates, TouchPointState) + Q_DECLARE_OPERATORS_FOR_FLAGS(TouchPointStates) + +#ifndef QT_NO_GESTURES + enum GestureState + { + NoGesture, + GestureStarted = 1, + GestureUpdated = 2, + GestureFinished = 3, + GestureCanceled = 4 + }; + + enum GestureType + { + TapGesture = 1, + TapAndHoldGesture = 2, + PanGesture = 3, + PinchGesture = 4, + SwipeGesture = 5, + + CustomGesture = 0x0100, + + LastGestureType = ~0u + }; + + enum GestureFlag + { + DontStartGestureOnChildren = 0x01, + ReceivePartialGestures = 0x02, + IgnoredGesturesPropagateToParent = 0x04 + }; + Q_DECLARE_FLAGS(GestureFlags, GestureFlag) + Q_DECLARE_OPERATORS_FOR_FLAGS(GestureFlags) + + enum NativeGestureType + { + BeginNativeGesture, + EndNativeGesture, + PanNativeGesture, + ZoomNativeGesture, + SmartZoomNativeGesture, + RotateNativeGesture, + SwipeNativeGesture + }; + +#endif // QT_NO_GESTURES + + enum NavigationMode + { + NavigationModeNone, + NavigationModeKeypadTabOrder, + NavigationModeKeypadDirectional, + NavigationModeCursorAuto, + NavigationModeCursorForceVisible + }; + + enum CursorMoveStyle { + LogicalMoveStyle, + VisualMoveStyle + }; + + enum TimerType { + PreciseTimer, + CoarseTimer, + VeryCoarseTimer + }; + + enum class TimerId { + Invalid = 0, + }; + + enum ScrollPhase { + NoScrollPhase = 0, + ScrollBegin, + ScrollUpdate, + ScrollEnd, + ScrollMomentum + }; + + enum MouseEventSource { + MouseEventNotSynthesized, + MouseEventSynthesizedBySystem, + MouseEventSynthesizedByQt, + MouseEventSynthesizedByApplication + }; + + enum MouseEventFlag { + NoMouseEventFlag = 0x00, + MouseEventCreatedDoubleClick = 0x01, + MouseEventFlagMask = 0xFF + }; + Q_DECLARE_FLAGS(MouseEventFlags, MouseEventFlag) + Q_DECLARE_OPERATORS_FOR_FLAGS(MouseEventFlags) + + enum ChecksumType { + ChecksumIso3309, + ChecksumItuV41 + }; + + enum class HighDpiScaleFactorRoundingPolicy { + Unset, + Round, + Ceil, + Floor, + RoundPreferFloor, + PassThrough + }; + + enum class PermissionStatus { + Undetermined, + Granted, + Denied, + }; + + // QTBUG-48701 + enum ReturnByValueConstant { ReturnByValue }; // ### Qt 7: Remove me + +#ifndef Q_QDOC + // NOTE: Generally, do not add Q_ENUM_NS if a corresponding Q_FLAG_NS exists. + Q_ENUM_NS(ScrollBarPolicy) + Q_ENUM_NS(FocusPolicy) + Q_ENUM_NS(ContextMenuPolicy) + Q_ENUM_NS(ContextMenuTrigger) + Q_ENUM_NS(ArrowType) + Q_ENUM_NS(ToolButtonStyle) + Q_ENUM_NS(PenStyle) + Q_ENUM_NS(PenCapStyle) + Q_ENUM_NS(PenJoinStyle) + Q_ENUM_NS(BrushStyle) + Q_ENUM_NS(FillRule) + Q_ENUM_NS(MaskMode) + Q_ENUM_NS(BGMode) + Q_ENUM_NS(ClipOperation) + Q_ENUM_NS(SizeMode) + Q_ENUM_NS(Axis) + Q_ENUM_NS(Corner) + Q_ENUM_NS(Edge) + Q_ENUM_NS(LayoutDirection) + Q_ENUM_NS(SizeHint) + Q_ENUM_NS(Orientation) + Q_ENUM_NS(DropAction) + Q_FLAG_NS(Alignment) + Q_ENUM_NS(TextFlag) + Q_FLAG_NS(Orientations) + Q_FLAG_NS(SplitBehavior) + Q_FLAG_NS(DropActions) + Q_FLAG_NS(Edges) + Q_FLAG_NS(DockWidgetAreas) + Q_FLAG_NS(ToolBarAreas) + Q_ENUM_NS(DockWidgetArea) + Q_ENUM_NS(ToolBarArea) + Q_ENUM_NS(TextFormat) + Q_ENUM_NS(TextElideMode) + Q_ENUM_NS(DateFormat) + Q_ENUM_NS(TimeSpec) + Q_ENUM_NS(DayOfWeek) + Q_ENUM_NS(CursorShape) + Q_ENUM_NS(GlobalColor) + Q_ENUM_NS(ColorScheme) + Q_ENUM_NS(AspectRatioMode) + Q_ENUM_NS(TransformationMode) + Q_FLAG_NS(ImageConversionFlags) + Q_ENUM_NS(Key) + Q_ENUM_NS(ShortcutContext) + Q_ENUM_NS(TextInteractionFlag) + Q_FLAG_NS(TextInteractionFlags) + Q_ENUM_NS(ItemSelectionMode) + Q_ENUM_NS(ItemSelectionOperation) + Q_FLAG_NS(ItemFlags) + Q_ENUM_NS(CheckState) + Q_ENUM_NS(ItemDataRole) + Q_ENUM_NS(SortOrder) + Q_ENUM_NS(CaseSensitivity) + Q_FLAG_NS(MatchFlags) + Q_ENUM_NS(Modifier) + Q_FLAG_NS(Modifiers) + Q_ENUM_NS(KeyboardModifier) + Q_FLAG_NS(KeyboardModifiers) + Q_FLAG_NS(MouseButtons) + Q_ENUM_NS(WindowType) + Q_ENUM_NS(WindowState) + Q_ENUM_NS(WindowModality) + Q_ENUM_NS(WidgetAttribute) + Q_ENUM_NS(ApplicationAttribute) + Q_FLAG_NS(WindowFlags) + Q_FLAG_NS(WindowStates) + Q_ENUM_NS(FocusReason) + Q_ENUM_NS(InputMethodHint) + Q_ENUM_NS(InputMethodQuery) + Q_FLAG_NS(InputMethodHints) + Q_ENUM_NS(EnterKeyType) + Q_FLAG_NS(InputMethodQueries) + Q_FLAG_NS(TouchPointStates) + Q_ENUM_NS(ScreenOrientation) + Q_FLAG_NS(ScreenOrientations) + Q_ENUM_NS(ConnectionType) + Q_ENUM_NS(ApplicationState) +#ifndef QT_NO_GESTURES + Q_ENUM_NS(GestureState) + Q_ENUM_NS(GestureType) + Q_ENUM_NS(NativeGestureType) +#endif + Q_ENUM_NS(CursorMoveStyle) + Q_ENUM_NS(TimerType) + Q_ENUM_NS(TimerId) + Q_ENUM_NS(ScrollPhase) + Q_ENUM_NS(MouseEventSource) + Q_FLAG_NS(MouseEventFlags) + Q_ENUM_NS(ChecksumType) + Q_ENUM_NS(HighDpiScaleFactorRoundingPolicy) + Q_ENUM_NS(TabFocusBehavior) + Q_ENUM_NS(PermissionStatus) +#endif // Q_DOC + +} + +typedef bool (*qInternalCallback)(void **); + +class Q_CORE_EXPORT QInternal { +public: + enum PaintDeviceFlags { + UnknownDevice = 0x00, + Widget = 0x01, + Pixmap = 0x02, + Image = 0x03, + Printer = 0x04, + Picture = 0x05, + Pbuffer = 0x06, // GL pbuffer + FramebufferObject = 0x07, // GL framebuffer object + CustomRaster = 0x08, + PaintBuffer = 0x0a, + OpenGL = 0x0b + }; + enum RelayoutType { + RelayoutNormal, + RelayoutDragging, + RelayoutDropped + }; + + enum DockPosition { + LeftDock, + RightDock, + TopDock, + BottomDock, + DockCount + }; + + enum Callback { + EventNotifyCallback, + LastCallback + }; + static bool registerCallback(Callback, qInternalCallback); + static bool unregisterCallback(Callback, qInternalCallback); + static bool activateCallbacks(Callback, void **); +}; + +class QKeyCombination +{ + int combination; + +public: + constexpr Q_IMPLICIT QKeyCombination(Qt::Key key = Qt::Key_unknown) noexcept + : combination(int(key)) + {} + + constexpr explicit QKeyCombination(Qt::Modifiers modifiers, Qt::Key key = Qt::Key_unknown) noexcept + : combination(modifiers.toInt() | int(key)) + {} + + constexpr explicit QKeyCombination(Qt::KeyboardModifiers modifiers, Qt::Key key = Qt::Key_unknown) noexcept + : combination(modifiers.toInt() | int(key)) + {} + + constexpr Qt::KeyboardModifiers keyboardModifiers() const noexcept + { + return Qt::KeyboardModifiers(combination & Qt::KeyboardModifierMask); + } + + constexpr Qt::Key key() const noexcept + { + return Qt::Key(combination & ~int(Qt::KeyboardModifierMask)); + } + + static constexpr QKeyCombination fromCombined(int combined) + { + QKeyCombination result; + result.combination = combined; + return result; + } + + constexpr int toCombined() const noexcept + { + return combination; + } + +#if QT_DEPRECATED_SINCE(6, 0) + QT_DEPRECATED_VERSION_X(6, 0, "Use QKeyCombination instead of int") + constexpr Q_IMPLICIT operator int() const noexcept + { + return combination; + } +#endif + bool operator<(QKeyCombination) const = delete; +private: + friend constexpr bool comparesEqual(const QKeyCombination &lhs, + const QKeyCombination &rhs) noexcept + { + return lhs.combination == rhs.combination; + } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QKeyCombination) +}; + +Q_DECLARE_TYPEINFO(QKeyCombination, Q_RELOCATABLE_TYPE); + +namespace Qt { +constexpr QKeyCombination operator|(Qt::Modifier modifier, Qt::Key key) noexcept +{ + return QKeyCombination(modifier, key); +} + +constexpr QKeyCombination operator|(Qt::Modifiers modifiers, Qt::Key key) noexcept +{ + return QKeyCombination(modifiers, key); +} + +constexpr QKeyCombination operator|(Qt::KeyboardModifier modifier, Qt::Key key) noexcept +{ + return QKeyCombination(modifier, key); +} + +constexpr QKeyCombination operator|(Qt::KeyboardModifiers modifiers, Qt::Key key) noexcept +{ + return QKeyCombination(modifiers, key); +} + +constexpr QKeyCombination operator|(Qt::Key key, Qt::Modifier modifier) noexcept +{ + return QKeyCombination(modifier, key); +} + +constexpr QKeyCombination operator|(Qt::Key key, Qt::Modifiers modifiers) noexcept +{ + return QKeyCombination(modifiers, key); +} + +constexpr QKeyCombination operator|(Qt::Key key, Qt::KeyboardModifier modifier) noexcept +{ + return QKeyCombination(modifier, key); +} + +constexpr QKeyCombination operator|(Qt::Key key, Qt::KeyboardModifiers modifiers) noexcept +{ + return QKeyCombination(modifiers, key); +} + +#if QT_DEPRECATED_SINCE(6, 0) +QT_DEPRECATED_VERSION_X(6, 0, "Use operator| instead") +constexpr QKeyCombination operator+(Qt::Modifier modifier, Qt::Key key) noexcept +{ + return QKeyCombination(modifier, key); +} + +QT_DEPRECATED_VERSION_X(6, 0, "Use operator| instead") +constexpr QKeyCombination operator+(Qt::Modifiers modifiers, Qt::Key key) noexcept +{ + return QKeyCombination(modifiers, key); +} + +QT_DEPRECATED_VERSION_X(6, 0, "Use operator| instead") +constexpr QKeyCombination operator+(Qt::KeyboardModifier modifier, Qt::Key key) noexcept +{ + return QKeyCombination(modifier, key); +} + +QT_DEPRECATED_VERSION_X(6, 0, "Use operator| instead") +constexpr QKeyCombination operator+(Qt::KeyboardModifiers modifiers, Qt::Key key) noexcept +{ + return QKeyCombination(modifiers, key); +} + +QT_DEPRECATED_VERSION_X(6, 0, "Use operator| instead") +constexpr QKeyCombination operator+(Qt::Key key, Qt::Modifier modifier) noexcept +{ + return QKeyCombination(modifier, key); +} + +QT_DEPRECATED_VERSION_X(6, 0, "Use operator| instead") +constexpr QKeyCombination operator+(Qt::Key key, Qt::Modifiers modifiers) noexcept +{ + return QKeyCombination(modifiers, key); +} + +QT_DEPRECATED_VERSION_X(6, 0, "Use operator| instead") +constexpr QKeyCombination operator+(Qt::Key key, Qt::KeyboardModifier modifier) noexcept +{ + return QKeyCombination(modifier, key); +} + +QT_DEPRECATED_VERSION_X(6, 0, "Use operator| instead") +constexpr QKeyCombination operator+(Qt::Key key, Qt::KeyboardModifiers modifiers) noexcept +{ + return QKeyCombination(modifiers, key); +} +#endif +} + +QT_END_NAMESPACE + +#endif // QNAMESPACE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qnativeinterface.h b/qt/6.8.1/msvc2022_64/include/QtCore/qnativeinterface.h new file mode 100644 index 0000000000000000000000000000000000000000..0a1c2d9216502ff99274c8edfaa509b3faf50834 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qnativeinterface.h @@ -0,0 +1,148 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QNATIVEINTERFACE_H +#define QNATIVEINTERFACE_H + +#include + +QT_BEGIN_NAMESPACE + +// We declare a virtual non-inline function in the form +// of the destructor, making it the key function. This +// ensures that the typeinfo of the class is exported. +// By being protected, we also ensure that pointers to +// the interface can't be deleted. +#define QT_DECLARE_NATIVE_INTERFACE_3(NativeInterface, Revision, BaseType) \ + protected: \ + virtual ~NativeInterface(); \ + \ + struct TypeInfo { \ + using baseType = BaseType; \ + static constexpr char const *name = QT_STRINGIFY(NativeInterface); \ + static constexpr int revision = Revision; \ + }; \ + \ + template \ + friend struct QNativeInterface::Private::has_type_info; \ + \ + template \ + friend bool constexpr QNativeInterface::Private::hasTypeInfo(); \ + \ + template \ + friend struct QNativeInterface::Private::TypeInfo; \ + public: \ + NativeInterface() = default; \ + Q_DISABLE_COPY_MOVE(NativeInterface) + +// Revisioned interfaces only make sense when exposed through a base +// type via QT_DECLARE_NATIVE_INTERFACE_ACCESSOR, as the revision +// checks happen at that level (and not for normal dynamic_casts). +#define QT_DECLARE_NATIVE_INTERFACE_2(NativeInterface, Revision) \ + static_assert(false, "Must provide a base type when specifying revision"); + +#define QT_DECLARE_NATIVE_INTERFACE_1(NativeInterface) \ + QT_DECLARE_NATIVE_INTERFACE_3(NativeInterface, 0, void) + +#define QT_DECLARE_NATIVE_INTERFACE(...) \ + QT_OVERLOADED_MACRO(QT_DECLARE_NATIVE_INTERFACE, __VA_ARGS__) + +namespace QNativeInterface::Private { + + // Basic type-trait to verify that a given native interface has + // all the required type information for us to evaluate it. + template + struct has_type_info : std::false_type {}; + + // The type-trait is friended by TypeInfo, so that we can + // evaluate TypeInfo in the template arguments. + template + struct has_type_info> : std::true_type {}; + + // We need to wrap the instantiation of has_type_info in a + // function friended by TypeInfo, otherwise MSVC will not + // let us evaluate TypeInfo in the template arguments. + template + bool constexpr hasTypeInfo() + { + return has_type_info::value; + } + + template + struct TypeInfo + { + // To ensure SFINAE works for hasTypeInfo we can't use it in a constexpr + // variable that also includes an expression that relies on the type + // info. This helper variable is okey, as it it self contained. + static constexpr bool haveTypeInfo = hasTypeInfo(); + + // We can then use the helper variable in a constexpr condition in a + // function, which does not break SFINAE if haveTypeInfo is false. + template + static constexpr bool isCompatibleHelper() + { + if constexpr (haveTypeInfo) + return std::is_base_of::value; + else + return false; + } + + // MSVC however doesn't like constexpr functions in enable_if_t conditions, + // so we need to wrap it yet again in a constexpr variable. This is fine, + // as all the SFINAE magic has been resolved at this point. + template + static constexpr bool isCompatibleWith = isCompatibleHelper(); + + // The revision and name accessors are not used in enable_if_t conditions, + // so we can leave them as constexpr functions. As this class template is + // friended by TypeInfo we can access the protected members of TypeInfo. + static constexpr int revision() + { + if constexpr (haveTypeInfo) + return NativeInterface::TypeInfo::revision; + else + return 0; + } + + static constexpr char const *name() + { + if constexpr (haveTypeInfo) + return NativeInterface::TypeInfo::name; + else + return nullptr; + } + }; + + // Wrapper type to make the error message in case + // of incompatible interface types read better. + template + struct NativeInterface : TypeInfo {}; +} // QNativeInterface::Private + +// Declares an accessor for the native interface +#ifdef Q_QDOC +#define QT_DECLARE_NATIVE_INTERFACE_ACCESSOR(T) \ + template \ + QNativeInterface *nativeInterface() const; +#else +#define QT_DECLARE_NATIVE_INTERFACE_ACCESSOR(T) \ + template , \ + typename BaseType = T, std::enable_if_t, bool> = true> \ + NativeInterface *nativeInterface() const \ + { \ + return static_cast(resolveInterface( \ + TypeInfo::name(), TypeInfo::revision())); \ + } \ + protected: \ + void *resolveInterface(const char *name, int revision) const; \ + public: +#endif + +QT_END_NAMESPACE + +#endif // QNATIVEINTERFACE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qnumeric.h b/qt/6.8.1/msvc2022_64/include/QtCore/qnumeric.h new file mode 100644 index 0000000000000000000000000000000000000000..ac0c0ebf6c083587aeae76e92df75b20c520c1b5 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qnumeric.h @@ -0,0 +1,409 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QNUMERIC_H +#define QNUMERIC_H + +#if 0 +#pragma qt_class(QtNumeric) +#endif + +#include +#include +#include + +#include +#include +#include + +// min() and max() may be #defined by windows.h if that is included before, but we need them +// for std::numeric_limits below. You should not use the min() and max() macros, so we just #undef. +#ifdef min +# undef min +# undef max +#endif + +#if defined(Q_CC_MSVC) +# include +# include +# if defined(Q_PROCESSOR_X86_64) || defined(Q_PROCESSOR_ARM_64) +# define Q_INTRINSIC_MUL_OVERFLOW64 +# define Q_UMULH(v1, v2) __umulh(v1, v2); +# define Q_SMULH(v1, v2) __mulh(v1, v2); +# pragma intrinsic(__umulh) +# pragma intrinsic(__mulh) +# endif +#endif + +# if defined(Q_OS_INTEGRITY) && defined(Q_PROCESSOR_ARM_64) +# include +# define Q_INTRINSIC_MUL_OVERFLOW64 +# define Q_UMULH(v1, v2) __MULUH64(v1, v2); +# define Q_SMULH(v1, v2) __MULSH64(v1, v2); +#endif + +QT_BEGIN_NAMESPACE + +// To match std::is{inf,nan,finite} functions: +template +constexpr typename std::enable_if::value, bool>::type +qIsInf(T) { return false; } +template +constexpr typename std::enable_if::value, bool>::type +qIsNaN(T) { return false; } +template +constexpr typename std::enable_if::value, bool>::type +qIsFinite(T) { return true; } + +// Floating-point types (see qfloat16.h for its overloads). +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsInf(double d); +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsNaN(double d); +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsFinite(double d); +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION int qFpClassify(double val); +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsInf(float f); +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsNaN(float f); +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsFinite(float f); +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION int qFpClassify(float val); + +#if QT_CONFIG(signaling_nan) +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION double qSNaN(); +#endif +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION double qQNaN(); +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION double qInf(); + +Q_CORE_EXPORT quint32 qFloatDistance(float a, float b); +Q_CORE_EXPORT quint64 qFloatDistance(double a, double b); + +#define Q_INFINITY (QT_PREPEND_NAMESPACE(qInf)()) +#if QT_CONFIG(signaling_nan) +# define Q_SNAN (QT_PREPEND_NAMESPACE(qSNaN)()) +#endif +#define Q_QNAN (QT_PREPEND_NAMESPACE(qQNaN)()) + +// Overflow math. +// This provides efficient implementations for int, unsigned, qsizetype and +// size_t. Implementations for 8- and 16-bit types will work but may not be as +// efficient. Implementations for 64-bit may be missing on 32-bit platforms. + +#if (Q_CC_GNU >= 500 || __has_builtin(__builtin_add_overflow)) \ + && !(QT_POINTER_SIZE == 4 && defined(Q_CC_CLANG)) +// GCC 5 and Clang 3.8 have builtins to detect overflows +// 32 bit Clang has the builtins but tries to link a library which hasn't +#define Q_INTRINSIC_MUL_OVERFLOW64 + +template inline +typename std::enable_if_t || std::is_signed_v, bool> +qAddOverflow(T v1, T v2, T *r) +{ return __builtin_add_overflow(v1, v2, r); } + +template inline +typename std::enable_if_t || std::is_signed_v, bool> +qSubOverflow(T v1, T v2, T *r) +{ return __builtin_sub_overflow(v1, v2, r); } + +template inline +typename std::enable_if_t || std::is_signed_v, bool> +qMulOverflow(T v1, T v2, T *r) +{ return __builtin_mul_overflow(v1, v2, r); } + +#else +// Generic implementations + +template inline typename std::enable_if_t, bool> +qAddOverflow(T v1, T v2, T *r) +{ + // unsigned additions are well-defined + *r = v1 + v2; + return v1 > T(v1 + v2); +} + +template inline typename std::enable_if_t, bool> +qAddOverflow(T v1, T v2, T *r) +{ + // Here's how we calculate the overflow: + // 1) unsigned addition is well-defined, so we can always execute it + // 2) conversion from unsigned back to signed is implementation- + // defined and in the implementations we use, it's a no-op. + // 3) signed integer overflow happens if the sign of the two input operands + // is the same but the sign of the result is different. In other words, + // the sign of the result must be the same as the sign of either + // operand. + + using U = typename std::make_unsigned_t; + *r = T(U(v1) + U(v2)); + + // If int is two's complement, assume all integer types are too. + if (std::is_same_v) { + // Two's complement equivalent (generates slightly shorter code): + // x ^ y is negative if x and y have different signs + // x & y is negative if x and y are negative + // (x ^ z) & (y ^ z) is negative if x and z have different signs + // AND y and z have different signs + return ((v1 ^ *r) & (v2 ^ *r)) < 0; + } + + bool s1 = (v1 < 0); + bool s2 = (v2 < 0); + bool sr = (*r < 0); + return s1 != sr && s2 != sr; + // also: return s1 == s2 && s1 != sr; +} + +template inline typename std::enable_if_t, bool> +qSubOverflow(T v1, T v2, T *r) +{ + // unsigned subtractions are well-defined + *r = v1 - v2; + return v1 < v2; +} + +template inline typename std::enable_if_t, bool> +qSubOverflow(T v1, T v2, T *r) +{ + // See above for explanation. This is the same with some signs reversed. + // We can't use qAddOverflow(v1, -v2, r) because it would be UB if + // v2 == std::numeric_limits::min(). + + using U = typename std::make_unsigned_t; + *r = T(U(v1) - U(v2)); + + if (std::is_same_v) + return ((v1 ^ *r) & (~v2 ^ *r)) < 0; + + bool s1 = (v1 < 0); + bool s2 = !(v2 < 0); + bool sr = (*r < 0); + return s1 != sr && s2 != sr; + // also: return s1 == s2 && s1 != sr; +} + +template inline +typename std::enable_if_t || std::is_signed_v, bool> +qMulOverflow(T v1, T v2, T *r) +{ + // use the next biggest type + // Note: for 64-bit systems where __int128 isn't supported, this will cause an error. + using LargerInt = QIntegerForSize; + using Larger = typename std::conditional_t, + typename LargerInt::Signed, typename LargerInt::Unsigned>; + Larger lr = Larger(v1) * Larger(v2); + *r = T(lr); + return lr > (std::numeric_limits::max)() || lr < (std::numeric_limits::min)(); +} + +# if defined(Q_INTRINSIC_MUL_OVERFLOW64) +template <> inline bool qMulOverflow(quint64 v1, quint64 v2, quint64 *r) +{ + *r = v1 * v2; + return Q_UMULH(v1, v2); +} +template <> inline bool qMulOverflow(qint64 v1, qint64 v2, qint64 *r) +{ + // This is slightly more complex than the unsigned case above: the sign bit + // of 'low' must be replicated as the entire 'high', so the only valid + // values for 'high' are 0 and -1. Use unsigned multiply since it's the same + // as signed for the low bits and use a signed right shift to verify that + // 'high' is nothing but sign bits that match the sign of 'low'. + + qint64 high = Q_SMULH(v1, v2); + *r = qint64(quint64(v1) * quint64(v2)); + return (*r >> 63) != high; +} + +# if defined(Q_OS_INTEGRITY) && defined(Q_PROCESSOR_ARM_64) +template <> inline bool qMulOverflow(uint64_t v1, uint64_t v2, uint64_t *r) +{ + return qMulOverflow(v1,v2,reinterpret_cast(r)); +} + +template <> inline bool qMulOverflow(int64_t v1, int64_t v2, int64_t *r) +{ + return qMulOverflow(v1,v2,reinterpret_cast(r)); +} +# endif // OS_INTEGRITY ARM64 +# endif // Q_INTRINSIC_MUL_OVERFLOW64 + +# if defined(Q_CC_MSVC) && defined(Q_PROCESSOR_X86) +// We can use intrinsics for the unsigned operations with MSVC +template <> inline bool qAddOverflow(unsigned v1, unsigned v2, unsigned *r) +{ return _addcarry_u32(0, v1, v2, r); } + +// 32-bit qMulOverflow is fine with the generic code above + +template <> inline bool qAddOverflow(quint64 v1, quint64 v2, quint64 *r) +{ +# if defined(Q_PROCESSOR_X86_64) + return _addcarry_u64(0, v1, v2, reinterpret_cast(r)); +# else + uint low, high; + uchar carry = _addcarry_u32(0, unsigned(v1), unsigned(v2), &low); + carry = _addcarry_u32(carry, v1 >> 32, v2 >> 32, &high); + *r = (quint64(high) << 32) | low; + return carry; +# endif // !x86-64 +} +# endif // MSVC X86 +#endif // !GCC + +// Implementations for addition, subtraction or multiplication by a +// compile-time constant. For addition and subtraction, we simply call the code +// that detects overflow at runtime. For multiplication, we compare to the +// maximum possible values before multiplying to ensure no overflow happens. + +template bool qAddOverflow(T v1, std::integral_constant, T *r) +{ + return qAddOverflow(v1, V2, r); +} + +template bool qAddOverflow(T v1, T *r) +{ + return qAddOverflow(v1, std::integral_constant{}, r); +} + +template bool qSubOverflow(T v1, std::integral_constant, T *r) +{ + return qSubOverflow(v1, V2, r); +} + +template bool qSubOverflow(T v1, T *r) +{ + return qSubOverflow(v1, std::integral_constant{}, r); +} + +template bool qMulOverflow(T v1, std::integral_constant, T *r) +{ + // Runtime detection for anything smaller than or equal to a register + // width, as most architectures' multiplication instructions actually + // produce a result twice as wide as the input registers, allowing us to + // efficiently detect the overflow. + if constexpr (sizeof(T) <= sizeof(qregisteruint)) { + return qMulOverflow(v1, V2, r); + +#ifdef Q_INTRINSIC_MUL_OVERFLOW64 + } else if constexpr (sizeof(T) <= sizeof(quint64)) { + // If we have intrinsics detecting overflow of 64-bit multiplications, + // then detect overflows through them up to 64 bits. + return qMulOverflow(v1, V2, r); +#endif + + } else if constexpr (V2 == 0 || V2 == 1) { + // trivial cases (and simplify logic below due to division by zero) + *r = v1 * V2; + return false; + } else if constexpr (V2 == -1) { + // multiplication by -1 is valid *except* for signed minimum values + // (necessary to avoid diving min() by -1, which is an overflow) + if (v1 < 0 && v1 == (std::numeric_limits::min)()) + return true; + *r = -v1; + return false; + } else { + // For 64-bit multiplications on 32-bit platforms, let's instead compare v1 + // against the bounds that would overflow. + constexpr T Highest = (std::numeric_limits::max)() / V2; + constexpr T Lowest = (std::numeric_limits::min)() / V2; + if constexpr (Highest > Lowest) { + if (v1 > Highest || v1 < Lowest) + return true; + } else { + // this can only happen if V2 < 0 + static_assert(V2 < 0); + if (v1 > Lowest || v1 < Highest) + return true; + } + + *r = v1 * V2; + return false; + } +} + +template bool qMulOverflow(T v1, T *r) +{ + if constexpr (V2 == 2) + return qAddOverflow(v1, v1, r); + return qMulOverflow(v1, std::integral_constant{}, r); +} + +template +constexpr inline T qAbs(const T &t) { return t >= 0 ? t : -t; } + +// gcc < 10 doesn't have __has_builtin +#if defined(Q_PROCESSOR_ARM_64) && (__has_builtin(__builtin_round) || defined(Q_CC_GNU)) && !defined(Q_CC_CLANG) +// ARM64 has a single instruction that can do C++ rounding with conversion to integer. +// Note current clang versions have non-constexpr __builtin_round, ### allow clang this path when they fix it. +constexpr inline int qRound(double d) +{ return int(__builtin_round(d)); } +constexpr inline int qRound(float f) +{ return int(__builtin_roundf(f)); } +constexpr inline qint64 qRound64(double d) +{ return qint64(__builtin_round(d)); } +constexpr inline qint64 qRound64(float f) +{ return qint64(__builtin_roundf(f)); } +#elif defined(__SSE2__) && (__has_builtin(__builtin_copysign) || defined(Q_CC_GNU)) +// SSE has binary operations directly on floating point making copysign fast +constexpr inline int qRound(double d) +{ return int(d + __builtin_copysign(0.5, d)); } +constexpr inline int qRound(float f) +{ return int(f + __builtin_copysignf(0.5f, f)); } +constexpr inline qint64 qRound64(double d) +{ return qint64(d + __builtin_copysign(0.5, d)); } +constexpr inline qint64 qRound64(float f) +{ return qint64(f + __builtin_copysignf(0.5f, f)); } +#else +constexpr inline int qRound(double d) +{ return d >= 0.0 ? int(d + 0.5) : int(d - 0.5); } +constexpr inline int qRound(float d) +{ return d >= 0.0f ? int(d + 0.5f) : int(d - 0.5f); } + +constexpr inline qint64 qRound64(double d) +{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - 0.5); } +constexpr inline qint64 qRound64(float d) +{ return d >= 0.0f ? qint64(d + 0.5f) : qint64(d - 0.5f); } +#endif + +namespace QtPrivate { +template +constexpr inline const T &min(const T &a, const T &b) { return (a < b) ? a : b; } +} + +[[nodiscard]] constexpr bool qFuzzyCompare(double p1, double p2) noexcept +{ + return (qAbs(p1 - p2) * 1000000000000. <= QtPrivate::min(qAbs(p1), qAbs(p2))); +} + +[[nodiscard]] constexpr bool qFuzzyCompare(float p1, float p2) noexcept +{ + return (qAbs(p1 - p2) * 100000.f <= QtPrivate::min(qAbs(p1), qAbs(p2))); +} + +[[nodiscard]] constexpr bool qFuzzyIsNull(double d) noexcept +{ + return qAbs(d) <= 0.000000000001; +} + +[[nodiscard]] constexpr bool qFuzzyIsNull(float f) noexcept +{ + return qAbs(f) <= 0.00001f; +} + +QT_WARNING_PUSH +QT_WARNING_DISABLE_FLOAT_COMPARE + +[[nodiscard]] constexpr bool qIsNull(double d) noexcept +{ + return d == 0.0; +} + +[[nodiscard]] constexpr bool qIsNull(float f) noexcept +{ + return f == 0.0f; +} + +QT_WARNING_POP + +inline int qIntCast(double f) { return int(f); } +inline int qIntCast(float f) { return int(f); } + +QT_END_NAMESPACE + +#endif // QNUMERIC_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qobject.h b/qt/6.8.1/msvc2022_64/include/QtCore/qobject.h new file mode 100644 index 0000000000000000000000000000000000000000..cbebdf5cf932d3a7f3d6bd5520595e625311bf72 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qobject.h @@ -0,0 +1,577 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2013 Olivier Goffart +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QOBJECT_H +#define QOBJECT_H + +#ifndef QT_NO_QOBJECT + +#include +#include +#include +#include +#ifdef QT_INCLUDE_COMPAT +#include +#endif +#include +#include + +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + + +template class QBindable; +class QEvent; +class QTimerEvent; +class QChildEvent; +struct QMetaObject; +class QVariant; +class QObjectPrivate; +class QObject; +class QThread; +class QWidget; +class QAccessibleWidget; +#if QT_CONFIG(regularexpression) +class QRegularExpression; +#endif +struct QDynamicMetaObjectData; + +typedef QList QObjectList; + +#if QT_CORE_REMOVED_SINCE(6, 7) +Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QString &name, + const QMetaObject &mo, QList *list, Qt::FindChildOptions options); +#endif +Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, QAnyStringView name, + const QMetaObject &mo, QList *list, + Qt::FindChildOptions options); +#if QT_CORE_REMOVED_SINCE(6, 7) +Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QMetaObject &mo, + QList *list, Qt::FindChildOptions options); +#endif +Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QRegularExpression &re, + const QMetaObject &mo, QList *list, Qt::FindChildOptions options); +#if QT_CORE_REMOVED_SINCE(6, 7) +Q_CORE_EXPORT QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, Qt::FindChildOptions options); +#endif +Q_CORE_EXPORT QObject *qt_qFindChild_helper(const QObject *parent, QAnyStringView name, + const QMetaObject &mo, Qt::FindChildOptions options); + +class Q_CORE_EXPORT QObjectData +{ + Q_DISABLE_COPY(QObjectData) +public: + QObjectData() = default; + virtual ~QObjectData() = 0; + QObject *q_ptr; + QObject *parent; + QObjectList children; + + uint isWidget : 1; + uint blockSig : 1; + uint wasDeleted : 1; + uint isDeletingChildren : 1; + uint sendChildEvents : 1; + uint receiveChildEvents : 1; + uint isWindow : 1; // for QWindow + uint deleteLaterCalled : 1; + uint isQuickItem : 1; + uint willBeWidget : 1; // for handling widget-specific bits in QObject's ctor + uint wasWidget : 1; // for properly cleaning up in QObject's dtor + uint receiveParentEvents: 1; + uint unused : 20; + QAtomicInt postedEvents; + QDynamicMetaObjectData *metaObject; + QBindingStorage bindingStorage; + + // ### Qt7: Make this return a const QMetaObject *. You should not mess with + // the metaobjects of existing objects. + QMetaObject *dynamicMetaObject() const; + +#ifdef QT_DEBUG + enum { CheckForParentChildLoopsWarnDepth = 4096 }; +#endif +}; + +class Q_CORE_EXPORT QObject +{ + Q_OBJECT + + Q_PROPERTY(QString objectName READ objectName WRITE setObjectName NOTIFY objectNameChanged + BINDABLE bindableObjectName) + Q_DECLARE_PRIVATE(QObject) + +public: + Q_INVOKABLE explicit QObject(QObject *parent = nullptr); + virtual ~QObject(); + + virtual bool event(QEvent *event); + virtual bool eventFilter(QObject *watched, QEvent *event); + +#if defined(QT_NO_TRANSLATION) || defined(Q_QDOC) + static QString tr(const char *sourceText, const char * = nullptr, int = -1) + { return QString::fromUtf8(sourceText); } +#endif // QT_NO_TRANSLATION + + QString objectName() const; +#if QT_CORE_REMOVED_SINCE(6, 4) + void setObjectName(const QString &name); +#endif + Q_WEAK_OVERLOAD + void setObjectName(const QString &name) { doSetObjectName(name); } + void setObjectName(QAnyStringView name); + QBindable bindableObjectName(); + + inline bool isWidgetType() const { return d_ptr->isWidget; } + inline bool isWindowType() const { return d_ptr->isWindow; } + inline bool isQuickItemType() const { return d_ptr->isQuickItem; } + + inline bool signalsBlocked() const noexcept { return d_ptr->blockSig; } + bool blockSignals(bool b) noexcept; + + QThread *thread() const; +#if QT_CORE_REMOVED_SINCE(6, 7) + void moveToThread(QThread *thread); +#endif + bool moveToThread(QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL); + + int startTimer(int interval, Qt::TimerType timerType = Qt::CoarseTimer); + +#if QT_CORE_REMOVED_SINCE(6, 8) + int startTimer(std::chrono::milliseconds time, Qt::TimerType timerType = Qt::CoarseTimer); +#endif + int startTimer(std::chrono::nanoseconds time, Qt::TimerType timerType = Qt::CoarseTimer); + + void killTimer(int id); + void killTimer(Qt::TimerId id); + + template + T findChild(QAnyStringView aName, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const + { + typedef typename std::remove_cv::type>::type ObjType; + static_assert(QtPrivate::HasQ_OBJECT_Macro::Value, + "No Q_OBJECT in the class passed to QObject::findChild"); + return static_cast(qt_qFindChild_helper(this, aName, ObjType::staticMetaObject, options)); + } + + template + QList findChildren(QAnyStringView aName, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const + { + typedef typename std::remove_cv::type>::type ObjType; + static_assert(QtPrivate::HasQ_OBJECT_Macro::Value, + "No Q_OBJECT in the class passed to QObject::findChildren"); + QList list; + qt_qFindChildren_helper(this, aName, ObjType::staticMetaObject, + reinterpret_cast *>(&list), options); + return list; + } + + template + T findChild(Qt::FindChildOptions options = Qt::FindChildrenRecursively) const + { + return findChild({}, options); + } + + template + QList findChildren(Qt::FindChildOptions options = Qt::FindChildrenRecursively) const + { + return findChildren(QAnyStringView{}, options); + } + +#if QT_CONFIG(regularexpression) + template + inline QList findChildren(const QRegularExpression &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const + { + typedef typename std::remove_cv::type>::type ObjType; + static_assert(QtPrivate::HasQ_OBJECT_Macro::Value, + "No Q_OBJECT in the class passed to QObject::findChildren"); + QList list; + qt_qFindChildren_helper(this, re, ObjType::staticMetaObject, + reinterpret_cast *>(&list), options); + return list; + } +#endif // QT_CONFIG(regularexpression) + + inline const QObjectList &children() const { return d_ptr->children; } + + void setParent(QObject *parent); + void installEventFilter(QObject *filterObj); + void removeEventFilter(QObject *obj); + + static QMetaObject::Connection connect(const QObject *sender, const char *signal, + const QObject *receiver, const char *member, Qt::ConnectionType = Qt::AutoConnection); + + static QMetaObject::Connection connect(const QObject *sender, const QMetaMethod &signal, + const QObject *receiver, const QMetaMethod &method, + Qt::ConnectionType type = Qt::AutoConnection); + + inline QMetaObject::Connection connect(const QObject *sender, const char *signal, + const char *member, Qt::ConnectionType type = Qt::AutoConnection) const; + +#ifdef Q_QDOC + template + static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type = Qt::AutoConnection); + template + static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor); + template + static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type = Qt::AutoConnection); +#else + //connect with context + template + static inline QMetaObject::Connection + connect(const typename QtPrivate::FunctionPointer::Object *sender, Func1 signal, + const typename QtPrivate::ContextTypeForFunctor::ContextType *context, Func2 &&slot, + Qt::ConnectionType type = Qt::AutoConnection) + { + typedef QtPrivate::FunctionPointer SignalType; + typedef QtPrivate::FunctionPointer> SlotType; + + if constexpr (SlotType::ArgumentCount != -1) { + static_assert((QtPrivate::AreArgumentsCompatible::value), + "Return type of the slot is not compatible with the return type of the signal."); + } else { + constexpr int FunctorArgumentCount = QtPrivate::ComputeFunctorArgumentCount, typename SignalType::Arguments>::Value; + [[maybe_unused]] + constexpr int SlotArgumentCount = (FunctorArgumentCount >= 0) ? FunctorArgumentCount : 0; + typedef typename QtPrivate::FunctorReturnType, typename QtPrivate::List_Left::Value>::Value SlotReturnType; + + static_assert((QtPrivate::AreArgumentsCompatible::value), + "Return type of the slot is not compatible with the return type of the signal."); + } + + static_assert(QtPrivate::HasQ_OBJECT_Macro::Value, + "No Q_OBJECT in the class with the signal"); + + //compilation error if the arguments does not match. + static_assert(int(SignalType::ArgumentCount) >= int(SlotType::ArgumentCount), + "The slot requires more arguments than the signal provides."); + + const int *types = nullptr; + if (type == Qt::QueuedConnection || type == Qt::BlockingQueuedConnection) + types = QtPrivate::ConnectionTypes::types(); + + void **pSlot = nullptr; + if constexpr (std::is_member_function_pointer_v>) { + pSlot = const_cast(reinterpret_cast(&slot)); + } else { + Q_ASSERT_X((type & Qt::UniqueConnection) == 0, "", + "QObject::connect: Unique connection requires the slot to be a pointer to " + "a member function of a QObject subclass."); + } + + return connectImpl(sender, reinterpret_cast(&signal), context, pSlot, + QtPrivate::makeCallableObject(std::forward(slot)), + type, types, &SignalType::Object::staticMetaObject); + } + +#ifndef QT_NO_CONTEXTLESS_CONNECT + //connect without context + template + static inline QMetaObject::Connection + connect(const typename QtPrivate::FunctionPointer::Object *sender, Func1 signal, Func2 &&slot) + { + return connect(sender, signal, sender, std::forward(slot), Qt::DirectConnection); + } +#endif // QT_NO_CONTEXTLESS_CONNECT +#endif //Q_QDOC + + static bool disconnect(const QObject *sender, const char *signal, + const QObject *receiver, const char *member); + static bool disconnect(const QObject *sender, const QMetaMethod &signal, + const QObject *receiver, const QMetaMethod &member); + inline bool disconnect(const char *signal = nullptr, + const QObject *receiver = nullptr, const char *member = nullptr) const + { return disconnect(this, signal, receiver, member); } + inline bool disconnect(const QObject *receiver, const char *member = nullptr) const + { return disconnect(this, nullptr, receiver, member); } + static bool disconnect(const QMetaObject::Connection &); + +#ifdef Q_QDOC + template + static bool disconnect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method); +#else + template + static inline bool disconnect(const typename QtPrivate::FunctionPointer::Object *sender, Func1 signal, + const typename QtPrivate::FunctionPointer::Object *receiver, Func2 slot) + { + typedef QtPrivate::FunctionPointer SignalType; + typedef QtPrivate::FunctionPointer SlotType; + + static_assert(QtPrivate::HasQ_OBJECT_Macro::Value, + "No Q_OBJECT in the class with the signal"); + + //compilation error if the arguments does not match. + static_assert((QtPrivate::CheckCompatibleArguments::value), + "Signal and slot arguments are not compatible."); + + return disconnectImpl(sender, reinterpret_cast(&signal), receiver, reinterpret_cast(&slot), + &SignalType::Object::staticMetaObject); + } + template + static inline bool disconnect(const typename QtPrivate::FunctionPointer::Object *sender, Func1 signal, + const QObject *receiver, void **zero) + { + // This is the overload for when one wish to disconnect a signal from any slot. (slot=nullptr) + // Since the function template parameter cannot be deduced from '0', we use a + // dummy void ** parameter that must be equal to 0 + Q_ASSERT(!zero); + typedef QtPrivate::FunctionPointer SignalType; + return disconnectImpl(sender, reinterpret_cast(&signal), receiver, zero, + &SignalType::Object::staticMetaObject); + } +#endif //Q_QDOC + + void dumpObjectTree() const; + void dumpObjectInfo() const; + + QT_CORE_INLINE_SINCE(6, 6) + bool setProperty(const char *name, const QVariant &value); + inline bool setProperty(const char *name, QVariant &&value); + QVariant property(const char *name) const; + QList dynamicPropertyNames() const; + QBindingStorage *bindingStorage() { return &d_ptr->bindingStorage; } + const QBindingStorage *bindingStorage() const { return &d_ptr->bindingStorage; } + +Q_SIGNALS: + void destroyed(QObject * = nullptr); + void objectNameChanged(const QString &objectName, QPrivateSignal); + +public: + inline QObject *parent() const { return d_ptr->parent; } + + inline bool inherits(const char *classname) const + { + return const_cast(this)->qt_metacast(classname) != nullptr; + } + +public Q_SLOTS: + void deleteLater(); + +protected: + QObject *sender() const; + int senderSignalIndex() const; + int receivers(const char *signal) const; + bool isSignalConnected(const QMetaMethod &signal) const; + + virtual void timerEvent(QTimerEvent *event); + virtual void childEvent(QChildEvent *event); + virtual void customEvent(QEvent *event); + + virtual void connectNotify(const QMetaMethod &signal); + virtual void disconnectNotify(const QMetaMethod &signal); + +protected: + QObject(QObjectPrivate &dd, QObject *parent = nullptr); + +protected: + QScopedPointer d_ptr; + + friend struct QMetaObject; + friend struct QMetaObjectPrivate; + friend class QMetaCallEvent; + friend class QApplication; + friend class QApplicationPrivate; + friend class QCoreApplication; + friend class QCoreApplicationPrivate; + friend class QWidget; + friend class QAccessibleWidget; + friend class QThreadData; + +private: + void doSetObjectName(const QString &name); + bool doSetProperty(const char *name, const QVariant *lvalue, QVariant *rvalue); + + Q_DISABLE_COPY(QObject) + +private: + static QMetaObject::Connection connectImpl(const QObject *sender, void **signal, + const QObject *receiver, void **slotPtr, + QtPrivate::QSlotObjectBase *slot, Qt::ConnectionType type, + const int *types, const QMetaObject *senderMetaObject); + + static bool disconnectImpl(const QObject *sender, void **signal, const QObject *receiver, void **slot, + const QMetaObject *senderMetaObject); + +}; + +inline QMetaObject::Connection QObject::connect(const QObject *asender, const char *asignal, + const char *amember, Qt::ConnectionType atype) const +{ return connect(asender, asignal, this, amember, atype); } + +#if QT_CORE_INLINE_IMPL_SINCE(6, 6) +bool QObject::setProperty(const char *name, const QVariant &value) +{ + return doSetProperty(name, &value, nullptr); +} +#endif // inline since 6.6 +bool QObject::setProperty(const char *name, QVariant &&value) +{ + return doSetProperty(name, &value, &value); +} + +template +inline T qobject_cast(QObject *object) +{ + static_assert(std::is_pointer_v, + "qobject_cast requires to cast towards a pointer type"); + typedef typename std::remove_cv::type>::type ObjType; + static_assert(QtPrivate::HasQ_OBJECT_Macro::Value, + "qobject_cast requires the type to have a Q_OBJECT macro"); + return static_cast(ObjType::staticMetaObject.cast(object)); +} + +template +inline T qobject_cast(const QObject *object) +{ + static_assert(std::is_pointer_v, + "qobject_cast requires to cast towards a pointer type"); + static_assert(std::is_const_v>, + "qobject_cast cannot cast away constness (use const_cast)"); + typedef typename std::remove_cv::type>::type ObjType; + static_assert(QtPrivate::HasQ_OBJECT_Macro::Value, + "qobject_cast requires the type to have a Q_OBJECT macro"); + return static_cast(ObjType::staticMetaObject.cast(object)); +} + + +template constexpr const char * qobject_interface_iid() = delete; +template inline T * +qobject_iid_cast(QObject *object, const char *IId = qobject_interface_iid()) +{ + return reinterpret_cast((object ? object->qt_metacast(IId) : nullptr)); +} +template inline std::enable_if_t::value, T *> +qobject_iid_cast(const QObject *object) +{ + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast) + QObject *o = const_cast(object); + return qobject_iid_cast>(o); +} + +#if defined(Q_QDOC) +# define Q_DECLARE_INTERFACE(IFace, IId) +#elif !defined(Q_MOC_RUN) +# define Q_DECLARE_INTERFACE(IFace, IId) \ + template <> constexpr const char *qobject_interface_iid() \ + { return IId; } \ + template <> inline IFace *qobject_cast(QObject *object) \ + { return qobject_iid_cast(object); } \ + template <> inline const IFace *qobject_cast(const QObject *object) \ + { return qobject_iid_cast(object); } +#endif // Q_MOC_RUN + +inline const QBindingStorage *qGetBindingStorage(const QObject *o) +{ + return o->bindingStorage(); +} +inline QBindingStorage *qGetBindingStorage(QObject *o) +{ + return o->bindingStorage(); +} + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QObject *); +#endif + +class QSignalBlocker +{ +public: + Q_NODISCARD_CTOR + inline explicit QSignalBlocker(QObject *o) noexcept; + Q_NODISCARD_CTOR + inline explicit QSignalBlocker(QObject &o) noexcept; + inline ~QSignalBlocker(); + + Q_NODISCARD_CTOR + inline QSignalBlocker(QSignalBlocker &&other) noexcept; + inline QSignalBlocker &operator=(QSignalBlocker &&other) noexcept; + + inline void reblock() noexcept; + inline void unblock() noexcept; + inline void dismiss() noexcept; + +private: + Q_DISABLE_COPY(QSignalBlocker) + QObject *m_o; + bool m_blocked; + bool m_inhibited; +}; + +QSignalBlocker::QSignalBlocker(QObject *o) noexcept + : m_o(o), + m_blocked(o && o->blockSignals(true)), + m_inhibited(false) +{} + +QSignalBlocker::QSignalBlocker(QObject &o) noexcept + : m_o(&o), + m_blocked(o.blockSignals(true)), + m_inhibited(false) +{} + +QSignalBlocker::QSignalBlocker(QSignalBlocker &&other) noexcept + : m_o(other.m_o), + m_blocked(other.m_blocked), + m_inhibited(other.m_inhibited) +{ + other.m_o = nullptr; +} + +QSignalBlocker &QSignalBlocker::operator=(QSignalBlocker &&other) noexcept +{ + if (this != &other) { + // if both *this and other block the same object's signals: + // unblock *this iff our dtor would unblock, but other's wouldn't + if (m_o != other.m_o || (!m_inhibited && other.m_inhibited)) + unblock(); + m_o = other.m_o; + m_blocked = other.m_blocked; + m_inhibited = other.m_inhibited; + // disable other: + other.m_o = nullptr; + } + return *this; +} + +QSignalBlocker::~QSignalBlocker() +{ + if (m_o && !m_inhibited) + m_o->blockSignals(m_blocked); +} + +void QSignalBlocker::reblock() noexcept +{ + if (m_o) + m_o->blockSignals(true); + m_inhibited = false; +} + +void QSignalBlocker::unblock() noexcept +{ + if (m_o) + m_o->blockSignals(m_blocked); + m_inhibited = true; +} + +void QSignalBlocker::dismiss() noexcept +{ + m_o = nullptr; +} + +namespace QtPrivate { + inline QObject & deref_for_methodcall(QObject &o) { return o; } + inline QObject & deref_for_methodcall(QObject *o) { return *o; } +} +#define Q_SET_OBJECT_NAME(obj) QT_PREPEND_NAMESPACE(QtPrivate)::deref_for_methodcall(obj).setObjectName(QLatin1StringView(#obj)) + +QT_END_NAMESPACE + +#endif + +#endif // QOBJECT_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qobject_impl.h b/qt/6.8.1/msvc2022_64/include/QtCore/qobject_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..e7bf45306acffa9d84fe94479e7432f451a3b39e --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qobject_impl.h @@ -0,0 +1,45 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef Q_QDOC + +#ifndef QOBJECT_H +#error Do not include qobject_impl.h directly +#endif + +#if 0 +#pragma qt_sync_skip_header_check +#pragma qt_sync_stop_processing +#endif + +QT_BEGIN_NAMESPACE + + +namespace QtPrivate { + /* + Logic to statically generate the array of qMetaTypeId + ConnectionTypes::Arguments>::types() returns an array + of int that is suitable for the types arguments of the connection functions. + + The array only exist of all the types are declared as a metatype + (detected using the TypesAreDeclaredMetaType helper struct) + If one of the type is not declared, the function return 0 and the signal + cannot be used in queued connection. + */ + template struct TypesAreDeclaredMetaType { enum { Value = false }; }; + template <> struct TypesAreDeclaredMetaType> { enum { Value = true }; }; + template struct TypesAreDeclaredMetaType > + { enum { Value = QMetaTypeId2::Defined && TypesAreDeclaredMetaType>::Value }; }; + + template ::Value > struct ConnectionTypes + { static const int *types() { return nullptr; } }; + template <> struct ConnectionTypes, true> + { static const int *types() { return nullptr; } }; + template struct ConnectionTypes, true> + { static const int *types() { static const int t[sizeof...(Args) + 1] = { (QtPrivate::QMetaTypeIdHelper::qt_metatype_id())..., 0 }; return t; } }; +} + + +QT_END_NAMESPACE + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qobjectcleanuphandler.h b/qt/6.8.1/msvc2022_64/include/QtCore/qobjectcleanuphandler.h new file mode 100644 index 0000000000000000000000000000000000000000..3ea9563252ab5e1c73aca184b8c8da58e0a31d1b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qobjectcleanuphandler.h @@ -0,0 +1,34 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QOBJECTCLEANUPHANDLER_H +#define QOBJECTCLEANUPHANDLER_H + +#include + +QT_BEGIN_NAMESPACE + +class Q_CORE_EXPORT QObjectCleanupHandler : public QObject +{ + Q_OBJECT + +public: + QObjectCleanupHandler(); + ~QObjectCleanupHandler(); + + QObject *add(QObject *object); + void remove(QObject *object); + bool isEmpty() const; + void clear(); + +private: + // ### move into d pointer + QObjectList cleanupObjects; + +private Q_SLOTS: + void objectDestroyed(QObject *); +}; + +QT_END_NAMESPACE + +#endif // QOBJECTCLEANUPHANDLER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qobjectdefs.h b/qt/6.8.1/msvc2022_64/include/QtCore/qobjectdefs.h new file mode 100644 index 0000000000000000000000000000000000000000..3874939746d68980739d792127bd645a44669db3 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qobjectdefs.h @@ -0,0 +1,691 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// Copyright (C) 2019 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QOBJECTDEFS_H +#define QOBJECTDEFS_H + +#if defined(__OBJC__) && !defined(__cplusplus) +# warning "File built in Objective-C mode (.m), but using Qt requires Objective-C++ (.mm)" +#endif + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QByteArray; +struct QArrayData; + +class QString; + +#ifndef QT_NO_META_MACROS +// macro for onaming members +#ifdef METHOD +#undef METHOD +#endif +#ifdef SLOT +#undef SLOT +#endif +#ifdef SIGNAL +#undef SIGNAL +#endif +#endif // QT_NO_META_MACROS + +Q_CORE_EXPORT const char *qFlagLocation(const char *method); + +#ifndef QT_NO_META_MACROS +# define QMETHOD_CODE 0 // member type codes +# define QSLOT_CODE 1 +# define QSIGNAL_CODE 2 +# define QT_PREFIX_CODE(code, a) QT_STRINGIFY(code) #a +# define QT_STRINGIFY_METHOD(a) QT_PREFIX_CODE(QMETHOD_CODE, a) +# define QT_STRINGIFY_SLOT(a) QT_PREFIX_CODE(QSLOT_CODE, a) +# define QT_STRINGIFY_SIGNAL(a) QT_PREFIX_CODE(QSIGNAL_CODE, a) +# ifndef QT_NO_DEBUG +# define QLOCATION "\0" __FILE__ ":" QT_STRINGIFY(__LINE__) +# ifndef QT_NO_KEYWORDS +# define METHOD(a) qFlagLocation(QT_STRINGIFY_METHOD(a) QLOCATION) +# endif +# define SLOT(a) qFlagLocation(QT_STRINGIFY_SLOT(a) QLOCATION) +# define SIGNAL(a) qFlagLocation(QT_STRINGIFY_SIGNAL(a) QLOCATION) +# else +# ifndef QT_NO_KEYWORDS +# define METHOD(a) QT_STRINGIFY_METHOD(a) +# endif +# define SLOT(a) QT_STRINGIFY_SLOT(a) +# define SIGNAL(a) QT_STRINGIFY_SIGNAL(a) +# endif +#endif // QT_NO_META_MACROS + +#define Q_ARG(Type, data) QtPrivate::Invoke::argument(QT_STRINGIFY(Type), data) +#define Q_RETURN_ARG(Type, data) QtPrivate::Invoke::returnArgument(QT_STRINGIFY(Type), data) + +class QObject; +class QMetaMethod; +class QMetaEnum; +class QMetaProperty; +class QMetaClassInfo; + +namespace QtPrivate { +class QMetaTypeInterface; +template constexpr const QMetaTypeInterface *qMetaTypeInterfaceForType(); +} + +struct QMethodRawArguments +{ + void **arguments; +}; + +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) +class Q_CORE_EXPORT QGenericArgument +{ +public: + inline QGenericArgument(const char *aName = nullptr, const void *aData = nullptr) + : _data(aData), _name(aName) {} + inline void *data() const { return const_cast(_data); } + inline const char *name() const { return _name; } + +private: + const void *_data; + const char *_name; +}; + +class Q_CORE_EXPORT QGenericReturnArgument: public QGenericArgument +{ +public: + inline QGenericReturnArgument(const char *aName = nullptr, void *aData = nullptr) + : QGenericArgument(aName, aData) + {} +}; + +template +class QArgument: public QGenericArgument +{ +public: + inline QArgument(const char *aName, const T &aData) + : QGenericArgument(aName, static_cast(&aData)) + {} +}; +template +class QArgument: public QGenericArgument +{ +public: + inline QArgument(const char *aName, T &aData) + : QGenericArgument(aName, static_cast(&aData)) + {} +}; + + +template +class QReturnArgument: public QGenericReturnArgument +{ +public: + inline QReturnArgument(const char *aName, T &aData) + : QGenericReturnArgument(aName, static_cast(&aData)) + {} +}; +#endif + +struct QMetaMethodArgument +{ + const QtPrivate::QMetaTypeInterface *metaType; + const char *name; + const void *data; +}; + +struct QMetaMethodReturnArgument +{ + const QtPrivate::QMetaTypeInterface *metaType; + const char *name; + void *data; +}; + +template +struct QTemplatedMetaMethodReturnArgument : QMetaMethodReturnArgument +{ + using Type = T; +}; + +namespace QtPrivate { +namespace Invoke { +#if QT_VERSION <= QT_VERSION_CHECK(7, 0, 0) +template +using AreOldStyleArgs = std::disjunction...>; + +template using IfNotOldStyleArgs = + std::enable_if_t::value, T>; +#else +template using IfNotOldStyleArgs = T; +#endif + +template inline QMetaMethodArgument argument(const char *name, const T &t) +{ + if constexpr ((std::is_lvalue_reference_v && std::is_const_v>) || + !std::is_reference_v) { + return { qMetaTypeInterfaceForType(), name, std::addressof(t) }; + } else { + return { nullptr, name, std::addressof(t) }; + } +} + +template +inline QTemplatedMetaMethodReturnArgument returnArgument(const char *name, T &t) +{ + return { qMetaTypeInterfaceForType(), name, std::addressof(t) }; +} + +template inline const char *typenameHelper(const T &) +{ + return nullptr; +} +template inline const void *dataHelper(const T &t) +{ + return std::addressof(t); +} +template inline const QMetaTypeInterface *metaTypeHelper(const T &) +{ + return qMetaTypeInterfaceForType(); +} + +inline const char *typenameHelper(QMetaMethodArgument a) +{ return a.name; } +inline const void *dataHelper(QMetaMethodArgument a) +{ return a.data; } +inline const QMetaTypeInterface *metaTypeHelper(QMetaMethodArgument a) +{ return a.metaType; } + +inline const char *typenameHelper(const char *) = delete; +template inline const void *dataHelper(const char *) = delete; +inline const QMetaTypeInterface *metaTypeHelper(const char *) = delete; +inline const char *typenameHelper(const char16_t *) = delete; +template inline const void *dataHelper(const char16_t *) = delete; +inline const QMetaTypeInterface *metaTypeHelper(const char16_t *) = delete; + +} // namespace QtPrivate::Invoke + +template inline auto invokeMethodHelper(QMetaMethodReturnArgument r, const Args &... arguments) +{ + std::array params = { const_cast(r.data), Invoke::dataHelper(arguments)... }; + std::array names = { r.name, Invoke::typenameHelper(arguments)... }; + std::array types = { r.metaType, Invoke::metaTypeHelper(arguments)... }; + static_assert(params.size() == types.size()); + static_assert(params.size() == names.size()); + + struct R { + decltype(params) parameters; + decltype(names) typeNames; + decltype(types) metaTypes; + constexpr qsizetype parameterCount() const { return qsizetype(parameters.size()); } + }; + return R { params, names, types }; +} +} // namespace QtPrivate + +template void qReturnArg(const T &&) = delete; +template inline QTemplatedMetaMethodReturnArgument qReturnArg(T &data) +{ + return QtPrivate::Invoke::returnArgument(nullptr, data); +} + +struct Q_CORE_EXPORT QMetaObject +{ + class Connection; + const char *className() const; + const QMetaObject *superClass() const; + + bool inherits(const QMetaObject *metaObject) const noexcept; + QObject *cast(QObject *obj) const + { return const_cast(cast(const_cast(obj))); } + const QObject *cast(const QObject *obj) const; + +#if !defined(QT_NO_TRANSLATION) || defined(Q_QDOC) + QString tr(const char *s, const char *c, int n = -1) const; +#endif // QT_NO_TRANSLATION + + QMetaType metaType() const; + + int methodOffset() const; + int enumeratorOffset() const; + int propertyOffset() const; + int classInfoOffset() const; + + int constructorCount() const; + int methodCount() const; + int enumeratorCount() const; + int propertyCount() const; + int classInfoCount() const; + + int indexOfConstructor(const char *constructor) const; + int indexOfMethod(const char *method) const; + int indexOfSignal(const char *signal) const; + int indexOfSlot(const char *slot) const; + int indexOfEnumerator(const char *name) const; + + int indexOfProperty(const char *name) const; + int indexOfClassInfo(const char *name) const; + + QMetaMethod constructor(int index) const; + QMetaMethod method(int index) const; + QMetaEnum enumerator(int index) const; + QMetaProperty property(int index) const; + QMetaClassInfo classInfo(int index) const; + QMetaProperty userProperty() const; + + static bool checkConnectArgs(const char *signal, const char *method); + static bool checkConnectArgs(const QMetaMethod &signal, + const QMetaMethod &method); + static QByteArray normalizedSignature(const char *method); + static QByteArray normalizedType(const char *type); + + // internal index-based connect + static Connection connect(const QObject *sender, int signal_index, + const QObject *receiver, int method_index, + int type = 0, int *types = nullptr); + // internal index-based disconnect + static bool disconnect(const QObject *sender, int signal_index, + const QObject *receiver, int method_index); + static bool disconnectOne(const QObject *sender, int signal_index, + const QObject *receiver, int method_index); + // internal slot-name based connect + static void connectSlotsByName(QObject *o); + + // internal index-based signal activation + static void activate(QObject *sender, int signal_index, void **argv); + static void activate(QObject *sender, const QMetaObject *, int local_signal_index, void **argv); + static void activate(QObject *sender, int signal_offset, int local_signal_index, void **argv); + +#if QT_VERSION <= QT_VERSION_CHECK(7, 0, 0) + static bool invokeMethod(QObject *obj, const char *member, + Qt::ConnectionType, + QGenericReturnArgument ret, + QGenericArgument val0 = QGenericArgument(nullptr), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()); + + static inline bool invokeMethod(QObject *obj, const char *member, + QGenericReturnArgument ret, + QGenericArgument val0 = QGenericArgument(nullptr), + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) + { + return invokeMethod(obj, member, Qt::AutoConnection, ret, val0, val1, val2, val3, + val4, val5, val6, val7, val8, val9); + } + + static inline bool invokeMethod(QObject *obj, const char *member, + Qt::ConnectionType type, + QGenericArgument val0, + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) + { + return invokeMethod(obj, member, type, QGenericReturnArgument(), val0, val1, val2, + val3, val4, val5, val6, val7, val8, val9); + } + + static inline bool invokeMethod(QObject *obj, const char *member, + QGenericArgument val0, + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) + { + return invokeMethod(obj, member, Qt::AutoConnection, QGenericReturnArgument(), val0, + val1, val2, val3, val4, val5, val6, val7, val8, val9); + } +#endif // Qt < 7.0 + + template static +#ifdef Q_QDOC + bool +#else + QtPrivate::Invoke::IfNotOldStyleArgs +#endif + invokeMethod(QObject *obj, const char *member, Qt::ConnectionType c, + QTemplatedMetaMethodReturnArgument r, Args &&... arguments) + { + auto h = QtPrivate::invokeMethodHelper(r, std::forward(arguments)...); + return invokeMethodImpl(obj, member, c, h.parameterCount(), h.parameters.data(), + h.typeNames.data(), h.metaTypes.data()); + } + + template static +#ifdef Q_QDOC + bool +#else + QtPrivate::Invoke::IfNotOldStyleArgs +#endif + invokeMethod(QObject *obj, const char *member, Qt::ConnectionType c, Args &&... arguments) + { + QTemplatedMetaMethodReturnArgument r = {}; + return invokeMethod(obj, member, c, r, std::forward(arguments)...); + } + + template static +#ifdef Q_QDOC + bool +#else + QtPrivate::Invoke::IfNotOldStyleArgs +#endif + invokeMethod(QObject *obj, const char *member, QTemplatedMetaMethodReturnArgument r, + Args &&... arguments) + { + return invokeMethod(obj, member, Qt::AutoConnection, r, std::forward(arguments)...); + } + + template static +#ifdef Q_QDOC + bool +#else + QtPrivate::Invoke::IfNotOldStyleArgs +#endif + invokeMethod(QObject *obj, const char *member, Args &&... arguments) + { + QTemplatedMetaMethodReturnArgument r = {}; + return invokeMethod(obj, member, Qt::AutoConnection, r, std::forward(arguments)...); + } + +#ifdef Q_QDOC + template + static bool invokeMethod(QObject *context, Functor &&function, Qt::ConnectionType type = Qt::AutoConnection, FunctorReturnType *ret = nullptr); + template + static bool invokeMethod(QObject *context, Functor &&function, FunctorReturnType *ret); + + template + static bool invokeMethod(QObject *context, Functor &&function, Qt::ConnectionType type, QTemplatedMetaMethodReturnArgument ret, Args &&...arguments); + template + static bool invokeMethod(QObject *context, Functor &&function, QTemplatedMetaMethodReturnArgument ret, Args &&...arguments); + template + static bool invokeMethod(QObject *context, Functor &&function, Qt::ConnectionType type, Args &&...arguments); + template + static bool invokeMethod(QObject *context, Functor &&function, Args &&...arguments); +#else + template + static std::enable_if_t, + QtPrivate::Invoke::AreOldStyleArgs>, + bool> + invokeMethod(typename QtPrivate::ContextTypeForFunctor::ContextType *object, + Func &&function, Qt::ConnectionType type, + typename QtPrivate::Callable::ReturnType *ret) + { + using R = typename QtPrivate::Callable::ReturnType; + const auto getReturnArg = [ret]() -> QTemplatedMetaMethodReturnArgument { + if constexpr (std::is_void_v) + return {}; + else + return ret ? qReturnArg(*ret) : QTemplatedMetaMethodReturnArgument{}; + }; + return invokeMethod(object, std::forward(function), type, getReturnArg()); + } + template + static std::enable_if_t, + QtPrivate::Invoke::AreOldStyleArgs>, + bool> + invokeMethod(typename QtPrivate::ContextTypeForFunctor::ContextType *object, + Func &&function, typename QtPrivate::Callable::ReturnType *ret) + { + return invokeMethod(object, std::forward(function), Qt::AutoConnection, ret); + } + + template + static std::enable_if_t, + QtPrivate::Invoke::AreOldStyleArgs>, + bool> + invokeMethod(typename QtPrivate::ContextTypeForFunctor::ContextType *object, + Func &&function, Qt::ConnectionType type, + QTemplatedMetaMethodReturnArgument< + typename QtPrivate::Callable::ReturnType> + ret, + Args &&...args) + { + return invokeMethodCallableHelper(object, std::forward(function), type, ret, + std::forward(args)...); + } + + template + static std::enable_if_t, + QtPrivate::Invoke::AreOldStyleArgs>, + bool> + invokeMethod(typename QtPrivate::ContextTypeForFunctor::ContextType *object, + Func &&function, Qt::ConnectionType type, Args &&...args) + { + using R = typename QtPrivate::Callable::ReturnType; + QTemplatedMetaMethodReturnArgument r{ QtPrivate::qMetaTypeInterfaceForType(), nullptr, + nullptr }; + return invokeMethod(object, std::forward(function), type, r, + std::forward(args)...); + } + + template + static std::enable_if_t, + QtPrivate::Invoke::AreOldStyleArgs>, + bool> + invokeMethod(typename QtPrivate::ContextTypeForFunctor::ContextType *object, + Func &&function, + QTemplatedMetaMethodReturnArgument< + typename QtPrivate::Callable::ReturnType> + ret, + Args &&...args) + { + return invokeMethod(object, std::forward(function), Qt::AutoConnection, ret, + std::forward(args)...); + } + + template + static std::enable_if_t, + QtPrivate::Invoke::AreOldStyleArgs>, + bool> + invokeMethod(typename QtPrivate::ContextTypeForFunctor::ContextType *object, + Func &&function, Args &&...args) + { + using R = typename QtPrivate::Callable::ReturnType; + QTemplatedMetaMethodReturnArgument r{ QtPrivate::qMetaTypeInterfaceForType(), nullptr, + nullptr }; + return invokeMethod(object, std::forward(function), Qt::AutoConnection, r, + std::forward(args)...); + } + +#endif + +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) + QObject *newInstance(QGenericArgument val0, + QGenericArgument val1 = QGenericArgument(), + QGenericArgument val2 = QGenericArgument(), + QGenericArgument val3 = QGenericArgument(), + QGenericArgument val4 = QGenericArgument(), + QGenericArgument val5 = QGenericArgument(), + QGenericArgument val6 = QGenericArgument(), + QGenericArgument val7 = QGenericArgument(), + QGenericArgument val8 = QGenericArgument(), + QGenericArgument val9 = QGenericArgument()) const; +#endif + + template +#ifdef Q_QDOC + QObject * +#else + QtPrivate::Invoke::IfNotOldStyleArgs +#endif + newInstance(Args &&... arguments) const + { + auto h = QtPrivate::invokeMethodHelper(QMetaMethodReturnArgument{}, std::forward(arguments)...); + return newInstanceImpl(this, h.parameterCount(), h.parameters.data(), + h.typeNames.data(), h.metaTypes.data()); + } + + enum Call { + InvokeMetaMethod, + ReadProperty, + WriteProperty, + ResetProperty, + CreateInstance, + IndexOfMethod, + RegisterPropertyMetaType, + RegisterMethodArgumentMetaType, + BindableProperty, + CustomCall, + ConstructInPlace, + }; + + int static_metacall(Call, int, void **) const; + static int metacall(QObject *, Call, int, void **); + + template static constexpr const QMetaObject *staticMetaObject() + { + return &MO; + } + + struct SuperData { + using Getter = const QMetaObject *(*)(); + const QMetaObject *direct; + SuperData() = default; + constexpr SuperData(std::nullptr_t) : direct(nullptr) {} + constexpr SuperData(const QMetaObject *mo) : direct(mo) {} + + constexpr const QMetaObject *operator->() const { return operator const QMetaObject *(); } + +#ifdef QT_NO_DATA_RELOCATION + Getter indirect = nullptr; + constexpr SuperData(Getter g) : direct(nullptr), indirect(g) {} + constexpr operator const QMetaObject *() const + { return indirect ? indirect() : direct; } + template static constexpr SuperData link() + { return SuperData(QMetaObject::staticMetaObject); } +#else + constexpr SuperData(Getter g) : direct(g()) {} + constexpr operator const QMetaObject *() const + { return direct; } + template static constexpr SuperData link() + { return SuperData(QMetaObject::staticMetaObject()); } +#endif + }; + + struct Data { // private data + SuperData superdata; + const uint *stringdata; + const uint *data; + typedef void (*StaticMetacallFunction)(QObject *, QMetaObject::Call, int, void **); + StaticMetacallFunction static_metacall; + const SuperData *relatedMetaObjects; + const QtPrivate::QMetaTypeInterface *const *metaTypes; + void *extradata; //reserved for future use + } d; + +private: + // Just need to have this here with a separate name so the other inline + // functions can call this without any ambiguity + template + static bool + invokeMethodCallableHelper(typename QtPrivate::ContextTypeForFunctor::ContextType *object, + Func &&function, Qt::ConnectionType type, const QMetaMethodReturnArgument &ret, + Args &&...args) + { + using Callable = QtPrivate::Callable; + using ExpectedArguments = typename Callable::Arguments; + static_assert(sizeof...(Args) <= ExpectedArguments::size, "Too many arguments"); + using ActualArguments = QtPrivate::List; + static_assert(QtPrivate::CheckCompatibleArguments::value, + "Incompatible arguments"); + + auto h = QtPrivate::invokeMethodHelper(ret, std::forward(args)...); + + // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks) + auto callable = new QtPrivate::QCallableObject, ActualArguments, + typename Callable::ReturnType>(std::forward(function)); + return invokeMethodImpl(object, callable, type, h.parameterCount(), h.parameters.data(), + h.typeNames.data(), h.metaTypes.data()); + } + + static bool invokeMethodImpl(QObject *object, const char *member, Qt::ConnectionType type, + qsizetype parameterCount, const void *const *parameters, const char *const *names, + const QtPrivate::QMetaTypeInterface * const *metaTypes); + static bool invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase *slotObj, + Qt::ConnectionType type, qsizetype parameterCount, + const void *const *params, const char *const *names, + const QtPrivate::QMetaTypeInterface *const *metaTypes); +#if QT_CORE_REMOVED_SINCE(6, 7) + static bool invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase *slot, Qt::ConnectionType type, void *ret); +#endif + static QObject *newInstanceImpl(const QMetaObject *mobj, qsizetype parameterCount, + const void **parameters, const char **typeNames, + const QtPrivate::QMetaTypeInterface **metaTypes); + friend class QTimer; + friend class QChronoTimer; +}; + +class Q_CORE_EXPORT QMetaObject::Connection { + void *d_ptr; //QObjectPrivate::Connection* + explicit Connection(void *data) : d_ptr(data) { } + friend class QObject; + friend class QObjectPrivate; + friend struct QMetaObject; + bool isConnected_helper() const; +public: + ~Connection(); + Connection(); + Connection(const Connection &other); + Connection &operator=(const Connection &other); +#ifdef Q_QDOC + operator bool() const; +#else + // still using the restricted bool trick here, in order to support + // code using copy-init (e.g. `bool ok = connect(...)`) + typedef void *Connection::*RestrictedBool; + operator RestrictedBool() const { return d_ptr && isConnected_helper() ? &Connection::d_ptr : nullptr; } +#endif + + Connection(Connection &&other) noexcept : d_ptr(std::exchange(other.d_ptr, nullptr)) {} + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(Connection) + void swap(Connection &other) noexcept { qt_ptr_swap(d_ptr, other.d_ptr); } +}; + +inline void swap(QMetaObject::Connection &lhs, QMetaObject::Connection &rhs) noexcept +{ + lhs.swap(rhs); +} + +inline const QMetaObject *QMetaObject::superClass() const +{ return d.superdata; } + +namespace QtPrivate { + // Trait that tells if a QObject has a Q_OBJECT macro + template struct HasQ_OBJECT_Macro { + template + static char test(int (T::*)(QMetaObject::Call, int, void **)); + static int test(int (Object::*)(QMetaObject::Call, int, void **)); + enum { Value = sizeof(test(&Object::qt_metacall)) == sizeof(int) }; + }; +} + +QT_END_NAMESPACE + +#endif // QOBJECTDEFS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qobjectdefs_impl.h b/qt/6.8.1/msvc2022_64/include/QtCore/qobjectdefs_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..54da4c3bc54bed9cdb612d73a691c0d29b6c83d4 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qobjectdefs_impl.h @@ -0,0 +1,663 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2013 Olivier Goffart +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QOBJECTDEFS_H +#error Do not include qobjectdefs_impl.h directly +#include +#endif + +#if 0 +#pragma qt_sync_skip_header_check +#pragma qt_sync_stop_processing +#endif + +#include + +#include + +QT_BEGIN_NAMESPACE +class QObject; +class QObjectPrivate; +class QMetaMethod; +class QByteArray; + +namespace QtPrivate { + template struct RemoveRef { typedef T Type; }; + template struct RemoveRef { typedef T Type; }; + template struct RemoveConstRef { typedef T Type; }; + template struct RemoveConstRef { typedef T Type; }; + + /* + The following List classes are used to help to handle the list of arguments. + It follow the same principles as the lisp lists. + List_Left take a list and a number as a parameter and returns (via the Value typedef, + the list composed of the first N element of the list + */ + // With variadic template, lists are represented using a variadic template argument instead of the lisp way + template struct List { static constexpr size_t size = sizeof...(Ts); }; + template struct SizeOfList { static constexpr size_t value = 1; }; + template<> struct SizeOfList> { static constexpr size_t value = 0; }; + template struct SizeOfList> { static constexpr size_t value = List::size; }; + template struct List { + static constexpr size_t size = 1 + sizeof...(Tail); + typedef Head Car; typedef List Cdr; + }; + template struct List_Append; + template struct List_Append, List> { typedef List Value; }; + template struct List_Left { + typedef typename List_Append,typename List_Left::Value>::Value Value; + }; + template struct List_Left { typedef List<> Value; }; + + /* + This is used to store the return value from a slot, whether the caller + wants to store this value (QMetaObject::invokeMethod() with + qReturnArg() or non-void signal ) or not. + */ + struct FunctorCallBase + { + template + static void call_internal([[maybe_unused]] void **args, Lambda &&fn) + noexcept(std::is_nothrow_invocable_v) + { + if constexpr (std::is_void_v || std::is_void_v>) { + std::forward(fn)(); + } else { + if (args[0]) + *reinterpret_cast(args[0]) = std::forward(fn)(); + else + [[maybe_unused]] auto r = std::forward(fn)(); + } + } + }; + + /* + The FunctionPointer struct is a type trait for function pointer. + - ArgumentCount is the number of argument, or -1 if it is unknown + - the Object typedef is the Object of a pointer to member function + - the Arguments typedef is the list of argument (in a QtPrivate::List) + - the Function typedef is an alias to the template parameter Func + - the call(f,o,args) method is used to call that slot + Args is the list of argument of the signal + R is the return type of the signal + f is the function pointer + o is the receiver object + and args is the array of pointer to arguments, as used in qt_metacall + + The Functor struct is the helper to call a functor of N argument. + Its call function is the same as the FunctionPointer::call function. + */ + template using InvokeGenSeq = typename T::Type; + + template struct IndexesList { using Type = IndexesList; }; + + template struct ConcatSeqImpl; + + template + struct ConcatSeqImpl, IndexesList> + : IndexesList{}; + + template + using ConcatSeq = InvokeGenSeq>; + + template struct GenSeq; + template using makeIndexSequence = InvokeGenSeq>; + + template + struct GenSeq : ConcatSeq, makeIndexSequence>{}; + + template<> struct GenSeq<0> : IndexesList<>{}; + template<> struct GenSeq<1> : IndexesList<0>{}; + + template + struct Indexes { using Value = makeIndexSequence; }; + + template struct FunctionPointer { enum {ArgumentCount = -1, IsPointerToMemberFunction = false}; }; + + template inline void assertObjectType(QObjectPrivate *d); + template inline void assertObjectType(QObject *o) + { + // ensure all three compile + [[maybe_unused]] auto staticcast = [](QObject *obj) { return static_cast(obj); }; + [[maybe_unused]] auto qobjcast = [](QObject *obj) { return Obj::staticMetaObject.cast(obj); }; +#ifdef __cpp_rtti + [[maybe_unused]] auto dyncast = [](QObject *obj) { return dynamic_cast(obj); }; + auto cast = dyncast; +#else + auto cast = qobjcast; +#endif + Q_ASSERT_X(cast(o), Obj::staticMetaObject.className(), + "Called object is not of the correct type (class destructor may have already run)"); + } + + template struct FunctorCall; + template + struct FunctorCall, List, R, Function> : FunctorCallBase + { + static void call(Function &f, void **arg) + { + call_internal(arg, [&] { + return f((*reinterpret_cast::Type *>(arg[II+1]))...); + }); + } + }; + template + struct FunctorCall, List, R, SlotRet (Obj::*)(SlotArgs...)> : FunctorCallBase + { + static void call(SlotRet (Obj::*f)(SlotArgs...), Obj *o, void **arg) + { + assertObjectType(o); + call_internal(arg, [&] { + return (o->*f)((*reinterpret_cast::Type *>(arg[II+1]))...); + }); + } + }; + template + struct FunctorCall, List, R, SlotRet (Obj::*)(SlotArgs...) const> : FunctorCallBase + { + static void call(SlotRet (Obj::*f)(SlotArgs...) const, Obj *o, void **arg) + { + assertObjectType(o); + call_internal(arg, [&] { + return (o->*f)((*reinterpret_cast::Type *>(arg[II+1]))...); + }); + } + }; + template + struct FunctorCall, List, R, SlotRet (Obj::*)(SlotArgs...) noexcept> : FunctorCallBase + { + static void call(SlotRet (Obj::*f)(SlotArgs...) noexcept, Obj *o, void **arg) + { + assertObjectType(o); + call_internal(arg, [&]() noexcept { + return (o->*f)((*reinterpret_cast::Type *>(arg[II+1]))...); + }); + } + }; + template + struct FunctorCall, List, R, SlotRet (Obj::*)(SlotArgs...) const noexcept> : FunctorCallBase + { + static void call(SlotRet (Obj::*f)(SlotArgs...) const noexcept, Obj *o, void **arg) + { + assertObjectType(o); + call_internal(arg, [&]() noexcept { + return (o->*f)((*reinterpret_cast::Type *>(arg[II+1]))...); + }); + } + }; + + template struct FunctionPointer + { + typedef Obj Object; + typedef List Arguments; + typedef Ret ReturnType; + typedef Ret (Obj::*Function) (Args...); + enum {ArgumentCount = sizeof...(Args), IsPointerToMemberFunction = true}; + template + static void call(Function f, Obj *o, void **arg) { + FunctorCall::Value, SignalArgs, R, Function>::call(f, o, arg); + } + }; + template struct FunctionPointer + { + typedef Obj Object; + typedef List Arguments; + typedef Ret ReturnType; + typedef Ret (Obj::*Function) (Args...) const; + enum {ArgumentCount = sizeof...(Args), IsPointerToMemberFunction = true}; + template + static void call(Function f, Obj *o, void **arg) { + FunctorCall::Value, SignalArgs, R, Function>::call(f, o, arg); + } + }; + + template struct FunctionPointer + { + typedef List Arguments; + typedef Ret ReturnType; + typedef Ret (*Function) (Args...); + enum {ArgumentCount = sizeof...(Args), IsPointerToMemberFunction = false}; + template + static void call(Function f, void *, void **arg) { + FunctorCall::Value, SignalArgs, R, Function>::call(f, arg); + } + }; + + template struct FunctionPointer + { + typedef Obj Object; + typedef List Arguments; + typedef Ret ReturnType; + typedef Ret (Obj::*Function) (Args...) noexcept; + enum {ArgumentCount = sizeof...(Args), IsPointerToMemberFunction = true}; + template + static void call(Function f, Obj *o, void **arg) { + FunctorCall::Value, SignalArgs, R, Function>::call(f, o, arg); + } + }; + template struct FunctionPointer + { + typedef Obj Object; + typedef List Arguments; + typedef Ret ReturnType; + typedef Ret (Obj::*Function) (Args...) const noexcept; + enum {ArgumentCount = sizeof...(Args), IsPointerToMemberFunction = true}; + template + static void call(Function f, Obj *o, void **arg) { + FunctorCall::Value, SignalArgs, R, Function>::call(f, o, arg); + } + }; + + template struct FunctionPointer + { + typedef List Arguments; + typedef Ret ReturnType; + typedef Ret (*Function) (Args...) noexcept; + enum {ArgumentCount = sizeof...(Args), IsPointerToMemberFunction = false}; + template + static void call(Function f, void *, void **arg) { + FunctorCall::Value, SignalArgs, R, Function>::call(f, arg); + } + }; + + // Traits to detect if there is a conversion between two types, + // and that conversion does not include a narrowing conversion. + template + struct NarrowingDetector { T t[1]; }; // from P0608 + + template + struct IsConvertibleWithoutNarrowing : std::false_type {}; + + template + struct IsConvertibleWithoutNarrowing{ {std::declval()} } ) > + > : std::true_type {}; + + // Check for the actual arguments. If they are exactly the same, + // then don't bother checking for narrowing; as a by-product, + // this solves the problem of incomplete types (which must be supported, + // or they would error out in the trait above). + template + struct AreArgumentsConvertibleWithoutNarrowingBase : std::false_type {}; + + template + struct AreArgumentsConvertibleWithoutNarrowingBase, IsConvertibleWithoutNarrowing> + > + > : std::true_type {}; + + /* + Logic that check if the arguments of the slot matches the argument of the signal. + To be used like this: + static_assert(CheckCompatibleArguments::Arguments, FunctionPointer::Arguments>::value) + */ + template struct AreArgumentsCompatible { + static int test(const std::remove_reference_t&); + static char test(...); + enum { value = sizeof(test(std::declval>())) == sizeof(int) }; +#ifdef QT_NO_NARROWING_CONVERSIONS_IN_CONNECT + using AreArgumentsConvertibleWithoutNarrowing = AreArgumentsConvertibleWithoutNarrowingBase, std::decay_t>; + static_assert(AreArgumentsConvertibleWithoutNarrowing::value, "Signal and slot arguments are not compatible (narrowing)"); +#endif + }; + template struct AreArgumentsCompatible { enum { value = false }; }; + template struct AreArgumentsCompatible { enum { value = true }; }; + // void as a return value + template struct AreArgumentsCompatible { enum { value = true }; }; + template struct AreArgumentsCompatible { enum { value = true }; }; + template<> struct AreArgumentsCompatible { enum { value = true }; }; + + template struct CheckCompatibleArguments { enum { value = false }; }; + template <> struct CheckCompatibleArguments, List<>> { enum { value = true }; }; + template struct CheckCompatibleArguments> { enum { value = true }; }; + template + struct CheckCompatibleArguments, List> + { + enum { value = AreArgumentsCompatible::Type, typename RemoveConstRef::Type>::value + && CheckCompatibleArguments, List>::value }; + }; + + /* + Find the maximum number of arguments a functor object can take and be still compatible with + the arguments from the signal. + Value is the number of arguments, or -1 if nothing matches. + */ + template struct ComputeFunctorArgumentCount; + + template struct ComputeFunctorArgumentCountHelper + { enum { Value = -1 }; }; + template + struct ComputeFunctorArgumentCountHelper, false> + : ComputeFunctorArgumentCount, sizeof...(ArgList)>::Value> {}; + + template struct ComputeFunctorArgumentCount> + { + template static auto test(F f) -> decltype(((f.operator()((std::declval())...)), int())); + static char test(...); + enum { + Ok = sizeof(test(std::declval())) == sizeof(int), + Value = Ok ? int(sizeof...(ArgList)) : int(ComputeFunctorArgumentCountHelper, Ok>::Value) + }; + }; + + /* get the return type of a functor, given the signal argument list */ + template struct FunctorReturnType; + template struct FunctorReturnType> { + typedef decltype(std::declval().operator()((std::declval())...)) Value; + }; + + template + struct FunctorCallable + { + using ReturnType = decltype(std::declval()(std::declval()...)); + using Function = ReturnType(*)(Args...); + enum {ArgumentCount = sizeof...(Args)}; + using Arguments = QtPrivate::List; + + template + static void call(Func &f, void *, void **arg) { + FunctorCall::Value, SignalArgs, R, Func>::call(f, arg); + } + }; + + template + struct HasCallOperatorAcceptingArgs + { + private: + template + struct Test : std::false_type + { + }; + // We explicitly use .operator() to not return true for pointers to free/static function + template + struct Test().operator()(std::declval()...))>> + : std::true_type + { + }; + + public: + using Type = Test; + static constexpr bool value = Type::value; + }; + + template + constexpr bool + HasCallOperatorAcceptingArgs_v = HasCallOperatorAcceptingArgs::value; + + template + struct CallableHelper + { + private: + // Could've been std::conditional_t, but that requires all branches to + // be valid + static auto Resolve(std::true_type CallOperator) -> FunctorCallable; + static auto Resolve(std::false_type CallOperator) -> FunctionPointer>; + + public: + using Type = decltype(Resolve(typename HasCallOperatorAcceptingArgs, + Args...>::Type{})); + }; + + template + struct Callable : CallableHelper::Type + {}; + template + struct Callable> : CallableHelper::Type + {}; + + /* + Wrapper around ComputeFunctorArgumentCount and CheckCompatibleArgument, + depending on whether \a Functor is a PMF or not. Returns -1 if \a Func is + not compatible with the \a ExpectedArguments, otherwise returns >= 0. + */ + template + inline constexpr std::enable_if_t, + std::is_same, QMetaMethod>, + std::is_convertible, + std::is_same, QMetaMethod> + >, + int> + countMatchingArguments() + { + using ExpectedArguments = typename QtPrivate::FunctionPointer::Arguments; + using Actual = std::decay_t; + + if constexpr (QtPrivate::FunctionPointer::IsPointerToMemberFunction + || QtPrivate::FunctionPointer::ArgumentCount >= 0) { + // PMF or free function + using ActualArguments = typename QtPrivate::FunctionPointer::Arguments; + if constexpr (QtPrivate::CheckCompatibleArguments::value) + return QtPrivate::FunctionPointer::ArgumentCount; + else + return -1; + } else { + // lambda or functor + return QtPrivate::ComputeFunctorArgumentCount::Value; + } + } + + // internal base class (interface) containing functions required to call a slot managed by a pointer to function. + class QSlotObjectBase + { + // Don't use virtual functions here; we don't want the + // compiler to create tons of per-polymorphic-class stuff that + // we'll never need. We just use one function pointer, and the + // Operations enum below to distinguish requests +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) + QAtomicInt m_ref = 1; + typedef void (*ImplFn)(int which, QSlotObjectBase* this_, QObject *receiver, void **args, bool *ret); + const ImplFn m_impl; +#else + using ImplFn = void (*)(QSlotObjectBase* this_, QObject *receiver, void **args, int which, bool *ret); + const ImplFn m_impl; + QAtomicInt m_ref = 1; +#endif + protected: + // The operations that can be requested by calls to m_impl, + // see the member functions that call m_impl below for details + enum Operation { + Destroy, + Call, + Compare, + + NumOperations + }; + public: + explicit QSlotObjectBase(ImplFn fn) : m_impl(fn) {} + + // A custom deleter compatible with std protocols (op()()) we well as + // the legacy QScopedPointer protocol (cleanup()). + struct Deleter { + void operator()(QSlotObjectBase *p) const noexcept + { if (p) p->destroyIfLastRef(); } + // for the non-standard QScopedPointer protocol: + static void cleanup(QSlotObjectBase *p) noexcept { Deleter{}(p); } + }; + + bool ref() noexcept { return m_ref.ref(); } +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) + inline void destroyIfLastRef() noexcept + { if (!m_ref.deref()) m_impl(Destroy, this, nullptr, nullptr, nullptr); } + + inline bool compare(void **a) { bool ret = false; m_impl(Compare, this, nullptr, a, &ret); return ret; } + inline void call(QObject *r, void **a) { m_impl(Call, this, r, a, nullptr); } +#else + inline void destroyIfLastRef() noexcept + { if (!m_ref.deref()) m_impl(this, nullptr, nullptr, Destroy, nullptr); } + + inline bool compare(void **a) + { + bool ret = false; + m_impl(this, nullptr, a, Compare, &ret); + return ret; + } + inline void call(QObject *r, void **a) { m_impl(this, r, a, Call, nullptr); } +#endif + bool isImpl(ImplFn f) const { return m_impl == f; } + protected: + ~QSlotObjectBase() {} + private: + Q_DISABLE_COPY_MOVE(QSlotObjectBase) + }; + + using SlotObjUniquePtr = std::unique_ptr; + inline SlotObjUniquePtr copy(const SlotObjUniquePtr &other) noexcept + { + if (other) + other->ref(); + return SlotObjUniquePtr{other.get()}; + } + + class SlotObjSharedPtr { + SlotObjUniquePtr obj; + public: + Q_NODISCARD_CTOR Q_IMPLICIT SlotObjSharedPtr() noexcept = default; + Q_NODISCARD_CTOR Q_IMPLICIT SlotObjSharedPtr(std::nullptr_t) noexcept : SlotObjSharedPtr() {} + Q_NODISCARD_CTOR explicit SlotObjSharedPtr(SlotObjUniquePtr o) + : obj(std::move(o)) + { + // does NOT ref() (takes unique_ptr by value) + // (that's why (QSlotObjectBase*) ctor doesn't exisit: don't know whether that one _should_) + } + Q_NODISCARD_CTOR SlotObjSharedPtr(const SlotObjSharedPtr &other) noexcept + : obj{copy(other.obj)} {} + SlotObjSharedPtr &operator=(const SlotObjSharedPtr &other) noexcept + { auto copy = other; swap(copy); return *this; } + + Q_NODISCARD_CTOR SlotObjSharedPtr(SlotObjSharedPtr &&other) noexcept = default; + SlotObjSharedPtr &operator=(SlotObjSharedPtr &&other) noexcept = default; + ~SlotObjSharedPtr() = default; + + void swap(SlotObjSharedPtr &other) noexcept { obj.swap(other.obj); } + + auto get() const noexcept { return obj.get(); } + auto operator->() const noexcept { return get(); } + + explicit operator bool() const noexcept { return bool(obj); } + }; + + + // Implementation of QSlotObjectBase for which the slot is a callable (function, PMF, functor, or lambda). + // Args and R are the List of arguments and the return type of the signal to which the slot is connected. + template + class QCallableObject : public QSlotObjectBase, + private QtPrivate::CompactStorage> + { + using FunctorValue = std::decay_t; + using Storage = QtPrivate::CompactStorage; + using FuncType = Callable; + +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) + Q_DECL_HIDDEN static void impl(int which, QSlotObjectBase *this_, QObject *r, void **a, bool *ret) +#else + // Design note: the first three arguments match those for typical Call + // and Destroy uses. We return void to enable tail call optimization + // for those too. + Q_DECL_HIDDEN static void impl(QSlotObjectBase *this_, QObject *r, void **a, int which, bool *ret) +#endif + { + const auto that = static_cast(this_); + switch (which) { + case Destroy: + delete that; + break; + case Call: + if constexpr (std::is_member_function_pointer_v) + FuncType::template call(that->object(), static_cast(r), a); + else + FuncType::template call(that->object(), r, a); + break; + case Compare: + if constexpr (std::is_member_function_pointer_v) { + *ret = *reinterpret_cast(a) == that->object(); + break; + } + // not implemented otherwise + Q_FALLTHROUGH(); + case NumOperations: + Q_UNUSED(ret); + } + } + public: + explicit QCallableObject(Func &&f) : QSlotObjectBase(&impl), Storage{std::move(f)} {} + explicit QCallableObject(const Func &f) : QSlotObjectBase(&impl), Storage{f} {} + }; + + // Helper to detect the context object type based on the functor type: + // QObject for free functions and lambdas; the callee for member function + // pointers. The default declaration doesn't have the ContextType typedef, + // and so non-functor APIs (like old-style string-based slots) are removed + // from the overload set. + template + struct ContextTypeForFunctor {}; + + template + struct ContextTypeForFunctor, + std::is_member_function_pointer + > + > + > + { + using ContextType = QObject; + }; + template + struct ContextTypeForFunctor>, + std::is_member_function_pointer, + std::is_convertible::Object *, QObject *> + > + > + > + { + using ContextType = typename QtPrivate::FunctionPointer::Object; + }; + + /* + Returns a suitable QSlotObjectBase object that holds \a func, if possible. + + Not available (and thus produces compile-time errors) if the Functor provided is + not compatible with the expected Prototype. + */ + template + static constexpr std::enable_if_t() >= 0, + QtPrivate::QSlotObjectBase *> + makeCallableObject(Functor &&func) + { + using ExpectedSignature = QtPrivate::FunctionPointer; + using ExpectedReturnType = typename ExpectedSignature::ReturnType; + using ExpectedArguments = typename ExpectedSignature::Arguments; + + using ActualSignature = QtPrivate::FunctionPointer; + constexpr int MatchingArgumentCount = QtPrivate::countMatchingArguments(); + using ActualArguments = typename QtPrivate::List_Left::Value; + + static_assert(int(ActualSignature::ArgumentCount) <= int(ExpectedSignature::ArgumentCount), + "Functor requires more arguments than what can be provided."); + + // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks) + return new QtPrivate::QCallableObject, ActualArguments, ExpectedReturnType>(std::forward(func)); + } + + template + struct AreFunctionsCompatible : std::false_type {}; + template + struct AreFunctionsCompatible(std::forward(std::declval()))), + QtPrivate::QSlotObjectBase *>> + > : std::true_type {}; + + template + inline constexpr bool AssertCompatibleFunctions() { + static_assert(AreFunctionsCompatible::value, + "Functor is not compatible with expected prototype!"); + return true; + } +} + +QT_END_NAMESPACE + diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qoperatingsystemversion.h b/qt/6.8.1/msvc2022_64/include/QtCore/qoperatingsystemversion.h new file mode 100644 index 0000000000000000000000000000000000000000..ea0ad59337ad63f1abd3259fd1d3ad5029372f77 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qoperatingsystemversion.h @@ -0,0 +1,308 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include +#include +#include + +#ifndef QOPERATINGSYSTEMVERSION_H +#define QOPERATINGSYSTEMVERSION_H + +QT_BEGIN_NAMESPACE + +#if 0 +# pragma qt_class(QOperatingSystemVersionBase) +# pragma qt_class(QOperatingSystemVersion) +# pragma qt_sync_stop_processing // we have some ifdef'ery fooling syncqt +#endif + +class QString; + +class QOperatingSystemVersionBase +{ +public: + // ### Qt 7: Keep synchronized with the copy in QOperatingSystemVersion until Qt7, + // then remove this comment :) + enum OSType { + Unknown = 0, + Windows, + MacOS, + IOS, + TvOS, + WatchOS, + Android, + VisionOS, + }; + + constexpr QOperatingSystemVersionBase(OSType osType, + int vmajor, int vminor = -1, int vmicro = -1) + : m_os(osType), + m_major(vmajor), + m_minor(vminor), + m_micro(vmicro) + { } + + static Q_CORE_EXPORT QOperatingSystemVersionBase current(); + static Q_CORE_EXPORT QString name(QOperatingSystemVersionBase osversion); + static Q_CORE_EXPORT bool isAnyOfType(std::initializer_list types, OSType type); + + static constexpr OSType currentType() + { +#if defined(Q_OS_WIN) + return Windows; +#elif defined(Q_OS_MACOS) + return MacOS; +#elif defined(Q_OS_IOS) + return IOS; +#elif defined(Q_OS_TVOS) + return TvOS; +#elif defined(Q_OS_WATCHOS) + return WatchOS; +#elif defined(Q_OS_VISIONOS) + return VisionOS; +#elif defined(Q_OS_ANDROID) + return Android; +#else + return Unknown; +#endif + } + + inline QVersionNumber version() const { return QVersionNumber(m_major, m_minor, m_micro); } + + constexpr int majorVersion() const { return m_major; } + constexpr int minorVersion() const { return m_minor; } + constexpr int microVersion() const { return m_micro; } + + constexpr int segmentCount() const + { return m_micro >= 0 ? 3 : m_minor >= 0 ? 2 : m_major >= 0 ? 1 : 0; } + + inline bool isAnyOfType(std::initializer_list types) const + { + return QOperatingSystemVersionBase::isAnyOfType(types, type()); + } + constexpr OSType type() const { return m_os; } + inline QString name() const { return name(*this); } + +protected: + static Q_CORE_EXPORT int compare(QOperatingSystemVersionBase v1, + QOperatingSystemVersionBase v2) noexcept; + + friend Qt::partial_ordering compareThreeWay(const QOperatingSystemVersionBase &lhs, + const QOperatingSystemVersionBase &rhs) noexcept + { + if (lhs.type() != rhs.type()) + return Qt::partial_ordering::unordered; + const int res = QOperatingSystemVersionBase::compare(lhs, rhs); + return Qt::compareThreeWay(res, 0); + } +#ifdef __cpp_lib_three_way_comparison + friend std::partial_ordering + operator<=>(QOperatingSystemVersionBase lhs, QOperatingSystemVersionBase rhs) noexcept + { return compareThreeWay(lhs, rhs); } +#else + friend bool + operator>(QOperatingSystemVersionBase lhs, QOperatingSystemVersionBase rhs) noexcept + { return is_gt(compareThreeWay(lhs, rhs)); } + + friend bool + operator>=(QOperatingSystemVersionBase lhs, QOperatingSystemVersionBase rhs) noexcept + { return is_gteq(compareThreeWay(lhs, rhs)); } + + friend bool + operator<(QOperatingSystemVersionBase lhs, QOperatingSystemVersionBase rhs) noexcept + { return is_lt(compareThreeWay(lhs, rhs)); } + + friend bool + operator<=(QOperatingSystemVersionBase lhs, QOperatingSystemVersionBase rhs) noexcept + { return is_lteq(compareThreeWay(lhs, rhs)); } +#endif + + QOperatingSystemVersionBase() = default; +private: + static QOperatingSystemVersionBase current_impl(); + + OSType m_os; + int m_major; + int m_minor; + int m_micro; +}; + +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED) && !defined(Q_QDOC) +class QOperatingSystemVersionUnexported : public QOperatingSystemVersionBase +{ +public: + using QOperatingSystemVersionBase::QOperatingSystemVersionBase; + constexpr QOperatingSystemVersionUnexported(QOperatingSystemVersionBase other) noexcept + : QOperatingSystemVersionBase(other) {} +#else +class QOperatingSystemVersion : public QOperatingSystemVersionBase +{ + using QOperatingSystemVersionUnexported = QOperatingSystemVersionBase; +public: +#endif + + // ### Qt7: Regroup with the rest below + static constexpr QOperatingSystemVersionBase MacOSSonoma { QOperatingSystemVersionBase::MacOS, 14, 0 }; + static constexpr QOperatingSystemVersionBase MacOSSequoia { QOperatingSystemVersionBase::MacOS, 15, 0 }; + static constexpr QOperatingSystemVersionBase Android14 { QOperatingSystemVersionBase::Android, 14, 0 }; + static constexpr QOperatingSystemVersionBase Windows11_23H2 { QOperatingSystemVersionBase::Windows, 10, 0, 22631 }; + static constexpr QOperatingSystemVersionBase Windows11_24H2 { QOperatingSystemVersionBase::Windows, 10, 0, 26100 }; + +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED) && !defined(Q_QDOC) +}; + +class Q_CORE_EXPORT QOperatingSystemVersion : public QOperatingSystemVersionUnexported +{ +#endif +public: + // ### Qt7: Remove. Keep synchronized with QOperatingSystemVersionBase::OSType until then! +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED) + enum OSType { + Unknown = 0, + Windows, + MacOS, + IOS, + TvOS, + WatchOS, + Android, + VisionOS, + }; +#endif + + // ### Qt7: remove the branch with static const variables. Then group and + // sort the inline ones. Until then, new entries should be added to + // QOperatingSystemVersionUnexported. +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED) + static const QOperatingSystemVersion Windows7; + static const QOperatingSystemVersion Windows8; + static const QOperatingSystemVersion Windows8_1; + static const QOperatingSystemVersion Windows10; + + static const QOperatingSystemVersion OSXMavericks; + static const QOperatingSystemVersion OSXYosemite; + static const QOperatingSystemVersion OSXElCapitan; + static const QOperatingSystemVersion MacOSSierra; + static const QOperatingSystemVersion MacOSHighSierra; + static const QOperatingSystemVersion MacOSMojave; + static const QOperatingSystemVersion MacOSCatalina; + static const QOperatingSystemVersion MacOSBigSur; + static const QOperatingSystemVersion MacOSMonterey; + + static const QOperatingSystemVersion AndroidJellyBean; + static const QOperatingSystemVersion AndroidJellyBean_MR1; + static const QOperatingSystemVersion AndroidJellyBean_MR2; + static const QOperatingSystemVersion AndroidKitKat; + static const QOperatingSystemVersion AndroidLollipop; + static const QOperatingSystemVersion AndroidLollipop_MR1; + static const QOperatingSystemVersion AndroidMarshmallow; + static const QOperatingSystemVersion AndroidNougat; + static const QOperatingSystemVersion AndroidNougat_MR1; + static const QOperatingSystemVersion AndroidOreo; + static const QOperatingSystemVersion AndroidOreo_MR1; + static const QOperatingSystemVersion AndroidPie; + static const QOperatingSystemVersion Android10; + static const QOperatingSystemVersion Android11; +#else + static constexpr QOperatingSystemVersionBase Windows7 { QOperatingSystemVersionBase::Windows, 6, 1 }; + static constexpr QOperatingSystemVersionBase Windows8 { QOperatingSystemVersionBase::Windows, 6, 2 }; + static constexpr QOperatingSystemVersionBase Windows8_1 { QOperatingSystemVersionBase::Windows, 6, 3 }; + static constexpr QOperatingSystemVersionBase Windows10 { QOperatingSystemVersionBase::Windows, 10 }; + + static constexpr QOperatingSystemVersionBase OSXMavericks { QOperatingSystemVersionBase::MacOS, 10, 9 }; + static constexpr QOperatingSystemVersionBase OSXYosemite { QOperatingSystemVersionBase::MacOS, 10, 10 }; + static constexpr QOperatingSystemVersionBase OSXElCapitan { QOperatingSystemVersionBase::MacOS, 10, 11 }; + static constexpr QOperatingSystemVersionBase MacOSSierra { QOperatingSystemVersionBase::MacOS, 10, 12 }; + static constexpr QOperatingSystemVersionBase MacOSHighSierra { QOperatingSystemVersionBase::MacOS, 10, 13 }; + static constexpr QOperatingSystemVersionBase MacOSMojave { QOperatingSystemVersionBase::MacOS, 10, 14 }; + static constexpr QOperatingSystemVersionBase MacOSCatalina { QOperatingSystemVersionBase::MacOS, 10, 15 }; + static constexpr QOperatingSystemVersionBase MacOSBigSur = { QOperatingSystemVersionBase::MacOS, 11, 0 }; + static constexpr QOperatingSystemVersionBase MacOSMonterey = { QOperatingSystemVersionBase::MacOS, 12, 0 }; + + static constexpr QOperatingSystemVersionBase AndroidJellyBean { QOperatingSystemVersionBase::Android, 4, 1 }; + static constexpr QOperatingSystemVersionBase AndroidJellyBean_MR1 { QOperatingSystemVersionBase::Android, 4, 2 }; + static constexpr QOperatingSystemVersionBase AndroidJellyBean_MR2 { QOperatingSystemVersionBase::Android, 4, 3 }; + static constexpr QOperatingSystemVersionBase AndroidKitKat { QOperatingSystemVersionBase::Android, 4, 4 }; + static constexpr QOperatingSystemVersionBase AndroidLollipop { QOperatingSystemVersionBase::Android, 5, 0 }; + static constexpr QOperatingSystemVersionBase AndroidLollipop_MR1 { QOperatingSystemVersionBase::Android, 5, 1 }; + static constexpr QOperatingSystemVersionBase AndroidMarshmallow { QOperatingSystemVersionBase::Android, 6, 0 }; + static constexpr QOperatingSystemVersionBase AndroidNougat { QOperatingSystemVersionBase::Android, 7, 0 }; + static constexpr QOperatingSystemVersionBase AndroidNougat_MR1 { QOperatingSystemVersionBase::Android, 7, 1 }; + static constexpr QOperatingSystemVersionBase AndroidOreo { QOperatingSystemVersionBase::Android, 8, 0 }; + static constexpr QOperatingSystemVersionBase AndroidOreo_MR1 { QOperatingSystemVersionBase::Android, 8, 1 }; + static constexpr QOperatingSystemVersionBase AndroidPie { QOperatingSystemVersionBase::Android, 9, 0 }; + static constexpr QOperatingSystemVersionBase Android10 { QOperatingSystemVersionBase::Android, 10, 0 }; + static constexpr QOperatingSystemVersionBase Android11 { QOperatingSystemVersionBase::Android, 11, 0 }; +#endif + + static constexpr QOperatingSystemVersionBase Windows10_1809 { QOperatingSystemVersionBase::Windows, 10, 0, 17763 }; // RS5 + static constexpr QOperatingSystemVersionBase Windows10_1903 { QOperatingSystemVersionBase::Windows, 10, 0, 18362 }; // 19H1 + static constexpr QOperatingSystemVersionBase Windows10_1909 { QOperatingSystemVersionBase::Windows, 10, 0, 18363 }; // 19H2 + static constexpr QOperatingSystemVersionBase Windows10_2004 { QOperatingSystemVersionBase::Windows, 10, 0, 19041 }; // 20H1 + static constexpr QOperatingSystemVersionBase Windows10_20H2 { QOperatingSystemVersionBase::Windows, 10, 0, 19042 }; + static constexpr QOperatingSystemVersionBase Windows10_21H1 { QOperatingSystemVersionBase::Windows, 10, 0, 19043 }; + static constexpr QOperatingSystemVersionBase Windows10_21H2 { QOperatingSystemVersionBase::Windows, 10, 0, 19044 }; + static constexpr QOperatingSystemVersionBase Windows10_22H2 { QOperatingSystemVersionBase::Windows, 10, 0, 19045 }; + static constexpr QOperatingSystemVersionBase Windows11 { QOperatingSystemVersionBase::Windows, 10, 0, 22000 }; + static constexpr QOperatingSystemVersionBase Windows11_21H2 = Windows11; + static constexpr QOperatingSystemVersionBase Windows11_22H2 { QOperatingSystemVersionBase::Windows, 10, 0, 22621 }; + + static constexpr QOperatingSystemVersionBase Android12 { QOperatingSystemVersionBase::Android, 12, 0 }; + static constexpr QOperatingSystemVersionBase Android12L { QOperatingSystemVersionBase::Android, 12, 0 }; + static constexpr QOperatingSystemVersionBase Android13 { QOperatingSystemVersionBase::Android, 13, 0 }; + + static constexpr QOperatingSystemVersionBase MacOSVentura { QOperatingSystemVersionBase::MacOS, 13, 0 }; + + constexpr QOperatingSystemVersion(const QOperatingSystemVersionBase &osversion) + : QOperatingSystemVersionUnexported(osversion) {} + + constexpr QOperatingSystemVersion(OSType osType, int vmajor, int vminor = -1, int vmicro = -1) + : QOperatingSystemVersionUnexported(QOperatingSystemVersionBase::OSType(osType), vmajor, vminor, + vmicro) + { + } + +#if QT_CORE_REMOVED_SINCE(6, 3) || defined(Q_QDOC) + static QOperatingSystemVersion current(); +#endif + + static constexpr OSType currentType() + { + return OSType(QOperatingSystemVersionBase::currentType()); + } + +#if QT_CORE_REMOVED_SINCE(6, 3) || defined(Q_QDOC) + QVersionNumber version() const { return QOperatingSystemVersionBase::version(); } + + constexpr int majorVersion() const { return QOperatingSystemVersionBase::majorVersion(); } + constexpr int minorVersion() const { return QOperatingSystemVersionBase::minorVersion(); } + constexpr int microVersion() const { return QOperatingSystemVersionBase::microVersion(); } + + constexpr int segmentCount() const + { return QOperatingSystemVersionBase::segmentCount(); } +#endif // QT_CORE_REMOVED_SINCE(6, 3) + + constexpr OSType type() const { return OSType(QOperatingSystemVersionBase::type()); } + QT7_ONLY(Q_CORE_EXPORT) bool isAnyOfType(std::initializer_list types) const; +#if QT_CORE_REMOVED_SINCE(6, 3) || defined(Q_QDOC) + QString name() const; +#endif + +private: + QOperatingSystemVersion() = default; + +#if QT_CORE_REMOVED_SINCE(6, 3) + // ### Qt 7: Remove. It's only here for backwards compat with previous inline calls. + [[maybe_unused]] static int compare(const QOperatingSystemVersion &v1, + const QOperatingSystemVersion &v2); +#endif +}; +Q_DECLARE_TYPEINFO(QOperatingSystemVersion, Q_PRIMITIVE_TYPE); + +#ifndef QT_NO_DEBUG_STREAM +class QDebug; +Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QOperatingSystemVersion &ov); +#endif + +QT_END_NAMESPACE + +#endif // QOPERATINGSYSTEMVERSION_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qoverload.h b/qt/6.8.1/msvc2022_64/include/QtCore/qoverload.h new file mode 100644 index 0000000000000000000000000000000000000000..724272426b6fc4b544a431841b13cdcbb7764e81 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qoverload.h @@ -0,0 +1,80 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QOVERLOAD_H +#define QOVERLOAD_H + +#include + +#if 0 +#pragma qt_class(QOverload) +#endif + +QT_BEGIN_NAMESPACE + +#ifdef Q_QDOC +// Just for documentation generation +template +auto qOverload(T functionPointer); +template +auto qConstOverload(T memberFunctionPointer); +template +auto qNonConstOverload(T memberFunctionPointer); +#else +template +struct QNonConstOverload +{ + template + constexpr auto operator()(R (T::*ptr)(Args...)) const noexcept -> decltype(ptr) + { return ptr; } + + template + static constexpr auto of(R (T::*ptr)(Args...)) noexcept -> decltype(ptr) + { return ptr; } +}; + +template +struct QConstOverload +{ + template + constexpr auto operator()(R (T::*ptr)(Args...) const) const noexcept -> decltype(ptr) + { return ptr; } + + template + static constexpr auto of(R (T::*ptr)(Args...) const) noexcept -> decltype(ptr) + { return ptr; } +}; + +template +struct QOverload : QConstOverload, QNonConstOverload +{ + using QConstOverload::of; + using QConstOverload::operator(); + using QNonConstOverload::of; + using QNonConstOverload::operator(); + + template + constexpr auto operator()(R (*ptr)(Args...)) const noexcept -> decltype(ptr) + { return ptr; } + + template + static constexpr auto of(R (*ptr)(Args...)) noexcept -> decltype(ptr) + { return ptr; } +}; + +template constexpr inline QOverload qOverload = {}; +template constexpr inline QConstOverload qConstOverload = {}; +template constexpr inline QNonConstOverload qNonConstOverload = {}; + +#endif // Q_QDOC + +#define QT_VA_ARGS_CHOOSE(_1, _2, _3, _4, _5, _6, _7, _8, _9, N, ...) N +#define QT_VA_ARGS_EXPAND(...) __VA_ARGS__ // Needed for MSVC +#define QT_VA_ARGS_COUNT(...) QT_VA_ARGS_EXPAND(QT_VA_ARGS_CHOOSE(__VA_ARGS__, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)) +#define QT_OVERLOADED_MACRO_EXPAND(MACRO, ARGC) MACRO##_##ARGC +#define QT_OVERLOADED_MACRO_IMP(MACRO, ARGC) QT_OVERLOADED_MACRO_EXPAND(MACRO, ARGC) +#define QT_OVERLOADED_MACRO(MACRO, ...) QT_VA_ARGS_EXPAND(QT_OVERLOADED_MACRO_IMP(MACRO, QT_VA_ARGS_COUNT(__VA_ARGS__))(__VA_ARGS__)) + +QT_END_NAMESPACE + +#endif /* QOVERLOAD_H */ diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qpair.h b/qt/6.8.1/msvc2022_64/include/QtCore/qpair.h new file mode 100644 index 0000000000000000000000000000000000000000..cc84422b64d64cd603ea43c2a0e7b2f990cb02e8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qpair.h @@ -0,0 +1,29 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QPAIR_H +#define QPAIR_H + +#include +#include + +QT_BEGIN_NAMESPACE + +#if 0 +#pragma qt_class(QPair) +#endif + +#ifndef QT_NO_QPAIR + +template +constexpr decltype(auto) qMakePair(T1 &&value1, T2 &&value2) + noexcept(noexcept(std::make_pair(std::forward(value1), std::forward(value2)))) +{ + return std::make_pair(std::forward(value1), std::forward(value2)); +} + +#endif // QT_NO_QPAIR + +QT_END_NAMESPACE + +#endif // QPAIR_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qparallelanimationgroup.h b/qt/6.8.1/msvc2022_64/include/QtCore/qparallelanimationgroup.h new file mode 100644 index 0000000000000000000000000000000000000000..307549e830e815492cd4360b6ef53cd51df4f278 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qparallelanimationgroup.h @@ -0,0 +1,40 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QPARALLELANIMATIONGROUP_H +#define QPARALLELANIMATIONGROUP_H + +#include + +QT_REQUIRE_CONFIG(animation); + +QT_BEGIN_NAMESPACE + +class QParallelAnimationGroupPrivate; +class Q_CORE_EXPORT QParallelAnimationGroup : public QAnimationGroup +{ + Q_OBJECT + +public: + QParallelAnimationGroup(QObject *parent = nullptr); + ~QParallelAnimationGroup(); + + int duration() const override; + +protected: + QParallelAnimationGroup(QParallelAnimationGroupPrivate &dd, QObject *parent); + bool event(QEvent *event) override; + + void updateCurrentTime(int currentTime) override; + void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) override; + void updateDirection(QAbstractAnimation::Direction direction) override; + +private: + Q_DISABLE_COPY(QParallelAnimationGroup) + Q_DECLARE_PRIVATE(QParallelAnimationGroup) + Q_PRIVATE_SLOT(d_func(), void _q_uncontrolledAnimationFinished()) +}; + +QT_END_NAMESPACE + +#endif // QPARALLELANIMATIONGROUP diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qpauseanimation.h b/qt/6.8.1/msvc2022_64/include/QtCore/qpauseanimation.h new file mode 100644 index 0000000000000000000000000000000000000000..07a15f7121edee40ce27fd202b9dae77117ee7c1 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qpauseanimation.h @@ -0,0 +1,39 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QPAUSEANIMATION_H +#define QPAUSEANIMATION_H + +#include + +QT_REQUIRE_CONFIG(animation); + +QT_BEGIN_NAMESPACE + +class QPauseAnimationPrivate; + +class Q_CORE_EXPORT QPauseAnimation : public QAbstractAnimation +{ + Q_OBJECT + Q_PROPERTY(int duration READ duration WRITE setDuration BINDABLE bindableDuration) +public: + QPauseAnimation(QObject *parent = nullptr); + QPauseAnimation(int msecs, QObject *parent = nullptr); + ~QPauseAnimation(); + + int duration() const override; + void setDuration(int msecs); + QBindable bindableDuration(); + +protected: + bool event(QEvent *e) override; + void updateCurrentTime(int) override; + +private: + Q_DISABLE_COPY(QPauseAnimation) + Q_DECLARE_PRIVATE(QPauseAnimation) +}; + +QT_END_NAMESPACE + +#endif // QPAUSEANIMATION_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qpermissions.h b/qt/6.8.1/msvc2022_64/include/QtCore/qpermissions.h new file mode 100644 index 0000000000000000000000000000000000000000..d3f902d05b7d0c53cc50ce2d076aa6d2ee335ed2 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qpermissions.h @@ -0,0 +1,219 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QPERMISSIONS_H +#define QPERMISSIONS_H + +#if 0 +#pragma qt_class(QPermissions) +#endif + +#include +#include +#include + +#include +#include +#include + +#include + +#if !defined(Q_QDOC) +QT_REQUIRE_CONFIG(permissions); +#endif + +QT_BEGIN_NAMESPACE + +#ifndef QT_NO_DEBUG_STREAM +class QDebug; +#endif + +struct QMetaObject; +class QCoreApplication; + +class QPermission +{ + template + static constexpr inline bool is_permission_v = false; + + template + using if_permission = std::enable_if_t, bool>; +public: + explicit QPermission() = default; + + template = true> + QPermission(const T &t) : m_data(QVariant::fromValue(t)) {} + + Qt::PermissionStatus status() const { return m_status; } + + QMetaType type() const { return m_data.metaType(); } + + template = true> + std::optional value() const + { + if (auto p = data(QMetaType::fromType())) + return *static_cast(p); + return std::nullopt; + } + +#ifndef QT_NO_DEBUG_STREAM + friend Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QPermission &); +#endif + +private: + Q_CORE_EXPORT const void *data(QMetaType id) const; + + Qt::PermissionStatus m_status = Qt::PermissionStatus::Undetermined; + QVariant m_data; + + friend class QCoreApplication; +}; + +template +constexpr bool QPermission::is_permission_v = true; + +#define QT_PERMISSION(ClassName) \ + using QtPermissionHelper = void; \ + friend class QPermission; \ + union U { \ + U() : d(nullptr) {} \ + U(ShortData _data) : data(_data) {} \ + U(ClassName##Private *_d) : d(_d) {} \ + ShortData data; \ + ClassName##Private *d; \ + } u; \ +public: \ + Q_CORE_EXPORT ClassName(); \ + Q_CORE_EXPORT ClassName(const ClassName &other) noexcept; \ + ClassName(ClassName &&other) noexcept \ + : u{other.u} { other.u.d = nullptr; } \ + Q_CORE_EXPORT ~ClassName(); \ + Q_CORE_EXPORT ClassName &operator=(const ClassName &other) noexcept; \ + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(ClassName) \ + void swap(ClassName &other) noexcept { std::swap(u, other.u); } \ +private: \ + /*end*/ + +class QLocationPermissionPrivate; +class QLocationPermission +{ + Q_GADGET_EXPORT(Q_CORE_EXPORT) +public: + enum Accuracy : quint8 { + Approximate, + Precise, + }; + Q_ENUM(Accuracy) + + Q_CORE_EXPORT void setAccuracy(Accuracy accuracy); + Q_CORE_EXPORT Accuracy accuracy() const; + + enum Availability : quint8 { + WhenInUse, + Always, + }; + Q_ENUM(Availability) + + Q_CORE_EXPORT void setAvailability(Availability availability); + Q_CORE_EXPORT Availability availability() const; + +private: + struct ShortData { + Accuracy accuracy; + Availability availability; + char reserved[sizeof(void*) - sizeof(accuracy) - sizeof(availability)]; + }; + QT_PERMISSION(QLocationPermission) +}; +Q_DECLARE_SHARED(QLocationPermission) + +class QCalendarPermissionPrivate; +class QCalendarPermission +{ + Q_GADGET_EXPORT(Q_CORE_EXPORT) +public: + enum AccessMode : quint8 { + ReadOnly, + ReadWrite, + }; + Q_ENUM(AccessMode) + + Q_CORE_EXPORT void setAccessMode(AccessMode mode); + Q_CORE_EXPORT AccessMode accessMode() const; + +private: + struct ShortData { + AccessMode mode; + char reserved[sizeof(void*) - sizeof(mode)]; + }; + QT_PERMISSION(QCalendarPermission) +}; +Q_DECLARE_SHARED(QCalendarPermission) + +class QContactsPermissionPrivate; +class QContactsPermission +{ + Q_GADGET_EXPORT(Q_CORE_EXPORT) +public: + enum AccessMode : quint8 { + ReadOnly, + ReadWrite, + }; + Q_ENUM(AccessMode) + + Q_CORE_EXPORT void setAccessMode(AccessMode mode); + Q_CORE_EXPORT AccessMode accessMode() const; + +private: + struct ShortData { + AccessMode mode; + char reserved[sizeof(void*) - sizeof(mode)]; + }; + QT_PERMISSION(QContactsPermission) +}; +Q_DECLARE_SHARED(QContactsPermission) + +class QBluetoothPermissionPrivate; +class QBluetoothPermission +{ + Q_GADGET_EXPORT(Q_CORE_EXPORT) +public: + enum CommunicationMode : quint8 { + Access = 0x01, + Advertise = 0x02, + Default = Access | Advertise, + }; + Q_DECLARE_FLAGS(CommunicationModes, CommunicationMode) + Q_FLAG(CommunicationModes) + + Q_CORE_EXPORT void setCommunicationModes(CommunicationModes modes); + Q_CORE_EXPORT CommunicationModes communicationModes() const; + +private: + struct ShortData { + CommunicationMode mode; + char reserved[sizeof(void*) - sizeof(mode)]; + }; + QT_PERMISSION(QBluetoothPermission) +}; +Q_DECLARE_OPERATORS_FOR_FLAGS(QBluetoothPermission::CommunicationModes) +Q_DECLARE_SHARED(QBluetoothPermission) + +#define Q_DECLARE_MINIMAL_PERMISSION(ClassName) \ + class ClassName##Private; \ + class ClassName \ + { \ + struct ShortData { char reserved[sizeof(void*)]; }; \ + QT_PERMISSION(ClassName) \ + }; \ + Q_DECLARE_SHARED(ClassName) + +Q_DECLARE_MINIMAL_PERMISSION(QCameraPermission) +Q_DECLARE_MINIMAL_PERMISSION(QMicrophonePermission) + +#undef QT_PERMISSION +#undef Q_DECLARE_MINIMAL_PERMISSION + +QT_END_NAMESPACE + +#endif // QPERMISSIONS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qplugin.h b/qt/6.8.1/msvc2022_64/include/QtCore/qplugin.h new file mode 100644 index 0000000000000000000000000000000000000000..ec84223b8d10fa90c7fca462aa2ba8881bc82990 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qplugin.h @@ -0,0 +1,268 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2021 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QPLUGIN_H +#define QPLUGIN_H + +#if 0 +#pragma qt_class(QtPlugin) +#endif + +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +// Used up to Qt 6.2 +inline constexpr unsigned char qPluginArchRequirements() +{ + return 0 +#ifndef QT_NO_DEBUG + | 1 +#endif +#ifdef __AVX2__ + | 2 +# ifdef __AVX512F__ + | 4 +# endif +#endif + ; +} + +typedef QObject *(*QtPluginInstanceFunction)(); +struct QPluginMetaData +{ + static constexpr quint8 CurrentMetaDataVersion = 1; + static constexpr char MagicString[] = { + 'Q', 'T', 'M', 'E', 'T', 'A', 'D', 'A', 'T', 'A', ' ', '!' + }; + + template + static constexpr void copy(OO (&out)[OSize], II (&in)[ISize]) + { + static_assert(OSize <= ISize, "Output would not be fully initialized"); + q20::copy_n(in, OSize, out); + } + + static constexpr quint8 archRequirements() + { + quint8 v = 0; +#if defined(__AVX512F__) + v = 4; // x86-64-v4: AVX512F, AVX512BW, AVX512CD, AVX512DQ and AVX512VL +#elif defined(__AVX__) || defined(__BMI__) || defined(__BMI2__) || defined(__MOVBE__) + v = 3; // x86-64-v3: AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE, XSAVE +#elif defined(__SSE3__) + v = 2; // x86-64-v2: POPCNT, SSE3, SSSE3, SSE4.1 and SSE4.2. +#elif defined(__SSE__) || defined(__MMX___) + v = 1; // x86-64 baseline: SSE and SSE2 +#endif +#ifndef QT_NO_DEBUG + v |= 0x80; +#endif + return v; + } + + struct Header { + quint8 version = CurrentMetaDataVersion; + quint8 qt_major_version = QT_VERSION_MAJOR; + quint8 qt_minor_version = QT_VERSION_MINOR; + quint8 plugin_arch_requirements = archRequirements(); + }; + static_assert(alignof(Header) == 1, "Alignment of header incorrect with this compiler"); + + struct MagicHeader { + char magic[sizeof(QPluginMetaData::MagicString)] = {}; + constexpr MagicHeader() { copy(magic, QPluginMetaData::MagicString); } + Header header = {}; + }; + static_assert(alignof(MagicHeader) == 1, "Alignment of header incorrect with this compiler"); + + struct ElfNoteHeader { + static constexpr quint32 NoteType = 0x74510001; + static constexpr char NoteName[] = "qt-project!"; + + // ELF note header + quint32 n_namesz = sizeof(name); + quint32 n_descsz; + quint32 n_type = NoteType; + char name[sizeof(NoteName)] = {}; + + // payload + alignas(void *) // mandatory alignment as per ELF note requirements + Header header = {}; + constexpr ElfNoteHeader(quint32 payloadSize) : n_descsz(sizeof(header) + payloadSize) + { QPluginMetaData::copy(name, NoteName); } + }; + static_assert(alignof(ElfNoteHeader) == alignof(void*), "Alignment of header incorrect with this compiler"); + static_assert((sizeof(ElfNoteHeader::name) % 4) == 0, "ELF note name length not a multiple of 4"); + + const void *data; + size_t size; +}; +typedef QPluginMetaData (*QtPluginMetaDataFunction)(); + + +struct Q_CORE_EXPORT QStaticPlugin +{ +public: + constexpr QStaticPlugin(QtPluginInstanceFunction i, QtPluginMetaDataFunction m) + : instance(i), rawMetaDataSize(m().size), rawMetaData(m().data) + {} + QtPluginInstanceFunction instance; + QJsonObject metaData() const; + +private: + qsizetype rawMetaDataSize; + const void *rawMetaData; + friend class QFactoryLoader; +}; +Q_DECLARE_TYPEINFO(QStaticPlugin, Q_PRIMITIVE_TYPE); + +void Q_CORE_EXPORT qRegisterStaticPluginFunction(QStaticPlugin staticPlugin); + +#if defined(Q_OF_ELF) || (defined(Q_OS_WIN) && (defined (Q_CC_GNU) || defined(Q_CC_CLANG))) +# define QT_PLUGIN_METADATA_SECTION \ + __attribute__ ((section (".qtmetadata"))) __attribute__((used)) +#elif defined(Q_OS_DARWIN) +# define QT_PLUGIN_METADATA_SECTION \ + __attribute__ ((section ("__TEXT,qtmetadata"))) __attribute__((used)) +#elif defined(Q_CC_MSVC) +// TODO: Implement section parsing for MSVC +#pragma section(".qtmetadata",read,shared) +# define QT_PLUGIN_METADATA_SECTION \ + __declspec(allocate(".qtmetadata")) +#else +# define QT_PLUGIN_METADATA_SECTION +#endif + +// Since Qt 6.3 +template class QPluginMetaDataV2 +{ + struct ElfNotePayload : QPluginMetaData::ElfNoteHeader { + static constexpr size_t HeaderOffset = offsetof(QPluginMetaData::ElfNoteHeader, header); + quint8 payload[sizeof(PluginMetaData)] = {}; + constexpr ElfNotePayload() : ElfNoteHeader(sizeof(PluginMetaData)) + { QPluginMetaData::copy(payload, PluginMetaData); } + }; + + struct RegularPayload : QPluginMetaData::MagicHeader { + static constexpr size_t HeaderOffset = offsetof(QPluginMetaData::MagicHeader, header); + quint8 payload[sizeof(PluginMetaData)] = {}; + constexpr RegularPayload() { QPluginMetaData::copy(payload, PluginMetaData); } + }; + + struct StaticPayload { + static constexpr size_t HeaderOffset = 0; + QPluginMetaData::Header header = {}; + quint8 payload[sizeof(PluginMetaData)] = {}; + constexpr StaticPayload() { QPluginMetaData::copy(payload, PluginMetaData); } + }; + +#if defined(QT_STATICPLUGIN) +# define QT_PLUGIN_METADATAV2_SECTION + using Payload = StaticPayload; +#elif defined(Q_OF_ELF) +# ifdef Q_CC_CLANG +# define QT_PLUGIN_METADATAV2_SECTION \ + __attribute__((section(".note.qt.metadata"), used, aligned(alignof(void *)), \ + no_sanitize("address"))) +# else +# define QT_PLUGIN_METADATAV2_SECTION \ + __attribute__((section(".note.qt.metadata"), used, aligned(alignof(void *)))) +# endif + using Payload = ElfNotePayload; +#else +# define QT_PLUGIN_METADATAV2_SECTION QT_PLUGIN_METADATA_SECTION + using Payload = RegularPayload; +#endif + + Payload payload = {}; + +public: + operator QPluginMetaData() const + { + Q_ASSERT(reinterpret_cast(&payload) + Payload::HeaderOffset == + reinterpret_cast(&payload.header)); + return { &payload.header, sizeof(payload) - Payload::HeaderOffset }; + } +}; + +#define Q_IMPORT_PLUGIN(PLUGIN) \ + extern const QT_PREPEND_NAMESPACE(QStaticPlugin) qt_static_plugin_##PLUGIN(); \ + class Static##PLUGIN##PluginInstance{ \ + public: \ + Static##PLUGIN##PluginInstance() { \ + qRegisterStaticPluginFunction(qt_static_plugin_##PLUGIN()); \ + } \ + }; \ + static Static##PLUGIN##PluginInstance static##PLUGIN##Instance; + +#if defined(QT_PLUGIN_RESOURCE_INIT_FUNCTION) +# define QT_PLUGIN_RESOURCE_INIT \ + extern void QT_PLUGIN_RESOURCE_INIT_FUNCTION(); \ + QT_PLUGIN_RESOURCE_INIT_FUNCTION(); +#else +# define QT_PLUGIN_RESOURCE_INIT +#endif + +#define Q_PLUGIN_INSTANCE(IMPLEMENTATION) \ + { \ + static QT_PREPEND_NAMESPACE(QPointer) _instance; \ + if (!_instance) { \ + QT_PLUGIN_RESOURCE_INIT \ + _instance = new IMPLEMENTATION; \ + } \ + return _instance; \ + } + +#if defined(QT_STATICPLUGIN) +# define QT_MOC_EXPORT_PLUGIN_COMMON(PLUGINCLASS, MANGLEDNAME) \ + static QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance_##MANGLEDNAME() \ + Q_PLUGIN_INSTANCE(PLUGINCLASS) \ + const QT_PREPEND_NAMESPACE(QStaticPlugin) qt_static_plugin_##MANGLEDNAME() \ + { return { qt_plugin_instance_##MANGLEDNAME, qt_plugin_query_metadata_##MANGLEDNAME}; } \ + /**/ + +# define QT_MOC_EXPORT_PLUGIN(PLUGINCLASS, PLUGINCLASSNAME) \ + static QPluginMetaData qt_plugin_query_metadata_##PLUGINCLASSNAME() \ + { return { qt_pluginMetaData_##PLUGINCLASSNAME, sizeof qt_pluginMetaData_##PLUGINCLASSNAME }; } \ + QT_MOC_EXPORT_PLUGIN_COMMON(PLUGINCLASS, PLUGINCLASSNAME) + +# define QT_MOC_EXPORT_PLUGIN_V2(PLUGINCLASS, MANGLEDNAME, MD) \ + static QT_PREPEND_NAMESPACE(QPluginMetaData) qt_plugin_query_metadata_##MANGLEDNAME() \ + { static constexpr QPluginMetaDataV2 md{}; return md; } \ + QT_MOC_EXPORT_PLUGIN_COMMON(PLUGINCLASS, MANGLEDNAME) +#else +# define QT_MOC_EXPORT_PLUGIN_COMMON(PLUGINCLASS, MANGLEDNAME) \ + extern "C" Q_DECL_EXPORT QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance() \ + Q_PLUGIN_INSTANCE(PLUGINCLASS) \ + /**/ + +# define QT_MOC_EXPORT_PLUGIN(PLUGINCLASS, PLUGINCLASSNAME) \ + extern "C" Q_DECL_EXPORT \ + QPluginMetaData qt_plugin_query_metadata() \ + { return { qt_pluginMetaData_##PLUGINCLASSNAME, sizeof qt_pluginMetaData_##PLUGINCLASSNAME }; } \ + QT_MOC_EXPORT_PLUGIN_COMMON(PLUGINCLASS, PLUGINCLASSNAME) + +# define QT_MOC_EXPORT_PLUGIN_V2(PLUGINCLASS, MANGLEDNAME, MD) \ + extern "C" Q_DECL_EXPORT QT_PREPEND_NAMESPACE(QPluginMetaData) qt_plugin_query_metadata_v2()\ + { static constexpr QT_PLUGIN_METADATAV2_SECTION QPluginMetaDataV2 md{}; return md; } \ + QT_MOC_EXPORT_PLUGIN_COMMON(PLUGINCLASS, MANGLEDNAME) +#endif + +#define Q_EXPORT_PLUGIN(PLUGIN) \ + Q_EXPORT_PLUGIN2(PLUGIN, PLUGIN) +# define Q_EXPORT_PLUGIN2(PLUGIN, PLUGINCLASS) \ + static_assert(false, "Old plugin system used") + +# define Q_EXPORT_STATIC_PLUGIN2(PLUGIN, PLUGINCLASS) \ + static_assert(false, "Old plugin system used") + + +QT_END_NAMESPACE + +#endif // Q_PLUGIN_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qpluginloader.h b/qt/6.8.1/msvc2022_64/include/QtCore/qpluginloader.h new file mode 100644 index 0000000000000000000000000000000000000000..118f146e2f1e208eee996af93d82e8b5a22939b5 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qpluginloader.h @@ -0,0 +1,67 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QPLUGINLOADER_H +#define QPLUGINLOADER_H + +#include +#if QT_CONFIG(library) +#include +#endif +#include + +QT_BEGIN_NAMESPACE + +#if QT_CONFIG(library) + +class QLibraryPrivate; +class QJsonObject; + +class Q_CORE_EXPORT QPluginLoader : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString fileName READ fileName WRITE setFileName) + Q_PROPERTY(QLibrary::LoadHints loadHints READ loadHints WRITE setLoadHints) +public: + explicit QPluginLoader(QObject *parent = nullptr); + explicit QPluginLoader(const QString &fileName, QObject *parent = nullptr); + ~QPluginLoader(); + + QObject *instance(); + QJsonObject metaData() const; + + static QObjectList staticInstances(); + static QList staticPlugins(); + + bool load(); + bool unload(); + bool isLoaded() const; + + void setFileName(const QString &fileName); + QString fileName() const; + + QString errorString() const; + + void setLoadHints(QLibrary::LoadHints loadHints); + QLibrary::LoadHints loadHints() const; + +private: + QLibraryPrivate *d; + bool did_load; + Q_DISABLE_COPY(QPluginLoader) +}; + +#else + +class Q_CORE_EXPORT QPluginLoader +{ +public: + static QObjectList staticInstances(); + static QList staticPlugins(); +}; + +#endif // QT_CONFIG(library) + +QT_END_NAMESPACE + +#endif // QPLUGINLOADER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qpoint.h b/qt/6.8.1/msvc2022_64/include/QtCore/qpoint.h new file mode 100644 index 0000000000000000000000000000000000000000..6ff3511074b20f7f86561db5b53fc390f5dcae46 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qpoint.h @@ -0,0 +1,435 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QPOINT_H +#define QPOINT_H + +#include +#include +#include + +#include +#include + +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) +struct CGPoint; +#endif + +QT_BEGIN_NAMESPACE + +QT_ENABLE_P0846_SEMANTICS_FOR(get) + +class QPointF; + +class QPoint +{ +public: + constexpr QPoint() noexcept; + constexpr QPoint(int xpos, int ypos) noexcept; + + constexpr inline bool isNull() const noexcept; + + constexpr inline int x() const noexcept; + constexpr inline int y() const noexcept; + constexpr inline void setX(int x) noexcept; + constexpr inline void setY(int y) noexcept; + + constexpr inline int manhattanLength() const; + + constexpr QPoint transposed() const noexcept { return {yp, xp}; } + + constexpr inline int &rx() noexcept; + constexpr inline int &ry() noexcept; + + constexpr inline QPoint &operator+=(const QPoint &p); + constexpr inline QPoint &operator-=(const QPoint &p); + + constexpr inline QPoint &operator*=(float factor); + constexpr inline QPoint &operator*=(double factor); + constexpr inline QPoint &operator*=(int factor); + + constexpr inline QPoint &operator/=(qreal divisor); + + constexpr static inline int dotProduct(const QPoint &p1, const QPoint &p2) + { return p1.xp * p2.xp + p1.yp * p2.yp; } + +private: + friend constexpr bool comparesEqual(const QPoint &p1, const QPoint &p2) noexcept + { return p1.xp == p2.xp && p1.yp == p2.yp; } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QPoint) + friend constexpr inline QPoint operator+(const QPoint &p1, const QPoint &p2) noexcept + { return QPoint(p1.xp + p2.xp, p1.yp + p2.yp); } + friend constexpr inline QPoint operator-(const QPoint &p1, const QPoint &p2) noexcept + { return QPoint(p1.xp - p2.xp, p1.yp - p2.yp); } + friend constexpr inline QPoint operator*(const QPoint &p, float factor) + { return QPoint(qRound(p.xp * factor), qRound(p.yp * factor)); } + friend constexpr inline QPoint operator*(const QPoint &p, double factor) + { return QPoint(qRound(p.xp * factor), qRound(p.yp * factor)); } + friend constexpr inline QPoint operator*(const QPoint &p, int factor) noexcept + { return QPoint(p.xp * factor, p.yp * factor); } + friend constexpr inline QPoint operator*(float factor, const QPoint &p) + { return QPoint(qRound(p.xp * factor), qRound(p.yp * factor)); } + friend constexpr inline QPoint operator*(double factor, const QPoint &p) + { return QPoint(qRound(p.xp * factor), qRound(p.yp * factor)); } + friend constexpr inline QPoint operator*(int factor, const QPoint &p) noexcept + { return QPoint(p.xp * factor, p.yp * factor); } + friend constexpr inline QPoint operator+(const QPoint &p) noexcept + { return p; } + friend constexpr inline QPoint operator-(const QPoint &p) noexcept + { return QPoint(-p.xp, -p.yp); } + friend constexpr inline QPoint operator/(const QPoint &p, qreal c) + { return QPoint(qRound(p.xp / c), qRound(p.yp / c)); } + +public: +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) + [[nodiscard]] Q_CORE_EXPORT CGPoint toCGPoint() const noexcept; +#endif + [[nodiscard]] constexpr inline QPointF toPointF() const noexcept; + +private: + friend class QTransform; + int xp; + int yp; + + template = true, + std::enable_if_t, QPoint>, bool> = true> + friend constexpr decltype(auto) get(P &&p) noexcept + { + if constexpr (I == 0) + return q23::forward_like

(p.xp); + else if constexpr (I == 1) + return q23::forward_like

(p.yp); + } +}; + +Q_DECLARE_TYPEINFO(QPoint, Q_PRIMITIVE_TYPE); + +/***************************************************************************** + QPoint stream functions + *****************************************************************************/ +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QPoint &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QPoint &); +#endif + +/***************************************************************************** + QPoint inline functions + *****************************************************************************/ + +constexpr inline QPoint::QPoint() noexcept : xp(0), yp(0) {} + +constexpr inline QPoint::QPoint(int xpos, int ypos) noexcept : xp(xpos), yp(ypos) {} + +constexpr inline bool QPoint::isNull() const noexcept +{ + return xp == 0 && yp == 0; +} + +constexpr inline int QPoint::x() const noexcept +{ + return xp; +} + +constexpr inline int QPoint::y() const noexcept +{ + return yp; +} + +constexpr inline void QPoint::setX(int xpos) noexcept +{ + xp = xpos; +} + +constexpr inline void QPoint::setY(int ypos) noexcept +{ + yp = ypos; +} + +inline int constexpr QPoint::manhattanLength() const +{ + return qAbs(x()) + qAbs(y()); +} + +constexpr inline int &QPoint::rx() noexcept +{ + return xp; +} + +constexpr inline int &QPoint::ry() noexcept +{ + return yp; +} + +constexpr inline QPoint &QPoint::operator+=(const QPoint &p) +{ + xp += p.xp; + yp += p.yp; + return *this; +} + +constexpr inline QPoint &QPoint::operator-=(const QPoint &p) +{ + xp -= p.xp; + yp -= p.yp; + return *this; +} + +constexpr inline QPoint &QPoint::operator*=(float factor) +{ + xp = qRound(xp * factor); + yp = qRound(yp * factor); + return *this; +} + +constexpr inline QPoint &QPoint::operator*=(double factor) +{ + xp = qRound(xp * factor); + yp = qRound(yp * factor); + return *this; +} + +constexpr inline QPoint &QPoint::operator*=(int factor) +{ + xp = xp * factor; + yp = yp * factor; + return *this; +} + +constexpr inline QPoint &QPoint::operator/=(qreal c) +{ + xp = qRound(xp / c); + yp = qRound(yp / c); + return *this; +} + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QPoint &); +#endif + +Q_CORE_EXPORT size_t qHash(QPoint key, size_t seed = 0) noexcept; + + + + +class QPointF +{ +public: + constexpr QPointF() noexcept; + constexpr QPointF(const QPoint &p) noexcept; + constexpr QPointF(qreal xpos, qreal ypos) noexcept; + + constexpr inline qreal manhattanLength() const; + + inline bool isNull() const noexcept; + + constexpr inline qreal x() const noexcept; + constexpr inline qreal y() const noexcept; + constexpr inline void setX(qreal x) noexcept; + constexpr inline void setY(qreal y) noexcept; + + constexpr QPointF transposed() const noexcept { return {yp, xp}; } + + constexpr inline qreal &rx() noexcept; + constexpr inline qreal &ry() noexcept; + + constexpr inline QPointF &operator+=(const QPointF &p); + constexpr inline QPointF &operator-=(const QPointF &p); + constexpr inline QPointF &operator*=(qreal c); + constexpr inline QPointF &operator/=(qreal c); + + constexpr static inline qreal dotProduct(const QPointF &p1, const QPointF &p2) + { + return p1.xp * p2.xp + p1.yp * p2.yp; + } + +private: + QT_WARNING_PUSH + QT_WARNING_DISABLE_FLOAT_COMPARE + friend constexpr bool qFuzzyCompare(const QPointF &p1, const QPointF &p2) noexcept + { + return ((!p1.xp || !p2.xp) ? qFuzzyIsNull(p1.xp - p2.xp) : qFuzzyCompare(p1.xp, p2.xp)) + && ((!p1.yp || !p2.yp) ? qFuzzyIsNull(p1.yp - p2.yp) : qFuzzyCompare(p1.yp, p2.yp)); + } + QT_WARNING_POP + friend constexpr bool qFuzzyIsNull(const QPointF &point) noexcept + { + return qFuzzyIsNull(point.xp) && qFuzzyIsNull(point.yp); + } + friend constexpr bool comparesEqual(const QPointF &p1, const QPointF &p2) noexcept + { return qFuzzyCompare(p1, p2); } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QPointF) + friend constexpr bool comparesEqual(const QPointF &p1, const QPoint &p2) noexcept + { return comparesEqual(p1, p2.toPointF()); } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QPointF, QPoint) + friend constexpr inline QPointF operator+(const QPointF &p1, const QPointF &p2) + { return QPointF(p1.xp + p2.xp, p1.yp + p2.yp); } + friend constexpr inline QPointF operator-(const QPointF &p1, const QPointF &p2) + { return QPointF(p1.xp - p2.xp, p1.yp - p2.yp); } + friend constexpr inline QPointF operator*(const QPointF &p, qreal c) + { return QPointF(p.xp * c, p.yp * c); } + friend constexpr inline QPointF operator*(qreal c, const QPointF &p) + { return QPointF(p.xp * c, p.yp * c); } + friend constexpr inline QPointF operator+(const QPointF &p) + { return p; } + friend constexpr inline QPointF operator-(const QPointF &p) + { return QPointF(-p.xp, -p.yp); } + friend constexpr inline QPointF operator/(const QPointF &p, qreal divisor) + { + Q_ASSERT(divisor < 0 || divisor > 0); + return QPointF(p.xp / divisor, p.yp / divisor); + } + +public: + constexpr QPoint toPoint() const; + +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) + [[nodiscard]] Q_CORE_EXPORT static QPointF fromCGPoint(CGPoint point) noexcept; + [[nodiscard]] Q_CORE_EXPORT CGPoint toCGPoint() const noexcept; +#endif + +private: + friend class QTransform; + + qreal xp; + qreal yp; + + template = true, + std::enable_if_t, QPointF>, bool> = true> + friend constexpr decltype(auto) get(P &&p) noexcept + { + if constexpr (I == 0) + return q23::forward_like

(p.xp); + else if constexpr (I == 1) + return q23::forward_like

(p.yp); + } +}; + +Q_DECLARE_TYPEINFO(QPointF, Q_PRIMITIVE_TYPE); + +size_t qHash(QPointF, size_t seed = 0) = delete; + +/***************************************************************************** + QPointF stream functions + *****************************************************************************/ +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QPointF &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QPointF &); +#endif + +/***************************************************************************** + QPointF inline functions + *****************************************************************************/ + +constexpr inline QPointF::QPointF() noexcept : xp(0), yp(0) { } + +constexpr inline QPointF::QPointF(qreal xpos, qreal ypos) noexcept : xp(xpos), yp(ypos) { } + +constexpr inline QPointF::QPointF(const QPoint &p) noexcept : xp(p.x()), yp(p.y()) { } + +constexpr inline qreal QPointF::manhattanLength() const +{ + return qAbs(x()) + qAbs(y()); +} + +inline bool QPointF::isNull() const noexcept +{ + return qIsNull(xp) && qIsNull(yp); +} + +constexpr inline qreal QPointF::x() const noexcept +{ + return xp; +} + +constexpr inline qreal QPointF::y() const noexcept +{ + return yp; +} + +constexpr inline void QPointF::setX(qreal xpos) noexcept +{ + xp = xpos; +} + +constexpr inline void QPointF::setY(qreal ypos) noexcept +{ + yp = ypos; +} + +constexpr inline qreal &QPointF::rx() noexcept +{ + return xp; +} + +constexpr inline qreal &QPointF::ry() noexcept +{ + return yp; +} + +constexpr inline QPointF &QPointF::operator+=(const QPointF &p) +{ + xp += p.xp; + yp += p.yp; + return *this; +} + +constexpr inline QPointF &QPointF::operator-=(const QPointF &p) +{ + xp -= p.xp; + yp -= p.yp; + return *this; +} + +constexpr inline QPointF &QPointF::operator*=(qreal c) +{ + xp *= c; + yp *= c; + return *this; +} + +constexpr inline QPointF &QPointF::operator/=(qreal divisor) +{ + Q_ASSERT(divisor > 0 || divisor < 0); + xp /= divisor; + yp /= divisor; + return *this; +} + +constexpr QPointF QPoint::toPointF() const noexcept { return *this; } + +constexpr inline QPoint QPointF::toPoint() const +{ + return QPoint(qRound(xp), qRound(yp)); +} + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug d, const QPointF &p); +#endif + +QT_END_NAMESPACE + +/***************************************************************************** + QPoint/QPointF tuple protocol + *****************************************************************************/ + +namespace std { + template <> + class tuple_size : public integral_constant {}; + template <> + class tuple_element<0, QT_PREPEND_NAMESPACE(QPoint)> { public: using type = int; }; + template <> + class tuple_element<1, QT_PREPEND_NAMESPACE(QPoint)> { public: using type = int; }; + + template <> + class tuple_size : public integral_constant {}; + template <> + class tuple_element<0, QT_PREPEND_NAMESPACE(QPointF)> { public: using type = QT_PREPEND_NAMESPACE(qreal); }; + template <> + class tuple_element<1, QT_PREPEND_NAMESPACE(QPointF)> { public: using type = QT_PREPEND_NAMESPACE(qreal); }; +} + +#endif // QPOINT_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qpointer.h b/qt/6.8.1/msvc2022_64/include/QtCore/qpointer.h new file mode 100644 index 0000000000000000000000000000000000000000..935d9e926a0161c35607026ff42dc7be778b33f8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qpointer.h @@ -0,0 +1,124 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QPOINTER_H +#define QPOINTER_H + +#include +#include +#include + +#ifndef QT_NO_QOBJECT + +QT_BEGIN_NAMESPACE + +class QVariant; + +template +class QPointer +{ + static_assert(!std::is_pointer::value, "QPointer's template type must not be a pointer type"); + + template + using if_convertible = std::enable_if_t, bool>; + template + friend class QPointer; + + using QObjectType = + typename std::conditional::value, const QObject, QObject>::type; + QWeakPointer wp; +public: + Q_NODISCARD_CTOR + QPointer() noexcept = default; + Q_NODISCARD_CTOR + constexpr QPointer(std::nullptr_t) noexcept : QPointer{} {} + Q_WEAK_OVERLOAD + Q_NODISCARD_CTOR + inline QPointer(T *p) : wp(p, true) { } + // compiler-generated copy/move ctor/assignment operators are fine! + // compiler-generated dtor is fine! + + template = true> + Q_NODISCARD_CTOR + QPointer(QPointer &&other) noexcept + : wp(std::exchange(other.wp, nullptr).internalData(), true) {} + template = true> + Q_NODISCARD_CTOR + QPointer(const QPointer &other) noexcept + : wp(other.wp.internalData(), true) {} + + template = true> + QPointer &operator=(const QPointer &other) noexcept + { + QPointer(other).swap(*this); + return *this; + } + + template = true> + QPointer &operator=(QPointer &&other) noexcept + { + QPointer(std::move(other)).swap(*this); + return *this; + } + +#ifdef Q_QDOC + // Stop qdoc from complaining about missing function + ~QPointer(); +#endif + + inline void swap(QPointer &other) noexcept { wp.swap(other.wp); } + + inline QPointer &operator=(T* p) + { wp.assign(static_cast(p)); return *this; } + + T* data() const noexcept + { return static_cast(wp.internalData()); } + T* get() const noexcept + { return data(); } + T* operator->() const noexcept + { return data(); } + T& operator*() const noexcept + { return *data(); } + operator T*() const noexcept + { return data(); } + + bool isNull() const noexcept + { return wp.isNull(); } + + void clear() noexcept + { wp.clear(); } + + friend void swap(QPointer &lhs, QPointer &rhs) noexcept + { lhs.swap(rhs); } + +private: + template + friend bool comparesEqual(const QPointer &lhs, const QPointer &rhs) noexcept + { return lhs.data() == rhs.data(); } + QT_DECLARE_EQUALITY_OPERATORS_HELPER(QPointer, QPointer, /* non-constexpr */, + noexcept(true), template ) + + template + friend bool comparesEqual(const QPointer &lhs, X *rhs) noexcept + { return lhs.data() == rhs; } + Q_DECLARE_EQUALITY_COMPARABLE(QPointer, X*, template ) + + friend bool comparesEqual(const QPointer &lhs, std::nullptr_t) noexcept + { return lhs.data() == nullptr; } + Q_DECLARE_EQUALITY_COMPARABLE(QPointer, std::nullptr_t) +}; +template Q_DECLARE_TYPEINFO_BODY(QPointer, Q_RELOCATABLE_TYPE); + +template +QPointer +qPointerFromVariant(const QVariant &variant) +{ + const auto wp = QtSharedPointer::weakPointerFromVariant_internal(variant); + return QPointer{qobject_cast(QtPrivate::EnableInternalData::internalData(wp))}; +} + +QT_END_NAMESPACE + +#endif // QT_NO_QOBJECT + +#endif // QPOINTER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qprocess.h b/qt/6.8.1/msvc2022_64/include/QtCore/qprocess.h new file mode 100644 index 0000000000000000000000000000000000000000..48cda337c122fda2365e0f2b0ae47c5c2a1e7a2d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qprocess.h @@ -0,0 +1,297 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2023 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QPROCESS_H +#define QPROCESS_H + +#include +#include +#include +#include + +#include + +QT_REQUIRE_CONFIG(processenvironment); + +#if defined(Q_OS_WIN) || defined(Q_QDOC) +struct _PROCESS_INFORMATION; +struct _SECURITY_ATTRIBUTES; +struct _STARTUPINFOW; +using Q_PROCESS_INFORMATION = _PROCESS_INFORMATION; +using Q_SECURITY_ATTRIBUTES = _SECURITY_ATTRIBUTES; +using Q_STARTUPINFO = _STARTUPINFOW; +#endif + +QT_BEGIN_NAMESPACE + +class QProcessPrivate; +class QProcessEnvironmentPrivate; + +class Q_CORE_EXPORT QProcessEnvironment +{ +public: + enum Initialization { InheritFromParent }; + + QProcessEnvironment(); + QProcessEnvironment(Initialization) noexcept; + QProcessEnvironment(const QProcessEnvironment &other); + ~QProcessEnvironment(); + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QProcessEnvironment) + QProcessEnvironment &operator=(const QProcessEnvironment &other); + + void swap(QProcessEnvironment &other) noexcept { d.swap(other.d); } + +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator==(const QProcessEnvironment &other) const; + inline bool operator!=(const QProcessEnvironment &other) const + { return !operator==(other); } +#endif + + bool isEmpty() const; + [[nodiscard]] bool inheritsFromParent() const; + void clear(); + + bool contains(const QString &name) const; + void insert(const QString &name, const QString &value); + void remove(const QString &name); + QString value(const QString &name, const QString &defaultValue = QString()) const; + + QStringList toStringList() const; + + QStringList keys() const; + + void insert(const QProcessEnvironment &e); + + static QProcessEnvironment systemEnvironment(); + +private: + friend Q_CORE_EXPORT bool comparesEqual(const QProcessEnvironment &lhs, + const QProcessEnvironment &rhs); + Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QProcessEnvironment) + friend class QProcessPrivate; + friend class QProcessEnvironmentPrivate; + QSharedDataPointer d; +}; + +Q_DECLARE_SHARED(QProcessEnvironment) + +#if QT_CONFIG(process) + +class Q_CORE_EXPORT QProcess : public QIODevice +{ + Q_OBJECT +public: + enum ProcessError { + FailedToStart, + Crashed, + Timedout, + ReadError, + WriteError, + UnknownError + }; + Q_ENUM(ProcessError) + + enum ProcessState { + NotRunning, + Starting, + Running + }; + Q_ENUM(ProcessState) + + enum ProcessChannel { + StandardOutput, + StandardError + }; + Q_ENUM(ProcessChannel) + + enum ProcessChannelMode { + SeparateChannels, + MergedChannels, + ForwardedChannels, + ForwardedOutputChannel, + ForwardedErrorChannel + }; + Q_ENUM(ProcessChannelMode) + + enum InputChannelMode { + ManagedInputChannel, + ForwardedInputChannel + }; + Q_ENUM(InputChannelMode) + + enum ExitStatus { + NormalExit, + CrashExit + }; + Q_ENUM(ExitStatus) + + explicit QProcess(QObject *parent = nullptr); + virtual ~QProcess(); + + void start(const QString &program, const QStringList &arguments = {}, OpenMode mode = ReadWrite); + void start(OpenMode mode = ReadWrite); + void startCommand(const QString &command, OpenMode mode = ReadWrite); + bool startDetached(qint64 *pid = nullptr); + bool open(OpenMode mode = ReadWrite) override; + + QString program() const; + void setProgram(const QString &program); + + QStringList arguments() const; + void setArguments(const QStringList & arguments); + + ProcessChannelMode processChannelMode() const; + void setProcessChannelMode(ProcessChannelMode mode); + InputChannelMode inputChannelMode() const; + void setInputChannelMode(InputChannelMode mode); + + ProcessChannel readChannel() const; + void setReadChannel(ProcessChannel channel); + + void closeReadChannel(ProcessChannel channel); + void closeWriteChannel(); + + void setStandardInputFile(const QString &fileName); + void setStandardOutputFile(const QString &fileName, OpenMode mode = Truncate); + void setStandardErrorFile(const QString &fileName, OpenMode mode = Truncate); + void setStandardOutputProcess(QProcess *destination); + +#if defined(Q_OS_WIN) || defined(Q_QDOC) + QString nativeArguments() const; + void setNativeArguments(const QString &arguments); + struct CreateProcessArguments + { + const wchar_t *applicationName; + wchar_t *arguments; + Q_SECURITY_ATTRIBUTES *processAttributes; + Q_SECURITY_ATTRIBUTES *threadAttributes; + bool inheritHandles; + unsigned long flags; + void *environment; + const wchar_t *currentDirectory; + Q_STARTUPINFO *startupInfo; + Q_PROCESS_INFORMATION *processInformation; + }; + typedef std::function CreateProcessArgumentModifier; + CreateProcessArgumentModifier createProcessArgumentsModifier() const; + void setCreateProcessArgumentsModifier(CreateProcessArgumentModifier modifier); +#endif // Q_OS_WIN || Q_QDOC +#if defined(Q_OS_UNIX) || defined(Q_QDOC) + std::function childProcessModifier() const; + void setChildProcessModifier(const std::function &modifier); + Q_NORETURN void failChildProcessModifier(const char *description, int error = 0) noexcept; + + enum class UnixProcessFlag : quint32 { + ResetSignalHandlers = 0x0001, // like POSIX_SPAWN_SETSIGDEF + IgnoreSigPipe = 0x0002, + // some room if we want to add IgnoreSigHup or so + CloseFileDescriptors = 0x0010, + UseVFork = 0x0020, // like POSIX_SPAWN_USEVFORK + CreateNewSession = 0x0040, // like POSIX_SPAWN_SETSID + DisconnectControllingTerminal = 0x0080, + ResetIds = 0x0100, // like POSIX_SPAWN_RESETIDS + }; + Q_DECLARE_FLAGS(UnixProcessFlags, UnixProcessFlag) + struct UnixProcessParameters + { + UnixProcessFlags flags = {}; + int lowestFileDescriptorToClose = 0; + + quint32 _reserved[6] {}; + }; + UnixProcessParameters unixProcessParameters() const noexcept; + void setUnixProcessParameters(const UnixProcessParameters ¶ms); + void setUnixProcessParameters(UnixProcessFlags flagsOnly); +#endif + + QString workingDirectory() const; + void setWorkingDirectory(const QString &dir); + + void setEnvironment(const QStringList &environment); + QStringList environment() const; + void setProcessEnvironment(const QProcessEnvironment &environment); + QProcessEnvironment processEnvironment() const; + + QProcess::ProcessError error() const; + QProcess::ProcessState state() const; + + qint64 processId() const; + + bool waitForStarted(int msecs = 30000); + bool waitForReadyRead(int msecs = 30000) override; + bool waitForBytesWritten(int msecs = 30000) override; + bool waitForFinished(int msecs = 30000); + + QByteArray readAllStandardOutput(); + QByteArray readAllStandardError(); + + int exitCode() const; + QProcess::ExitStatus exitStatus() const; + + // QIODevice + qint64 bytesToWrite() const override; + bool isSequential() const override; + void close() override; + + static int execute(const QString &program, const QStringList &arguments = {}); + static bool startDetached(const QString &program, const QStringList &arguments = {}, + const QString &workingDirectory = QString(), qint64 *pid = nullptr); + + static QStringList systemEnvironment(); + + static QString nullDevice(); + + static QStringList splitCommand(QStringView command); + +public Q_SLOTS: + void terminate(); + void kill(); + +Q_SIGNALS: + void started(QPrivateSignal); + void finished(int exitCode, QProcess::ExitStatus exitStatus = NormalExit); + void errorOccurred(QProcess::ProcessError error); + void stateChanged(QProcess::ProcessState state, QPrivateSignal); + + void readyReadStandardOutput(QPrivateSignal); + void readyReadStandardError(QPrivateSignal); + +protected: + void setProcessState(ProcessState state); + + // QIODevice + qint64 readData(char *data, qint64 maxlen) override; + qint64 writeData(const char *data, qint64 len) override; + +private: + Q_DECLARE_PRIVATE(QProcess) + Q_DISABLE_COPY(QProcess) + +#if QT_VERSION < QT_VERSION_CHECK(7,0,0) + // ### Qt7: Remove this struct and the virtual function; they're here only + // to cause build errors in Qt 5 code that wasn't updated to Qt 6's + // setChildProcessModifier() + struct Use_setChildProcessModifier_Instead {}; + QT_DEPRECATED_X("Use setChildProcessModifier() instead") + virtual Use_setChildProcessModifier_Instead setupChildProcess(); +#endif + + Q_PRIVATE_SLOT(d_func(), bool _q_canReadStandardOutput()) + Q_PRIVATE_SLOT(d_func(), bool _q_canReadStandardError()) +#ifdef Q_OS_UNIX + Q_PRIVATE_SLOT(d_func(), bool _q_canWrite()) +#endif + Q_PRIVATE_SLOT(d_func(), bool _q_startupNotification()) + Q_PRIVATE_SLOT(d_func(), void _q_processDied()) +}; + +#ifdef Q_OS_UNIX +Q_DECLARE_OPERATORS_FOR_FLAGS(QProcess::UnixProcessFlags) +#endif + +#endif // QT_CONFIG(process) + +QT_END_NAMESPACE + +#endif // QPROCESS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qprocessordetection.h b/qt/6.8.1/msvc2022_64/include/QtCore/qprocessordetection.h new file mode 100644 index 0000000000000000000000000000000000000000..a29f1687cf0ee4b8d3fa7eb083e7a759dadc7428 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qprocessordetection.h @@ -0,0 +1,406 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + + +#if 0 +#pragma qt_class(QtProcessorDetection) +#pragma qt_sync_skip_header_check +#pragma qt_sync_stop_processing +#endif + +#ifndef QPROCESSORDETECTION_H +#define QPROCESSORDETECTION_H + +/* + This file uses preprocessor #defines to set various Q_PROCESSOR_* #defines + based on the following patterns: + + Q_PROCESSOR_{FAMILY} + Q_PROCESSOR_{FAMILY}_{VARIANT} + Q_PROCESSOR_{FAMILY}_{REVISION} + + The first is always defined. Defines for the various revisions/variants are + optional and usually dependent on how the compiler was invoked. Variants + that are a superset of another should have a define for the superset. + + In addition to the processor family, variants, and revisions, we also set + Q_BYTE_ORDER appropriately for the target processor. For bi-endian + processors, we try to auto-detect the byte order using the __BIG_ENDIAN__, + __LITTLE_ENDIAN__, or __BYTE_ORDER__ preprocessor macros. + + Note: when adding support for new processors, be sure to update + config.tests/arch/arch.cpp to ensure that configure can detect the target + and host architectures. +*/ + +/* Machine byte-order, reuse preprocessor provided macros when available */ +#if defined(__ORDER_BIG_ENDIAN__) +# define Q_BIG_ENDIAN __ORDER_BIG_ENDIAN__ +#else +# define Q_BIG_ENDIAN 4321 +#endif +#if defined(__ORDER_LITTLE_ENDIAN__) +# define Q_LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__ +#else +# define Q_LITTLE_ENDIAN 1234 +#endif + +/* + Alpha family, no revisions or variants + + Alpha is bi-endian, use endianness auto-detection implemented below. +*/ +#if defined(__alpha__) || defined(_M_ALPHA) +# define Q_PROCESSOR_ALPHA +// Q_BYTE_ORDER not defined, use endianness auto-detection + +/* + ARM family, known revisions: V5, V6, V7, V8 + + ARM is bi-endian, detect using __ARMEL__ or __ARMEB__, falling back to + auto-detection implemented below. +*/ +#elif defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(_M_ARM64) || defined(__aarch64__) || defined(__ARM64__) +# if defined(__aarch64__) || defined(__ARM64__) || defined(_M_ARM64) +# define Q_PROCESSOR_ARM_64 +# define Q_PROCESSOR_WORDSIZE 8 +# else +# define Q_PROCESSOR_ARM_32 +# endif +# if defined(__ARM_ARCH) && __ARM_ARCH > 1 +# define Q_PROCESSOR_ARM __ARM_ARCH +# elif defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM > 1 +# define Q_PROCESSOR_ARM __TARGET_ARCH_ARM +# elif defined(_M_ARM) && _M_ARM > 1 +# define Q_PROCESSOR_ARM _M_ARM +# elif defined(__ARM64_ARCH_8__) \ + || defined(__aarch64__) \ + || defined(__ARMv8__) \ + || defined(__ARMv8_A__) \ + || defined(_M_ARM64) +# define Q_PROCESSOR_ARM 8 +# elif defined(__ARM_ARCH_7__) \ + || defined(__ARM_ARCH_7A__) \ + || defined(__ARM_ARCH_7R__) \ + || defined(__ARM_ARCH_7M__) \ + || defined(__ARM_ARCH_7S__) \ + || defined(_ARM_ARCH_7) \ + || defined(__CORE_CORTEXA__) +# define Q_PROCESSOR_ARM 7 +# elif defined(__ARM_ARCH_6__) \ + || defined(__ARM_ARCH_6J__) \ + || defined(__ARM_ARCH_6T2__) \ + || defined(__ARM_ARCH_6Z__) \ + || defined(__ARM_ARCH_6K__) \ + || defined(__ARM_ARCH_6ZK__) \ + || defined(__ARM_ARCH_6M__) +# define Q_PROCESSOR_ARM 6 +# elif defined(__ARM_ARCH_5TEJ__) \ + || defined(__ARM_ARCH_5TE__) +# define Q_PROCESSOR_ARM 5 +# else +# define Q_PROCESSOR_ARM 0 +# endif +# if Q_PROCESSOR_ARM >= 8 +# define Q_PROCESSOR_ARM_V8 +# endif +# if Q_PROCESSOR_ARM >= 7 +# define Q_PROCESSOR_ARM_V7 +# endif +# if Q_PROCESSOR_ARM >= 6 +# define Q_PROCESSOR_ARM_V6 +# endif +# if Q_PROCESSOR_ARM >= 5 +# define Q_PROCESSOR_ARM_V5 +# else +# error "ARM architecture too old" +# endif +# if defined(__ARMEL__) || defined(_M_ARM64) +# define Q_BYTE_ORDER Q_LITTLE_ENDIAN +# elif defined(__ARMEB__) +# define Q_BYTE_ORDER Q_BIG_ENDIAN +# else +// Q_BYTE_ORDER not defined, use endianness auto-detection +#endif + +/* + AVR32 family, no revisions or variants + + AVR32 is big-endian. +*/ +// #elif defined(__avr32__) +// # define Q_PROCESSOR_AVR32 +// # define Q_BYTE_ORDER Q_BIG_ENDIAN + +/* + Blackfin family, no revisions or variants + + Blackfin is little-endian. +*/ +// #elif defined(__bfin__) +// # define Q_PROCESSOR_BLACKFIN +// # define Q_BYTE_ORDER Q_LITTLE_ENDIAN + +/* + PA-RISC family, no revisions or variants + + PA-RISC is big-endian. +*/ +#elif defined(__hppa__) +# define Q_PROCESSOR_HPPA +# define Q_BYTE_ORDER Q_BIG_ENDIAN + +/* + X86 family, known variants: 32- and 64-bit + + X86 is little-endian. +*/ +#elif defined(__i386) || defined(__i386__) || defined(_M_IX86) +# define Q_PROCESSOR_X86_32 +# define Q_BYTE_ORDER Q_LITTLE_ENDIAN +# define Q_PROCESSOR_WORDSIZE 4 + +/* + * We define Q_PROCESSOR_X86 == 6 for anything above a equivalent or better + * than a Pentium Pro (the processor whose architecture was called P6) or an + * Athlon. + * + * All processors since the Pentium III and the Athlon 4 have SSE support, so + * we use that to detect. That leaves the original Athlon, Pentium Pro and + * Pentium II. + */ + +# if defined(_M_IX86) +# define Q_PROCESSOR_X86 (_M_IX86/100) +# elif defined(__i686__) || defined(__athlon__) || defined(__SSE__) || defined(__pentiumpro__) +# define Q_PROCESSOR_X86 6 +# elif defined(__i586__) || defined(__k6__) || defined(__pentium__) +# define Q_PROCESSOR_X86 5 +# elif defined(__i486__) || defined(__80486__) +# define Q_PROCESSOR_X86 4 +# else +# define Q_PROCESSOR_X86 3 +# endif + +#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64) +# define Q_PROCESSOR_X86 6 +# define Q_PROCESSOR_X86_64 +# define Q_BYTE_ORDER Q_LITTLE_ENDIAN +# define Q_PROCESSOR_WORDSIZE 8 + +/* + Itanium (IA-64) family, no revisions or variants + + Itanium is bi-endian, use endianness auto-detection implemented below. +*/ +#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64) +# define Q_PROCESSOR_IA64 +# define Q_PROCESSOR_WORDSIZE 8 +// Q_BYTE_ORDER not defined, use endianness auto-detection + +/* + LoongArch family, known variants: 32- and 64-bit + + LoongArch is little-endian. +*/ +#elif defined(__loongarch__) +# define Q_PROCESSOR_LOONGARCH +# if __loongarch_grlen == 64 +# define Q_PROCESSOR_LOONGARCH_64 +# else +# define Q_PROCESSOR_LOONGARCH_32 +# endif +# define Q_BYTE_ORDER Q_LITTLE_ENDIAN + +/* + Motorola 68000 family, no revisions or variants + + M68K is big-endian. +*/ +#elif defined(__m68k__) +# define Q_PROCESSOR_M68K +# define Q_BYTE_ORDER Q_BIG_ENDIAN + +/* + MIPS family, known revisions: I, II, III, IV, 32, 64 + + MIPS is bi-endian, use endianness auto-detection implemented below. +*/ +#elif defined(__mips) || defined(__mips__) || defined(_M_MRX000) +# define Q_PROCESSOR_MIPS +# if defined(_MIPS_ARCH_MIPS1) || (defined(__mips) && __mips - 0 >= 1) +# define Q_PROCESSOR_MIPS_I +# endif +# if defined(_MIPS_ARCH_MIPS2) || (defined(__mips) && __mips - 0 >= 2) +# define Q_PROCESSOR_MIPS_II +# endif +# if defined(_MIPS_ARCH_MIPS3) || (defined(__mips) && __mips - 0 >= 3) +# define Q_PROCESSOR_MIPS_III +# endif +# if defined(_MIPS_ARCH_MIPS4) || (defined(__mips) && __mips - 0 >= 4) +# define Q_PROCESSOR_MIPS_IV +# endif +# if defined(_MIPS_ARCH_MIPS5) || (defined(__mips) && __mips - 0 >= 5) +# define Q_PROCESSOR_MIPS_V +# endif +# if defined(_MIPS_ARCH_MIPS32) || defined(__mips32) || (defined(__mips) && __mips - 0 >= 32) +# define Q_PROCESSOR_MIPS_32 +# endif +# if defined(_MIPS_ARCH_MIPS64) || defined(__mips64) +# define Q_PROCESSOR_MIPS_64 +# define Q_PROCESSOR_WORDSIZE 8 +# endif +# if defined(__MIPSEL__) +# define Q_BYTE_ORDER Q_LITTLE_ENDIAN +# elif defined(__MIPSEB__) +# define Q_BYTE_ORDER Q_BIG_ENDIAN +# else +// Q_BYTE_ORDER not defined, use endianness auto-detection +# endif + +/* + Power family, known variants: 32- and 64-bit + + There are many more known variants/revisions that we do not handle/detect. + See http://en.wikipedia.org/wiki/Power_Architecture + and http://en.wikipedia.org/wiki/File:PowerISA-evolution.svg + + Power is bi-endian, use endianness auto-detection implemented below. +*/ +#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \ + || defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \ + || defined(_M_MPPC) || defined(_M_PPC) +# define Q_PROCESSOR_POWER +# if defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__) +# define Q_PROCESSOR_POWER_64 +# define Q_PROCESSOR_WORDSIZE 8 +# else +# define Q_PROCESSOR_POWER_32 +# endif +// Q_BYTE_ORDER not defined, use endianness auto-detection + +/* + RISC-V family, known variants: 32- and 64-bit + + RISC-V is little-endian. +*/ +#elif defined(__riscv) +# define Q_PROCESSOR_RISCV +# if __riscv_xlen == 64 +# define Q_PROCESSOR_RISCV_64 +# else +# define Q_PROCESSOR_RISCV_32 +# endif +# define Q_BYTE_ORDER Q_LITTLE_ENDIAN + +/* + S390 family, known variant: S390X (64-bit) + + S390 is big-endian. +*/ +#elif defined(__s390__) +# define Q_PROCESSOR_S390 +# if defined(__s390x__) +# define Q_PROCESSOR_S390_X +# endif +# define Q_BYTE_ORDER Q_BIG_ENDIAN + +/* + SuperH family, optional revision: SH-4A + + SuperH is bi-endian, use endianness auto-detection implemented below. +*/ +// #elif defined(__sh__) +// # define Q_PROCESSOR_SH +// # if defined(__sh4a__) +// # define Q_PROCESSOR_SH_4A +// # endif +// Q_BYTE_ORDER not defined, use endianness auto-detection + +/* + SPARC family, optional revision: V9 + + SPARC is big-endian only prior to V9, while V9 is bi-endian with big-endian + as the default byte order. Assume all SPARC systems are big-endian. +*/ +#elif defined(__sparc__) +# define Q_PROCESSOR_SPARC +# if defined(__sparc_v9__) || defined(__sparcv9) +# define Q_PROCESSOR_SPARC_V9 +# endif +# if defined(__sparc64__) +# define Q_PROCESSOR_SPARC_64 +# endif +# define Q_BYTE_ORDER Q_BIG_ENDIAN + +// -- Web Assembly -- +#elif defined(__EMSCRIPTEN__) +# define Q_PROCESSOR_WASM +# define Q_BYTE_ORDER Q_LITTLE_ENDIAN +# define Q_PROCESSOR_WORDSIZE 8 +#ifdef QT_COMPILER_SUPPORTS_SSE2 +# define Q_PROCESSOR_X86 6 // enables SIMD support +# define Q_PROCESSOR_X86_64 // wasm64 +# define Q_PROCESSOR_WASM_64 +#endif + +#endif + +/* + NOTE: + GCC 4.6 added __BYTE_ORDER__, __ORDER_BIG_ENDIAN__, __ORDER_LITTLE_ENDIAN__ + and __ORDER_PDP_ENDIAN__ in SVN r165881. If you are using GCC 4.6 or newer, + this code will properly detect your target byte order; if you are not, and + the __LITTLE_ENDIAN__ or __BIG_ENDIAN__ macros are not defined, then this + code will fail to detect the target byte order. +*/ +// Some processors support either endian format, try to detect which we are using. +#if !defined(Q_BYTE_ORDER) +# if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == Q_BIG_ENDIAN || __BYTE_ORDER__ == Q_LITTLE_ENDIAN) +// Reuse __BYTE_ORDER__ as-is, since our Q_*_ENDIAN #defines match the preprocessor defaults +# define Q_BYTE_ORDER __BYTE_ORDER__ +# elif defined(__BIG_ENDIAN__) || defined(_big_endian__) || defined(_BIG_ENDIAN) +# define Q_BYTE_ORDER Q_BIG_ENDIAN +# elif defined(__LITTLE_ENDIAN__) || defined(_little_endian__) || defined(_LITTLE_ENDIAN) +# define Q_BYTE_ORDER Q_LITTLE_ENDIAN +# else +# error "Unable to determine byte order!" +# endif +#endif + +/* + Size of a pointer and the machine register size. We detect a 64-bit system by: + * GCC and compatible compilers (Clang, ICC on OS X and Windows) always define + __SIZEOF_POINTER__. This catches all known cases of ILP32 builds on 64-bit + processors. + * Most other Unix compilers define __LP64__ or _LP64 on 64-bit mode + (Long and Pointer 64-bit) + * If Q_PROCESSOR_WORDSIZE was defined above, it's assumed to match the pointer + size. + Otherwise, we assume to be 32-bit and then check in qglobal.cpp that it is right. +*/ + +#if defined __SIZEOF_POINTER__ +# define QT_POINTER_SIZE __SIZEOF_POINTER__ +#elif defined(__LP64__) || defined(_LP64) +# define QT_POINTER_SIZE 8 +#elif defined(Q_PROCESSOR_WORDSIZE) +# define QT_POINTER_SIZE Q_PROCESSOR_WORDSIZE +#else +# define QT_POINTER_SIZE 4 +#endif + +/* + Define Q_PROCESSOR_WORDSIZE to be the size of the machine's word (usually, + the size of the register). On some architectures where a pointer could be + smaller than the register, the macro is defined above. + + Falls back to QT_POINTER_SIZE if not set explicitly for the platform. +*/ +#ifndef Q_PROCESSOR_WORDSIZE +# define Q_PROCESSOR_WORDSIZE QT_POINTER_SIZE +#endif + + +#endif // QPROCESSORDETECTION_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qpromise.h b/qt/6.8.1/msvc2022_64/include/QtCore/qpromise.h new file mode 100644 index 0000000000000000000000000000000000000000..4a2975a15cc61dc36c1ed735f81a31c9d8263e12 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qpromise.h @@ -0,0 +1,110 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QPROMISE_H +#define QPROMISE_H + +#include +#include + +#include + +QT_REQUIRE_CONFIG(future); + +QT_BEGIN_NAMESPACE + +namespace QtPrivate { + +template +using EnableIfSameOrConvertible = std::enable_if_t>; + +} // namespace QtPrivate + +template +class QPromise +{ + static_assert (std::is_move_constructible_v + || std::is_same_v, + "A move-constructible type or type void is required"); +public: + QPromise() = default; + Q_DISABLE_COPY(QPromise) + QPromise(QPromise &&other) = default; + QPromise(const QFutureInterface &other) : d(other) {} + QPromise(QFutureInterface &&other) noexcept : d(std::move(other)) {} + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QPromise) + ~QPromise() + { + // If computation is not finished at this point, cancel + // potential waits + if (d.d && !(d.loadState() & QFutureInterfaceBase::State::Finished)) { + d.cancelAndFinish(); // cancel and finalize the state + d.runContinuation(); + } + d.cleanContinuation(); + } + + // Core QPromise APIs + QFuture future() const { return d.future(); } + template, bool> = true> + bool emplaceResultAt(int index, Args&&...args) + { + return d.reportAndEmplaceResult(index, std::forward(args)...); + } + template, bool> = true> + bool emplaceResult(Args&&...args) + { + return d.reportAndEmplaceResult(-1, std::forward(args)...); + } + template> + bool addResult(U &&result, int index = -1) + { + return d.reportAndEmplaceResult(index, std::forward(result)); + } + bool addResults(const QList &result) + { return d.reportResults(result); } +#ifndef QT_NO_EXCEPTIONS + void setException(const QException &e) { d.reportException(e); } +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) + void setException(std::exception_ptr e) { d.reportException(e); } +#else + void setException(const std::exception_ptr &e) { d.reportException(e); } +#endif +#endif + void start() { d.reportStarted(); } + void finish() { d.reportFinished(); } + + void suspendIfRequested() { d.suspendIfRequested(); } + + bool isCanceled() const { return d.isCanceled(); } + + // Progress methods + void setProgressRange(int minimum, int maximum) { d.setProgressRange(minimum, maximum); } + void setProgressValue(int progressValue) { d.setProgressValue(progressValue); } + void setProgressValueAndText(int progressValue, const QString &progressText) + { + d.setProgressValueAndText(progressValue, progressText); + } + + void swap(QPromise &other) noexcept + { + d.swap(other.d); + } + +#if defined(Q_QDOC) // documentation-only simplified signatures + bool addResult(const T &result, int index = -1) { } + bool addResult(T &&result, int index = -1) { } +#endif +private: + mutable QFutureInterface d; +}; + +template +inline void swap(QPromise &a, QPromise &b) noexcept +{ + a.swap(b); +} + +QT_END_NAMESPACE + +#endif // QPROMISE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qproperty.h b/qt/6.8.1/msvc2022_64/include/QtCore/qproperty.h new file mode 100644 index 0000000000000000000000000000000000000000..f77858b973113a9f8305158d385c113068e4dd52 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qproperty.h @@ -0,0 +1,1368 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QPROPERTY_H +#define QPROPERTY_H + +#include +#include +#include +#include +#include + +#include + +#include + +#if __has_include() && __cplusplus >= 202002L && !defined(Q_QDOC) +#include +#if defined(__cpp_lib_source_location) +#define QT_SOURCE_LOCATION_NAMESPACE std +#define QT_PROPERTY_COLLECT_BINDING_LOCATION +#if defined(Q_CC_MSVC) +/* MSVC runs into an issue with constexpr with source location (error C7595) + so use the factory function as a workaround */ +# define QT_PROPERTY_DEFAULT_BINDING_LOCATION QPropertyBindingSourceLocation::fromStdSourceLocation(std::source_location::current()) +#else +/* some versions of gcc in turn run into + expression ‘std::source_location::current()’ is not a constant expression + so don't use the workaround there */ +# define QT_PROPERTY_DEFAULT_BINDING_LOCATION QPropertyBindingSourceLocation(std::source_location::current()) +#endif +#endif +#endif + +#if __has_include() && !defined(Q_QDOC) +#include +#if !defined(QT_PROPERTY_COLLECT_BINDING_LOCATION) +#if defined(__cpp_lib_experimental_source_location) +#define QT_SOURCE_LOCATION_NAMESPACE std::experimental +#define QT_PROPERTY_COLLECT_BINDING_LOCATION +#define QT_PROPERTY_DEFAULT_BINDING_LOCATION QPropertyBindingSourceLocation(std::experimental::source_location::current()) +#endif // defined(__cpp_lib_experimental_source_location) +#endif +#endif + +#if !defined(QT_PROPERTY_COLLECT_BINDING_LOCATION) +#define QT_PROPERTY_DEFAULT_BINDING_LOCATION QPropertyBindingSourceLocation() +#endif + +QT_BEGIN_NAMESPACE + +namespace Qt { +Q_CORE_EXPORT void beginPropertyUpdateGroup(); +Q_CORE_EXPORT void endPropertyUpdateGroup(); +} + +class QScopedPropertyUpdateGroup +{ + Q_DISABLE_COPY_MOVE(QScopedPropertyUpdateGroup) +public: + Q_NODISCARD_CTOR + QScopedPropertyUpdateGroup() + { Qt::beginPropertyUpdateGroup(); } + ~QScopedPropertyUpdateGroup() noexcept(false) + { Qt::endPropertyUpdateGroup(); } +}; + +template +class QPropertyData : public QUntypedPropertyData +{ +protected: + mutable T val = T(); +private: + class DisableRValueRefs {}; +protected: + static constexpr bool UseReferences = !(std::is_arithmetic_v || std::is_enum_v || std::is_pointer_v); +public: + using value_type = T; + using parameter_type = std::conditional_t; + using rvalue_ref = typename std::conditional_t; + using arrow_operator_result = std::conditional_t, const T &, + std::conditional_t, const T &, void>>; + + QPropertyData() = default; + QPropertyData(parameter_type t) : val(t) {} + QPropertyData(rvalue_ref t) : val(std::move(t)) {} + ~QPropertyData() = default; + + parameter_type valueBypassingBindings() const { return val; } + void setValueBypassingBindings(parameter_type v) { val = v; } + void setValueBypassingBindings(rvalue_ref v) { val = std::move(v); } +}; + +// ### Qt 7: un-export +struct Q_CORE_EXPORT QPropertyBindingSourceLocation +{ + const char *fileName = nullptr; + const char *functionName = nullptr; + quint32 line = 0; + quint32 column = 0; + QPropertyBindingSourceLocation() = default; +#ifdef __cpp_lib_source_location + constexpr QPropertyBindingSourceLocation(const std::source_location &cppLocation) + { + fileName = cppLocation.file_name(); + functionName = cppLocation.function_name(); + line = cppLocation.line(); + column = cppLocation.column(); + } + QT_POST_CXX17_API_IN_EXPORTED_CLASS + static consteval QPropertyBindingSourceLocation + fromStdSourceLocation(const std::source_location &cppLocation) + { + return cppLocation; + } +#endif +#ifdef __cpp_lib_experimental_source_location + constexpr QPropertyBindingSourceLocation(const std::experimental::source_location &cppLocation) + { + fileName = cppLocation.file_name(); + functionName = cppLocation.function_name(); + line = cppLocation.line(); + column = cppLocation.column(); + } +#endif +}; + +template class QPropertyChangeHandler; +class QPropertyBindingErrorPrivate; + +class Q_CORE_EXPORT QPropertyBindingError +{ +public: + enum Type { + NoError, + BindingLoop, + EvaluationError, + UnknownError + }; + + QPropertyBindingError(); + QPropertyBindingError(Type type, const QString &description = QString()); + + QPropertyBindingError(const QPropertyBindingError &other); + QPropertyBindingError &operator=(const QPropertyBindingError &other); + QPropertyBindingError(QPropertyBindingError &&other); + QPropertyBindingError &operator=(QPropertyBindingError &&other); + ~QPropertyBindingError(); + + bool hasError() const { return d.get() != nullptr; } + Type type() const; + QString description() const; + +private: + QSharedDataPointer d; +}; + +class Q_CORE_EXPORT QUntypedPropertyBinding +{ +public: + // writes binding result into dataPtr + using BindingFunctionVTable = QtPrivate::BindingFunctionVTable; + + QUntypedPropertyBinding(); + QUntypedPropertyBinding(QMetaType metaType, const BindingFunctionVTable *vtable, void *function, const QPropertyBindingSourceLocation &location); + + template + QUntypedPropertyBinding(QMetaType metaType, Functor &&f, const QPropertyBindingSourceLocation &location) + : QUntypedPropertyBinding(metaType, &QtPrivate::bindingFunctionVTable>, &f, location) + {} + + QUntypedPropertyBinding(QUntypedPropertyBinding &&other); + QUntypedPropertyBinding(const QUntypedPropertyBinding &other); + QUntypedPropertyBinding &operator=(const QUntypedPropertyBinding &other); + QUntypedPropertyBinding &operator=(QUntypedPropertyBinding &&other); + ~QUntypedPropertyBinding(); + + bool isNull() const; + + QPropertyBindingError error() const; + + QMetaType valueMetaType() const; + + explicit QUntypedPropertyBinding(QPropertyBindingPrivate *priv); +private: + friend class QtPrivate::QPropertyBindingData; + friend class QPropertyBindingPrivate; + template friend class QPropertyBinding; + QPropertyBindingPrivatePtr d; +}; + +template +class QPropertyBinding : public QUntypedPropertyBinding +{ + +public: + QPropertyBinding() = default; + + template + QPropertyBinding(Functor &&f, const QPropertyBindingSourceLocation &location) + : QUntypedPropertyBinding(QMetaType::fromType(), &QtPrivate::bindingFunctionVTable, PropertyType>, &f, location) + {} + + + // Internal + explicit QPropertyBinding(const QUntypedPropertyBinding &binding) + : QUntypedPropertyBinding(binding) + {} +}; + +namespace Qt { + template + auto makePropertyBinding(Functor &&f, const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION, + std::enable_if_t> * = nullptr) + { + return QPropertyBinding>(std::forward(f), location); + } +} + +struct QPropertyObserverPrivate; +struct QPropertyObserverPointer; +class QPropertyObserver; + +class QPropertyObserverBase +{ +public: + // Internal + enum ObserverTag { + ObserverNotifiesBinding, // observer was installed to notify bindings that obsverved property changed + ObserverNotifiesChangeHandler, // observer is a change handler, which runs on every change + ObserverIsPlaceholder, // the observer before this one is currently evaluated in QPropertyObserver::notifyObservers. +#if QT_DEPRECATED_SINCE(6, 6) + ObserverIsAlias QT_DEPRECATED_VERSION_X_6_6("Use QProperty and add a binding to the target.") +#endif + }; +protected: + using ChangeHandler = void (*)(QPropertyObserver*, QUntypedPropertyData *); + +private: + friend struct QPropertyDelayedNotifications; + friend struct QPropertyObserverNodeProtector; + friend class QPropertyObserver; + friend struct QPropertyObserverPointer; + friend struct QPropertyBindingDataPointer; + friend class QPropertyBindingPrivate; + + QTaggedPointer next; + // prev is a pointer to the "next" element within the previous node, or to the "firstObserverPtr" if it is the + // first node. + QtPrivate::QTagPreservingPointerToPointer prev; + + union { + QPropertyBindingPrivate *binding = nullptr; + ChangeHandler changeHandler; + QUntypedPropertyData *aliasData; + }; +}; + +class Q_CORE_EXPORT QPropertyObserver : public QPropertyObserverBase +{ +public: + constexpr QPropertyObserver() = default; + QPropertyObserver(QPropertyObserver &&other) noexcept; + QPropertyObserver &operator=(QPropertyObserver &&other) noexcept; + ~QPropertyObserver(); + + template = true> + void setSource(const Property &property) + { setSource(property.bindingData()); } + void setSource(const QtPrivate::QPropertyBindingData &property); + +protected: + QPropertyObserver(ChangeHandler changeHandler); +#if QT_DEPRECATED_SINCE(6, 6) + QT_DEPRECATED_VERSION_X_6_6("This constructor was only meant for internal use. Use QProperty and add a binding to the target.") + QPropertyObserver(QUntypedPropertyData *aliasedPropertyPtr); +#endif + + QUntypedPropertyData *aliasedProperty() const + { + return aliasData; + } + +private: + + QPropertyObserver(const QPropertyObserver &) = delete; + QPropertyObserver &operator=(const QPropertyObserver &) = delete; + +}; + +template +class QPropertyChangeHandler : public QPropertyObserver +{ + Functor m_handler; +public: + Q_NODISCARD_CTOR + QPropertyChangeHandler(Functor handler) + : QPropertyObserver([](QPropertyObserver *self, QUntypedPropertyData *) { + auto This = static_cast*>(self); + This->m_handler(); + }) + , m_handler(handler) + { + } + + template = true> + Q_NODISCARD_CTOR + QPropertyChangeHandler(const Property &property, Functor handler) + : QPropertyObserver([](QPropertyObserver *self, QUntypedPropertyData *) { + auto This = static_cast*>(self); + This->m_handler(); + }) + , m_handler(handler) + { + setSource(property); + } +}; + +class QPropertyNotifier : public QPropertyObserver +{ + std::function m_handler; +public: + Q_NODISCARD_CTOR + QPropertyNotifier() = default; + template + Q_NODISCARD_CTOR + QPropertyNotifier(Functor handler) + : QPropertyObserver([](QPropertyObserver *self, QUntypedPropertyData *) { + auto This = static_cast(self); + This->m_handler(); + }) + , m_handler(handler) + { + } + + template = true> + Q_NODISCARD_CTOR + QPropertyNotifier(const Property &property, Functor handler) + : QPropertyObserver([](QPropertyObserver *self, QUntypedPropertyData *) { + auto This = static_cast(self); + This->m_handler(); + }) + , m_handler(handler) + { + setSource(property); + } +}; + +template +class QProperty : public QPropertyData +{ + QtPrivate::QPropertyBindingData d; + bool is_equal(const T &v) + { + if constexpr (QTypeTraits::has_operator_equal_v) { + if (v == this->val) + return true; + } + return false; + } + +public: + using value_type = typename QPropertyData::value_type; + using parameter_type = typename QPropertyData::parameter_type; + using rvalue_ref = typename QPropertyData::rvalue_ref; + using arrow_operator_result = typename QPropertyData::arrow_operator_result; + + QProperty() = default; + explicit QProperty(parameter_type initialValue) : QPropertyData(initialValue) {} + explicit QProperty(rvalue_ref initialValue) : QPropertyData(std::move(initialValue)) {} + explicit QProperty(const QPropertyBinding &binding) + : QProperty() + { setBinding(binding); } +#ifndef Q_QDOC + template + explicit QProperty(Functor &&f, const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION, + typename std::enable_if_t> * = nullptr) + : QProperty(QPropertyBinding(std::forward(f), location)) + {} +#else + template + explicit QProperty(Functor &&f); +#endif + ~QProperty() = default; + + parameter_type value() const + { + d.registerWithCurrentlyEvaluatingBinding(); + return this->val; + } + + arrow_operator_result operator->() const + { + if constexpr (QTypeTraits::is_dereferenceable_v) { + return value(); + } else if constexpr (std::is_pointer_v) { + value(); + return this->val; + } else { + return; + } + } + + parameter_type operator*() const + { + return value(); + } + + operator parameter_type() const + { + return value(); + } + + void setValue(rvalue_ref newValue) + { + d.removeBinding(); + if (is_equal(newValue)) + return; + this->val = std::move(newValue); + notify(); + } + + void setValue(parameter_type newValue) + { + d.removeBinding(); + if (is_equal(newValue)) + return; + this->val = newValue; + notify(); + } + + QProperty &operator=(rvalue_ref newValue) + { + setValue(std::move(newValue)); + return *this; + } + + QProperty &operator=(parameter_type newValue) + { + setValue(newValue); + return *this; + } + + QPropertyBinding setBinding(const QPropertyBinding &newBinding) + { + return QPropertyBinding(d.setBinding(newBinding, this)); + } + + bool setBinding(const QUntypedPropertyBinding &newBinding) + { + if (!newBinding.isNull() && newBinding.valueMetaType().id() != qMetaTypeId()) + return false; + setBinding(static_cast &>(newBinding)); + return true; + } + +#ifndef Q_QDOC + template + QPropertyBinding setBinding(Functor &&f, + const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION, + std::enable_if_t> * = nullptr) + { + return setBinding(Qt::makePropertyBinding(std::forward(f), location)); + } +#else + template + QPropertyBinding setBinding(Functor f); +#endif + + bool hasBinding() const { return d.hasBinding(); } + + QPropertyBinding binding() const + { + return QPropertyBinding(QUntypedPropertyBinding(d.binding())); + } + + QPropertyBinding takeBinding() + { + return QPropertyBinding(d.setBinding(QUntypedPropertyBinding(), this)); + } + + template + QPropertyChangeHandler onValueChanged(Functor f) + { + static_assert(std::is_invocable_v, "Functor callback must be callable without any parameters"); + return QPropertyChangeHandler(*this, f); + } + + template + QPropertyChangeHandler subscribe(Functor f) + { + static_assert(std::is_invocable_v, "Functor callback must be callable without any parameters"); + f(); + return onValueChanged(f); + } + + template + QPropertyNotifier addNotifier(Functor f) + { + static_assert(std::is_invocable_v, "Functor callback must be callable without any parameters"); + return QPropertyNotifier(*this, f); + } + + const QtPrivate::QPropertyBindingData &bindingData() const { return d; } +private: + void notify() + { + d.notifyObservers(this); + } + + Q_DISABLE_COPY_MOVE(QProperty) +}; + +namespace Qt { + template + QPropertyBinding makePropertyBinding(const QProperty &otherProperty, + const QPropertyBindingSourceLocation &location = + QT_PROPERTY_DEFAULT_BINDING_LOCATION) + { + return Qt::makePropertyBinding([&otherProperty]() -> PropertyType { return otherProperty; }, location); + } +} + + +namespace QtPrivate +{ + +struct QBindableInterface +{ + using Getter = void (*)(const QUntypedPropertyData *d, void *value); + using Setter = void (*)(QUntypedPropertyData *d, const void *value); + using BindingGetter = QUntypedPropertyBinding (*)(const QUntypedPropertyData *d); + using BindingSetter = QUntypedPropertyBinding (*)(QUntypedPropertyData *d, const QUntypedPropertyBinding &binding); + using MakeBinding = QUntypedPropertyBinding (*)(const QUntypedPropertyData *d, const QPropertyBindingSourceLocation &location); + using SetObserver = void (*)(const QUntypedPropertyData *d, QPropertyObserver *observer); + using GetMetaType = QMetaType (*)(); + Getter getter; + Setter setter; + BindingGetter getBinding; + BindingSetter setBinding; + MakeBinding makeBinding; + SetObserver setObserver; + GetMetaType metaType; + + static constexpr quintptr MetaTypeAccessorFlag = 0x1; +}; + +template +class QBindableInterfaceForProperty +{ + using T = typename Property::value_type; +public: + // interface for computed properties. Those do not have a binding()/setBinding() method, but one can + // install observers on them. + static constexpr QBindableInterface iface = { + [](const QUntypedPropertyData *d, void *value) -> void + { *static_cast(value) = static_cast(d)->value(); }, + nullptr, + nullptr, + nullptr, + [](const QUntypedPropertyData *d, const QPropertyBindingSourceLocation &location) -> QUntypedPropertyBinding + { return Qt::makePropertyBinding([d]() -> T { return static_cast(d)->value(); }, location); }, + [](const QUntypedPropertyData *d, QPropertyObserver *observer) -> void + { observer->setSource(static_cast(d)->bindingData()); }, + []() { return QMetaType::fromType(); } + }; +}; + +template +class QBindableInterfaceForProperty().binding())>> +{ + using T = typename Property::value_type; +public: + // A bindable created from a const property results in a read-only interface, too. + static constexpr QBindableInterface iface = { + + [](const QUntypedPropertyData *d, void *value) -> void + { *static_cast(value) = static_cast(d)->value(); }, + /*setter=*/nullptr, + [](const QUntypedPropertyData *d) -> QUntypedPropertyBinding + { return static_cast(d)->binding(); }, + /*setBinding=*/nullptr, + [](const QUntypedPropertyData *d, const QPropertyBindingSourceLocation &location) -> QUntypedPropertyBinding + { return Qt::makePropertyBinding([d]() -> T { return static_cast(d)->value(); }, location); }, + [](const QUntypedPropertyData *d, QPropertyObserver *observer) -> void + { observer->setSource(static_cast(d)->bindingData()); }, + []() { return QMetaType::fromType(); } + }; +}; + +template +class QBindableInterfaceForProperty().binding())>> +{ + using T = typename Property::value_type; +public: + static constexpr QBindableInterface iface = { + [](const QUntypedPropertyData *d, void *value) -> void + { *static_cast(value) = static_cast(d)->value(); }, + [](QUntypedPropertyData *d, const void *value) -> void + { static_cast(d)->setValue(*static_cast(value)); }, + [](const QUntypedPropertyData *d) -> QUntypedPropertyBinding + { return static_cast(d)->binding(); }, + [](QUntypedPropertyData *d, const QUntypedPropertyBinding &binding) -> QUntypedPropertyBinding + { return static_cast(d)->setBinding(static_cast &>(binding)); }, + [](const QUntypedPropertyData *d, const QPropertyBindingSourceLocation &location) -> QUntypedPropertyBinding + { return Qt::makePropertyBinding([d]() -> T { return static_cast(d)->value(); }, location); }, + [](const QUntypedPropertyData *d, QPropertyObserver *observer) -> void + { observer->setSource(static_cast(d)->bindingData()); }, + []() { return QMetaType::fromType(); } + }; +}; + +} + +namespace QtPrivate { +// used in Q(Untyped)Bindable to print warnings about various binding errors +namespace BindableWarnings { +enum Reason { InvalidInterface, NonBindableInterface, ReadOnlyInterface }; +Q_CORE_EXPORT void printUnsuitableBindableWarning(QAnyStringView prefix, Reason reason); +Q_CORE_EXPORT void printMetaTypeMismatch(QMetaType actual, QMetaType expected); +} + +namespace PropertyAdaptorSlotObjectHelpers { +Q_CORE_EXPORT void getter(const QUntypedPropertyData *d, void *value); +Q_CORE_EXPORT void setter(QUntypedPropertyData *d, const void *value); +Q_CORE_EXPORT QUntypedPropertyBinding getBinding(const QUntypedPropertyData *d); +Q_CORE_EXPORT bool bindingWrapper(QMetaType type, QUntypedPropertyData *d, + QtPrivate::QPropertyBindingFunction binding, + QUntypedPropertyData *temp, void *value); +Q_CORE_EXPORT QUntypedPropertyBinding setBinding(QUntypedPropertyData *d, + const QUntypedPropertyBinding &binding, + QPropertyBindingWrapper wrapper); +Q_CORE_EXPORT void setObserver(const QUntypedPropertyData *d, QPropertyObserver *observer); + +template +bool bindingWrapper(QMetaType type, QUntypedPropertyData *d, + QtPrivate::QPropertyBindingFunction binding) +{ + struct Data : QPropertyData + { + void *data() { return &this->val; } + } temp; + return bindingWrapper(type, d, binding, &temp, temp.data()); +} + +template +QUntypedPropertyBinding setBinding(QUntypedPropertyData *d, const QUntypedPropertyBinding &binding) +{ + return setBinding(d, binding, &bindingWrapper); +} + +template +QUntypedPropertyBinding makeBinding(const QUntypedPropertyData *d, + const QPropertyBindingSourceLocation &location) +{ + return Qt::makePropertyBinding( + [d]() -> T { + T r; + getter(d, &r); + return r; + }, + location); +} + +template +inline constexpr QBindableInterface iface = { + &getter, + &setter, + &getBinding, + &setBinding, + &makeBinding, + &setObserver, + &QMetaType::fromType, +}; +} +} + +class QUntypedBindable +{ + friend struct QUntypedBindablePrivate; // allows access to internal data +protected: + QUntypedPropertyData *data = nullptr; + const QtPrivate::QBindableInterface *iface = nullptr; + constexpr QUntypedBindable(QUntypedPropertyData *d, const QtPrivate::QBindableInterface *i) + : data(d), iface(i) + {} + + Q_CORE_EXPORT explicit QUntypedBindable(QObject* obj, const QMetaProperty &property, const QtPrivate::QBindableInterface *i); + Q_CORE_EXPORT explicit QUntypedBindable(QObject* obj, const char* property, const QtPrivate::QBindableInterface *i); + +public: + constexpr QUntypedBindable() = default; + template + QUntypedBindable(Property *p) + : data(const_cast *>(p)), + iface(&QtPrivate::QBindableInterfaceForProperty::iface) + { Q_ASSERT(data && iface); } + + bool isValid() const { return data != nullptr; } + bool isBindable() const { return iface && iface->getBinding; } + bool isReadOnly() const { return !(iface && iface->setBinding && iface->setObserver); } + + QUntypedPropertyBinding makeBinding(const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION) const + { + return iface ? iface->makeBinding(data, location) : QUntypedPropertyBinding(); + } + + QUntypedPropertyBinding takeBinding() + { + if (!iface) + return QUntypedPropertyBinding {}; + // We do not have a dedicated takeBinding function pointer in the interface + // therefore we synthesize takeBinding by retrieving the binding with binding + // and calling setBinding with a default constructed QUntypedPropertyBinding + // afterwards. + if (!(iface->getBinding && iface->setBinding)) + return QUntypedPropertyBinding {}; + QUntypedPropertyBinding binding = iface->getBinding(data); + iface->setBinding(data, QUntypedPropertyBinding{}); + return binding; + } + + void observe(QPropertyObserver *observer) const + { + if (iface) + iface->setObserver(data, observer); +#ifndef QT_NO_DEBUG + else + QtPrivate::BindableWarnings::printUnsuitableBindableWarning("observe:", + QtPrivate::BindableWarnings::InvalidInterface); +#endif + } + + template + QPropertyChangeHandler onValueChanged(Functor f) const + { + QPropertyChangeHandler handler(f); + observe(&handler); + return handler; + } + + template + QPropertyChangeHandler subscribe(Functor f) const + { + f(); + return onValueChanged(f); + } + + template + QPropertyNotifier addNotifier(Functor f) + { + QPropertyNotifier handler(f); + observe(&handler); + return handler; + } + + QUntypedPropertyBinding binding() const + { + if (!isBindable()) { +#ifndef QT_NO_DEBUG + QtPrivate::BindableWarnings::printUnsuitableBindableWarning("binding: ", + QtPrivate::BindableWarnings::NonBindableInterface); +#endif + return QUntypedPropertyBinding(); + } + return iface->getBinding(data); + } + bool setBinding(const QUntypedPropertyBinding &binding) + { + if (isReadOnly()) { +#ifndef QT_NO_DEBUG + const auto errorType = iface ? QtPrivate::BindableWarnings::ReadOnlyInterface : + QtPrivate::BindableWarnings::InvalidInterface; + QtPrivate::BindableWarnings::printUnsuitableBindableWarning("setBinding: Could not set binding via bindable interface.", errorType); +#endif + return false; + } + if (!binding.isNull() && binding.valueMetaType() != metaType()) { +#ifndef QT_NO_DEBUG + QtPrivate::BindableWarnings::printMetaTypeMismatch(metaType(), binding.valueMetaType()); +#endif + return false; + } + iface->setBinding(data, binding); + return true; + } + bool hasBinding() const + { + return !binding().isNull(); + } + + QMetaType metaType() const + { + if (!(iface && data)) + return QMetaType(); + if (iface->metaType) + return iface->metaType(); + // ### Qt 7: Change the metatype function to take data as its argument + // special casing for QML's proxy bindable: allow multiplexing in the getter + // function to retrieve the metatype from data + Q_ASSERT(iface->getter); + QMetaType result; + iface->getter(data, reinterpret_cast(quintptr(&result) | QtPrivate::QBindableInterface::MetaTypeAccessorFlag)); + return result; + } + +}; + +template +class QBindable : public QUntypedBindable +{ + template + friend class QPropertyAlias; + constexpr QBindable(QUntypedPropertyData *d, const QtPrivate::QBindableInterface *i) + : QUntypedBindable(d, i) + {} +public: + using QUntypedBindable::QUntypedBindable; + explicit QBindable(const QUntypedBindable &b) : QUntypedBindable(b) + { + if (iface && metaType() != QMetaType::fromType()) { + data = nullptr; + iface = nullptr; + } + } + + explicit QBindable(QObject *obj, const QMetaProperty &property) + : QUntypedBindable(obj, property, &QtPrivate::PropertyAdaptorSlotObjectHelpers::iface) {} + + explicit QBindable(QObject *obj, const char *property) + : QUntypedBindable(obj, property, &QtPrivate::PropertyAdaptorSlotObjectHelpers::iface) {} + + QPropertyBinding makeBinding(const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION) const + { + return static_cast &&>(QUntypedBindable::makeBinding(location)); + } + QPropertyBinding binding() const + { + return static_cast &&>(QUntypedBindable::binding()); + } + + QPropertyBinding takeBinding() + { + return static_cast &&>(QUntypedBindable::takeBinding()); + } + + using QUntypedBindable::setBinding; + QPropertyBinding setBinding(const QPropertyBinding &binding) + { + Q_ASSERT(!iface || binding.isNull() || binding.valueMetaType() == metaType()); + + if (iface && iface->setBinding) + return static_cast &&>(iface->setBinding(data, binding)); +#ifndef QT_NO_DEBUG + if (!iface) + QtPrivate::BindableWarnings::printUnsuitableBindableWarning("setBinding", QtPrivate::BindableWarnings::InvalidInterface); + else + QtPrivate::BindableWarnings::printUnsuitableBindableWarning("setBinding: Could not set binding via bindable interface.", QtPrivate::BindableWarnings::ReadOnlyInterface); +#endif + return QPropertyBinding(); + } +#ifndef Q_QDOC + template + QPropertyBinding setBinding(Functor &&f, + const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION, + std::enable_if_t> * = nullptr) + { + return setBinding(Qt::makePropertyBinding(std::forward(f), location)); + } +#else + template + QPropertyBinding setBinding(Functor f); +#endif + + T value() const + { + if (iface) { + T result; + iface->getter(data, &result); + return result; + } + return T{}; + } + + void setValue(const T &value) + { + if (iface && iface->setter) + iface->setter(data, &value); + } +}; + +#if QT_DEPRECATED_SINCE(6, 6) +template +class QT_DEPRECATED_VERSION_X_6_6("Class was only meant for internal use, use a QProperty and add a binding to the target") +QPropertyAlias : public QPropertyObserver +{ + Q_DISABLE_COPY_MOVE(QPropertyAlias) + const QtPrivate::QBindableInterface *iface = nullptr; + +public: + QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED + QPropertyAlias(QProperty *property) + : QPropertyObserver(property), + iface(&QtPrivate::QBindableInterfaceForProperty>::iface) + { + if (iface) + iface->setObserver(aliasedProperty(), this); + } + + template = true> + QPropertyAlias(Property *property) + : QPropertyObserver(property), + iface(&QtPrivate::QBindableInterfaceForProperty::iface) + { + if (iface) + iface->setObserver(aliasedProperty(), this); + } + + QPropertyAlias(QPropertyAlias *alias) + : QPropertyObserver(alias->aliasedProperty()), + iface(alias->iface) + { + if (iface) + iface->setObserver(aliasedProperty(), this); + } + + QPropertyAlias(const QBindable &property) + : QPropertyObserver(property.data), + iface(property.iface) + { + if (iface) + iface->setObserver(aliasedProperty(), this); + } + + T value() const + { + T t = T(); + if (auto *p = aliasedProperty()) + iface->getter(p, &t); + return t; + } + + operator T() const { return value(); } + + void setValue(const T &newValue) + { + if (auto *p = aliasedProperty()) + iface->setter(p, &newValue); + } + + QPropertyAlias &operator=(const T &newValue) + { + setValue(newValue); + return *this; + } + + QPropertyBinding setBinding(const QPropertyBinding &newBinding) + { + return QBindable(aliasedProperty(), iface).setBinding(newBinding); + } + + bool setBinding(const QUntypedPropertyBinding &newBinding) + { + return QBindable(aliasedProperty(), iface).setBinding(newBinding); + } + +#ifndef Q_QDOC + template + QPropertyBinding setBinding(Functor &&f, + const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION, + std::enable_if_t> * = nullptr) + { + return setBinding(Qt::makePropertyBinding(std::forward(f), location)); + } +#else + template + QPropertyBinding setBinding(Functor f); +#endif + + bool hasBinding() const + { + return QBindable(aliasedProperty(), iface).hasBinding(); + } + + QPropertyBinding binding() const + { + return QBindable(aliasedProperty(), iface).binding(); + } + + QPropertyBinding takeBinding() + { + return QBindable(aliasedProperty(), iface).takeBinding(); + } + + template + QPropertyChangeHandler onValueChanged(Functor f) + { + return QBindable(aliasedProperty(), iface).onValueChanged(f); + } + + template + QPropertyChangeHandler subscribe(Functor f) + { + return QBindable(aliasedProperty(), iface).subscribe(f); + } + + template + QPropertyNotifier addNotifier(Functor f) + { + return QBindable(aliasedProperty(), iface).addNotifier(f); + } + + bool isValid() const + { + return aliasedProperty() != nullptr; + } + QT_WARNING_POP +}; +#endif // QT_DEPRECATED_SINCE(6, 6) + +template +class QObjectBindableProperty : public QPropertyData +{ + using ThisType = QObjectBindableProperty; + static bool constexpr HasSignal = !std::is_same_v; + using SignalTakesValue = std::is_invocable; + Class *owner() + { + char *that = reinterpret_cast(this); + return reinterpret_cast(that - QtPrivate::detail::getOffset(Offset)); + } + const Class *owner() const + { + char *that = const_cast(reinterpret_cast(this)); + return reinterpret_cast(that - QtPrivate::detail::getOffset(Offset)); + } + static void signalCallBack(QUntypedPropertyData *o) + { + QObjectBindableProperty *that = static_cast(o); + if constexpr (HasSignal) { + if constexpr (SignalTakesValue::value) + (that->owner()->*Signal)(that->valueBypassingBindings()); + else + (that->owner()->*Signal)(); + } + } +public: + using value_type = typename QPropertyData::value_type; + using parameter_type = typename QPropertyData::parameter_type; + using rvalue_ref = typename QPropertyData::rvalue_ref; + using arrow_operator_result = typename QPropertyData::arrow_operator_result; + + QObjectBindableProperty() = default; + explicit QObjectBindableProperty(const T &initialValue) : QPropertyData(initialValue) {} + explicit QObjectBindableProperty(T &&initialValue) : QPropertyData(std::move(initialValue)) {} + explicit QObjectBindableProperty(const QPropertyBinding &binding) + : QObjectBindableProperty() + { setBinding(binding); } +#ifndef Q_QDOC + template + explicit QObjectBindableProperty(Functor &&f, const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION, + typename std::enable_if_t> * = nullptr) + : QObjectBindableProperty(QPropertyBinding(std::forward(f), location)) + {} +#else + template + explicit QObjectBindableProperty(Functor &&f); +#endif + + parameter_type value() const + { + qGetBindingStorage(owner())->registerDependency(this); + return this->val; + } + + arrow_operator_result operator->() const + { + if constexpr (QTypeTraits::is_dereferenceable_v) { + return value(); + } else if constexpr (std::is_pointer_v) { + value(); + return this->val; + } else { + return; + } + } + + parameter_type operator*() const + { + return value(); + } + + operator parameter_type() const + { + return value(); + } + + void setValue(parameter_type t) + { + auto *bd = qGetBindingStorage(owner())->bindingData(this); + if (bd) + bd->removeBinding(); + if (this->val == t) + return; + this->val = t; + notify(bd); + } + + void notify() { + auto *bd = qGetBindingStorage(owner())->bindingData(this); + notify(bd); + } + + void setValue(rvalue_ref t) + { + auto *bd = qGetBindingStorage(owner())->bindingData(this); + if (bd) + bd->removeBinding(); + if (this->val == t) + return; + this->val = std::move(t); + notify(bd); + } + + QObjectBindableProperty &operator=(rvalue_ref newValue) + { + setValue(std::move(newValue)); + return *this; + } + + QObjectBindableProperty &operator=(parameter_type newValue) + { + setValue(newValue); + return *this; + } + + QPropertyBinding setBinding(const QPropertyBinding &newBinding) + { + QtPrivate::QPropertyBindingData *bd = qGetBindingStorage(owner())->bindingData(this, true); + QUntypedPropertyBinding oldBinding(bd->setBinding(newBinding, this, HasSignal ? &signalCallBack : nullptr)); + return static_cast &>(oldBinding); + } + + bool setBinding(const QUntypedPropertyBinding &newBinding) + { + if (!newBinding.isNull() && newBinding.valueMetaType().id() != qMetaTypeId()) + return false; + setBinding(static_cast &>(newBinding)); + return true; + } + +#ifndef Q_QDOC + template + QPropertyBinding setBinding(Functor &&f, + const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION, + std::enable_if_t> * = nullptr) + { + return setBinding(Qt::makePropertyBinding(std::forward(f), location)); + } +#else + template + QPropertyBinding setBinding(Functor f); +#endif + + bool hasBinding() const + { + auto *bd = qGetBindingStorage(owner())->bindingData(this); + return bd && bd->binding() != nullptr; + } + + QPropertyBinding binding() const + { + auto *bd = qGetBindingStorage(owner())->bindingData(this); + return static_cast &&>(QUntypedPropertyBinding(bd ? bd->binding() : nullptr)); + } + + QPropertyBinding takeBinding() + { + return setBinding(QPropertyBinding()); + } + + template + QPropertyChangeHandler onValueChanged(Functor f) + { + static_assert(std::is_invocable_v, "Functor callback must be callable without any parameters"); + return QPropertyChangeHandler(*this, f); + } + + template + QPropertyChangeHandler subscribe(Functor f) + { + static_assert(std::is_invocable_v, "Functor callback must be callable without any parameters"); + f(); + return onValueChanged(f); + } + + template + QPropertyNotifier addNotifier(Functor f) + { + static_assert(std::is_invocable_v, "Functor callback must be callable without any parameters"); + return QPropertyNotifier(*this, f); + } + + const QtPrivate::QPropertyBindingData &bindingData() const + { + auto *storage = const_cast(qGetBindingStorage(owner())); + return *storage->bindingData(const_cast(this), true); + } +private: + void notify(const QtPrivate::QPropertyBindingData *binding) + { + if (binding) + binding->notifyObservers(this, qGetBindingStorage(owner())); + if constexpr (HasSignal) { + if constexpr (SignalTakesValue::value) + (owner()->*Signal)(this->valueBypassingBindings()); + else + (owner()->*Signal)(); + } + } +}; + +#define QT_OBJECT_BINDABLE_PROPERTY_3(Class, Type, name) \ + static constexpr size_t _qt_property_##name##_offset() { \ + QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF \ + return offsetof(Class, name); \ + QT_WARNING_POP \ + } \ + QObjectBindableProperty name; + +#define QT_OBJECT_BINDABLE_PROPERTY_4(Class, Type, name, Signal) \ + static constexpr size_t _qt_property_##name##_offset() { \ + QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF \ + return offsetof(Class, name); \ + QT_WARNING_POP \ + } \ + QObjectBindableProperty name; + +#define Q_OBJECT_BINDABLE_PROPERTY(...) \ + QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF \ + QT_OVERLOADED_MACRO(QT_OBJECT_BINDABLE_PROPERTY, __VA_ARGS__) \ + QT_WARNING_POP + +#define QT_OBJECT_BINDABLE_PROPERTY_WITH_ARGS_4(Class, Type, name, value) \ + static constexpr size_t _qt_property_##name##_offset() \ + { \ + QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF \ + return offsetof(Class, name); \ + QT_WARNING_POP \ + } \ + QObjectBindableProperty name = \ + QObjectBindableProperty( \ + value); + +#define QT_OBJECT_BINDABLE_PROPERTY_WITH_ARGS_5(Class, Type, name, value, Signal) \ + static constexpr size_t _qt_property_##name##_offset() \ + { \ + QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF \ + return offsetof(Class, name); \ + QT_WARNING_POP \ + } \ + QObjectBindableProperty name = \ + QObjectBindableProperty( \ + value); + +#define Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(...) \ + QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF \ + QT_OVERLOADED_MACRO(QT_OBJECT_BINDABLE_PROPERTY_WITH_ARGS, __VA_ARGS__) \ + QT_WARNING_POP + +template +class QObjectComputedProperty : public QUntypedPropertyData +{ + Class *owner() + { + char *that = reinterpret_cast(this); + return reinterpret_cast(that - QtPrivate::detail::getOffset(Offset)); + } + const Class *owner() const + { + char *that = const_cast(reinterpret_cast(this)); + return reinterpret_cast(that - QtPrivate::detail::getOffset(Offset)); + } + +public: + using value_type = T; + using parameter_type = T; + + QObjectComputedProperty() = default; + + parameter_type value() const + { + qGetBindingStorage(owner())->registerDependency(this); + return (owner()->*Getter)(); + } + + std::conditional_t, parameter_type, void> + operator->() const + { + if constexpr (QTypeTraits::is_dereferenceable_v) + return value(); + else + return; + } + + parameter_type operator*() const + { + return value(); + } + + operator parameter_type() const + { + return value(); + } + + constexpr bool hasBinding() const { return false; } + + template + QPropertyChangeHandler onValueChanged(Functor f) + { + static_assert(std::is_invocable_v, "Functor callback must be callable without any parameters"); + return QPropertyChangeHandler(*this, f); + } + + template + QPropertyChangeHandler subscribe(Functor f) + { + static_assert(std::is_invocable_v, "Functor callback must be callable without any parameters"); + f(); + return onValueChanged(f); + } + + template + QPropertyNotifier addNotifier(Functor f) + { + static_assert(std::is_invocable_v, "Functor callback must be callable without any parameters"); + return QPropertyNotifier(*this, f); + } + + QtPrivate::QPropertyBindingData &bindingData() const + { + auto *storage = const_cast(qGetBindingStorage(owner())); + return *storage->bindingData(const_cast(this), true); + } + + void notify() { + // computed property can't store a binding, so there's nothing to mark + auto *storage = const_cast(qGetBindingStorage(owner())); + auto bd = storage->bindingData(const_cast(this), false); + if (bd) + bd->notifyObservers(this, qGetBindingStorage(owner())); + } +}; + +#define Q_OBJECT_COMPUTED_PROPERTY(Class, Type, name, ...) \ + static constexpr size_t _qt_property_##name##_offset() { \ + QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF \ + return offsetof(Class, name); \ + QT_WARNING_POP \ + } \ + QObjectComputedProperty name; + +#undef QT_SOURCE_LOCATION_NAMESPACE + +QT_END_NAMESPACE + +#endif // QPROPERTY_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qpropertyanimation.h b/qt/6.8.1/msvc2022_64/include/QtCore/qpropertyanimation.h new file mode 100644 index 0000000000000000000000000000000000000000..99fcc4b975dd9a1bda4576e019ac77e86a7f3bd7 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qpropertyanimation.h @@ -0,0 +1,47 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QPROPERTYANIMATION_H +#define QPROPERTYANIMATION_H + +#include + +QT_REQUIRE_CONFIG(animation); + +QT_BEGIN_NAMESPACE + +class QPropertyAnimationPrivate; +class Q_CORE_EXPORT QPropertyAnimation : public QVariantAnimation +{ + Q_OBJECT + Q_PROPERTY(QByteArray propertyName READ propertyName WRITE setPropertyName + BINDABLE bindablePropertyName) + Q_PROPERTY(QObject* targetObject READ targetObject WRITE setTargetObject + BINDABLE bindableTargetObject) + +public: + QPropertyAnimation(QObject *parent = nullptr); + QPropertyAnimation(QObject *target, const QByteArray &propertyName, QObject *parent = nullptr); + ~QPropertyAnimation(); + + QObject *targetObject() const; + void setTargetObject(QObject *target); + QBindable bindableTargetObject(); + + QByteArray propertyName() const; + void setPropertyName(const QByteArray &propertyName); + QBindable bindablePropertyName(); + +protected: + bool event(QEvent *event) override; + void updateCurrentValue(const QVariant &value) override; + void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) override; + +private: + Q_DISABLE_COPY(QPropertyAnimation) + Q_DECLARE_PRIVATE(QPropertyAnimation) +}; + +QT_END_NAMESPACE + +#endif // QPROPERTYANIMATION_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qpropertyprivate.h b/qt/6.8.1/msvc2022_64/include/QtCore/qpropertyprivate.h new file mode 100644 index 0000000000000000000000000000000000000000..ec8d42cb9e13482ea0566e504e02bffd15bf3239 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qpropertyprivate.h @@ -0,0 +1,391 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QPROPERTYPRIVATE_H +#define QPROPERTYPRIVATE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QBindingStorage; + +template +class QObjectCompatProperty; + +class QPropertyBindingPrivatePtr; +using PendingBindingObserverList = QVarLengthArray; + +namespace QtPrivate { +// QPropertyBindingPrivatePtr operates on a RefCountingMixin solely so that we can inline +// the constructor and copy constructor +struct RefCounted { + + int refCount() const { return ref; } + void addRef() { ++ref; } + bool deref() { return --ref != 0; } + +private: + int ref = 0; +}; +} + +class QQmlPropertyBinding; +class QPropertyBindingPrivate; +class QPropertyBindingPrivatePtr +{ +public: + using T = QtPrivate::RefCounted; + T &operator*() const { return *d; } + T *operator->() noexcept { return d; } + T *operator->() const noexcept { return d; } + explicit operator T *() { return d; } + explicit operator const T *() const noexcept { return d; } + T *data() const noexcept { return d; } + T *get() const noexcept { return d; } + const T *constData() const noexcept { return d; } + T *take() noexcept { T *x = d; d = nullptr; return x; } + + QPropertyBindingPrivatePtr() noexcept : d(nullptr) { } + ~QPropertyBindingPrivatePtr() + { + if (d && !d->deref()) + destroyAndFreeMemory(); + } + Q_CORE_EXPORT void destroyAndFreeMemory(); + + explicit QPropertyBindingPrivatePtr(T *data) noexcept : d(data) { if (d) d->addRef(); } + QPropertyBindingPrivatePtr(const QPropertyBindingPrivatePtr &o) noexcept + : d(o.d) { if (d) d->addRef(); } + + void reset(T *ptr = nullptr) noexcept; + + QPropertyBindingPrivatePtr &operator=(const QPropertyBindingPrivatePtr &o) noexcept + { + reset(o.d); + return *this; + } + QPropertyBindingPrivatePtr &operator=(T *o) noexcept + { + reset(o); + return *this; + } + QPropertyBindingPrivatePtr(QPropertyBindingPrivatePtr &&o) noexcept : d(std::exchange(o.d, nullptr)) {} + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QPropertyBindingPrivatePtr) + + operator bool () const noexcept { return d != nullptr; } + bool operator!() const noexcept { return d == nullptr; } + + void swap(QPropertyBindingPrivatePtr &other) noexcept + { qt_ptr_swap(d, other.d); } + +private: + friend bool comparesEqual(const QPropertyBindingPrivatePtr &lhs, + const QPropertyBindingPrivatePtr &rhs) noexcept + { return lhs.d == rhs.d; } + Q_DECLARE_EQUALITY_COMPARABLE(QPropertyBindingPrivatePtr) + friend bool comparesEqual(const QPropertyBindingPrivatePtr &lhs, + const T *rhs) noexcept + { return lhs.d == rhs; } + Q_DECLARE_EQUALITY_COMPARABLE(QPropertyBindingPrivatePtr, T*) + friend bool comparesEqual(const QPropertyBindingPrivatePtr &lhs, + std::nullptr_t) noexcept + { return !lhs; } + Q_DECLARE_EQUALITY_COMPARABLE(QPropertyBindingPrivatePtr, std::nullptr_t) + + QtPrivate::RefCounted *d; +}; + +class QUntypedPropertyBinding; +class QPropertyBindingPrivate; +struct QPropertyBindingDataPointer; +class QPropertyObserver; +struct QPropertyObserverPointer; + +class QUntypedPropertyData +{ +}; + +namespace QtPrivate { +template +using IsUntypedPropertyData = std::enable_if_t, bool>; +} + +template +class QPropertyData; + +// Used for grouped property evaluations +namespace QtPrivate { +class QPropertyBindingData; +} +struct QPropertyDelayedNotifications; +struct QPropertyProxyBindingData +{ + // acts as QPropertyBindingData::d_ptr + quintptr d_ptr; + /* + The two members below store the original binding data and property + data pointer of the property which gets proxied. + They are set in QPropertyDelayedNotifications::addProperty + */ + const QtPrivate::QPropertyBindingData *originalBindingData; + QUntypedPropertyData *propertyData; +}; + +namespace QtPrivate { +struct BindingEvaluationState; + +/* used in BindingFunctionVTable::createFor; on all other compilers, void would work, but on + MSVC this causes C2182 when compiling in C++20 mode. As we only need to provide some default + value which gets ignored, we introduce this dummy type. +*/ +struct MSVCWorkAround {}; + +struct BindingFunctionVTable +{ + using CallFn = bool(*)(QMetaType, QUntypedPropertyData *, void *); + using DtorFn = void(*)(void *); + using MoveCtrFn = void(*)(void *, void *); + const CallFn call; + const DtorFn destroy; + const MoveCtrFn moveConstruct; + const qsizetype size; + + template + static constexpr BindingFunctionVTable createFor() + { + static_assert (alignof(Callable) <= alignof(std::max_align_t), "Bindings do not support overaligned functors!"); + return { + /*call=*/[](QMetaType metaType, QUntypedPropertyData *dataPtr, void *f){ + if constexpr (!std::is_invocable_v) { + // we got an untyped callable + static_assert (std::is_invocable_r_v ); + auto untypedEvaluationFunction = static_cast(f); + return std::invoke(*untypedEvaluationFunction, metaType, dataPtr); + } else if constexpr (!std::is_same_v) { + Q_UNUSED(metaType); + QPropertyData *propertyPtr = static_cast *>(dataPtr); + // That is allowed by POSIX even if Callable is a function pointer + auto evaluationFunction = static_cast(f); + PropertyType newValue = std::invoke(*evaluationFunction); + if constexpr (QTypeTraits::has_operator_equal_v) { + if (newValue == propertyPtr->valueBypassingBindings()) + return false; + } + propertyPtr->setValueBypassingBindings(std::move(newValue)); + return true; + } else { + // Our code will never instantiate this + Q_UNREACHABLE_RETURN(false); + } + }, + /*destroy*/[](void *f){ static_cast(f)->~Callable(); }, + /*moveConstruct*/[](void *addr, void *other){ + new (addr) Callable(std::move(*static_cast(other))); + }, + /*size*/sizeof(Callable) + }; + } +}; + +template +inline constexpr BindingFunctionVTable bindingFunctionVTable = BindingFunctionVTable::createFor(); + + +// writes binding result into dataPtr +struct QPropertyBindingFunction { + const QtPrivate::BindingFunctionVTable *vtable; + void *functor; +}; + +using QPropertyObserverCallback = void (*)(QUntypedPropertyData *); +using QPropertyBindingWrapper = bool(*)(QMetaType, QUntypedPropertyData *dataPtr, QPropertyBindingFunction); + +/*! + \internal + A property normally consists of the actual property value and metadata for the binding system. + QPropertyBindingData is the latter part. It stores a pointer to either + - a (potentially empty) linked list of notifiers, in case there is no binding set, + - an actual QUntypedPropertyBinding when the property has a binding, + - or a pointer to QPropertyProxyBindingData when notifications occur inside a grouped update. + + \sa QPropertyDelayedNotifications, beginPropertyUpdateGroup + */ +class Q_CORE_EXPORT QPropertyBindingData +{ + // Mutable because the address of the observer of the currently evaluating binding is stored here, for + // notification later when the value changes. + mutable quintptr d_ptr = 0; + friend struct QT_PREPEND_NAMESPACE(QPropertyBindingDataPointer); + friend class QT_PREPEND_NAMESPACE(QQmlPropertyBinding); + friend struct QT_PREPEND_NAMESPACE(QPropertyDelayedNotifications); + + template + friend class QT_PREPEND_NAMESPACE(QObjectCompatProperty); + + Q_DISABLE_COPY(QPropertyBindingData) +public: + QPropertyBindingData() = default; + QPropertyBindingData(QPropertyBindingData &&other); + QPropertyBindingData &operator=(QPropertyBindingData &&other) = delete; + ~QPropertyBindingData(); + + // Is d_ptr pointing to a binding (1) or list of notifiers (0)? + static inline constexpr quintptr BindingBit = 0x1; + // Is d_ptr pointing to QPropertyProxyBindingData (1) or to an actual binding/list of notifiers? + static inline constexpr quintptr DelayedNotificationBit = 0x2; + + bool hasBinding() const { return d_ptr & BindingBit; } + bool isNotificationDelayed() const { return d_ptr & DelayedNotificationBit; } + + QUntypedPropertyBinding setBinding(const QUntypedPropertyBinding &newBinding, + QUntypedPropertyData *propertyDataPtr, + QPropertyObserverCallback staticObserverCallback = nullptr, + QPropertyBindingWrapper bindingWrapper = nullptr); + + QPropertyBindingPrivate *binding() const + { + quintptr dd = d(); + if (dd & BindingBit) + return reinterpret_cast(dd - BindingBit); + return nullptr; + + } + + void evaluateIfDirty(const QUntypedPropertyData *) const; // ### Kept for BC reasons, unused + + void removeBinding() + { + if (hasBinding()) + removeBinding_helper(); + } + + void registerWithCurrentlyEvaluatingBinding(QtPrivate::BindingEvaluationState *currentBinding) const + { + if (!currentBinding) + return; + registerWithCurrentlyEvaluatingBinding_helper(currentBinding); + } + void registerWithCurrentlyEvaluatingBinding() const; + void notifyObservers(QUntypedPropertyData *propertyDataPtr) const; + void notifyObservers(QUntypedPropertyData *propertyDataPtr, QBindingStorage *storage) const; +private: + /*! + \internal + Returns a reference to d_ptr, except when d_ptr points to a proxy. + In that case, a reference to proxy->d_ptr is returned instead. + + To properly support proxying, direct access to d_ptr only occurs when + - a function actually deals with proxying (e.g. + QPropertyDelayedNotifications::addProperty), + - only the tag value is accessed (e.g. hasBinding) or + - inside a constructor. + */ + quintptr &d_ref() const + { + quintptr &d = d_ptr; + if (isNotificationDelayed()) + return proxyData()->d_ptr; + return d; + } + quintptr d() const { return d_ref(); } + QPropertyProxyBindingData *proxyData() const + { + Q_ASSERT(isNotificationDelayed()); + return reinterpret_cast(d_ptr & ~(BindingBit|DelayedNotificationBit)); + } + void registerWithCurrentlyEvaluatingBinding_helper(BindingEvaluationState *currentBinding) const; + void removeBinding_helper(); + + enum NotificationResult { Delayed, Evaluated }; + NotificationResult notifyObserver_helper( + QUntypedPropertyData *propertyDataPtr, QBindingStorage *storage, + QPropertyObserverPointer observer, + PendingBindingObserverList &bindingObservers) const; +}; + +template +class QTagPreservingPointerToPointer +{ +public: + constexpr QTagPreservingPointerToPointer() = default; + + QTagPreservingPointerToPointer(T **ptr) + : d(reinterpret_cast(ptr)) + {} + + QTagPreservingPointerToPointer &operator=(T **ptr) + { + d = reinterpret_cast(ptr); + return *this; + } + + QTagPreservingPointerToPointer &operator=(QTaggedPointer *ptr) + { + d = reinterpret_cast(ptr); + return *this; + } + + void clear() + { + d = nullptr; + } + + void setPointer(T *ptr) + { + *d = reinterpret_cast(ptr) | (*d & QTaggedPointer::tagMask()); + } + + T *get() const + { + return reinterpret_cast(*d & QTaggedPointer::pointerMask()); + } + + explicit operator bool() const + { + return d != nullptr; + } + +private: + quintptr *d = nullptr; +}; + +namespace detail { + template + struct ExtractClassFromFunctionPointer; + + template + struct ExtractClassFromFunctionPointer { using Class = C; }; + + constexpr size_t getOffset(size_t o) + { + return o; + } + constexpr size_t getOffset(size_t (*offsetFn)()) + { + return offsetFn(); + } +} + +} // namespace QtPrivate + +QT_END_NAMESPACE + +#endif // QPROPERTYPRIVATE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qqueue.h b/qt/6.8.1/msvc2022_64/include/QtCore/qqueue.h new file mode 100644 index 0000000000000000000000000000000000000000..e670346b563dcf18c1c5f21d227eee42d57a224f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qqueue.h @@ -0,0 +1,26 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QQUEUE_H +#define QQUEUE_H + +#include + +QT_BEGIN_NAMESPACE + + +template +class QQueue : public QList +{ +public: + // compiler-generated special member functions are fine! + inline void swap(QQueue &other) noexcept { QList::swap(other); } // prevent QList<->QQueue swaps + inline void enqueue(const T &t) { QList::append(t); } + inline T dequeue() { return QList::takeFirst(); } + inline T &head() { return QList::first(); } + inline const T &head() const { return QList::first(); } +}; + +QT_END_NAMESPACE + +#endif // QQUEUE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qrandom.h b/qt/6.8.1/msvc2022_64/include/QtCore/qrandom.h new file mode 100644 index 0000000000000000000000000000000000000000..5ea8a2b47692744eec5451b1b575bef52ed320c1 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qrandom.h @@ -0,0 +1,289 @@ +// Copyright (C) 2020 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QRANDOM_H +#define QRANDOM_H + +#include +#include // for std::generate +#include // for std::mt19937 + +#ifdef min +# undef min +#endif +#ifdef max +# undef max +#endif + +QT_BEGIN_NAMESPACE + +class QRandomGenerator +{ + // restrict the template parameters to unsigned integers 32 bits wide or larger + template using IfValidUInt = + typename std::enable_if::value && sizeof(UInt) >= sizeof(uint), bool>::type; +public: + QRandomGenerator(quint32 seedValue = 1) + : QRandomGenerator(&seedValue, 1) + {} + template QRandomGenerator(const quint32 (&seedBuffer)[N]) + : QRandomGenerator(seedBuffer, seedBuffer + N) + {} + QRandomGenerator(const quint32 *seedBuffer, qsizetype len) + : QRandomGenerator(seedBuffer, seedBuffer + len) + {} + Q_CORE_EXPORT QRandomGenerator(std::seed_seq &sseq) noexcept; + Q_CORE_EXPORT QRandomGenerator(const quint32 *begin, const quint32 *end); + + // copy constructor & assignment operator (move unnecessary) + Q_CORE_EXPORT QRandomGenerator(const QRandomGenerator &other); + Q_CORE_EXPORT QRandomGenerator &operator=(const QRandomGenerator &other); + + ~QRandomGenerator() = default; + + friend Q_CORE_EXPORT bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2); + friend bool operator!=(const QRandomGenerator &rng1, const QRandomGenerator &rng2) + { + return !(rng1 == rng2); + } + + quint32 generate() + { + return quint32(_fillRange(nullptr, 1)); + } + + quint64 generate64() + { + return _fillRange(nullptr, sizeof(quint64) / sizeof(quint32)); + } + + double generateDouble() + { + // IEEE 754 double precision has: + // 1 bit sign + // 10 bits exponent + // 53 bits mantissa + // In order for our result to be normalized in the range [0, 1), we + // need exactly 53 bits of random data. Use generate64() to get enough. + quint64 x = generate64(); + quint64 limit = Q_UINT64_C(1) << std::numeric_limits::digits; + x >>= std::numeric_limits::digits - std::numeric_limits::digits; + return double(x) / double(limit); + } + + double bounded(double highest) + { + return generateDouble() * highest; + } + + quint32 bounded(quint32 highest) + { + quint64 value = generate(); + value *= highest; + value /= (max)() + quint64(1); + return quint32(value); + } + + quint32 bounded(quint32 lowest, quint32 highest) + { + Q_ASSERT(highest > lowest); + return bounded(highest - lowest) + lowest; + } + + int bounded(int highest) + { + Q_ASSERT(highest > 0); + return int(bounded(0U, quint32(highest))); + } + + int bounded(int lowest, int highest) + { + return bounded(highest - lowest) + lowest; + } + + quint64 bounded(quint64 highest); + + quint64 bounded(quint64 lowest, quint64 highest) + { + Q_ASSERT(highest > lowest); + return bounded(highest - lowest) + lowest; + } + + qint64 bounded(qint64 highest) + { + Q_ASSERT(highest > 0); + return qint64(bounded(quint64(0), quint64(highest))); + } + + qint64 bounded(qint64 lowest, qint64 highest) + { + return bounded(highest - lowest) + lowest; + } + + // these functions here only to help with ambiguous overloads + qint64 bounded(int lowest, qint64 highest) + { + return bounded(qint64(lowest), qint64(highest)); + } + qint64 bounded(qint64 lowest, int highest) + { + return bounded(qint64(lowest), qint64(highest)); + } + + quint64 bounded(unsigned lowest, quint64 highest) + { + return bounded(quint64(lowest), quint64(highest)); + } + quint64 bounded(quint64 lowest, unsigned highest) + { + return bounded(quint64(lowest), quint64(highest)); + } + + template = true> + void fillRange(UInt *buffer, qsizetype count) + { + _fillRange(buffer, count * sizeof(UInt) / sizeof(quint32)); + } + + template = true> + void fillRange(UInt (&buffer)[N]) + { + _fillRange(buffer, N * sizeof(UInt) / sizeof(quint32)); + } + + // API like std::seed_seq + template + void generate(ForwardIterator begin, ForwardIterator end) + { + std::generate(begin, end, [this]() { return generate(); }); + } + + void generate(quint32 *begin, quint32 *end) + { + _fillRange(begin, end - begin); + } + + // API like std:: random engines + typedef quint32 result_type; + result_type operator()() { return generate(); } + void seed(quint32 s = 1) { *this = { s }; } + void seed(std::seed_seq &sseq) noexcept { *this = { sseq }; } + Q_CORE_EXPORT void discard(unsigned long long z); + static constexpr result_type min() { return (std::numeric_limits::min)(); } + static constexpr result_type max() { return (std::numeric_limits::max)(); } + + static inline Q_DECL_CONST_FUNCTION QRandomGenerator *system(); + static inline Q_DECL_CONST_FUNCTION QRandomGenerator *global(); + static inline QRandomGenerator securelySeeded(); + +protected: + enum System {}; + QRandomGenerator(System); + +private: + Q_CORE_EXPORT quint64 _fillRange(void *buffer, qptrdiff count); + + struct InitialRandomData { + quintptr data[16 / sizeof(quintptr)]; + }; + friend InitialRandomData qt_initial_random_value() noexcept; + friend class QRandomGenerator64; + struct SystemGenerator; + struct SystemAndGlobalGenerators; + using RandomEngine = std::mersenne_twister_engine; + + union Storage { + uint dummy; + RandomEngine twister; + RandomEngine &engine() { return twister; } + const RandomEngine &engine() const { return twister; } + + static_assert(std::is_trivially_destructible::value, + "std::mersenne_twister not trivially destructible as expected"); + constexpr Storage(); + }; + uint type; + Storage storage; +}; + +class QRandomGenerator64 : public QRandomGenerator +{ + QRandomGenerator64(System); +public: + // unshadow generate() overloads, since we'll override. + using QRandomGenerator::generate; + quint64 generate() { return generate64(); } + + typedef quint64 result_type; + result_type operator()() { return generate64(); } + +#ifndef Q_QDOC + QRandomGenerator64(quint32 seedValue = 1) + : QRandomGenerator(seedValue) + {} + template QRandomGenerator64(const quint32 (&seedBuffer)[N]) + : QRandomGenerator(seedBuffer) + {} + QRandomGenerator64(const quint32 *seedBuffer, qsizetype len) + : QRandomGenerator(seedBuffer, len) + {} + QRandomGenerator64(std::seed_seq &sseq) noexcept + : QRandomGenerator(sseq) + {} + QRandomGenerator64(const quint32 *begin, const quint32 *end) + : QRandomGenerator(begin, end) + {} + QRandomGenerator64(const QRandomGenerator &other) : QRandomGenerator(other) {} + + void discard(unsigned long long z) + { + Q_ASSERT_X(z * 2 > z, "QRandomGenerator64::discard", + "Overflow. Are you sure you want to skip over 9 quintillion samples?"); + QRandomGenerator::discard(z * 2); + } + + static constexpr result_type min() { return (std::numeric_limits::min)(); } + static constexpr result_type max() { return (std::numeric_limits::max)(); } + static Q_DECL_CONST_FUNCTION Q_CORE_EXPORT QRandomGenerator64 *system(); + static Q_DECL_CONST_FUNCTION Q_CORE_EXPORT QRandomGenerator64 *global(); + static Q_CORE_EXPORT QRandomGenerator64 securelySeeded(); +#endif // Q_QDOC +}; + +inline quint64 QRandomGenerator::bounded(quint64 highest) +{ + // Implement an algorithm similar to libc++'s uniform_int_distribution: + // loop around getting a random number, mask off any bits that "highest" + // will never need, then check if it's higher than "highest". The number of + // times the loop will run is unbounded but the probability of terminating + // is better than 1/2 on each iteration. Therefore, the average loop count + // should be less than 2. + + const int width = qCountLeadingZeroBits(highest - 1); + const quint64 mask = (quint64(1) << (std::numeric_limits::digits - width)) - 1; + quint64 v; + do { + v = generate64() & mask; + } while (v >= highest); + return v; +} + +inline QRandomGenerator *QRandomGenerator::system() +{ + return QRandomGenerator64::system(); +} + +inline QRandomGenerator *QRandomGenerator::global() +{ + return QRandomGenerator64::global(); +} + +QRandomGenerator QRandomGenerator::securelySeeded() +{ + return QRandomGenerator64::securelySeeded(); +} + +QT_END_NAMESPACE + +#endif // QRANDOM_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qreadwritelock.h b/qt/6.8.1/msvc2022_64/include/QtCore/qreadwritelock.h new file mode 100644 index 0000000000000000000000000000000000000000..f026ef1aad46c50e603aafa4433f9436914ad88e --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qreadwritelock.h @@ -0,0 +1,246 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QREADWRITELOCK_H +#define QREADWRITELOCK_H + +#include +#include + +QT_BEGIN_NAMESPACE + +#if QT_CONFIG(thread) + +class QReadWriteLockPrivate; + +class Q_CORE_EXPORT QReadWriteLock +{ +public: + enum RecursionMode { NonRecursive, Recursive }; + + QT_CORE_INLINE_SINCE(6, 6) + explicit QReadWriteLock(RecursionMode recursionMode = NonRecursive); + QT_CORE_INLINE_SINCE(6, 6) + ~QReadWriteLock(); + + QT_CORE_INLINE_SINCE(6, 6) + void lockForRead(); +#if QT_CORE_REMOVED_SINCE(6, 6) + bool tryLockForRead(); +#endif + QT_CORE_INLINE_SINCE(6, 6) + bool tryLockForRead(int timeout); + bool tryLockForRead(QDeadlineTimer timeout = {}); + + QT_CORE_INLINE_SINCE(6, 6) + void lockForWrite(); +#if QT_CORE_REMOVED_SINCE(6, 6) + bool tryLockForWrite(); +#endif + QT_CORE_INLINE_SINCE(6, 6) + bool tryLockForWrite(int timeout); + bool tryLockForWrite(QDeadlineTimer timeout = {}); + + void unlock(); + +private: + Q_DISABLE_COPY(QReadWriteLock) + QAtomicPointer d_ptr; + friend class QReadWriteLockPrivate; + static QReadWriteLockPrivate *initRecursive(); + static void destroyRecursive(QReadWriteLockPrivate *); +}; + +#if QT_CORE_INLINE_IMPL_SINCE(6, 6) +QReadWriteLock::QReadWriteLock(RecursionMode recursionMode) + : d_ptr(recursionMode == Recursive ? initRecursive() : nullptr) +{ +} + +QReadWriteLock::~QReadWriteLock() +{ + if (auto d = d_ptr.loadAcquire()) + destroyRecursive(d); +} + +void QReadWriteLock::lockForRead() +{ + tryLockForRead(QDeadlineTimer(QDeadlineTimer::Forever)); +} + +bool QReadWriteLock::tryLockForRead(int timeout) +{ + return tryLockForRead(QDeadlineTimer(timeout)); +} + +void QReadWriteLock::lockForWrite() +{ + tryLockForWrite(QDeadlineTimer(QDeadlineTimer::Forever)); +} + +bool QReadWriteLock::tryLockForWrite(int timeout) +{ + return tryLockForWrite(QDeadlineTimer(timeout)); +} +#endif // inline since 6.6 + +#if defined(Q_CC_MSVC) +#pragma warning( push ) +#pragma warning( disable : 4312 ) // ignoring the warning from /Wp64 +#endif + +class QT6_ONLY(Q_CORE_EXPORT) QReadLocker +{ +public: + Q_NODISCARD_CTOR + inline QReadLocker(QReadWriteLock *readWriteLock); + + inline ~QReadLocker() + { unlock(); } + + inline void unlock() + { + if (q_val) { + if ((q_val & quintptr(1u)) == quintptr(1u)) { + q_val &= ~quintptr(1u); + readWriteLock()->unlock(); + } + } + } + + inline void relock() + { + if (q_val) { + if ((q_val & quintptr(1u)) == quintptr(0u)) { + readWriteLock()->lockForRead(); + q_val |= quintptr(1u); + } + } + } + + inline QReadWriteLock *readWriteLock() const + { return reinterpret_cast(q_val & ~quintptr(1u)); } + +private: + Q_DISABLE_COPY(QReadLocker) + quintptr q_val; +}; + +inline QReadLocker::QReadLocker(QReadWriteLock *areadWriteLock) + : q_val(reinterpret_cast(areadWriteLock)) +{ + Q_ASSERT_X((q_val & quintptr(1u)) == quintptr(0), + "QReadLocker", "QReadWriteLock pointer is misaligned"); + relock(); +} + +class QT6_ONLY(Q_CORE_EXPORT) QWriteLocker +{ +public: + Q_NODISCARD_CTOR + inline QWriteLocker(QReadWriteLock *readWriteLock); + + inline ~QWriteLocker() + { unlock(); } + + inline void unlock() + { + if (q_val) { + if ((q_val & quintptr(1u)) == quintptr(1u)) { + q_val &= ~quintptr(1u); + readWriteLock()->unlock(); + } + } + } + + inline void relock() + { + if (q_val) { + if ((q_val & quintptr(1u)) == quintptr(0u)) { + readWriteLock()->lockForWrite(); + q_val |= quintptr(1u); + } + } + } + + inline QReadWriteLock *readWriteLock() const + { return reinterpret_cast(q_val & ~quintptr(1u)); } + + +private: + Q_DISABLE_COPY(QWriteLocker) + quintptr q_val; +}; + +inline QWriteLocker::QWriteLocker(QReadWriteLock *areadWriteLock) + : q_val(reinterpret_cast(areadWriteLock)) +{ + Q_ASSERT_X((q_val & quintptr(1u)) == quintptr(0), + "QWriteLocker", "QReadWriteLock pointer is misaligned"); + relock(); +} + +#if defined(Q_CC_MSVC) +#pragma warning( pop ) +#endif + +#else // QT_CONFIG(thread) + +class QT6_ONLY(Q_CORE_EXPORT) QReadWriteLock +{ +public: + enum RecursionMode { NonRecursive, Recursive }; + inline explicit QReadWriteLock(RecursionMode = NonRecursive) noexcept { } + inline ~QReadWriteLock() { } + + void lockForRead() noexcept { } + bool tryLockForRead() noexcept { return true; } + bool tryLockForRead(QDeadlineTimer) noexcept { return true; } + bool tryLockForRead(int timeout) noexcept { Q_UNUSED(timeout); return true; } + + void lockForWrite() noexcept { } + bool tryLockForWrite() noexcept { return true; } + bool tryLockForWrite(QDeadlineTimer) noexcept { return true; } + bool tryLockForWrite(int timeout) noexcept { Q_UNUSED(timeout); return true; } + + void unlock() noexcept { } + +private: + Q_DISABLE_COPY(QReadWriteLock) +}; + +class QT6_ONLY(Q_CORE_EXPORT) QReadLocker +{ +public: + Q_NODISCARD_CTOR + inline explicit QReadLocker(QReadWriteLock *) noexcept { } + inline ~QReadLocker() noexcept { } + + void unlock() noexcept { } + void relock() noexcept { } + QReadWriteLock *readWriteLock() noexcept { return nullptr; } + +private: + Q_DISABLE_COPY(QReadLocker) +}; + +class QT6_ONLY(Q_CORE_EXPORT) QWriteLocker +{ +public: + Q_NODISCARD_CTOR + inline explicit QWriteLocker(QReadWriteLock *) noexcept { } + inline ~QWriteLocker() noexcept { } + + void unlock() noexcept { } + void relock() noexcept { } + QReadWriteLock *readWriteLock() noexcept { return nullptr; } + +private: + Q_DISABLE_COPY(QWriteLocker) +}; + +#endif // QT_CONFIG(thread) + +QT_END_NAMESPACE + +#endif // QREADWRITELOCK_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qrect.h b/qt/6.8.1/msvc2022_64/include/QtCore/qrect.h new file mode 100644 index 0000000000000000000000000000000000000000..076b28292a8153080fd3d066e58e297cf8d16bcc --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qrect.h @@ -0,0 +1,919 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QRECT_H +#define QRECT_H + +#include +#include +#include +#include + +#ifdef topLeft +#error qrect.h must be included before any header file that defines topLeft +#endif + +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) +struct CGRect; +#endif +#if defined(Q_OS_WASM) || defined(Q_QDOC) +namespace emscripten { +class val; +} +#endif + +QT_BEGIN_NAMESPACE + +class QRectF; + +class Q_CORE_EXPORT QRect +{ +public: + constexpr QRect() noexcept : x1(0), y1(0), x2(-1), y2(-1) {} + constexpr QRect(const QPoint &topleft, const QPoint &bottomright) noexcept; + constexpr QRect(const QPoint &topleft, const QSize &size) noexcept; + constexpr QRect(int left, int top, int width, int height) noexcept; + + constexpr inline bool isNull() const noexcept; + constexpr inline bool isEmpty() const noexcept; + constexpr inline bool isValid() const noexcept; + + constexpr inline int left() const noexcept; + constexpr inline int top() const noexcept; + constexpr inline int right() const noexcept; + constexpr inline int bottom() const noexcept; + [[nodiscard]] QRect normalized() const noexcept; + + constexpr inline int x() const noexcept; + constexpr inline int y() const noexcept; + constexpr inline void setLeft(int pos) noexcept; + constexpr inline void setTop(int pos) noexcept; + constexpr inline void setRight(int pos) noexcept; + constexpr inline void setBottom(int pos) noexcept; + constexpr inline void setX(int x) noexcept; + constexpr inline void setY(int y) noexcept; + + constexpr inline void setTopLeft(const QPoint &p) noexcept; + constexpr inline void setBottomRight(const QPoint &p) noexcept; + constexpr inline void setTopRight(const QPoint &p) noexcept; + constexpr inline void setBottomLeft(const QPoint &p) noexcept; + + constexpr inline QPoint topLeft() const noexcept; + constexpr inline QPoint bottomRight() const noexcept; + constexpr inline QPoint topRight() const noexcept; + constexpr inline QPoint bottomLeft() const noexcept; + constexpr inline QPoint center() const noexcept; + + constexpr inline void moveLeft(int pos) noexcept; + constexpr inline void moveTop(int pos) noexcept; + constexpr inline void moveRight(int pos) noexcept; + constexpr inline void moveBottom(int pos) noexcept; + constexpr inline void moveTopLeft(const QPoint &p) noexcept; + constexpr inline void moveBottomRight(const QPoint &p) noexcept; + constexpr inline void moveTopRight(const QPoint &p) noexcept; + constexpr inline void moveBottomLeft(const QPoint &p) noexcept; + constexpr inline void moveCenter(const QPoint &p) noexcept; + + constexpr inline void translate(int dx, int dy) noexcept; + constexpr inline void translate(const QPoint &p) noexcept; + [[nodiscard]] constexpr inline QRect translated(int dx, int dy) const noexcept; + [[nodiscard]] constexpr inline QRect translated(const QPoint &p) const noexcept; + [[nodiscard]] constexpr inline QRect transposed() const noexcept; + + constexpr inline void moveTo(int x, int t) noexcept; + constexpr inline void moveTo(const QPoint &p) noexcept; + + constexpr inline void setRect(int x, int y, int w, int h) noexcept; + constexpr inline void getRect(int *x, int *y, int *w, int *h) const; + + constexpr inline void setCoords(int x1, int y1, int x2, int y2) noexcept; + constexpr inline void getCoords(int *x1, int *y1, int *x2, int *y2) const; + + constexpr inline void adjust(int x1, int y1, int x2, int y2) noexcept; + [[nodiscard]] constexpr inline QRect adjusted(int x1, int y1, int x2, int y2) const noexcept; + + constexpr inline QSize size() const noexcept; + constexpr inline int width() const noexcept; + constexpr inline int height() const noexcept; + constexpr inline void setWidth(int w) noexcept; + constexpr inline void setHeight(int h) noexcept; + constexpr inline void setSize(const QSize &s) noexcept; + + QRect operator|(const QRect &r) const noexcept; + QRect operator&(const QRect &r) const noexcept; + inline QRect &operator|=(const QRect &r) noexcept; + inline QRect &operator&=(const QRect &r) noexcept; + + bool contains(const QRect &r, bool proper = false) const noexcept; + bool contains(const QPoint &p, bool proper = false) const noexcept; + inline bool contains(int x, int y) const noexcept; + inline bool contains(int x, int y, bool proper) const noexcept; + [[nodiscard]] inline QRect united(const QRect &other) const noexcept; + [[nodiscard]] inline QRect intersected(const QRect &other) const noexcept; + bool intersects(const QRect &r) const noexcept; + + constexpr inline QRect marginsAdded(const QMargins &margins) const noexcept; + constexpr inline QRect marginsRemoved(const QMargins &margins) const noexcept; + constexpr inline QRect &operator+=(const QMargins &margins) noexcept; + constexpr inline QRect &operator-=(const QMargins &margins) noexcept; + + [[nodiscard]] static constexpr inline QRect span(const QPoint &p1, const QPoint &p2) noexcept; + +private: + friend constexpr bool comparesEqual(const QRect &r1, const QRect &r2) noexcept + { return r1.x1==r2.x1 && r1.x2==r2.x2 && r1.y1==r2.y1 && r1.y2==r2.y2; } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QRect) + friend constexpr inline size_t qHash(const QRect &, size_t) noexcept; + +public: +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) + [[nodiscard]] CGRect toCGRect() const noexcept; +#endif + [[nodiscard]] constexpr inline QRectF toRectF() const noexcept; + +private: + int x1; + int y1; + int x2; + int y2; +}; +Q_DECLARE_TYPEINFO(QRect, Q_RELOCATABLE_TYPE); + + +/***************************************************************************** + QRect stream functions + *****************************************************************************/ +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QRect &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QRect &); +#endif + +/***************************************************************************** + QRect inline member functions + *****************************************************************************/ + +constexpr inline QRect::QRect(int aleft, int atop, int awidth, int aheight) noexcept + : x1(aleft), y1(atop), x2(aleft + awidth - 1), y2(atop + aheight - 1) {} + +constexpr inline QRect::QRect(const QPoint &atopLeft, const QPoint &abottomRight) noexcept + : x1(atopLeft.x()), y1(atopLeft.y()), x2(abottomRight.x()), y2(abottomRight.y()) {} + +constexpr inline QRect::QRect(const QPoint &atopLeft, const QSize &asize) noexcept + : x1(atopLeft.x()), y1(atopLeft.y()), x2(atopLeft.x()+asize.width() - 1), y2(atopLeft.y()+asize.height() - 1) {} + +constexpr inline bool QRect::isNull() const noexcept +{ return x2 == x1 - 1 && y2 == y1 - 1; } + +constexpr inline bool QRect::isEmpty() const noexcept +{ return x1 > x2 || y1 > y2; } + +constexpr inline bool QRect::isValid() const noexcept +{ return x1 <= x2 && y1 <= y2; } + +constexpr inline int QRect::left() const noexcept +{ return x1; } + +constexpr inline int QRect::top() const noexcept +{ return y1; } + +constexpr inline int QRect::right() const noexcept +{ return x2; } + +constexpr inline int QRect::bottom() const noexcept +{ return y2; } + +constexpr inline int QRect::x() const noexcept +{ return x1; } + +constexpr inline int QRect::y() const noexcept +{ return y1; } + +constexpr inline void QRect::setLeft(int pos) noexcept +{ x1 = pos; } + +constexpr inline void QRect::setTop(int pos) noexcept +{ y1 = pos; } + +constexpr inline void QRect::setRight(int pos) noexcept +{ x2 = pos; } + +constexpr inline void QRect::setBottom(int pos) noexcept +{ y2 = pos; } + +constexpr inline void QRect::setTopLeft(const QPoint &p) noexcept +{ x1 = p.x(); y1 = p.y(); } + +constexpr inline void QRect::setBottomRight(const QPoint &p) noexcept +{ x2 = p.x(); y2 = p.y(); } + +constexpr inline void QRect::setTopRight(const QPoint &p) noexcept +{ x2 = p.x(); y1 = p.y(); } + +constexpr inline void QRect::setBottomLeft(const QPoint &p) noexcept +{ x1 = p.x(); y2 = p.y(); } + +constexpr inline void QRect::setX(int ax) noexcept +{ x1 = ax; } + +constexpr inline void QRect::setY(int ay) noexcept +{ y1 = ay; } + +constexpr inline QPoint QRect::topLeft() const noexcept +{ return QPoint(x1, y1); } + +constexpr inline QPoint QRect::bottomRight() const noexcept +{ return QPoint(x2, y2); } + +constexpr inline QPoint QRect::topRight() const noexcept +{ return QPoint(x2, y1); } + +constexpr inline QPoint QRect::bottomLeft() const noexcept +{ return QPoint(x1, y2); } + +constexpr inline QPoint QRect::center() const noexcept +{ return QPoint(int((qint64(x1)+x2)/2), int((qint64(y1)+y2)/2)); } // cast avoids overflow on addition + +constexpr inline int QRect::width() const noexcept +{ return x2 - x1 + 1; } + +constexpr inline int QRect::height() const noexcept +{ return y2 - y1 + 1; } + +constexpr inline QSize QRect::size() const noexcept +{ return QSize(width(), height()); } + +constexpr inline void QRect::translate(int dx, int dy) noexcept +{ + x1 += dx; + y1 += dy; + x2 += dx; + y2 += dy; +} + +constexpr inline void QRect::translate(const QPoint &p) noexcept +{ + x1 += p.x(); + y1 += p.y(); + x2 += p.x(); + y2 += p.y(); +} + +constexpr inline QRect QRect::translated(int dx, int dy) const noexcept +{ return QRect(QPoint(x1 + dx, y1 + dy), QPoint(x2 + dx, y2 + dy)); } + +constexpr inline QRect QRect::translated(const QPoint &p) const noexcept +{ return QRect(QPoint(x1 + p.x(), y1 + p.y()), QPoint(x2 + p.x(), y2 + p.y())); } + +constexpr inline QRect QRect::transposed() const noexcept +{ return QRect(topLeft(), size().transposed()); } + +constexpr inline void QRect::moveTo(int ax, int ay) noexcept +{ + x2 += ax - x1; + y2 += ay - y1; + x1 = ax; + y1 = ay; +} + +constexpr inline void QRect::moveTo(const QPoint &p) noexcept +{ + x2 += p.x() - x1; + y2 += p.y() - y1; + x1 = p.x(); + y1 = p.y(); +} + +constexpr inline void QRect::moveLeft(int pos) noexcept +{ x2 += (pos - x1); x1 = pos; } + +constexpr inline void QRect::moveTop(int pos) noexcept +{ y2 += (pos - y1); y1 = pos; } + +constexpr inline void QRect::moveRight(int pos) noexcept +{ + x1 += (pos - x2); + x2 = pos; +} + +constexpr inline void QRect::moveBottom(int pos) noexcept +{ + y1 += (pos - y2); + y2 = pos; +} + +constexpr inline void QRect::moveTopLeft(const QPoint &p) noexcept +{ + moveLeft(p.x()); + moveTop(p.y()); +} + +constexpr inline void QRect::moveBottomRight(const QPoint &p) noexcept +{ + moveRight(p.x()); + moveBottom(p.y()); +} + +constexpr inline void QRect::moveTopRight(const QPoint &p) noexcept +{ + moveRight(p.x()); + moveTop(p.y()); +} + +constexpr inline void QRect::moveBottomLeft(const QPoint &p) noexcept +{ + moveLeft(p.x()); + moveBottom(p.y()); +} + +constexpr inline void QRect::moveCenter(const QPoint &p) noexcept +{ + int w = x2 - x1; + int h = y2 - y1; + x1 = p.x() - w/2; + y1 = p.y() - h/2; + x2 = x1 + w; + y2 = y1 + h; +} + +constexpr inline void QRect::getRect(int *ax, int *ay, int *aw, int *ah) const +{ + *ax = x1; + *ay = y1; + *aw = x2 - x1 + 1; + *ah = y2 - y1 + 1; +} + +constexpr inline void QRect::setRect(int ax, int ay, int aw, int ah) noexcept +{ + x1 = ax; + y1 = ay; + x2 = (ax + aw - 1); + y2 = (ay + ah - 1); +} + +constexpr inline void QRect::getCoords(int *xp1, int *yp1, int *xp2, int *yp2) const +{ + *xp1 = x1; + *yp1 = y1; + *xp2 = x2; + *yp2 = y2; +} + +constexpr inline void QRect::setCoords(int xp1, int yp1, int xp2, int yp2) noexcept +{ + x1 = xp1; + y1 = yp1; + x2 = xp2; + y2 = yp2; +} + +constexpr inline QRect QRect::adjusted(int xp1, int yp1, int xp2, int yp2) const noexcept +{ return QRect(QPoint(x1 + xp1, y1 + yp1), QPoint(x2 + xp2, y2 + yp2)); } + +constexpr inline void QRect::adjust(int dx1, int dy1, int dx2, int dy2) noexcept +{ + x1 += dx1; + y1 += dy1; + x2 += dx2; + y2 += dy2; +} + +constexpr inline void QRect::setWidth(int w) noexcept +{ x2 = (x1 + w - 1); } + +constexpr inline void QRect::setHeight(int h) noexcept +{ y2 = (y1 + h - 1); } + +constexpr inline void QRect::setSize(const QSize &s) noexcept +{ + x2 = (s.width() + x1 - 1); + y2 = (s.height() + y1 - 1); +} + +inline bool QRect::contains(int ax, int ay, bool aproper) const noexcept +{ + return contains(QPoint(ax, ay), aproper); +} + +inline bool QRect::contains(int ax, int ay) const noexcept +{ + return contains(QPoint(ax, ay), false); +} + +inline QRect &QRect::operator|=(const QRect &r) noexcept +{ + *this = *this | r; + return *this; +} + +inline QRect &QRect::operator&=(const QRect &r) noexcept +{ + *this = *this & r; + return *this; +} + +inline QRect QRect::intersected(const QRect &other) const noexcept +{ + return *this & other; +} + +inline QRect QRect::united(const QRect &r) const noexcept +{ + return *this | r; +} + +constexpr inline size_t qHash(const QRect &r, size_t seed = 0) noexcept +{ + return qHashMulti(seed, r.x1, r.x2, r.y1, r.y2); +} + +constexpr inline QRect operator+(const QRect &rectangle, const QMargins &margins) noexcept +{ + return QRect(QPoint(rectangle.left() - margins.left(), rectangle.top() - margins.top()), + QPoint(rectangle.right() + margins.right(), rectangle.bottom() + margins.bottom())); +} + +constexpr inline QRect operator+(const QMargins &margins, const QRect &rectangle) noexcept +{ + return QRect(QPoint(rectangle.left() - margins.left(), rectangle.top() - margins.top()), + QPoint(rectangle.right() + margins.right(), rectangle.bottom() + margins.bottom())); +} + +constexpr inline QRect operator-(const QRect &lhs, const QMargins &rhs) noexcept +{ + return QRect(QPoint(lhs.left() + rhs.left(), lhs.top() + rhs.top()), + QPoint(lhs.right() - rhs.right(), lhs.bottom() - rhs.bottom())); +} + +constexpr inline QRect QRect::marginsAdded(const QMargins &margins) const noexcept +{ + return QRect(QPoint(x1 - margins.left(), y1 - margins.top()), + QPoint(x2 + margins.right(), y2 + margins.bottom())); +} + +constexpr inline QRect QRect::marginsRemoved(const QMargins &margins) const noexcept +{ + return QRect(QPoint(x1 + margins.left(), y1 + margins.top()), + QPoint(x2 - margins.right(), y2 - margins.bottom())); +} + +constexpr inline QRect &QRect::operator+=(const QMargins &margins) noexcept +{ + *this = marginsAdded(margins); + return *this; +} + +constexpr inline QRect &QRect::operator-=(const QMargins &margins) noexcept +{ + *this = marginsRemoved(margins); + return *this; +} + +constexpr QRect QRect::span(const QPoint &p1, const QPoint &p2) noexcept +{ + return QRect(QPoint(qMin(p1.x(), p2.x()), qMin(p1.y(), p2.y())), + QPoint(qMax(p1.x(), p2.x()), qMax(p1.y(), p2.y()))); +} + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QRect &); +#endif + + +class Q_CORE_EXPORT QRectF +{ +public: + constexpr QRectF() noexcept : xp(0.), yp(0.), w(0.), h(0.) {} + constexpr QRectF(const QPointF &topleft, const QSizeF &size) noexcept; + constexpr QRectF(const QPointF &topleft, const QPointF &bottomRight) noexcept; + constexpr QRectF(qreal left, qreal top, qreal width, qreal height) noexcept; + constexpr QRectF(const QRect &rect) noexcept; + + constexpr inline bool isNull() const noexcept; + constexpr inline bool isEmpty() const noexcept; + constexpr inline bool isValid() const noexcept; + [[nodiscard]] QRectF normalized() const noexcept; + + constexpr inline qreal left() const noexcept { return xp; } + constexpr inline qreal top() const noexcept { return yp; } + constexpr inline qreal right() const noexcept { return xp + w; } + constexpr inline qreal bottom() const noexcept { return yp + h; } + + constexpr inline qreal x() const noexcept; + constexpr inline qreal y() const noexcept; + constexpr inline void setLeft(qreal pos) noexcept; + constexpr inline void setTop(qreal pos) noexcept; + constexpr inline void setRight(qreal pos) noexcept; + constexpr inline void setBottom(qreal pos) noexcept; + constexpr inline void setX(qreal pos) noexcept { setLeft(pos); } + constexpr inline void setY(qreal pos) noexcept { setTop(pos); } + + constexpr inline QPointF topLeft() const noexcept { return QPointF(xp, yp); } + constexpr inline QPointF bottomRight() const noexcept { return QPointF(xp+w, yp+h); } + constexpr inline QPointF topRight() const noexcept { return QPointF(xp+w, yp); } + constexpr inline QPointF bottomLeft() const noexcept { return QPointF(xp, yp+h); } + constexpr inline QPointF center() const noexcept; + + constexpr inline void setTopLeft(const QPointF &p) noexcept; + constexpr inline void setBottomRight(const QPointF &p) noexcept; + constexpr inline void setTopRight(const QPointF &p) noexcept; + constexpr inline void setBottomLeft(const QPointF &p) noexcept; + + constexpr inline void moveLeft(qreal pos) noexcept; + constexpr inline void moveTop(qreal pos) noexcept; + constexpr inline void moveRight(qreal pos) noexcept; + constexpr inline void moveBottom(qreal pos) noexcept; + constexpr inline void moveTopLeft(const QPointF &p) noexcept; + constexpr inline void moveBottomRight(const QPointF &p) noexcept; + constexpr inline void moveTopRight(const QPointF &p) noexcept; + constexpr inline void moveBottomLeft(const QPointF &p) noexcept; + constexpr inline void moveCenter(const QPointF &p) noexcept; + + constexpr inline void translate(qreal dx, qreal dy) noexcept; + constexpr inline void translate(const QPointF &p) noexcept; + + [[nodiscard]] constexpr inline QRectF translated(qreal dx, qreal dy) const noexcept; + [[nodiscard]] constexpr inline QRectF translated(const QPointF &p) const noexcept; + + [[nodiscard]] constexpr inline QRectF transposed() const noexcept; + + constexpr inline void moveTo(qreal x, qreal y) noexcept; + constexpr inline void moveTo(const QPointF &p) noexcept; + + constexpr inline void setRect(qreal x, qreal y, qreal w, qreal h) noexcept; + constexpr inline void getRect(qreal *x, qreal *y, qreal *w, qreal *h) const; + + constexpr inline void setCoords(qreal x1, qreal y1, qreal x2, qreal y2) noexcept; + constexpr inline void getCoords(qreal *x1, qreal *y1, qreal *x2, qreal *y2) const; + + constexpr inline void adjust(qreal x1, qreal y1, qreal x2, qreal y2) noexcept; + [[nodiscard]] constexpr inline QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const noexcept; + + constexpr inline QSizeF size() const noexcept; + constexpr inline qreal width() const noexcept; + constexpr inline qreal height() const noexcept; + constexpr inline void setWidth(qreal w) noexcept; + constexpr inline void setHeight(qreal h) noexcept; + constexpr inline void setSize(const QSizeF &s) noexcept; + + QRectF operator|(const QRectF &r) const noexcept; + QRectF operator&(const QRectF &r) const noexcept; + inline QRectF &operator|=(const QRectF &r) noexcept; + inline QRectF &operator&=(const QRectF &r) noexcept; + + bool contains(const QRectF &r) const noexcept; + bool contains(const QPointF &p) const noexcept; + inline bool contains(qreal x, qreal y) const noexcept; + [[nodiscard]] inline QRectF united(const QRectF &other) const noexcept; + [[nodiscard]] inline QRectF intersected(const QRectF &other) const noexcept; + bool intersects(const QRectF &r) const noexcept; + + constexpr inline QRectF marginsAdded(const QMarginsF &margins) const noexcept; + constexpr inline QRectF marginsRemoved(const QMarginsF &margins) const noexcept; + constexpr inline QRectF &operator+=(const QMarginsF &margins) noexcept; + constexpr inline QRectF &operator-=(const QMarginsF &margins) noexcept; + +private: + friend constexpr bool comparesEqual(const QRectF &r1, const QRectF &r2) noexcept + { + return r1.topLeft() == r2.topLeft() + && r1.size() == r2.size(); + } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QRectF) + + friend constexpr bool comparesEqual(const QRectF &r1, const QRect &r2) noexcept + { return r1.topLeft() == r2.topLeft() && r1.size() == r2.size(); } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QRectF, QRect) + + friend constexpr bool qFuzzyCompare(const QRectF &lhs, const QRectF &rhs) noexcept + { + return qFuzzyCompare(lhs.topLeft(), rhs.topLeft()) + && qFuzzyCompare(lhs.bottomRight(), rhs.bottomRight()); + } + + friend constexpr bool qFuzzyIsNull(const QRectF &rect) noexcept + { + return qFuzzyIsNull(rect.w) && qFuzzyIsNull(rect.h); + } + +public: + [[nodiscard]] constexpr inline QRect toRect() const noexcept; + [[nodiscard]] QRect toAlignedRect() const noexcept; + +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) + [[nodiscard]] static QRectF fromCGRect(CGRect rect) noexcept; + [[nodiscard]] CGRect toCGRect() const noexcept; +#endif + +#if defined(Q_OS_WASM) || defined(Q_QDOC) + [[nodiscard]] static QRectF fromDOMRect(emscripten::val domRect); + [[nodiscard]] emscripten::val toDOMRect() const; +#endif + +private: + qreal xp; + qreal yp; + qreal w; + qreal h; +}; +Q_DECLARE_TYPEINFO(QRectF, Q_RELOCATABLE_TYPE); + + +/***************************************************************************** + QRectF stream functions + *****************************************************************************/ +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QRectF &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QRectF &); +#endif + +/***************************************************************************** + QRectF inline member functions + *****************************************************************************/ + +constexpr inline QRectF::QRectF(qreal aleft, qreal atop, qreal awidth, qreal aheight) noexcept + : xp(aleft), yp(atop), w(awidth), h(aheight) +{ +} + +constexpr inline QRectF::QRectF(const QPointF &atopLeft, const QSizeF &asize) noexcept + : xp(atopLeft.x()), yp(atopLeft.y()), w(asize.width()), h(asize.height()) +{ +} + + +constexpr inline QRectF::QRectF(const QPointF &atopLeft, const QPointF &abottomRight) noexcept + : xp(atopLeft.x()), yp(atopLeft.y()), w(abottomRight.x() - atopLeft.x()), h(abottomRight.y() - atopLeft.y()) +{ +} + +constexpr inline QRectF::QRectF(const QRect &r) noexcept + : xp(r.x()), yp(r.y()), w(r.width()), h(r.height()) +{ +} + +QT_WARNING_PUSH +QT_WARNING_DISABLE_FLOAT_COMPARE + +constexpr inline bool QRectF::isNull() const noexcept +{ return w == 0. && h == 0.; } + +constexpr inline bool QRectF::isEmpty() const noexcept +{ return w <= 0. || h <= 0.; } + +QT_WARNING_POP + +constexpr inline bool QRectF::isValid() const noexcept +{ return w > 0. && h > 0.; } + +constexpr inline qreal QRectF::x() const noexcept +{ return xp; } + +constexpr inline qreal QRectF::y() const noexcept +{ return yp; } + +constexpr inline void QRectF::setLeft(qreal pos) noexcept +{ qreal diff = pos - xp; xp += diff; w -= diff; } + +constexpr inline void QRectF::setRight(qreal pos) noexcept +{ w = pos - xp; } + +constexpr inline void QRectF::setTop(qreal pos) noexcept +{ qreal diff = pos - yp; yp += diff; h -= diff; } + +constexpr inline void QRectF::setBottom(qreal pos) noexcept +{ h = pos - yp; } + +constexpr inline void QRectF::setTopLeft(const QPointF &p) noexcept +{ setLeft(p.x()); setTop(p.y()); } + +constexpr inline void QRectF::setTopRight(const QPointF &p) noexcept +{ setRight(p.x()); setTop(p.y()); } + +constexpr inline void QRectF::setBottomLeft(const QPointF &p) noexcept +{ setLeft(p.x()); setBottom(p.y()); } + +constexpr inline void QRectF::setBottomRight(const QPointF &p) noexcept +{ setRight(p.x()); setBottom(p.y()); } + +constexpr inline QPointF QRectF::center() const noexcept +{ return QPointF(xp + w/2, yp + h/2); } + +constexpr inline void QRectF::moveLeft(qreal pos) noexcept +{ xp = pos; } + +constexpr inline void QRectF::moveTop(qreal pos) noexcept +{ yp = pos; } + +constexpr inline void QRectF::moveRight(qreal pos) noexcept +{ xp = pos - w; } + +constexpr inline void QRectF::moveBottom(qreal pos) noexcept +{ yp = pos - h; } + +constexpr inline void QRectF::moveTopLeft(const QPointF &p) noexcept +{ moveLeft(p.x()); moveTop(p.y()); } + +constexpr inline void QRectF::moveTopRight(const QPointF &p) noexcept +{ moveRight(p.x()); moveTop(p.y()); } + +constexpr inline void QRectF::moveBottomLeft(const QPointF &p) noexcept +{ moveLeft(p.x()); moveBottom(p.y()); } + +constexpr inline void QRectF::moveBottomRight(const QPointF &p) noexcept +{ moveRight(p.x()); moveBottom(p.y()); } + +constexpr inline void QRectF::moveCenter(const QPointF &p) noexcept +{ xp = p.x() - w/2; yp = p.y() - h/2; } + +constexpr inline qreal QRectF::width() const noexcept +{ return w; } + +constexpr inline qreal QRectF::height() const noexcept +{ return h; } + +constexpr inline QSizeF QRectF::size() const noexcept +{ return QSizeF(w, h); } + +constexpr inline void QRectF::translate(qreal dx, qreal dy) noexcept +{ + xp += dx; + yp += dy; +} + +constexpr inline void QRectF::translate(const QPointF &p) noexcept +{ + xp += p.x(); + yp += p.y(); +} + +constexpr inline void QRectF::moveTo(qreal ax, qreal ay) noexcept +{ + xp = ax; + yp = ay; +} + +constexpr inline void QRectF::moveTo(const QPointF &p) noexcept +{ + xp = p.x(); + yp = p.y(); +} + +constexpr inline QRectF QRectF::translated(qreal dx, qreal dy) const noexcept +{ + return QRectF(xp + dx, yp + dy, w, h); +} + +constexpr inline QRectF QRectF::translated(const QPointF &p) const noexcept +{ return QRectF(xp + p.x(), yp + p.y(), w, h); } + +constexpr inline QRectF QRectF::transposed() const noexcept +{ return QRectF(topLeft(), size().transposed()); } + +constexpr inline void QRectF::getRect(qreal *ax, qreal *ay, qreal *aaw, qreal *aah) const +{ + *ax = this->xp; + *ay = this->yp; + *aaw = this->w; + *aah = this->h; +} + +constexpr inline void QRectF::setRect(qreal ax, qreal ay, qreal aaw, qreal aah) noexcept +{ + this->xp = ax; + this->yp = ay; + this->w = aaw; + this->h = aah; +} + +constexpr inline void QRectF::getCoords(qreal *xp1, qreal *yp1, qreal *xp2, qreal *yp2) const +{ + *xp1 = xp; + *yp1 = yp; + *xp2 = xp + w; + *yp2 = yp + h; +} + +constexpr inline void QRectF::setCoords(qreal xp1, qreal yp1, qreal xp2, qreal yp2) noexcept +{ + xp = xp1; + yp = yp1; + w = xp2 - xp1; + h = yp2 - yp1; +} + +constexpr inline void QRectF::adjust(qreal xp1, qreal yp1, qreal xp2, qreal yp2) noexcept +{ + xp += xp1; + yp += yp1; + w += xp2 - xp1; + h += yp2 - yp1; +} + +constexpr inline QRectF QRectF::adjusted(qreal xp1, qreal yp1, qreal xp2, qreal yp2) const noexcept +{ + return QRectF(xp + xp1, yp + yp1, w + xp2 - xp1, h + yp2 - yp1); +} + +constexpr inline void QRectF::setWidth(qreal aw) noexcept +{ this->w = aw; } + +constexpr inline void QRectF::setHeight(qreal ah) noexcept +{ this->h = ah; } + +constexpr inline void QRectF::setSize(const QSizeF &s) noexcept +{ + w = s.width(); + h = s.height(); +} + +inline bool QRectF::contains(qreal ax, qreal ay) const noexcept +{ + return contains(QPointF(ax, ay)); +} + +inline QRectF &QRectF::operator|=(const QRectF &r) noexcept +{ + *this = *this | r; + return *this; +} + +inline QRectF &QRectF::operator&=(const QRectF &r) noexcept +{ + *this = *this & r; + return *this; +} + +inline QRectF QRectF::intersected(const QRectF &r) const noexcept +{ + return *this & r; +} + +inline QRectF QRectF::united(const QRectF &r) const noexcept +{ + return *this | r; +} + +constexpr QRectF QRect::toRectF() const noexcept { return *this; } + +constexpr inline QRect QRectF::toRect() const noexcept +{ + // This rounding is designed to minimize the maximum possible difference + // in topLeft(), bottomRight(), and size() after rounding. + // All dimensions are at most off by 0.75, and topLeft by at most 0.5. + const int nxp = qRound(xp); + const int nyp = qRound(yp); + const int nw = qRound(w + (xp - nxp) / 2); + const int nh = qRound(h + (yp - nyp) / 2); + return QRect(nxp, nyp, nw, nh); +} + +constexpr inline QRectF operator+(const QRectF &lhs, const QMarginsF &rhs) noexcept +{ + return QRectF(QPointF(lhs.left() - rhs.left(), lhs.top() - rhs.top()), + QSizeF(lhs.width() + rhs.left() + rhs.right(), lhs.height() + rhs.top() + rhs.bottom())); +} + +constexpr inline QRectF operator+(const QMarginsF &lhs, const QRectF &rhs) noexcept +{ + return QRectF(QPointF(rhs.left() - lhs.left(), rhs.top() - lhs.top()), + QSizeF(rhs.width() + lhs.left() + lhs.right(), rhs.height() + lhs.top() + lhs.bottom())); +} + +constexpr inline QRectF operator-(const QRectF &lhs, const QMarginsF &rhs) noexcept +{ + return QRectF(QPointF(lhs.left() + rhs.left(), lhs.top() + rhs.top()), + QSizeF(lhs.width() - rhs.left() - rhs.right(), lhs.height() - rhs.top() - rhs.bottom())); +} + +constexpr inline QRectF QRectF::marginsAdded(const QMarginsF &margins) const noexcept +{ + return QRectF(QPointF(xp - margins.left(), yp - margins.top()), + QSizeF(w + margins.left() + margins.right(), h + margins.top() + margins.bottom())); +} + +constexpr inline QRectF QRectF::marginsRemoved(const QMarginsF &margins) const noexcept +{ + return QRectF(QPointF(xp + margins.left(), yp + margins.top()), + QSizeF(w - margins.left() - margins.right(), h - margins.top() - margins.bottom())); +} + +constexpr inline QRectF &QRectF::operator+=(const QMarginsF &margins) noexcept +{ + *this = marginsAdded(margins); + return *this; +} + +constexpr inline QRectF &QRectF::operator-=(const QMarginsF &margins) noexcept +{ + *this = marginsRemoved(margins); + return *this; +} + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QRectF &); +#endif + +QT_END_NAMESPACE + +#endif // QRECT_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qrefcount.h b/qt/6.8.1/msvc2022_64/include/QtCore/qrefcount.h new file mode 100644 index 0000000000000000000000000000000000000000..32983f24734c0b1bc7812ed052e67b9a77b90013 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qrefcount.h @@ -0,0 +1,56 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QREFCOUNT_H +#define QREFCOUNT_H + +#include + +QT_BEGIN_NAMESPACE + + +namespace QtPrivate +{ + +class RefCount +{ +public: + inline bool ref() noexcept { + int count = atomic.loadRelaxed(); + if (count != -1) // !isStatic + atomic.ref(); + return true; + } + + inline bool deref() noexcept { + int count = atomic.loadRelaxed(); + if (count == -1) // isStatic + return true; + return atomic.deref(); + } + + bool isStatic() const noexcept + { + // Persistent object, never deleted + return atomic.loadRelaxed() == -1; + } + + bool isShared() const noexcept + { + int count = atomic.loadRelaxed(); + return (count != 1) && (count != 0); + } + + void initializeOwned() noexcept { atomic.storeRelaxed(1); } + void initializeUnsharable() noexcept { atomic.storeRelaxed(0); } + + QBasicAtomicInt atomic; +}; + +} + +#define Q_REFCOUNT_INITIALIZE_STATIC { Q_BASIC_ATOMIC_INITIALIZER(-1) } + +QT_END_NAMESPACE + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qregularexpression.h b/qt/6.8.1/msvc2022_64/include/QtCore/qregularexpression.h new file mode 100644 index 0000000000000000000000000000000000000000..92afd8a96ebfbe5479a057c0bc3cc03fc7cdaf21 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qregularexpression.h @@ -0,0 +1,402 @@ +// Copyright (C) 2020 Giuseppe D'Angelo . +// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QREGULAREXPRESSION_H +#define QREGULAREXPRESSION_H + +#include +#include +#include +#include +#include + +#include + +QT_REQUIRE_CONFIG(regularexpression); + +QT_BEGIN_NAMESPACE + +class QRegularExpressionMatch; +class QRegularExpressionMatchIterator; +struct QRegularExpressionPrivate; +class QRegularExpression; + +QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QRegularExpressionPrivate, Q_CORE_EXPORT) + +Q_CORE_EXPORT size_t qHash(const QRegularExpression &key, size_t seed = 0) noexcept; + +class Q_CORE_EXPORT QRegularExpression +{ +public: + enum PatternOption { + NoPatternOption = 0x0000, + CaseInsensitiveOption = 0x0001, + DotMatchesEverythingOption = 0x0002, + MultilineOption = 0x0004, + ExtendedPatternSyntaxOption = 0x0008, + InvertedGreedinessOption = 0x0010, + DontCaptureOption = 0x0020, + UseUnicodePropertiesOption = 0x0040, + // Formerly (no-ops deprecated in 5.12, removed 6.0): + // OptimizeOnFirstUsageOption = 0x0080, + // DontAutomaticallyOptimizeOption = 0x0100, + }; + Q_DECLARE_FLAGS(PatternOptions, PatternOption) + + PatternOptions patternOptions() const; + void setPatternOptions(PatternOptions options); + + QRegularExpression(); + explicit QRegularExpression(const QString &pattern, PatternOptions options = NoPatternOption); + QRegularExpression(const QRegularExpression &re) noexcept; + QRegularExpression(QRegularExpression &&re) = default; + ~QRegularExpression(); + QRegularExpression &operator=(const QRegularExpression &re) noexcept; + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QRegularExpression) + + void swap(QRegularExpression &other) noexcept { d.swap(other.d); } + + QString pattern() const; + void setPattern(const QString &pattern); + + [[nodiscard]] + bool isValid() const; + qsizetype patternErrorOffset() const; + QString errorString() const; + + int captureCount() const; + QStringList namedCaptureGroups() const; + + enum MatchType { + NormalMatch = 0, + PartialPreferCompleteMatch, + PartialPreferFirstMatch, + NoMatch + }; + + enum MatchOption { + NoMatchOption = 0x0000, + AnchorAtOffsetMatchOption = 0x0001, + AnchoredMatchOption Q_DECL_ENUMERATOR_DEPRECATED_X( + "Use AnchorAtOffsetMatchOption instead") = AnchorAtOffsetMatchOption, // Rename@Qt6.0 + DontCheckSubjectStringMatchOption = 0x0002 + }; + Q_DECLARE_FLAGS(MatchOptions, MatchOption) + + [[nodiscard]] + QRegularExpressionMatch match(const QString &subject, + qsizetype offset = 0, + MatchType matchType = NormalMatch, + MatchOptions matchOptions = NoMatchOption) const; + +#if QT_DEPRECATED_SINCE(6, 8) + [[nodiscard]] + QT_DEPRECATED_VERSION_X_6_8("Use matchView instead.") + QRegularExpressionMatch match(QStringView subjectView, + qsizetype offset = 0, + MatchType matchType = NormalMatch, + MatchOptions matchOptions = NoMatchOption) const; +#endif + + [[nodiscard]] + QRegularExpressionMatch matchView(QStringView subjectView, + qsizetype offset = 0, + MatchType matchType = NormalMatch, + MatchOptions matchOptions = NoMatchOption) const; + + [[nodiscard]] + QRegularExpressionMatchIterator globalMatch(const QString &subject, + qsizetype offset = 0, + MatchType matchType = NormalMatch, + MatchOptions matchOptions = NoMatchOption) const; + +#if QT_DEPRECATED_SINCE(6, 8) + [[nodiscard]] + QT_DEPRECATED_VERSION_X_6_8("Use globalMatchView instead.") + QRegularExpressionMatchIterator globalMatch(QStringView subjectView, + qsizetype offset = 0, + MatchType matchType = NormalMatch, + MatchOptions matchOptions = NoMatchOption) const; +#endif + + [[nodiscard]] + QRegularExpressionMatchIterator globalMatchView(QStringView subjectView, + qsizetype offset = 0, + MatchType matchType = NormalMatch, + MatchOptions matchOptions = NoMatchOption) const; + + void optimize() const; + + enum WildcardConversionOption { + DefaultWildcardConversion = 0x0, + UnanchoredWildcardConversion = 0x1, + NonPathWildcardConversion = 0x2, + }; + Q_DECLARE_FLAGS(WildcardConversionOptions, WildcardConversionOption) + + static QString escape(const QString &str) + { + return escape(qToStringViewIgnoringNull(str)); + } + + static QString wildcardToRegularExpression(const QString &str, WildcardConversionOptions options = DefaultWildcardConversion) + { + return wildcardToRegularExpression(qToStringViewIgnoringNull(str), options); + } + + static inline QString anchoredPattern(const QString &expression) + { + return anchoredPattern(qToStringViewIgnoringNull(expression)); + } + + static QString escape(QStringView str); + static QString wildcardToRegularExpression(QStringView str, WildcardConversionOptions options = DefaultWildcardConversion); + static QString anchoredPattern(QStringView expression); + + static QRegularExpression fromWildcard(QStringView pattern, Qt::CaseSensitivity cs = Qt::CaseInsensitive, + WildcardConversionOptions options = DefaultWildcardConversion); +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator==(const QRegularExpression &re) const; + inline bool operator!=(const QRegularExpression &re) const { return !operator==(re); } +#endif +private: + friend Q_CORE_EXPORT bool comparesEqual(const QRegularExpression &lhs, + const QRegularExpression &rhs) noexcept; + Q_DECLARE_EQUALITY_COMPARABLE(QRegularExpression) + + friend struct QRegularExpressionPrivate; + friend class QRegularExpressionMatch; + friend struct QRegularExpressionMatchPrivate; + friend class QRegularExpressionMatchIterator; + friend Q_CORE_EXPORT size_t qHash(const QRegularExpression &key, size_t seed) noexcept; + + QRegularExpression(QRegularExpressionPrivate &dd); + QExplicitlySharedDataPointer d; +}; + +Q_DECLARE_SHARED(QRegularExpression) +Q_DECLARE_OPERATORS_FOR_FLAGS(QRegularExpression::PatternOptions) +Q_DECLARE_OPERATORS_FOR_FLAGS(QRegularExpression::MatchOptions) +Q_DECLARE_OPERATORS_FOR_FLAGS(QRegularExpression::WildcardConversionOptions) + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &out, const QRegularExpression &re); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &in, QRegularExpression &re); +#endif + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QRegularExpression &re); +Q_CORE_EXPORT QDebug operator<<(QDebug debug, QRegularExpression::PatternOptions patternOptions); +#endif + +struct QRegularExpressionMatchPrivate; +QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QRegularExpressionMatchPrivate, Q_CORE_EXPORT) + +class Q_CORE_EXPORT QRegularExpressionMatch +{ +public: + QRegularExpressionMatch(); + ~QRegularExpressionMatch(); + QRegularExpressionMatch(const QRegularExpressionMatch &match); + QRegularExpressionMatch(QRegularExpressionMatch &&match) = default; + QRegularExpressionMatch &operator=(const QRegularExpressionMatch &match); + QRegularExpressionMatch &operator=(QRegularExpressionMatch &&match) noexcept + { d.swap(match.d); return *this; } + void swap(QRegularExpressionMatch &other) noexcept { d.swap(other.d); } + + QRegularExpression regularExpression() const; + QRegularExpression::MatchType matchType() const; + QRegularExpression::MatchOptions matchOptions() const; + + bool hasMatch() const; + bool hasPartialMatch() const; + + bool isValid() const; + + int lastCapturedIndex() const; + +#if QT_CORE_REMOVED_SINCE(6, 8) + bool hasCaptured(const QString &name) const + { return hasCaptured(qToAnyStringViewIgnoringNull(name)); } + bool hasCaptured(QStringView name) const; +#endif + bool hasCaptured(QAnyStringView name) const; + bool hasCaptured(int nth) const; + + QString captured(int nth = 0) const; + QStringView capturedView(int nth = 0) const; + +#if QT_CORE_REMOVED_SINCE(6, 8) + QString captured(const QString &name) const + { return captured(qToAnyStringViewIgnoringNull(name)); } + + QString captured(QStringView name) const; + QStringView capturedView(QStringView name) const; +#endif + QString captured(QAnyStringView name) const; + QStringView capturedView(QAnyStringView name) const; + + QStringList capturedTexts() const; + + qsizetype capturedStart(int nth = 0) const; + qsizetype capturedLength(int nth = 0) const; + qsizetype capturedEnd(int nth = 0) const; + +#if QT_CORE_REMOVED_SINCE(6, 8) + qsizetype capturedStart(const QString &name) const + { return capturedStart(qToAnyStringViewIgnoringNull(name)); } + qsizetype capturedLength(const QString &name) const + { return capturedLength(qToAnyStringViewIgnoringNull(name)); } + qsizetype capturedEnd(const QString &name) const + { return capturedEnd(qToAnyStringViewIgnoringNull(name)); } + + qsizetype capturedStart(QStringView name) const; + qsizetype capturedLength(QStringView name) const; + qsizetype capturedEnd(QStringView name) const; +#endif + qsizetype capturedStart(QAnyStringView name) const; + qsizetype capturedLength(QAnyStringView name) const; + qsizetype capturedEnd(QAnyStringView name) const; + +private: + friend class QRegularExpression; + friend struct QRegularExpressionMatchPrivate; + friend class QRegularExpressionMatchIterator; + + QRegularExpressionMatch(QRegularExpressionMatchPrivate &dd); + QExplicitlySharedDataPointer d; +}; + +Q_DECLARE_SHARED(QRegularExpressionMatch) + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QRegularExpressionMatch &match); +#endif + +namespace QtPrivate { +class QRegularExpressionMatchIteratorRangeBasedForIterator; +class QRegularExpressionMatchIteratorRangeBasedForIteratorSentinel {}; +} + +struct QRegularExpressionMatchIteratorPrivate; +QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QRegularExpressionMatchIteratorPrivate, Q_CORE_EXPORT) + +class Q_CORE_EXPORT QRegularExpressionMatchIterator +{ +public: + QRegularExpressionMatchIterator(); + ~QRegularExpressionMatchIterator(); + QRegularExpressionMatchIterator(const QRegularExpressionMatchIterator &iterator); + QRegularExpressionMatchIterator(QRegularExpressionMatchIterator &&iterator) = default; + QRegularExpressionMatchIterator &operator=(const QRegularExpressionMatchIterator &iterator); + QRegularExpressionMatchIterator &operator=(QRegularExpressionMatchIterator &&iterator) noexcept + { d.swap(iterator.d); return *this; } + void swap(QRegularExpressionMatchIterator &other) noexcept { d.swap(other.d); } + + bool isValid() const; + + bool hasNext() const; + QRegularExpressionMatch next(); + QRegularExpressionMatch peekNext() const; + + QRegularExpression regularExpression() const; + QRegularExpression::MatchType matchType() const; + QRegularExpression::MatchOptions matchOptions() const; + +private: + friend class QRegularExpression; + friend Q_CORE_EXPORT QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator); + friend QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIteratorSentinel end(const QRegularExpressionMatchIterator &) { return {}; } + + QRegularExpressionMatchIterator(QRegularExpressionMatchIteratorPrivate &dd); + QExplicitlySharedDataPointer d; +}; + +namespace QtPrivate { + +// support for range-based for loop +class QRegularExpressionMatchIteratorRangeBasedForIterator +{ +public: + using value_type = QRegularExpressionMatch; + using difference_type = int; + using reference_type = const QRegularExpressionMatch &; + using pointer_type = const QRegularExpressionMatch *; + using iterator_category = std::forward_iterator_tag; + + QRegularExpressionMatchIteratorRangeBasedForIterator() + : m_atEnd(true) + { + } + + explicit QRegularExpressionMatchIteratorRangeBasedForIterator(const QRegularExpressionMatchIterator &iterator) + : m_matchIterator(iterator), + m_currentMatch(), + m_atEnd(false) + { + ++*this; + } + + const QRegularExpressionMatch &operator*() const + { + Q_ASSERT_X(!m_atEnd, Q_FUNC_INFO, "operator* called on an iterator already at the end"); + return m_currentMatch; + } + + QRegularExpressionMatchIteratorRangeBasedForIterator &operator++() + { + Q_ASSERT_X(!m_atEnd, Q_FUNC_INFO, "operator++ called on an iterator already at the end"); + if (m_matchIterator.hasNext()) { + m_currentMatch = m_matchIterator.next(); + } else { + m_currentMatch = QRegularExpressionMatch(); + m_atEnd = true; + } + + return *this; + } + + QRegularExpressionMatchIteratorRangeBasedForIterator operator++(int) + { + QRegularExpressionMatchIteratorRangeBasedForIterator i = *this; + ++*this; + return i; + } + +private: + // [input.iterators] imposes operator== on us. Unfortunately, it's not + // trivial to implement, so just do the bare minimum to satifisfy + // Cpp17EqualityComparable. + friend bool comparesEqual(const QRegularExpressionMatchIteratorRangeBasedForIterator &lhs, + const QRegularExpressionMatchIteratorRangeBasedForIterator &rhs) + noexcept + { + return (&lhs == &rhs); + } + Q_DECLARE_EQUALITY_COMPARABLE(QRegularExpressionMatchIteratorRangeBasedForIterator) + + // This is what we really use in a range-based for. + friend bool comparesEqual(const QRegularExpressionMatchIteratorRangeBasedForIterator &lhs, + const QRegularExpressionMatchIteratorRangeBasedForIteratorSentinel &rhs) + noexcept + { + Q_UNUSED(rhs); + return lhs.m_atEnd; + } + Q_DECLARE_EQUALITY_COMPARABLE(QRegularExpressionMatchIteratorRangeBasedForIterator, + QRegularExpressionMatchIteratorRangeBasedForIteratorSentinel) + + QRegularExpressionMatchIterator m_matchIterator; + QRegularExpressionMatch m_currentMatch; + bool m_atEnd; +}; + +} // namespace QtPrivate + +Q_DECLARE_SHARED(QRegularExpressionMatchIterator) + +QT_END_NAMESPACE + +#endif // QREGULAREXPRESSION_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qresource.h b/qt/6.8.1/msvc2022_64/include/QtCore/qresource.h new file mode 100644 index 0000000000000000000000000000000000000000..a8b328c60473b0f15091a96ba88a09b257f4a74e --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qresource.h @@ -0,0 +1,69 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2019 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QRESOURCE_H +#define QRESOURCE_H + +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + + +class QResourcePrivate; + +class Q_CORE_EXPORT QResource +{ +public: + enum Compression { + NoCompression, + ZlibCompression, + ZstdCompression + }; + + QResource(const QString &file = QString(), const QLocale &locale = QLocale()); + ~QResource(); + + void setFileName(const QString &file); + QString fileName() const; + QString absoluteFilePath() const; + + void setLocale(const QLocale &locale); + QLocale locale() const; + + bool isValid() const; + + Compression compressionAlgorithm() const; + qint64 size() const; + const uchar *data() const; + qint64 uncompressedSize() const; + QByteArray uncompressedData() const; + QDateTime lastModified() const; + + static bool registerResource(const QString &rccFilename, const QString &resourceRoot=QString()); + static bool unregisterResource(const QString &rccFilename, const QString &resourceRoot=QString()); + + static bool registerResource(const uchar *rccData, const QString &resourceRoot=QString()); + static bool unregisterResource(const uchar *rccData, const QString &resourceRoot=QString()); + +protected: + friend class QResourceFileEngine; + friend class QResourceFileEngineIterator; + bool isDir() const; + inline bool isFile() const { return !isDir(); } + QStringList children() const; + +protected: + QScopedPointer d_ptr; + +private: + Q_DECLARE_PRIVATE(QResource) +}; + +QT_END_NAMESPACE + +#endif // QRESOURCE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qresultstore.h b/qt/6.8.1/msvc2022_64/include/QtCore/qresultstore.h new file mode 100644 index 0000000000000000000000000000000000000000..9afc98c8e1b3d58ef39bd8aa83196d79dfe658f9 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qresultstore.h @@ -0,0 +1,238 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTCORE_RESULTSTORE_H +#define QTCORE_RESULTSTORE_H + +#include + +#include + +QT_REQUIRE_CONFIG(future); + +QT_BEGIN_NAMESPACE + +/* + ResultStore stores indexed results. Results can be added and retrieved + either individually batched in a QList. Retriveing results and checking + which indexes are in the store can be done either by iterating or by random + access. In addition results can be removed from the front of the store, + either individually or in batches. +*/ + +namespace QtPrivate { + +class ResultItem +{ +public: + ResultItem(const void *_result, int _count) : m_count(_count), result(_result) { } // construct with vector of results + ResultItem(const void *_result) : m_count(0), result(_result) { } // construct with result + ResultItem() : m_count(0), result(nullptr) { } + bool isValid() const { return result != nullptr; } + bool isVector() const { return m_count != 0; } + int count() const { return (m_count == 0) ? 1 : m_count; } + int m_count; // result is either a pointer to a result or to a vector of results, + const void *result; // if count is 0 it's a result, otherwise it's a vector. +}; + +class Q_CORE_EXPORT ResultIteratorBase +{ +public: + ResultIteratorBase(); + ResultIteratorBase(QMap::const_iterator _mapIterator, int _vectorIndex = 0); + int vectorIndex() const; + int resultIndex() const; + + ResultIteratorBase operator++(); + int batchSize() const; + void batchedAdvance(); +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator==(const ResultIteratorBase &other) const; + bool operator!=(const ResultIteratorBase &other) const; +#endif + bool isVector() const; + bool canIncrementVectorIndex() const; + bool isValid() const; + +private: + friend bool comparesEqual(const ResultIteratorBase &lhs, + const ResultIteratorBase &rhs) + { + return (lhs.mapIterator == rhs.mapIterator && lhs.m_vectorIndex == rhs.m_vectorIndex); + } + Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(ResultIteratorBase) +protected: + QMap::const_iterator mapIterator; + int m_vectorIndex; +public: + template + const T &value() const + { + return *pointer(); + } + + template + T &value() + { + return *pointer(); + } + + template + T *pointer() + { + const T *p = std::as_const(*this).pointer(); + return const_cast(p); + } + + template + const T *pointer() const + { + if (mapIterator.value().isVector()) + return &(reinterpret_cast *>(mapIterator.value().result)->at(m_vectorIndex)); + else + return reinterpret_cast(mapIterator.value().result); + } +}; + +class Q_CORE_EXPORT ResultStoreBase final +{ +public: + ResultStoreBase(); + void setFilterMode(bool enable); + bool filterMode() const; + int addResult(int index, const void *result); + int addResults(int index, const void *results, int vectorSize, int logicalCount); + ResultIteratorBase begin() const; + ResultIteratorBase end() const; + bool hasNextResult() const; + ResultIteratorBase resultAt(int index) const; + bool contains(int index) const; + int count() const; + // ### Qt 7: 'virtual' isn't required, can be removed, along with renaming + // the class to ResultStore and changing the members below to be private. + virtual ~ResultStoreBase(); + +protected: + int insertResultItem(int index, ResultItem &resultItem); + void insertResultItemIfValid(int index, ResultItem &resultItem); + bool containsValidResultItem(int index) const; + void syncPendingResults(); + void syncResultCount(); + int updateInsertIndex(int index, int _count); + + QMap m_results; + int insertIndex; // The index where the next results(s) will be inserted. + int resultCount; // The number of consecutive results stored, starting at index 0. + + bool m_filterMode; + QMap pendingResults; + int filteredResults; + + template + static void clear(QMap &store) + { + QMap::const_iterator mapIterator = store.constBegin(); + while (mapIterator != store.constEnd()) { + if (mapIterator.value().isVector()) + delete reinterpret_cast *>(mapIterator.value().result); + else + delete reinterpret_cast(mapIterator.value().result); + ++mapIterator; + } + store.clear(); + } + +public: + template + int emplaceResult(int index, Args&&...args) + { + if (containsValidResultItem(index)) // reject if already present + return -1; + return addResult(index, static_cast(new T(std::forward(args)...))); + } + + template + int addResult(int index, const T *result) + { + if (containsValidResultItem(index)) // reject if already present + return -1; + + if (result == nullptr) + return addResult(index, static_cast(nullptr)); + + return addResult(index, static_cast(new T(*result))); + } + + template + int moveResult(int index, T &&result) + { + static_assert(!std::is_reference_v, "trying to move from an lvalue!"); + + return emplaceResult>(index, std::forward(result)); + } + + template + int addResults(int index, const QList *results) + { + if (results->empty()) // reject if results are empty + return -1; + + if (containsValidResultItem(index)) // reject if already present + return -1; + + return addResults(index, new QList(*results), results->size(), results->size()); + } + + template + int addResults(int index, const QList *results, int totalCount) + { + // reject if results are empty, and nothing is filtered away + if ((m_filterMode == false || results->size() == totalCount) && results->empty()) + return -1; + + if (containsValidResultItem(index)) // reject if already present + return -1; + + if (m_filterMode == true && results->size() != totalCount && 0 == results->size()) + return addResults(index, nullptr, 0, totalCount); + + return addResults(index, new QList(*results), results->size(), totalCount); + } + + int addCanceledResult(int index) + { + if (containsValidResultItem(index)) // reject if already present + return -1; + + return addResult(index, static_cast(nullptr)); + } + + template + int addCanceledResults(int index, int _count) + { + if (containsValidResultItem(index)) // reject if already present + return -1; + + QList empty; + return addResults(index, &empty, _count); + } + + template + void clear() + { + ResultStoreBase::clear(m_results); + resultCount = 0; + insertIndex = 0; + ResultStoreBase::clear(pendingResults); + filteredResults = 0; + } +}; + +} // namespace QtPrivate + +Q_DECLARE_TYPEINFO(QtPrivate::ResultItem, Q_PRIMITIVE_TYPE); + + +QT_END_NAMESPACE + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qrunnable.h b/qt/6.8.1/msvc2022_64/include/QtCore/qrunnable.h new file mode 100644 index 0000000000000000000000000000000000000000..03c0fe4500a3cec3cd12d59b1a52bf68b547134d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qrunnable.h @@ -0,0 +1,137 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QRUNNABLE_H +#define QRUNNABLE_H + +#include +#include +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +class Q_CORE_EXPORT QRunnable +{ + bool m_autoDelete = true; + + Q_DISABLE_COPY(QRunnable) +public: + virtual void run() = 0; + + constexpr QRunnable() noexcept = default; + virtual ~QRunnable(); +#if QT_CORE_REMOVED_SINCE(6, 6) + static QRunnable *create(std::function functionToRun); +#endif + template + using if_callable = std::enable_if_t, bool>; + + template = true> + static QRunnable *create(Callable &&functionToRun); + static QRunnable *create(std::nullptr_t) = delete; + + bool autoDelete() const { return m_autoDelete; } + void setAutoDelete(bool autoDelete) { m_autoDelete = autoDelete; } + +private: + static Q_DECL_COLD_FUNCTION QRunnable *warnNullCallable(); + class QGenericRunnable; +}; + +class Q_CORE_EXPORT QRunnable::QGenericRunnable : public QRunnable +{ + // Type erasure, to only instantiate a non-virtual class per Callable: + class HelperBase + { + protected: + enum class Op { + Run, + Destroy, + }; + using OpFn = void* (*)(Op, HelperBase *, void*); + OpFn fn; + protected: + constexpr explicit HelperBase(OpFn f) noexcept : fn(f) {} + ~HelperBase() = default; + public: + void run() { fn(Op::Run, this, nullptr); } + void destroy() { fn(Op::Destroy, this, nullptr); } + }; + + template + class Helper : public HelperBase, private QtPrivate::CompactStorage + { + using Storage = QtPrivate::CompactStorage; + static void *impl(Op op, HelperBase *that, [[maybe_unused]] void *arg) + { + const auto _this = static_cast(that); + switch (op) { + case Op::Run: _this->object()(); break; + case Op::Destroy: delete _this; break; + } + return nullptr; + } + public: + template + explicit Helper(UniCallable &&functionToRun) noexcept + : HelperBase(&impl), + Storage{std::forward(functionToRun)} + { + } + }; + + HelperBase *runHelper; +public: + template = true> + explicit QGenericRunnable(Callable &&c) + : runHelper(new Helper>(std::forward(c))) + { + } + ~QGenericRunnable() override; + + void run() override; +}; + +namespace QtPrivate { + +template +constexpr inline bool is_function_pointer_v = std::conjunction_v< + std::is_pointer, + std::is_function> + >; +template +constexpr inline bool is_std_function_v = false; +template +constexpr inline bool is_std_function_v> = true; + +} // namespace QtPrivate + +template > +QRunnable *QRunnable::create(Callable &&functionToRun) +{ + using F = std::decay_t; + constexpr bool is_std_function = QtPrivate::is_std_function_v; + constexpr bool is_function_pointer = QtPrivate::is_function_pointer_v; + if constexpr (is_std_function || is_function_pointer) { + bool is_null; + if constexpr (is_std_function) { + is_null = !functionToRun; + } else if constexpr (is_function_pointer) { + // shut up warnings about functions always having a non-null address: + const void *functionPtr = reinterpret_cast(functionToRun); + is_null = !functionPtr; + } + if (is_null) + return warnNullCallable(); + } + + return new QGenericRunnable(std::forward(functionToRun)); +} + +QT_END_NAMESPACE + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qsavefile.h b/qt/6.8.1/msvc2022_64/include/QtCore/qsavefile.h new file mode 100644 index 0000000000000000000000000000000000000000..f9b09e877828f932ce4544fc96d0fab8998f5f52 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qsavefile.h @@ -0,0 +1,67 @@ +// Copyright (C) 2012 David Faure +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSAVEFILE_H +#define QSAVEFILE_H + +#include + +#if QT_CONFIG(temporaryfile) + +#include +#include + +#ifdef open +#error qsavefile.h must be included before any header file that defines open +#endif + +QT_BEGIN_NAMESPACE + +class QAbstractFileEngine; +class QSaveFilePrivate; + +class Q_CORE_EXPORT QSaveFile : public QFileDevice +{ +#ifndef QT_NO_QOBJECT + Q_OBJECT +#endif + Q_DECLARE_PRIVATE(QSaveFile) + +public: + + explicit QSaveFile(const QString &name); +#ifndef QT_NO_QOBJECT + explicit QSaveFile(QObject *parent = nullptr); + explicit QSaveFile(const QString &name, QObject *parent); +#endif + ~QSaveFile(); + + QString fileName() const override; + void setFileName(const QString &name); + + QFILE_MAYBE_NODISCARD bool open(OpenMode flags) override; + bool commit(); + + void cancelWriting(); + + void setDirectWriteFallback(bool enabled); + bool directWriteFallback() const; + +protected: + qint64 writeData(const char *data, qint64 len) override; + +private: + void close() override; +#if !QT_CONFIG(translation) + static QString tr(const char *string) { return QString::fromLatin1(string); } +#endif + +private: + Q_DISABLE_COPY(QSaveFile) +}; + +QT_END_NAMESPACE + +#endif // QT_CONFIG(temporaryfile) + +#endif // QSAVEFILE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qscopedpointer.h b/qt/6.8.1/msvc2022_64/include/QtCore/qscopedpointer.h new file mode 100644 index 0000000000000000000000000000000000000000..00871af34a6f6aeb458d00abdac5d3f63d53ee55 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qscopedpointer.h @@ -0,0 +1,248 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSCOPEDPOINTER_H +#define QSCOPEDPOINTER_H + +#include + +#include + +QT_BEGIN_NAMESPACE + +template +struct QScopedPointerDeleter +{ + static inline void cleanup(T *pointer) noexcept + { + // Enforce a complete type. + // If you get a compile error here, read the section on forward declared + // classes in the QScopedPointer documentation. + typedef char IsIncompleteType[ sizeof(T) ? 1 : -1 ]; + (void) sizeof(IsIncompleteType); + + delete pointer; + } + void operator()(T *pointer) const noexcept + { + cleanup(pointer); + } +}; + +template +struct QScopedPointerArrayDeleter +{ + static inline void cleanup(T *pointer) noexcept + { + // Enforce a complete type. + // If you get a compile error here, read the section on forward declared + // classes in the QScopedPointer documentation. + typedef char IsIncompleteType[ sizeof(T) ? 1 : -1 ]; + (void) sizeof(IsIncompleteType); + + delete[] pointer; + } + void operator()(T *pointer) const noexcept + { + cleanup(pointer); + } +}; + +struct QScopedPointerPodDeleter +{ + static inline void cleanup(void *pointer) noexcept { free(pointer); } + void operator()(void *pointer) const noexcept { cleanup(pointer); } +}; + +#ifndef QT_NO_QOBJECT +template +struct QScopedPointerObjectDeleteLater +{ + static inline void cleanup(T *pointer) { if (pointer) pointer->deleteLater(); } + void operator()(T *pointer) const { cleanup(pointer); } +}; + +class QObject; +typedef QScopedPointerObjectDeleteLater QScopedPointerDeleteLater; +#endif + +template > +class QScopedPointer +{ +public: + Q_NODISCARD_CTOR + explicit QScopedPointer(T *p = nullptr) noexcept : d(p) + { + } + + inline ~QScopedPointer() + { + T *oldD = this->d; + Cleanup::cleanup(oldD); + } + + inline T &operator*() const + { + Q_ASSERT(d); + return *d; + } + + T *operator->() const noexcept + { + return d; + } + + bool operator!() const noexcept + { + return !d; + } + + explicit operator bool() const + { + return !isNull(); + } + + T *data() const noexcept + { + return d; + } + + T *get() const noexcept + { + return d; + } + + bool isNull() const noexcept + { + return !d; + } + + void reset(T *other = nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval()))) + { + if (d == other) + return; + T *oldD = std::exchange(d, other); + Cleanup::cleanup(oldD); + } + +#if QT_DEPRECATED_SINCE(6, 1) + QT_DEPRECATED_VERSION_X_6_1("Use std::unique_ptr instead, and call release().") + T *take() noexcept + { + T *oldD = std::exchange(d, nullptr); + return oldD; + } +#endif + +#if QT_DEPRECATED_SINCE(6, 2) + QT_DEPRECATED_VERSION_X_6_2("Use std::unique_ptr instead of QScopedPointer.") + void swap(QScopedPointer &other) noexcept + { + qt_ptr_swap(d, other.d); + } +#endif + + typedef T *pointer; + + friend bool operator==(const QScopedPointer &lhs, const QScopedPointer &rhs) noexcept + { + return lhs.data() == rhs.data(); + } + + friend bool operator!=(const QScopedPointer &lhs, const QScopedPointer &rhs) noexcept + { + return lhs.data() != rhs.data(); + } + + friend bool operator==(const QScopedPointer &lhs, std::nullptr_t) noexcept + { + return lhs.isNull(); + } + + friend bool operator==(std::nullptr_t, const QScopedPointer &rhs) noexcept + { + return rhs.isNull(); + } + + friend bool operator!=(const QScopedPointer &lhs, std::nullptr_t) noexcept + { + return !lhs.isNull(); + } + + friend bool operator!=(std::nullptr_t, const QScopedPointer &rhs) noexcept + { + return !rhs.isNull(); + } + +#if QT_DEPRECATED_SINCE(6, 2) + QT_DEPRECATED_VERSION_X_6_2("Use std::unique_ptr instead of QScopedPointer.") + friend void swap(QScopedPointer &p1, QScopedPointer &p2) noexcept + { p1.swap(p2); } +#endif + +protected: + T *d; + +private: + Q_DISABLE_COPY_MOVE(QScopedPointer) +}; + +template > +class QScopedArrayPointer : public QScopedPointer +{ + template + using if_same_type = typename std::enable_if::type, Ptr>::value, bool>::type; +public: + Q_NODISCARD_CTOR + inline QScopedArrayPointer() : QScopedPointer(nullptr) {} + inline ~QScopedArrayPointer() = default; + + template = true> + Q_NODISCARD_CTOR + explicit QScopedArrayPointer(D *p) + : QScopedPointer(p) + { + } + + T &operator[](qsizetype i) + { + return this->d[i]; + } + + const T &operator[](qsizetype i) const + { + return this->d[i]; + } + +#if QT_DEPRECATED_SINCE(6, 2) + QT_DEPRECATED_VERSION_X_6_2("Use std::unique_ptr instead of QScopedArrayPointer.") + void swap(QScopedArrayPointer &other) noexcept // prevent QScopedPointer <->QScopedArrayPointer swaps + { QScopedPointer::swap(other); } +#endif + +private: + explicit inline QScopedArrayPointer(void *) + { + // Enforce the same type. + + // If you get a compile error here, make sure you declare + // QScopedArrayPointer with the same template type as you pass to the + // constructor. See also the QScopedPointer documentation. + + // Storing a scalar array as a pointer to a different type is not + // allowed and results in undefined behavior. + } + + Q_DISABLE_COPY_MOVE(QScopedArrayPointer) +}; + +#if QT_DEPRECATED_SINCE(6, 2) +template +QT_DEPRECATED_VERSION_X_6_2("Use std::unique_ptr instead of QScopedArrayPointer.") +inline void swap(QScopedArrayPointer &lhs, QScopedArrayPointer &rhs) noexcept +{ lhs.swap(rhs); } +#endif + +QT_END_NAMESPACE + +#endif // QSCOPEDPOINTER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qscopedvaluerollback.h b/qt/6.8.1/msvc2022_64/include/QtCore/qscopedvaluerollback.h new file mode 100644 index 0000000000000000000000000000000000000000..8deffef96d59e9830ed5d6d1390485ace6f30411 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qscopedvaluerollback.h @@ -0,0 +1,50 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSCOPEDVALUEROLLBACK_H +#define QSCOPEDVALUEROLLBACK_H + +#include + +QT_BEGIN_NAMESPACE + +template +class QScopedValueRollback +{ +public: + Q_NODISCARD_CTOR + explicit constexpr QScopedValueRollback(T &var) + : varRef(var), oldValue(var) + { + } + + Q_NODISCARD_CTOR + explicit constexpr QScopedValueRollback(T &var, T value) + : varRef(var), oldValue(std::move(var)) // ### C++20: std::exchange(var, std::move(value)) + { + var = std::move(value); + } + +#if __cpp_constexpr >= 201907L + constexpr +#endif + ~QScopedValueRollback() + { + varRef = std::move(oldValue); + } + + constexpr void commit() + { + oldValue = varRef; + } + +private: + T &varRef; + T oldValue; + + Q_DISABLE_COPY_MOVE(QScopedValueRollback) +}; + +QT_END_NAMESPACE + +#endif // QSCOPEDVALUEROLLBACK_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qscopeguard.h b/qt/6.8.1/msvc2022_64/include/QtCore/qscopeguard.h new file mode 100644 index 0000000000000000000000000000000000000000..4f4765326ea1055cf07d5b05a6f8135a2b7bf282 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qscopeguard.h @@ -0,0 +1,67 @@ +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Sérgio Martins +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSCOPEGUARD_H +#define QSCOPEGUARD_H + +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +template +class QScopeGuard +{ +public: + Q_NODISCARD_CTOR + explicit QScopeGuard(F &&f) noexcept + : m_func(std::move(f)) + { + } + + Q_NODISCARD_CTOR + explicit QScopeGuard(const F &f) noexcept + : m_func(f) + { + } + + Q_NODISCARD_CTOR + QScopeGuard(QScopeGuard &&other) noexcept + : m_func(std::move(other.m_func)) + , m_invoke(std::exchange(other.m_invoke, false)) + { + } + + ~QScopeGuard() noexcept + { + if (m_invoke) + m_func(); + } + + void dismiss() noexcept + { + m_invoke = false; + } + +private: + Q_DISABLE_COPY(QScopeGuard) + + F m_func; + bool m_invoke = true; +}; + +template QScopeGuard(F(&)()) -> QScopeGuard; + +//! [qScopeGuard] +template +[[nodiscard]] QScopeGuard::type> qScopeGuard(F &&f) +{ + return QScopeGuard::type>(std::forward(f)); +} + +QT_END_NAMESPACE + +#endif // QSCOPEGUARD_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qsemaphore.h b/qt/6.8.1/msvc2022_64/include/QtCore/qsemaphore.h new file mode 100644 index 0000000000000000000000000000000000000000..17f15407552b9e6c4b739b57fee58dab727eb847 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qsemaphore.h @@ -0,0 +1,109 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSEMAPHORE_H +#define QSEMAPHORE_H + +#include +#include + +#include + +QT_REQUIRE_CONFIG(thread); + +QT_BEGIN_NAMESPACE + +class QSemaphorePrivate; +class Q_CORE_EXPORT QSemaphore +{ +public: + explicit QSemaphore(int n = 0); + ~QSemaphore(); + + void acquire(int n = 1); + bool tryAcquire(int n = 1); + QT_CORE_INLINE_SINCE(6, 6) + bool tryAcquire(int n, int timeout); + bool tryAcquire(int n, QDeadlineTimer timeout); +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) + template + bool tryAcquire(int n, std::chrono::duration timeout) + { return tryAcquire(n, QDeadlineTimer(timeout)); } +#endif + + void release(int n = 1); + + int available() const; + + // std::counting_semaphore compatibility: + bool try_acquire() noexcept { return tryAcquire(); } + template + bool try_acquire_for(const std::chrono::duration &timeout) + { return tryAcquire(1, timeout); } + template + bool try_acquire_until(const std::chrono::time_point &tp) + { + return try_acquire_for(tp - Clock::now()); + } +private: + Q_DISABLE_COPY(QSemaphore) + + union { + QSemaphorePrivate *d; + QBasicAtomicInteger u; + QBasicAtomicInteger u32[2]; + QBasicAtomicInteger u64; + }; +}; + +#if QT_CORE_INLINE_IMPL_SINCE(6, 6) +bool QSemaphore::tryAcquire(int n, int timeout) +{ + return tryAcquire(n, QDeadlineTimer(timeout)); +} +#endif + +class QSemaphoreReleaser +{ +public: + Q_NODISCARD_CTOR + QSemaphoreReleaser() = default; + Q_NODISCARD_CTOR + explicit QSemaphoreReleaser(QSemaphore &sem, int n = 1) noexcept + : m_sem(&sem), m_n(n) {} + Q_NODISCARD_CTOR + explicit QSemaphoreReleaser(QSemaphore *sem, int n = 1) noexcept + : m_sem(sem), m_n(n) {} + Q_NODISCARD_CTOR + QSemaphoreReleaser(QSemaphoreReleaser &&other) noexcept + : m_sem(other.cancel()), m_n(other.m_n) {} + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QSemaphoreReleaser) + + ~QSemaphoreReleaser() + { + if (m_sem) + m_sem->release(m_n); + } + + void swap(QSemaphoreReleaser &other) noexcept + { + qt_ptr_swap(m_sem, other.m_sem); + std::swap(m_n, other.m_n); + } + + QSemaphore *semaphore() const noexcept + { return m_sem; } + + QSemaphore *cancel() noexcept + { + return std::exchange(m_sem, nullptr); + } + +private: + QSemaphore *m_sem = nullptr; + int m_n; +}; + +QT_END_NAMESPACE + +#endif // QSEMAPHORE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qsequentialanimationgroup.h b/qt/6.8.1/msvc2022_64/include/QtCore/qsequentialanimationgroup.h new file mode 100644 index 0000000000000000000000000000000000000000..2630b99375800c01fbe38e296f8772696ac0298f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qsequentialanimationgroup.h @@ -0,0 +1,52 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSEQUENTIALANIMATIONGROUP_H +#define QSEQUENTIALANIMATIONGROUP_H + +#include + +QT_REQUIRE_CONFIG(animation); + +QT_BEGIN_NAMESPACE + +class QPauseAnimation; +class QSequentialAnimationGroupPrivate; + +class Q_CORE_EXPORT QSequentialAnimationGroup : public QAnimationGroup +{ + Q_OBJECT + Q_PROPERTY(QAbstractAnimation *currentAnimation READ currentAnimation + NOTIFY currentAnimationChanged BINDABLE bindableCurrentAnimation) + +public: + QSequentialAnimationGroup(QObject *parent = nullptr); + ~QSequentialAnimationGroup(); + + QPauseAnimation *addPause(int msecs); + QPauseAnimation *insertPause(int index, int msecs); + + QAbstractAnimation *currentAnimation() const; + QBindable bindableCurrentAnimation() const; + int duration() const override; + +Q_SIGNALS: + void currentAnimationChanged(QAbstractAnimation *current); + +protected: + QSequentialAnimationGroup(QSequentialAnimationGroupPrivate &dd, QObject *parent); + bool event(QEvent *event) override; + + void updateCurrentTime(int) override; + void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) override; + void updateDirection(QAbstractAnimation::Direction direction) override; + +private: + Q_DISABLE_COPY(QSequentialAnimationGroup) + Q_DECLARE_PRIVATE(QSequentialAnimationGroup) + Q_PRIVATE_SLOT(d_func(), void _q_uncontrolledAnimationFinished()) +}; + +QT_END_NAMESPACE + +#endif //QSEQUENTIALANIMATIONGROUP_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qsequentialiterable.h b/qt/6.8.1/msvc2022_64/include/QtCore/qsequentialiterable.h new file mode 100644 index 0000000000000000000000000000000000000000..399840062a10caa41ba595cc7656012feee40cff --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qsequentialiterable.h @@ -0,0 +1,155 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSEQUENTIALITERABLE_H +#define QSEQUENTIALITERABLE_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class Q_CORE_EXPORT QSequentialIterator : public QIterator +{ +public: + using value_type = QVariant; + using reference = QVariantRef; + using pointer = QVariantPointer; + + QSequentialIterator(QIterator &&it) + : QIterator(std::move(it)) + {} + + QVariantRef operator*() const; + QVariantPointer operator->() const; +}; + +class Q_CORE_EXPORT QSequentialConstIterator : public QConstIterator +{ +public: + using value_type = QVariant; + using reference = const QVariant &; + using pointer = QVariantConstPointer; + + QSequentialConstIterator(QConstIterator &&it) + : QConstIterator(std::move(it)) + {} + + QVariant operator*() const; + QVariantConstPointer operator->() const; +}; + +class Q_CORE_EXPORT QSequentialIterable : public QIterable +{ +public: + using iterator = QTaggedIterator; + using const_iterator = QTaggedIterator; + + using RandomAccessIterator = QTaggedIterator; + using BidirectionalIterator = QTaggedIterator; + using ForwardIterator = QTaggedIterator; + using InputIterator = QTaggedIterator; + + using RandomAccessConstIterator = QTaggedIterator; + using BidirectionalConstIterator = QTaggedIterator; + using ForwardConstIterator = QTaggedIterator; + using InputConstIterator = QTaggedIterator; + + template + QSequentialIterable(const T *p) + : QIterable(QMetaSequence::fromContainer(), p) + { + Q_UNUSED(m_revision); + } + + template + QSequentialIterable(T *p) + : QIterable(QMetaSequence::fromContainer(), p) + { + } + + QSequentialIterable() + : QIterable(QMetaSequence(), nullptr) + { + } + + template + QSequentialIterable(const QMetaSequence &metaSequence, Pointer iterable) + : QIterable(metaSequence, iterable) + { + } + + // ### Qt7: Pass QMetaType as value rather than const ref. + QSequentialIterable(const QMetaSequence &metaSequence, const QMetaType &metaType, + void *iterable) + : QIterable(metaSequence, metaType.alignOf(), iterable) + { + } + + // ### Qt7: Pass QMetaType as value rather than const ref. + QSequentialIterable(const QMetaSequence &metaSequence, const QMetaType &metaType, + const void *iterable) + : QIterable(metaSequence, metaType.alignOf(), iterable) + { + } + + QSequentialIterable(QIterable &&other) : QIterable(std::move(other)) {} + + QSequentialIterable &operator=(QIterable &&other) + { + QIterable::operator=(std::move(other)); + return *this; + } + + const_iterator begin() const { return constBegin(); } + const_iterator end() const { return constEnd(); } + + const_iterator constBegin() const { return const_iterator(QIterable::constBegin()); } + const_iterator constEnd() const { return const_iterator(QIterable::constEnd()); } + + iterator mutableBegin() { return iterator(QIterable::mutableBegin()); } + iterator mutableEnd() { return iterator(QIterable::mutableEnd()); } + + QVariant at(qsizetype idx) const; + void set(qsizetype idx, const QVariant &value); + + enum Position { Unspecified, AtBegin, AtEnd }; + void addValue(const QVariant &value, Position position = Unspecified); + void removeValue(Position position = Unspecified); + + QMetaType valueMetaType() const; +}; + +template<> +inline QVariantRef::operator QVariant() const +{ + if (m_pointer == nullptr) + return QVariant(); + const QMetaType metaType(m_pointer->metaContainer().valueMetaType()); + QVariant v(metaType); + void *dataPtr = metaType == QMetaType::fromType() ? &v : v.data(); + m_pointer->metaContainer().valueAtIterator(m_pointer->constIterator(), dataPtr); + return v; +} + +template<> +inline QVariantRef &QVariantRef::operator=( + const QVariant &value) +{ + if (m_pointer == nullptr) + return *this; + + QtPrivate::QVariantTypeCoercer coercer; + m_pointer->metaContainer().setValueAtIterator( + m_pointer->constIterator(), + coercer.coerce(value, m_pointer->metaContainer().valueMetaType())); + return *this; +} + +Q_DECLARE_TYPEINFO(QSequentialIterable, Q_RELOCATABLE_TYPE); +Q_DECLARE_TYPEINFO(QSequentialIterable::iterator, Q_RELOCATABLE_TYPE); +Q_DECLARE_TYPEINFO(QSequentialIterable::const_iterator, Q_RELOCATABLE_TYPE); + +QT_END_NAMESPACE + +#endif // QSEQUENTIALITERABLE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qset.h b/qt/6.8.1/msvc2022_64/include/QtCore/qset.h new file mode 100644 index 0000000000000000000000000000000000000000..e014dde793d8f2a469a60bd92be1f147bbe2a508 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qset.h @@ -0,0 +1,355 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSET_H +#define QSET_H + +#include +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + + +template +class QSet +{ + typedef QHash Hash; + +public: + inline QSet() noexcept {} + inline QSet(std::initializer_list list) + : QSet(list.begin(), list.end()) {} + template = true> + inline QSet(InputIterator first, InputIterator last) + { + QtPrivate::reserveIfForwardIterator(this, first, last); + for (; first != last; ++first) + insert(*first); + } + + // compiler-generated copy/move ctor/assignment operators are fine! + // compiler-generated destructor is fine! + + inline void swap(QSet &other) noexcept { q_hash.swap(other.q_hash); } + +#ifndef Q_QDOC + template + QTypeTraits::compare_eq_result_container operator==(const QSet &other) const + { return q_hash == other.q_hash; } + template + QTypeTraits::compare_eq_result_container operator!=(const QSet &other) const + { return q_hash != other.q_hash; } +#else + bool operator==(const QSet &other) const; + bool operator!=(const QSet &other) const; +#endif + + inline qsizetype size() const { return q_hash.size(); } + + inline bool isEmpty() const { return q_hash.isEmpty(); } + + inline qsizetype capacity() const { return q_hash.capacity(); } + inline void reserve(qsizetype size); + inline void squeeze() { q_hash.squeeze(); } + + inline void detach() { q_hash.detach(); } + inline bool isDetached() const { return q_hash.isDetached(); } + + inline void clear() { q_hash.clear(); } + + inline bool remove(const T &value) { return q_hash.remove(value) != 0; } + + template + inline qsizetype removeIf(Pred predicate) + { + return QtPrivate::qset_erase_if(*this, predicate); + } + + inline bool contains(const T &value) const { return q_hash.contains(value); } + + bool contains(const QSet &set) const; + + class const_iterator; + + class iterator + { + typedef QHash Hash; + typename Hash::iterator i; + friend class const_iterator; + friend class QSet; + + public: + typedef std::forward_iterator_tag iterator_category; + typedef qptrdiff difference_type; + typedef T value_type; + typedef const T *pointer; + typedef const T &reference; + + inline iterator() {} + inline iterator(typename Hash::iterator o) : i(o) {} + inline iterator(const iterator &o) : i(o.i) {} + inline iterator &operator=(const iterator &o) { i = o.i; return *this; } + inline const T &operator*() const { return i.key(); } + inline const T *operator->() const { return &i.key(); } + inline bool operator==(const iterator &o) const { return i == o.i; } + inline bool operator!=(const iterator &o) const { return i != o.i; } + inline bool operator==(const const_iterator &o) const + { return i == o.i; } + inline bool operator!=(const const_iterator &o) const + { return i != o.i; } + inline iterator &operator++() { ++i; return *this; } + inline iterator operator++(int) { iterator r = *this; ++i; return r; } + }; + + class const_iterator + { + typedef QHash Hash; + typename Hash::const_iterator i; + friend class iterator; + friend class QSet; + + public: + typedef std::forward_iterator_tag iterator_category; + typedef qptrdiff difference_type; + typedef T value_type; + typedef const T *pointer; + typedef const T &reference; + + inline const_iterator() {} + inline const_iterator(typename Hash::const_iterator o) : i(o) {} + inline const_iterator(const const_iterator &o) : i(o.i) {} + inline const_iterator(const iterator &o) + : i(o.i) {} + inline const_iterator &operator=(const const_iterator &o) { i = o.i; return *this; } + inline const T &operator*() const { return i.key(); } + inline const T *operator->() const { return &i.key(); } + inline bool operator==(const const_iterator &o) const { return i == o.i; } + inline bool operator!=(const const_iterator &o) const { return i != o.i; } + inline const_iterator &operator++() { ++i; return *this; } + inline const_iterator operator++(int) { const_iterator r = *this; ++i; return r; } + }; + + // STL style + inline iterator begin() { return q_hash.begin(); } + inline const_iterator begin() const noexcept { return q_hash.begin(); } + inline const_iterator cbegin() const noexcept { return q_hash.begin(); } + inline const_iterator constBegin() const noexcept { return q_hash.constBegin(); } + inline iterator end() { return q_hash.end(); } + inline const_iterator end() const noexcept { return q_hash.end(); } + inline const_iterator cend() const noexcept { return q_hash.end(); } + inline const_iterator constEnd() const noexcept { return q_hash.constEnd(); } + + iterator erase(const_iterator i) + { + Q_ASSERT(i != constEnd()); + return q_hash.erase(i.i); + } + + // more Qt + typedef iterator Iterator; + typedef const_iterator ConstIterator; + inline qsizetype count() const { return q_hash.size(); } + inline iterator insert(const T &value) + { return q_hash.insert(value, QHashDummyValue()); } + inline iterator insert(T &&value) + { return q_hash.emplace(std::move(value), QHashDummyValue()); } + iterator find(const T &value) { return q_hash.find(value); } + const_iterator find(const T &value) const { return q_hash.find(value); } + inline const_iterator constFind(const T &value) const { return find(value); } + QSet &unite(const QSet &other); + QSet &intersect(const QSet &other); + bool intersects(const QSet &other) const; + QSet &subtract(const QSet &other); + + // STL compatibility + typedef T key_type; + typedef T value_type; + typedef value_type *pointer; + typedef const value_type *const_pointer; + typedef value_type &reference; + typedef const value_type &const_reference; + typedef qptrdiff difference_type; + typedef qsizetype size_type; + + inline bool empty() const { return isEmpty(); } + + iterator insert(const_iterator, const T &value) { return insert(value); } + + // comfort + inline QSet &operator<<(const T &value) { insert(value); return *this; } + inline QSet &operator|=(const QSet &other) { unite(other); return *this; } + inline QSet &operator|=(const T &value) { insert(value); return *this; } + inline QSet &operator&=(const QSet &other) { intersect(other); return *this; } + inline QSet &operator&=(const T &value) + { QSet result; if (contains(value)) result.insert(value); return (*this = result); } + inline QSet &operator+=(const QSet &other) { unite(other); return *this; } + inline QSet &operator+=(const T &value) { insert(value); return *this; } + inline QSet &operator-=(const QSet &other) { subtract(other); return *this; } + inline QSet &operator-=(const T &value) { remove(value); return *this; } + + friend QSet operator|(const QSet &lhs, const QSet &rhs) { return QSet(lhs) |= rhs; } + friend QSet operator|(QSet &&lhs, const QSet &rhs) { lhs |= rhs; return std::move(lhs); } + + friend QSet operator&(const QSet &lhs, const QSet &rhs) { return QSet(lhs) &= rhs; } + friend QSet operator&(QSet &&lhs, const QSet &rhs) { lhs &= rhs; return std::move(lhs); } + + friend QSet operator+(const QSet &lhs, const QSet &rhs) { return QSet(lhs) += rhs; } + friend QSet operator+(QSet &&lhs, const QSet &rhs) { lhs += rhs; return std::move(lhs); } + + friend QSet operator-(const QSet &lhs, const QSet &rhs) { return QSet(lhs) -= rhs; } + friend QSet operator-(QSet &&lhs, const QSet &rhs) { lhs -= rhs; return std::move(lhs); } + + QList values() const; + +private: + Hash q_hash; +}; + +template ::value_type, + QtPrivate::IfIsInputIterator = true> +QSet(InputIterator, InputIterator) -> QSet; + +template +size_t qHash(const QSet &key, size_t seed = 0) +noexcept(noexcept(qHashRangeCommutative(key.begin(), key.end(), seed))) +{ + return qHashRangeCommutative(key.begin(), key.end(), seed); +} + +// inline function implementations + +template +Q_INLINE_TEMPLATE void QSet::reserve(qsizetype asize) { q_hash.reserve(asize); } + +template +Q_INLINE_TEMPLATE QSet &QSet::unite(const QSet &other) +{ + if (q_hash.isSharedWith(other.q_hash)) + return *this; + QSet tmp = other; + if (size() < other.size()) + swap(tmp); + for (const auto &e : std::as_const(tmp)) + insert(e); + return *this; +} + +template +Q_INLINE_TEMPLATE QSet &QSet::intersect(const QSet &other) +{ + QSet copy1; + QSet copy2; + if (size() <= other.size()) { + copy1 = *this; + copy2 = other; + } else { + copy1 = other; + copy2 = *this; + *this = copy1; + } + for (const auto &e : std::as_const(copy1)) { + if (!copy2.contains(e)) + remove(e); + } + return *this; +} + +template +Q_INLINE_TEMPLATE bool QSet::intersects(const QSet &other) const +{ + const bool otherIsBigger = other.size() > size(); + const QSet &smallestSet = otherIsBigger ? *this : other; + const QSet &biggestSet = otherIsBigger ? other : *this; + typename QSet::const_iterator i = smallestSet.cbegin(); + typename QSet::const_iterator e = smallestSet.cend(); + + while (i != e) { + if (biggestSet.contains(*i)) + return true; + ++i; + } + + return false; +} + +template +Q_INLINE_TEMPLATE QSet &QSet::subtract(const QSet &other) +{ + if (q_hash.isSharedWith(other.q_hash)) { + clear(); + } else { + for (const auto &e : other) + remove(e); + } + return *this; +} + +template +Q_INLINE_TEMPLATE bool QSet::contains(const QSet &other) const +{ + typename QSet::const_iterator i = other.constBegin(); + while (i != other.constEnd()) { + if (!contains(*i)) + return false; + ++i; + } + return true; +} + +template +Q_OUTOFLINE_TEMPLATE QList QSet::values() const +{ + QList result; + result.reserve(size()); + typename QSet::const_iterator i = constBegin(); + while (i != constEnd()) { + result.append(*i); + ++i; + } + return result; +} + +Q_DECLARE_SEQUENTIAL_ITERATOR(Set) + +#if !defined(QT_NO_JAVA_STYLE_ITERATORS) +template +class QMutableSetIterator +{ + typedef typename QSet::iterator iterator; + QSet *c; + iterator i, n; + inline bool item_exists() const { return c->constEnd() != n; } + +public: + inline QMutableSetIterator(QSet &container) + : c(&container) + { i = c->begin(); n = c->end(); } + inline QMutableSetIterator &operator=(QSet &container) + { c = &container; i = c->begin(); n = c->end(); return *this; } + inline void toFront() { i = c->begin(); n = c->end(); } + inline void toBack() { i = c->end(); n = i; } + inline bool hasNext() const { return c->constEnd() != i; } + inline const T &next() { n = i++; return *n; } + inline const T &peekNext() const { return *i; } + inline void remove() + { if (c->constEnd() != n) { i = c->erase(n); n = c->end(); } } + inline const T &value() const { Q_ASSERT(item_exists()); return *n; } + inline bool findNext(const T &t) + { while (c->constEnd() != (n = i)) if (*i++ == t) return true; return false; } +}; +#endif // QT_NO_JAVA_STYLE_ITERATORS + +template +qsizetype erase_if(QSet &set, Predicate pred) +{ + return QtPrivate::qset_erase_if(set, pred); +} + +QT_END_NAMESPACE + +#endif // QSET_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qsettings.h b/qt/6.8.1/msvc2022_64/include/QtCore/qsettings.h new file mode 100644 index 0000000000000000000000000000000000000000..0d48ac679a8205c7523999b8faef2187dc27ab52 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qsettings.h @@ -0,0 +1,188 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSETTINGS_H +#define QSETTINGS_H + +#include +#include +#include +#include + +QT_REQUIRE_CONFIG(settings); + +#include + +QT_BEGIN_NAMESPACE + +#ifdef Status // we seem to pick up a macro Status --> int somewhere +#undef Status +#endif + +class QIODevice; +class QSettingsPrivate; + +#ifndef QT_NO_QOBJECT +class Q_CORE_EXPORT QSettings : public QObject +#else +class Q_CORE_EXPORT QSettings +#endif +{ +#ifndef QT_NO_QOBJECT + Q_OBJECT +#else + QScopedPointer d_ptr; +#endif + Q_DECLARE_PRIVATE(QSettings) + +public: + enum Status { + NoError = 0, + AccessError, + FormatError + }; +#ifndef QT_NO_QOBJECT + Q_ENUM(Status) +#endif + + enum Format { + NativeFormat = 0, + IniFormat = 1, + +#if defined(Q_OS_WIN) || defined(Q_QDOC) + Registry32Format = 2, + Registry64Format = 3, +#endif + +#if defined(Q_OS_WASM) || defined(Q_QDOC) + WebLocalStorageFormat = 4, + WebIndexedDBFormat = 5, +#endif + + InvalidFormat = 16, + CustomFormat1, + CustomFormat2, + CustomFormat3, + CustomFormat4, + CustomFormat5, + CustomFormat6, + CustomFormat7, + CustomFormat8, + CustomFormat9, + CustomFormat10, + CustomFormat11, + CustomFormat12, + CustomFormat13, + CustomFormat14, + CustomFormat15, + CustomFormat16 + }; +#ifndef QT_NO_QOBJECT + Q_ENUM(Format) +#endif + + enum Scope { + UserScope, + SystemScope + }; +#ifndef QT_NO_QOBJECT + Q_ENUM(Scope) +#endif + +#ifndef QT_NO_QOBJECT + explicit QSettings(const QString &organization, + const QString &application = QString(), QObject *parent = nullptr); + QSettings(Scope scope, const QString &organization, + const QString &application = QString(), QObject *parent = nullptr); + QSettings(Format format, Scope scope, const QString &organization, + const QString &application = QString(), QObject *parent = nullptr); + QSettings(const QString &fileName, Format format, QObject *parent = nullptr); + explicit QSettings(QObject *parent = nullptr); + explicit QSettings(Scope scope, QObject *parent = nullptr); +#else + explicit QSettings(const QString &organization, + const QString &application = QString()); + QSettings(Scope scope, const QString &organization, + const QString &application = QString()); + QSettings(Format format, Scope scope, const QString &organization, + const QString &application = QString()); + QSettings(const QString &fileName, Format format); + explicit QSettings(Scope scope = UserScope); +#endif + ~QSettings(); + + void clear(); + void sync(); + Status status() const; + bool isAtomicSyncRequired() const; + void setAtomicSyncRequired(bool enable); + +#if QT_CORE_REMOVED_SINCE(6, 4) + void beginGroup(const QString &prefix); +#endif + void beginGroup(QAnyStringView prefix); + void endGroup(); + QString group() const; + +#if QT_CORE_REMOVED_SINCE(6, 4) + int beginReadArray(const QString &prefix); + void beginWriteArray(const QString &prefix, int size = -1); +#endif + int beginReadArray(QAnyStringView prefix); + void beginWriteArray(QAnyStringView prefix, int size = -1); + void endArray(); + void setArrayIndex(int i); + + QStringList allKeys() const; + QStringList childKeys() const; + QStringList childGroups() const; + bool isWritable() const; + +#if QT_CORE_REMOVED_SINCE(6, 4) + void setValue(const QString &key, const QVariant &value); + QVariant value(const QString &key, const QVariant &defaultValue) const; + QVariant value(const QString &key) const; +#endif + void setValue(QAnyStringView key, const QVariant &value); + QVariant value(QAnyStringView key, const QVariant &defaultValue) const; + QVariant value(QAnyStringView key) const; + +#if QT_CORE_REMOVED_SINCE(6, 4) + void remove(const QString &key); + bool contains(const QString &key) const; +#endif + void remove(QAnyStringView key); + bool contains(QAnyStringView key) const; + + void setFallbacksEnabled(bool b); + bool fallbacksEnabled() const; + + QString fileName() const; + Format format() const; + Scope scope() const; + QString organizationName() const; + QString applicationName() const; + + static void setDefaultFormat(Format format); + static Format defaultFormat(); + static void setPath(Format format, Scope scope, const QString &path); + + typedef QMap SettingsMap; + typedef bool (*ReadFunc)(QIODevice &device, SettingsMap &map); + typedef bool (*WriteFunc)(QIODevice &device, const SettingsMap &map); + + static Format registerFormat(const QString &extension, ReadFunc readFunc, WriteFunc writeFunc, + Qt::CaseSensitivity caseSensitivity = Qt::CaseSensitive); + +protected: +#ifndef QT_NO_QOBJECT + bool event(QEvent *event) override; +#endif + +private: + Q_DISABLE_COPY(QSettings) +}; + +QT_END_NAMESPACE + +#endif // QSETTINGS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qshareddata.h b/qt/6.8.1/msvc2022_64/include/QtCore/qshareddata.h new file mode 100644 index 0000000000000000000000000000000000000000..d1b2c44675b3dad9a2efb23d43b4edeef37d990f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qshareddata.h @@ -0,0 +1,307 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSHAREDDATA_H +#define QSHAREDDATA_H + +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + + +template class QSharedDataPointer; + +class QSharedData +{ +public: + mutable QAtomicInt ref; + + QSharedData() noexcept : ref(0) { } + QSharedData(const QSharedData &) noexcept : ref(0) { } + + // using the assignment operator would lead to corruption in the ref-counting + QSharedData &operator=(const QSharedData &) = delete; + ~QSharedData() = default; +}; + +struct QAdoptSharedDataTag { explicit constexpr QAdoptSharedDataTag() = default; }; + +template +class QSharedDataPointer +{ +public: + typedef T Type; + typedef T *pointer; + + void detach() { if (d && d->ref.loadRelaxed() != 1) detach_helper(); } + T &operator*() { detach(); return *d; } + const T &operator*() const { return *d; } + T *operator->() { detach(); return d; } + const T *operator->() const noexcept { return d; } + operator T *() { detach(); return d; } + operator const T *() const noexcept { return d; } + T *data() { detach(); return d; } + T *get() { detach(); return d; } + const T *data() const noexcept { return d; } + const T *get() const noexcept { return d; } + const T *constData() const noexcept { return d; } + T *take() noexcept { return std::exchange(d, nullptr); } + + Q_NODISCARD_CTOR + QSharedDataPointer() noexcept : d(nullptr) { } + ~QSharedDataPointer() { if (d && !d->ref.deref()) delete d; } + + Q_NODISCARD_CTOR + explicit QSharedDataPointer(T *data) noexcept : d(data) + { if (d) d->ref.ref(); } + Q_NODISCARD_CTOR + QSharedDataPointer(T *data, QAdoptSharedDataTag) noexcept : d(data) + {} + Q_NODISCARD_CTOR + QSharedDataPointer(const QSharedDataPointer &o) noexcept : d(o.d) + { if (d) d->ref.ref(); } + + void reset(T *ptr = nullptr) noexcept + { + if (ptr != d) { + if (ptr) + ptr->ref.ref(); + T *old = std::exchange(d, ptr); + if (old && !old->ref.deref()) + delete old; + } + } + + QSharedDataPointer &operator=(const QSharedDataPointer &o) noexcept + { + reset(o.d); + return *this; + } + inline QSharedDataPointer &operator=(T *o) noexcept + { + reset(o); + return *this; + } + Q_NODISCARD_CTOR + QSharedDataPointer(QSharedDataPointer &&o) noexcept : d(std::exchange(o.d, nullptr)) {} + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QSharedDataPointer) + + operator bool () const noexcept { return d != nullptr; } + bool operator!() const noexcept { return d == nullptr; } + + void swap(QSharedDataPointer &other) noexcept + { qt_ptr_swap(d, other.d); } + +#define DECLARE_COMPARE_SET(T1, A1, T2, A2) \ + friend bool operator<(T1, T2) noexcept \ + { return std::less{}(A1, A2); } \ + friend bool operator<=(T1, T2) noexcept \ + { return !std::less{}(A2, A1); } \ + friend bool operator>(T1, T2) noexcept \ + { return std::less{}(A2, A1); } \ + friend bool operator>=(T1, T2) noexcept \ + { return !std::less{}(A1, A2); } \ + friend bool operator==(T1, T2) noexcept \ + { return A1 == A2; } \ + friend bool operator!=(T1, T2) noexcept \ + { return A1 != A2; } \ + + DECLARE_COMPARE_SET(const QSharedDataPointer &p1, p1.d, const QSharedDataPointer &p2, p2.d) + DECLARE_COMPARE_SET(const QSharedDataPointer &p1, p1.d, const T *ptr, ptr) + DECLARE_COMPARE_SET(const T *ptr, ptr, const QSharedDataPointer &p2, p2.d) + DECLARE_COMPARE_SET(const QSharedDataPointer &p1, p1.d, std::nullptr_t, nullptr) + DECLARE_COMPARE_SET(std::nullptr_t, nullptr, const QSharedDataPointer &p2, p2.d) + +protected: + T *clone(); + +private: + void detach_helper(); + + T *d; +}; + +template +class QExplicitlySharedDataPointer +{ +public: + typedef T Type; + typedef T *pointer; + + T &operator*() const { return *d; } + T *operator->() noexcept { return d; } + T *operator->() const noexcept { return d; } + explicit operator T *() { return d; } + explicit operator const T *() const noexcept { return d; } + T *data() const noexcept { return d; } + T *get() const noexcept { return d; } + const T *constData() const noexcept { return d; } + T *take() noexcept { return std::exchange(d, nullptr); } + + void detach() { if (d && d->ref.loadRelaxed() != 1) detach_helper(); } + + Q_NODISCARD_CTOR + QExplicitlySharedDataPointer() noexcept : d(nullptr) { } + ~QExplicitlySharedDataPointer() { if (d && !d->ref.deref()) delete d; } + + Q_NODISCARD_CTOR + explicit QExplicitlySharedDataPointer(T *data) noexcept : d(data) + { if (d) d->ref.ref(); } + Q_NODISCARD_CTOR + QExplicitlySharedDataPointer(T *data, QAdoptSharedDataTag) noexcept : d(data) + {} + Q_NODISCARD_CTOR + QExplicitlySharedDataPointer(const QExplicitlySharedDataPointer &o) noexcept : d(o.d) + { if (d) d->ref.ref(); } + + template + Q_NODISCARD_CTOR + QExplicitlySharedDataPointer(const QExplicitlySharedDataPointer &o) noexcept +#ifdef QT_ENABLE_QEXPLICITLYSHAREDDATAPOINTER_STATICCAST + : d{(warnIfQExplicitlySharedDataPointerStaticCastMacroDefined(), static_cast(o.data()))} +#else + : d(o.data()) +#endif + { if (d) d->ref.ref(); } + + void reset(T *ptr = nullptr) noexcept + { + if (ptr != d) { + if (ptr) + ptr->ref.ref(); + T *old = std::exchange(d, ptr); + if (old && !old->ref.deref()) + delete old; + } + } + + QExplicitlySharedDataPointer &operator=(const QExplicitlySharedDataPointer &o) noexcept + { + reset(o.d); + return *this; + } + QExplicitlySharedDataPointer &operator=(T *o) noexcept + { + reset(o); + return *this; + } + Q_NODISCARD_CTOR + QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o) noexcept : d(std::exchange(o.d, nullptr)) {} + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QExplicitlySharedDataPointer) + + operator bool () const noexcept { return d != nullptr; } + bool operator!() const noexcept { return d == nullptr; } + + void swap(QExplicitlySharedDataPointer &other) noexcept + { qt_ptr_swap(d, other.d); } + + DECLARE_COMPARE_SET(const QExplicitlySharedDataPointer &p1, p1.d, const QExplicitlySharedDataPointer &p2, p2.d) + DECLARE_COMPARE_SET(const QExplicitlySharedDataPointer &p1, p1.d, const T *ptr, ptr) + DECLARE_COMPARE_SET(const T *ptr, ptr, const QExplicitlySharedDataPointer &p2, p2.d) + DECLARE_COMPARE_SET(const QExplicitlySharedDataPointer &p1, p1.d, std::nullptr_t, nullptr) + DECLARE_COMPARE_SET(std::nullptr_t, nullptr, const QExplicitlySharedDataPointer &p2, p2.d) + +#undef DECLARE_COMPARE_SET + +protected: + T *clone(); + +private: + void detach_helper(); + +#ifdef QT_ENABLE_QEXPLICITLYSHAREDDATAPOINTER_STATICCAST + [[deprecated("Usage of QT_ENABLE_QEXPLICITLYSHAREDDATAPOINTER_STATICCAST is deprecated.")]] + constexpr void warnIfQExplicitlySharedDataPointerStaticCastMacroDefined() {} +#endif + + T *d; +}; + +// Declared here and as Q_OUTOFLINE_TEMPLATE to work-around MSVC bug causing missing symbols at link time. +template +Q_INLINE_TEMPLATE T *QSharedDataPointer::clone() +{ + return new T(*d); +} + +template +Q_OUTOFLINE_TEMPLATE void QSharedDataPointer::detach_helper() +{ + T *x = clone(); + x->ref.ref(); + if (!d->ref.deref()) + delete d; + d = x; +} + +template +Q_INLINE_TEMPLATE T *QExplicitlySharedDataPointer::clone() +{ + return new T(*d); +} + +template +Q_OUTOFLINE_TEMPLATE void QExplicitlySharedDataPointer::detach_helper() +{ + T *x = clone(); + x->ref.ref(); + if (!d->ref.deref()) + delete d; + d = x; +} + +template +void swap(QSharedDataPointer &p1, QSharedDataPointer &p2) noexcept +{ p1.swap(p2); } + +template +void swap(QExplicitlySharedDataPointer &p1, QExplicitlySharedDataPointer &p2) noexcept +{ p1.swap(p2); } + +template +size_t qHash(const QSharedDataPointer &ptr, size_t seed = 0) noexcept +{ + return qHash(ptr.data(), seed); +} +template +size_t qHash(const QExplicitlySharedDataPointer &ptr, size_t seed = 0) noexcept +{ + return qHash(ptr.data(), seed); +} + +template Q_DECLARE_TYPEINFO_BODY(QSharedDataPointer, Q_RELOCATABLE_TYPE); +template Q_DECLARE_TYPEINFO_BODY(QExplicitlySharedDataPointer, Q_RELOCATABLE_TYPE); + +#define QT_DECLARE_QSDP_SPECIALIZATION_DTOR(Class) \ + template<> QSharedDataPointer::~QSharedDataPointer(); + +#define QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(Class, ExportMacro) \ + template<> ExportMacro QSharedDataPointer::~QSharedDataPointer(); + +#define QT_DEFINE_QSDP_SPECIALIZATION_DTOR(Class) \ + template<> QSharedDataPointer::~QSharedDataPointer() \ + { \ + if (d && !d->ref.deref()) \ + delete d; \ + } + +#define QT_DECLARE_QESDP_SPECIALIZATION_DTOR(Class) \ + template<> QExplicitlySharedDataPointer::~QExplicitlySharedDataPointer(); + +#define QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(Class, ExportMacro) \ + template<> ExportMacro QExplicitlySharedDataPointer::~QExplicitlySharedDataPointer(); + +#define QT_DEFINE_QESDP_SPECIALIZATION_DTOR(Class) \ + template<> QExplicitlySharedDataPointer::~QExplicitlySharedDataPointer() \ + { \ + if (d && !d->ref.deref()) \ + delete d; \ + } + +QT_END_NAMESPACE + +#endif // QSHAREDDATA_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qshareddata_impl.h b/qt/6.8.1/msvc2022_64/include/QtCore/qshareddata_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..7a3cd84bbcc150ad107b1a7f8d21817b6d311f6c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qshareddata_impl.h @@ -0,0 +1,142 @@ +// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#if 0 +#pragma qt_sync_skip_header_check +#pragma qt_sync_stop_processing +#endif + +#ifndef QSHAREDDATA_IMPL_H +#define QSHAREDDATA_IMPL_H + +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtPrivate { + +template +class QExplicitlySharedDataPointerV2 +{ + T *d; + +public: + constexpr QExplicitlySharedDataPointerV2() noexcept : d(nullptr) {} + + explicit QExplicitlySharedDataPointerV2(T *t) noexcept + : d(t) + { + if (d) + d->ref.ref(); + } + + QExplicitlySharedDataPointerV2(T *t, QAdoptSharedDataTag) noexcept + : d(t) + { + } + + QExplicitlySharedDataPointerV2(const QExplicitlySharedDataPointerV2 &other) noexcept + : d(other.d) + { + if (d) + d->ref.ref(); + } + + QExplicitlySharedDataPointerV2 &operator=(const QExplicitlySharedDataPointerV2 &other) noexcept + { + QExplicitlySharedDataPointerV2 copy(other); + swap(copy); + return *this; + } + + QExplicitlySharedDataPointerV2(QExplicitlySharedDataPointerV2 &&other) noexcept + : d(std::exchange(other.d, nullptr)) + { + } + + QExplicitlySharedDataPointerV2 &operator=(QExplicitlySharedDataPointerV2 &&other) noexcept + { + QExplicitlySharedDataPointerV2 moved(std::move(other)); + swap(moved); + return *this; + } + + ~QExplicitlySharedDataPointerV2() + { + if (d && !d->ref.deref()) + delete d; + } + + void detach() + { + if (!d) { + // should this codepath be here on in all user's detach()? + d = new T; + d->ref.ref(); + } else if (d->ref.loadRelaxed() != 1) { + // TODO: qAtomicDetach here...? + QExplicitlySharedDataPointerV2 copy(new T(*d)); + swap(copy); + } + } + + void reset(T *t = nullptr) noexcept + { + if (d && !d->ref.deref()) + delete d; + d = t; + if (d) + d->ref.ref(); + } + + constexpr T *take() noexcept + { + return std::exchange(d, nullptr); + } + + bool isShared() const noexcept + { + return d && d->ref.loadRelaxed() != 1; + } + + constexpr void swap(QExplicitlySharedDataPointerV2 &other) noexcept + { + qt_ptr_swap(d, other.d); + } + + // important change from QExplicitlySharedDataPointer: deep const + constexpr T &operator*() { return *d; } + constexpr T *operator->() { return d; } + constexpr const T &operator*() const { return *d; } + constexpr const T *operator->() const { return d; } + + constexpr T *data() noexcept { return d; } + constexpr const T *data() const noexcept { return d; } + + constexpr explicit operator bool() const noexcept { return d; } + + constexpr friend bool operator==(const QExplicitlySharedDataPointerV2 &lhs, + const QExplicitlySharedDataPointerV2 &rhs) noexcept + { + return lhs.d == rhs.d; + } + + constexpr friend bool operator!=(const QExplicitlySharedDataPointerV2 &lhs, + const QExplicitlySharedDataPointerV2 &rhs) noexcept + { + return lhs.d != rhs.d; + } +}; + +template +constexpr void swap(QExplicitlySharedDataPointerV2 &lhs, QExplicitlySharedDataPointerV2 &rhs) noexcept +{ + lhs.swap(rhs); +} + +} // namespace QtPrivate + +QT_END_NAMESPACE + +#endif // QSHAREDDATA_IMPL_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qsharedmemory.h b/qt/6.8.1/msvc2022_64/include/QtCore/qsharedmemory.h new file mode 100644 index 0000000000000000000000000000000000000000..53eb43f6ed8155f83421f96b4757aedd74cd7de3 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qsharedmemory.h @@ -0,0 +1,99 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSHAREDMEMORY_H +#define QSHAREDMEMORY_H + +#include +#ifndef QT_NO_QOBJECT +# include +#else +# include +# include +# include +#endif + +QT_BEGIN_NAMESPACE + +#if QT_CONFIG(sharedmemory) + +class QSharedMemoryPrivate; + +class Q_CORE_EXPORT QSharedMemory : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QSharedMemory) + +public: + enum AccessMode + { + ReadOnly, + ReadWrite + }; + Q_ENUM(AccessMode) + + enum SharedMemoryError + { + NoError, + PermissionDenied, + InvalidSize, + KeyError, + AlreadyExists, + NotFound, + LockError, + OutOfResources, + UnknownError + }; + Q_ENUM(SharedMemoryError) + + QSharedMemory(QObject *parent = nullptr); + QSharedMemory(const QNativeIpcKey &key, QObject *parent = nullptr); + ~QSharedMemory(); + + QSharedMemory(const QString &key, QObject *parent = nullptr); + void setKey(const QString &key); + QString key() const; + + void setNativeKey(const QNativeIpcKey &key); + void setNativeKey(const QString &key, QNativeIpcKey::Type type = QNativeIpcKey::legacyDefaultTypeForOs()) + { setNativeKey({ key, type }); } + QString nativeKey() const; + QNativeIpcKey nativeIpcKey() const; +#if QT_CORE_REMOVED_SINCE(6, 5) + void setNativeKey(const QString &key); +#endif + + bool create(qsizetype size, AccessMode mode = ReadWrite); + qsizetype size() const; + + bool attach(AccessMode mode = ReadWrite); + bool isAttached() const; + bool detach(); + + void *data(); + const void* constData() const; + const void *data() const; + +#if QT_CONFIG(systemsemaphore) + bool lock(); + bool unlock(); +#endif + + SharedMemoryError error() const; + QString errorString() const; + + static bool isKeyTypeSupported(QNativeIpcKey::Type type) Q_DECL_CONST_FUNCTION; + static QNativeIpcKey platformSafeKey(const QString &key, + QNativeIpcKey::Type type = QNativeIpcKey::DefaultTypeForOs); + static QNativeIpcKey legacyNativeKey(const QString &key, + QNativeIpcKey::Type type = QNativeIpcKey::legacyDefaultTypeForOs()); + +private: + Q_DISABLE_COPY(QSharedMemory) +}; + +#endif // QT_CONFIG(sharedmemory) + +QT_END_NAMESPACE + +#endif // QSHAREDMEMORY_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qsharedpointer.h b/qt/6.8.1/msvc2022_64/include/QtCore/qsharedpointer.h new file mode 100644 index 0000000000000000000000000000000000000000..9e5188275b4e8d0a1dd8648ef6aaa6b492f418ee --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qsharedpointer.h @@ -0,0 +1,185 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSHAREDPOINTER_H +#define QSHAREDPOINTER_H + +#include +#include +#include + +#ifndef Q_QDOC +# include +#else + +#include // for std::shared_ptr + +QT_BEGIN_NAMESPACE + + +// These classes are here to fool qdoc into generating a better documentation + +template +class QSharedPointer +{ +public: + // basic accessor functions + T *data() const; + T *get() const; + bool isNull() const; + operator bool() const; + bool operator!() const; + T &operator*() const; + T *operator->() const; + + // constructors + QSharedPointer(); + template explicit QSharedPointer(X *ptr); + template QSharedPointer(X *ptr, Deleter d); + QSharedPointer(std::nullptr_t); + template QSharedPointer(std::nullptr_t, Deleter d); + QSharedPointer(const QSharedPointer &other); + QSharedPointer(const QWeakPointer &other); + QSharedPointer(QSharedPointer &&other) noexcept; + + ~QSharedPointer() { } + + QSharedPointer &operator=(const QSharedPointer &other); + QSharedPointer &operator=(QSharedPointer &&other) noexcept; + QSharedPointer &operator=(const QWeakPointer &other); + + template + QSharedPointer(QSharedPointer && other) noexcept; + template + QSharedPointer &operator=(QSharedPointer && other) noexcept; + + void swap(QSharedPointer &other) noexcept; + + QWeakPointer toWeakRef() const; + + void clear(); + + void reset(); + void reset(T *t); + template + void reset(T *t, Deleter deleter); + + // casts: + template QSharedPointer staticCast() const; + template QSharedPointer dynamicCast() const; + template QSharedPointer constCast() const; + template QSharedPointer objectCast() const; + + template + static inline QSharedPointer create(Args &&... args); + + // owner-based comparisons + template + bool owner_before(const QSharedPointer &other) const noexcept; + template + bool owner_before(const QWeakPointer &other) const noexcept; + + template + bool owner_equal(const QSharedPointer &other) const noexcept; + template + bool owner_equal(const QWeakPointer &other) const noexcept; + + size_t owner_hash() const noexcept; +}; + +template +size_t qHash(const QSharedPointer &key, size_t seed = 0) noexcept; + +template +class QWeakPointer +{ +public: + // basic accessor functions + bool isNull() const; + operator bool() const; + bool operator!() const; + + // constructors: + QWeakPointer(); + QWeakPointer(const QWeakPointer &other) noexcept; + QWeakPointer(QWeakPointer &&other) noexcept; + QWeakPointer(const QSharedPointer &other); + + ~QWeakPointer(); + + QWeakPointer &operator=(const QWeakPointer &other) noexcept; + QWeakPointer &operator=(QWeakPointer &&other) noexcept; + QWeakPointer &operator=(const QSharedPointer &other); + + QWeakPointer(const QObject *other); + QWeakPointer &operator=(const QObject *other); + + void swap(QWeakPointer &other) noexcept; + + T *data() const; + void clear(); + + QSharedPointer toStrongRef() const; + QSharedPointer lock() const; + + // owner-based comparisons + template + bool owner_before(const QWeakPointer &other) const noexcept; + template + bool owner_before(const QSharedPointer &other) const noexcept; + + template + bool owner_equal(const QWeakPointer &other) const noexcept; + template + bool owner_equal(const QSharedPointer &other) const noexcept; + + size_t owner_hash() const noexcept; +}; + +template +class QEnableSharedFromThis +{ +public: + QSharedPointer sharedFromThis(); + QSharedPointer sharedFromThis() const; +}; + +template bool operator==(const QSharedPointer &ptr1, const QSharedPointer &ptr2); +template bool operator!=(const QSharedPointer &ptr1, const QSharedPointer &ptr2); +template bool operator==(const QSharedPointer &ptr1, const X *ptr2); +template bool operator!=(const QSharedPointer &ptr1, const X *ptr2); +template bool operator==(const T *ptr1, const QSharedPointer &ptr2); +template bool operator!=(const T *ptr1, const QSharedPointer &ptr2); +template bool operator==(const QWeakPointer &ptr1, const QSharedPointer &ptr2); +template bool operator!=(const QWeakPointer &ptr1, const QSharedPointer &ptr2); +template bool operator==(const QSharedPointer &ptr1, const QWeakPointer &ptr2); +template bool operator!=(const QSharedPointer &ptr1, const QWeakPointer &ptr2); +template bool operator==(const QSharedPointer &lhs, std::nullptr_t); +template bool operator!=(const QSharedPointer &lhs, std::nullptr_t); +template bool operator==(std::nullptr_t, const QSharedPointer &rhs); +template bool operator!=(std::nullptr_t, const QSharedPointer &rhs); +template bool operator==(const QWeakPointer &lhs, std::nullptr_t); +template bool operator!=(const QWeakPointer &lhs, std::nullptr_t); +template bool operator==(std::nullptr_t, const QWeakPointer &rhs); +template bool operator!=(std::nullptr_t, const QWeakPointer &rhs); + +template QSharedPointer qSharedPointerCast(const QSharedPointer &other); +template QSharedPointer qSharedPointerCast(const QWeakPointer &other); +template QSharedPointer qSharedPointerDynamicCast(const QSharedPointer &src); +template QSharedPointer qSharedPointerDynamicCast(const QWeakPointer &src); +template QSharedPointer qSharedPointerConstCast(const QSharedPointer &src); +template QSharedPointer qSharedPointerConstCast(const QWeakPointer &src); +template QSharedPointer qSharedPointerObjectCast(const QSharedPointer &src); +template QSharedPointer qSharedPointerObjectCast(const QWeakPointer &src); +template std::shared_ptr qobject_pointer_cast(const std::shared_ptr &src); +template std::shared_ptr qobject_pointer_cast(std::shared_ptr &&src); +template std::shared_ptr qSharedPointerObjectCast(const std::shared_ptr &src); +template std::shared_ptr qSharedPointerObjectCast(std::shared_ptr &&src); + +template QWeakPointer qWeakPointerCast(const QWeakPointer &src); + +QT_END_NAMESPACE + +#endif // Q_QDOC + +#endif // QSHAREDPOINTER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qsharedpointer_impl.h b/qt/6.8.1/msvc2022_64/include/QtCore/qsharedpointer_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..8ecb0380224225ef17359914c9b6f0ea53fc7868 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qsharedpointer_impl.h @@ -0,0 +1,1004 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// Copyright (C) 2022 Intel Corporation. +// Copyright (C) 2019 Klarälvdalens Datakonsult AB. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef Q_QDOC + +#ifndef QSHAREDPOINTER_H +#error Do not include qsharedpointer_impl.h directly +#endif + +#if 0 +#pragma qt_sync_skip_header_check +#pragma qt_sync_stop_processing +#endif + +#if 0 +// These macros are duplicated here to make syncqt not complain a about +// this header, as we have a "qt_sync_stop_processing" below, which in turn +// is here because this file contains a template mess and duplicates the +// classes found in qsharedpointer.h +QT_BEGIN_NAMESPACE +QT_END_NAMESPACE +#pragma qt_sync_stop_processing +#endif + +#include +#include +#include +#include // for IsPointerToTypeDerivedFromQObject +#include + +#include + +QT_BEGIN_NAMESPACE + +class QObject; +template +T qobject_cast(const QObject *object); + +// +// forward declarations +// +template class QWeakPointer; +template class QSharedPointer; +template class QEnableSharedFromThis; + +class QVariant; + +template +QSharedPointer qSharedPointerCast(const QSharedPointer &ptr); +template +QSharedPointer qSharedPointerDynamicCast(const QSharedPointer &ptr); +template +QSharedPointer qSharedPointerConstCast(const QSharedPointer &ptr); + +#ifndef QT_NO_QOBJECT +template +QSharedPointer qSharedPointerObjectCast(const QSharedPointer &ptr); +#endif + +namespace QtPrivate { +struct EnableInternalData; +} + +namespace QtSharedPointer { + template class ExternalRefCount; + + template QSharedPointer copyAndSetPointer(X * ptr, const QSharedPointer &src); + + // used in debug mode to verify the reuse of pointers + Q_CORE_EXPORT void internalSafetyCheckAdd(const void *, const volatile void *); + Q_CORE_EXPORT void internalSafetyCheckRemove(const void *); + + template + inline void executeDeleter(T *t, RetVal (Klass:: *memberDeleter)()) + { if (t) (t->*memberDeleter)(); } + template + inline void executeDeleter(T *t, Deleter d) + { d(t); } + struct NormalDeleter {}; + + // this uses partial template specialization + template struct RemovePointer; + template struct RemovePointer { typedef T Type; }; + template struct RemovePointer > { typedef T Type; }; + template struct RemovePointer > { typedef T Type; }; + + // This class is the d-pointer of QSharedPointer and QWeakPointer. + // + // It is a reference-counted reference counter. "strongref" is the inner + // reference counter, and it tracks the lifetime of the pointer itself. + // "weakref" is the outer reference counter and it tracks the lifetime of + // the ExternalRefCountData object. + // + // The deleter is stored in the destroyer member and is always a pointer to + // a static function in ExternalRefCountWithCustomDeleter or in + // ExternalRefCountWithContiguousData + struct ExternalRefCountData + { + typedef void (*DestroyerFn)(ExternalRefCountData *); + QBasicAtomicInt weakref; + QBasicAtomicInt strongref; + DestroyerFn destroyer; + + inline ExternalRefCountData(DestroyerFn d) + : destroyer(d) + { + strongref.storeRelaxed(1); + weakref.storeRelaxed(1); + } + inline ExternalRefCountData(Qt::Initialization) { } + ~ExternalRefCountData() { Q_ASSERT(!weakref.loadRelaxed()); Q_ASSERT(strongref.loadRelaxed() <= 0); } + + void destroy() { destroyer(this); } + +#ifndef QT_NO_QOBJECT + Q_CORE_EXPORT static ExternalRefCountData *getAndRef(const QObject *); + QT6_ONLY( + Q_CORE_EXPORT void setQObjectShared(const QObject *, bool enable); + ) + QT6_ONLY(Q_CORE_EXPORT void checkQObjectShared(const QObject *);) +#endif + inline void checkQObjectShared(...) { } + inline void setQObjectShared(...) { } + + // Normally, only subclasses of ExternalRefCountData are allocated + // One exception exists in getAndRef; that uses the global operator new + // to prevent a mismatch with the custom operator delete + inline void *operator new(std::size_t) = delete; + // placement new + inline void *operator new(std::size_t, void *ptr) noexcept { return ptr; } + inline void operator delete(void *ptr) { ::operator delete(ptr); } + inline void operator delete(void *, void *) { } + }; + // sizeof(ExternalRefCountData) = 12 (32-bit) / 16 (64-bit) + + template + struct CustomDeleter + { + Deleter deleter; + T *ptr; + + CustomDeleter(T *p, Deleter d) : deleter(d), ptr(p) {} + void execute() { executeDeleter(ptr, deleter); } + }; + // sizeof(CustomDeleter) = sizeof(Deleter) + sizeof(void*) + padding + // for Deleter = stateless functor: 8 (32-bit) / 16 (64-bit) due to padding + // for Deleter = function pointer: 8 (32-bit) / 16 (64-bit) + // for Deleter = PMF: 12 (32-bit) / 24 (64-bit) (GCC) + + // This specialization of CustomDeleter for a deleter of type NormalDeleter + // is an optimization: instead of storing a pointer to a function that does + // the deleting, we simply delete the pointer ourselves. + template + struct CustomDeleter + { + T *ptr; + + CustomDeleter(T *p, NormalDeleter) : ptr(p) {} + void execute() { delete ptr; } + }; + // sizeof(CustomDeleter specialization) = sizeof(void*) + + // This class extends ExternalRefCountData and implements + // the static function that deletes the object. The pointer and the + // custom deleter are kept in the "extra" member so we can construct + // and destruct it independently of the full structure. + template + struct ExternalRefCountWithCustomDeleter: public ExternalRefCountData + { + typedef ExternalRefCountWithCustomDeleter Self; + typedef ExternalRefCountData BaseClass; + CustomDeleter extra; + + static inline void deleter(ExternalRefCountData *self) + { + Self *realself = static_cast(self); + realself->extra.execute(); + + // delete the deleter too + realself->extra.~CustomDeleter(); + } + static void safetyCheckDeleter(ExternalRefCountData *self) + { + internalSafetyCheckRemove(self); + deleter(self); + } + + static inline Self *create(T *ptr, Deleter userDeleter, DestroyerFn actualDeleter) + { + Self *d = static_cast(::operator new(sizeof(Self))); + + // initialize the two sub-objects + new (&d->extra) CustomDeleter(ptr, userDeleter); + new (d) BaseClass(actualDeleter); // can't throw + + return d; + } + private: + // prevent construction + ExternalRefCountWithCustomDeleter() = delete; + ~ExternalRefCountWithCustomDeleter() = delete; + Q_DISABLE_COPY(ExternalRefCountWithCustomDeleter) + }; + + // This class extends ExternalRefCountData and adds a "T" + // member. That way, when the create() function is called, we allocate + // memory for both QSharedPointer's d-pointer and the actual object being + // tracked. + template + struct ExternalRefCountWithContiguousData: public ExternalRefCountData + { + typedef ExternalRefCountData Parent; + typedef typename std::remove_cv::type NoCVType; + NoCVType data; + + static void deleter(ExternalRefCountData *self) + { + ExternalRefCountWithContiguousData *that = + static_cast(self); + that->data.~T(); + Q_UNUSED(that); // MSVC warns if T has a trivial destructor + } + static void safetyCheckDeleter(ExternalRefCountData *self) + { + internalSafetyCheckRemove(self); + deleter(self); + } + static void noDeleter(ExternalRefCountData *) { } + + static inline ExternalRefCountData *create(NoCVType **ptr, DestroyerFn destroy) + { + ExternalRefCountWithContiguousData *d = + static_cast(::operator new(sizeof(ExternalRefCountWithContiguousData))); + + // initialize the d-pointer sub-object + // leave d->data uninitialized + new (d) Parent(destroy); // can't throw + + *ptr = &d->data; + return d; + } + + private: + // prevent construction + ExternalRefCountWithContiguousData() = delete; + ~ExternalRefCountWithContiguousData() = delete; + Q_DISABLE_COPY(ExternalRefCountWithContiguousData) + }; + +#ifndef QT_NO_QOBJECT + Q_CORE_EXPORT QWeakPointer weakPointerFromVariant_internal(const QVariant &variant); + Q_CORE_EXPORT QSharedPointer sharedPointerFromVariant_internal(const QVariant &variant); +#endif +} // namespace QtSharedPointer + +template class QSharedPointer +{ + typedef QtSharedPointer::ExternalRefCountData Data; + template + using IfCompatible = typename std::enable_if::value, bool>::type; + +public: + typedef T Type; + typedef T element_type; + typedef T value_type; + typedef value_type *pointer; + typedef const value_type *const_pointer; + typedef value_type &reference; + typedef const value_type &const_reference; + typedef qptrdiff difference_type; + + T *data() const noexcept { return value; } + T *get() const noexcept { return value; } + bool isNull() const noexcept { return !data(); } + explicit operator bool() const noexcept { return !isNull(); } + bool operator !() const noexcept { return isNull(); } + T &operator*() const { return *data(); } + T *operator->() const noexcept { return data(); } + + Q_NODISCARD_CTOR + constexpr QSharedPointer() noexcept : value(nullptr), d(nullptr) { } + ~QSharedPointer() { deref(); } + + Q_NODISCARD_CTOR + constexpr QSharedPointer(std::nullptr_t) noexcept : value(nullptr), d(nullptr) { } + + template = true> + Q_NODISCARD_CTOR + inline explicit QSharedPointer(X *ptr) : value(ptr) // noexcept + { internalConstruct(ptr, QtSharedPointer::NormalDeleter()); } + + template = true> + Q_NODISCARD_CTOR + inline QSharedPointer(X *ptr, Deleter deleter) : value(ptr) // throws + { internalConstruct(ptr, deleter); } + + template + Q_NODISCARD_CTOR + QSharedPointer(std::nullptr_t, Deleter deleter) : value(nullptr) + { internalConstruct(static_cast(nullptr), deleter); } + + Q_NODISCARD_CTOR + QSharedPointer(const QSharedPointer &other) noexcept : value(other.value), d(other.d) + { if (d) ref(); } + QSharedPointer &operator=(const QSharedPointer &other) noexcept + { + QSharedPointer copy(other); + swap(copy); + return *this; + } + Q_NODISCARD_CTOR + QSharedPointer(QSharedPointer &&other) noexcept + : value(other.value), d(other.d) + { + other.d = nullptr; + other.value = nullptr; + } + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QSharedPointer) + + template = true> + Q_NODISCARD_CTOR + QSharedPointer(QSharedPointer &&other) noexcept + : value(other.value), d(other.d) + { + other.d = nullptr; + other.value = nullptr; + } + + template = true> + QSharedPointer &operator=(QSharedPointer &&other) noexcept + { + QSharedPointer moved(std::move(other)); + swap(moved); + return *this; + } + + template = true> + Q_NODISCARD_CTOR + QSharedPointer(const QSharedPointer &other) noexcept : value(other.value), d(other.d) + { if (d) ref(); } + + template = true> + inline QSharedPointer &operator=(const QSharedPointer &other) + { + QSharedPointer copy(other); + swap(copy); + return *this; + } + + template = true> + Q_NODISCARD_CTOR + inline QSharedPointer(const QWeakPointer &other) : value(nullptr), d(nullptr) + { *this = other; } + + template = true> + inline QSharedPointer &operator=(const QWeakPointer &other) + { internalSet(other.d, other.value); return *this; } + + inline void swap(QSharedPointer &other) noexcept + { this->internalSwap(other); } + + inline void reset() { clear(); } + inline void reset(T *t) + { QSharedPointer copy(t); swap(copy); } + template + inline void reset(T *t, Deleter deleter) + { QSharedPointer copy(t, deleter); swap(copy); } + + template + QSharedPointer staticCast() const + { + return qSharedPointerCast(*this); + } + + template + QSharedPointer dynamicCast() const + { + return qSharedPointerDynamicCast(*this); + } + + template + QSharedPointer constCast() const + { + return qSharedPointerConstCast(*this); + } + +#ifndef QT_NO_QOBJECT + template + QSharedPointer objectCast() const + { + return qSharedPointerObjectCast(*this); + } +#endif + + inline void clear() { QSharedPointer copy; swap(copy); } + + [[nodiscard]] QWeakPointer toWeakRef() const; + + template + [[nodiscard]] static QSharedPointer create(Args && ...arguments) + { + typedef QtSharedPointer::ExternalRefCountWithContiguousData Private; +# ifdef QT_SHAREDPOINTER_TRACK_POINTERS + typename Private::DestroyerFn destroy = &Private::safetyCheckDeleter; +# else + typename Private::DestroyerFn destroy = &Private::deleter; +# endif + typename Private::DestroyerFn noDestroy = &Private::noDeleter; + QSharedPointer result(Qt::Uninitialized); + typename std::remove_cv::type *ptr; + result.d = Private::create(&ptr, noDestroy); + + // now initialize the data + new (ptr) T(std::forward(arguments)...); + result.value = ptr; + result.d->destroyer = destroy; + result.d->setQObjectShared(result.value, true); +# ifdef QT_SHAREDPOINTER_TRACK_POINTERS + internalSafetyCheckAdd(result.d, result.value); +# endif + result.enableSharedFromThis(result.data()); + return result; + } + +#define DECLARE_COMPARE_SET(T1, A1, T2, A2) \ + friend bool operator==(T1, T2) noexcept \ + { return A1 == A2; } \ + friend bool operator!=(T1, T2) noexcept \ + { return A1 != A2; } + +#define DECLARE_TEMPLATE_COMPARE_SET(T1, A1, T2, A2) \ + template \ + friend bool operator==(T1, T2) noexcept \ + { return A1 == A2; } \ + template \ + friend bool operator!=(T1, T2) noexcept \ + { return A1 != A2; } + + DECLARE_TEMPLATE_COMPARE_SET(const QSharedPointer &p1, p1.data(), const QSharedPointer &p2, p2.data()) + DECLARE_TEMPLATE_COMPARE_SET(const QSharedPointer &p1, p1.data(), X *ptr, ptr) + DECLARE_TEMPLATE_COMPARE_SET(X *ptr, ptr, const QSharedPointer &p2, p2.data()) + DECLARE_COMPARE_SET(const QSharedPointer &p1, p1.data(), std::nullptr_t, nullptr) + DECLARE_COMPARE_SET(std::nullptr_t, nullptr, const QSharedPointer &p2, p2.data()) +#undef DECLARE_TEMPLATE_COMPARE_SET +#undef DECLARE_COMPARE_SET + + template + bool owner_before(const QSharedPointer &other) const noexcept + { return std::less<>()(d, other.d); } + template + bool owner_before(const QWeakPointer &other) const noexcept + { return std::less<>()(d, other.d); } + + template + bool owner_equal(const QSharedPointer &other) const noexcept + { return d == other.d; } + template + bool owner_equal(const QWeakPointer &other) const noexcept + { return d == other.d; } + + size_t owner_hash() const noexcept + { return std::hash()(d); } + +private: + Q_NODISCARD_CTOR + explicit QSharedPointer(Qt::Initialization) {} + + void deref() noexcept + { deref(d); } + static void deref(Data *dd) noexcept + { + if (!dd) return; + if (!dd->strongref.deref()) { + dd->destroy(); + } + if (!dd->weakref.deref()) + delete dd; + } + + template + inline void enableSharedFromThis(const QEnableSharedFromThis *ptr) + { + ptr->initializeFromSharedPointer(constCast::type>()); + } + + inline void enableSharedFromThis(...) {} + + template + inline void internalConstruct(X *ptr, Deleter deleter) + { + typedef QtSharedPointer::ExternalRefCountWithCustomDeleter Private; +# ifdef QT_SHAREDPOINTER_TRACK_POINTERS + typename Private::DestroyerFn actualDeleter = &Private::safetyCheckDeleter; +# else + typename Private::DestroyerFn actualDeleter = &Private::deleter; +# endif + d = Private::create(ptr, deleter, actualDeleter); + +#ifdef QT_SHAREDPOINTER_TRACK_POINTERS + internalSafetyCheckAdd(d, ptr); +#endif + enableSharedFromThis(ptr); + } + + void internalSwap(QSharedPointer &other) noexcept + { + qt_ptr_swap(d, other.d); + qt_ptr_swap(this->value, other.value); + } + + template friend class QSharedPointer; + template friend class QWeakPointer; + template friend QSharedPointer QtSharedPointer::copyAndSetPointer(X * ptr, const QSharedPointer &src); + void ref() const noexcept { d->weakref.ref(); d->strongref.ref(); } + + inline void internalSet(Data *o, T *actual) + { + if (o) { + // increase the strongref, but never up from zero + // or less (-1 is used by QWeakPointer on untracked QObject) + int tmp = o->strongref.loadRelaxed(); + while (tmp > 0) { + // try to increment from "tmp" to "tmp + 1" + if (o->strongref.testAndSetRelaxed(tmp, tmp + 1)) + break; // succeeded + tmp = o->strongref.loadRelaxed(); // failed, try again + } + + if (tmp > 0) + o->weakref.ref(); + else + o = nullptr; + } + + qt_ptr_swap(d, o); + qt_ptr_swap(this->value, actual); + if (!d || d->strongref.loadRelaxed() == 0) + this->value = nullptr; + + // dereference saved data + deref(o); + } + + Type *value; + Data *d; +}; + +template +class QWeakPointer +{ + typedef QtSharedPointer::ExternalRefCountData Data; + template + using IfCompatible = typename std::enable_if::value, bool>::type; + + template + using IfVirtualBase = typename std::enable_if, bool>::type; + + template + using IfNotVirtualBase = typename std::enable_if, bool>::type; + +public: + typedef T element_type; + typedef T value_type; + typedef value_type *pointer; + typedef const value_type *const_pointer; + typedef value_type &reference; + typedef const value_type &const_reference; + typedef qptrdiff difference_type; + + bool isNull() const noexcept { return d == nullptr || d->strongref.loadRelaxed() == 0 || value == nullptr; } + explicit operator bool() const noexcept { return !isNull(); } + bool operator !() const noexcept { return isNull(); } + + Q_NODISCARD_CTOR + constexpr QWeakPointer() noexcept : d(nullptr), value(nullptr) { } + inline ~QWeakPointer() { if (d && !d->weakref.deref()) delete d; } + + Q_NODISCARD_CTOR + QWeakPointer(const QWeakPointer &other) noexcept : d(other.d), value(other.value) + { if (d) d->weakref.ref(); } + Q_NODISCARD_CTOR + QWeakPointer(QWeakPointer &&other) noexcept + : d(other.d), value(other.value) + { + other.d = nullptr; + other.value = nullptr; + } + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QWeakPointer) + + template = true, IfNotVirtualBase = true> + Q_NODISCARD_CTOR + QWeakPointer(QWeakPointer &&other) noexcept + : d(std::exchange(other.d, nullptr)), + value(std::exchange(other.value, nullptr)) + { + } + + template = true, IfVirtualBase = true> + Q_NODISCARD_CTOR + QWeakPointer(QWeakPointer &&other) noexcept + : d(other.d), value(other.toStrongRef().get()) // must go through QSharedPointer, see below + { + other.d = nullptr; + other.value = nullptr; + } + + template = true> + QWeakPointer &operator=(QWeakPointer &&other) noexcept + { + QWeakPointer moved(std::move(other)); + swap(moved); + return *this; + } + + QWeakPointer &operator=(const QWeakPointer &other) noexcept + { + QWeakPointer copy(other); + swap(copy); + return *this; + } + + void swap(QWeakPointer &other) noexcept + { + qt_ptr_swap(this->d, other.d); + qt_ptr_swap(this->value, other.value); + } + + Q_NODISCARD_CTOR + inline QWeakPointer(const QSharedPointer &o) : d(o.d), value(o.data()) + { if (d) d->weakref.ref();} + inline QWeakPointer &operator=(const QSharedPointer &o) + { + internalSet(o.d, o.value); + return *this; + } + + template = true> + Q_NODISCARD_CTOR + inline QWeakPointer(const QWeakPointer &o) : d(nullptr), value(nullptr) + { *this = o; } + + template = true> + inline QWeakPointer &operator=(const QWeakPointer &o) + { + // conversion between X and T could require access to the virtual table + // so force the operation to go through QSharedPointer + *this = o.toStrongRef(); + return *this; + } + + template = true> + Q_NODISCARD_CTOR + inline QWeakPointer(const QSharedPointer &o) : d(nullptr), value(nullptr) + { *this = o; } + + template = true> + inline QWeakPointer &operator=(const QSharedPointer &o) + { + internalSet(o.d, o.data()); + return *this; + } + + inline void clear() { *this = QWeakPointer(); } + + [[nodiscard]] QSharedPointer toStrongRef() const { return QSharedPointer(*this); } + // std::weak_ptr compatibility: + [[nodiscard]] QSharedPointer lock() const { return toStrongRef(); } + + template + bool operator==(const QWeakPointer &o) const noexcept + { return d == o.d && value == static_cast(o.value); } + + template + bool operator!=(const QWeakPointer &o) const noexcept + { return !(*this == o); } + + template + bool operator==(const QSharedPointer &o) const noexcept + { return d == o.d; } + + template + bool operator!=(const QSharedPointer &o) const noexcept + { return !(*this == o); } + + template + friend bool operator==(const QSharedPointer &p1, const QWeakPointer &p2) noexcept + { return p2 == p1; } + template + friend bool operator!=(const QSharedPointer &p1, const QWeakPointer &p2) noexcept + { return p2 != p1; } + + friend bool operator==(const QWeakPointer &p, std::nullptr_t) + { return p.isNull(); } + friend bool operator==(std::nullptr_t, const QWeakPointer &p) + { return p.isNull(); } + friend bool operator!=(const QWeakPointer &p, std::nullptr_t) + { return !p.isNull(); } + friend bool operator!=(std::nullptr_t, const QWeakPointer &p) + { return !p.isNull(); } + + template + bool owner_before(const QWeakPointer &other) const noexcept + { return std::less<>()(d, other.d); } + template + bool owner_before(const QSharedPointer &other) const noexcept + { return std::less<>()(d, other.d); } + + template + bool owner_equal(const QWeakPointer &other) const noexcept + { return d == other.d; } + template + bool owner_equal(const QSharedPointer &other) const noexcept + { return d == other.d; } + + size_t owner_hash() const noexcept + { return std::hash()(d); } + +private: + friend struct QtPrivate::EnableInternalData; + template friend class QSharedPointer; + template friend class QWeakPointer; + template friend class QPointer; + + template + inline QWeakPointer &assign(X *ptr) + { return *this = QWeakPointer(ptr, true); } + +#ifndef QT_NO_QOBJECT + template = true> + Q_NODISCARD_CTOR + inline QWeakPointer(X *ptr, bool) : d(ptr ? Data::getAndRef(ptr) : nullptr), value(ptr) + { } +#endif + + inline void internalSet(Data *o, T *actual) + { + if (d == o) return; + if (o) + o->weakref.ref(); + if (d && !d->weakref.deref()) + delete d; + d = o; + value = actual; + } + + // ### TODO - QTBUG-88102: remove all users of this API; no one should ever + // access a weak pointer's data but the weak pointer itself + inline T *internalData() const noexcept + { + return d == nullptr || d->strongref.loadRelaxed() == 0 ? nullptr : value; + } + + Data *d; + T *value; +}; + +namespace QtPrivate { +struct EnableInternalData { + template + static T *internalData(const QWeakPointer &p) noexcept { return p.internalData(); } +}; +// hack to delay name lookup to instantiation time by making +// EnableInternalData a dependent name: +template +struct EnableInternalDataWrap : EnableInternalData {}; +} + +template +class QEnableSharedFromThis +{ +protected: + QEnableSharedFromThis() = default; + QEnableSharedFromThis(const QEnableSharedFromThis &) {} + QEnableSharedFromThis &operator=(const QEnableSharedFromThis &) { return *this; } + +public: + inline QSharedPointer sharedFromThis() { return QSharedPointer(weakPointer); } + inline QSharedPointer sharedFromThis() const { return QSharedPointer(weakPointer); } + +private: + template friend class QSharedPointer; + template + inline void initializeFromSharedPointer(const QSharedPointer &ptr) const + { + weakPointer = ptr; + } + + mutable QWeakPointer weakPointer; +}; + +// +// operator- +// +template +Q_INLINE_TEMPLATE typename QSharedPointer::difference_type operator-(const QSharedPointer &ptr1, const QSharedPointer &ptr2) +{ + return ptr1.data() - ptr2.data(); +} +template +Q_INLINE_TEMPLATE typename QSharedPointer::difference_type operator-(const QSharedPointer &ptr1, X *ptr2) +{ + return ptr1.data() - ptr2; +} +template +Q_INLINE_TEMPLATE typename QSharedPointer::difference_type operator-(T *ptr1, const QSharedPointer &ptr2) +{ + return ptr1 - ptr2.data(); +} + +// +// operator< +// +template +Q_INLINE_TEMPLATE bool operator<(const QSharedPointer &ptr1, const QSharedPointer &ptr2) +{ + using CT = typename std::common_type::type; + return std::less()(ptr1.data(), ptr2.data()); +} +template +Q_INLINE_TEMPLATE bool operator<(const QSharedPointer &ptr1, X *ptr2) +{ + using CT = typename std::common_type::type; + return std::less()(ptr1.data(), ptr2); +} +template +Q_INLINE_TEMPLATE bool operator<(T *ptr1, const QSharedPointer &ptr2) +{ + using CT = typename std::common_type::type; + return std::less()(ptr1, ptr2.data()); +} + +// +// qHash +// +template +Q_INLINE_TEMPLATE size_t qHash(const QSharedPointer &ptr, size_t seed = 0) +{ + return qHash(ptr.data(), seed); +} + + +template +Q_INLINE_TEMPLATE QWeakPointer QSharedPointer::toWeakRef() const +{ + return QWeakPointer(*this); +} + +template +inline void swap(QSharedPointer &p1, QSharedPointer &p2) noexcept +{ p1.swap(p2); } + +template +inline void swap(QWeakPointer &p1, QWeakPointer &p2) noexcept +{ p1.swap(p2); } + +namespace QtSharedPointer { +// helper functions: + template + Q_INLINE_TEMPLATE QSharedPointer copyAndSetPointer(X *ptr, const QSharedPointer &src) + { + QSharedPointer result; + result.internalSet(src.d, ptr); + return result; + } +} + +// cast operators +template +Q_INLINE_TEMPLATE QSharedPointer qSharedPointerCast(const QSharedPointer &src) +{ + X *ptr = static_cast(src.data()); // if you get an error in this line, the cast is invalid + return QtSharedPointer::copyAndSetPointer(ptr, src); +} +template +Q_INLINE_TEMPLATE QSharedPointer qSharedPointerCast(const QWeakPointer &src) +{ + return qSharedPointerCast(src.toStrongRef()); +} + +template +Q_INLINE_TEMPLATE QSharedPointer qSharedPointerDynamicCast(const QSharedPointer &src) +{ + X *ptr = dynamic_cast(src.data()); // if you get an error in this line, the cast is invalid + if (!ptr) + return QSharedPointer(); + return QtSharedPointer::copyAndSetPointer(ptr, src); +} +template +Q_INLINE_TEMPLATE QSharedPointer qSharedPointerDynamicCast(const QWeakPointer &src) +{ + return qSharedPointerDynamicCast(src.toStrongRef()); +} + +template +Q_INLINE_TEMPLATE QSharedPointer qSharedPointerConstCast(const QSharedPointer &src) +{ + X *ptr = const_cast(src.data()); // if you get an error in this line, the cast is invalid + return QtSharedPointer::copyAndSetPointer(ptr, src); +} +template +Q_INLINE_TEMPLATE QSharedPointer qSharedPointerConstCast(const QWeakPointer &src) +{ + return qSharedPointerConstCast(src.toStrongRef()); +} + +template +Q_INLINE_TEMPLATE +QWeakPointer qWeakPointerCast(const QSharedPointer &src) +{ + return qSharedPointerCast(src).toWeakRef(); +} + +#ifndef QT_NO_QOBJECT +template +Q_INLINE_TEMPLATE QSharedPointer qSharedPointerObjectCast(const QSharedPointer &src) +{ + X *ptr = qobject_cast(src.data()); + if (!ptr) + return QSharedPointer(); + return QtSharedPointer::copyAndSetPointer(ptr, src); +} +template +Q_INLINE_TEMPLATE QSharedPointer qSharedPointerObjectCast(const QWeakPointer &src) +{ + return qSharedPointerObjectCast(src.toStrongRef()); +} + +template +inline QSharedPointer::Type> +qobject_cast(const QSharedPointer &src) +{ + return qSharedPointerObjectCast::Type, T>(src); +} +template +inline QSharedPointer::Type> +qobject_cast(const QWeakPointer &src) +{ + return qSharedPointerObjectCast::Type, T>(src); +} + +/// ### TODO - QTBUG-88102: make this use toStrongRef() (once support for +/// storing non-managed QObjects in QWeakPointer is removed) +template +QWeakPointer::Value, T>::type> +qWeakPointerFromVariant(const QVariant &variant) +{ + return QWeakPointer(qobject_cast(QtPrivate::EnableInternalData::internalData(QtSharedPointer::weakPointerFromVariant_internal(variant)))); +} +template +QSharedPointer::Value, T>::type> +qSharedPointerFromVariant(const QVariant &variant) +{ + return qSharedPointerObjectCast(QtSharedPointer::sharedPointerFromVariant_internal(variant)); +} + +// std::shared_ptr helpers + +template +std::shared_ptr qobject_pointer_cast(const std::shared_ptr &src) +{ + using element_type = typename std::shared_ptr::element_type; + if (auto ptr = qobject_cast(src.get())) + return std::shared_ptr(src, ptr); + return std::shared_ptr(); +} + +template +std::shared_ptr qobject_pointer_cast(std::shared_ptr &&src) +{ + using element_type = typename std::shared_ptr::element_type; + auto castResult = qobject_cast(src.get()); + if (castResult) { + // C++2a's move aliasing constructor will leave src empty. + // Before C++2a we don't really know if the compiler has support for it. + // The move aliasing constructor is the resolution for LWG2996, + // which does not impose a feature-testing macro. So: clear src. + return std::shared_ptr(std::exchange(src, nullptr), castResult); + } + return std::shared_ptr(); +} + +template +std::shared_ptr qSharedPointerObjectCast(const std::shared_ptr &src) +{ + return qobject_pointer_cast(src); +} + +template +std::shared_ptr qSharedPointerObjectCast(std::shared_ptr &&src) +{ + return qobject_pointer_cast(std::move(src)); +} + +#endif + +template Q_DECLARE_TYPEINFO_BODY(QWeakPointer, Q_RELOCATABLE_TYPE); +template Q_DECLARE_TYPEINFO_BODY(QSharedPointer, Q_RELOCATABLE_TYPE); + + +QT_END_NAMESPACE + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qsignalmapper.h b/qt/6.8.1/msvc2022_64/include/QtCore/qsignalmapper.h new file mode 100644 index 0000000000000000000000000000000000000000..d076eb21ce860adbbb4b7643d65d4bb9d055c6c9 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qsignalmapper.h @@ -0,0 +1,45 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSIGNALMAPPER_H +#define QSIGNALMAPPER_H + +#include + +QT_BEGIN_NAMESPACE + +class QSignalMapperPrivate; + +class Q_CORE_EXPORT QSignalMapper : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QSignalMapper) +public: + explicit QSignalMapper(QObject *parent = nullptr); + ~QSignalMapper(); + + void setMapping(QObject *sender, int id); + void setMapping(QObject *sender, const QString &text); + void setMapping(QObject *sender, QObject *object); + void removeMappings(QObject *sender); + + QObject *mapping(int id) const; + QObject *mapping(const QString &text) const; + QObject *mapping(QObject *object) const; + +Q_SIGNALS: + void mappedInt(int); + void mappedString(const QString &); + void mappedObject(QObject *); + +public Q_SLOTS: + void map(); + void map(QObject *sender); + +private: + Q_DISABLE_COPY(QSignalMapper) +}; + +QT_END_NAMESPACE + +#endif // QSIGNALMAPPER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qsimd.h b/qt/6.8.1/msvc2022_64/include/QtCore/qsimd.h new file mode 100644 index 0000000000000000000000000000000000000000..8d53c1b357612e405b71318f7b1de250a35d7245 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qsimd.h @@ -0,0 +1,134 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2022 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSIMD_H +#define QSIMD_H + +#include + +/* + * qconfig.h defines the QT_COMPILER_SUPPORTS_XXX macros. + * They mean the compiler supports the necessary flags and the headers + * for the x86 and ARM intrinsics. + * + * Supported instruction set extensions are: + * Flag | Arch + * neon | ARM + * mips_dsp | mips + * mips_dspr2 | mips + * sse2 | x86 + * sse4_1 | x86 + * sse4_2 | x86 + * avx | x86 + * + * Code can use the following constructs to determine compiler support & status: + * - #if QT_COMPILER_USES(XXX) (e.g: #if QT_COMPILER_USES(neon) or QT_COMPILER_USES(sse4_1) + * If this test passes, then the compiler is already generating code using the + * given instruction set. The intrinsics for those instructions are + * #included and can be used without restriction or runtime check. + * + * Code that requires runtime detection and different code paths at runtime is + * currently not supported here, have a look at qsimd_p.h for support. + */ + +#define QT_COMPILER_USES(feature) (1/QT_COMPILER_USES_##feature == 1) + +#if defined(Q_PROCESSOR_ARM) && defined(__ARM_NEON) || defined(__ARM_NEON__) || defined(_M_ARM64) +# include +# define QT_COMPILER_USES_neon 1 +#else +# define QT_COMPILER_USES_neon -1 +#endif + +#if defined(Q_PROCESSOR_MIPS) && (defined(__MIPS_DSP__) || (defined(__mips_dsp) && defined(Q_PROCESSOR_MIPS_32))) +# define QT_COMPILER_USES_mips_dsp 1 +#else +# define QT_COMPILER_USES_mips_dsp -1 +#endif + +#if defined(Q_PROCESSOR_MIPS) && (defined(__MIPS_DSPR2__) || (defined(__mips_dspr2) && defined(Q_PROCESSOR_MIPS_32))) +# define QT_COMPILER_USES_mips_dspr2 1 +#else +# define QT_COMPILER_USES_mips_dspr2 -1 +#endif + +#if defined(Q_PROCESSOR_X86) && defined(Q_CC_MSVC) +// MSVC doesn't define __SSE2__, so do it ourselves +# if (defined(_M_X64) || _M_IX86_FP >= 2) && defined(QT_COMPILER_SUPPORTS_SSE2) +# define __SSE__ 1 +# define __SSE2__ 1 +# endif +# if (defined(_M_AVX) || defined(__AVX__)) +// Visual Studio defines __AVX__ when /arch:AVX is passed, but not the earlier macros +// See: https://msdn.microsoft.com/en-us/library/b0084kay.aspx +# define __SSE3__ 1 +# define __SSSE3__ 1 +# define __SSE4_1__ 1 +# define __SSE4_2__ 1 +# define __POPCNT__ 1 +# ifndef __AVX__ +# define __AVX__ 1 +# endif +# endif +# ifdef __SSE2__ +# define QT_VECTORCALL __vectorcall +# endif +# ifdef __AVX2__ +// MSVC defines __AVX2__ with /arch:AVX2 +# define __F16C__ 1 +# define __RDRND__ 1 +# define __FMA__ 1 +# define __BMI__ 1 +# define __BMI2__ 1 +# define __MOVBE__ 1 +# define __LZCNT__ 1 +# endif +// Starting with /arch:AVX512, MSVC defines all the macros +#endif + +#if defined(Q_PROCESSOR_X86) && defined(__SSE2__) +# include +# define QT_COMPILER_USES_sse2 1 +#else +# define QT_COMPILER_USES_sse2 -1 +#endif + +#if defined(Q_PROCESSOR_X86) && defined(__SSE3__) +# define QT_COMPILER_USES_sse3 1 +#else +# define QT_COMPILER_USES_sse3 -1 +#endif + +#if defined(Q_PROCESSOR_X86) && defined(__SSSE3__) +# define QT_COMPILER_USES_ssse3 1 +#else +# define QT_COMPILER_USES_ssse3 -1 +#endif + +#if defined(Q_PROCESSOR_X86) && defined(__SSE4_1__) +# define QT_COMPILER_USES_sse4_1 1 +#else +# define QT_COMPILER_USES_sse4_1 -1 +#endif + +#if defined(Q_PROCESSOR_X86) && defined(__SSE4_2__) +# define QT_COMPILER_USES_sse4_2 1 +#else +# define QT_COMPILER_USES_sse4_2 -1 +#endif + +#if defined(Q_PROCESSOR_X86) && defined(__AVX__) +# define QT_COMPILER_USES_avx 1 +#else +# define QT_COMPILER_USES_avx -1 +#endif + +#ifndef QT_VECTORCALL +#define QT_VECTORCALL +#endif + +QT_BEGIN_NAMESPACE +QT_END_NAMESPACE + +#endif // QSIMD_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qsize.h b/qt/6.8.1/msvc2022_64/include/QtCore/qsize.h new file mode 100644 index 0000000000000000000000000000000000000000..11726e8b5f9a838d2879dd14c8ae300a27584104 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qsize.h @@ -0,0 +1,434 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSIZE_H +#define QSIZE_H + +#include +#include +#include + +#include +#include + +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) +struct CGSize; +#endif + +QT_BEGIN_NAMESPACE + +// QT_ENABLE_P0846_SEMANTICS_FOR(get) // from qmargins.h + +class QSizeF; + +class Q_CORE_EXPORT QSize +{ +public: + constexpr QSize() noexcept; + constexpr QSize(int w, int h) noexcept; + + constexpr inline bool isNull() const noexcept; + constexpr inline bool isEmpty() const noexcept; + constexpr inline bool isValid() const noexcept; + + constexpr inline int width() const noexcept; + constexpr inline int height() const noexcept; + constexpr inline void setWidth(int w) noexcept; + constexpr inline void setHeight(int h) noexcept; + void transpose() noexcept; + [[nodiscard]] constexpr inline QSize transposed() const noexcept; + + inline void scale(int w, int h, Qt::AspectRatioMode mode) noexcept; + inline void scale(const QSize &s, Qt::AspectRatioMode mode) noexcept; + [[nodiscard]] QSize scaled(int w, int h, Qt::AspectRatioMode mode) const noexcept; + [[nodiscard]] QSize scaled(const QSize &s, Qt::AspectRatioMode mode) const noexcept; + + [[nodiscard]] constexpr inline QSize expandedTo(const QSize &) const noexcept; + [[nodiscard]] constexpr inline QSize boundedTo(const QSize &) const noexcept; + + [[nodiscard]] constexpr QSize grownBy(QMargins m) const noexcept + { return {width() + m.left() + m.right(), height() + m.top() + m.bottom()}; } + [[nodiscard]] constexpr QSize shrunkBy(QMargins m) const noexcept + { return {width() - m.left() - m.right(), height() - m.top() - m.bottom()}; } + + constexpr inline int &rwidth() noexcept; + constexpr inline int &rheight() noexcept; + + constexpr inline QSize &operator+=(const QSize &) noexcept; + constexpr inline QSize &operator-=(const QSize &) noexcept; + constexpr inline QSize &operator*=(qreal c) noexcept; + inline QSize &operator/=(qreal c); + +private: + friend constexpr bool comparesEqual(const QSize &s1, const QSize &s2) noexcept + { return s1.wd == s2.wd && s1.ht == s2.ht; } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QSize) + friend inline constexpr QSize operator+(const QSize &s1, const QSize &s2) noexcept + { return QSize(s1.wd + s2.wd, s1.ht + s2.ht); } + friend inline constexpr QSize operator-(const QSize &s1, const QSize &s2) noexcept + { return QSize(s1.wd - s2.wd, s1.ht - s2.ht); } + friend inline constexpr QSize operator*(const QSize &s, qreal c) noexcept + { return QSize(qRound(s.wd * c), qRound(s.ht * c)); } + friend inline constexpr QSize operator*(qreal c, const QSize &s) noexcept + { return s * c; } + friend inline QSize operator/(const QSize &s, qreal c) + { Q_ASSERT(!qFuzzyIsNull(c)); return QSize(qRound(s.wd / c), qRound(s.ht / c)); } + friend inline constexpr size_t qHash(const QSize &, size_t) noexcept; + +public: +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) + [[nodiscard]] CGSize toCGSize() const noexcept; +#endif + + [[nodiscard]] inline constexpr QSizeF toSizeF() const noexcept; + +private: + int wd; + int ht; + + template = true, + std::enable_if_t, QSize>, bool> = true> + friend constexpr decltype(auto) get(S &&s) noexcept + { + if constexpr (I == 0) + return q23::forward_like(s.wd); + else if constexpr (I == 1) + return q23::forward_like(s.ht); + } +}; +Q_DECLARE_TYPEINFO(QSize, Q_RELOCATABLE_TYPE); + +/***************************************************************************** + QSize stream functions + *****************************************************************************/ + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QSize &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QSize &); +#endif + + +/***************************************************************************** + QSize inline functions + *****************************************************************************/ + +constexpr inline QSize::QSize() noexcept : wd(-1), ht(-1) {} + +constexpr inline QSize::QSize(int w, int h) noexcept : wd(w), ht(h) {} + +constexpr inline bool QSize::isNull() const noexcept +{ return wd == 0 && ht == 0; } + +constexpr inline bool QSize::isEmpty() const noexcept +{ return wd < 1 || ht < 1; } + +constexpr inline bool QSize::isValid() const noexcept +{ return wd >= 0 && ht >= 0; } + +constexpr inline int QSize::width() const noexcept +{ return wd; } + +constexpr inline int QSize::height() const noexcept +{ return ht; } + +constexpr inline void QSize::setWidth(int w) noexcept +{ wd = w; } + +constexpr inline void QSize::setHeight(int h) noexcept +{ ht = h; } + +constexpr inline QSize QSize::transposed() const noexcept +{ return QSize(ht, wd); } + +inline void QSize::scale(int w, int h, Qt::AspectRatioMode mode) noexcept +{ scale(QSize(w, h), mode); } + +inline void QSize::scale(const QSize &s, Qt::AspectRatioMode mode) noexcept +{ *this = scaled(s, mode); } + +inline QSize QSize::scaled(int w, int h, Qt::AspectRatioMode mode) const noexcept +{ return scaled(QSize(w, h), mode); } + +constexpr inline int &QSize::rwidth() noexcept +{ return wd; } + +constexpr inline int &QSize::rheight() noexcept +{ return ht; } + +constexpr inline QSize &QSize::operator+=(const QSize &s) noexcept +{ + wd += s.wd; + ht += s.ht; + return *this; +} + +constexpr inline QSize &QSize::operator-=(const QSize &s) noexcept +{ + wd -= s.wd; + ht -= s.ht; + return *this; +} + +constexpr inline QSize &QSize::operator*=(qreal c) noexcept +{ + wd = qRound(wd * c); + ht = qRound(ht * c); + return *this; +} + +constexpr inline size_t qHash(const QSize &s, size_t seed = 0) noexcept +{ return qHashMulti(seed, s.wd, s.ht); } + +inline QSize &QSize::operator/=(qreal c) +{ + Q_ASSERT(!qFuzzyIsNull(c)); + wd = qRound(wd / c); + ht = qRound(ht / c); + return *this; +} + +constexpr inline QSize QSize::expandedTo(const QSize & otherSize) const noexcept +{ + return QSize(qMax(wd,otherSize.wd), qMax(ht,otherSize.ht)); +} + +constexpr inline QSize QSize::boundedTo(const QSize & otherSize) const noexcept +{ + return QSize(qMin(wd,otherSize.wd), qMin(ht,otherSize.ht)); +} + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QSize &); +#endif + + +class Q_CORE_EXPORT QSizeF +{ +public: + constexpr QSizeF() noexcept; + constexpr QSizeF(const QSize &sz) noexcept; + constexpr QSizeF(qreal w, qreal h) noexcept; + + inline bool isNull() const noexcept; + constexpr inline bool isEmpty() const noexcept; + constexpr inline bool isValid() const noexcept; + + constexpr inline qreal width() const noexcept; + constexpr inline qreal height() const noexcept; + constexpr inline void setWidth(qreal w) noexcept; + constexpr inline void setHeight(qreal h) noexcept; + void transpose() noexcept; + [[nodiscard]] constexpr inline QSizeF transposed() const noexcept; + + inline void scale(qreal w, qreal h, Qt::AspectRatioMode mode) noexcept; + inline void scale(const QSizeF &s, Qt::AspectRatioMode mode) noexcept; + [[nodiscard]] QSizeF scaled(qreal w, qreal h, Qt::AspectRatioMode mode) const noexcept; + [[nodiscard]] QSizeF scaled(const QSizeF &s, Qt::AspectRatioMode mode) const noexcept; + + [[nodiscard]] constexpr inline QSizeF expandedTo(const QSizeF &) const noexcept; + [[nodiscard]] constexpr inline QSizeF boundedTo(const QSizeF &) const noexcept; + + [[nodiscard]] constexpr QSizeF grownBy(QMarginsF m) const noexcept + { return {width() + m.left() + m.right(), height() + m.top() + m.bottom()}; } + [[nodiscard]] constexpr QSizeF shrunkBy(QMarginsF m) const noexcept + { return {width() - m.left() - m.right(), height() - m.top() - m.bottom()}; } + + constexpr inline qreal &rwidth() noexcept; + constexpr inline qreal &rheight() noexcept; + + constexpr inline QSizeF &operator+=(const QSizeF &) noexcept; + constexpr inline QSizeF &operator-=(const QSizeF &) noexcept; + constexpr inline QSizeF &operator*=(qreal c) noexcept; + inline QSizeF &operator/=(qreal c); + +private: + QT_WARNING_PUSH + QT_WARNING_DISABLE_FLOAT_COMPARE + friend constexpr bool qFuzzyCompare(const QSizeF &s1, const QSizeF &s2) noexcept + { + // Cannot use qFuzzyCompare(), because it will give incorrect results + // if one of the arguments is 0.0. + return ((!s1.wd || !s2.wd) ? qFuzzyIsNull(s1.wd - s2.wd) : qFuzzyCompare(s1.wd, s2.wd)) + && ((!s1.ht || !s2.ht) ? qFuzzyIsNull(s1.ht - s2.ht) : qFuzzyCompare(s1.ht, s2.ht)); + } + QT_WARNING_POP + friend constexpr bool qFuzzyIsNull(const QSizeF &size) noexcept + { return qFuzzyIsNull(size.wd) && qFuzzyIsNull(size.ht); } + friend constexpr bool comparesEqual(const QSizeF &lhs, const QSizeF &rhs) noexcept + { return qFuzzyCompare(lhs, rhs); } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QSizeF) + friend constexpr bool comparesEqual(const QSizeF &lhs, const QSize &rhs) noexcept + { return comparesEqual(lhs, rhs.toSizeF()); } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QSizeF, QSize) + friend constexpr inline QSizeF operator+(const QSizeF &s1, const QSizeF &s2) noexcept + { return QSizeF(s1.wd + s2.wd, s1.ht + s2.ht); } + friend constexpr inline QSizeF operator-(const QSizeF &s1, const QSizeF &s2) noexcept + { return QSizeF(s1.wd - s2.wd, s1.ht - s2.ht); } + friend constexpr inline QSizeF operator*(const QSizeF &s, qreal c) noexcept + { return QSizeF(s.wd * c, s.ht * c); } + friend constexpr inline QSizeF operator*(qreal c, const QSizeF &s) noexcept + { return s * c; } + friend inline QSizeF operator/(const QSizeF &s, qreal c) + { Q_ASSERT(!qFuzzyIsNull(c)); return QSizeF(s.wd / c, s.ht / c); } + +public: + constexpr inline QSize toSize() const noexcept; + +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) + [[nodiscard]] static QSizeF fromCGSize(CGSize size) noexcept; + [[nodiscard]] CGSize toCGSize() const noexcept; +#endif + +private: + qreal wd; + qreal ht; + + template = true, + std::enable_if_t, QSizeF>, bool> = true> + friend constexpr decltype(auto) get(S &&s) noexcept + { + if constexpr (I == 0) + return q23::forward_like(s.wd); + else if constexpr (I == 1) + return q23::forward_like(s.ht); + } +}; +Q_DECLARE_TYPEINFO(QSizeF, Q_RELOCATABLE_TYPE); + + +/***************************************************************************** + QSizeF stream functions + *****************************************************************************/ + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QSizeF &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QSizeF &); +#endif + + +/***************************************************************************** + QSizeF inline functions + *****************************************************************************/ + +constexpr inline QSizeF::QSizeF() noexcept : wd(-1.), ht(-1.) {} + +constexpr inline QSizeF::QSizeF(const QSize &sz) noexcept : wd(sz.width()), ht(sz.height()) {} + +constexpr inline QSizeF::QSizeF(qreal w, qreal h) noexcept : wd(w), ht(h) {} + +inline bool QSizeF::isNull() const noexcept +{ return qIsNull(wd) && qIsNull(ht); } + +constexpr inline bool QSizeF::isEmpty() const noexcept +{ return wd <= 0. || ht <= 0.; } + +constexpr inline bool QSizeF::isValid() const noexcept +{ return wd >= 0. && ht >= 0.; } + +constexpr inline qreal QSizeF::width() const noexcept +{ return wd; } + +constexpr inline qreal QSizeF::height() const noexcept +{ return ht; } + +constexpr inline void QSizeF::setWidth(qreal w) noexcept +{ wd = w; } + +constexpr inline void QSizeF::setHeight(qreal h) noexcept +{ ht = h; } + +constexpr inline QSizeF QSizeF::transposed() const noexcept +{ return QSizeF(ht, wd); } + +inline void QSizeF::scale(qreal w, qreal h, Qt::AspectRatioMode mode) noexcept +{ scale(QSizeF(w, h), mode); } + +inline void QSizeF::scale(const QSizeF &s, Qt::AspectRatioMode mode) noexcept +{ *this = scaled(s, mode); } + +inline QSizeF QSizeF::scaled(qreal w, qreal h, Qt::AspectRatioMode mode) const noexcept +{ return scaled(QSizeF(w, h), mode); } + +constexpr inline qreal &QSizeF::rwidth() noexcept +{ return wd; } + +constexpr inline qreal &QSizeF::rheight() noexcept +{ return ht; } + +constexpr inline QSizeF &QSizeF::operator+=(const QSizeF &s) noexcept +{ + wd += s.wd; + ht += s.ht; + return *this; +} + +constexpr inline QSizeF &QSizeF::operator-=(const QSizeF &s) noexcept +{ + wd -= s.wd; + ht -= s.ht; + return *this; +} + +constexpr inline QSizeF &QSizeF::operator*=(qreal c) noexcept +{ + wd *= c; + ht *= c; + return *this; +} + +inline QSizeF &QSizeF::operator/=(qreal c) +{ + Q_ASSERT(!qFuzzyIsNull(c) && qIsFinite(c)); + wd = wd / c; + ht = ht / c; + return *this; +} + +constexpr inline QSizeF QSizeF::expandedTo(const QSizeF &otherSize) const noexcept +{ + return QSizeF(qMax(wd, otherSize.wd), qMax(ht, otherSize.ht)); +} + +constexpr inline QSizeF QSizeF::boundedTo(const QSizeF &otherSize) const noexcept +{ + return QSizeF(qMin(wd, otherSize.wd), qMin(ht, otherSize.ht)); +} + +constexpr inline QSize QSizeF::toSize() const noexcept +{ + return QSize(qRound(wd), qRound(ht)); +} + +constexpr QSizeF QSize::toSizeF() const noexcept { return *this; } + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QSizeF &); +#endif + +QT_END_NAMESPACE + +/***************************************************************************** + QSize/QSizeF tuple protocol + *****************************************************************************/ + +namespace std { + template <> + class tuple_size : public integral_constant {}; + template <> + class tuple_element<0, QT_PREPEND_NAMESPACE(QSize)> { public: using type = int; }; + template <> + class tuple_element<1, QT_PREPEND_NAMESPACE(QSize)> { public: using type = int; }; + + template <> + class tuple_size : public integral_constant {}; + template <> + class tuple_element<0, QT_PREPEND_NAMESPACE(QSizeF)> { public: using type = QT_PREPEND_NAMESPACE(qreal); }; + template <> + class tuple_element<1, QT_PREPEND_NAMESPACE(QSizeF)> { public: using type = QT_PREPEND_NAMESPACE(qreal); }; +} + +#endif // QSIZE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qsocketnotifier.h b/qt/6.8.1/msvc2022_64/include/QtCore/qsocketnotifier.h new file mode 100644 index 0000000000000000000000000000000000000000..5d37dbdecc47a355a6723ae62bdd2e8be413e69a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qsocketnotifier.h @@ -0,0 +1,108 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSOCKETNOTIFIER_H +#define QSOCKETNOTIFIER_H + +#include + +QT_BEGIN_NAMESPACE + +class QSocketDescriptor; +class QSocketNotifierPrivate; +class Q_CORE_EXPORT QSocketNotifier : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QSocketNotifier) + +public: + enum Type { Read, Write, Exception }; + + explicit QSocketNotifier(Type, QObject *parent = nullptr); + QSocketNotifier(qintptr socket, Type, QObject *parent = nullptr); + ~QSocketNotifier(); + + void setSocket(qintptr socket); + qintptr socket() const; + Type type() const; + + bool isValid() const; + bool isEnabled() const; + +public Q_SLOTS: + void setEnabled(bool); + +Q_SIGNALS: +#if defined(Q_MOC_RUN) + // Add default arguments during Q_MOC_RUN which makes moc generate "signals" which takes less + // parameters, but we won't actually allow emitting without all 3. This lets users use the + // string-based connect without specifying QSocketNotifier::Type as one of the parameters. + void activated(QSocketDescriptor socket, QSocketNotifier::Type activationEvent = Read, + QPrivateSignal = {}); +#else + void activated(QSocketDescriptor socket, QSocketNotifier::Type activationEvent, QPrivateSignal); +#endif + + // ### Qt7: consider removing it. + // The old signal is compiled internally, but hidden outside of this class. + // This means the PMF-based connect(..) will automatically, on recompile, pick up the new + // version while the old-style connect(..) can query the metaobject system for this version. +#if defined(Q_MOC_RUN) || defined(BUILDING_QSOCKETNOTIFIER) || defined(Q_QDOC) + QT_MOC_COMPAT void activated(int socket, QPrivateSignal); +#endif + +protected: + bool event(QEvent *) override; + +private: + Q_DISABLE_COPY(QSocketNotifier) +}; + +class QSocketDescriptor +{ +public: +#if defined(Q_OS_WIN) || defined(Q_QDOC) + using DescriptorType = Qt::HANDLE; +#define Q_DECL_CONSTEXPR_NOT_WIN +#else + using DescriptorType = int; +#define Q_DECL_CONSTEXPR_NOT_WIN Q_DECL_CONSTEXPR +#endif + + Q_DECL_CONSTEXPR_NOT_WIN Q_IMPLICIT + QSocketDescriptor(DescriptorType descriptor = DescriptorType(-1)) noexcept : sockfd(descriptor) + { + } + +#if defined(Q_OS_WIN) || defined(Q_QDOC) + Q_IMPLICIT QSocketDescriptor(qintptr desc) noexcept : sockfd(DescriptorType(desc)) {} + Q_IMPLICIT operator qintptr() const noexcept { return qintptr(sockfd); } + Q_DECL_CONSTEXPR Qt::HANDLE winHandle() const noexcept { return sockfd; } +#endif + Q_DECL_CONSTEXPR operator DescriptorType() const noexcept { return sockfd; } + + Q_DECL_CONSTEXPR_NOT_WIN bool isValid() const noexcept { return *this != QSocketDescriptor(); } + +private: + friend Q_DECL_CONSTEXPR_NOT_WIN bool comparesEqual(const QSocketDescriptor &lhs, + const QSocketDescriptor &rhs) noexcept + { + return lhs.sockfd == rhs.sockfd; + } +#if defined(Q_OS_WIN) || defined(Q_QDOC) + Q_DECLARE_EQUALITY_COMPARABLE(QSocketDescriptor) +#else + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QSocketDescriptor) +#endif + +#undef Q_DECL_CONSTEXPR_NOT_WIN + + DescriptorType sockfd; +}; + +QT_END_NAMESPACE + +QT_DECL_METATYPE_EXTERN_TAGGED(QSocketNotifier::Type, QSocketNotifier_Type, Q_CORE_EXPORT) +QT_DECL_METATYPE_EXTERN(QSocketDescriptor, Q_CORE_EXPORT) + +#endif // QSOCKETNOTIFIER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qsortfilterproxymodel.h b/qt/6.8.1/msvc2022_64/include/QtCore/qsortfilterproxymodel.h new file mode 100644 index 0000000000000000000000000000000000000000..71409df85f9ae4c1a672b81f1acffec97caf6ac6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qsortfilterproxymodel.h @@ -0,0 +1,179 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSORTFILTERPROXYMODEL_H +#define QSORTFILTERPROXYMODEL_H + +#include + +#include + +QT_REQUIRE_CONFIG(sortfilterproxymodel); + +QT_BEGIN_NAMESPACE + + +class QSortFilterProxyModelPrivate; +class QSortFilterProxyModelLessThan; +class QSortFilterProxyModelGreaterThan; + +class Q_CORE_EXPORT QSortFilterProxyModel : public QAbstractProxyModel +{ + friend class QSortFilterProxyModelLessThan; + friend class QSortFilterProxyModelGreaterThan; + + Q_OBJECT + Q_PROPERTY(QRegularExpression filterRegularExpression READ filterRegularExpression + WRITE setFilterRegularExpression BINDABLE bindableFilterRegularExpression) + Q_PROPERTY(int filterKeyColumn READ filterKeyColumn WRITE setFilterKeyColumn + BINDABLE bindableFilterKeyColumn) + Q_PROPERTY(bool dynamicSortFilter READ dynamicSortFilter WRITE setDynamicSortFilter + BINDABLE bindableDynamicSortFilter) + Q_PROPERTY(Qt::CaseSensitivity filterCaseSensitivity READ filterCaseSensitivity + WRITE setFilterCaseSensitivity NOTIFY filterCaseSensitivityChanged + BINDABLE bindableFilterCaseSensitivity) + Q_PROPERTY(Qt::CaseSensitivity sortCaseSensitivity READ sortCaseSensitivity + WRITE setSortCaseSensitivity NOTIFY sortCaseSensitivityChanged + BINDABLE bindableSortCaseSensitivity) + Q_PROPERTY(bool isSortLocaleAware READ isSortLocaleAware WRITE setSortLocaleAware + NOTIFY sortLocaleAwareChanged BINDABLE bindableIsSortLocaleAware) + Q_PROPERTY(int sortRole READ sortRole WRITE setSortRole NOTIFY sortRoleChanged + BINDABLE bindableSortRole) + Q_PROPERTY(int filterRole READ filterRole WRITE setFilterRole NOTIFY filterRoleChanged + BINDABLE bindableFilterRole) + Q_PROPERTY(bool recursiveFilteringEnabled READ isRecursiveFilteringEnabled + WRITE setRecursiveFilteringEnabled NOTIFY recursiveFilteringEnabledChanged + BINDABLE bindableRecursiveFilteringEnabled) + Q_PROPERTY(bool autoAcceptChildRows READ autoAcceptChildRows WRITE setAutoAcceptChildRows + NOTIFY autoAcceptChildRowsChanged BINDABLE bindableAutoAcceptChildRows) + +public: + explicit QSortFilterProxyModel(QObject *parent = nullptr); + ~QSortFilterProxyModel(); + + void setSourceModel(QAbstractItemModel *sourceModel) override; + + QModelIndex mapToSource(const QModelIndex &proxyIndex) const override; + QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override; + + QItemSelection mapSelectionToSource(const QItemSelection &proxySelection) const override; + QItemSelection mapSelectionFromSource(const QItemSelection &sourceSelection) const override; + + QRegularExpression filterRegularExpression() const; + QBindable bindableFilterRegularExpression(); + + int filterKeyColumn() const; + void setFilterKeyColumn(int column); + QBindable bindableFilterKeyColumn(); + + Qt::CaseSensitivity filterCaseSensitivity() const; + void setFilterCaseSensitivity(Qt::CaseSensitivity cs); + QBindable bindableFilterCaseSensitivity(); + + Qt::CaseSensitivity sortCaseSensitivity() const; + void setSortCaseSensitivity(Qt::CaseSensitivity cs); + QBindable bindableSortCaseSensitivity(); + + bool isSortLocaleAware() const; + void setSortLocaleAware(bool on); + QBindable bindableIsSortLocaleAware(); + + int sortColumn() const; + Qt::SortOrder sortOrder() const; + + bool dynamicSortFilter() const; + void setDynamicSortFilter(bool enable); + QBindable bindableDynamicSortFilter(); + + int sortRole() const; + void setSortRole(int role); + QBindable bindableSortRole(); + + int filterRole() const; + void setFilterRole(int role); + QBindable bindableFilterRole(); + + bool isRecursiveFilteringEnabled() const; + void setRecursiveFilteringEnabled(bool recursive); + QBindable bindableRecursiveFilteringEnabled(); + + bool autoAcceptChildRows() const; + void setAutoAcceptChildRows(bool accept); + QBindable bindableAutoAcceptChildRows(); + +public Q_SLOTS: + void setFilterRegularExpression(const QString &pattern); + void setFilterRegularExpression(const QRegularExpression ®ularExpression); + void setFilterWildcard(const QString &pattern); + void setFilterFixedString(const QString &pattern); + void invalidate(); + +protected: + virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; + virtual bool filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const; + virtual bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const; + + void invalidateFilter(); + void invalidateRowsFilter(); + void invalidateColumnsFilter(); + +public: + using QObject::parent; + + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; + QModelIndex parent(const QModelIndex &child) const override; + QModelIndex sibling(int row, int column, const QModelIndex &idx) const override; + + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int columnCount(const QModelIndex &parent = QModelIndex()) const override; + bool hasChildren(const QModelIndex &parent = QModelIndex()) const override; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; + + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + bool setHeaderData(int section, Qt::Orientation orientation, + const QVariant &value, int role = Qt::EditRole) override; + + QMimeData *mimeData(const QModelIndexList &indexes) const override; + bool dropMimeData(const QMimeData *data, Qt::DropAction action, + int row, int column, const QModelIndex &parent) override; + + bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; + bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override; + bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; + bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override; + + void fetchMore(const QModelIndex &parent) override; + bool canFetchMore(const QModelIndex &parent) const override; + Qt::ItemFlags flags(const QModelIndex &index) const override; + + QModelIndex buddy(const QModelIndex &index) const override; + QModelIndexList match(const QModelIndex &start, int role, + const QVariant &value, int hits = 1, + Qt::MatchFlags flags = + Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const override; + QSize span(const QModelIndex &index) const override; + void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override; + + QStringList mimeTypes() const override; + Qt::DropActions supportedDropActions() const override; + +Q_SIGNALS: + void dynamicSortFilterChanged(bool dynamicSortFilter); + void filterCaseSensitivityChanged(Qt::CaseSensitivity filterCaseSensitivity); + void sortCaseSensitivityChanged(Qt::CaseSensitivity sortCaseSensitivity); + void sortLocaleAwareChanged(bool sortLocaleAware); + void sortRoleChanged(int sortRole); + void filterRoleChanged(int filterRole); + void recursiveFilteringEnabledChanged(bool recursiveFilteringEnabled); + void autoAcceptChildRowsChanged(bool autoAcceptChildRows); + +private: + Q_DECLARE_PRIVATE(QSortFilterProxyModel) + Q_DISABLE_COPY(QSortFilterProxyModel) +}; + +QT_END_NAMESPACE + +#endif // QSORTFILTERPROXYMODEL_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qspan.h b/qt/6.8.1/msvc2022_64/include/QtCore/qspan.h new file mode 100644 index 0000000000000000000000000000000000000000..f4129bb6f54f88103db1e39f131f6ef22290dd82 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qspan.h @@ -0,0 +1,472 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSPAN_H +#define QSPAN_H + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#ifdef __cpp_lib_span +#include +#endif +#include + +QT_BEGIN_NAMESPACE + +// like std::dynamic_extent +namespace q20 { + inline constexpr auto dynamic_extent = std::size_t(-1); +} // namespace q20 + +QT_BEGIN_INCLUDE_NAMESPACE +#ifdef __cpp_lib_span +#ifdef __cpp_lib_concepts +namespace std::ranges { +// Officially, these are defined in , but that is a heavy-hitter header. +// OTOH, must specialize these variable templates, too, so we assume that +// includes some meaningful subset of and just go ahead and use them: +template +constexpr inline bool enable_borrowed_range> = true; +template +constexpr inline bool enable_view> = true; +} // namespace std::ranges +#endif // __cpp_lib_concepts +#endif // __cpp_lib_span +QT_END_INCLUDE_NAMESPACE + +namespace QSpanPrivate { + +template class QSpanBase; + +template +struct is_qspan_helper : std::false_type {}; +template +struct is_qspan_helper> : std::true_type {}; +template +struct is_qspan_helper> : std::true_type {}; +template +using is_qspan = is_qspan_helper>; + +template +struct is_std_span_helper : std::false_type {}; +#ifdef __cpp_lib_span +template +struct is_std_span_helper> : std::true_type {}; +#endif // __cpp_lib_span +template +using is_std_span = is_std_span_helper>; + +template +struct is_std_array_helper : std::false_type {}; +template +struct is_std_array_helper> : std::true_type {}; +template +using is_std_array = is_std_array_helper>; + +template +using is_qualification_conversion = + std::is_convertible; // https://eel.is/c++draft/span.cons#note-1 +template +constexpr inline bool is_qualification_conversion_v = is_qualification_conversion::value; + +namespace AdlTester { +#define MAKE_ADL_TEST(what) \ + using std:: what; /* bring into scope */ \ + template using what ## _result = decltype( what (std::declval())); \ + /* end */ +MAKE_ADL_TEST(begin) +MAKE_ADL_TEST(data) +MAKE_ADL_TEST(size) +#undef MAKE_ADL_TEST +} + +// Replacements for std::ranges::XXX(), but only bringing in ADL XXX()s, +// not doing the extra work C++20 requires +template +AdlTester::begin_result adl_begin(Range &&r) { using std::begin; return begin(r); } +template +AdlTester::data_result adl_data(Range &&r) { using std::data; return data(r); } +template +AdlTester::size_result adl_size(Range &&r) { using std::size; return size(r); } + +// Replacement for std::ranges::iterator_t (which depends on C++20 std::ranges::begin) +// This one uses adl_begin() instead. +template +using iterator_t = decltype(QSpanPrivate::adl_begin(std::declval())); +template +using range_reference_t = q20::iter_reference_t>; + +template +class QSpanCommon { +protected: + template + using is_compatible_iterator = std::conjunction< + // ### C++20: extend to contiguous_iteratorss + std::is_base_of< + std::random_access_iterator_tag, + typename std::iterator_traits::iterator_category + >, + is_qualification_conversion< + std::remove_reference_t>, + T + > + >; + template + using is_compatible_iterator_and_sentinel = std::conjunction< + // ### C++20: extend to contiguous_iterators and real sentinels + is_compatible_iterator, + std::negation> + >; + template // wrap use of SFINAE-unfriendly iterator_t: + struct is_compatible_range_helper : std::false_type {}; + template + struct is_compatible_range_helper>> + : is_compatible_iterator> {}; + template + using is_compatible_range = std::conjunction< + // ### C++20: extend to contiguous_iterators + std::negation>, + std::negation>, + std::negation>, + std::negation>>, + is_compatible_range_helper + >; + + // constraints + template + using if_compatible_iterator = std::enable_if_t< + is_compatible_iterator::value + , bool>; + template + using if_compatible_iterator_and_sentinel = std::enable_if_t< + is_compatible_iterator_and_sentinel::value + , bool>; + template + using if_compatible_range = std::enable_if_t::value, bool>; +}; // class QSpanCommon + +template +class QSpanBase : protected QSpanCommon +{ + static_assert(E < size_t{(std::numeric_limits::max)()}, + "QSpan only supports extents that fit into the signed size type (qsizetype)."); + + template + using if_compatible_array = std::enable_if_t< + N == E && is_qualification_conversion_v + , bool>; + + template + using if_qualification_conversion = std::enable_if_t< + is_qualification_conversion_v + , bool>; +protected: + using Base = QSpanCommon; + + // data members: + T *m_data; + static constexpr qsizetype m_size = qsizetype(E); + + // types and constants: + // (in QSpan only) + + // constructors (need to be public d/t the way ctor inheriting works): +public: + template = true> + Q_IMPLICIT constexpr QSpanBase() noexcept : m_data{nullptr} {} + + template = true> + explicit constexpr QSpanBase(It first, qsizetype count) + : m_data{q20::to_address(first)} + { + Q_ASSERT(count == m_size); + } + + template = true> + explicit constexpr QSpanBase(It first, End last) + : QSpanBase(first, last - first) {} + + template = true> + Q_IMPLICIT constexpr QSpanBase(q20::type_identity_t (&arr)[N]) noexcept + : QSpanBase(arr, N) {} + + template = true> + Q_IMPLICIT constexpr QSpanBase(std::array &arr) noexcept + : QSpanBase(arr.data(), N) {} + + template = true> + Q_IMPLICIT constexpr QSpanBase(const std::array &arr) noexcept + : QSpanBase(arr.data(), N) {} + + template = true> + Q_IMPLICIT constexpr QSpanBase(Range &&r) + : QSpanBase(QSpanPrivate::adl_data(r), // no forward<>() here (std doesn't have it, either) + qsizetype(QSpanPrivate::adl_size(r))) // ditto, no forward<>() + {} + + template = true> + Q_IMPLICIT constexpr QSpanBase(QSpan other) noexcept + : QSpanBase(other.data(), other.size()) + {} + + template = true> + Q_IMPLICIT constexpr QSpanBase(QSpan other) + : QSpanBase(other.data(), other.size()) + {} + + template , bool> = true> + Q_IMPLICIT constexpr QSpanBase(std::initializer_list> il) + : QSpanBase(il.begin(), il.size()) + {} + +#ifdef __cpp_lib_span + template = true> + Q_IMPLICIT constexpr QSpanBase(std::span other) noexcept + : QSpanBase(other.data(), other.size()) + {} + + template = true> + Q_IMPLICIT constexpr QSpanBase(std::span other) + : QSpanBase(other.data(), other.size()) + {} +#endif // __cpp_lib_span +}; // class QSpanBase (fixed extent) + +template +class QSpanBase : protected QSpanCommon +{ + template + using if_qualification_conversion = std::enable_if_t< + is_qualification_conversion_v + , bool>; +protected: + using Base = QSpanCommon; + + // data members: + T *m_data; + qsizetype m_size; + + // constructors (need to be public d/t the way ctor inheriting works): +public: + Q_IMPLICIT constexpr QSpanBase() noexcept : m_data{nullptr}, m_size{0} {} + + template = true> + Q_IMPLICIT constexpr QSpanBase(It first, qsizetype count) + : m_data{q20::to_address(first)}, m_size{count} {} + + template = true> + Q_IMPLICIT constexpr QSpanBase(It first, End last) + : QSpanBase(first, last - first) {} + + template + Q_IMPLICIT constexpr QSpanBase(q20::type_identity_t (&arr)[N]) noexcept + : QSpanBase(arr, N) {} + + template = true> + Q_IMPLICIT constexpr QSpanBase(std::array &arr) noexcept + : QSpanBase(arr.data(), N) {} + + template = true> + Q_IMPLICIT constexpr QSpanBase(const std::array &arr) noexcept + : QSpanBase(arr.data(), N) {} + + template = true> + Q_IMPLICIT constexpr QSpanBase(Range &&r) + : QSpanBase(QSpanPrivate::adl_data(r), // no forward<>() here (std doesn't have it, either) + qsizetype(QSpanPrivate::adl_size(r))) // ditto, no forward<>() + {} + + template = true> + Q_IMPLICIT constexpr QSpanBase(QSpan other) noexcept + : QSpanBase(other.data(), other.size()) + {} + + template , bool> = true> + Q_IMPLICIT constexpr QSpanBase(std::initializer_list> il) noexcept + : QSpanBase(il.begin(), il.size()) + {} + +#ifdef __cpp_lib_span + template = true> + Q_IMPLICIT constexpr QSpanBase(std::span other) noexcept + : QSpanBase(other.data(), other.size()) + {} +#endif // __cpp_lib_span +}; // class QSpanBase (dynamic extent) + +} // namespace QSpanPrivate + +template +class QSpan +#ifndef Q_QDOC + : private QSpanPrivate::QSpanBase +#endif +{ + using Base = QSpanPrivate::QSpanBase; + Q_ALWAYS_INLINE constexpr void verify([[maybe_unused]] qsizetype pos = 0, + [[maybe_unused]] qsizetype n = 1) const + { + Q_ASSERT(pos >= 0); + Q_ASSERT(pos <= size()); + Q_ASSERT(n >= 0); + Q_ASSERT(n <= size() - pos); + } + + template + static constexpr bool subspan_always_succeeds_v = N <= E && E != q20::dynamic_extent; +public: + // constants and types + using value_type = std::remove_cv_t; +#ifdef QT_COMPILER_HAS_LWG3346 + using iterator_concept = std::contiguous_iterator_tag; + using element_type = T; +#endif + using size_type = qsizetype; // difference to std::span + using difference_type = qptrdiff; // difference to std::span + using pointer = T*; + using const_pointer = const T*; + using reference = T&; + using const_reference = const T&; + using iterator = pointer; // implementation-defined choice + using const_iterator = const_pointer; // implementation-defined choice + using reverse_iterator = std::reverse_iterator; + using const_reverse_iterator = std::reverse_iterator; + static constexpr std::size_t extent = E; + + // [span.cons], constructors, copy, and assignment + using Base::Base; +#ifdef Q_QDOC + template using if_compatible_iterator = bool; + template using if_qualification_conversion = bool; + template using if_compatible_range = bool; + template = true> constexpr QSpan(It first, qsizetype count); + template = true> constexpr QSpan(It first, It last); + template constexpr QSpan(q20::type_identity_t (&arr)[N]) noexcept; + template = true> constexpr QSpan(std::array &arr) noexcept; + template = true> constexpr QSpan(const std::array &arr) noexcept; + template = true> constexpr QSpan(Range &&r); + template = true> constexpr QSpan(QSpan other) noexcept; + template = true> constexpr QSpan(std::span other) noexcept; + constexpr QSpan(std::initializer_list il); +#endif // Q_QDOC + + // [span.obs] + [[nodiscard]] constexpr size_type size() const noexcept { return this->m_size; } + [[nodiscard]] constexpr size_type size_bytes() const noexcept { return size() * sizeof(T); } + [[nodiscard]] constexpr bool empty() const noexcept { return size() == 0; } + + // [span.elem] + [[nodiscard]] constexpr reference operator[](size_type idx) const + { verify(idx); return data()[idx]; } + [[nodiscard]] constexpr reference front() const { verify(); return *data(); } + [[nodiscard]] constexpr reference back() const { verify(); return data()[size() - 1]; } + [[nodiscard]] constexpr pointer data() const noexcept { return this->m_data; } + + // [span.iterators] + [[nodiscard]] constexpr iterator begin() const noexcept { return data(); } + [[nodiscard]] constexpr iterator end() const noexcept { return data() + size(); } + [[nodiscard]] constexpr const_iterator cbegin() const noexcept { return begin(); } + [[nodiscard]] constexpr const_iterator cend() const noexcept { return end(); } + [[nodiscard]] constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator{end()}; } + [[nodiscard]] constexpr reverse_iterator rend() const noexcept { return reverse_iterator{begin()}; } + [[nodiscard]] constexpr const_reverse_iterator crbegin() const noexcept { return rbegin(); } + [[nodiscard]] constexpr const_reverse_iterator crend() const noexcept { return rend(); } + + // [span.sub] + template + [[nodiscard]] constexpr QSpan first() const + noexcept(subspan_always_succeeds_v) + { + static_assert(Count <= E, + "Count cannot be larger than the span's extent."); + verify(0, Count); + return QSpan{data(), Count}; + } + + template + [[nodiscard]] constexpr QSpan last() const + noexcept(subspan_always_succeeds_v) + { + static_assert(Count <= E, + "Count cannot be larger than the span's extent."); + verify(0, Count); + return QSpan{data() + (size() - Count), Count}; + } + + template + [[nodiscard]] constexpr auto subspan() const + noexcept(subspan_always_succeeds_v) + { + static_assert(Offset <= E, + "Offset cannot be larger than the span's extent."); + verify(Offset, 0); + if constexpr (E == q20::dynamic_extent) + return QSpan{data() + Offset, qsizetype(size() - Offset)}; + else + return QSpan{data() + Offset, qsizetype(E - Offset)}; + } + + template + [[nodiscard]] constexpr auto subspan() const + noexcept(subspan_always_succeeds_v) + { return subspan().template first(); } + + [[nodiscard]] constexpr QSpan first(size_type n) const { verify(0, n); return {data(), n}; } + [[nodiscard]] constexpr QSpan last(size_type n) const { verify(0, n); return {data() + (size() - n), n}; } + [[nodiscard]] constexpr QSpan subspan(size_type pos) const { verify(pos, 0); return {data() + pos, size() - pos}; } + [[nodiscard]] constexpr QSpan subspan(size_type pos, size_type n) const { return subspan(pos).first(n); } + + // Qt-compatibility API: + [[nodiscard]] constexpr bool isEmpty() const noexcept { return empty(); } + // nullary first()/last() clash with first<>() and last<>(), so they're not provided for QSpan + [[nodiscard]] constexpr QSpan sliced(size_type pos) const { return subspan(pos); } + [[nodiscard]] constexpr QSpan sliced(size_type pos, size_type n) const { return subspan(pos, n); } + +private: + // [span.objectrep] + [[nodiscard]] friend + QSpan + as_bytes(QSpan s) noexcept + { + using R = QSpan; + return R{reinterpret_cast(s.data()), s.size_bytes()}; + } + + template + using if_mutable = std::enable_if_t, bool>; + +#ifndef Q_QDOC + template = true> +#endif + [[nodiscard]] friend + QSpan + as_writable_bytes(QSpan s) noexcept + { + using R = QSpan; + return R{reinterpret_cast(s.data()), s.size_bytes()}; + } +}; // class QSpan + +// [span.deduct] +template +QSpan(It, EndOrSize) -> QSpan>>; +template +QSpan(T (&)[N]) -> QSpan; +template +QSpan(std::array &) -> QSpan; +template +QSpan(const std::array &) -> QSpan; +template +QSpan(R&&) -> QSpan>>; + +QT_END_NAMESPACE + +#endif // QSPAN_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qstack.h b/qt/6.8.1/msvc2022_64/include/QtCore/qstack.h new file mode 100644 index 0000000000000000000000000000000000000000..c345cf8258efab2ccb05a9a3a049ca7c38ee2532 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qstack.h @@ -0,0 +1,25 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSTACK_H +#define QSTACK_H + +#include + +QT_BEGIN_NAMESPACE + +template +class QStack : public QList +{ +public: + // compiler-generated special member functions are fine! + void swap(QStack &other) noexcept { QList::swap(other); } // prevent QList<->QStack swaps + void push(const T &t) { QList::append(t); } + T pop() { return QList::takeLast(); } + T &top() { return QList::last(); } + const T &top() const { return QList::last(); } +}; + +QT_END_NAMESPACE + +#endif // QSTACK_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qstandardpaths.h b/qt/6.8.1/msvc2022_64/include/QtCore/qstandardpaths.h new file mode 100644 index 0000000000000000000000000000000000000000..35991c5a3a9a49d2f8fba1dac0d797f1711abb24 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qstandardpaths.h @@ -0,0 +1,80 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSTANDARDPATHS_H +#define QSTANDARDPATHS_H + +#include +#include + +QT_BEGIN_NAMESPACE + + +#ifndef QT_NO_STANDARDPATHS + +class Q_CORE_EXPORT QStandardPaths +{ + Q_GADGET + +public: + enum StandardLocation { + DesktopLocation, + DocumentsLocation, + FontsLocation, + ApplicationsLocation, + MusicLocation, + MoviesLocation, + PicturesLocation, + TempLocation, + HomeLocation, + AppLocalDataLocation, + CacheLocation, + GenericDataLocation, + RuntimeLocation, + ConfigLocation, + DownloadLocation, + GenericCacheLocation, + GenericConfigLocation, + AppDataLocation, + AppConfigLocation, + PublicShareLocation, + TemplatesLocation, + StateLocation, + GenericStateLocation, + }; + Q_ENUM(StandardLocation) + + static QString writableLocation(StandardLocation type); + static QStringList standardLocations(StandardLocation type); + + enum LocateOption { + LocateFile = 0x0, + LocateDirectory = 0x1 + }; + Q_DECLARE_FLAGS(LocateOptions, LocateOption) + Q_FLAG(LocateOptions) + + static QString locate(StandardLocation type, const QString &fileName, LocateOptions options = LocateFile); + static QStringList locateAll(StandardLocation type, const QString &fileName, LocateOptions options = LocateFile); +#ifndef QT_BOOTSTRAPPED + static QString displayName(StandardLocation type); +#endif + + static QString findExecutable(const QString &executableName, const QStringList &paths = QStringList()); + + static void setTestModeEnabled(bool testMode); + static bool isTestModeEnabled(); + +private: + // prevent construction + QStandardPaths(); + ~QStandardPaths(); +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QStandardPaths::LocateOptions) + +#endif // QT_NO_STANDARDPATHS + +QT_END_NAMESPACE + +#endif // QSTANDARDPATHS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qstaticlatin1stringmatcher.h b/qt/6.8.1/msvc2022_64/include/QtCore/qstaticlatin1stringmatcher.h new file mode 100644 index 0000000000000000000000000000000000000000..af1e8c6043d95fc0611f6579cc61d57fa13d740a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qstaticlatin1stringmatcher.h @@ -0,0 +1,157 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSTATICLATIN1STRINGMATCHER_H +#define QSTATICLATIN1STRINGMATCHER_H + +#include +#include +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#ifdef Q_CC_GHS +# define QT_STATIC_BOYER_MOORE_NOT_SUPPORTED +#else +namespace QtPrivate { +template ::value_type>, + class BinaryPredicate = std::equal_to<>> +class q_boyer_moore_searcher +{ +public: + constexpr q_boyer_moore_searcher(RandomIt1 pat_first, RandomIt1 pat_last) : m_skiptable{} + { + const size_t n = std::distance(pat_first, pat_last); + constexpr auto uchar_max = (std::numeric_limits::max)(); + uchar max = n > uchar_max ? uchar_max : uchar(n); + q20::fill(std::begin(m_skiptable), std::end(m_skiptable), max); + Hash hf; + RandomIt1 pattern = std::next(pat_first, n - max); + while (max--) + m_skiptable[hf(*pattern++)] = max; + } + + template + constexpr auto operator()(RandomIt2 first, RandomIt2 last, RandomIt1 pat_first, + RandomIt1 pat_last) const + { + struct R + { + RandomIt2 begin, end; + }; + Hash hf; + BinaryPredicate pred; + auto pat_length = std::distance(pat_first, pat_last); + if (pat_length == 0) + return R{ first, first }; + + auto haystack_length = std::distance(first, last); + if (haystack_length < pat_length) + return R{ last, last }; + + const qsizetype pl_minus_one = qsizetype(pat_length - 1); + RandomIt2 current = first + pl_minus_one; + + qsizetype skip = 0; + while (current < last - skip) { + current += skip; + skip = m_skiptable[hf(*current)]; + if (!skip) { + // possible match + while (skip < pat_length) { + if (!pred(hf(*(current - skip)), hf(pat_first[pl_minus_one - skip]))) + break; + skip++; + } + if (skip > pl_minus_one) { // we have a match + auto match = current + 1 - skip; + return R{ match, match + pat_length }; + } + + // If we don't have a match we are a bit inefficient as we only skip by one + // when we have the non matching char in the string. + if (m_skiptable[hf(*(current - skip))] == pat_length) + skip = pat_length - skip; + else + skip = 1; + } + } + + return R{ last, last }; + } + +private: + alignas(16) uchar m_skiptable[256]; +}; +} // namespace QtPrivate + +template +class QStaticLatin1StringMatcher +{ + static_assert(N > 2, + "QStaticLatin1StringMatcher makes no sense for finding a single-char pattern"); + + QLatin1StringView m_pattern; + using Hasher = std::conditional_t; + QtPrivate::q_boyer_moore_searcher m_searcher; + +public: + explicit constexpr QStaticLatin1StringMatcher(QLatin1StringView patternToMatch) noexcept + : m_pattern(patternToMatch), + m_searcher(patternToMatch.begin(), patternToMatch.begin() + N - 1) + { + } + + constexpr qsizetype indexIn(QLatin1StringView haystack, qsizetype from = 0) const noexcept + { return indexIn_helper(haystack, from); } + + constexpr qsizetype indexIn(QStringView haystack, qsizetype from = 0) const noexcept + { return indexIn_helper(haystack, from); } + +private: + template + constexpr qsizetype indexIn_helper(String haystack, qsizetype from = 0) const noexcept + { + static_assert(QtPrivate::isLatin1OrUtf16View); + + if (from >= haystack.size()) + return -1; + + const auto start = [haystack]() constexpr { + if constexpr (std::is_same_v) + return haystack.utf16(); + else + return haystack.begin(); + }(); + const auto begin = start + from; + const auto end = start + haystack.size(); + const auto r = m_searcher(begin, end, m_pattern.begin(), m_pattern.end()); + return r.begin == end ? -1 : std::distance(start, r.begin); + } +}; + +template +constexpr auto qMakeStaticCaseSensitiveLatin1StringMatcher(const char (&patternToMatch)[N]) noexcept +{ + return QStaticLatin1StringMatcher( + QLatin1StringView(patternToMatch, qsizetype(N) - 1)); +} + +template +constexpr auto +qMakeStaticCaseInsensitiveLatin1StringMatcher(const char (&patternToMatch)[N]) noexcept +{ + return QStaticLatin1StringMatcher( + QLatin1StringView(patternToMatch, qsizetype(N) - 1)); +} +#endif + +QT_END_NAMESPACE + +#endif // QSTATICLATIN1STRINGMATCHER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qstorageinfo.h b/qt/6.8.1/msvc2022_64/include/QtCore/qstorageinfo.h new file mode 100644 index 0000000000000000000000000000000000000000..7d99bea638ddd950b39275588477e81d4db00b4d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qstorageinfo.h @@ -0,0 +1,83 @@ +// Copyright (C) 2014 Ivan Komissarov +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSTORAGEINFO_H +#define QSTORAGEINFO_H + +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QDebug; + +class QStorageInfoPrivate; +class Q_CORE_EXPORT QStorageInfo +{ +public: + QStorageInfo(); + explicit QStorageInfo(const QString &path); + explicit QStorageInfo(const QDir &dir); + QStorageInfo(const QStorageInfo &other); + ~QStorageInfo(); + + QStorageInfo &operator=(const QStorageInfo &other); + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QStorageInfo) + + inline void swap(QStorageInfo &other) noexcept + { d.swap(other.d); } + + void setPath(const QString &path); + + QString rootPath() const; + QByteArray device() const; + QByteArray subvolume() const; + QByteArray fileSystemType() const; + QString name() const; + QString displayName() const; + + qint64 bytesTotal() const; + qint64 bytesFree() const; + qint64 bytesAvailable() const; + int blockSize() const; + + inline bool isRoot() const; + bool isReadOnly() const; + bool isReady() const; + bool isValid() const; + + void refresh(); + + static QList mountedVolumes(); + static QStorageInfo root(); + +private: + explicit QStorageInfo(QStorageInfoPrivate &dd); + friend class QStorageInfoPrivate; + friend Q_CORE_EXPORT bool + comparesEqual(const QStorageInfo &lhs, const QStorageInfo &rhs) noexcept; + Q_DECLARE_EQUALITY_COMPARABLE(QStorageInfo) + + friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QStorageInfo &); + QExplicitlySharedDataPointer d; +}; + +inline bool QStorageInfo::isRoot() const +{ return *this == QStorageInfo::root(); } + +Q_DECLARE_SHARED(QStorageInfo) + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QStorageInfo &); +#endif + +QT_END_NAMESPACE + +QT_DECL_METATYPE_EXTERN(QStorageInfo, Q_CORE_EXPORT) + +#endif // QSTORAGEINFO_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qstring.h b/qt/6.8.1/msvc2022_64/include/QtCore/qstring.h new file mode 100644 index 0000000000000000000000000000000000000000..d6eed5e7647d44006a1342867a4ade82bb5ef229 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qstring.h @@ -0,0 +1,1652 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2019 Intel Corporation. +// Copyright (C) 2019 Mail.ru Group. +// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSTRING_H +#define QSTRING_H + +#if defined(QT_NO_CAST_FROM_ASCII) && defined(QT_RESTRICTED_CAST_FROM_ASCII) +#error QT_NO_CAST_FROM_ASCII and QT_RESTRICTED_CAST_FROM_ASCII must not be defined at the same time +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#ifdef truncate +#error qstring.h must be included before any header file that defines truncate +#endif + +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) +Q_FORWARD_DECLARE_CF_TYPE(CFString); +Q_FORWARD_DECLARE_OBJC_CLASS(NSString); +#endif + +class tst_QString; + +QT_BEGIN_NAMESPACE + +class QRegularExpression; +class QRegularExpressionMatch; +class QString; + +namespace QtPrivate { +template class BoolList; + +template +using IsCompatibleChar32TypeHelper = + std::is_same; +template +using IsCompatibleChar32Type + = IsCompatibleChar32TypeHelper>; +} + +// Qt 4.x compatibility + +// +// QLatin1StringView inline implementations +// +constexpr bool QtPrivate::isLatin1(QLatin1StringView) noexcept +{ return true; } + +// +// QStringView members that require QLatin1StringView: +// +int QStringView::compare(QLatin1StringView s, Qt::CaseSensitivity cs) const noexcept +{ return QtPrivate::compareStrings(*this, s, cs); } +bool QStringView::startsWith(QLatin1StringView s, Qt::CaseSensitivity cs) const noexcept +{ return QtPrivate::startsWith(*this, s, cs); } +bool QStringView::endsWith(QLatin1StringView s, Qt::CaseSensitivity cs) const noexcept +{ return QtPrivate::endsWith(*this, s, cs); } +qsizetype QStringView::indexOf(QLatin1StringView s, qsizetype from, Qt::CaseSensitivity cs) const noexcept +{ return QtPrivate::findString(*this, from, s, cs); } +bool QStringView::contains(QLatin1StringView s, Qt::CaseSensitivity cs) const noexcept +{ return indexOf(s, 0, cs) != qsizetype(-1); } +qsizetype QStringView::lastIndexOf(QLatin1StringView s, Qt::CaseSensitivity cs) const noexcept +{ return QtPrivate::lastIndexOf(*this, size(), s, cs); } +qsizetype QStringView::lastIndexOf(QLatin1StringView s, qsizetype from, Qt::CaseSensitivity cs) const noexcept +{ return QtPrivate::lastIndexOf(*this, from, s, cs); } +qsizetype QStringView::count(QLatin1StringView s, Qt::CaseSensitivity cs) const +{ return QtPrivate::count(*this, s, cs); } + +// +// QAnyStringView members that require QLatin1StringView +// + +constexpr QAnyStringView::QAnyStringView(QLatin1StringView str) noexcept + : m_data{str.data()}, m_size{size_t(str.size() << SizeShift) | Tag::Latin1} {} + +constexpr QLatin1StringView QAnyStringView::asLatin1StringView() const +{ + Q_ASSERT(isLatin1()); + return {m_data_utf8, size()}; +} + + +template +constexpr decltype(auto) QAnyStringView::visit(Visitor &&v) const +{ + if (isUtf16()) + return std::forward(v)(asStringView()); + else if (isLatin1()) + return std::forward(v)(asLatin1StringView()); + else + return std::forward(v)(asUtf8StringView()); +} + +// +// QAnyStringView members that require QAnyStringView::visit() +// + +constexpr QChar QAnyStringView::front() const +{ + return visit([] (auto that) { return QAnyStringView::toQChar(that.front()); }); +} +constexpr QChar QAnyStringView::back() const +{ + return visit([] (auto that) { return QAnyStringView::toQChar(that.back()); }); +} + + +class Q_CORE_EXPORT QString +{ + typedef QTypedArrayData Data; + + friend class ::tst_QString; + + template + static constexpr bool is_contiguous_iterator_v = + // Can't use contiguous_iterator_tag here, as STL impls can't agree on feature macro. + // To avoid differences in C++20 and C++17 builds, treat only pointers as contiguous + // for now: + // std::contiguous_iterator; + std::is_pointer_v; + + template + using is_compatible_char_helper = std::disjunction< + QtPrivate::IsCompatibleCharType, + QtPrivate::IsCompatibleChar32Type, + QtPrivate::IsCompatibleChar8Type, + std::is_same // special case + >; + + template + static constexpr bool is_compatible_iterator_v = std::conjunction_v< + std::is_convertible< + typename std::iterator_traits::iterator_category, + std::input_iterator_tag + >, + is_compatible_char_helper::value_type> + >; + + template + using if_compatible_iterator = std::enable_if_t, bool>; + +public: + typedef QStringPrivate DataPointer; + + constexpr QString() noexcept; + explicit QString(const QChar *unicode, qsizetype size = -1); + QString(QChar c); + QString(qsizetype size, QChar c); + inline QString(QLatin1StringView latin1); + explicit QString(QStringView sv) : QString(sv.data(), sv.size()) {} +#if defined(__cpp_char8_t) || defined(Q_QDOC) + Q_WEAK_OVERLOAD + inline QString(const char8_t *str) + : QString(fromUtf8(str)) + {} +#endif + inline QString(const QString &) noexcept; + inline ~QString(); + QString &operator=(QChar c); + QString &operator=(const QString &) noexcept; + QString &operator=(QLatin1StringView latin1); + inline QString(QString &&other) noexcept + = default; + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QString) + void swap(QString &other) noexcept { d.swap(other.d); } + + static constexpr qsizetype maxSize() noexcept + { + // -1 to deal with the NUL terminator + return Data::maxSize() - 1; + } + inline qsizetype size() const noexcept { return d.size; } +#if QT_DEPRECATED_SINCE(6, 4) + QT_DEPRECATED_VERSION_X_6_4("Use size() or length() instead.") + inline qsizetype count() const { return d.size; } +#endif + inline qsizetype length() const noexcept { return d.size; } + inline bool isEmpty() const noexcept { return d.size == 0; } + void resize(qsizetype size); + void resize(qsizetype size, QChar fillChar); + void resizeForOverwrite(qsizetype size); + + QString &fill(QChar c, qsizetype size = -1); + void truncate(qsizetype pos); + void chop(qsizetype n); + + QString &slice(qsizetype pos) + { verify(pos, 0); return remove(0, pos); } + QString &slice(qsizetype pos, qsizetype n) + { + verify(pos, n); + if (isNull()) + return *this; + resize(pos + n); + return remove(0, pos); + } + + inline qsizetype capacity() const; + inline void reserve(qsizetype size); + inline void squeeze(); + + inline const QChar *unicode() const; + inline QChar *data(); + inline const QChar *data() const; + inline const QChar *constData() const; + + inline void detach(); + inline bool isDetached() const; + inline bool isSharedWith(const QString &other) const { return d.isSharedWith(other.d); } + inline void clear(); + + inline const QChar at(qsizetype i) const; + inline const QChar operator[](qsizetype i) const; + [[nodiscard]] inline QChar &operator[](qsizetype i); + + [[nodiscard]] inline QChar front() const { return at(0); } + [[nodiscard]] inline QChar &front(); + [[nodiscard]] inline QChar back() const { return at(size() - 1); } + [[nodiscard]] inline QChar &back(); + + [[nodiscard]] QString arg(qlonglong a, int fieldwidth=0, int base=10, + QChar fillChar = u' ') const; + [[nodiscard]] QString arg(qulonglong a, int fieldwidth=0, int base=10, + QChar fillChar = u' ') const; + [[nodiscard]] inline QString arg(long a, int fieldwidth=0, int base=10, + QChar fillChar = u' ') const; + [[nodiscard]] inline QString arg(ulong a, int fieldwidth=0, int base=10, + QChar fillChar = u' ') const; + [[nodiscard]] inline QString arg(int a, int fieldWidth = 0, int base = 10, + QChar fillChar = u' ') const; + [[nodiscard]] inline QString arg(uint a, int fieldWidth = 0, int base = 10, + QChar fillChar = u' ') const; + [[nodiscard]] inline QString arg(short a, int fieldWidth = 0, int base = 10, + QChar fillChar = u' ') const; + [[nodiscard]] inline QString arg(ushort a, int fieldWidth = 0, int base = 10, + QChar fillChar = u' ') const; + [[nodiscard]] QString arg(double a, int fieldWidth = 0, char format = 'g', int precision = -1, + QChar fillChar = u' ') const; + [[nodiscard]] QString arg(char a, int fieldWidth = 0, + QChar fillChar = u' ') const; + [[nodiscard]] QString arg(QChar a, int fieldWidth = 0, + QChar fillChar = u' ') const; + [[nodiscard]] QString arg(const QString &a, int fieldWidth = 0, + QChar fillChar = u' ') const; + [[nodiscard]] QString arg(QStringView a, int fieldWidth = 0, + QChar fillChar = u' ') const; + [[nodiscard]] QString arg(QLatin1StringView a, int fieldWidth = 0, + QChar fillChar = u' ') const; +private: + template + using is_convertible_to_view_or_qstring = std::disjunction< + std::is_convertible, + std::is_convertible, + std::is_convertible + >; +public: + template + [[nodiscard]] +#ifdef Q_QDOC + QString +#else + typename std::enable_if< + sizeof...(Args) >= 2 && std::is_same< + QtPrivate::BoolList::value..., true>, + QtPrivate::BoolList::value...> + >::value, + QString + >::type +#endif + arg(Args &&...args) const + { return qToStringViewIgnoringNull(*this).arg(std::forward(args)...); } + + static QString vasprintf(const char *format, va_list ap) Q_ATTRIBUTE_FORMAT_PRINTF(1, 0); + static QString asprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(1, 2); + + [[nodiscard]] QT_CORE_INLINE_SINCE(6, 8) + qsizetype indexOf(QChar c, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + [[nodiscard]] qsizetype indexOf(QLatin1StringView s, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + [[nodiscard]] qsizetype indexOf(const QString &s, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + [[nodiscard]] qsizetype indexOf(QStringView s, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::findString(*this, from, s, cs); } + [[nodiscard]] qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return lastIndexOf(c, -1, cs); } + [[nodiscard]] QT_CORE_INLINE_SINCE(6, 8) + qsizetype lastIndexOf(QChar c, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + [[nodiscard]] qsizetype lastIndexOf(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const + { return lastIndexOf(s, size(), cs); } + [[nodiscard]] qsizetype lastIndexOf(QLatin1StringView s, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + [[nodiscard]] qsizetype lastIndexOf(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const + { return lastIndexOf(s, size(), cs); } + [[nodiscard]] qsizetype lastIndexOf(const QString &s, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + + [[nodiscard]] qsizetype lastIndexOf(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return lastIndexOf(s, size(), cs); } + [[nodiscard]] qsizetype lastIndexOf(QStringView s, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::lastIndexOf(*this, from, s, cs); } + + [[nodiscard]] inline bool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + [[nodiscard]] inline bool contains(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + [[nodiscard]] inline bool contains(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + [[nodiscard]] inline bool contains(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + [[nodiscard]] qsizetype count(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + [[nodiscard]] qsizetype count(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + [[nodiscard]] qsizetype count(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + +#if QT_CONFIG(regularexpression) + [[nodiscard]] qsizetype indexOf(const QRegularExpression &re, qsizetype from = 0, + QRegularExpressionMatch *rmatch = nullptr) const; +#ifdef Q_QDOC + [[nodiscard]] qsizetype lastIndexOf(const QRegularExpression &re, QRegularExpressionMatch *rmatch = nullptr) const; +#else + // prevent an ambiguity when called like this: lastIndexOf(re, 0) + template , bool> = false> + [[nodiscard]] qsizetype lastIndexOf(const QRegularExpression &re, T *rmatch = nullptr) const + { return lastIndexOf(re, size(), rmatch); } +#endif + [[nodiscard]] qsizetype lastIndexOf(const QRegularExpression &re, qsizetype from, + QRegularExpressionMatch *rmatch = nullptr) const; + [[nodiscard]] bool contains(const QRegularExpression &re, QRegularExpressionMatch *rmatch = nullptr) const; + [[nodiscard]] qsizetype count(const QRegularExpression &re) const; +#endif + + enum SectionFlag { + SectionDefault = 0x00, + SectionSkipEmpty = 0x01, + SectionIncludeLeadingSep = 0x02, + SectionIncludeTrailingSep = 0x04, + SectionCaseInsensitiveSeps = 0x08 + }; + Q_DECLARE_FLAGS(SectionFlags, SectionFlag) + + [[nodiscard]] inline QString section(QChar sep, qsizetype start, qsizetype end = -1, SectionFlags flags = SectionDefault) const; + [[nodiscard]] QString section(const QString &in_sep, qsizetype start, qsizetype end = -1, SectionFlags flags = SectionDefault) const; +#if QT_CONFIG(regularexpression) + [[nodiscard]] QString section(const QRegularExpression &re, qsizetype start, qsizetype end = -1, SectionFlags flags = SectionDefault) const; +#endif + +#if QT_CORE_REMOVED_SINCE(6, 7) + QString left(qsizetype n) const; + QString right(qsizetype n) const; + QString mid(qsizetype position, qsizetype n = -1) const; + + QString first(qsizetype n) const; + QString last(qsizetype n) const; + QString sliced(qsizetype pos) const; + QString sliced(qsizetype pos, qsizetype n) const; + QString chopped(qsizetype n) const; +#else + [[nodiscard]] QString left(qsizetype n) const & + { + if (size_t(n) >= size_t(size())) + return *this; + return first(n); + } + [[nodiscard]] QString left(qsizetype n) && + { + if (size_t(n) >= size_t(size())) + return std::move(*this); + return std::move(*this).first(n); + } + [[nodiscard]] QString right(qsizetype n) const & + { + if (size_t(n) >= size_t(size())) + return *this; + return last(n); + } + [[nodiscard]] QString right(qsizetype n) && + { + if (size_t(n) >= size_t(size())) + return std::move(*this); + return std::move(*this).last(n); + } + [[nodiscard]] QString mid(qsizetype position, qsizetype n = -1) const &; + [[nodiscard]] QString mid(qsizetype position, qsizetype n = -1) &&; + + [[nodiscard]] QString first(qsizetype n) const & + { verify(0, n); return sliced(0, n); } + [[nodiscard]] QString last(qsizetype n) const & + { verify(0, n); return sliced(size() - n, n); } + [[nodiscard]] QString sliced(qsizetype pos) const & + { verify(pos, 0); return sliced(pos, size() - pos); } + [[nodiscard]] QString sliced(qsizetype pos, qsizetype n) const & + { verify(pos, n); return QString(begin() + pos, n); } + [[nodiscard]] QString chopped(qsizetype n) const & + { verify(0, n); return sliced(0, size() - n); } + + [[nodiscard]] QString first(qsizetype n) && + { + verify(0, n); + resize(n); // may detach and allocate memory + return std::move(*this); + } + [[nodiscard]] QString last(qsizetype n) && + { verify(0, n); return sliced_helper(*this, size() - n, n); } + [[nodiscard]] QString sliced(qsizetype pos) && + { verify(pos, 0); return sliced_helper(*this, pos, size() - pos); } + [[nodiscard]] QString sliced(qsizetype pos, qsizetype n) && + { verify(pos, n); return sliced_helper(*this, pos, n); } + [[nodiscard]] QString chopped(qsizetype n) && + { verify(0, n); return std::move(*this).first(size() - n); } +#endif + bool startsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + [[nodiscard]] bool startsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::startsWith(*this, s, cs); } + bool startsWith(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + bool startsWith(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + + bool endsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + [[nodiscard]] bool endsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::endsWith(*this, s, cs); } + bool endsWith(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + bool endsWith(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + + bool isUpper() const; + bool isLower() const; + + [[nodiscard]] QString leftJustified(qsizetype width, QChar fill = u' ', bool trunc = false) const; + [[nodiscard]] QString rightJustified(qsizetype width, QChar fill = u' ', bool trunc = false) const; + +#if !defined(Q_QDOC) + [[nodiscard]] QString toLower() const & + { return toLower_helper(*this); } + [[nodiscard]] QString toLower() && + { return toLower_helper(*this); } + [[nodiscard]] QString toUpper() const & + { return toUpper_helper(*this); } + [[nodiscard]] QString toUpper() && + { return toUpper_helper(*this); } + [[nodiscard]] QString toCaseFolded() const & + { return toCaseFolded_helper(*this); } + [[nodiscard]] QString toCaseFolded() && + { return toCaseFolded_helper(*this); } + [[nodiscard]] QString trimmed() const & + { return trimmed_helper(*this); } + [[nodiscard]] QString trimmed() && + { return trimmed_helper(*this); } + [[nodiscard]] QString simplified() const & + { return simplified_helper(*this); } + [[nodiscard]] QString simplified() && + { return simplified_helper(*this); } +#else + [[nodiscard]] QString toLower() const; + [[nodiscard]] QString toUpper() const; + [[nodiscard]] QString toCaseFolded() const; + [[nodiscard]] QString trimmed() const; + [[nodiscard]] QString simplified() const; +#endif + [[nodiscard]] QString toHtmlEscaped() const; + + QString &insert(qsizetype i, QChar c); + QString &insert(qsizetype i, const QChar *uc, qsizetype len); + inline QString &insert(qsizetype i, const QString &s) { return insert(i, s.constData(), s.size()); } + inline QString &insert(qsizetype i, QStringView v) { return insert(i, v.data(), v.size()); } + QString &insert(qsizetype i, QLatin1StringView s); + QString &insert(qsizetype i, QUtf8StringView s); + + QString &append(QChar c); + QString &append(const QChar *uc, qsizetype len); + QString &append(const QString &s); + inline QString &append(QStringView v) { return append(v.data(), v.size()); } + QString &append(QLatin1StringView s); + QString &append(QUtf8StringView s); + + inline QString &prepend(QChar c) { return insert(0, c); } + inline QString &prepend(const QChar *uc, qsizetype len) { return insert(0, uc, len); } + inline QString &prepend(const QString &s) { return insert(0, s); } + inline QString &prepend(QStringView v) { return prepend(v.data(), v.size()); } + inline QString &prepend(QLatin1StringView s) { return insert(0, s); } + QString &prepend(QUtf8StringView s) { return insert(0, s); } + + QString &assign(QAnyStringView s); + inline QString &assign(qsizetype n, QChar c) + { + Q_ASSERT(n >= 0); + return fill(c, n); + } + template = true> + QString &assign(InputIterator first, InputIterator last) + { + using V = typename std::iterator_traits::value_type; + constexpr bool IsL1C = std::is_same_v, QLatin1Char>; + constexpr bool IsFwdIt = std::is_convertible_v< + typename std::iterator_traits::iterator_category, + std::forward_iterator_tag + >; + + if constexpr (is_contiguous_iterator_v) { + const auto p = q20::to_address(first); + const auto len = qsizetype(last - first); + if constexpr (IsL1C) + return assign(QLatin1StringView(reinterpret_cast(p), len)); + else if constexpr (sizeof(V) == 4) + return assign_helper(p, len); + else + return assign(QAnyStringView(p, len)); + } else if constexpr (sizeof(V) == 4) { // non-contiguous iterator, feed data piecemeal + resize(0); + if constexpr (IsFwdIt) { + const qsizetype requiredCapacity = 2 * std::distance(first, last); + reserve(requiredCapacity); + } + while (first != last) { + append(QChar::fromUcs4(*first)); + ++first; + } + return *this; + } else if constexpr (QtPrivate::IsCompatibleChar8Type::value) { + assign_helper_char8(first, last); + if (d.constAllocatedCapacity()) + d.data()[d.size] = u'\0'; + return *this; + } else { + d.assign(first, last, [](QChar ch) -> char16_t { return ch.unicode(); }); + if (d.constAllocatedCapacity()) + d.data()[d.size] = u'\0'; + return *this; + } + } + + inline QString &operator+=(QChar c) { return append(c); } + + inline QString &operator+=(const QString &s) { return append(s); } + inline QString &operator+=(QStringView v) { return append(v); } + inline QString &operator+=(QLatin1StringView s) { return append(s); } + QString &operator+=(QUtf8StringView s) { return append(s); } + +#if defined(QT_RESTRICTED_CAST_FROM_ASCII) + template + QString &insert(qsizetype i, const char (&ch)[N]) { return insert(i, QUtf8StringView(ch)); } + template + QString &append(const char (&ch)[N]) { return append(QUtf8StringView(ch)); } + template + QString &prepend(const char (&ch)[N]) { return prepend(QUtf8StringView(ch)); } + template + QString &operator+=(const char (&ch)[N]) { return append(QUtf8StringView(ch)); } +#endif + + QString &remove(qsizetype i, qsizetype len); + QString &remove(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive); + QString &remove(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive); + QString &remove(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive); + + QString &removeAt(qsizetype pos) + { return size_t(pos) < size_t(size()) ? remove(pos, 1) : *this; } + QString &removeFirst() { return !isEmpty() ? remove(0, 1) : *this; } + QString &removeLast() { return !isEmpty() ? remove(size() - 1, 1) : *this; } + + template + QString &removeIf(Predicate pred) + { + removeIf_helper(pred); + return *this; + } + + QString &replace(qsizetype i, qsizetype len, QChar after); + QString &replace(qsizetype i, qsizetype len, const QChar *s, qsizetype slen); + QString &replace(qsizetype i, qsizetype len, const QString &after); + QString &replace(QChar before, QChar after, Qt::CaseSensitivity cs = Qt::CaseSensitive); + QString &replace(const QChar *before, qsizetype blen, const QChar *after, qsizetype alen, Qt::CaseSensitivity cs = Qt::CaseSensitive); + QString &replace(QLatin1StringView before, QLatin1StringView after, Qt::CaseSensitivity cs = Qt::CaseSensitive); + QString &replace(QLatin1StringView before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive); + QString &replace(const QString &before, QLatin1StringView after, Qt::CaseSensitivity cs = Qt::CaseSensitive); + QString &replace(const QString &before, const QString &after, + Qt::CaseSensitivity cs = Qt::CaseSensitive); + QString &replace(QChar c, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive); + QString &replace(QChar c, QLatin1StringView after, Qt::CaseSensitivity cs = Qt::CaseSensitive); +#if QT_CONFIG(regularexpression) + QString &replace(const QRegularExpression &re, const QString &after); + inline QString &remove(const QRegularExpression &re) + { return replace(re, QString()); } +#endif + +public: + [[nodiscard]] + QStringList split(const QString &sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + [[nodiscard]] + QStringList split(QChar sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const; +#ifndef QT_NO_REGULAREXPRESSION + [[nodiscard]] + QStringList split(const QRegularExpression &sep, + Qt::SplitBehavior behavior = Qt::KeepEmptyParts) const; +#endif + + template + [[nodiscard]] inline auto tokenize(Needle &&needle, Flags...flags) const & + noexcept(noexcept(qTokenize(std::declval(), std::forward(needle), flags...))) + -> decltype(qTokenize(*this, std::forward(needle), flags...)) + { return qTokenize(qToStringViewIgnoringNull(*this), std::forward(needle), flags...); } + + template + [[nodiscard]] inline auto tokenize(Needle &&needle, Flags...flags) const && + noexcept(noexcept(qTokenize(std::declval(), std::forward(needle), flags...))) + -> decltype(qTokenize(std::move(*this), std::forward(needle), flags...)) + { return qTokenize(std::move(*this), std::forward(needle), flags...); } + + template + [[nodiscard]] inline auto tokenize(Needle &&needle, Flags...flags) && + noexcept(noexcept(qTokenize(std::declval(), std::forward(needle), flags...))) + -> decltype(qTokenize(std::move(*this), std::forward(needle), flags...)) + { return qTokenize(std::move(*this), std::forward(needle), flags...); } + + + enum NormalizationForm { + NormalizationForm_D, + NormalizationForm_C, + NormalizationForm_KD, + NormalizationForm_KC + }; + [[nodiscard]] QString normalized(NormalizationForm mode, QChar::UnicodeVersion version = QChar::Unicode_Unassigned) const; + + [[nodiscard]] QString repeated(qsizetype times) const; + + const ushort *utf16() const; // ### Qt 7 char16_t + +#if !defined(Q_QDOC) + [[nodiscard]] QByteArray toLatin1() const & + { return toLatin1_helper(*this); } + [[nodiscard]] QByteArray toLatin1() && + { return toLatin1_helper_inplace(*this); } + [[nodiscard]] QByteArray toUtf8() const & + { return toUtf8_helper(*this); } + [[nodiscard]] QByteArray toUtf8() && + { return toUtf8_helper(*this); } + [[nodiscard]] QByteArray toLocal8Bit() const & + { return toLocal8Bit_helper(isNull() ? nullptr : constData(), size()); } + [[nodiscard]] QByteArray toLocal8Bit() && + { return toLocal8Bit_helper(isNull() ? nullptr : constData(), size()); } +#else + [[nodiscard]] QByteArray toLatin1() const; + [[nodiscard]] QByteArray toUtf8() const; + [[nodiscard]] QByteArray toLocal8Bit() const; +#endif + [[nodiscard]] QList toUcs4() const; // ### Qt 7 char32_t + + // note - this are all inline so we can benefit from strlen() compile time optimizations + static QString fromLatin1(QByteArrayView ba); + Q_WEAK_OVERLOAD + static inline QString fromLatin1(const QByteArray &ba) { return fromLatin1(QByteArrayView(ba)); } + static inline QString fromLatin1(const char *str, qsizetype size) + { + return fromLatin1(QByteArrayView(str, !str || size < 0 ? qstrlen(str) : size)); + } + static QString fromUtf8(QByteArrayView utf8); + Q_WEAK_OVERLOAD + static inline QString fromUtf8(const QByteArray &ba) { return fromUtf8(QByteArrayView(ba)); } + static inline QString fromUtf8(const char *utf8, qsizetype size) + { + return fromUtf8(QByteArrayView(utf8, !utf8 || size < 0 ? qstrlen(utf8) : size)); + } +#if defined(__cpp_char8_t) || defined(Q_QDOC) + Q_WEAK_OVERLOAD + static inline QString fromUtf8(const char8_t *str) + { return fromUtf8(reinterpret_cast(str)); } + Q_WEAK_OVERLOAD + static inline QString fromUtf8(const char8_t *str, qsizetype size) + { return fromUtf8(reinterpret_cast(str), size); } +#endif + static QString fromLocal8Bit(QByteArrayView ba); + Q_WEAK_OVERLOAD + static inline QString fromLocal8Bit(const QByteArray &ba) { return fromLocal8Bit(QByteArrayView(ba)); } + static inline QString fromLocal8Bit(const char *str, qsizetype size) + { + return fromLocal8Bit(QByteArrayView(str, !str || size < 0 ? qstrlen(str) : size)); + } + static QString fromUtf16(const char16_t *, qsizetype size = -1); + static QString fromUcs4(const char32_t *, qsizetype size = -1); + static QString fromRawData(const QChar *, qsizetype size); + +#if QT_DEPRECATED_SINCE(6, 0) + QT_DEPRECATED_VERSION_X_6_0("Use char16_t* overload.") + static QString fromUtf16(const ushort *str, qsizetype size = -1) + { return fromUtf16(reinterpret_cast(str), size); } + QT_DEPRECATED_VERSION_X_6_0("Use char32_t* overload.") + static QString fromUcs4(const uint *str, qsizetype size = -1) + { return fromUcs4(reinterpret_cast(str), size); } +#endif + + inline qsizetype toWCharArray(wchar_t *array) const; + [[nodiscard]] static inline QString fromWCharArray(const wchar_t *string, qsizetype size = -1); + + QString &setRawData(const QChar *unicode, qsizetype size); + QString &setUnicode(const QChar *unicode, qsizetype size); + inline QString &setUtf16(const ushort *utf16, qsizetype size); // ### Qt 7 char16_t + + int compare(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + int compare(QLatin1StringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + inline int compare(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + int compare(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return compare(QStringView{&ch, 1}, cs); } + + static inline int compare(const QString &s1, const QString &s2, + Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept + { return s1.compare(s2, cs); } + + static inline int compare(const QString &s1, QLatin1StringView s2, + Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept + { return s1.compare(s2, cs); } + static inline int compare(QLatin1StringView s1, const QString &s2, + Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept + { return -s2.compare(s1, cs); } + static int compare(const QString &s1, QStringView s2, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept + { return s1.compare(s2, cs); } + static int compare(QStringView s1, const QString &s2, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept + { return -s2.compare(s1, cs); } + + int localeAwareCompare(const QString& s) const; + inline int localeAwareCompare(QStringView s) const; + static int localeAwareCompare(const QString& s1, const QString& s2) + { return s1.localeAwareCompare(s2); } + + static inline int localeAwareCompare(QStringView s1, QStringView s2); + + short toShort(bool *ok=nullptr, int base=10) const + { return toIntegral_helper(*this, ok, base); } + ushort toUShort(bool *ok=nullptr, int base=10) const + { return toIntegral_helper(*this, ok, base); } + int toInt(bool *ok=nullptr, int base=10) const + { return toIntegral_helper(*this, ok, base); } + uint toUInt(bool *ok=nullptr, int base=10) const + { return toIntegral_helper(*this, ok, base); } + long toLong(bool *ok=nullptr, int base=10) const + { return toIntegral_helper(*this, ok, base); } + ulong toULong(bool *ok=nullptr, int base=10) const + { return toIntegral_helper(*this, ok, base); } + QT_CORE_INLINE_SINCE(6, 5) + qlonglong toLongLong(bool *ok=nullptr, int base=10) const; + QT_CORE_INLINE_SINCE(6, 5) + qulonglong toULongLong(bool *ok=nullptr, int base=10) const; + float toFloat(bool *ok=nullptr) const; + double toDouble(bool *ok=nullptr) const; + + inline QString &setNum(short, int base=10); + inline QString &setNum(ushort, int base=10); + inline QString &setNum(int, int base=10); + inline QString &setNum(uint, int base=10); + inline QString &setNum(long, int base=10); + inline QString &setNum(ulong, int base=10); + QString &setNum(qlonglong, int base=10); + QString &setNum(qulonglong, int base=10); + inline QString &setNum(float, char format='g', int precision=6); + QString &setNum(double, char format='g', int precision=6); + + static QString number(int, int base=10); + static QString number(uint, int base=10); + static QString number(long, int base=10); + static QString number(ulong, int base=10); + static QString number(qlonglong, int base=10); + static QString number(qulonglong, int base=10); + static QString number(double, char format='g', int precision=6); + + friend bool comparesEqual(const QString &s1, const QString &s2) noexcept + { return comparesEqual(QStringView(s1), QStringView(s2)); } + friend Qt::strong_ordering compareThreeWay(const QString &s1, const QString &s2) noexcept + { return compareThreeWay(QStringView(s1), QStringView(s2)); } + Q_DECLARE_STRONGLY_ORDERED(QString) + + Q_WEAK_OVERLOAD + friend bool comparesEqual(const QString &s1, QUtf8StringView s2) noexcept + { return QtPrivate::equalStrings(s1, s2); } + Q_WEAK_OVERLOAD + friend Qt::strong_ordering compareThreeWay(const QString &s1, QUtf8StringView s2) noexcept + { + const int res = QtPrivate::compareStrings(s1, s2, Qt::CaseSensitive); + return Qt::compareThreeWay(res, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QString, QUtf8StringView, Q_WEAK_OVERLOAD) + +#ifdef __cpp_char8_t + friend bool comparesEqual(const QString &s1, const char8_t *s2) noexcept + { return comparesEqual(s1, QUtf8StringView(s2)); } + friend Qt::strong_ordering compareThreeWay(const QString &s1, const char8_t *s2) noexcept + { return compareThreeWay(s1, QUtf8StringView(s2)); } + Q_DECLARE_STRONGLY_ORDERED(QString, const char8_t *) +#endif // __cpp_char8_t + + friend bool comparesEqual(const QString &s1, QLatin1StringView s2) noexcept + { return (s1.size() == s2.size()) && QtPrivate::equalStrings(s1, s2); } + friend Qt::strong_ordering + compareThreeWay(const QString &s1, QLatin1StringView s2) noexcept + { + const int res = QtPrivate::compareStrings(s1, s2, Qt::CaseSensitive); + return Qt::compareThreeWay(res, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QString, QLatin1StringView) + + // Check isEmpty() instead of isNull() for backwards compatibility. + friend bool comparesEqual(const QString &s1, std::nullptr_t) noexcept + { return s1.isEmpty(); } + friend Qt::strong_ordering compareThreeWay(const QString &s1, std::nullptr_t) noexcept + { return s1.isEmpty() ? Qt::strong_ordering::equivalent : Qt::strong_ordering::greater; } + Q_DECLARE_STRONGLY_ORDERED(QString, std::nullptr_t) + + friend bool comparesEqual(const QString &s1, const char16_t *s2) noexcept + { return comparesEqual(s1, QStringView(s2)); } + friend Qt::strong_ordering compareThreeWay(const QString &s1, const char16_t *s2) noexcept + { return compareThreeWay(s1, QStringView(s2)); } + Q_DECLARE_STRONGLY_ORDERED(QString, const char16_t *) + + // QChar <> QString + friend bool comparesEqual(const QString &lhs, QChar rhs) noexcept + { return lhs.size() == 1 && rhs == lhs.front(); } + friend Qt::strong_ordering compareThreeWay(const QString &lhs, QChar rhs) noexcept + { + const int res = compare_helper(lhs.data(), lhs.size(), &rhs, 1); + return Qt::compareThreeWay(res, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QString, QChar) + + // ASCII compatibility +#if defined(QT_RESTRICTED_CAST_FROM_ASCII) + template + inline QString(const char (&ch)[N]) + : QString(fromUtf8(ch)) + {} + template + QString(char (&)[N]) = delete; + template + inline QString &operator=(const char (&ch)[N]) + { return (*this = fromUtf8(ch, N - 1)); } + template + QString &operator=(char (&)[N]) = delete; +#endif +#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) + QT_ASCII_CAST_WARN inline QString(const char *ch) + : QString(fromUtf8(ch)) + {} + QT_ASCII_CAST_WARN inline QString(const QByteArray &a) + : QString(fromUtf8(a)) + {} + QT_ASCII_CAST_WARN inline QString &operator=(const char *ch) + { + if (!ch) { + clear(); + return *this; + } + return assign(ch); + } + QT_ASCII_CAST_WARN inline QString &operator=(const QByteArray &a) + { + if (a.isNull()) { + clear(); + return *this; + } + return assign(a); + } + // these are needed, so it compiles with STL support enabled + QT_ASCII_CAST_WARN inline QString &prepend(const char *s) + { return prepend(QUtf8StringView(s)); } + QT_ASCII_CAST_WARN inline QString &prepend(const QByteArray &s) + { return prepend(QUtf8StringView(s)); } + QT_ASCII_CAST_WARN inline QString &append(const char *s) + { return append(QUtf8StringView(s)); } + QT_ASCII_CAST_WARN inline QString &append(const QByteArray &s) + { return append(QUtf8StringView(s)); } + QT_ASCII_CAST_WARN inline QString &insert(qsizetype i, const char *s) + { return insert(i, QUtf8StringView(s)); } + QT_ASCII_CAST_WARN inline QString &insert(qsizetype i, const QByteArray &s) + { return insert(i, QUtf8StringView(s)); } + QT_ASCII_CAST_WARN inline QString &operator+=(const char *s) + { return append(QUtf8StringView(s)); } + QT_ASCII_CAST_WARN inline QString &operator+=(const QByteArray &s) + { return append(QUtf8StringView(s)); } + +#if QT_CORE_REMOVED_SINCE(6, 8) + QT_ASCII_CAST_WARN inline bool operator==(const char *s) const; + QT_ASCII_CAST_WARN inline bool operator!=(const char *s) const; + QT_ASCII_CAST_WARN inline bool operator<(const char *s) const; + QT_ASCII_CAST_WARN inline bool operator<=(const char *s) const; + QT_ASCII_CAST_WARN inline bool operator>(const char *s) const; + QT_ASCII_CAST_WARN inline bool operator>=(const char *s) const; + + QT_ASCII_CAST_WARN inline bool operator==(const QByteArray &s) const; + QT_ASCII_CAST_WARN inline bool operator!=(const QByteArray &s) const; + QT_ASCII_CAST_WARN inline bool operator<(const QByteArray &s) const; + QT_ASCII_CAST_WARN inline bool operator>(const QByteArray &s) const; + QT_ASCII_CAST_WARN inline bool operator<=(const QByteArray &s) const; + QT_ASCII_CAST_WARN inline bool operator>=(const QByteArray &s) const; +#else + friend bool comparesEqual(const QString &lhs, QByteArrayView rhs) noexcept + { + return QString::compare_helper(lhs.constData(), lhs.size(), + rhs.constData(), rhs.size()) == 0; + } + friend Qt::strong_ordering + compareThreeWay(const QString &lhs, QByteArrayView rhs) noexcept + { + const int res = QString::compare_helper(lhs.constData(), lhs.size(), + rhs.constData(), rhs.size()); + return Qt::compareThreeWay(res, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QString, QByteArrayView, QT_ASCII_CAST_WARN) + + friend bool comparesEqual(const QString &lhs, const QByteArray &rhs) noexcept + { return comparesEqual(lhs, QByteArrayView(rhs)); } + friend Qt::strong_ordering + compareThreeWay(const QString &lhs, const QByteArray &rhs) noexcept + { + return compareThreeWay(lhs, QByteArrayView(rhs)); + } + Q_DECLARE_STRONGLY_ORDERED(QString, QByteArray, QT_ASCII_CAST_WARN) + + friend bool comparesEqual(const QString &lhs, const char *rhs) noexcept + { return comparesEqual(lhs, QByteArrayView(rhs)); } + friend Qt::strong_ordering + compareThreeWay(const QString &lhs, const char *rhs) noexcept + { + return compareThreeWay(lhs, QByteArrayView(rhs)); + } + Q_DECLARE_STRONGLY_ORDERED(QString, const char *, QT_ASCII_CAST_WARN) +#endif // QT_CORE_REMOVED_SINCE(6, 8) + +#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) + + typedef QChar *iterator; + typedef const QChar *const_iterator; + typedef iterator Iterator; + typedef const_iterator ConstIterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + inline iterator begin(); + inline const_iterator begin() const; + inline const_iterator cbegin() const; + inline const_iterator constBegin() const; + inline iterator end(); + inline const_iterator end() const; + inline const_iterator cend() const; + inline const_iterator constEnd() const; + reverse_iterator rbegin() { return reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } + const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } + const_reverse_iterator crbegin() const { return const_reverse_iterator(end()); } + const_reverse_iterator crend() const { return const_reverse_iterator(begin()); } + + // STL compatibility + typedef qsizetype size_type; + typedef qptrdiff difference_type; + typedef const QChar & const_reference; + typedef QChar & reference; + typedef QChar *pointer; + typedef const QChar *const_pointer; + typedef QChar value_type; + inline void push_back(QChar c) { append(c); } + inline void push_back(const QString &s) { append(s); } + inline void push_front(QChar c) { prepend(c); } + inline void push_front(const QString &s) { prepend(s); } + void shrink_to_fit() { squeeze(); } + iterator erase(const_iterator first, const_iterator last); + inline iterator erase(const_iterator it) { return erase(it, it + 1); } + constexpr qsizetype max_size() const noexcept + { + return maxSize(); + } + + static inline QString fromStdString(const std::string &s); + inline std::string toStdString() const; + static inline QString fromStdWString(const std::wstring &s); + inline std::wstring toStdWString() const; + + static inline QString fromStdU16String(const std::u16string &s); + inline std::u16string toStdU16String() const; + static inline QString fromStdU32String(const std::u32string &s); + inline std::u32string toStdU32String() const; + + Q_IMPLICIT inline operator std::u16string_view() const noexcept; + +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) + static QString fromCFString(CFStringRef string); + CFStringRef toCFString() const Q_DECL_CF_RETURNS_RETAINED; + static QString fromNSString(const NSString *string); + NSString *toNSString() const Q_DECL_NS_RETURNS_AUTORELEASED; +#endif + +#if defined(Q_OS_WASM) || defined(Q_QDOC) + static QString fromEcmaString(emscripten::val jsString); + emscripten::val toEcmaString() const; +#endif + + inline bool isNull() const { return d.isNull(); } + + bool isRightToLeft() const; + [[nodiscard]] bool isValidUtf16() const noexcept + { return QStringView(*this).isValidUtf16(); } + + QString(qsizetype size, Qt::Initialization); + explicit QString(DataPointer &&dd) : d(std::move(dd)) {} + +private: +#if defined(QT_NO_CAST_FROM_ASCII) + QString &operator+=(const char *s); + QString &operator+=(const QByteArray &s); + QString(const char *ch); + QString(const QByteArray &a); + QString &operator=(const char *ch); + QString &operator=(const QByteArray &a); +#endif + + DataPointer d; + static const char16_t _empty; + + void reallocData(qsizetype alloc, QArrayData::AllocationOption option); + void reallocGrowData(qsizetype n); + // ### remove once QAnyStringView supports UTF-32: + QString &assign_helper(const char32_t *data, qsizetype len); + // Defined in qstringconverter.h + template + void assign_helper_char8(InputIterator first, InputIterator last); + static int compare_helper(const QChar *data1, qsizetype length1, + const QChar *data2, qsizetype length2, + Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; + static int compare_helper(const QChar *data1, qsizetype length1, + const char *data2, qsizetype length2, + Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; + static int localeAwareCompare_helper(const QChar *data1, qsizetype length1, + const QChar *data2, qsizetype length2); + static QString sliced_helper(QString &str, qsizetype pos, qsizetype n); + static QString toLower_helper(const QString &str); + static QString toLower_helper(QString &str); + static QString toUpper_helper(const QString &str); + static QString toUpper_helper(QString &str); + static QString toCaseFolded_helper(const QString &str); + static QString toCaseFolded_helper(QString &str); + static QString trimmed_helper(const QString &str); + static QString trimmed_helper(QString &str); + static QString simplified_helper(const QString &str); + static QString simplified_helper(QString &str); + static QByteArray toLatin1_helper(const QString &); + static QByteArray toLatin1_helper_inplace(QString &); + static QByteArray toUtf8_helper(const QString &); + static QByteArray toLocal8Bit_helper(const QChar *data, qsizetype size); +#if QT_CORE_REMOVED_SINCE(6, 6) + static qsizetype toUcs4_helper(const ushort *uc, qsizetype length, uint *out); +#endif + static qsizetype toUcs4_helper(const char16_t *uc, qsizetype length, char32_t *out); + static qlonglong toIntegral_helper(QStringView string, bool *ok, int base); + static qulonglong toIntegral_helper(QStringView string, bool *ok, uint base); + template + qsizetype removeIf_helper(Predicate pred) + { + const qsizetype result = d->eraseIf(pred); + if (result > 0) + d.data()[d.size] = u'\0'; + return result; + } + + friend class QStringView; + friend class QByteArray; + friend struct QAbstractConcatenable; + template friend qsizetype erase(QString &s, const T &t); + template friend qsizetype erase_if(QString &s, Predicate pred); + + template static + T toIntegral_helper(QStringView string, bool *ok, int base) + { + using Int64 = typename std::conditional::value, qulonglong, qlonglong>::type; + using Int32 = typename std::conditional::value, uint, int>::type; + + // we select the right overload by casting base to int or uint + Int64 val = toIntegral_helper(string, ok, Int32(base)); + if (T(val) != val) { + if (ok) + *ok = false; + val = 0; + } + return T(val); + } + + Q_ALWAYS_INLINE constexpr void verify([[maybe_unused]] qsizetype pos = 0, + [[maybe_unused]] qsizetype n = 1) const + { + Q_ASSERT(pos >= 0); + Q_ASSERT(pos <= d.size); + Q_ASSERT(n >= 0); + Q_ASSERT(n <= d.size - pos); + } + +public: + inline DataPointer &data_ptr() { return d; } + inline const DataPointer &data_ptr() const { return d; } +}; + +// +// QLatin1StringView inline members that require QUtf8StringView: +// + +int QLatin1StringView::compare(QUtf8StringView other, Qt::CaseSensitivity cs) const noexcept +{ return QtPrivate::compareStrings(*this, other, cs); } + +// +// QLatin1StringView inline members that require QString: +// + +QString QLatin1StringView::toString() const { return *this; } + +// +// QStringView inline members that require QUtf8StringView: +// + +int QStringView::compare(QUtf8StringView other, Qt::CaseSensitivity cs) const noexcept +{ return QtPrivate::compareStrings(*this, other, cs); } + +// +// QStringView inline members that require QString: +// + +QString QStringView::toString() const +{ return QString(*this); } + +qint64 QStringView::toLongLong(bool *ok, int base) const +{ return QString::toIntegral_helper(*this, ok, base); } +quint64 QStringView::toULongLong(bool *ok, int base) const +{ return QString::toIntegral_helper(*this, ok, base); } +long QStringView::toLong(bool *ok, int base) const +{ return QString::toIntegral_helper(*this, ok, base); } +ulong QStringView::toULong(bool *ok, int base) const +{ return QString::toIntegral_helper(*this, ok, base); } +int QStringView::toInt(bool *ok, int base) const +{ return QString::toIntegral_helper(*this, ok, base); } +uint QStringView::toUInt(bool *ok, int base) const +{ return QString::toIntegral_helper(*this, ok, base); } +short QStringView::toShort(bool *ok, int base) const +{ return QString::toIntegral_helper(*this, ok, base); } +ushort QStringView::toUShort(bool *ok, int base) const +{ return QString::toIntegral_helper(*this, ok, base); } + +// +// QUtf8StringView inline members that require QStringView: +// + +template +int QBasicUtf8StringView::compare(QChar other, Qt::CaseSensitivity cs) const noexcept +{ + return QtPrivate::compareStrings(*this, QStringView(&other, 1), cs); +} + +template +int QBasicUtf8StringView::compare(QStringView other, Qt::CaseSensitivity cs) const noexcept +{ + return QtPrivate::compareStrings(*this, other, cs); +} + +template +[[nodiscard]] bool QBasicUtf8StringView::equal(QChar other) const noexcept +{ + return QtPrivate::equalStrings(*this, QStringView(&other, 1)); +} + +template +[[nodiscard]] bool QBasicUtf8StringView::equal(QStringView other) const noexcept +{ + return QtPrivate::equalStrings(*this, other); +} + +// +// QUtf8StringView inline members that require QString, QL1SV or QBA: +// + +template +QString QBasicUtf8StringView::toString() const +{ + return QString::fromUtf8(data(), size()); +} + +template +[[nodiscard]] int QBasicUtf8StringView::compare(QLatin1StringView other, + Qt::CaseSensitivity cs) const noexcept +{ + return QtPrivate::compareStrings(*this, other, cs); +} + +template +[[nodiscard]] int QBasicUtf8StringView::compare(const QByteArray &other, + Qt::CaseSensitivity cs) const noexcept +{ + return QtPrivate::compareStrings(*this, + QBasicUtf8StringView(other.data(), other.size()), + cs); +} + +template +[[nodiscard]] bool QBasicUtf8StringView::equal(QLatin1StringView other) const noexcept +{ + return QtPrivate::equalStrings(*this, other); +} + +template +[[nodiscard]] bool QBasicUtf8StringView::equal(const QByteArray &other) const noexcept +{ + return size() == other.size() + && QtPrivate::equalStrings(*this, QBasicUtf8StringView(other.data(), + other.size())); +} + +// +// QAnyStringView inline members that require QString: +// + +QAnyStringView::QAnyStringView(const QByteArray &str) noexcept + : QAnyStringView{str.begin(), str.size()} {} +QAnyStringView::QAnyStringView(const QString &str) noexcept + : QAnyStringView{str.begin(), str.size()} {} + +QString QAnyStringView::toString() const +{ return QtPrivate::convertToQString(*this); } + +// +// QString inline members +// +QString::QString(QLatin1StringView latin1) + : QString{QString::fromLatin1(latin1.data(), latin1.size())} {} +const QChar QString::at(qsizetype i) const +{ verify(i, 1); return QChar(d.data()[i]); } +const QChar QString::operator[](qsizetype i) const +{ verify(i, 1); return QChar(d.data()[i]); } +const QChar *QString::unicode() const +{ return data(); } +const QChar *QString::data() const +{ +#if QT5_NULL_STRINGS == 1 + return reinterpret_cast(d.data() ? d.data() : &_empty); +#else + return reinterpret_cast(d.data()); +#endif +} +QChar *QString::data() +{ + detach(); + Q_ASSERT(d.data()); + return reinterpret_cast(d.data()); +} +const QChar *QString::constData() const +{ return data(); } +void QString::detach() +{ if (d.needsDetach()) reallocData(d.size, QArrayData::KeepSize); } +bool QString::isDetached() const +{ return !d.isShared(); } +void QString::clear() +{ if (!isNull()) *this = QString(); } +QString::QString(const QString &other) noexcept : d(other.d) +{ } +qsizetype QString::capacity() const { return qsizetype(d.constAllocatedCapacity()); } +QString &QString::setNum(short n, int base) +{ return setNum(qlonglong(n), base); } +QString &QString::setNum(ushort n, int base) +{ return setNum(qulonglong(n), base); } +QString &QString::setNum(int n, int base) +{ return setNum(qlonglong(n), base); } +QString &QString::setNum(uint n, int base) +{ return setNum(qulonglong(n), base); } +QString &QString::setNum(long n, int base) +{ return setNum(qlonglong(n), base); } +QString &QString::setNum(ulong n, int base) +{ return setNum(qulonglong(n), base); } +QString &QString::setNum(float n, char f, int prec) +{ return setNum(double(n),f,prec); } +QString QString::arg(int a, int fieldWidth, int base, QChar fillChar) const +{ return arg(qlonglong(a), fieldWidth, base, fillChar); } +QString QString::arg(uint a, int fieldWidth, int base, QChar fillChar) const +{ return arg(qulonglong(a), fieldWidth, base, fillChar); } +QString QString::arg(long a, int fieldWidth, int base, QChar fillChar) const +{ return arg(qlonglong(a), fieldWidth, base, fillChar); } +QString QString::arg(ulong a, int fieldWidth, int base, QChar fillChar) const +{ return arg(qulonglong(a), fieldWidth, base, fillChar); } +QString QString::arg(short a, int fieldWidth, int base, QChar fillChar) const +{ return arg(qlonglong(a), fieldWidth, base, fillChar); } +QString QString::arg(ushort a, int fieldWidth, int base, QChar fillChar) const +{ return arg(qulonglong(a), fieldWidth, base, fillChar); } + +QString QString::section(QChar asep, qsizetype astart, qsizetype aend, SectionFlags aflags) const +{ return section(QString(asep), astart, aend, aflags); } + +QT_WARNING_PUSH +QT_WARNING_DISABLE_MSVC(4127) // "conditional expression is constant" +QT_WARNING_DISABLE_INTEL(111) // "statement is unreachable" + +qsizetype QString::toWCharArray(wchar_t *array) const +{ + return qToStringViewIgnoringNull(*this).toWCharArray(array); +} + +qsizetype QStringView::toWCharArray(wchar_t *array) const +{ + if (sizeof(wchar_t) == sizeof(QChar)) { + if (auto src = data()) + memcpy(array, src, sizeof(QChar) * size()); + return size(); + } else { + return QString::toUcs4_helper(utf16(), size(), reinterpret_cast(array)); + } +} + +QT_WARNING_POP + +QString QString::fromWCharArray(const wchar_t *string, qsizetype size) +{ + if constexpr (sizeof(wchar_t) == sizeof(QChar)) { + return QString(reinterpret_cast(string), size); + } else { +#ifdef QT_BOOTSTRAPPED + Q_UNREACHABLE_RETURN(QString()); +#else + return fromUcs4(reinterpret_cast(string), size); +#endif + } +} + +constexpr QString::QString() noexcept {} +QString::~QString() {} + +void QString::reserve(qsizetype asize) +{ + if (d.needsDetach() || asize >= capacity() - d.freeSpaceAtBegin()) + reallocData(qMax(asize, size()), QArrayData::KeepSize); + if (d.constAllocatedCapacity()) + d.setFlag(Data::CapacityReserved); +} + +void QString::squeeze() +{ + if (!d.isMutable()) + return; + if (d.needsDetach() || size() < capacity()) + reallocData(d.size, QArrayData::KeepSize); + if (d.constAllocatedCapacity()) + d.clearFlag(Data::CapacityReserved); +} + +QString &QString::setUtf16(const ushort *autf16, qsizetype asize) +{ return setUnicode(reinterpret_cast(autf16), asize); } +QChar &QString::operator[](qsizetype i) +{ verify(i, 1); return data()[i]; } +QChar &QString::front() { return operator[](0); } +QChar &QString::back() { return operator[](size() - 1); } +QString::iterator QString::begin() +{ detach(); return reinterpret_cast(d.data()); } +QString::const_iterator QString::begin() const +{ return reinterpret_cast(d.data()); } +QString::const_iterator QString::cbegin() const +{ return reinterpret_cast(d.data()); } +QString::const_iterator QString::constBegin() const +{ return reinterpret_cast(d.data()); } +QString::iterator QString::end() +{ detach(); return reinterpret_cast(d.data() + d.size); } +QString::const_iterator QString::end() const +{ return reinterpret_cast(d.data() + d.size); } +QString::const_iterator QString::cend() const +{ return reinterpret_cast(d.data() + d.size); } +QString::const_iterator QString::constEnd() const +{ return reinterpret_cast(d.data() + d.size); } +bool QString::contains(const QString &s, Qt::CaseSensitivity cs) const +{ return indexOf(s, 0, cs) != -1; } +bool QString::contains(QLatin1StringView s, Qt::CaseSensitivity cs) const +{ return indexOf(s, 0, cs) != -1; } +bool QString::contains(QChar c, Qt::CaseSensitivity cs) const +{ return indexOf(c, 0, cs) != -1; } +bool QString::contains(QStringView s, Qt::CaseSensitivity cs) const noexcept +{ return indexOf(s, 0, cs) != -1; } + +#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) +#if QT_CORE_REMOVED_SINCE(6, 8) +bool QString::operator==(const char *s) const +{ return QString::compare_helper(constData(), size(), s, -1) == 0; } +bool QString::operator!=(const char *s) const +{ return QString::compare_helper(constData(), size(), s, -1) != 0; } +bool QString::operator<(const char *s) const +{ return QString::compare_helper(constData(), size(), s, -1) < 0; } +bool QString::operator>(const char *s) const +{ return QString::compare_helper(constData(), size(), s, -1) > 0; } +bool QString::operator<=(const char *s) const +{ return QString::compare_helper(constData(), size(), s, -1) <= 0; } +bool QString::operator>=(const char *s) const +{ return QString::compare_helper(constData(), size(), s, -1) >= 0; } + +QT_ASCII_CAST_WARN bool QString::operator==(const QByteArray &s) const +{ return QString::compare_helper(constData(), size(), s.constData(), s.size()) == 0; } +QT_ASCII_CAST_WARN bool QString::operator!=(const QByteArray &s) const +{ return QString::compare_helper(constData(), size(), s.constData(), s.size()) != 0; } +QT_ASCII_CAST_WARN bool QString::operator<(const QByteArray &s) const +{ return QString::compare_helper(constData(), size(), s.constData(), s.size()) < 0; } +QT_ASCII_CAST_WARN bool QString::operator>(const QByteArray &s) const +{ return QString::compare_helper(constData(), size(), s.constData(), s.size()) > 0; } +QT_ASCII_CAST_WARN bool QString::operator<=(const QByteArray &s) const +{ return QString::compare_helper(constData(), size(), s.constData(), s.size()) <= 0; } +QT_ASCII_CAST_WARN bool QString::operator>=(const QByteArray &s) const +{ return QString::compare_helper(constData(), size(), s.constData(), s.size()) >= 0; } + +bool QByteArray::operator==(const QString &s) const +{ return QString::compare_helper(s.constData(), s.size(), constData(), size()) == 0; } +bool QByteArray::operator!=(const QString &s) const +{ return QString::compare_helper(s.constData(), s.size(), constData(), size()) != 0; } +bool QByteArray::operator<(const QString &s) const +{ return QString::compare_helper(s.constData(), s.size(), constData(), size()) > 0; } +bool QByteArray::operator>(const QString &s) const +{ return QString::compare_helper(s.constData(), s.size(), constData(), size()) < 0; } +bool QByteArray::operator<=(const QString &s) const +{ return QString::compare_helper(s.constData(), s.size(), constData(), size()) >= 0; } +bool QByteArray::operator>=(const QString &s) const +{ return QString::compare_helper(s.constData(), s.size(), constData(), size()) <= 0; } +#endif // QT_CORE_REMOVED_SINCE(6, 8) +#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) + +#if !defined(QT_USE_FAST_OPERATOR_PLUS) && !defined(QT_USE_QSTRINGBUILDER) +inline QString operator+(const QString &s1, const QString &s2) +{ QString t(s1); t += s2; return t; } +inline QString operator+(QString &&lhs, const QString &rhs) +{ return std::move(lhs += rhs); } +inline QString operator+(const QString &s1, QChar s2) +{ QString t(s1); t += s2; return t; } +inline QString operator+(QString &&lhs, QChar rhs) +{ return std::move(lhs += rhs); } +inline QString operator+(QChar s1, const QString &s2) +{ QString t(s1); t += s2; return t; } +# if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) +QT_ASCII_CAST_WARN inline QString operator+(const QString &s1, const char *s2) +{ QString t(s1); t += QUtf8StringView(s2); return t; } +QT_ASCII_CAST_WARN inline QString operator+(QString &&lhs, const char *rhs) +{ QT_IGNORE_DEPRECATIONS(return std::move(lhs += rhs);) } +QT_ASCII_CAST_WARN inline QString operator+(const char *s1, const QString &s2) +{ QString t = QString::fromUtf8(s1); t += s2; return t; } +QT_ASCII_CAST_WARN inline QString operator+(const QByteArray &ba, const QString &s) +{ QString t = QString::fromUtf8(ba); t += s; return t; } +QT_ASCII_CAST_WARN inline QString operator+(const QString &s, const QByteArray &ba) +{ QString t(s); t += QUtf8StringView(ba); return t; } +QT_ASCII_CAST_WARN inline QString operator+(QString &&lhs, const QByteArray &rhs) +{ QT_IGNORE_DEPRECATIONS(return std::move(lhs += rhs);) } +# endif // QT_NO_CAST_FROM_ASCII +#endif // QT_USE_QSTRINGBUILDER + +std::string QString::toStdString() const +{ return toUtf8().toStdString(); } + +QString QString::fromStdString(const std::string &s) +{ return fromUtf8(s.data(), qsizetype(s.size())); } + +std::wstring QString::toStdWString() const +{ + std::wstring str; + str.resize(size()); + str.resize(toWCharArray(str.data())); + return str; +} + +QString QString::fromStdWString(const std::wstring &s) +{ return fromWCharArray(s.data(), qsizetype(s.size())); } + +QString QString::fromStdU16String(const std::u16string &s) +{ return fromUtf16(s.data(), qsizetype(s.size())); } + +std::u16string QString::toStdU16String() const +{ return std::u16string(reinterpret_cast(data()), size()); } + +QString QString::fromStdU32String(const std::u32string &s) +{ return fromUcs4(s.data(), qsizetype(s.size())); } + +std::u32string QString::toStdU32String() const +{ + std::u32string u32str(size(), char32_t(0)); + const qsizetype len = toUcs4_helper(reinterpret_cast(data()), + size(), u32str.data()); + u32str.resize(len); + return u32str; +} + +QString::operator std::u16string_view() const noexcept +{ + return std::u16string_view(d.data(), size_t(d.size)); +} + +#if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED) +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QString &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QString &); +#endif + +Q_DECLARE_SHARED(QString) +Q_DECLARE_OPERATORS_FOR_FLAGS(QString::SectionFlags) + +int QString::compare(QStringView s, Qt::CaseSensitivity cs) const noexcept +{ return -s.compare(*this, cs); } + +int QString::localeAwareCompare(QStringView s) const +{ return localeAwareCompare_helper(constData(), size(), s.constData(), s.size()); } +int QString::localeAwareCompare(QStringView s1, QStringView s2) +{ return localeAwareCompare_helper(s1.constData(), s1.size(), s2.constData(), s2.size()); } +int QStringView::localeAwareCompare(QStringView other) const +{ return QString::localeAwareCompare(*this, other); } + +#if QT_CORE_INLINE_IMPL_SINCE(6, 5) +qint64 QString::toLongLong(bool *ok, int base) const +{ + return toIntegral_helper(*this, ok, base); +} + +quint64 QString::toULongLong(bool *ok, int base) const +{ + return toIntegral_helper(*this, ok, base); +} +#endif +#if QT_CORE_INLINE_IMPL_SINCE(6, 8) +qsizetype QString::indexOf(QChar ch, qsizetype from, Qt::CaseSensitivity cs) const +{ + return qToStringViewIgnoringNull(*this).indexOf(ch, from, cs); +} +qsizetype QString::lastIndexOf(QChar ch, qsizetype from, Qt::CaseSensitivity cs) const +{ + return qToStringViewIgnoringNull(*this).lastIndexOf(ch, from, cs); +} +#endif + +namespace QtPrivate { +// used by qPrintable() and qUtf8Printable() macros +inline const QString &asString(const QString &s) { return s; } +inline QString &&asString(QString &&s) { return std::move(s); } +} + +#ifndef qPrintable +# define qPrintable(string) QtPrivate::asString(string).toLocal8Bit().constData() +#endif + +#ifndef qUtf8Printable +# define qUtf8Printable(string) QtPrivate::asString(string).toUtf8().constData() +#endif + +/* + Wrap QString::utf16() with enough casts to allow passing it + to QString::asprintf("%ls") without warnings. +*/ +#ifndef qUtf16Printable +# define qUtf16Printable(string) \ + static_cast(static_cast(QtPrivate::asString(string).utf16())) +#endif + +// +// QStringView::arg() implementation +// + +namespace QtPrivate { + +struct ArgBase { + enum Tag : uchar { L1, U8, U16 } tag; +}; + +struct QStringViewArg : ArgBase { + QStringView string; + QStringViewArg() = default; + constexpr explicit QStringViewArg(QStringView v) noexcept : ArgBase{U16}, string{v} {} +}; + +struct QLatin1StringArg : ArgBase { + QLatin1StringView string; + QLatin1StringArg() = default; + constexpr explicit QLatin1StringArg(QLatin1StringView v) noexcept : ArgBase{L1}, string{v} {} +}; + +[[nodiscard]] Q_CORE_EXPORT QString argToQString(QStringView pattern, size_t n, const ArgBase **args); +[[nodiscard]] Q_CORE_EXPORT QString argToQString(QLatin1StringView pattern, size_t n, const ArgBase **args); + +template +[[nodiscard]] Q_ALWAYS_INLINE QString argToQStringDispatch(StringView pattern, const Args &...args) +{ + const ArgBase *argBases[] = {&args..., /* avoid zero-sized array */ nullptr}; + return QtPrivate::argToQString(pattern, sizeof...(Args), argBases); +} + + inline QStringViewArg qStringLikeToArg(const QString &s) noexcept { return QStringViewArg{qToStringViewIgnoringNull(s)}; } +constexpr inline QStringViewArg qStringLikeToArg(QStringView s) noexcept { return QStringViewArg{s}; } + inline QStringViewArg qStringLikeToArg(const QChar &c) noexcept { return QStringViewArg{QStringView{&c, 1}}; } +constexpr inline QLatin1StringArg qStringLikeToArg(QLatin1StringView s) noexcept { return QLatin1StringArg{s}; } + +} // namespace QtPrivate + +template +Q_ALWAYS_INLINE +QString QStringView::arg(Args &&...args) const +{ + return QtPrivate::argToQStringDispatch(*this, QtPrivate::qStringLikeToArg(args)...); +} + +template +Q_ALWAYS_INLINE +QString QLatin1StringView::arg(Args &&...args) const +{ + return QtPrivate::argToQStringDispatch(*this, QtPrivate::qStringLikeToArg(args)...); +} + +template +qsizetype erase(QString &s, const T &t) +{ + return s.removeIf_helper([&t](const auto &e) { return t == e; }); +} + +template +qsizetype erase_if(QString &s, Predicate pred) +{ + return s.removeIf_helper(pred); +} + +namespace Qt { +inline namespace Literals { +inline namespace StringLiterals { +inline QString operator""_s(const char16_t *str, size_t size) noexcept +{ + return QString(QStringPrivate(nullptr, const_cast(str), qsizetype(size))); +} + +} // StringLiterals +} // Literals +} // Qt + +inline namespace QtLiterals { +#if QT_DEPRECATED_SINCE(6, 8) + +QT_DEPRECATED_VERSION_X_6_8("Use _s from Qt::StringLiterals namespace instead.") +inline QString operator""_qs(const char16_t *str, size_t size) noexcept +{ + return Qt::StringLiterals::operator""_s(str, size); +} + +#endif // QT_DEPRECATED_SINCE(6, 8) +} // QtLiterals + +QT_END_NAMESPACE + +#include +#include + +#ifdef Q_L1S_VIEW_IS_PRIMARY +# undef Q_L1S_VIEW_IS_PRIMARY +#endif + +#endif // QSTRING_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qstringalgorithms.h b/qt/6.8.1/msvc2022_64/include/QtCore/qstringalgorithms.h new file mode 100644 index 0000000000000000000000000000000000000000..b6ef306c028b9a375402fd8c4cdd12cdd86953f9 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qstringalgorithms.h @@ -0,0 +1,209 @@ +// Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSTRINGALGORITHMS_H +#define QSTRINGALGORITHMS_H + +#include +#include +#include +#include +#if 0 +#pragma qt_class(QStringAlgorithms) +#endif + +#include // std::find +#include // std::size + +#include // q20::is_constant_evaluated + +QT_BEGIN_NAMESPACE + +namespace QtPrivate { + +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype qustrlen(const char16_t *str) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype qustrnlen(const char16_t *str, qsizetype maxlen) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION const char16_t *qustrchr(QStringView str, char16_t ch) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION const char16_t *qustrcasechr(QStringView str, char16_t ch) noexcept; + +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QStringView lhs, QStringView rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QStringView lhs, QLatin1StringView rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QStringView lhs, QBasicUtf8StringView rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QLatin1StringView lhs, QStringView rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QLatin1StringView lhs, QLatin1StringView rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QLatin1StringView lhs, QBasicUtf8StringView rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QBasicUtf8StringView lhs, QStringView rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QBasicUtf8StringView lhs, QLatin1StringView rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QBasicUtf8StringView lhs, QBasicUtf8StringView rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; + +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool equalStrings(QStringView lhs, QStringView rhs) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool equalStrings(QStringView lhs, QLatin1StringView rhs) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool equalStrings(QStringView lhs, QBasicUtf8StringView rhs) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool equalStrings(QLatin1StringView lhs, QStringView rhs) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool equalStrings(QLatin1StringView lhs, QLatin1StringView rhs) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool equalStrings(QLatin1StringView lhs, QBasicUtf8StringView rhs) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool equalStrings(QBasicUtf8StringView lhs, QStringView rhs) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool equalStrings(QBasicUtf8StringView lhs, QLatin1StringView rhs) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool equalStrings(QBasicUtf8StringView lhs, QBasicUtf8StringView rhs) noexcept; + +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool startsWith(QStringView haystack, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool startsWith(QStringView haystack, QLatin1StringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool startsWith(QLatin1StringView haystack, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool startsWith(QLatin1StringView haystack, QLatin1StringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; + +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool endsWith(QStringView haystack, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool endsWith(QStringView haystack, QLatin1StringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool endsWith(QLatin1StringView haystack, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool endsWith(QLatin1StringView haystack, QLatin1StringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; + +[[nodiscard]] inline qsizetype findString(QStringView str, qsizetype from, QChar needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype findString(QStringView haystack, qsizetype from, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype findString(QStringView haystack, qsizetype from, QLatin1StringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype findString(QLatin1StringView haystack, qsizetype from, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype findString(QLatin1StringView haystack, qsizetype from, QLatin1StringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; + +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype lastIndexOf(QStringView haystack, qsizetype from, char16_t needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype lastIndexOf(QStringView haystack, qsizetype from, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype lastIndexOf(QStringView haystack, qsizetype from, QLatin1StringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype lastIndexOf(QLatin1StringView haystack, qsizetype from, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype lastIndexOf(QLatin1StringView haystack, qsizetype from, QLatin1StringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; + +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION QStringView trimmed(QStringView s) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION QLatin1StringView trimmed(QLatin1StringView s) noexcept; + +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isLower(QStringView s) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isUpper(QStringView s) noexcept; + +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype count(QStringView haystack, QChar needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype count(QStringView haystack, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype count(QStringView haystack, QLatin1StringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive); +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype count(QLatin1StringView haystack, QLatin1StringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive); +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype count(QLatin1StringView haystack, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive); +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype count(QLatin1StringView haystack, QChar needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; + +#if QT_CONFIG(regularexpression) +// ### Qt 7: unify these overloads; +// remove the ones taking only a QStringView, export the others, adjust callers +[[nodiscard]] qsizetype indexOf(QStringView viewHaystack, + const QString *stringHaystack, + const QRegularExpression &re, + qsizetype from = 0, + QRegularExpressionMatch *rmatch = nullptr); +[[nodiscard]] Q_CORE_EXPORT qsizetype indexOf(QStringView haystack, + const QRegularExpression &re, + qsizetype from = 0, + QRegularExpressionMatch *rmatch = nullptr); +[[nodiscard]] qsizetype lastIndexOf(QStringView viewHaystack, + const QString *stringHaystack, + const QRegularExpression &re, + qsizetype from = -1, + QRegularExpressionMatch *rmatch = nullptr); +[[nodiscard]] Q_CORE_EXPORT qsizetype lastIndexOf(QStringView haystack, + const QRegularExpression &re, + qsizetype from = -1, + QRegularExpressionMatch *rmatch = nullptr); +[[nodiscard]] bool contains(QStringView viewHaystack, + const QString *stringHaystack, + const QRegularExpression &re, + QRegularExpressionMatch *rmatch = nullptr); +[[nodiscard]] Q_CORE_EXPORT bool contains(QStringView haystack, + const QRegularExpression &re, + QRegularExpressionMatch *rmatch = nullptr); +[[nodiscard]] Q_CORE_EXPORT qsizetype count(QStringView haystack, const QRegularExpression &re); +#endif + +[[nodiscard]] Q_CORE_EXPORT QString convertToQString(QAnyStringView s); + +[[nodiscard]] Q_CORE_EXPORT QByteArray convertToLatin1(QStringView str); +[[nodiscard]] Q_CORE_EXPORT QByteArray convertToUtf8(QStringView str); +[[nodiscard]] Q_CORE_EXPORT QByteArray convertToLocal8Bit(QStringView str); +[[nodiscard]] Q_CORE_EXPORT QList convertToUcs4(QStringView str); // ### Qt 7 char32_t + +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isRightToLeft(QStringView string) noexcept; + +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isAscii(QLatin1StringView s) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isAscii(QStringView s) noexcept; +[[nodiscard]] constexpr inline bool isLatin1(QLatin1StringView s) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isLatin1(QStringView s) noexcept; +[[nodiscard]] Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isValidUtf16(QStringView s) noexcept; + +template [[nodiscard]] constexpr Q_ALWAYS_INLINE +qsizetype lengthHelperContainerLoop(const Char (&str)[N]) +{ +#if defined(__cpp_lib_constexpr_algorithms) && defined(Q_CC_GNU_ONLY) + // libstdc++'s std::find / std::find_if manages to execute more steps + // than the loop below + const auto it = std::find(str, str + N, Char(0)); + return it - str; +#else + // std::char_traits is deprecated for C not one of the standard char + // types, so we have to roll out our own loop. + for (size_t i = 0; i < N; ++i) { + if (str[i] == Char(0)) + return qsizetype(i); + } + return qsizetype(N); +#endif +} + +template [[nodiscard]] constexpr Q_ALWAYS_INLINE +std::enable_if_t +lengthHelperContainer(const Char (&str)[N]) +{ + // The following values were empirically determined to detect the threshold + // at which the compiler gives up pre-calculating the std::find() below and + // instead inserts code to be executed at runtime. + constexpr size_t RuntimeThreshold = +#if defined(Q_CC_CLANG) + // tested on Clang 15, 16 & 17 + 1023 +#elif defined(Q_CC_GNU) + // tested through GCC 13.1 at -O3 compilation level + // note: at -O2, GCC always generates a loop! + __cplusplus >= 202002L ? 39 : 17 +#else + 0 +#endif + ; + if constexpr (N == 1) { + return str[0] == Char(0) ? 0 : 1; + } else if constexpr (N > RuntimeThreshold) { +#ifdef QT_SUPPORTS_IS_CONSTANT_EVALUATED + if (!q20::is_constant_evaluated()) + return QtPrivate::qustrnlen(reinterpret_cast(str), N); +#endif + } + + return lengthHelperContainerLoop(str); +} + +inline qsizetype qstrnlen_helper(const char *str, size_t maxlen) +{ +#if !defined(Q_COMPILER_SLOW_QSTRNLEN_COMPILATION) + return qstrnlen(str, maxlen); +#else + return strnlen_s(str, maxlen); +#endif +} + +template [[nodiscard]] constexpr inline +std::enable_if_t lengthHelperContainer(const Char (&str)[N]) +{ +#ifdef QT_SUPPORTS_IS_CONSTANT_EVALUATED + if (!q20::is_constant_evaluated()) + return qstrnlen_helper(reinterpret_cast(str), N); +#endif + + return lengthHelperContainerLoop(str); +} + +template +constexpr qsizetype lengthHelperContainer(const Container &c) noexcept +{ + return qsizetype(std::size(c)); +} +} // namespace QtPrivate + +QT_END_NAMESPACE + +#endif // QSTRINGALGORTIHMS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qstringbuilder.h b/qt/6.8.1/msvc2022_64/include/QtCore/qstringbuilder.h new file mode 100644 index 0000000000000000000000000000000000000000..5ab56b2e2d1e6883af1f5097d5c0093cb6ebed60 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qstringbuilder.h @@ -0,0 +1,469 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include + +#ifndef QSTRINGBUILDER_H +#define QSTRINGBUILDER_H + +#if 0 +// syncqt can not handle the templates in this file, and it doesn't need to +// process them anyway because they are internal. +#pragma qt_class(QStringBuilder) +#pragma qt_sync_stop_processing +#endif + +#include + +#include + +QT_BEGIN_NAMESPACE + + +struct Q_CORE_EXPORT QAbstractConcatenable +{ +protected: + static void convertFromUtf8(QByteArrayView in, QChar *&out) noexcept; + static inline void convertFromAscii(char a, QChar *&out) noexcept + { + *out++ = QLatin1Char(a); + } + static void appendLatin1To(QLatin1StringView in, QChar *out) noexcept; +}; + +template struct QConcatenable; + +template +using QConcatenableEx = QConcatenable>; + +namespace QtStringBuilder { + template struct ConvertToTypeHelper + { typedef A ConvertTo; }; + template struct ConvertToTypeHelper + { typedef QString ConvertTo; }; + + template using HasIsNull = decltype(std::declval().isNull()); + template bool isNull(const T &t) + { + if constexpr (qxp::is_detected_v) + return t.isNull(); + else + return false; + } +} + +template +struct QStringBuilderCommon +{ + T toUpper() const { return resolved().toUpper(); } + T toLower() const { return resolved().toLower(); } + +protected: + T resolved() const { return *static_cast(this); } +}; + +template +struct QStringBuilderBase : public QStringBuilderCommon +{ +}; + +template +struct QStringBuilderBase : public QStringBuilderCommon +{ + QByteArray toLatin1() const { return this->resolved().toLatin1(); } + QByteArray toUtf8() const { return this->resolved().toUtf8(); } + QByteArray toLocal8Bit() const { return this->resolved().toLocal8Bit(); } +}; + +template +class QStringBuilder : public QStringBuilderBase, + typename QtStringBuilder::ConvertToTypeHelper< + typename QConcatenableEx::ConvertTo, + typename QConcatenableEx::ConvertTo + >::ConvertTo + > +{ +public: + QStringBuilder(A &&a_, B &&b_) : a(std::forward(a_)), b(std::forward(b_)) {} + + QStringBuilder(QStringBuilder &&) = default; + QStringBuilder(const QStringBuilder &) = default; + ~QStringBuilder() = default; + +private: + friend class QByteArray; + friend class QString; + template T convertTo() const + { + if (isNull()) { + // appending two null strings must give back a null string, + // so we're special casing this one out, QTBUG-114206 + return T(); + } + + const qsizetype len = Concatenable::size(*this); + T s(len, Qt::Uninitialized); + + // Using data_ptr() here (private API) so we can bypass the + // isDetached() and the replacement of a null pointer with _empty in + // both QString and QByteArray's data() and constData(). The result is + // the same if len != 0. + auto d = reinterpret_cast(s.data_ptr().data()); + const auto start = d; + Concatenable::appendTo(*this, d); + + if constexpr (Concatenable::ExactSize) { + Q_UNUSED(start) + } else { + if (len != d - start) { + // this resize is necessary since we allocate a bit too much + // when dealing with variable sized 8-bit encodings + s.resize(d - start); + } + } + return s; + } + + typedef QConcatenable > Concatenable; +public: + typedef typename Concatenable::ConvertTo ConvertTo; + operator ConvertTo() const { return convertTo(); } + + qsizetype size() const { return Concatenable::size(*this); } + + bool isNull() const + { + return QtStringBuilder::isNull(a) && QtStringBuilder::isNull(b); + } + + A a; + B b; + +private: + QStringBuilder &operator=(QStringBuilder &&) = delete; + QStringBuilder &operator=(const QStringBuilder &) = delete; +}; + +template <> struct QConcatenable : private QAbstractConcatenable +{ + typedef char type; + typedef QByteArray ConvertTo; + enum { ExactSize = true }; + static qsizetype size(const char) { return 1; } +#ifndef QT_NO_CAST_FROM_ASCII + QT_ASCII_CAST_WARN static inline void appendTo(const char c, QChar *&out) + { + QAbstractConcatenable::convertFromAscii(c, out); + } +#endif + static inline void appendTo(const char c, char *&out) + { *out++ = c; } +}; + +template <> struct QConcatenable : private QAbstractConcatenable +{ + typedef QByteArrayView type; + typedef QByteArray ConvertTo; + enum { ExactSize = true }; + static qsizetype size(QByteArrayView bav) { return bav.size(); } +#ifndef QT_NO_CAST_FROM_ASCII + QT_ASCII_CAST_WARN static inline void appendTo(QByteArrayView bav, QChar *&out) + { + QAbstractConcatenable::convertFromUtf8(bav, out); + } +#endif + static inline void appendTo(QByteArrayView bav, char *&out) + { + qsizetype n = bav.size(); + if (n) + memcpy(out, bav.data(), n); + out += n; + } +}; + +template <> struct QConcatenable : private QAbstractConcatenable +{ + typedef char16_t type; + typedef QString ConvertTo; + enum { ExactSize = true }; + static constexpr qsizetype size(char16_t) { return 1; } + static inline void appendTo(char16_t c, QChar *&out) + { *out++ = c; } +}; + +template <> struct QConcatenable +{ + typedef QLatin1Char type; + typedef QString ConvertTo; + enum { ExactSize = true }; + static qsizetype size(const QLatin1Char) { return 1; } + static inline void appendTo(const QLatin1Char c, QChar *&out) + { *out++ = c; } + static inline void appendTo(const QLatin1Char c, char *&out) + { *out++ = c.toLatin1(); } +}; + +template <> struct QConcatenable : private QAbstractConcatenable +{ + typedef QChar type; + typedef QString ConvertTo; + enum { ExactSize = true }; + static qsizetype size(const QChar) { return 1; } + static inline void appendTo(const QChar c, QChar *&out) + { *out++ = c; } +}; + +template <> struct QConcatenable : private QAbstractConcatenable +{ + typedef QChar::SpecialCharacter type; + typedef QString ConvertTo; + enum { ExactSize = true }; + static qsizetype size(const QChar::SpecialCharacter) { return 1; } + static inline void appendTo(const QChar::SpecialCharacter c, QChar *&out) + { *out++ = c; } +}; + +template <> struct QConcatenable : private QAbstractConcatenable +{ + typedef QLatin1StringView type; + typedef QString ConvertTo; + enum { ExactSize = true }; + static qsizetype size(const QLatin1StringView a) { return a.size(); } + static inline void appendTo(const QLatin1StringView a, QChar *&out) + { + appendLatin1To(a, out); + out += a.size(); + } + static inline void appendTo(const QLatin1StringView a, char *&out) + { + if (const char *data = a.data()) { + memcpy(out, data, a.size()); + out += a.size(); + } + } +}; + +template <> struct QConcatenable : private QAbstractConcatenable +{ + typedef QString type; + typedef QString ConvertTo; + enum { ExactSize = true }; + static qsizetype size(const QString &a) { return a.size(); } + static inline void appendTo(const QString &a, QChar *&out) + { + const qsizetype n = a.size(); + if (n) + memcpy(out, reinterpret_cast(a.constData()), sizeof(QChar) * n); + out += n; + } +}; + +template <> struct QConcatenable : private QAbstractConcatenable +{ + typedef QStringView type; + typedef QString ConvertTo; + enum { ExactSize = true }; + static qsizetype size(QStringView a) { return a.size(); } + static inline void appendTo(QStringView a, QChar *&out) + { + const auto n = a.size(); + if (n) + memcpy(out, a.data(), sizeof(QChar) * n); + out += n; + } +}; + +template struct QConcatenable : private QAbstractConcatenable +{ + typedef const char type[N]; + typedef QByteArray ConvertTo; + enum { ExactSize = false }; + static qsizetype size(const char[N]) { return N - 1; } +#ifndef QT_NO_CAST_FROM_ASCII + QT_ASCII_CAST_WARN static inline void appendTo(const char a[N], QChar *&out) + { + QAbstractConcatenable::convertFromUtf8(QByteArrayView(a, N - 1), out); + } +#endif + static inline void appendTo(const char a[N], char *&out) + { + while (*a) + *out++ = *a++; + } +}; + +template struct QConcatenable : QConcatenable +{ + typedef char type[N]; +}; + +template <> struct QConcatenable : private QAbstractConcatenable +{ + typedef const char *type; + typedef QByteArray ConvertTo; + enum { ExactSize = false }; + static qsizetype size(const char *a) { return qstrlen(a); } +#ifndef QT_NO_CAST_FROM_ASCII + QT_ASCII_CAST_WARN static inline void appendTo(const char *a, QChar *&out) + { QAbstractConcatenable::convertFromUtf8(QByteArrayView(a), out); } +#endif + static inline void appendTo(const char *a, char *&out) + { + if (!a) + return; + while (*a) + *out++ = *a++; + } +}; + +template <> struct QConcatenable : QConcatenable +{ + typedef char *type; +}; + +template struct QConcatenable : private QAbstractConcatenable +{ + using type = const char16_t[N]; + using ConvertTo = QString; + enum { ExactSize = true }; + static qsizetype size(const char16_t[N]) { return N - 1; } + static void appendTo(const char16_t a[N], QChar *&out) + { + memcpy(static_cast(out), a, (N - 1) * sizeof(char16_t)); + out += N - 1; + } +}; + +template struct QConcatenable : QConcatenable +{ + using type = char16_t[N]; +}; + +template <> struct QConcatenable : private QAbstractConcatenable +{ + using type = const char16_t *; + using ConvertTo = QString; + enum { ExactSize = true }; + static qsizetype size(const char16_t *a) { return QStringView(a).size(); } + QT_ASCII_CAST_WARN static inline void appendTo(const char16_t *a, QChar *&out) + { + if (!a) + return; + while (*a) + *out++ = *a++; + } +}; + +template <> struct QConcatenable : QConcatenable +{ + typedef char16_t *type; +}; + +template <> struct QConcatenable : private QAbstractConcatenable +{ + typedef QByteArray type; + typedef QByteArray ConvertTo; + enum { ExactSize = false }; + static qsizetype size(const QByteArray &ba) { return ba.size(); } +#ifndef QT_NO_CAST_FROM_ASCII + QT_ASCII_CAST_WARN static inline void appendTo(const QByteArray &ba, QChar *&out) + { + QAbstractConcatenable::convertFromUtf8(ba, out); + } +#endif + static inline void appendTo(const QByteArray &ba, char *&out) + { + const qsizetype n = ba.size(); + if (n) + memcpy(out, ba.begin(), n); + out += n; + } +}; + + +template +struct QConcatenable< QStringBuilder > +{ + typedef QStringBuilder type; + using ConvertTo = typename QtStringBuilder::ConvertToTypeHelper< + typename QConcatenableEx::ConvertTo, + typename QConcatenableEx::ConvertTo + >::ConvertTo; + enum { ExactSize = QConcatenableEx::ExactSize && QConcatenableEx::ExactSize }; + static qsizetype size(const type &p) + { + return QConcatenableEx::size(p.a) + QConcatenableEx::size(p.b); + } + template static inline void appendTo(const type &p, T *&out) + { + QConcatenableEx::appendTo(p.a, out); + QConcatenableEx::appendTo(p.b, out); + } +}; + +template ::type, typename QConcatenableEx::type>> +auto operator%(A &&a, B &&b) +{ + return QStringBuilder(std::forward(a), std::forward(b)); +} + +// QT_USE_FAST_OPERATOR_PLUS was introduced in 4.7, QT_USE_QSTRINGBUILDER is to be used from 4.8 onwards +// QT_USE_FAST_OPERATOR_PLUS does not remove the normal operator+ for QByteArray +#if defined(QT_USE_FAST_OPERATOR_PLUS) || defined(QT_USE_QSTRINGBUILDER) +template ::type, typename QConcatenableEx::type>> +auto operator+(A &&a, B &&b) +{ + return std::forward(a) % std::forward(b); +} +#endif + +namespace QtStringBuilder { +template +QByteArray &appendToByteArray(QByteArray &a, const QStringBuilder &b, char) +{ + // append 8-bit data to a byte array + qsizetype len = a.size() + QConcatenable< QStringBuilder >::size(b); + a.detach(); // a detach() in a.data() could reset a.capacity() to a.size() + if (len > a.data_ptr().freeSpaceAtEnd()) // capacity() was broken when prepend()-optimization landed + a.reserve(qMax(len, 2 * a.capacity())); + char *it = a.data() + a.size(); + QConcatenable< QStringBuilder >::appendTo(b, it); + a.resize(len); //we need to resize after the appendTo for the case str+=foo+str + return a; +} + +#ifndef QT_NO_CAST_TO_ASCII +template +QByteArray &appendToByteArray(QByteArray &a, const QStringBuilder &b, QChar) +{ + return a += QString(b).toUtf8(); +} +#endif +} + +template +QByteArray &operator+=(QByteArray &a, const QStringBuilder &b) +{ + return QtStringBuilder::appendToByteArray(a, b, + typename QConcatenable< QStringBuilder >::ConvertTo::value_type()); +} + +template +QString &operator+=(QString &a, const QStringBuilder &b) +{ + qsizetype len = a.size() + QConcatenable< QStringBuilder >::size(b); + a.detach(); // a detach() in a.data() could reset a.capacity() to a.size() + if (len > a.data_ptr().freeSpaceAtEnd()) // capacity() was broken when prepend()-optimization landed + a.reserve(qMax(len, 2 * a.capacity())); + QChar *it = a.data() + a.size(); + QConcatenable< QStringBuilder >::appendTo(b, it); + // we need to resize after the appendTo for the case str+=foo+str + a.resize(it - a.constData()); //may be smaller than len if there was conversion from utf8 + return a; +} + +QT_END_NAMESPACE + +#endif // QSTRINGBUILDER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qstringconverter.h b/qt/6.8.1/msvc2022_64/include/QtCore/qstringconverter.h new file mode 100644 index 0000000000000000000000000000000000000000..ef8a29c25e4642af02acc71289e76cd0f3522507 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qstringconverter.h @@ -0,0 +1,262 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#if 0 +// keep existing syncqt header working after the move of the class +// into qstringconverter_base +#pragma qt_class(QStringConverter) +#pragma qt_class(QStringConverterBase) +#endif + +#ifndef QSTRINGCONVERTER_H +#define QSTRINGCONVERTER_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QStringEncoder : public QStringConverter +{ +protected: + constexpr explicit QStringEncoder(const Interface *i) noexcept + : QStringConverter(i) + {} +public: + constexpr QStringEncoder() noexcept + : QStringConverter() + {} + constexpr explicit QStringEncoder(Encoding encoding, Flags flags = Flag::Default) + : QStringConverter(encoding, flags) + {} + explicit QStringEncoder(QAnyStringView name, Flags flags = Flag::Default) + : QStringConverter(name, flags) + {} + + template + struct DecodedData + { + QStringEncoder *encoder; + T data; + operator QByteArray() const { return encoder->encodeAsByteArray(data); } + }; + Q_WEAK_OVERLOAD + DecodedData operator()(const QString &str) + { return DecodedData{this, str}; } + DecodedData operator()(QStringView in) + { return DecodedData{this, in}; } + Q_WEAK_OVERLOAD + DecodedData encode(const QString &str) + { return DecodedData{this, str}; } + DecodedData encode(QStringView in) + { return DecodedData{this, in}; } + + qsizetype requiredSpace(qsizetype inputLength) const + { return iface ? iface->fromUtf16Len(inputLength) : 0; } + char *appendToBuffer(char *out, QStringView in) + { + if (!iface) { + state.invalidChars = 1; + return out; + } + return iface->fromUtf16(out, in, &state); + } +private: + QByteArray encodeAsByteArray(QStringView in) + { + if (!iface) { + // ensure that hasError returns true + state.invalidChars = 1; + return {}; + } + QByteArray result(iface->fromUtf16Len(in.size()), Qt::Uninitialized); + char *out = result.data(); + out = iface->fromUtf16(out, in, &state); + result.truncate(out - result.constData()); + return result; + } + +}; + +class QStringDecoder : public QStringConverter +{ +protected: + constexpr explicit QStringDecoder(const Interface *i) noexcept + : QStringConverter(i) + {} +public: + constexpr explicit QStringDecoder(Encoding encoding, Flags flags = Flag::Default) + : QStringConverter(encoding, flags) + {} + constexpr QStringDecoder() noexcept + : QStringConverter() + {} + explicit QStringDecoder(QAnyStringView name, Flags f = Flag::Default) + : QStringConverter(name, f) + {} + + template + struct EncodedData + { + QStringDecoder *decoder; + T data; + operator QString() const { return decoder->decodeAsString(data); } + }; + Q_WEAK_OVERLOAD + EncodedData operator()(const QByteArray &ba) + { return EncodedData{this, ba}; } + EncodedData operator()(QByteArrayView ba) + { return EncodedData{this, ba}; } + Q_WEAK_OVERLOAD + EncodedData decode(const QByteArray &ba) + { return EncodedData{this, ba}; } + EncodedData decode(QByteArrayView ba) + { return EncodedData{this, ba}; } + + qsizetype requiredSpace(qsizetype inputLength) const + { return iface ? iface->toUtf16Len(inputLength) : 0; } + QChar *appendToBuffer(QChar *out, QByteArrayView ba) + { + if (!iface) { + state.invalidChars = 1; + return out; + } + return iface->toUtf16(out, ba, &state); + } + char16_t *appendToBuffer(char16_t *out, QByteArrayView ba) + { return reinterpret_cast(appendToBuffer(reinterpret_cast(out), ba)); } + + Q_CORE_EXPORT static QStringDecoder decoderForHtml(QByteArrayView data); + +private: + QString decodeAsString(QByteArrayView in) + { + if (!iface) { + // ensure that hasError returns true + state.invalidChars = 1; + return {}; + } + QString result(iface->toUtf16Len(in.size()), Qt::Uninitialized); + const QChar *out = iface->toUtf16(result.data(), in, &state); + result.truncate(out - result.constData()); + return result; + } +}; + + +#if defined(QT_USE_FAST_OPERATOR_PLUS) || defined(QT_USE_QSTRINGBUILDER) +template +struct QConcatenable> + : private QAbstractConcatenable +{ + typedef QChar type; + typedef QString ConvertTo; + enum { ExactSize = false }; + static qsizetype size(const QStringDecoder::EncodedData &s) { return s.decoder->requiredSpace(s.data.size()); } + static inline void appendTo(const QStringDecoder::EncodedData &s, QChar *&out) + { + out = s.decoder->appendToBuffer(out, s.data); + } +}; + +template +struct QConcatenable> + : private QAbstractConcatenable +{ + typedef char type; + typedef QByteArray ConvertTo; + enum { ExactSize = false }; + static qsizetype size(const QStringEncoder::DecodedData &s) { return s.encoder->requiredSpace(s.data.size()); } + static inline void appendTo(const QStringEncoder::DecodedData &s, char *&out) + { + out = s.encoder->appendToBuffer(out, s.data); + } +}; + +template +QString &operator+=(QString &a, const QStringDecoder::EncodedData &b) +{ + qsizetype len = a.size() + QConcatenable>::size(b); + a.reserve(len); + QChar *it = a.data() + a.size(); + QConcatenable>::appendTo(b, it); + a.resize(qsizetype(it - a.constData())); //may be smaller than len + return a; +} + +template +QByteArray &operator+=(QByteArray &a, const QStringEncoder::DecodedData &b) +{ + qsizetype len = a.size() + QConcatenable>::size(b); + a.reserve(len); + char *it = a.data() + a.size(); + QConcatenable>::appendTo(b, it); + a.resize(qsizetype(it - a.constData())); //may be smaller than len + return a; +} +#endif + +template +void QString::assign_helper_char8(InputIterator first, InputIterator last) +{ + static_assert(!QString::is_contiguous_iterator_v, + "Internal error: Should have been handed over to the QAnyStringView overload." + ); + + using ValueType = typename std::iterator_traits::value_type; + constexpr bool IsFwdIt = std::is_convertible_v< + typename std::iterator_traits::iterator_category, + std::forward_iterator_tag + >; + + resize(0); + // In case of not being shared, there is the possibility of having free space at begin + // even after the resize to zero. + if (const auto offset = d.freeSpaceAtBegin()) + d.setBegin(d.begin() - offset); + + if constexpr (IsFwdIt) + reserve(static_cast(std::distance(first, last))); + + auto toUtf16 = QStringDecoder(QStringDecoder::Utf8); + auto availableCapacity = d.constAllocatedCapacity(); + auto *dst = d.data(); + auto *dend = d.data() + availableCapacity; + + while (true) { + if (first == last) { // ran out of input elements + Q_ASSERT(!std::less<>{}(dend, dst)); + d.size = dst - d.begin(); + return; + } + const ValueType next = *first; // decays proxies, if any + const auto chunk = QUtf8StringView(&next, 1); + // UTF-8 characters can have a maximum size of 4 bytes and may result in a surrogate + // pair of UTF-16 code units. In the input-iterator case, we don't know the size + // and would need to always reserve space for 2 code units. To keep our promise + // of 'not allocating if it fits', we have to pre-check this condition. + // We know that it fits in the forward-iterator case. + if constexpr (!IsFwdIt) { + constexpr qsizetype Pair = 2; + char16_t buf[Pair]; + const qptrdiff n = toUtf16.appendToBuffer(buf, chunk) - buf; + if (dend - dst < n) { // ran out of allocated memory + const auto offset = dst - d.begin(); + reallocData(d.constAllocatedCapacity() + Pair, QArrayData::Grow); + // update the pointers since we've re-allocated + availableCapacity = d.constAllocatedCapacity(); + dst = d.data() + offset; + dend = d.data() + availableCapacity; + } + dst = std::copy_n(buf, n, dst); + } else { // take the fast path + dst = toUtf16.appendToBuffer(dst, chunk); + } + ++first; + } +} + +QT_END_NAMESPACE + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qstringconverter_base.h b/qt/6.8.1/msvc2022_64/include/QtCore/qstringconverter_base.h new file mode 100644 index 0000000000000000000000000000000000000000..d08a2a40f106bbf2e8005e897496126f228ae52a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qstringconverter_base.h @@ -0,0 +1,183 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSTRINGCONVERTER_BASE_H +#define QSTRINGCONVERTER_BASE_H + +#if 0 +// QStringConverter(Base) class are handled in qstringconverter +#pragma qt_sync_stop_processing +#endif + +#include + +#include // QT_{BEGIN,END}_NAMESPACE +#include // Q_DECLARE_FLAGS +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QByteArrayView; +class QChar; +class QByteArrayView; +class QStringView; + +class QStringConverterBase +{ +public: + enum class Flag { + Default = 0, + Stateless = 0x1, + ConvertInvalidToNull = 0x2, + WriteBom = 0x4, + ConvertInitialBom = 0x8, + UsesIcu = 0x10, + }; + Q_DECLARE_FLAGS(Flags, Flag) + + struct State { + constexpr State(Flags f = Flag::Default) noexcept + : flags(f), state_data{0, 0, 0, 0} {} + ~State() { clear(); } + + State(State &&other) noexcept + : flags(other.flags), + remainingChars(other.remainingChars), + invalidChars(other.invalidChars), + state_data{other.state_data[0], other.state_data[1], + other.state_data[2], other.state_data[3]}, + clearFn(other.clearFn) + { other.clearFn = nullptr; } + State &operator=(State &&other) noexcept + { + clear(); + flags = other.flags; + remainingChars = other.remainingChars; + invalidChars = other.invalidChars; + std::memmove(state_data, other.state_data, sizeof state_data); // self-assignment-safe + clearFn = other.clearFn; + other.clearFn = nullptr; + return *this; + } + Q_CORE_EXPORT void clear() noexcept; + Q_CORE_EXPORT void reset() noexcept; + + Flags flags; + int internalState = 0; + qsizetype remainingChars = 0; + qsizetype invalidChars = 0; + + union { + uint state_data[4]; + void *d[2]; + }; + using ClearDataFn = void (*)(State *) noexcept; + ClearDataFn clearFn = nullptr; + private: + Q_DISABLE_COPY(State) + }; +protected: + ~QStringConverterBase() = default; +}; +Q_DECLARE_OPERATORS_FOR_FLAGS(QStringConverterBase::Flags) + +class QStringConverter : public QStringConverterBase +{ +public: + + enum Encoding { + Utf8, +#ifndef QT_BOOTSTRAPPED + Utf16, + Utf16LE, + Utf16BE, + Utf32, + Utf32LE, + Utf32BE, +#endif + Latin1, + System, + LastEncoding = System + }; +#ifdef Q_QDOC + // document the flags here + enum class Flag { + Default = 0, + Stateless = 0x1, + ConvertInvalidToNull = 0x2, + WriteBom = 0x4, + ConvertInitialBom = 0x8, + UsesIcu = 0x10, + }; + Q_DECLARE_FLAGS(Flags, Flag) +#endif + +protected: + + struct Interface + { + using DecoderFn = QChar * (*)(QChar *out, QByteArrayView in, State *state); + using LengthFn = qsizetype (*)(qsizetype inLength); + using EncoderFn = char * (*)(char *out, QStringView in, State *state); + const char *name = nullptr; + DecoderFn toUtf16 = nullptr; + LengthFn toUtf16Len = nullptr; + EncoderFn fromUtf16 = nullptr; + LengthFn fromUtf16Len = nullptr; + }; + + constexpr QStringConverter() noexcept + : iface(nullptr) + {} + constexpr explicit QStringConverter(Encoding encoding, Flags f) + : iface(&encodingInterfaces[qsizetype(encoding)]), state(f) + {} + constexpr explicit QStringConverter(const Interface *i) noexcept + : iface(i) + {} +#if QT_CORE_REMOVED_SINCE(6, 8) + Q_CORE_EXPORT explicit QStringConverter(const char *name, Flags f); +#endif + Q_CORE_EXPORT explicit QStringConverter(QAnyStringView name, Flags f); + + + ~QStringConverter() = default; + +public: + QStringConverter(QStringConverter &&) = default; + QStringConverter &operator=(QStringConverter &&) = default; + + bool isValid() const noexcept { return iface != nullptr; } + + void resetState() noexcept + { + state.reset(); + } + bool hasError() const noexcept { return state.invalidChars != 0; } + + Q_CORE_EXPORT const char *name() const noexcept; + +#if QT_CORE_REMOVED_SINCE(6, 8) + Q_CORE_EXPORT static std::optional encodingForName(const char *name) noexcept; +#endif + Q_CORE_EXPORT static std::optional encodingForName(QAnyStringView name) noexcept; + Q_CORE_EXPORT static const char *nameForEncoding(Encoding e); + Q_CORE_EXPORT static std::optional + encodingForData(QByteArrayView data, char16_t expectedFirstCharacter = 0) noexcept; + Q_CORE_EXPORT static std::optional encodingForHtml(QByteArrayView data); + + Q_CORE_EXPORT static QStringList availableCodecs(); + +protected: + const Interface *iface; + State state; +private: + Q_CORE_EXPORT static const Interface encodingInterfaces[Encoding::LastEncoding + 1]; +}; + +QT_END_NAMESPACE + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qstringfwd.h b/qt/6.8.1/msvc2022_64/include/QtCore/qstringfwd.h new file mode 100644 index 0000000000000000000000000000000000000000..81ef8ec34a4f895eb4ed9e629acb6f8e98165244 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qstringfwd.h @@ -0,0 +1,56 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include + +#ifndef QSTRINGFWD_H +#define QSTRINGFWD_H + +QT_BEGIN_NAMESPACE + +#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0) +# define QT_BEGIN_HAS_CHAR8_T_NAMESPACE inline namespace q_has_char8_t { +# define QT_BEGIN_NO_CHAR8_T_NAMESPACE namespace q_no_char8_t { +#else +# define QT_BEGIN_HAS_CHAR8_T_NAMESPACE namespace q_has_char8_t { +# define QT_BEGIN_NO_CHAR8_T_NAMESPACE inline namespace q_no_char8_t { +#endif +#define QT_END_HAS_CHAR8_T_NAMESPACE } +#define QT_END_NO_CHAR8_T_NAMESPACE } + +// declare namespaces: +QT_BEGIN_HAS_CHAR8_T_NAMESPACE +QT_END_HAS_CHAR8_T_NAMESPACE +QT_BEGIN_NO_CHAR8_T_NAMESPACE +QT_END_NO_CHAR8_T_NAMESPACE + +class QByteArray; +class QByteArrayView; +#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0) || defined(QT_BOOTSTRAPPED) || defined(Q_QDOC) +class QLatin1StringView; +using QLatin1String = QLatin1StringView; +#else +class QLatin1String; +using QLatin1StringView = QLatin1String; +#endif +class QStringView; +template class QBasicUtf8StringView; +class QAnyStringView; +class QChar; +class QRegularExpression; +class QRegularExpressionMatch; + +#ifndef Q_QDOC +// ### Qt 7: remove the non-char8_t version of QUtf8StringView +QT_BEGIN_NO_CHAR8_T_NAMESPACE +using QUtf8StringView = QBasicUtf8StringView; +QT_END_NO_CHAR8_T_NAMESPACE + +QT_BEGIN_HAS_CHAR8_T_NAMESPACE +using QUtf8StringView = QBasicUtf8StringView; +QT_END_HAS_CHAR8_T_NAMESPACE +#endif // Q_QDOC + +QT_END_NAMESPACE + +#endif // QSTRINGFWD_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qstringlist.h b/qt/6.8.1/msvc2022_64/include/QtCore/qstringlist.h new file mode 100644 index 0000000000000000000000000000000000000000..c9c0962112be5836d7291739a30a7ad365db0a27 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qstringlist.h @@ -0,0 +1,176 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include + +#ifndef QSTRINGLIST_H +#define QSTRINGLIST_H + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QRegularExpression; + +#if !defined(QT_NO_JAVA_STYLE_ITERATORS) +using QStringListIterator = QListIterator; +using QMutableStringListIterator = QMutableListIterator; +#endif + + +namespace QtPrivate { + void Q_CORE_EXPORT QStringList_sort(QStringList *that, Qt::CaseSensitivity cs); + qsizetype Q_CORE_EXPORT QStringList_removeDuplicates(QStringList *that); + QString Q_CORE_EXPORT QStringList_join(const QStringList *that, QStringView sep); + QString Q_CORE_EXPORT QStringList_join(const QStringList *that, const QChar *sep, qsizetype seplen); + Q_CORE_EXPORT QString QStringList_join(const QStringList &list, QLatin1StringView sep); + QStringList Q_CORE_EXPORT QStringList_filter(const QStringList *that, QStringView str, + Qt::CaseSensitivity cs); + Q_CORE_EXPORT QStringList QStringList_filter(const QStringList &that, QLatin1StringView needle, + Qt::CaseSensitivity cs); + Q_CORE_EXPORT QStringList QStringList_filter(const QStringList &that, + const QStringMatcher &matcher); + + bool Q_CORE_EXPORT QStringList_contains(const QStringList *that, QStringView str, Qt::CaseSensitivity cs); + bool Q_CORE_EXPORT QStringList_contains(const QStringList *that, QLatin1StringView str, Qt::CaseSensitivity cs); + void Q_CORE_EXPORT QStringList_replaceInStrings(QStringList *that, QStringView before, QStringView after, + Qt::CaseSensitivity cs); + + qsizetype Q_CORE_EXPORT QStringList_indexOf(const QStringList &that, QStringView str, + qsizetype from, Qt::CaseSensitivity cs); + qsizetype Q_CORE_EXPORT QStringList_indexOf(const QStringList &that, QLatin1StringView str, + qsizetype from, Qt::CaseSensitivity cs); + + Q_CORE_EXPORT qsizetype QStringList_lastIndexOf(const QStringList &that, QStringView str, + qsizetype from, Qt::CaseSensitivity cs); + Q_CORE_EXPORT qsizetype QStringList_lastIndexOf(const QStringList &that, QLatin1StringView str, + qsizetype from, Qt::CaseSensitivity cs); + +#if QT_CONFIG(regularexpression) + void Q_CORE_EXPORT QStringList_replaceInStrings(QStringList *that, const QRegularExpression &rx, const QString &after); + QStringList Q_CORE_EXPORT QStringList_filter(const QStringList *that, const QRegularExpression &re); + qsizetype Q_CORE_EXPORT QStringList_indexOf(const QStringList *that, const QRegularExpression &re, qsizetype from); + qsizetype Q_CORE_EXPORT QStringList_lastIndexOf(const QStringList *that, const QRegularExpression &re, qsizetype from); +#endif // QT_CONFIG(regularexpression) +} + +#ifdef Q_QDOC +class QStringList : public QList +#else +template <> struct QListSpecialMethods : QListSpecialMethodsBase +#endif +{ +#ifdef Q_QDOC +public: + using QList::QList; + QStringList(const QString &str); + QStringList(const QList &other); + QStringList(QList &&other); + + QStringList &operator=(const QList &other); + QStringList &operator=(QList &&other); + QStringList operator+(const QStringList &other) const; + QStringList &operator<<(const QString &str); + QStringList &operator<<(const QStringList &other); + QStringList &operator<<(const QList &other); +private: +#endif + +public: + inline void sort(Qt::CaseSensitivity cs = Qt::CaseSensitive) + { QtPrivate::QStringList_sort(self(), cs); } + inline qsizetype removeDuplicates() + { return QtPrivate::QStringList_removeDuplicates(self()); } + + inline QString join(QStringView sep) const + { return QtPrivate::QStringList_join(self(), sep); } + inline QString join(QLatin1StringView sep) const + { return QtPrivate::QStringList_join(*self(), sep); } + inline QString join(QChar sep) const + { return QtPrivate::QStringList_join(self(), &sep, 1); } + + QStringList filter(const QStringMatcher &matcher) const + { return QtPrivate::QStringList_filter(*self(), matcher); } + QStringList filter(QLatin1StringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) const + { return QtPrivate::QStringList_filter(*self(), needle, cs); } + inline QStringList filter(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const + { return QtPrivate::QStringList_filter(self(), str, cs); } + inline QStringList &replaceInStrings(QStringView before, QStringView after, Qt::CaseSensitivity cs = Qt::CaseSensitive) + { + QtPrivate::QStringList_replaceInStrings(self(), before, after, cs); + return *self(); + } + + inline QString join(const QString &sep) const + { return QtPrivate::QStringList_join(self(), sep.constData(), sep.size()); } + inline QStringList filter(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const + { return QtPrivate::QStringList_filter(self(), str, cs); } + inline QStringList &replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive) + { + QtPrivate::QStringList_replaceInStrings(self(), before, after, cs); + return *self(); + } + inline QStringList &replaceInStrings(const QString &before, QStringView after, Qt::CaseSensitivity cs = Qt::CaseSensitive) + { + QtPrivate::QStringList_replaceInStrings(self(), before, after, cs); + return *self(); + } + inline QStringList &replaceInStrings(QStringView before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive) + { + QtPrivate::QStringList_replaceInStrings(self(), before, after, cs); + return *self(); + } + using QListSpecialMethodsBase::contains; + using QListSpecialMethodsBase::indexOf; + using QListSpecialMethodsBase::lastIndexOf; + + inline bool contains(QLatin1StringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::QStringList_contains(self(), str, cs); } + inline bool contains(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::QStringList_contains(self(), str, cs); } + + inline bool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::QStringList_contains(self(), str, cs); } + + qsizetype indexOf(const QString &str, qsizetype from = 0, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return indexOf(QStringView(str), from, cs); } + qsizetype indexOf(QStringView needle, qsizetype from = 0, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::QStringList_indexOf(*self(), needle, from, cs); } + qsizetype indexOf(QLatin1StringView needle, qsizetype from = 0, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::QStringList_indexOf(*self(), needle, from, cs); } + + qsizetype lastIndexOf(const QString &str, qsizetype from = -1, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return lastIndexOf(QStringView(str), from, cs); } + qsizetype lastIndexOf(QStringView str, qsizetype from = -1, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::QStringList_lastIndexOf(*self(), str, from, cs); } + qsizetype lastIndexOf(QLatin1StringView needle, qsizetype from = -1, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::QStringList_lastIndexOf(*self(), needle, from, cs); } + +#if QT_CONFIG(regularexpression) + inline QStringList filter(const QRegularExpression &re) const + { return QtPrivate::QStringList_filter(self(), re); } + inline QStringList &replaceInStrings(const QRegularExpression &re, const QString &after) + { + QtPrivate::QStringList_replaceInStrings(self(), re, after); + return *self(); + } + inline qsizetype indexOf(const QRegularExpression &re, qsizetype from = 0) const + { return QtPrivate::QStringList_indexOf(self(), re, from); } + inline qsizetype lastIndexOf(const QRegularExpression &re, qsizetype from = -1) const + { return QtPrivate::QStringList_lastIndexOf(self(), re, from); } +#endif // QT_CONFIG(regularexpression) +}; + +QT_END_NAMESPACE + +#endif // QSTRINGLIST_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qstringlistmodel.h b/qt/6.8.1/msvc2022_64/include/QtCore/qstringlistmodel.h new file mode 100644 index 0000000000000000000000000000000000000000..e0b6341017c2ae081674ba4d391241500e69215a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qstringlistmodel.h @@ -0,0 +1,51 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSTRINGLISTMODEL_H +#define QSTRINGLISTMODEL_H + +#include +#include + +QT_REQUIRE_CONFIG(stringlistmodel); + +QT_BEGIN_NAMESPACE + +class Q_CORE_EXPORT QStringListModel : public QAbstractListModel +{ + Q_OBJECT +public: + explicit QStringListModel(QObject *parent = nullptr); + explicit QStringListModel(const QStringList &strings, QObject *parent = nullptr); + + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + QModelIndex sibling(int row, int column, const QModelIndex &idx) const override; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; + bool clearItemData(const QModelIndex &index) override; + + Qt::ItemFlags flags(const QModelIndex &index) const override; + + bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; + bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; + bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override; + + QMap itemData(const QModelIndex &index) const override; + bool setItemData(const QModelIndex &index, const QMap &roles) override; + + void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override; + + QStringList stringList() const; + void setStringList(const QStringList &strings); + + Qt::DropActions supportedDropActions() const override; + +private: + Q_DISABLE_COPY(QStringListModel) + QStringList lst; +}; + +QT_END_NAMESPACE + +#endif // QSTRINGLISTMODEL_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qstringliteral.h b/qt/6.8.1/msvc2022_64/include/QtCore/qstringliteral.h new file mode 100644 index 0000000000000000000000000000000000000000..d9e426b1b468ed5a466a1333449b10e689a92dff --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qstringliteral.h @@ -0,0 +1,43 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2020 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSTRINGLITERAL_H +#define QSTRINGLITERAL_H + +#include +#include + +#if 0 +#pragma qt_class(QStringLiteral) +#endif + +QT_BEGIN_NAMESPACE + +// all our supported compilers support Unicode string literals, +// even if their Q_COMPILER_UNICODE_STRING has been revoked due +// to lacking stdlib support. But QStringLiteral only needs the +// core language feature, so just use u"" here unconditionally: + +#define QT_UNICODE_LITERAL(str) u"" str + +using QStringPrivate = QArrayDataPointer; + +namespace QtPrivate { +template +static Q_ALWAYS_INLINE QStringPrivate qMakeStringPrivate(const char16_t (&literal)[N]) +{ + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast) + auto str = const_cast(literal); + return { nullptr, str, N - 1 }; +} +} + +#define QStringLiteral(str) \ + (QString(QtPrivate::qMakeStringPrivate(QT_UNICODE_LITERAL(str)))) \ + /**/ + + +QT_END_NAMESPACE + +#endif // QSTRINGLITERAL_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qstringmatcher.h b/qt/6.8.1/msvc2022_64/include/QtCore/qstringmatcher.h new file mode 100644 index 0000000000000000000000000000000000000000..09a0c58e4fc36ba622361aa5f218f86bfdfd18a1 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qstringmatcher.h @@ -0,0 +1,58 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2019 Mail.ru Group. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSTRINGMATCHER_H +#define QSTRINGMATCHER_H + +#include +#include + +QT_BEGIN_NAMESPACE + + +class QStringMatcherPrivate; + +class Q_CORE_EXPORT QStringMatcher +{ + void updateSkipTable(); +public: + QStringMatcher() = default; + explicit QStringMatcher(const QString &pattern, + Qt::CaseSensitivity cs = Qt::CaseSensitive); + QStringMatcher(const QChar *uc, qsizetype len, + Qt::CaseSensitivity cs = Qt::CaseSensitive) + : QStringMatcher(QStringView(uc, len), cs) + {} + QStringMatcher(QStringView pattern, + Qt::CaseSensitivity cs = Qt::CaseSensitive); + QStringMatcher(const QStringMatcher &other); + ~QStringMatcher(); + + QStringMatcher &operator=(const QStringMatcher &other); + + void setPattern(const QString &pattern); + void setCaseSensitivity(Qt::CaseSensitivity cs); + + qsizetype indexIn(const QString &str, qsizetype from = 0) const + { return indexIn(QStringView(str), from); } + qsizetype indexIn(const QChar *str, qsizetype length, qsizetype from = 0) const + { return indexIn(QStringView(str, length), from); } + qsizetype indexIn(QStringView str, qsizetype from = 0) const; + QString pattern() const; + QStringView patternView() const noexcept + { return q_sv; } + + inline Qt::CaseSensitivity caseSensitivity() const { return q_cs; } + +private: + QStringMatcherPrivate *d_ptr = nullptr; + Qt::CaseSensitivity q_cs = Qt::CaseSensitive; + QString q_pattern; + QStringView q_sv; + uchar q_skiptable[256] = {}; +}; + +QT_END_NAMESPACE + +#endif // QSTRINGMATCHER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qstringtokenizer.h b/qt/6.8.1/msvc2022_64/include/QtCore/qstringtokenizer.h new file mode 100644 index 0000000000000000000000000000000000000000..b7b45980e62401c123824e642223a0dfcf66b480 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qstringtokenizer.h @@ -0,0 +1,408 @@ +// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +#ifndef QSTRINGTOKENIZER_H +#define QSTRINGTOKENIZER_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +template class QStringBuilder; + +class QStringTokenizerBaseBase +{ +protected: + ~QStringTokenizerBaseBase() = default; + constexpr QStringTokenizerBaseBase(Qt::SplitBehavior sb, Qt::CaseSensitivity cs) noexcept + : m_sb{sb}, m_cs{cs} {} + + struct tokenizer_state { + qsizetype start, end, extra; + friend constexpr bool operator==(tokenizer_state lhs, tokenizer_state rhs) noexcept + { return lhs.start == rhs.start && lhs.end == rhs.end && lhs.extra == rhs.extra; } + friend constexpr bool operator!=(tokenizer_state lhs, tokenizer_state rhs) noexcept + { return !operator==(lhs, rhs); } + }; + + Qt::SplitBehavior m_sb; + Qt::CaseSensitivity m_cs; +}; + +template +class QStringTokenizerBase : protected QStringTokenizerBaseBase +{ + struct next_result { + Haystack value; + bool ok; + tokenizer_state state; + }; + inline next_result next(tokenizer_state state) const noexcept; + inline next_result toFront() const noexcept { return next({}); } +public: + constexpr explicit QStringTokenizerBase(Haystack haystack, Needle needle, Qt::SplitBehavior sb, Qt::CaseSensitivity cs) noexcept + : QStringTokenizerBaseBase{sb, cs}, m_haystack{haystack}, m_needle{needle} {} + + class iterator; + friend class iterator; + class sentinel { + friend constexpr bool operator==(sentinel, sentinel) noexcept { return true; } + friend constexpr bool operator!=(sentinel, sentinel) noexcept { return false; } + }; + class iterator { + const QStringTokenizerBase *tokenizer; + next_result current; + friend class QStringTokenizerBase; + explicit iterator(const QStringTokenizerBase &t) noexcept + : tokenizer{&t}, current{t.toFront()} {} + public: + using difference_type = qsizetype; + using value_type = Haystack; + using pointer = const value_type*; + using reference = const value_type&; + using iterator_category = std::forward_iterator_tag; + + iterator() noexcept = default; + + // violates std::forward_iterator (returns a reference into the iterator) + [[nodiscard]] constexpr const Haystack* operator->() const { return Q_ASSERT(current.ok), ¤t.value; } + [[nodiscard]] constexpr const Haystack& operator*() const { return *operator->(); } + + iterator& operator++() { advance(); return *this; } + iterator operator++(int) { auto tmp = *this; advance(); return tmp; } + + friend constexpr bool operator==(const iterator &lhs, const iterator &rhs) noexcept + { return lhs.current.ok == rhs.current.ok && (!lhs.current.ok || (Q_ASSERT(lhs.tokenizer == rhs.tokenizer), lhs.current.state == rhs.current.state)); } + friend constexpr bool operator!=(const iterator &lhs, const iterator &rhs) noexcept + { return !operator==(lhs, rhs); } + friend constexpr bool operator==(const iterator &lhs, sentinel) noexcept + { return !lhs.current.ok; } + friend constexpr bool operator!=(const iterator &lhs, sentinel) noexcept + { return !operator==(lhs, sentinel{}); } + friend constexpr bool operator==(sentinel, const iterator &rhs) noexcept + { return !rhs.current.ok; } + friend constexpr bool operator!=(sentinel, const iterator &rhs) noexcept + { return !operator==(sentinel{}, rhs); } + private: + void advance() { + Q_ASSERT(current.ok); + current = tokenizer->next(current.state); + } + }; + using const_iterator = iterator; + + using size_type = std::size_t; + using difference_type = typename iterator::difference_type; + using value_type = typename iterator::value_type; + using pointer = typename iterator::pointer; + using const_pointer = pointer; + using reference = typename iterator::reference; + using const_reference = reference; + + [[nodiscard]] iterator begin() const noexcept { return iterator{*this}; } + [[nodiscard]] iterator cbegin() const noexcept { return begin(); } + [[nodiscard]] constexpr sentinel end() const noexcept { return {}; } + [[nodiscard]] constexpr sentinel cend() const noexcept { return {}; } + +private: + Haystack m_haystack; + Needle m_needle; +}; + +QT_BEGIN_INCLUDE_NAMESPACE +#include +QT_END_INCLUDE_NAMESPACE + +namespace QtPrivate { +namespace Tok { + + constexpr qsizetype size(QChar) noexcept { return 1; } + template + constexpr qsizetype size(const String &s) noexcept { return static_cast(s.size()); } + + template struct ViewForImpl {}; + template <> struct ViewForImpl { using type = QStringView; }; + template <> struct ViewForImpl { using type = QLatin1StringView; }; + template <> struct ViewForImpl { using type = QChar; }; + template <> struct ViewForImpl : ViewForImpl {}; + template <> struct ViewForImpl : ViewForImpl {}; + template <> struct ViewForImpl : ViewForImpl {}; + template <> struct ViewForImpl : ViewForImpl {}; + template <> struct ViewForImpl : ViewForImpl {}; + template + struct ViewForImpl> : ViewForImpl::ConvertTo> {}; + template + struct ViewForImpl> : ViewForImpl {}; +#ifdef __cpp_lib_string_view + template + struct ViewForImpl> : ViewForImpl {}; +#endif + + // This metafunction maps a StringLike to a View (currently, QChar, + // QStringView, QLatin1StringView). This is what QStringTokenizerBase + // operates on. QStringTokenizer adds pinning to keep rvalues alive + // for the duration of the algorithm. + template + using ViewFor = typename ViewForImpl::type>::type; + + // Pinning: + // rvalues of owning string types need to be moved into QStringTokenizer + // to keep them alive for the lifetime of the tokenizer. For lvalues, we + // assume the user takes care of that. + + // default: don't pin anything (characters are pinned implicitly) + template + struct PinForImpl { using type = ViewFor; }; + + // rvalue QString -> QString + template <> + struct PinForImpl { using type = QString; }; + + // rvalue std::basic_string -> basic_string + template + struct PinForImpl> + { using type = std::basic_string; }; + + // rvalue QStringBuilder -> pin as the nested ConvertTo type + template + struct PinForImpl> + : PinForImpl::ConvertTo> {}; + + template + using PinFor = typename PinForImpl::type>::type; + + template struct is_owning_string_type : std::false_type {}; + template <> struct is_owning_string_type : std::true_type {}; + template struct is_owning_string_type> : std::true_type {}; + + // unpinned + template ::value> + struct Pinning + { + // this is the storage for non-pinned types - no storage + constexpr Pinning(const T&) noexcept {} + // Since we don't store something, the view() method needs to be + // given something it can return. + constexpr T view(T t) const noexcept { return t; } + }; + + // pinned + template + struct Pinning + { + T m_string; + // specialisation for owning string types (QString, std::u16string): + // stores the string: + constexpr Pinning(T &&s) noexcept : m_string{std::move(s)} {} + // ... and thus view() uses that instead of the argument passed in: + constexpr QStringView view(const T&) const noexcept { return m_string; } + }; + + // NeedlePinning and HaystackPinning are there to distinguish them as + // base classes of QStringTokenizer. We use inheritance to reap the + // empty base class optimization. + template + struct NeedlePinning : Pinning + { + using Pinning::Pinning; + template + constexpr auto needleView(Arg &&a) noexcept + -> decltype(this->view(std::forward(a))) + { return this->view(std::forward(a)); } + }; + + template + struct HaystackPinning : Pinning + { + using Pinning::Pinning; + template + constexpr auto haystackView(Arg &&a) noexcept + -> decltype(this->view(std::forward(a))) + { return this->view(std::forward(a)); } + }; + + // The Base of a QStringTokenizer is QStringTokenizerBase for the views + // corresponding to the Haystack and Needle template arguments + // + // ie. QStringTokenizer + // : QStringTokenizerBase (+ pinning) + template + using TokenizerBase = QStringTokenizerBase, ViewFor>; +} // namespace Tok +} // namespace QtPrivate + +template +class QStringTokenizer + : private QtPrivate::Tok::HaystackPinning, + private QtPrivate::Tok::NeedlePinning, + public QtPrivate::Tok::TokenizerBase +{ + using HPin = QtPrivate::Tok::HaystackPinning; + using NPin = QtPrivate::Tok::NeedlePinning; + using Base = QtPrivate::Tok::TokenizerBase; + template + struct if_haystack_not_pinned_impl : std::enable_if::value, bool> {}; + template + using if_haystack_not_pinned = typename if_haystack_not_pinned_impl::type; + template ()))> + using if_compatible_container = typename std::enable_if< + std::is_convertible< + typename Base::value_type, + typename std::iterator_traits::value_type + >::value, + bool + >::type; +public: + using value_type = typename Base::value_type; + using difference_type = typename Base::difference_type; + using size_type = typename Base::size_type; + using reference = typename Base::reference; + using const_reference = typename Base::const_reference; + using pointer = typename Base::pointer; + using const_pointer = typename Base::const_pointer; + using iterator = typename Base::iterator; + using const_iterator = typename Base::const_iterator; + using sentinel = typename Base::sentinel; + +#ifdef Q_QDOC + [[nodiscard]] iterator begin() const noexcept { return Base::begin(); } + [[nodiscard]] iterator cbegin() const noexcept { return begin(); } + [[nodiscard]] constexpr sentinel end() const noexcept { return {}; } + [[nodiscard]] constexpr sentinel cend() const noexcept { return {}; } +#endif + + constexpr explicit QStringTokenizer(Haystack haystack, Needle needle, + Qt::CaseSensitivity cs, + Qt::SplitBehavior sb = Qt::KeepEmptyParts) + noexcept(std::is_nothrow_copy_constructible::value) + // here, we present the haystack to Pinning<>, for optional storing. + // If it did store, haystack is moved-from and mustn't be touched + // any longer, which is why view() for these Pinning<>s ignores the + // argument. + : HPin{std::forward(haystack)}, + NPin{std::forward(needle)}, + // If Pinning<> didn't store, we pass the haystack (ditto needle) + // to view() again, so it can be copied from there. + Base{this->haystackView(haystack), + this->needleView(needle), sb, cs} + {} + constexpr explicit QStringTokenizer(Haystack haystack, Needle needle, + Qt::SplitBehavior sb = Qt::KeepEmptyParts, + Qt::CaseSensitivity cs = Qt::CaseSensitive) + noexcept(std::is_nothrow_copy_constructible::value) + : HPin{std::forward(haystack)}, + NPin{std::forward(needle)}, + Base{this->haystackView(haystack), + this->needleView(needle), sb, cs} + {} + +#ifdef Q_QDOC + template LContainer toContainer(LContainer &&c = {}) const & {} + template RContainer toContainer(RContainer &&c = {}) const && {} +#else + template, if_compatible_container = true> + Container toContainer(Container &&c = {}) const & + { + for (auto e : *this) + c.emplace_back(e); + return std::forward(c); + } + template, if_compatible_container = true, + if_haystack_not_pinned = true> + Container toContainer(Container &&c = {}) const && + { + for (auto e : *this) + c.emplace_back(e); + return std::forward(c); + } +#endif +}; + +namespace QtPrivate { +namespace Tok { +// This meta function just calculated the template arguments for the +// QStringTokenizer (not -Base), based on the actual arguments passed +// to qTokenize() (or the ctor, with CTAD). It basically detects rvalue +// QString and std::basic_string and otherwise decays the arguments to +// the respective view type. +// +// #define works around a C++ restriction: [temp.deduct.guide]/3 seems +// to ask for the simple-template-id following the `->` of a deduction +// guide to be identical to the class name for which we guide deduction. +// In particular, Clang rejects a template alias there, while GCC accepts +// it. +#define Q_TOK_RESULT \ + QStringTokenizer< \ + QtPrivate::Tok::PinFor, \ + QtPrivate::Tok::PinFor \ + > \ + /*end*/ +template +using TokenizerResult = Q_TOK_RESULT; +template +using is_nothrow_constructible_from = std::is_nothrow_copy_constructible>; +} +} + +#ifdef __cpp_deduction_guides +// these tell the compiler how to determine the QStringTokenizer +// template arguments based on the constructor arguments (CTAD): +template +QStringTokenizer(Haystack&&, Needle&&) + -> Q_TOK_RESULT; +template +QStringTokenizer(Haystack&&, Needle&&, Qt::SplitBehavior) + -> Q_TOK_RESULT; +template +QStringTokenizer(Haystack&&, Needle&&, Qt::SplitBehavior, Qt::CaseSensitivity) + -> Q_TOK_RESULT; +template +QStringTokenizer(Haystack&&, Needle&&, Qt::CaseSensitivity) + -> Q_TOK_RESULT; +template +QStringTokenizer(Haystack&&, Needle&&, Qt::CaseSensitivity, Qt::SplitBehavior) + -> Q_TOK_RESULT; +#endif + +#undef Q_TOK_RESULT + +template +[[nodiscard]] constexpr auto +qTokenize(Haystack &&h, Needle &&n, Flags...flags) + noexcept(QtPrivate::Tok::is_nothrow_constructible_from::value) + -> decltype(QtPrivate::Tok::TokenizerResult{std::forward(h), + std::forward(n), flags...}) +{ return QtPrivate::Tok::TokenizerResult{std::forward(h), + std::forward(n), + flags...}; } + +template +auto QStringTokenizerBase::next(tokenizer_state state) const noexcept -> next_result +{ + while (true) { + if (state.end < 0) { + // already at end: + return {{}, false, state}; + } + state.end = m_haystack.indexOf(m_needle, state.start + state.extra, m_cs); + Haystack result; + if (state.end >= 0) { + // token separator found => return intermediate element: + result = m_haystack.sliced(state.start, state.end - state.start); + const auto ns = QtPrivate::Tok::size(m_needle); + state.start = state.end + ns; + state.extra = (ns == 0 ? 1 : 0); + } else { + // token separator not found => return final element: + result = m_haystack.sliced(state.start); + } + if ((m_sb & Qt::SkipEmptyParts) && result.isEmpty()) + continue; + return {result, true, state}; + } +} + +QT_END_NAMESPACE + +#endif /* QSTRINGTOKENIZER_H */ diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qstringview.h b/qt/6.8.1/msvc2022_64/include/QtCore/qstringview.h new file mode 100644 index 0000000000000000000000000000000000000000..cf7587c0496b6bd483a5fc66f7dccdeb9f2728e6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qstringview.h @@ -0,0 +1,516 @@ +// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz +// Copyright (C) 2019 Mail.ru Group. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +#ifndef QSTRINGVIEW_H +#define QSTRINGVIEW_H + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) +Q_FORWARD_DECLARE_CF_TYPE(CFString); +Q_FORWARD_DECLARE_OBJC_CLASS(NSString); +#endif + +QT_BEGIN_NAMESPACE + +class QString; +class QStringView; +class QRegularExpression; +class QRegularExpressionMatch; +#ifdef Q_QDOC +class QUtf8StringView; +#endif + +namespace QtPrivate { +template +struct IsCompatibleCharTypeHelper + : std::integral_constant::value || + std::is_same::value || + std::is_same::value || + (std::is_same::value && sizeof(wchar_t) == sizeof(QChar))> {}; +template +struct IsCompatibleCharType + : IsCompatibleCharTypeHelper> {}; + +template +struct IsCompatiblePointerHelper : std::false_type {}; +template +struct IsCompatiblePointerHelper + : IsCompatibleCharType {}; +template +struct IsCompatiblePointer + : IsCompatiblePointerHelper> {}; + +template +struct IsContainerCompatibleWithQStringView : std::false_type {}; + +template +struct IsContainerCompatibleWithQStringView()) )>, + // ... and that has a suitable size ... + std::is_convertible()) ), qsizetype>, + // ... and it's a range as it defines an iterator-like API + IsCompatibleCharType()) )>::value_type>, + std::is_convertible< + decltype( std::begin(std::declval()) != std::end(std::declval()) ), + bool>, + + // These need to be treated specially due to the empty vs null distinction + std::negation, QString>>, + + // Don't make an accidental copy constructor + std::negation, QStringView>> + >>> : std::true_type {}; + +} // namespace QtPrivate + +class QStringView +{ +public: + typedef char16_t storage_type; + typedef const QChar value_type; + typedef std::ptrdiff_t difference_type; + typedef qsizetype size_type; + typedef value_type &reference; + typedef value_type &const_reference; + typedef value_type *pointer; + typedef value_type *const_pointer; + + typedef pointer iterator; + typedef const_pointer const_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + +private: + template + using if_compatible_char = typename std::enable_if::value, bool>::type; + + template + using if_compatible_pointer = typename std::enable_if::value, bool>::type; + + template + using if_compatible_qstring_like = typename std::enable_if::value, bool>::type; + + template + using if_compatible_container = typename std::enable_if::value, bool>::type; + + template + static constexpr qsizetype lengthHelperPointer(const Char *str) noexcept + { + if (q20::is_constant_evaluated()) + return QtPrivate::lengthHelperPointer(str); + return QtPrivate::qustrlen(reinterpret_cast(str)); + } + static qsizetype lengthHelperPointer(const QChar *str) noexcept + { + return QtPrivate::qustrlen(reinterpret_cast(str)); + } + + template + static const storage_type *castHelper(const Char *str) noexcept + { return reinterpret_cast(str); } + static constexpr const storage_type *castHelper(const storage_type *str) noexcept + { return str; } + +public: + constexpr QStringView() noexcept {} + constexpr QStringView(std::nullptr_t) noexcept + : QStringView() {} + + template = true> + constexpr QStringView(const Char *str, qsizetype len) +#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0) || defined(QT_BOOTSTRAPPED) + : m_data(castHelper(str)), + m_size((Q_ASSERT(len >= 0), Q_ASSERT(str || !len), len)) +#else + : m_size((Q_ASSERT(len >= 0), Q_ASSERT(str || !len), len)), + m_data(castHelper(str)) +#endif + {} + + template = true> + constexpr QStringView(const Char *f, const Char *l) + : QStringView(f, l - f) {} + +#ifdef Q_QDOC + template + constexpr QStringView(const Char (&array)[N]) noexcept; + + template + constexpr QStringView(const Char *str) noexcept; +#else + + template = true> + constexpr QStringView(const Pointer &str) noexcept + : QStringView(str, str ? lengthHelperPointer(str) : 0) {} +#endif + +#ifdef Q_QDOC + QStringView(const QString &str) noexcept; +#else + template = true> + QStringView(const String &str) noexcept + : QStringView{str.begin(), str.size()} {} +#endif + + template = true> + constexpr Q_ALWAYS_INLINE QStringView(const Container &c) noexcept + : QStringView(std::data(c), QtPrivate::lengthHelperContainer(c)) {} + + template = true> + [[nodiscard]] constexpr static QStringView fromArray(const Char (&string)[Size]) noexcept + { return QStringView(string, Size); } + + [[nodiscard]] inline QString toString() const; // defined in qstring.h +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) + // defined in qcore_foundation.mm + [[nodiscard]] Q_CORE_EXPORT CFStringRef toCFString() const Q_DECL_CF_RETURNS_RETAINED; + [[nodiscard]] Q_CORE_EXPORT NSString *toNSString() const Q_DECL_NS_RETURNS_AUTORELEASED; +#endif + + [[nodiscard]] constexpr qsizetype size() const noexcept { return m_size; } + [[nodiscard]] const_pointer data() const noexcept { return reinterpret_cast(m_data); } + [[nodiscard]] const_pointer constData() const noexcept { return data(); } + [[nodiscard]] constexpr const storage_type *utf16() const noexcept { return m_data; } + + [[nodiscard]] constexpr QChar operator[](qsizetype n) const + { verify(n, 1); return QChar(m_data[n]); } + + // + // QString API + // + + template + [[nodiscard]] inline QString arg(Args &&...args) const; // defined in qstring.h + + [[nodiscard]] QByteArray toLatin1() const { return QtPrivate::convertToLatin1(*this); } + [[nodiscard]] QByteArray toUtf8() const { return QtPrivate::convertToUtf8(*this); } + [[nodiscard]] QByteArray toLocal8Bit() const { return QtPrivate::convertToLocal8Bit(*this); } + [[nodiscard]] inline QList toUcs4() const; // defined in qlist.h ### Qt 7 char32_t + + [[nodiscard]] constexpr QChar at(qsizetype n) const noexcept { return (*this)[n]; } + + [[nodiscard]] constexpr QStringView mid(qsizetype pos, qsizetype n = -1) const noexcept + { + using namespace QtPrivate; + auto result = QContainerImplHelper::mid(size(), &pos, &n); + return result == QContainerImplHelper::Null ? QStringView() : QStringView(m_data + pos, n); + } + [[nodiscard]] constexpr QStringView left(qsizetype n) const noexcept + { + if (size_t(n) >= size_t(size())) + n = size(); + return QStringView(m_data, n); + } + [[nodiscard]] constexpr QStringView right(qsizetype n) const noexcept + { + if (size_t(n) >= size_t(size())) + n = size(); + return QStringView(m_data + m_size - n, n); + } + + [[nodiscard]] constexpr QStringView first(qsizetype n) const noexcept + { verify(0, n); return sliced(0, n); } + [[nodiscard]] constexpr QStringView last(qsizetype n) const noexcept + { verify(0, n); return sliced(size() - n, n); } + [[nodiscard]] constexpr QStringView sliced(qsizetype pos) const noexcept + { verify(pos, 0); return QStringView(m_data + pos, size() - pos); } + [[nodiscard]] constexpr QStringView sliced(qsizetype pos, qsizetype n) const noexcept + { verify(pos, n); return QStringView(m_data + pos, n); } + [[nodiscard]] constexpr QStringView chopped(qsizetype n) const noexcept + { verify(0, n); return sliced(0, m_size - n); } + + constexpr void truncate(qsizetype n) noexcept + { verify(0, n); ; m_size = n; } + constexpr void chop(qsizetype n) noexcept + { verify(0, n); m_size -= n; } + + [[nodiscard]] QStringView trimmed() const noexcept { return QtPrivate::trimmed(*this); } + + constexpr QStringView &slice(qsizetype pos) + { *this = sliced(pos); return *this; } + constexpr QStringView &slice(qsizetype pos, qsizetype n) + { *this = sliced(pos, n); return *this; } + + template + [[nodiscard]] constexpr inline auto tokenize(Needle &&needle, Flags...flags) const + noexcept(noexcept(qTokenize(std::declval(), std::forward(needle), flags...))) + -> decltype(qTokenize(*this, std::forward(needle), flags...)) + { return qTokenize(*this, std::forward(needle), flags...); } + + [[nodiscard]] int compare(QStringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::compareStrings(*this, other, cs); } + [[nodiscard]] inline int compare(QLatin1StringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + [[nodiscard]] inline int compare(QUtf8StringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + [[nodiscard]] constexpr int compare(QChar c) const noexcept + { return size() >= 1 ? compare_single_char_helper(*utf16() - c.unicode()) : -1; } + [[nodiscard]] int compare(QChar c, Qt::CaseSensitivity cs) const noexcept + { return QtPrivate::compareStrings(*this, QStringView(&c, 1), cs); } + + [[nodiscard]] inline int localeAwareCompare(QStringView other) const; + + [[nodiscard]] bool startsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::startsWith(*this, s, cs); } + [[nodiscard]] inline bool startsWith(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + [[nodiscard]] bool startsWith(QChar c) const noexcept + { return !empty() && front() == c; } + [[nodiscard]] bool startsWith(QChar c, Qt::CaseSensitivity cs) const noexcept + { return QtPrivate::startsWith(*this, QStringView(&c, 1), cs); } + + [[nodiscard]] bool endsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::endsWith(*this, s, cs); } + [[nodiscard]] inline bool endsWith(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + [[nodiscard]] bool endsWith(QChar c) const noexcept + { return !empty() && back() == c; } + [[nodiscard]] bool endsWith(QChar c, Qt::CaseSensitivity cs) const noexcept + { return QtPrivate::endsWith(*this, QStringView(&c, 1), cs); } + + [[nodiscard]] qsizetype indexOf(QChar c, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::findString(*this, from, c.unicode(), cs); } + [[nodiscard]] qsizetype indexOf(QStringView s, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::findString(*this, from, s, cs); } + [[nodiscard]] inline qsizetype indexOf(QLatin1StringView s, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + + [[nodiscard]] bool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return indexOf(QStringView(&c, 1), 0, cs) != qsizetype(-1); } + [[nodiscard]] bool contains(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return indexOf(s, 0, cs) != qsizetype(-1); } + [[nodiscard]] inline bool contains(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + + [[nodiscard]] qsizetype count(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::count(*this, c, cs); } + [[nodiscard]] qsizetype count(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::count(*this, s, cs); } + [[nodiscard]] inline qsizetype count(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + + [[nodiscard]] qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return lastIndexOf(c, -1, cs); } + [[nodiscard]] qsizetype lastIndexOf(QChar c, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::lastIndexOf(*this, from, c.unicode(), cs); } + [[nodiscard]] qsizetype lastIndexOf(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return lastIndexOf(s, size(), cs); } + [[nodiscard]] qsizetype lastIndexOf(QStringView s, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::lastIndexOf(*this, from, s, cs); } + [[nodiscard]] inline qsizetype lastIndexOf(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + [[nodiscard]] inline qsizetype lastIndexOf(QLatin1StringView s, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + +#if QT_CONFIG(regularexpression) + [[nodiscard]] qsizetype indexOf(const QRegularExpression &re, qsizetype from = 0, QRegularExpressionMatch *rmatch = nullptr) const + { + return QtPrivate::indexOf(*this, re, from, rmatch); + } +#ifdef Q_QDOC + [[nodiscard]] qsizetype lastIndexOf(const QRegularExpression &re, QRegularExpressionMatch *rmatch = nullptr) const; +#else + // prevent an ambiguity when called like this: lastIndexOf(re, 0) + template , bool> = false> + [[nodiscard]] qsizetype lastIndexOf(const QRegularExpression &re, T *rmatch = nullptr) const + { + return QtPrivate::lastIndexOf(*this, re, size(), rmatch); + } +#endif + [[nodiscard]] qsizetype lastIndexOf(const QRegularExpression &re, qsizetype from, QRegularExpressionMatch *rmatch = nullptr) const + { + return QtPrivate::lastIndexOf(*this, re, from, rmatch); + } + [[nodiscard]] bool contains(const QRegularExpression &re, QRegularExpressionMatch *rmatch = nullptr) const + { + return QtPrivate::contains(*this, re, rmatch); + } + [[nodiscard]] qsizetype count(const QRegularExpression &re) const + { + return QtPrivate::count(*this, re); + } +#endif + + [[nodiscard]] bool isRightToLeft() const noexcept + { return QtPrivate::isRightToLeft(*this); } + [[nodiscard]] bool isValidUtf16() const noexcept + { return QtPrivate::isValidUtf16(*this); } + + [[nodiscard]] bool isUpper() const noexcept + { return QtPrivate::isUpper(*this); } + [[nodiscard]] bool isLower() const noexcept + { return QtPrivate::isLower(*this); } + + [[nodiscard]] inline short toShort(bool *ok = nullptr, int base = 10) const; + [[nodiscard]] inline ushort toUShort(bool *ok = nullptr, int base = 10) const; + [[nodiscard]] inline int toInt(bool *ok = nullptr, int base = 10) const; + [[nodiscard]] inline uint toUInt(bool *ok = nullptr, int base = 10) const; + [[nodiscard]] inline long toLong(bool *ok = nullptr, int base = 10) const; + [[nodiscard]] inline ulong toULong(bool *ok = nullptr, int base = 10) const; + [[nodiscard]] inline qlonglong toLongLong(bool *ok = nullptr, int base = 10) const; + [[nodiscard]] inline qulonglong toULongLong(bool *ok = nullptr, int base = 10) const; + [[nodiscard]] Q_CORE_EXPORT float toFloat(bool *ok = nullptr) const; + [[nodiscard]] Q_CORE_EXPORT double toDouble(bool *ok = nullptr) const; + + [[nodiscard]] inline qsizetype toWCharArray(wchar_t *array) const; // defined in qstring.h + + + [[nodiscard]] Q_CORE_EXPORT + QList split(QStringView sep, + Qt::SplitBehavior behavior = Qt::KeepEmptyParts, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + [[nodiscard]] Q_CORE_EXPORT + QList split(QChar sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + +#if QT_CONFIG(regularexpression) + [[nodiscard]] Q_CORE_EXPORT + QList split(const QRegularExpression &sep, + Qt::SplitBehavior behavior = Qt::KeepEmptyParts) const; +#endif + + // QStringView <> QStringView + friend bool comparesEqual(const QStringView &lhs, const QStringView &rhs) noexcept + { return lhs.size() == rhs.size() && QtPrivate::equalStrings(lhs, rhs); } + friend Qt::strong_ordering + compareThreeWay(const QStringView &lhs, const QStringView &rhs) noexcept + { + const int res = QtPrivate::compareStrings(lhs, rhs); + return Qt::compareThreeWay(res, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QStringView) + + // QStringView <> QChar + friend bool comparesEqual(const QStringView &lhs, QChar rhs) noexcept + { return lhs.size() == 1 && lhs[0] == rhs; } + friend Qt::strong_ordering compareThreeWay(const QStringView &lhs, QChar rhs) noexcept + { return compareThreeWay(lhs, QStringView(&rhs, 1)); } + Q_DECLARE_STRONGLY_ORDERED(QStringView, QChar) + + // + // STL compatibility API: + // + [[nodiscard]] const_iterator begin() const noexcept { return data(); } + [[nodiscard]] const_iterator end() const noexcept { return data() + size(); } + [[nodiscard]] const_iterator cbegin() const noexcept { return begin(); } + [[nodiscard]] const_iterator cend() const noexcept { return end(); } + [[nodiscard]] const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } + [[nodiscard]] const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } + [[nodiscard]] const_reverse_iterator crbegin() const noexcept { return rbegin(); } + [[nodiscard]] const_reverse_iterator crend() const noexcept { return rend(); } + + [[nodiscard]] constexpr bool empty() const noexcept { return size() == 0; } + [[nodiscard]] constexpr QChar front() const { return Q_ASSERT(!empty()), QChar(m_data[0]); } + [[nodiscard]] constexpr QChar back() const { return Q_ASSERT(!empty()), QChar(m_data[m_size - 1]); } + + [[nodiscard]] Q_IMPLICIT operator std::u16string_view() const noexcept + { return std::u16string_view(m_data, size_t(m_size)); } + + [[nodiscard]] constexpr qsizetype max_size() const noexcept { return maxSize(); } + + // + // Qt compatibility API: + // + [[nodiscard]] const_iterator constBegin() const noexcept { return begin(); } + [[nodiscard]] const_iterator constEnd() const noexcept { return end(); } + [[nodiscard]] constexpr bool isNull() const noexcept { return !m_data; } + [[nodiscard]] constexpr bool isEmpty() const noexcept { return empty(); } + [[nodiscard]] constexpr qsizetype length() const noexcept + { return size(); } + [[nodiscard]] constexpr QChar first() const { return front(); } + [[nodiscard]] constexpr QChar last() const { return back(); } + + [[nodiscard]] static constexpr qsizetype maxSize() noexcept + { + // -1 to deal with the pointer one-past-the-end; + return QtPrivate::MaxAllocSize / sizeof(storage_type) - 1; + } +private: +#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0) || defined(QT_BOOTSTRAPPED) + const storage_type *m_data = nullptr; + qsizetype m_size = 0; +#else + qsizetype m_size = 0; + const storage_type *m_data = nullptr; +#endif + + Q_ALWAYS_INLINE constexpr void verify([[maybe_unused]] qsizetype pos = 0, + [[maybe_unused]] qsizetype n = 1) const + { + Q_ASSERT(pos >= 0); + Q_ASSERT(pos <= size()); + Q_ASSERT(n >= 0); + Q_ASSERT(n <= size() - pos); + } + + constexpr int compare_single_char_helper(int diff) const noexcept + { return diff ? diff : size() > 1 ? 1 : 0; } + + Q_CORE_EXPORT static bool equal_helper(QStringView sv, const char *data, qsizetype len); + Q_CORE_EXPORT static int compare_helper(QStringView sv, const char *data, qsizetype len); + +#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) + friend bool comparesEqual(const QStringView &lhs, const QByteArrayView &rhs) noexcept + { return equal_helper(lhs, rhs.data(), rhs.size()); } + friend Qt::strong_ordering + compareThreeWay(const QStringView &lhs, const QByteArrayView &rhs) noexcept + { + const int res = compare_helper(lhs, rhs.data(), rhs.size()); + return Qt::compareThreeWay(res, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QStringView, QByteArrayView, QT_ASCII_CAST_WARN) + Q_DECLARE_STRONGLY_ORDERED(QStringView, QByteArray, QT_ASCII_CAST_WARN) + Q_DECLARE_STRONGLY_ORDERED(QStringView, const char *, QT_ASCII_CAST_WARN) +#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) +}; +Q_DECLARE_TYPEINFO(QStringView, Q_PRIMITIVE_TYPE); + +template ::value, + bool>::type = true> +inline QStringView qToStringViewIgnoringNull(const QStringLike &s) noexcept +{ return QStringView(s.begin(), s.size()); } + +// QChar inline functions: + +[[nodiscard]] constexpr auto QChar::fromUcs4(char32_t c) noexcept +{ + struct R { + char16_t chars[2]; + [[nodiscard]] constexpr operator QStringView() const noexcept { return {begin(), end()}; } + [[nodiscard]] constexpr qsizetype size() const noexcept { return chars[1] ? 2 : 1; } + [[nodiscard]] constexpr const char16_t *begin() const noexcept { return chars; } + [[nodiscard]] constexpr const char16_t *end() const noexcept { return begin() + size(); } + }; + return requiresSurrogates(c) ? R{{QChar::highSurrogate(c), + QChar::lowSurrogate(c)}} : + R{{char16_t(c), u'\0'}} ; +} + +qsizetype QtPrivate::findString(QStringView str, qsizetype from, QChar ch, Qt::CaseSensitivity cs) noexcept +{ + if (from < -str.size()) // from < 0 && abs(from) > str.size(), avoiding overflow + return -1; + if (from < 0) + from = qMax(from + str.size(), qsizetype(0)); + if (from < str.size()) { + const char16_t *s = str.utf16(); + char16_t c = ch.unicode(); + const char16_t *n = s + from; + const char16_t *e = s + str.size(); + if (cs == Qt::CaseSensitive) + n = qustrchr(QStringView(n, e), c); + else + n = qustrcasechr(QStringView(n, e), c); + if (n != e) + return n - s; + } + return -1; +} + +QT_END_NAMESPACE + +#endif /* QSTRINGVIEW_H */ diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qswap.h b/qt/6.8.1/msvc2022_64/include/QtCore/qswap.h new file mode 100644 index 0000000000000000000000000000000000000000..8b25e69271e5a33ae0885b516b92233facf9789d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qswap.h @@ -0,0 +1,38 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTCORE_QSWAP_H +#define QTCORE_QSWAP_H + +#include + +#include +#include + +#if 0 +#pragma qt_class(QtSwap) +#pragma qt_sync_stop_processing +#endif + +QT_BEGIN_NAMESPACE + +template +constexpr void qSwap(T &value1, T &value2) + noexcept(std::is_nothrow_swappable_v) +{ + using std::swap; + swap(value1, value2); +} + +// pure compile-time micro-optimization for our own headers, so not documented: +template +constexpr inline void qt_ptr_swap(T* &lhs, T* &rhs) noexcept +{ + T *tmp = lhs; + lhs = rhs; + rhs = tmp; +} + +QT_END_NAMESPACE + +#endif // QTCORE_QSWAP_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qsysinfo.h b/qt/6.8.1/msvc2022_64/include/QtCore/qsysinfo.h new file mode 100644 index 0000000000000000000000000000000000000000..a94a526518cdf4473d350f16b6d266859220acce --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qsysinfo.h @@ -0,0 +1,58 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSYSINFO_H +#define QSYSINFO_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +/* + System information +*/ + +class QString; +class QByteArray; + +class Q_CORE_EXPORT QSysInfo +{ +public: + enum Sizes { + WordSize = (sizeof(void *)<<3) + }; + + enum Endian { + BigEndian, + LittleEndian +# ifdef Q_QDOC + , ByteOrder = BigEndian or LittleEndian +# elif Q_BYTE_ORDER == Q_BIG_ENDIAN + , ByteOrder = BigEndian +# elif Q_BYTE_ORDER == Q_LITTLE_ENDIAN + , ByteOrder = LittleEndian +# else +# error "Undefined byte order" +# endif + }; + + static QString buildCpuArchitecture(); + static QString currentCpuArchitecture(); + static QString buildAbi(); + + static QString kernelType(); + static QString kernelVersion(); + static QString productType(); + static QString productVersion(); + static QString prettyProductName(); + + static QString machineHostName(); + static QByteArray machineUniqueId(); + static QByteArray bootUniqueId(); +}; + +QT_END_NAMESPACE +#endif // QSYSINFO_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qsystemdetection.h b/qt/6.8.1/msvc2022_64/include/QtCore/qsystemdetection.h new file mode 100644 index 0000000000000000000000000000000000000000..d4605332dadfa7bd58de34c35bece27ff76a40c6 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qsystemdetection.h @@ -0,0 +1,250 @@ +// Copyright (C) 2019 The Qt Company Ltd. +// Copyright (C) 2019 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#if 0 +#pragma qt_class(QtSystemDetection) +#pragma qt_sync_skip_header_check +#pragma qt_sync_stop_processing +#endif + +#ifndef QSYSTEMDETECTION_H +#define QSYSTEMDETECTION_H + +/* + The operating system, must be one of: (Q_OS_x) + + DARWIN - Any Darwin system (macOS, iOS, watchOS, tvOS) + MACOS - macOS + IOS - iOS + WATCHOS - watchOS + TVOS - tvOS + VISIONOS - visionOS + WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008) + CYGWIN - Cygwin + SOLARIS - Sun Solaris + HPUX - HP-UX + LINUX - Linux [has variants] + FREEBSD - FreeBSD [has variants] + NETBSD - NetBSD + OPENBSD - OpenBSD + INTERIX - Interix + AIX - AIX + HURD - GNU Hurd + QNX - QNX [has variants] + QNX6 - QNX RTP 6.1 + LYNX - LynxOS + BSD4 - Any BSD 4.4 system + UNIX - Any UNIX BSD/SYSV system + ANDROID - Android platform + HAIKU - Haiku + WEBOS - LG WebOS + WASM - WebAssembly + + The following operating systems have variants: + LINUX - both Q_OS_LINUX and Q_OS_ANDROID are defined when building for Android + - only Q_OS_LINUX is defined if building for other Linux systems + MACOS - both Q_OS_BSD4 and Q_OS_IOS are defined when building for iOS + - both Q_OS_BSD4 and Q_OS_MACOS are defined when building for macOS + FREEBSD - Q_OS_FREEBSD is defined only when building for FreeBSD with a BSD userland + - Q_OS_FREEBSD_KERNEL is always defined on FreeBSD, even if the userland is from GNU +*/ + +#if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__)) +# include +# define Q_OS_APPLE +# if defined(TARGET_OS_MAC) && TARGET_OS_MAC +# define Q_OS_DARWIN +# define Q_OS_BSD4 +# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE +# define QT_PLATFORM_UIKIT +# if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH +# define Q_OS_WATCHOS +# elif defined(TARGET_OS_TV) && TARGET_OS_TV +# define Q_OS_TVOS +# elif defined(TARGET_OS_VISION) && TARGET_OS_VISION +# define Q_OS_VISIONOS +# else +# // TARGET_OS_IOS is only available in newer SDKs, +# // so assume any other iOS-based platform is iOS for now +# define Q_OS_IOS +# endif +# else +# // TARGET_OS_OSX is only available in newer SDKs, +# // so assume any non iOS-based platform is macOS for now +# define Q_OS_MACOS +# endif +# else +# error "Qt has not been ported to this Apple platform - see http://www.qt.io/developers" +# endif +#elif defined(__WEBOS__) +# define Q_OS_WEBOS +# define Q_OS_LINUX +#elif defined(__ANDROID__) || defined(ANDROID) +# define Q_OS_ANDROID +# define Q_OS_LINUX +#elif defined(__CYGWIN__) +# define Q_OS_CYGWIN +#elif !defined(SAG_COM) && (!defined(WINAPI_FAMILY) || WINAPI_FAMILY==WINAPI_FAMILY_DESKTOP_APP) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__)) +# define Q_OS_WIN32 +# define Q_OS_WIN64 +#elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)) +# define Q_OS_WIN32 +#elif defined(__sun) || defined(sun) +# define Q_OS_SOLARIS +#elif defined(hpux) || defined(__hpux) +# define Q_OS_HPUX +#elif defined(__EMSCRIPTEN__) +# define Q_OS_WASM +#elif defined(__linux__) || defined(__linux) +# define Q_OS_LINUX +#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) +# ifndef __FreeBSD_kernel__ +# define Q_OS_FREEBSD +# endif +# define Q_OS_FREEBSD_KERNEL +# define Q_OS_BSD4 +#elif defined(__NetBSD__) +# define Q_OS_NETBSD +# define Q_OS_BSD4 +#elif defined(__OpenBSD__) +# define Q_OS_OPENBSD +# define Q_OS_BSD4 +#elif defined(__INTERIX) +# define Q_OS_INTERIX +# define Q_OS_BSD4 +#elif defined(_AIX) +# define Q_OS_AIX +#elif defined(__Lynx__) +# define Q_OS_LYNX +#elif defined(__GNU__) +# define Q_OS_HURD +#elif defined(__QNXNTO__) +# define Q_OS_QNX +#elif defined(__INTEGRITY) +# define Q_OS_INTEGRITY +#elif defined(__rtems__) +# define Q_OS_RTEMS +#elif defined(__vxworks) +# define Q_OS_VXWORKS +#elif defined(__HAIKU__) +# define Q_OS_HAIKU +#elif defined(__MAKEDEPEND__) +#else +# error "Qt has not been ported to this OS - see http://www.qt-project.org/" +#endif + +#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) +# define Q_OS_WINDOWS +# define Q_OS_WIN +// On Windows, pointers to dllimport'ed variables are not constant expressions, +// so to keep to certain initializations (like QMetaObject) constexpr, we need +// to use functions instead. +# define QT_NO_DATA_RELOCATION +#endif + +#if defined(Q_OS_WIN) +# undef Q_OS_UNIX +#elif !defined(Q_OS_UNIX) +# define Q_OS_UNIX +#endif + +// Compatibility synonyms +#ifdef Q_OS_DARWIN +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wunknown-pragmas" +# define Q_OS_MAC // FIXME: Deprecate +# ifdef __LP64__ +# define Q_OS_DARWIN64 +# pragma clang deprecated(Q_OS_DARWIN64, "use Q_OS_DARWIN and QT_POINTER_SIZE/Q_PROCESSOR_* instead") +# define Q_OS_MAC64 +# pragma clang deprecated(Q_OS_MAC64, "use Q_OS_DARWIN and QT_POINTER_SIZE/Q_PROCESSOR_* instead") +# else +# define Q_OS_DARWIN32 +# pragma clang deprecated(Q_OS_DARWIN32, "use Q_OS_DARWIN and QT_POINTER_SIZE/Q_PROCESSOR_* instead") +# define Q_OS_MAC32 +# pragma clang deprecated(Q_OS_MAC32, "use Q_OS_DARWIN and QT_POINTER_SIZE/Q_PROCESSOR_* instead") +# endif +# ifdef Q_OS_MACOS +# define Q_OS_MACX +# pragma clang deprecated(Q_OS_MACX, "use Q_OS_MACOS instead") +# define Q_OS_OSX +# pragma clang deprecated(Q_OS_OSX, "use Q_OS_MACOS instead") +# endif +# pragma clang diagnostic pop +#endif + +#ifdef Q_OS_DARWIN +# include +# include + +# define QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios, tvos, watchos) \ + ((defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && macos != __MAC_NA && __MAC_OS_X_VERSION_MAX_ALLOWED >= macos) || \ + (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && ios != __IPHONE_NA && __IPHONE_OS_VERSION_MAX_ALLOWED >= ios) || \ + (defined(__TV_OS_VERSION_MAX_ALLOWED) && tvos != __TVOS_NA && __TV_OS_VERSION_MAX_ALLOWED >= tvos) || \ + (defined(__WATCH_OS_VERSION_MAX_ALLOWED) && watchos != __WATCHOS_NA && __WATCH_OS_VERSION_MAX_ALLOWED >= watchos)) + +# define QT_DARWIN_DEPLOYMENT_TARGET_BELOW(macos, ios, tvos, watchos) \ + ((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && macos != __MAC_NA && __MAC_OS_X_VERSION_MIN_REQUIRED < macos) || \ + (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && ios != __IPHONE_NA && __IPHONE_OS_VERSION_MIN_REQUIRED < ios) || \ + (defined(__TV_OS_VERSION_MIN_REQUIRED) && tvos != __TVOS_NA && __TV_OS_VERSION_MIN_REQUIRED < tvos) || \ + (defined(__WATCH_OS_VERSION_MIN_REQUIRED) && watchos != __WATCHOS_NA && __WATCH_OS_VERSION_MIN_REQUIRED < watchos)) + +# define QT_MACOS_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios) \ + QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios, __TVOS_NA, __WATCHOS_NA) +# define QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(macos) \ + QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, __IPHONE_NA, __TVOS_NA, __WATCHOS_NA) +# define QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(ios) \ + QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, ios, __TVOS_NA, __WATCHOS_NA) +# define QT_TVOS_PLATFORM_SDK_EQUAL_OR_ABOVE(tvos) \ + QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, __IPHONE_NA, tvos, __WATCHOS_NA) +# define QT_WATCHOS_PLATFORM_SDK_EQUAL_OR_ABOVE(watchos) \ + QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, __IPHONE_NA, __TVOS_NA, watchos) + +# define QT_MACOS_IOS_DEPLOYMENT_TARGET_BELOW(macos, ios) \ + QT_DARWIN_DEPLOYMENT_TARGET_BELOW(macos, ios, __TVOS_NA, __WATCHOS_NA) +# define QT_MACOS_DEPLOYMENT_TARGET_BELOW(macos) \ + QT_DARWIN_DEPLOYMENT_TARGET_BELOW(macos, __IPHONE_NA, __TVOS_NA, __WATCHOS_NA) +# define QT_IOS_DEPLOYMENT_TARGET_BELOW(ios) \ + QT_DARWIN_DEPLOYMENT_TARGET_BELOW(__MAC_NA, ios, __TVOS_NA, __WATCHOS_NA) +# define QT_TVOS_DEPLOYMENT_TARGET_BELOW(tvos) \ + QT_DARWIN_DEPLOYMENT_TARGET_BELOW(__MAC_NA, __IPHONE_NA, tvos, __WATCHOS_NA) +# define QT_WATCHOS_DEPLOYMENT_TARGET_BELOW(watchos) \ + QT_DARWIN_DEPLOYMENT_TARGET_BELOW(__MAC_NA, __IPHONE_NA, __TVOS_NA, watchos) + +#else // !Q_OS_DARWIN + +#define QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios, tvos, watchos) (0) +#define QT_MACOS_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios) (0) +#define QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(macos) (0) +#define QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(ios) (0) +#define QT_TVOS_PLATFORM_SDK_EQUAL_OR_ABOVE(tvos) (0) +#define QT_WATCHOS_PLATFORM_SDK_EQUAL_OR_ABOVE(watchos) (0) + +#endif // Q_OS_DARWIN + +#ifdef __LSB_VERSION__ +# if __LSB_VERSION__ < 40 +# error "This version of the Linux Standard Base is unsupported" +# endif +#ifndef QT_LINUXBASE +# define QT_LINUXBASE +#endif +#endif + +#if defined (__ELF__) +# define Q_OF_ELF +#endif +#if defined (__MACH__) && defined (__APPLE__) +# define Q_OF_MACH_O +#endif + +#if defined(__SIZEOF_INT128__) +// Compiler used in VxWorks SDK declares __SIZEOF_INT128__ but VxWorks doesn't support this type, +// so we can't rely solely on compiler here. +#if !defined(Q_OS_VXWORKS) +# define QT_COMPILER_SUPPORTS_INT128 __SIZEOF_INT128__ +#endif +#endif // defined(__SIZEOF_INT128__) + +#endif // QSYSTEMDETECTION_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qsystemsemaphore.h b/qt/6.8.1/msvc2022_64/include/QtCore/qsystemsemaphore.h new file mode 100644 index 0000000000000000000000000000000000000000..61858d31316135314bdfcadc1e26a7e1d1853bde --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qsystemsemaphore.h @@ -0,0 +1,75 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QSYSTEMSEMAPHORE_H +#define QSYSTEMSEMAPHORE_H + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#if QT_CONFIG(systemsemaphore) + +class QSystemSemaphorePrivate; + +class Q_CORE_EXPORT QSystemSemaphore +{ + Q_GADGET + Q_DECLARE_TR_FUNCTIONS(QSystemSemaphore) +public: + enum AccessMode + { + Open, + Create + }; + Q_ENUM(AccessMode) + + enum SystemSemaphoreError + { + NoError, + PermissionDenied, + KeyError, + AlreadyExists, + NotFound, + OutOfResources, + UnknownError + }; + + QSystemSemaphore(const QNativeIpcKey &key, int initialValue = 0, AccessMode = Open); + ~QSystemSemaphore(); + + void setNativeKey(const QNativeIpcKey &key, int initialValue = 0, AccessMode = Open); + void setNativeKey(const QString &key, int initialValue = 0, AccessMode mode = Open, + QNativeIpcKey::Type type = QNativeIpcKey::legacyDefaultTypeForOs()) + { setNativeKey({ key, type }, initialValue, mode); } + QNativeIpcKey nativeIpcKey() const; + + QSystemSemaphore(const QString &key, int initialValue = 0, AccessMode mode = Open); + void setKey(const QString &key, int initialValue = 0, AccessMode mode = Open); + QString key() const; + + bool acquire(); + bool release(int n = 1); + + SystemSemaphoreError error() const; + QString errorString() const; + + static bool isKeyTypeSupported(QNativeIpcKey::Type type) Q_DECL_CONST_FUNCTION; + static QNativeIpcKey platformSafeKey(const QString &key, + QNativeIpcKey::Type type = QNativeIpcKey::DefaultTypeForOs); + static QNativeIpcKey legacyNativeKey(const QString &key, + QNativeIpcKey::Type type = QNativeIpcKey::legacyDefaultTypeForOs()); + +private: + Q_DISABLE_COPY(QSystemSemaphore) + QScopedPointer d; +}; + +#endif // QT_CONFIG(systemsemaphore) + +QT_END_NAMESPACE + +#endif // QSYSTEMSEMAPHORE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qt_windows.h b/qt/6.8.1/msvc2022_64/include/QtCore/qt_windows.h new file mode 100644 index 0000000000000000000000000000000000000000..ff019f4666c2bb2c9ebc2f7afc6c1d21d44a27a3 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qt_windows.h @@ -0,0 +1,103 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QT_WINDOWS_H +#define QT_WINDOWS_H + +#if 0 +#pragma qt_sync_skip_header_check +#pragma qt_sync_stop_processing +#endif + +#ifndef WINVER +# define WINVER 0x0A00 // _WIN32_WINNT_WIN10 +#endif +#ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0A00 +#endif +#ifndef _WIN32_IE +# define _WIN32_IE 0x0A00 +#endif +#ifndef NTDDI_VERSION +# define NTDDI_VERSION 0x0A00000C // NTDDI_WIN10_NI +#endif + +#ifndef NOMINMAX +# define NOMINMAX +#endif +#include + +// already defined when compiled with WINVER >= 0x0500 +#ifndef SPI_SETMENUANIMATION +#define SPI_SETMENUANIMATION 0x1003 +#endif +#ifndef SPI_SETMENUFADE +#define SPI_SETMENUFADE 0x1013 +#endif +#ifndef SPI_SETCOMBOBOXANIMATION +#define SPI_SETCOMBOBOXANIMATION 0x1005 +#endif +#ifndef SPI_SETTOOLTIPANIMATION +#define SPI_SETTOOLTIPANIMATION 0x1017 +#endif +#ifndef SPI_SETTOOLTIPFADE +#define SPI_SETTOOLTIPFADE 0x1019 +#endif +#ifndef SPI_SETUIEFFECTS +#define SPI_SETUIEFFECTS 0x103F +#endif +#ifndef SPI_GETMENUANIMATION +#define SPI_GETMENUANIMATION 0x1002 +#endif +#ifndef SPI_GETMENUFADE +#define SPI_GETMENUFADE 0x1012 +#endif +#ifndef SPI_GETCOMBOBOXANIMATION +#define SPI_GETCOMBOBOXANIMATION 0x1004 +#endif +#ifndef SPI_GETTOOLTIPANIMATION +#define SPI_GETTOOLTIPANIMATION 0x1016 +#endif +#ifndef SPI_GETTOOLTIPFADE +#define SPI_GETTOOLTIPFADE 0x1018 +#endif +#ifndef SPI_GETUIEFFECTS +#define SPI_GETUIEFFECTS 0x103E +#endif +#ifndef SPI_GETKEYBOARDCUES +#define SPI_GETKEYBOARDCUES 0x100A +#endif +#ifndef SPI_GETGRADIENTCAPTIONS +#define SPI_GETGRADIENTCAPTIONS 0x1008 +#endif +#ifndef IDC_HAND +#define IDC_HAND MAKEINTRESOURCE(32649) +#endif +#ifndef WM_MOUSEWHEEL +#define WM_MOUSEWHEEL 0x020A +#endif +#ifndef WM_MOUSEHWHEEL +#define WM_MOUSEHWHEEL 0x020E +#endif +#ifndef ETO_PDY +#define ETO_PDY 0x2000 +#endif +#ifndef COLOR_GRADIENTACTIVECAPTION +#define COLOR_GRADIENTACTIVECAPTION 27 +#endif +#ifndef COLOR_GRADIENTINACTIVECAPTION +#define COLOR_GRADIENTINACTIVECAPTION 28 +#endif + +// already defined when compiled with WINVER >= 0x0600 +#ifndef SPI_GETFLATMENU +#define SPI_GETFLATMENU 0x1022 +#endif +#ifndef CS_DROPSHADOW +#define CS_DROPSHADOW 0x00020000 +#endif +#ifndef CLEARTYPE_QUALITY +#define CLEARTYPE_QUALITY 5 +#endif + +#endif // QT_WINDOWS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtaggedpointer.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtaggedpointer.h new file mode 100644 index 0000000000000000000000000000000000000000..976f7f38af06ee1e0593adb373cec6d538c50580 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtaggedpointer.h @@ -0,0 +1,189 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTAGGEDPOINTER_H +#define QTAGGEDPOINTER_H + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtPrivate { + constexpr quint8 nextByteSize(quint8 bits) { return quint8((bits + 7) / 8); } + + template + struct TagInfo + { + static constexpr size_t alignment = alignof(T); + static_assert((alignment & (alignment - 1)) == 0, + "Alignment of template parameter must be power of two"); + + static constexpr quint8 tagBits = quint8{QtPrivate::qConstexprCountTrailingZeroBits(alignment)}; + static_assert(tagBits > 0, + "Alignment of template parameter does not allow any tags"); + + static constexpr size_t tagSize = QtPrivate::qConstexprNextPowerOfTwo(nextByteSize(tagBits)); + static_assert(tagSize < sizeof(quintptr), + "Alignment of template parameter allows tags masking away pointer"); + + using TagType = typename QIntegerForSize::Unsigned; + }; +} + +template ::TagType> +class QTaggedPointer +{ +public: + using Type = T; + using TagType = Tag; + + static constexpr quintptr tagMask() { return QtPrivate::TagInfo::alignment - 1; } + static constexpr quintptr pointerMask() { return ~tagMask(); } + + Q_NODISCARD_CTOR constexpr QTaggedPointer() noexcept : d(0) {} + Q_NODISCARD_CTOR constexpr QTaggedPointer(std::nullptr_t) noexcept : QTaggedPointer() {} + + Q_NODISCARD_CTOR explicit QTaggedPointer(T *pointer, Tag tag = Tag()) noexcept + : d(quintptr(pointer) | quintptr(tag)) + { + static_assert(sizeof(Type*) == sizeof(QTaggedPointer)); + + Q_ASSERT_X((quintptr(pointer) & tagMask()) == 0, "QTaggedPointer", "Pointer is not aligned"); + Q_ASSERT_X((static_cast::TagType>(tag) & pointerMask()) == 0, + "QTaggedPointer::setTag", "Tag is larger than allowed by number of available tag bits"); + } + + Type &operator*() const noexcept + { + Q_ASSERT(data()); + return *data(); + } + + Type *operator->() const noexcept + { + return data(); + } + + explicit operator bool() const noexcept + { + return !isNull(); + } + +#ifdef Q_QDOC + QTaggedPointer &operator=(T *other) noexcept; +#else + // Disables the usage of `ptr = {}`, which would go through this operator + // (rather than using the implicitly-generated assignment operator). + // The operators have different semantics: the ones here leave the tag intact, + // the implicitly-generated one overwrites it. + template , bool> = false> + QTaggedPointer &operator=(U *other) noexcept + { + T *otherT = other; + d = reinterpret_cast(otherT) | (d & tagMask()); + return *this; + } + + template , bool> = false> + QTaggedPointer &operator=(U) noexcept + { + d = reinterpret_cast(static_cast(nullptr)) | (d & tagMask()); + return *this; + } +#endif + + static constexpr Tag maximumTag() noexcept + { + return TagType(typename QtPrivate::TagInfo::TagType(tagMask())); + } + + void setTag(Tag tag) + { + Q_ASSERT_X( + (static_cast(tag) & pointerMask()) == 0, + "QTaggedPointer::setTag", + "Tag is larger than allowed by number of available tag bits"); + + d = (d & pointerMask()) | static_cast(tag); + } + + Tag tag() const noexcept + { + return TagType(typename QtPrivate::TagInfo::TagType(d & tagMask())); + } + + T* data() const noexcept + { + return reinterpret_cast(d & pointerMask()); + } + + bool isNull() const noexcept + { + return !data(); + } + + void swap(QTaggedPointer &other) noexcept + { + std::swap(d, other.d); + } + + friend inline bool operator==(QTaggedPointer lhs, QTaggedPointer rhs) noexcept + { + return lhs.data() == rhs.data(); + } + + friend inline bool operator!=(QTaggedPointer lhs, QTaggedPointer rhs) noexcept + { + return lhs.data() != rhs.data(); + } + + friend inline bool operator==(QTaggedPointer lhs, std::nullptr_t) noexcept + { + return lhs.isNull(); + } + + friend inline bool operator==(std::nullptr_t, QTaggedPointer rhs) noexcept + { + return rhs.isNull(); + } + + friend inline bool operator!=(QTaggedPointer lhs, std::nullptr_t) noexcept + { + return !lhs.isNull(); + } + + friend inline bool operator!=(std::nullptr_t, QTaggedPointer rhs) noexcept + { + return !rhs.isNull(); + } + + friend inline bool operator!(QTaggedPointer ptr) noexcept + { + return !ptr.data(); + } + + friend inline void swap(QTaggedPointer &p1, QTaggedPointer &p2) noexcept + { + p1.swap(p2); + } + +protected: + quintptr d; +}; + +template +constexpr inline std::size_t qHash(QTaggedPointer p, std::size_t seed = 0) noexcept +{ return qHash(p.data(), seed); } + +template +class QTypeInfo> + : public QTypeInfoMerger, quintptr> {}; + +QT_END_NAMESPACE + +#endif // QTAGGEDPOINTER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtclasshelpermacros.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtclasshelpermacros.h new file mode 100644 index 0000000000000000000000000000000000000000..2c371fe8481617b6a0f5ededc2e0215a8e4ad036 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtclasshelpermacros.h @@ -0,0 +1,201 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTCLASSHELPERMACROS_H +#define QTCLASSHELPERMACROS_H + +#include + +#if 0 +#pragma qt_class(QtClassHelperMacros) +#pragma qt_sync_stop_processing +#endif + +QT_BEGIN_NAMESPACE + +#if defined(__cplusplus) + +/* + Some classes do not permit copies to be made of an object. These + classes contains a private copy constructor and assignment + operator to disable copying (the compiler gives an error message). +*/ +#define Q_DISABLE_COPY(Class) \ + Class(const Class &) = delete;\ + Class &operator=(const Class &) = delete; + +#define Q_DISABLE_COPY_MOVE(Class) \ + Q_DISABLE_COPY(Class) \ + Class(Class &&) = delete; \ + Class &operator=(Class &&) = delete; + +/* + Implementing a move assignment operator using an established + technique (move-and-swap, pure swap) is just boilerplate. + Here's a couple of *private* macros for convenience. + + To know which one to use: + + * if you don't have a move constructor (*) => use pure swap; + * if you have a move constructor, then + * if your class holds just memory (no file handles, no user-defined + datatypes, etc.) => use pure swap; + * use move and swap. + + The preference should always go for the move-and-swap one, as it + will deterministically destroy the data previously held in *this, + and not "dump" it in the moved-from object (which may then be alive + for longer). + + The requirement for either macro is the presence of a member swap(), + which any value class that defines its own special member functions + should have anyhow. + + (*) Many value classes in Qt do not have move constructors; mostly, + the implicitly shared classes using QSharedDataPointer and friends. + The reason is mostly historical: those classes require either an + out-of-line move constructor, which we could not provide before we + made C++11 mandatory (and that we don't like anyhow), or + an out-of-line dtor for the Q(E)DSP member (cf. QPixmap). + + If you can however add a move constructor to a class lacking it, + consider doing so, then reevaluate which macro to choose. +*/ +#define QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(Class) \ + Class &operator=(Class &&other) noexcept { \ + Class moved(std::move(other)); \ + swap(moved); \ + return *this; \ + } + +#define QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(Class) \ + Class &operator=(Class &&other) noexcept { \ + swap(other); \ + return *this; \ + } + +/* + These macros can be used to define tag structs in the preferred way (ie. + with explicit default ctor). + + The _STRUCT version only defines the tag type, no variable, while the + normal macro defines also a variable (and appends _t to the type name to + distinguish the two). + + E.g. if we were std, we could use + + QT_DEFINE_TAG(nullopt); // nullopt of type nullopt_t + + The variable will be constexpr by default. If you want to make it static, + or inline, or both, prepend those keywords: + + static QT_DEFINE_TAG(MyTag); // static constexpr + static inline QT_DEFINE_TAG(MyTag); // static inline constexpr +*/ +#define QT_DEFINE_TAG_STRUCT(TAG) \ + struct TAG { explicit TAG () = default; } +#define QT_DEFINE_TAG(TAG) \ + constexpr QT_DEFINE_TAG_STRUCT(TAG ## _t) TAG{} + + +template inline T *qGetPtrHelper(T *ptr) noexcept { return ptr; } +template inline auto qGetPtrHelper(Ptr &ptr) noexcept -> decltype(ptr.get()) +{ static_assert(noexcept(ptr.get()), "Smart d pointers for Q_DECLARE_PRIVATE must have noexcept get()"); return ptr.get(); } + +class QObject; +class QObjectPrivate; +namespace QtPrivate { + template void assertObjectType(QObjectPrivate *d); + inline const QObject *getQObject(const QObjectPrivate *d); +} + +#define Q_DECLARE_PRIVATE(Class) \ + inline Class##Private* d_func() noexcept \ + { Q_CAST_IGNORE_ALIGN(return reinterpret_cast(qGetPtrHelper(d_ptr));) } \ + inline const Class##Private* d_func() const noexcept \ + { Q_CAST_IGNORE_ALIGN(return reinterpret_cast(qGetPtrHelper(d_ptr));) } \ + friend class Class##Private; + +#define Q_DECLARE_PRIVATE_D(Dptr, Class) \ + inline Class##Private* d_func() noexcept \ + { Q_CAST_IGNORE_ALIGN(return reinterpret_cast(qGetPtrHelper(Dptr));) } \ + inline const Class##Private* d_func() const noexcept \ + { Q_CAST_IGNORE_ALIGN(return reinterpret_cast(qGetPtrHelper(Dptr));) } \ + friend class Class##Private; + +#define Q_DECLARE_PUBLIC(Class) \ + inline Class* q_func() noexcept { return static_cast(q_ptr); } \ + inline const Class* q_func() const noexcept { return static_cast(q_ptr); } \ + friend class Class; \ + friend const QObject *QtPrivate::getQObject(const QObjectPrivate *d); \ + template friend void QtPrivate::assertObjectType(QObjectPrivate *d); + +#define Q_D(Class) Class##Private * const d = d_func() +#define Q_Q(Class) Class * const q = q_func() + +/* + Specialize a shared type with: + + Q_DECLARE_SHARED(type) + + where 'type' is the name of the type to specialize. NOTE: shared + types must define a member-swap, and be defined in the same + namespace as Qt for this to work. + + For types defined in a namespace within QT_NAMESPACE, use + Q_DECLARE_SHARED_NS/_EXT instead. The _NS macro needs to be placed + inside the nested namespace: + + namespace ns { + // ~~~ type defined here ~~~ + Q_DECLARE_SHARED_NS(ns, type) + } + + while the _NS_EXT macro goes into the QT_NAMESPACE, outside any + nested namespaces: + + namespace ns { + // ~~~ type defined here ~~~ + } + Q_DECLARE_SHARED_NS_EXT(ns, type) + + The latter then also works for more deeply-nested namespaces: + + Q_DECLARE_SHARED_NS_EXT(ns1::ns2, type) + + Q_DECLARE_SHARED_NS does, too, if all namespaces were opened in one statement: + + namespace ns1::ns2 { + Q_DECLARE_SHARED_NS(ns1::ns2, type); + } +*/ + +#define Q_DECLARE_SHARED(TYPE) \ +QT_DECLARE_ADL_SWAP(TYPE) \ +Q_DECLARE_TYPEINFO(TYPE, Q_RELOCATABLE_TYPE); \ +/* end */ + +#define Q_DECLARE_SHARED_NS(NS, TYPE) \ +QT_DECLARE_ADL_SWAP(TYPE) \ +} /* namespace NS */ \ +Q_DECLARE_TYPEINFO(NS :: TYPE, Q_RELOCATABLE_TYPE); \ +namespace NS { \ +/* end */ + +#define Q_DECLARE_SHARED_NS_EXT(NS, TYPE) \ +namespace NS { \ +QT_DECLARE_ADL_SWAP(TYPE) \ +} /* namespace NS */ \ +Q_DECLARE_TYPEINFO(NS :: TYPE, Q_RELOCATABLE_TYPE); \ +/* end */ + +#define QT_DECLARE_ADL_SWAP(TYPE) \ +inline void swap(TYPE &value1, TYPE &value2) \ + noexcept(noexcept(value1.swap(value2))) \ +{ value1.swap(value2); } + +#endif // __cplusplus + +QT_END_NAMESPACE + +#endif // QTCLASSHELPERMACROS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtconfiginclude.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtconfiginclude.h new file mode 100644 index 0000000000000000000000000000000000000000..3cc488ac4f4feb10b48a266b93346593de174876 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtconfiginclude.h @@ -0,0 +1,22 @@ +// Copyright (C) 2022 Intel Corporation +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTCONFIGINCLUDE_H +#define QTCONFIGINCLUDE_H + +#if 0 +# pragma qt_sync_stop_processing +#endif + +#include + +#ifdef QT_BOOTSTRAPPED +// qconfig-bootstrapped.h is not supposed to be a part of the synced header files. So we find it by +// the include path specified for Bootstrap library in the source tree instead of the build tree as +// it's done for regular header files. +#include "qconfig-bootstrapped.h" +#else +#include +#endif + +#endif // QTCONFIGINCLUDE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtconfigmacros.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtconfigmacros.h new file mode 100644 index 0000000000000000000000000000000000000000..421df4946ddb51ba685d28005616481e1360a241 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtconfigmacros.h @@ -0,0 +1,214 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTCONFIGMACROS_H +#define QTCONFIGMACROS_H + +#if 0 +# pragma qt_sync_stop_processing +#endif + +#include +#include +#include + +#include + +/* + The Qt modules' export macros. + The options are: + - defined(QT_STATIC): Qt was built or is being built in static mode + - defined(QT_SHARED): Qt was built or is being built in shared/dynamic mode + If neither was defined, then QT_SHARED is implied. If Qt was compiled in static + mode, QT_STATIC is defined in qconfig.h. In shared mode, QT_STATIC is implied + for the bootstrapped tools. +*/ + +#ifdef QT_BOOTSTRAPPED +# ifdef QT_SHARED +# error "QT_SHARED and QT_BOOTSTRAPPED together don't make sense. Please fix the build" +# elif !defined(QT_STATIC) +# define QT_STATIC +# endif +#endif + +#if defined(QT_SHARED) || !defined(QT_STATIC) +# ifdef QT_STATIC +# error "Both QT_SHARED and QT_STATIC defined, please make up your mind" +# endif +# ifndef QT_SHARED +# define QT_SHARED +# endif +#endif + +/* + No, this is not an evil backdoor. QT_BUILD_INTERNAL just exports more symbols + for Qt's internal unit tests. If you want slower loading times and more + symbols that can vanish from version to version, feel free to define QT_BUILD_INTERNAL. + + \note After adding Q_AUTOTEST_EXPORT to a method, you'll need to wrap any unittests + that will use that method in "#ifdef QT_BUILD_INTERNAL". +*/ +#if defined(QT_BUILD_INTERNAL) && defined(QT_BUILDING_QT) && defined(QT_SHARED) +# define Q_AUTOTEST_EXPORT Q_DECL_EXPORT +#elif defined(QT_BUILD_INTERNAL) && defined(QT_SHARED) +# define Q_AUTOTEST_EXPORT Q_DECL_IMPORT +#else +# define Q_AUTOTEST_EXPORT +#endif + +/* + The QT_CONFIG macro implements a safe compile time check for features of Qt. + Features can be in three states: + 0 or undefined: This will lead to a compile error when testing for it + -1: The feature is not available + 1: The feature is available +*/ +#define QT_CONFIG(feature) (1/QT_FEATURE_##feature == 1) +#define QT_REQUIRE_CONFIG(feature) static_assert(QT_FEATURE_##feature == 1, "Required feature " #feature " for file " __FILE__ " not available.") + +/* moc compats (signals/slots) */ +#ifndef QT_MOC_COMPAT +# define QT_MOC_COMPAT +#else +# undef QT_MOC_COMPAT +# define QT_MOC_COMPAT +#endif + +/* + Debugging and error handling +*/ + +#if !defined(QT_NO_DEBUG) && !defined(QT_DEBUG) +# define QT_DEBUG +#endif + +// valid for both C and C++ +#define QT_MANGLE_NAMESPACE0(x) x +#define QT_MANGLE_NAMESPACE1(a, b) a##_##b +#define QT_MANGLE_NAMESPACE2(a, b) QT_MANGLE_NAMESPACE1(a,b) +#if !defined(QT_NAMESPACE) || defined(Q_MOC_RUN) /* user namespace */ +# define QT_MANGLE_NAMESPACE(name) name +#else +# define QT_MANGLE_NAMESPACE(name) QT_MANGLE_NAMESPACE2( \ + QT_MANGLE_NAMESPACE0(name), QT_MANGLE_NAMESPACE0(QT_NAMESPACE)) +#endif + +#ifdef __cplusplus + +#if !defined(QT_NAMESPACE) || defined(Q_MOC_RUN) /* user namespace */ + +# define QT_PREPEND_NAMESPACE(name) ::name +# define QT_USE_NAMESPACE +# define QT_BEGIN_NAMESPACE +# define QT_END_NAMESPACE +# define QT_BEGIN_INCLUDE_NAMESPACE +# define QT_END_INCLUDE_NAMESPACE +# define QT_FORWARD_DECLARE_CLASS(name) class name; +# define QT_FORWARD_DECLARE_STRUCT(name) struct name; + +#elif defined(QT_INLINE_NAMESPACE) /* user inline namespace FIXME in Qt 7: Default */ + +# define QT_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name +# define QT_USE_NAMESPACE +# define QT_BEGIN_NAMESPACE inline namespace QT_NAMESPACE { +# define QT_END_NAMESPACE } +# define QT_BEGIN_INCLUDE_NAMESPACE } +# define QT_END_INCLUDE_NAMESPACE inline namespace QT_NAMESPACE { +# define QT_FORWARD_DECLARE_CLASS(name) \ +QT_BEGIN_NAMESPACE class name; QT_END_NAMESPACE + +# define QT_FORWARD_DECLARE_STRUCT(name) \ +QT_BEGIN_NAMESPACE struct name; QT_END_NAMESPACE + +inline namespace QT_NAMESPACE {} + +#else /* user namespace */ + +# define QT_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name +# define QT_USE_NAMESPACE using namespace ::QT_NAMESPACE; +# define QT_BEGIN_NAMESPACE namespace QT_NAMESPACE { +# define QT_END_NAMESPACE } +# define QT_BEGIN_INCLUDE_NAMESPACE } +# define QT_END_INCLUDE_NAMESPACE namespace QT_NAMESPACE { +# define QT_FORWARD_DECLARE_CLASS(name) \ + QT_BEGIN_NAMESPACE class name; QT_END_NAMESPACE \ + using QT_PREPEND_NAMESPACE(name); + +# define QT_FORWARD_DECLARE_STRUCT(name) \ + QT_BEGIN_NAMESPACE struct name; QT_END_NAMESPACE \ + using QT_PREPEND_NAMESPACE(name); + +namespace QT_NAMESPACE {} + +# ifndef QT_BOOTSTRAPPED +# ifndef QT_NO_USING_NAMESPACE + /* + This expands to a "using QT_NAMESPACE" also in _header files_. + It is the only way the feature can be used without too much + pain, but if people _really_ do not want it they can add + QT_NO_USING_NAMESPACE to their build configuration. + */ + QT_USE_NAMESPACE +# endif +# endif + +#endif /* user namespace */ + +#else /* __cplusplus */ + +# define QT_BEGIN_NAMESPACE +# define QT_END_NAMESPACE +# define QT_USE_NAMESPACE +# define QT_BEGIN_INCLUDE_NAMESPACE +# define QT_END_INCLUDE_NAMESPACE + +#endif /* __cplusplus */ + +/* ### Qt 6.9 (or later): remove *_MOC_* macros (moc does not need them since 6.5) */ +#ifndef QT_BEGIN_MOC_NAMESPACE +# define QT_BEGIN_MOC_NAMESPACE QT_USE_NAMESPACE +#endif +#ifndef QT_END_MOC_NAMESPACE +# define QT_END_MOC_NAMESPACE +#endif + +/* + Strict mode +*/ +#ifdef QT_ENABLE_STRICT_MODE_UP_TO +#ifndef QT_DISABLE_DEPRECATED_UP_TO +# define QT_DISABLE_DEPRECATED_UP_TO QT_ENABLE_STRICT_MODE_UP_TO +#endif + +#if QT_ENABLE_STRICT_MODE_UP_TO >= QT_VERSION_CHECK(6, 0, 0) +# define QT_NO_FOREACH +# define QT_NO_CAST_FROM_ASCII +# define QT_NO_CAST_TO_ASCII +# define QT_NO_CAST_FROM_BYTEARRAY +# define QT_NO_URL_CAST_FROM_STRING +# define QT_NO_NARROWING_CONVERSIONS_IN_CONNECT +# define QT_NO_JAVA_STYLE_ITERATORS +#endif // 6.0.0 + +#if QT_ENABLE_STRICT_MODE_UP_TO >= QT_VERSION_CHECK(6, 6, 0) +# define QT_NO_QEXCHANGE +#endif // 6.6.0 + +#if QT_ENABLE_STRICT_MODE_UP_TO >= QT_VERSION_CHECK(6, 7, 0) +# define QT_NO_CONTEXTLESS_CONNECT +#endif // 6.7.0 + +#if QT_ENABLE_STRICT_MODE_UP_TO >= QT_VERSION_CHECK(6, 8, 0) +# define QT_NO_QASCONST +# if !defined(QT_USE_NODISCARD_FILE_OPEN) && !defined(QT_NO_USE_NODISCARD_FILE_OPEN) +# define QT_USE_NODISCARD_FILE_OPEN +# endif +#endif // 6.8.0 + +#if QT_ENABLE_STRICT_MODE_UP_TO >= QT_VERSION_CHECK(6, 9, 0) +# define QT_NO_QSNPRINTF +#endif // 6.9.0 +#endif // QT_ENABLE_STRICT_MODE_UP_TO + +#endif /* QTCONFIGMACROS_H */ diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtcore-config.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtcore-config.h new file mode 100644 index 0000000000000000000000000000000000000000..a6116e5a73860a376529fb292ec43f3b47cb8bcb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtcore-config.h @@ -0,0 +1,87 @@ +#define QT_FEATURE_clock_monotonic -1 + +#define QT_FEATURE_cxx11_future 1 + +#define QT_FEATURE_cxx17_filesystem 1 + +#define QT_FEATURE_glib -1 + +#define QT_FEATURE_inotify -1 + +#define QT_FEATURE_std_atomic64 1 + +#define QT_FEATURE_mimetype 1 + +#define QT_FEATURE_regularexpression 1 + +#define QT_FEATURE_sharedmemory 1 + +#define QT_FEATURE_shortcut 1 + +#define QT_FEATURE_systemsemaphore 1 + +#define QT_FEATURE_xmlstream 1 + +#define QT_FEATURE_cpp_winrt 1 + +#define QT_FEATURE_xmlstreamreader 1 + +#define QT_FEATURE_xmlstreamwriter 1 + +#define QT_FEATURE_textdate 1 + +#define QT_FEATURE_datestring 1 + +#define QT_FEATURE_process 1 + +#define QT_FEATURE_processenvironment 1 + +#define QT_FEATURE_temporaryfile 1 + +#define QT_FEATURE_library 1 + +#define QT_FEATURE_settings 1 + +#define QT_FEATURE_filesystemwatcher 1 + +#define QT_FEATURE_filesystemiterator 1 + +#define QT_FEATURE_itemmodel 1 + +#define QT_FEATURE_proxymodel 1 + +#define QT_FEATURE_sortfilterproxymodel 1 + +#define QT_FEATURE_identityproxymodel 1 + +#define QT_FEATURE_transposeproxymodel 1 + +#define QT_FEATURE_concatenatetablesproxymodel 1 + +#define QT_FEATURE_stringlistmodel 1 + +#define QT_FEATURE_translation 1 + +#define QT_FEATURE_easingcurve 1 + +#define QT_FEATURE_animation 1 + +#define QT_FEATURE_gestures 1 + +#define QT_FEATURE_jalalicalendar 1 + +#define QT_FEATURE_islamiccivilcalendar 1 + +#define QT_FEATURE_timezone 1 + +#define QT_FEATURE_commandlineparser 1 + +#define QT_FEATURE_cborstreamreader 1 + +#define QT_FEATURE_cborstreamwriter 1 + +#define QT_FEATURE_permissions 1 + +#define QT_NO_CLOCK_MONOTONIC 1 +#define QT_NO_GLIB 1 +#define QT_NO_INOTIFY 1 diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtcoreexports.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtcoreexports.h new file mode 100644 index 0000000000000000000000000000000000000000..a0f4f34e90c896dd8076e48d6b934be686f4037c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtcoreexports.h @@ -0,0 +1,50 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTCOREEXPORTS_H +#define QTCOREEXPORTS_H + +#include +#include // Q_CORE_EXPORT +#include // QT_IF_DEPRECATED_SINCE + +#if defined(QT_SHARED) || !defined(QT_STATIC) +# if defined(QT_BUILD_CORE_LIB) +# define Q_CORE_EXPORT Q_DECL_EXPORT +# else +# define Q_CORE_EXPORT Q_DECL_IMPORT +# endif +#else +# define Q_CORE_EXPORT +#endif + +#if !defined(QT_BUILD_CORE_LIB) && !defined(QT_STATIC) +/* outside library -> inline decl + defi */ +/* static builds treat everything as part of the library, so they never inline */ +# define QT_CORE_INLINE_SINCE(major, minor) inline +# define QT_CORE_INLINE_IMPL_SINCE(major, minor) 1 +#elif defined(QT_CORE_BUILD_REMOVED_API) +/* inside library, inside removed_api.cpp: + * keep deprecated API -> non-inline decl; + * remove deprecated API -> inline decl; + * definition is always available */ +# define QT_CORE_INLINE_SINCE(major, minor) \ + QT_IF_DEPRECATED_SINCE(major, minor, inline, /* not inline */) +# define QT_CORE_INLINE_IMPL_SINCE(major, minor) 1 +#else +/* inside library, outside removed_api.cpp: + * keep deprecated API -> non-inline decl, no defi; + * remove deprecated API -> inline decl, defi */ +# define QT_CORE_INLINE_SINCE(major, minor) \ + QT_IF_DEPRECATED_SINCE(major, minor, inline, /* not inline */) +# define QT_CORE_INLINE_IMPL_SINCE(major, minor) \ + QT_IF_DEPRECATED_SINCE(major, minor, 1, 0) +#endif + +#ifdef QT_CORE_BUILD_REMOVED_API +# define QT_CORE_REMOVED_SINCE(major, minor) QT_DEPRECATED_SINCE(major, minor) +#else +# define QT_CORE_REMOVED_SINCE(major, minor) 0 +#endif + +#endif // QTCOREEXPORTS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtcoreversion.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtcoreversion.h new file mode 100644 index 0000000000000000000000000000000000000000..21539162fb9b55c66162592fe825d090eeb9579d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtcoreversion.h @@ -0,0 +1,9 @@ +/* This file was generated by syncqt. */ +#ifndef QT_QTCORE_VERSION_H +#define QT_QTCORE_VERSION_H + +#define QTCORE_VERSION_STR "6.8.1" + +#define QTCORE_VERSION 0x060801 + +#endif // QT_QTCORE_VERSION_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtdeprecationdefinitions.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtdeprecationdefinitions.h new file mode 100644 index 0000000000000000000000000000000000000000..05c7b087bc627948bf06b779c32056e307f582aa --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtdeprecationdefinitions.h @@ -0,0 +1,28 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTDEPRECATIONDEFINITIONS_H +#define QTDEPRECATIONDEFINITIONS_H + +#ifndef QT_DISABLE_DEPRECATED_UP_TO +# ifdef QT_DISABLE_DEPRECATED_BEFORE // If the deprecated macro is defined, use its value +# define QT_DISABLE_DEPRECATED_UP_TO QT_DISABLE_DEPRECATED_BEFORE +# else +# define QT_DISABLE_DEPRECATED_UP_TO 0x040800 +# endif +#endif + +#if QT_DISABLE_DEPRECATED_UP_TO < 0x040800 +# warning QT_DISABLE_DEPRECATED_UP_TO is set to the version that is lower than the version that \ + Qt was built with. This may lead to linking issues. +#endif + +#ifndef QT_WARN_DEPRECATED_UP_TO +# ifdef QT_DEPRECATED_WARNINGS_SINCE // If the deprecated macro is defined, use its value +# define QT_WARN_DEPRECATED_UP_TO QT_DEPRECATED_WARNINGS_SINCE +# else +# define QT_WARN_DEPRECATED_UP_TO 0x070000 +# endif +#endif + +#endif // QTDEPRECATIONDEFINITIONS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtdeprecationmarkers.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtdeprecationmarkers.h new file mode 100644 index 0000000000000000000000000000000000000000..99a83b6d71598f2771818dc6f1cc82ae1861ccad --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtdeprecationmarkers.h @@ -0,0 +1,326 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTDEPRECATIONMARKERS_H +#define QTDEPRECATIONMARKERS_H + +#include +#include +#include +#include +#include // for Q_DECL_DEPRECATED + +#if 0 +#pragma qt_class(QtDeprecationMarkers) +#pragma qt_sync_stop_processing +#endif + +QT_BEGIN_NAMESPACE + +#if defined(QT_NO_DEPRECATED) +# undef QT_DEPRECATED +# undef QT_DEPRECATED_X +# undef QT_DEPRECATED_VARIABLE +# undef QT_DEPRECATED_CONSTRUCTOR +#elif !defined(QT_NO_DEPRECATED_WARNINGS) +# undef QT_DEPRECATED +# define QT_DEPRECATED Q_DECL_DEPRECATED +# undef QT_DEPRECATED_X +# define QT_DEPRECATED_X(text) Q_DECL_DEPRECATED_X(text) +# undef QT_DEPRECATED_VARIABLE +# define QT_DEPRECATED_VARIABLE Q_DECL_VARIABLE_DEPRECATED +# undef QT_DEPRECATED_CONSTRUCTOR +# define QT_DEPRECATED_CONSTRUCTOR Q_DECL_CONSTRUCTOR_DEPRECATED explicit +#else +# undef QT_DEPRECATED +# define QT_DEPRECATED +# undef QT_DEPRECATED_X +# define QT_DEPRECATED_X(text) +# undef QT_DEPRECATED_VARIABLE +# define QT_DEPRECATED_VARIABLE +# undef QT_DEPRECATED_CONSTRUCTOR +# define QT_DEPRECATED_CONSTRUCTOR +# undef Q_DECL_ENUMERATOR_DEPRECATED +# define Q_DECL_ENUMERATOR_DEPRECATED +# undef Q_DECL_ENUMERATOR_DEPRECATED_X +# define Q_DECL_ENUMERATOR_DEPRECATED_X(ignored) +#endif + +/* + QT_DEPRECATED_SINCE(major, minor) evaluates as true if the Qt version is greater than + the deprecation point specified. + + Use it to specify from which version of Qt a function or class has been deprecated + + Example: + #if QT_DEPRECATED_SINCE(5,1) + QT_DEPRECATED void deprecatedFunction(); //function deprecated since Qt 5.1 + #endif + +*/ +#ifdef QT_DEPRECATED +#define QT_DEPRECATED_SINCE(major, minor) (QT_VERSION_CHECK(major, minor, 0) > QT_DISABLE_DEPRECATED_UP_TO) +#else +#define QT_DEPRECATED_SINCE(major, minor) 0 +#endif + +/* + QT_DEPRECATED_VERSION(major, minor) and QT_DEPRECATED_VERSION_X(major, minor, text) + outputs a deprecation warning if QT_WARN_DEPRECATED_UP_TO is equal to or greater + than the version specified as major, minor. This makes it possible to deprecate a + function without annoying a user who needs to stay compatible with a specified minimum + version and therefore can't use the new function. +*/ +#if QT_WARN_DEPRECATED_UP_TO >= QT_VERSION_CHECK(5, 12, 0) +# define QT_DEPRECATED_VERSION_X_5_12(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_5_12 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_5_12(text) +# define QT_DEPRECATED_VERSION_5_12 +#endif + +#if QT_WARN_DEPRECATED_UP_TO >= QT_VERSION_CHECK(5, 13, 0) +# define QT_DEPRECATED_VERSION_X_5_13(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_5_13 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_5_13(text) +# define QT_DEPRECATED_VERSION_5_13 +#endif + +#if QT_WARN_DEPRECATED_UP_TO >= QT_VERSION_CHECK(5, 14, 0) +# define QT_DEPRECATED_VERSION_X_5_14(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_5_14 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_5_14(text) +# define QT_DEPRECATED_VERSION_5_14 +#endif + +#if QT_WARN_DEPRECATED_UP_TO >= QT_VERSION_CHECK(5, 15, 0) +# define QT_DEPRECATED_VERSION_X_5_15(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_5_15 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_5_15(text) +# define QT_DEPRECATED_VERSION_5_15 +#endif + +#if QT_WARN_DEPRECATED_UP_TO >= QT_VERSION_CHECK(6, 0, 0) +# define QT_DEPRECATED_VERSION_X_6_0(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_6_0 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_6_0(text) +# define QT_DEPRECATED_VERSION_6_0 +#endif + +#if QT_WARN_DEPRECATED_UP_TO >= QT_VERSION_CHECK(6, 1, 0) +# define QT_DEPRECATED_VERSION_X_6_1(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_6_1 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_6_1(text) +# define QT_DEPRECATED_VERSION_6_1 +#endif + +#if QT_WARN_DEPRECATED_UP_TO >= QT_VERSION_CHECK(6, 2, 0) +# define QT_DEPRECATED_VERSION_X_6_2(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_6_2 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_6_2(text) +# define QT_DEPRECATED_VERSION_6_2 +#endif + +#if QT_WARN_DEPRECATED_UP_TO >= QT_VERSION_CHECK(6, 3, 0) +# define QT_DEPRECATED_VERSION_X_6_3(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_6_3 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_6_3(text) +# define QT_DEPRECATED_VERSION_6_3 +#endif + +#if QT_WARN_DEPRECATED_UP_TO >= QT_VERSION_CHECK(6, 4, 0) +# define QT_DEPRECATED_VERSION_X_6_4(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_6_4 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_6_4(text) +# define QT_DEPRECATED_VERSION_6_4 +#endif + +#if QT_WARN_DEPRECATED_UP_TO >= QT_VERSION_CHECK(6, 5, 0) +# define QT_DEPRECATED_VERSION_X_6_5(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_6_5 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_6_5(text) +# define QT_DEPRECATED_VERSION_6_5 +#endif + +#if QT_WARN_DEPRECATED_UP_TO >= QT_VERSION_CHECK(6, 6, 0) +# define QT_DEPRECATED_VERSION_X_6_6(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_6_6 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_6_6(text) +# define QT_DEPRECATED_VERSION_6_6 +#endif + +#if QT_WARN_DEPRECATED_UP_TO >= QT_VERSION_CHECK(6, 7, 0) +# define QT_DEPRECATED_VERSION_X_6_7(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_6_7 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_6_7(text) +# define QT_DEPRECATED_VERSION_6_7 +#endif + +#if QT_WARN_DEPRECATED_UP_TO >= QT_VERSION_CHECK(6, 8, 0) +# define QT_DEPRECATED_VERSION_X_6_8(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_6_8 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_6_8(text) +# define QT_DEPRECATED_VERSION_6_8 +#endif + +#if QT_WARN_DEPRECATED_UP_TO >= QT_VERSION_CHECK(6, 9, 0) +# define QT_DEPRECATED_VERSION_X_6_9(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_6_9 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_6_9(text) +# define QT_DEPRECATED_VERSION_6_9 +#endif + +#if QT_WARN_DEPRECATED_UP_TO >= QT_VERSION_CHECK(6, 10, 0) +# define QT_DEPRECATED_VERSION_X_6_10(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_6_10 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_6_10(text) +# define QT_DEPRECATED_VERSION_6_10 +#endif + +#if QT_WARN_DEPRECATED_UP_TO >= QT_VERSION_CHECK(6, 11, 0) +# define QT_DEPRECATED_VERSION_X_6_11(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_6_11 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_6_11(text) +# define QT_DEPRECATED_VERSION_6_11 +#endif + +#define QT_DEPRECATED_VERSION_X_5(minor, text) QT_DEPRECATED_VERSION_X_5_##minor(text) +#define QT_DEPRECATED_VERSION_X(major, minor, text) QT_DEPRECATED_VERSION_X_##major##_##minor(text) + +#define QT_DEPRECATED_VERSION_5(minor) QT_DEPRECATED_VERSION_5_##minor +#define QT_DEPRECATED_VERSION(major, minor) QT_DEPRECATED_VERSION_##major##_##minor + +/* + QT_IF_DEPRECATED_SINCE(major, minor, whenTrue, whenFalse) expands to + \a whenTrue if the specified (\a major, \a minor) version is less than or + equal to the deprecation version defined by QT_DISABLE_DEPRECATED_UP_TO, + and to \a whenFalse otherwise. + + Currently used for QT_INLINE_SINCE(maj, min), but can also be helpful for + other macros of that kind. + + The implementation uses QT_DEPRECATED_SINCE(maj, min) to define a bunch of + helper QT_IF_DEPRECATED_SINCE_X_Y macros, which expand to \a whenTrue or + \a whenFalse depending on the value of QT_DEPRECATED_SINCE. + + If you need to use QT_IF_DEPRECATED_SINCE() for a (major, minor) version, + that is not yet covered by the list below, you need to copy the definition + and change the major and minor versions accordingly. For example, for + version (X, Y), you will need to add + + \code + #if QT_DEPRECATED_SINCE(X, Y) + # define QT_IF_DEPRECATED_SINCE_X_Y(whenTrue, whenFalse) whenFalse + #else + # define QT_IF_DEPRECATED_SINCE_X_Y(whenTrue, whenFalse) whenTrue + #endif + \endcode +*/ + +#define QT_IF_DEPRECATED_SINCE(major, minor, whenTrue, whenFalse) \ + QT_IF_DEPRECATED_SINCE_ ## major ## _ ## minor(whenTrue, whenFalse) + +#if QT_DEPRECATED_SINCE(6, 0) +# define QT_IF_DEPRECATED_SINCE_6_0(whenTrue, whenFalse) whenFalse +#else +# define QT_IF_DEPRECATED_SINCE_6_0(whenTrue, whenFalse) whenTrue +#endif + +#if QT_DEPRECATED_SINCE(6, 1) +# define QT_IF_DEPRECATED_SINCE_6_1(whenTrue, whenFalse) whenFalse +#else +# define QT_IF_DEPRECATED_SINCE_6_1(whenTrue, whenFalse) whenTrue +#endif + +#if QT_DEPRECATED_SINCE(6, 2) +# define QT_IF_DEPRECATED_SINCE_6_2(whenTrue, whenFalse) whenFalse +#else +# define QT_IF_DEPRECATED_SINCE_6_2(whenTrue, whenFalse) whenTrue +#endif + +#if QT_DEPRECATED_SINCE(6, 3) +# define QT_IF_DEPRECATED_SINCE_6_3(whenTrue, whenFalse) whenFalse +#else +# define QT_IF_DEPRECATED_SINCE_6_3(whenTrue, whenFalse) whenTrue +#endif + +#if QT_DEPRECATED_SINCE(6, 4) +# define QT_IF_DEPRECATED_SINCE_6_4(whenTrue, whenFalse) whenFalse +#else +# define QT_IF_DEPRECATED_SINCE_6_4(whenTrue, whenFalse) whenTrue +#endif + +#if QT_DEPRECATED_SINCE(6, 5) +# define QT_IF_DEPRECATED_SINCE_6_5(whenTrue, whenFalse) whenFalse +#else +# define QT_IF_DEPRECATED_SINCE_6_5(whenTrue, whenFalse) whenTrue +#endif + +#if QT_DEPRECATED_SINCE(6, 6) +# define QT_IF_DEPRECATED_SINCE_6_6(whenTrue, whenFalse) whenFalse +#else +# define QT_IF_DEPRECATED_SINCE_6_6(whenTrue, whenFalse) whenTrue +#endif + +#if QT_DEPRECATED_SINCE(6, 7) +# define QT_IF_DEPRECATED_SINCE_6_7(whenTrue, whenFalse) whenFalse +#else +# define QT_IF_DEPRECATED_SINCE_6_7(whenTrue, whenFalse) whenTrue +#endif + +#if QT_DEPRECATED_SINCE(6, 8) +# define QT_IF_DEPRECATED_SINCE_6_8(whenTrue, whenFalse) whenFalse +#else +# define QT_IF_DEPRECATED_SINCE_6_8(whenTrue, whenFalse) whenTrue +#endif + +#if QT_DEPRECATED_SINCE(6, 9) +# define QT_IF_DEPRECATED_SINCE_6_9(whenTrue, whenFalse) whenFalse +#else +# define QT_IF_DEPRECATED_SINCE_6_9(whenTrue, whenFalse) whenTrue +#endif + +#if QT_DEPRECATED_SINCE(6, 10) +# define QT_IF_DEPRECATED_SINCE_6_10(whenTrue, whenFalse) whenFalse +#else +# define QT_IF_DEPRECATED_SINCE_6_10(whenTrue, whenFalse) whenTrue +#endif + +#if QT_DEPRECATED_SINCE(6, 11) +# define QT_IF_DEPRECATED_SINCE_6_11(whenTrue, whenFalse) whenFalse +#else +# define QT_IF_DEPRECATED_SINCE_6_11(whenTrue, whenFalse) whenTrue +#endif + +#ifdef __cplusplus +// A tag to help mark stuff deprecated (cf. QStringViewLiteral) +namespace QtPrivate { +inline QT_DEFINE_TAG(Deprecated); +} +#endif + +#ifdef QT_ASCII_CAST_WARNINGS +# define QT_ASCII_CAST_WARN \ + Q_DECL_DEPRECATED_X("Use fromUtf8, QStringLiteral, or QLatin1StringView") +#else +# define QT_ASCII_CAST_WARN +#endif + +QT_END_NAMESPACE + +#endif // QTDEPRECATIONMARKERS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtemporarydir.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtemporarydir.h new file mode 100644 index 0000000000000000000000000000000000000000..728e112cbc0e10445f7174cd15822a450112dba8 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtemporarydir.h @@ -0,0 +1,59 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTEMPORARYDIR_H +#define QTEMPORARYDIR_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + + +#if QT_CONFIG(temporaryfile) + +class QTemporaryDirPrivate; + +class Q_CORE_EXPORT QTemporaryDir +{ +public: + QTemporaryDir(); + explicit QTemporaryDir(const QString &templateName); + QTemporaryDir(QTemporaryDir &&other) noexcept + : d_ptr{std::exchange(other.d_ptr, nullptr)} + { } + + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QTemporaryDir) + + ~QTemporaryDir(); + + void swap(QTemporaryDir &other) noexcept + { qt_ptr_swap(d_ptr, other.d_ptr); } + + bool isValid() const; + QString errorString() const; + + bool autoRemove() const; + void setAutoRemove(bool b); + bool remove(); + + QString path() const; + QString filePath(const QString &fileName) const; + +private: + QTemporaryDirPrivate *d_ptr; + + Q_DISABLE_COPY(QTemporaryDir) +}; + +inline void swap(QTemporaryDir &lhs, QTemporaryDir &rhs) noexcept +{ + lhs.swap(rhs); +} + +#endif // QT_CONFIG(temporaryfile) + +QT_END_NAMESPACE + +#endif // QTEMPORARYDIR_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtemporaryfile.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtemporaryfile.h new file mode 100644 index 0000000000000000000000000000000000000000..fa5cf8d9ac336590ff9ca4c753dcd5e516933646 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtemporaryfile.h @@ -0,0 +1,101 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTEMPORARYFILE_H +#define QTEMPORARYFILE_H + +#include +#include + +#ifdef open +#error qtemporaryfile.h must be included before any header file that defines open +#endif + +QT_BEGIN_NAMESPACE + + +#if QT_CONFIG(temporaryfile) + +class QTemporaryFilePrivate; +class QLockFilePrivate; + +class Q_CORE_EXPORT QTemporaryFile : public QFile +{ +#ifndef QT_NO_QOBJECT + Q_OBJECT +#endif + Q_DECLARE_PRIVATE(QTemporaryFile) + +public: + QTemporaryFile(); + explicit QTemporaryFile(const QString &templateName); +#ifndef QT_NO_QOBJECT + explicit QTemporaryFile(QObject *parent); + QTemporaryFile(const QString &templateName, QObject *parent); + +# if QT_CONFIG(cxx17_filesystem) || defined(Q_QDOC) + Q_WEAK_OVERLOAD + explicit QTemporaryFile(const std::filesystem::path &templateName, QObject *parent = nullptr) + : QTemporaryFile(QtPrivate::fromFilesystemPath(templateName), parent) + { + } +# endif // QT_CONFIG(cxx17_filesystem) +#endif // !QT_NO_QOBJECT + + ~QTemporaryFile(); + + bool autoRemove() const; + void setAutoRemove(bool b); + + // ### Hides open(flags) + QFILE_MAYBE_NODISCARD bool open() { return open(QIODevice::ReadWrite); } + + QString fileName() const override; + QString fileTemplate() const; + void setFileTemplate(const QString &name); +#if QT_CONFIG(cxx17_filesystem) || defined(Q_QDOC) + Q_WEAK_OVERLOAD + void setFileTemplate(const std::filesystem::path &name) + { + return setFileTemplate(QtPrivate::fromFilesystemPath(name)); + } +#endif // QT_CONFIG(cxx17_filesystem) + + // Hides QFile::rename + bool rename(const QString &newName); + +#if QT_CONFIG(cxx17_filesystem) || defined(Q_QDOC) + Q_WEAK_OVERLOAD + bool rename(const std::filesystem::path &newName) + { + return rename(QtPrivate::fromFilesystemPath(newName)); + } +#endif // QT_CONFIG(cxx17_filesystem) + + inline static QTemporaryFile *createNativeFile(const QString &fileName) + { QFile file(fileName); return createNativeFile(file); } + static QTemporaryFile *createNativeFile(QFile &file); + +#if QT_CONFIG(cxx17_filesystem) || defined(Q_QDOC) + Q_WEAK_OVERLOAD + static QTemporaryFile *createNativeFile(const std::filesystem::path &fileName) + { + QFile file(fileName); + return createNativeFile(file); + } +#endif // QT_CONFIG(cxx17_filesystem) + +protected: + bool open(OpenMode flags) override; + +private: + friend class QFile; + friend class QLockFilePrivate; + Q_DISABLE_COPY(QTemporaryFile) +}; + +#endif // QT_CONFIG(temporaryfile) + +QT_END_NAMESPACE + +#endif // QTEMPORARYFILE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtenvironmentvariables.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtenvironmentvariables.h new file mode 100644 index 0000000000000000000000000000000000000000..273f93c793a041dc79f0e92846293fbc1a9a1e60 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtenvironmentvariables.h @@ -0,0 +1,38 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTENVIRONMENTVARIABLES_H +#define QTENVIRONMENTVARIABLES_H + +#include +#include +#include + +#if 0 +#pragma qt_class(QtEnvironmentVariables) +#pragma qt_sync_stop_processing +#endif + +QT_BEGIN_NAMESPACE + +class QByteArray; +class QByteArrayView; +class QString; + +Q_CORE_EXPORT QByteArray qgetenv(const char *varName); +// need it as two functions because QString is only forward-declared here +Q_CORE_EXPORT QString qEnvironmentVariable(const char *varName); +Q_CORE_EXPORT QString qEnvironmentVariable(const char *varName, const QString &defaultValue); +#if QT_CORE_REMOVED_SINCE(6, 5) +Q_CORE_EXPORT bool qputenv(const char *varName, const QByteArray &value); +#endif +Q_CORE_EXPORT bool qputenv(const char *varName, QByteArrayView value); +Q_CORE_EXPORT bool qunsetenv(const char *varName); + +Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) noexcept; +Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) noexcept; +Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept; + +QT_END_NAMESPACE + +#endif /* QTENVIRONMENTVARIABLES_H */ diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtestsupport_core.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtestsupport_core.h new file mode 100644 index 0000000000000000000000000000000000000000..87ad2e78a810d1f00d2f385408b21a1dd429ad3f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtestsupport_core.h @@ -0,0 +1,68 @@ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTESTSUPPORT_CORE_H +#define QTESTSUPPORT_CORE_H + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +namespace QTest { + +Q_CORE_EXPORT void qSleep(int ms); +Q_CORE_EXPORT void qSleep(std::chrono::milliseconds msecs); + +template +[[nodiscard]] bool +qWaitFor(Functor predicate, QDeadlineTimer deadline = QDeadlineTimer(std::chrono::seconds{5})) +{ + // We should not spin the event loop in case the predicate is already true, + // otherwise we might send new events that invalidate the predicate. + if (predicate()) + return true; + + // qWait() is expected to spin the event loop at least once, even when + // called with a small timeout like 1ns. + + do { + // We explicitly do not pass the remaining time to processEvents, as + // that would keep spinning processEvents for the whole duration if + // new events were posted as part of processing events, and we need + // to return back to this function to check the predicate between + // each pass of processEvents. Our own timer will take care of the + // timeout. + QCoreApplication::processEvents(QEventLoop::AllEvents); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); + + if (predicate()) + return true; + + using namespace std::chrono; + + if (const auto remaining = deadline.remainingTimeAsDuration(); remaining > 0ns) + qSleep((std::min)(10ms, ceil(remaining))); + + } while (!deadline.hasExpired()); + + return predicate(); // Last chance +} + +template +[[nodiscard]] bool qWaitFor(Functor predicate, int timeout) +{ + return qWaitFor(predicate, QDeadlineTimer{timeout, Qt::PreciseTimer}); +} + +Q_CORE_EXPORT void qWait(int ms); + +Q_CORE_EXPORT void qWait(std::chrono::milliseconds msecs); + +} // namespace QTest + +QT_END_NAMESPACE + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtextboundaryfinder.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtextboundaryfinder.h new file mode 100644 index 0000000000000000000000000000000000000000..6e49e52e641eef705506cd149e09d5fcd598a568 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtextboundaryfinder.h @@ -0,0 +1,77 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTEXTBOUNDARYFINDER_H +#define QTEXTBOUNDARYFINDER_H + +#include +#include + +QT_BEGIN_NAMESPACE + + +struct QCharAttributes; + +class Q_CORE_EXPORT QTextBoundaryFinder +{ +public: + QTextBoundaryFinder(); + QTextBoundaryFinder(const QTextBoundaryFinder &other); + QTextBoundaryFinder &operator=(const QTextBoundaryFinder &other); + ~QTextBoundaryFinder(); + + enum BoundaryType { + Grapheme, + Word, + Sentence, + Line + }; + + enum BoundaryReason { + NotAtBoundary = 0, + BreakOpportunity = 0x1f, + StartOfItem = 0x20, + EndOfItem = 0x40, + MandatoryBreak = 0x80, + SoftHyphen = 0x100 + }; + Q_DECLARE_FLAGS( BoundaryReasons, BoundaryReason ) + + QTextBoundaryFinder(BoundaryType type, const QString &string); + QTextBoundaryFinder(BoundaryType type, const QChar *chars, qsizetype length, unsigned char *buffer = nullptr, qsizetype bufferSize = 0) + : QTextBoundaryFinder(type, QStringView(chars, length), buffer, bufferSize) + {} + QTextBoundaryFinder(BoundaryType type, QStringView str, unsigned char *buffer = nullptr, qsizetype bufferSize = 0); + + inline bool isValid() const { return attributes; } + + inline BoundaryType type() const { return t; } + QString string() const; + + void toStart(); + void toEnd(); + qsizetype position() const; + void setPosition(qsizetype position); + + qsizetype toNextBoundary(); + qsizetype toPreviousBoundary(); + + bool isAtBoundary() const; + BoundaryReasons boundaryReasons() const; + +private: + BoundaryType t = Grapheme; + QString s; + QStringView sv; + qsizetype pos = 0; + uint freeBuffer : 1; + uint unused : 31; + QCharAttributes *attributes = nullptr; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QTextBoundaryFinder::BoundaryReasons) + +QT_END_NAMESPACE + +#endif + diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtextstream.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtextstream.h new file mode 100644 index 0000000000000000000000000000000000000000..f0122bd23bc16ce640a9bfa477a5085485cb44f9 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtextstream.h @@ -0,0 +1,269 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTEXTSTREAM_H +#define QTEXTSTREAM_H + +#include +#include +#include +#include + +#include + +#if 0 +// the macros around the class name throw off syncqt: +#pragma qt_class(QTextStream) +#endif + +#ifdef Status +#error qtextstream.h must be included before any header file that defines Status +#endif + +QT_BEGIN_NAMESPACE + +class QIODevice; +class QLocale; +class QString; + +#if !QT_DEPRECATED_SINCE(6, 9) +# define QT_NO_INHERITABLE_TEXT_STREAM +#endif + +#ifdef QT_NO_INHERITABLE_TEXT_STREAM +# define QT_TEXT_STREAM_FINAL final +#else +# define QT_TEXT_STREAM_FINAL +#endif + +class QTextStreamPrivate; +class Q_CORE_EXPORT QTextStream QT_TEXT_STREAM_FINAL : public QIODeviceBase +{ + Q_DECLARE_PRIVATE(QTextStream) + +public: + enum RealNumberNotation { + SmartNotation, + FixedNotation, + ScientificNotation + }; + enum FieldAlignment { + AlignLeft, + AlignRight, + AlignCenter, + AlignAccountingStyle + }; + enum Status { + Ok, + ReadPastEnd, + ReadCorruptData, + WriteFailed + }; + enum NumberFlag { + ShowBase = 0x1, + ForcePoint = 0x2, + ForceSign = 0x4, + UppercaseBase = 0x8, + UppercaseDigits = 0x10 + }; + Q_DECLARE_FLAGS(NumberFlags, NumberFlag) + + QTextStream(); + explicit QTextStream(QIODevice *device); + explicit QTextStream(FILE *fileHandle, OpenMode openMode = ReadWrite); + explicit QTextStream(QString *string, OpenMode openMode = ReadWrite); + explicit QTextStream(QByteArray *array, OpenMode openMode = ReadWrite); + explicit QTextStream(const QByteArray &array, OpenMode openMode = ReadOnly); + QT6_ONLY(virtual) + ~QTextStream(); + + void setEncoding(QStringConverter::Encoding encoding); + QStringConverter::Encoding encoding() const; + void setAutoDetectUnicode(bool enabled); + bool autoDetectUnicode() const; + void setGenerateByteOrderMark(bool generate); + bool generateByteOrderMark() const; + + void setLocale(const QLocale &locale); + QLocale locale() const; + + void setDevice(QIODevice *device); + QIODevice *device() const; + + void setString(QString *string, OpenMode openMode = ReadWrite); + QString *string() const; + + Status status() const; + void setStatus(Status status); + void resetStatus(); + + bool atEnd() const; + void reset(); + void flush(); + bool seek(qint64 pos); + qint64 pos() const; + + void skipWhiteSpace(); + + QString readLine(qint64 maxlen = 0); + bool readLineInto(QString *line, qint64 maxlen = 0); + QString readAll(); + QString read(qint64 maxlen); + + void setFieldAlignment(FieldAlignment alignment); + FieldAlignment fieldAlignment() const; + + void setPadChar(QChar ch); + QChar padChar() const; + + void setFieldWidth(int width); + int fieldWidth() const; + + void setNumberFlags(NumberFlags flags); + NumberFlags numberFlags() const; + + void setIntegerBase(int base); + int integerBase() const; + + void setRealNumberNotation(RealNumberNotation notation); + RealNumberNotation realNumberNotation() const; + + void setRealNumberPrecision(int precision); + int realNumberPrecision() const; + + QTextStream &operator>>(QChar &ch); + QTextStream &operator>>(char &ch); + QTextStream &operator>>(char16_t &ch) + { QChar c; *this >> c; ch = c.unicode(); return *this; } + QTextStream &operator>>(signed short &i); + QTextStream &operator>>(unsigned short &i); + QTextStream &operator>>(signed int &i); + QTextStream &operator>>(unsigned int &i); + QTextStream &operator>>(signed long &i); + QTextStream &operator>>(unsigned long &i); + QTextStream &operator>>(qlonglong &i); + QTextStream &operator>>(qulonglong &i); + QTextStream &operator>>(float &f); + QTextStream &operator>>(double &f); + QTextStream &operator>>(QString &s); + QTextStream &operator>>(QByteArray &array); + QTextStream &operator>>(char *c); + + QTextStream &operator<<(QChar ch); + QTextStream &operator<<(char ch); + QTextStream &operator<<(char16_t ch) { return *this << QChar(ch); } + QTextStream &operator<<(signed short i); + QTextStream &operator<<(unsigned short i); + QTextStream &operator<<(signed int i); + QTextStream &operator<<(unsigned int i); + QTextStream &operator<<(signed long i); + QTextStream &operator<<(unsigned long i); + QTextStream &operator<<(qlonglong i); + QTextStream &operator<<(qulonglong i); + QTextStream &operator<<(float f); + QTextStream &operator<<(double f); + QTextStream &operator<<(const QString &s); + QTextStream &operator<<(QStringView s); + QTextStream &operator<<(QLatin1StringView s); + QTextStream &operator<<(const QByteArray &array); + QTextStream &operator<<(const char *c); + QTextStream &operator<<(const void *ptr); + +private: + Q_DISABLE_COPY(QTextStream) + friend class QDebugStateSaverPrivate; + friend class QDebug; + + QScopedPointer d_ptr; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QTextStream::NumberFlags) + +/***************************************************************************** + QTextStream manipulators + *****************************************************************************/ + +typedef QTextStream & (*QTextStreamFunction)(QTextStream &);// manipulator function +typedef void (QTextStream::*QTSMFI)(int); // manipulator w/int argument +typedef void (QTextStream::*QTSMFC)(QChar); // manipulator w/QChar argument + + +class Q_CORE_EXPORT QTextStreamManipulator +{ +public: + constexpr QTextStreamManipulator(QTSMFI m, int a) noexcept : mf(m), mc(nullptr), arg(a), ch() {} + constexpr QTextStreamManipulator(QTSMFC m, QChar c) noexcept : mf(nullptr), mc(m), arg(-1), ch(c) {} + void exec(QTextStream &s) { if (mf) { (s.*mf)(arg); } else { (s.*mc)(ch); } } + +private: + QTSMFI mf; // QTextStream member function + QTSMFC mc; // QTextStream member function + int arg; // member function argument + QChar ch; +}; + +inline QTextStream &operator>>(QTextStream &s, QTextStreamFunction f) +{ return (*f)(s); } + +inline QTextStream &operator<<(QTextStream &s, QTextStreamFunction f) +{ return (*f)(s); } + +inline QTextStream &operator<<(QTextStream &s, QTextStreamManipulator m) +{ m.exec(s); return s; } + +namespace Qt { +Q_CORE_EXPORT QTextStream &bin(QTextStream &s); +Q_CORE_EXPORT QTextStream &oct(QTextStream &s); +Q_CORE_EXPORT QTextStream &dec(QTextStream &s); +Q_CORE_EXPORT QTextStream &hex(QTextStream &s); + +Q_CORE_EXPORT QTextStream &showbase(QTextStream &s); +Q_CORE_EXPORT QTextStream &forcesign(QTextStream &s); +Q_CORE_EXPORT QTextStream &forcepoint(QTextStream &s); +Q_CORE_EXPORT QTextStream &noshowbase(QTextStream &s); +Q_CORE_EXPORT QTextStream &noforcesign(QTextStream &s); +Q_CORE_EXPORT QTextStream &noforcepoint(QTextStream &s); + +Q_CORE_EXPORT QTextStream &uppercasebase(QTextStream &s); +Q_CORE_EXPORT QTextStream &uppercasedigits(QTextStream &s); +Q_CORE_EXPORT QTextStream &lowercasebase(QTextStream &s); +Q_CORE_EXPORT QTextStream &lowercasedigits(QTextStream &s); + +Q_CORE_EXPORT QTextStream &fixed(QTextStream &s); +Q_CORE_EXPORT QTextStream &scientific(QTextStream &s); + +Q_CORE_EXPORT QTextStream &left(QTextStream &s); +Q_CORE_EXPORT QTextStream &right(QTextStream &s); +Q_CORE_EXPORT QTextStream ¢er(QTextStream &s); + +Q_CORE_EXPORT QTextStream &endl(QTextStream &s); +Q_CORE_EXPORT QTextStream &flush(QTextStream &s); +Q_CORE_EXPORT QTextStream &reset(QTextStream &s); + +Q_CORE_EXPORT QTextStream &bom(QTextStream &s); + +Q_CORE_EXPORT QTextStream &ws(QTextStream &s); + +} // namespace Qt + +inline QTextStreamManipulator qSetFieldWidth(int width) +{ + QTSMFI func = &QTextStream::setFieldWidth; + return QTextStreamManipulator(func,width); +} + +inline QTextStreamManipulator qSetPadChar(QChar ch) +{ + QTSMFC func = &QTextStream::setPadChar; + return QTextStreamManipulator(func, ch); +} + +inline QTextStreamManipulator qSetRealNumberPrecision(int precision) +{ + QTSMFI func = &QTextStream::setRealNumberPrecision; + return QTextStreamManipulator(func, precision); +} + +QT_END_NAMESPACE + +#endif // QTEXTSTREAM_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qthread.h b/qt/6.8.1/msvc2022_64/include/QtCore/qthread.h new file mode 100644 index 0000000000000000000000000000000000000000..892e3eed0d67fc20992a2eda2bcab13c216b8bd3 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qthread.h @@ -0,0 +1,194 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTHREAD_H +#define QTHREAD_H + +#include +#include + +// For QThread::create +#include // for std::async +#include // for std::invoke; no guard needed as it's a C++98 header +// internal compiler error with mingw 8.1 +#if defined(Q_CC_MSVC) && defined(Q_PROCESSOR_X86) +#include +#endif + +QT_BEGIN_NAMESPACE + + +class QThreadData; +class QThreadPrivate; +class QAbstractEventDispatcher; +class QEventLoopLocker; + +class Q_CORE_EXPORT QThread : public QObject +{ + Q_OBJECT +public: + static Qt::HANDLE currentThreadId() noexcept Q_DECL_PURE_FUNCTION; + static QThread *currentThread(); + static bool isMainThread() noexcept; + static int idealThreadCount() noexcept; + static void yieldCurrentThread(); + + explicit QThread(QObject *parent = nullptr); + ~QThread(); + + enum Priority { + IdlePriority, + + LowestPriority, + LowPriority, + NormalPriority, + HighPriority, + HighestPriority, + + TimeCriticalPriority, + + InheritPriority + }; + + void setPriority(Priority priority); + Priority priority() const; + + bool isFinished() const; + bool isRunning() const; + + void requestInterruption(); + bool isInterruptionRequested() const; + + void setStackSize(uint stackSize); + uint stackSize() const; + + QAbstractEventDispatcher *eventDispatcher() const; + void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher); + + bool event(QEvent *event) override; + int loopLevel() const; + + bool isCurrentThread() const noexcept; + + template + [[nodiscard]] static QThread *create(Function &&f, Args &&... args); + +public Q_SLOTS: + void start(Priority = InheritPriority); + void terminate(); + void exit(int retcode = 0); + void quit(); + +public: + bool wait(QDeadlineTimer deadline = QDeadlineTimer(QDeadlineTimer::Forever)); + bool wait(unsigned long time) + { + if (time == (std::numeric_limits::max)()) + return wait(QDeadlineTimer(QDeadlineTimer::Forever)); + return wait(QDeadlineTimer(time)); + } + + static void sleep(unsigned long); + static void msleep(unsigned long); + static void usleep(unsigned long); + static void sleep(std::chrono::nanoseconds nsec); + +Q_SIGNALS: + void started(QPrivateSignal); + void finished(QPrivateSignal); + +protected: + virtual void run(); + int exec(); + + static void setTerminationEnabled(bool enabled = true); + +protected: + QThread(QThreadPrivate &dd, QObject *parent = nullptr); + +private: + Q_DECLARE_PRIVATE(QThread) + friend class QEventLoopLocker; + + [[nodiscard]] static QThread *createThreadImpl(std::future &&future); + static Qt::HANDLE currentThreadIdImpl() noexcept Q_DECL_PURE_FUNCTION; + + friend class QCoreApplication; + friend class QThreadData; +}; + +template +QThread *QThread::create(Function &&f, Args &&... args) +{ + using DecayedFunction = typename std::decay::type; + auto threadFunction = + [f = static_cast(std::forward(f))](auto &&... largs) mutable -> void + { + (void)std::invoke(std::move(f), std::forward(largs)...); + }; + + return createThreadImpl(std::async(std::launch::deferred, + std::move(threadFunction), + std::forward(args)...)); +} + +/* + On architectures and platforms we know, interpret the thread control + block (TCB) as a unique identifier for a thread within a process. Otherwise, + fall back to a slower but safe implementation. + + As per the documentation of currentThreadId, we return an opaque handle + as a thread identifier, and application code is not supposed to use that + value for anything. In Qt we use the handle to check if threads are identical, + for which the TCB is sufficient. + + So we use the fastest possible way, rather than spend time on returning + some pseudo-interoperable value. +*/ +inline Qt::HANDLE QThread::currentThreadId() noexcept +{ + // define is undefed if we have to fall back to currentThreadIdImpl +#define QT_HAS_FAST_CURRENT_THREAD_ID + Qt::HANDLE tid; // typedef to void* + static_assert(sizeof(tid) == sizeof(void*)); + // See https://akkadia.org/drepper/tls.pdf for x86 ABI +#if defined(Q_PROCESSOR_X86_32) && ((defined(Q_OS_LINUX) && defined(__GLIBC__)) || defined(Q_OS_FREEBSD)) // x86 32-bit always uses GS + __asm__("mov %%gs:%c1, %0" : "=r" (tid) : "i" (2 * sizeof(void*)) : ); +#elif defined(Q_PROCESSOR_X86_64) && defined(Q_OS_DARWIN) + // 64bit macOS uses GS, see https://github.com/apple/darwin-xnu/blob/master/libsyscall/os/tsd.h + __asm__("mov %%gs:0, %0" : "=r" (tid) : : ); +#elif defined(Q_PROCESSOR_X86_64) && ((defined(Q_OS_LINUX) && defined(__GLIBC__)) || defined(Q_OS_FREEBSD)) + // x86_64 Linux, BSD uses FS + __asm__("mov %%fs:%c1, %0" : "=r" (tid) : "i" (2 * sizeof(void*)) : ); +#elif defined(Q_PROCESSOR_X86_64) && defined(Q_OS_WIN) + // See https://en.wikipedia.org/wiki/Win32_Thread_Information_Block + // First get the pointer to the TIB + quint8 *tib; +# if defined(Q_CC_MINGW) // internal compiler error when using the intrinsics + __asm__("movq %%gs:0x30, %0" : "=r" (tib) : :); +# else + tib = reinterpret_cast(__readgsqword(0x30)); +# endif + // Then read the thread ID + tid = *reinterpret_cast(tib + 0x48); +#elif defined(Q_PROCESSOR_X86_32) && defined(Q_OS_WIN) + // First get the pointer to the TIB + quint8 *tib; +# if defined(Q_CC_MINGW) // internal compiler error when using the intrinsics + __asm__("movl %%fs:0x18, %0" : "=r" (tib) : :); +# else + tib = reinterpret_cast(__readfsdword(0x18)); +# endif + // Then read the thread ID + tid = *reinterpret_cast(tib + 0x24); +#else +#undef QT_HAS_FAST_CURRENT_THREAD_ID + tid = currentThreadIdImpl(); +#endif + return tid; +} + +QT_END_NAMESPACE + +#endif // QTHREAD_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qthreadpool.h b/qt/6.8.1/msvc2022_64/include/QtCore/qthreadpool.h new file mode 100644 index 0000000000000000000000000000000000000000..cc0c434b8a5025893aee2a355c3f4e405e48fbcf --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qthreadpool.h @@ -0,0 +1,117 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTHREADPOOL_H +#define QTHREADPOOL_H + +#include + +#include +#include + +#if QT_CORE_REMOVED_SINCE(6, 6) +#include +#endif + +QT_REQUIRE_CONFIG(thread); + +QT_BEGIN_NAMESPACE + +class QThreadPoolPrivate; +class Q_CORE_EXPORT QThreadPool : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QThreadPool) + Q_PROPERTY(int expiryTimeout READ expiryTimeout WRITE setExpiryTimeout) + Q_PROPERTY(int maxThreadCount READ maxThreadCount WRITE setMaxThreadCount) + Q_PROPERTY(int activeThreadCount READ activeThreadCount) + Q_PROPERTY(uint stackSize READ stackSize WRITE setStackSize) + Q_PROPERTY(QThread::Priority threadPriority READ threadPriority WRITE setThreadPriority) + friend class QFutureInterfaceBase; + +public: + QThreadPool(QObject *parent = nullptr); + ~QThreadPool(); + + static QThreadPool *globalInstance(); + + void start(QRunnable *runnable, int priority = 0); + bool tryStart(QRunnable *runnable); + +#if QT_CORE_REMOVED_SINCE(6, 6) + void start(std::function functionToRun, int priority = 0); + bool tryStart(std::function functionToRun); +#endif + + void startOnReservedThread(QRunnable *runnable); +#if QT_CORE_REMOVED_SINCE(6, 6) + void startOnReservedThread(std::function functionToRun); +#endif + + template = true> + void start(Callable &&functionToRun, int priority = 0); + template = true> + bool tryStart(Callable &&functionToRun); + template = true> + void startOnReservedThread(Callable &&functionToRun); + + int expiryTimeout() const; + void setExpiryTimeout(int expiryTimeout); + + int maxThreadCount() const; + void setMaxThreadCount(int maxThreadCount); + + int activeThreadCount() const; + + void setStackSize(uint stackSize); + uint stackSize() const; + + void setThreadPriority(QThread::Priority priority); + QThread::Priority threadPriority() const; + + void reserveThread(); + void releaseThread(); + + QT_CORE_INLINE_SINCE(6, 8) + bool waitForDone(int msecs); + bool waitForDone(QDeadlineTimer deadline = QDeadlineTimer::Forever); + + void clear(); + + bool contains(const QThread *thread) const; + + [[nodiscard]] bool tryTake(QRunnable *runnable); +}; + +template > +void QThreadPool::start(Callable &&functionToRun, int priority) +{ + start(QRunnable::create(std::forward(functionToRun)), priority); +} + +template > +bool QThreadPool::tryStart(Callable &&functionToRun) +{ + QRunnable *runnable = QRunnable::create(std::forward(functionToRun)); + if (tryStart(runnable)) + return true; + delete runnable; + return false; +} + +template > +void QThreadPool::startOnReservedThread(Callable &&functionToRun) +{ + startOnReservedThread(QRunnable::create(std::forward(functionToRun))); +} + +#if QT_CORE_INLINE_IMPL_SINCE(6, 8) +bool QThreadPool::waitForDone(int msecs) +{ + return waitForDone(QDeadlineTimer(msecs)); +} +#endif + +QT_END_NAMESPACE + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qthreadstorage.h b/qt/6.8.1/msvc2022_64/include/QtCore/qthreadstorage.h new file mode 100644 index 0000000000000000000000000000000000000000..602daea05ef05283b8fe15d7dbe8af9064ef4057 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qthreadstorage.h @@ -0,0 +1,200 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTHREADSTORAGE_H +#define QTHREADSTORAGE_H + +#include + +#if QT_CONFIG(thread) + +QT_BEGIN_NAMESPACE + + +class Q_CORE_EXPORT QThreadStorageData +{ +public: + explicit QThreadStorageData(void (*func)(void *)); + ~QThreadStorageData(); + + void** get() const; + void** set(void* p); + + static void finish(void**); + int id; +}; + +#if !defined(QT_MOC_CPP) +// MOC_SKIP_BEGIN + +// pointer specialization +template +inline +T *&qThreadStorage_localData(QThreadStorageData &d, T **) +{ + void **v = d.get(); + if (!v) v = d.set(nullptr); + return *(reinterpret_cast(v)); +} + +template +inline +T *qThreadStorage_localData_const(const QThreadStorageData &d, T **) +{ + void **v = d.get(); + return v ? *(reinterpret_cast(v)) : 0; +} + +template +inline +void qThreadStorage_setLocalData(QThreadStorageData &d, T **t) +{ (void) d.set(*t); } + +template +inline +void qThreadStorage_deleteData(void *d, T **) +{ delete static_cast(d); } + +// value-based specialization +template +inline +T &qThreadStorage_localData(QThreadStorageData &d, T *) +{ + void **v = d.get(); + if (!v) v = d.set(new T()); + return *(reinterpret_cast(*v)); +} + +template +inline +T qThreadStorage_localData_const(const QThreadStorageData &d, T *) +{ + void **v = d.get(); + return v ? *(reinterpret_cast(*v)) : T(); +} + +template +inline +void qThreadStorage_setLocalData(QThreadStorageData &d, T *t) +{ (void) d.set(new T(*t)); } + +template +inline +void qThreadStorage_deleteData(void *d, T *) +{ delete static_cast(d); } + + +// MOC_SKIP_END +#endif + +template +class QThreadStorage +{ +private: + QThreadStorageData d; + + Q_DISABLE_COPY(QThreadStorage) + + static inline void deleteData(void *x) + { qThreadStorage_deleteData(x, reinterpret_cast(0)); } + +public: + inline QThreadStorage() : d(deleteData) { } + inline ~QThreadStorage() { } + + inline bool hasLocalData() const + { return d.get() != nullptr; } + + inline T& localData() + { return qThreadStorage_localData(d, reinterpret_cast(0)); } + inline T localData() const + { return qThreadStorage_localData_const(d, reinterpret_cast(0)); } + + inline void setLocalData(T t) + { qThreadStorage_setLocalData(d, &t); } +}; + +QT_END_NAMESPACE + +#else // !QT_CONFIG(thread) + +#include + +#include + +QT_BEGIN_NAMESPACE + +template +inline bool qThreadStorage_hasLocalData(const QScopedPointer &data) +{ + return !!data; +} + +template +inline bool qThreadStorage_hasLocalData(const QScopedPointer &data) +{ + return !!data ? *data != nullptr : false; +} + +template +inline void qThreadStorage_deleteLocalData(T *t) +{ + delete t; +} + +template +inline void qThreadStorage_deleteLocalData(T **t) +{ + delete *t; + delete t; +} + +template +class QThreadStorage +{ +private: + struct ScopedPointerThreadStorageDeleter + { + static inline void cleanup(T *t) + { + if (t == nullptr) + return; + qThreadStorage_deleteLocalData(t); + } + }; + QScopedPointer data; + +public: + QThreadStorage() = default; + ~QThreadStorage() = default; + QThreadStorage(const QThreadStorage &rhs) = delete; + QThreadStorage &operator=(const QThreadStorage &rhs) = delete; + + inline bool hasLocalData() const + { + return qThreadStorage_hasLocalData(data); + } + + inline T &localData() + { + if (!data) + data.reset(new T()); + return *data; + } + + inline T localData() const + { + return !!data ? *data : T(); + } + + inline void setLocalData(T t) + { + data.reset(new T(t)); + } +}; + +QT_END_NAMESPACE + +#endif // QT_CONFIG(thread) + +#endif // QTHREADSTORAGE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtimeline.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtimeline.h new file mode 100644 index 0000000000000000000000000000000000000000..c93e2db7ac045c554dfa0b78cbbb40911997908d --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtimeline.h @@ -0,0 +1,104 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTIMELINE_H +#define QTIMELINE_H + +#include + +QT_REQUIRE_CONFIG(easingcurve); + +#include +#include + +QT_BEGIN_NAMESPACE + + +class QTimeLinePrivate; +class Q_CORE_EXPORT QTimeLine : public QObject +{ + Q_OBJECT + Q_PROPERTY(int duration READ duration WRITE setDuration BINDABLE bindableDuration) + Q_PROPERTY(int updateInterval READ updateInterval WRITE setUpdateInterval + BINDABLE bindableUpdateInterval) + Q_PROPERTY(int currentTime READ currentTime WRITE setCurrentTime BINDABLE bindableCurrentTime) + Q_PROPERTY(Direction direction READ direction WRITE setDirection BINDABLE bindableDirection) + Q_PROPERTY(int loopCount READ loopCount WRITE setLoopCount BINDABLE bindableLoopCount) + Q_PROPERTY(QEasingCurve easingCurve READ easingCurve WRITE setEasingCurve + BINDABLE bindableEasingCurve) +public: + enum State { + NotRunning, + Paused, + Running + }; + enum Direction { + Forward, + Backward + }; + + explicit QTimeLine(int duration = 1000, QObject *parent = nullptr); + virtual ~QTimeLine(); + + State state() const; + + int loopCount() const; + void setLoopCount(int count); + QBindable bindableLoopCount(); + + Direction direction() const; + void setDirection(Direction direction); + QBindable bindableDirection(); + + int duration() const; + void setDuration(int duration); + QBindable bindableDuration(); + + int startFrame() const; + void setStartFrame(int frame); + int endFrame() const; + void setEndFrame(int frame); + void setFrameRange(int startFrame, int endFrame); + + int updateInterval() const; + void setUpdateInterval(int interval); + QBindable bindableUpdateInterval(); + + QEasingCurve easingCurve() const; + void setEasingCurve(const QEasingCurve &curve); + QBindable bindableEasingCurve(); + + int currentTime() const; + QBindable bindableCurrentTime(); + int currentFrame() const; + qreal currentValue() const; + + int frameForTime(int msec) const; + virtual qreal valueForTime(int msec) const; + +public Q_SLOTS: + void start(); + void resume(); + void stop(); + void setPaused(bool paused); + void setCurrentTime(int msec); + void toggleDirection(); + +Q_SIGNALS: + void valueChanged(qreal x, QPrivateSignal); + void frameChanged(int, QPrivateSignal); + void stateChanged(QTimeLine::State newState, QPrivateSignal); + void finished(QPrivateSignal); + +protected: + void timerEvent(QTimerEvent *event) override; + +private: + Q_DISABLE_COPY(QTimeLine) + Q_DECLARE_PRIVATE(QTimeLine) +}; + +QT_END_NAMESPACE + +#endif + diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtimer.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtimer.h new file mode 100644 index 0000000000000000000000000000000000000000..ad69e1fcde697c3a6df43f137d06c0f913d4a0ed --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtimer.h @@ -0,0 +1,203 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTIMER_H +#define QTIMER_H + +#include + +#ifndef QT_NO_QOBJECT + +#include // conceptual inheritance +#include + +#include + +QT_BEGIN_NAMESPACE + +class QTimerPrivate; +class Q_CORE_EXPORT QTimer : public QObject +{ + Q_OBJECT + Q_PROPERTY(bool singleShot READ isSingleShot WRITE setSingleShot BINDABLE bindableSingleShot) + Q_PROPERTY(int interval READ interval WRITE setInterval BINDABLE bindableInterval) + Q_PROPERTY(int remainingTime READ remainingTime) + Q_PROPERTY(Qt::TimerType timerType READ timerType WRITE setTimerType BINDABLE bindableTimerType) + Q_PROPERTY(bool active READ isActive STORED false BINDABLE bindableActive) +public: + explicit QTimer(QObject *parent = nullptr); + ~QTimer(); + + bool isActive() const; + QBindable bindableActive(); + int timerId() const; + Qt::TimerId id() const; + + void setInterval(int msec); + int interval() const; + QBindable bindableInterval(); + + int remainingTime() const; + + void setTimerType(Qt::TimerType atype); + Qt::TimerType timerType() const; + QBindable bindableTimerType(); + + void setSingleShot(bool singleShot); + bool isSingleShot() const; + QBindable bindableSingleShot(); + + QT_CORE_INLINE_SINCE(6, 8) + static void singleShot(int msec, const QObject *receiver, const char *member); + + QT_CORE_INLINE_SINCE(6, 8) + static void singleShot(int msec, Qt::TimerType timerType, const QObject *receiver, const char *member); + + // singleShot with context +#ifdef Q_QDOC + template + static inline void singleShot(Duration interval, const QObject *receiver, Functor &&slot); + template + static inline void singleShot(Duration interval, Qt::TimerType timerType, + const QObject *receiver, Functor &&slot); +#else + template + static inline void singleShot(Duration interval, + const typename QtPrivate::ContextTypeForFunctor::ContextType *receiver, + Functor &&slot) + { + singleShot(interval, defaultTypeFor(interval), receiver, std::forward(slot)); + } + template + static inline void singleShot(Duration interval, Qt::TimerType timerType, + const typename QtPrivate::ContextTypeForFunctor::ContextType *receiver, + Functor &&slot) + { + using Prototype = void(*)(); + singleShotImpl(interval, timerType, receiver, + QtPrivate::makeCallableObject(std::forward(slot))); + } +#endif + + // singleShot without context + template + static inline void singleShot(Duration interval, Functor &&slot) + { + singleShot(interval, defaultTypeFor(interval), nullptr, std::forward(slot)); + } + template + static inline void singleShot(Duration interval, Qt::TimerType timerType, Functor &&slot) + { + singleShot(interval, timerType, nullptr, std::forward(slot)); + } + +#ifdef Q_QDOC + template + QMetaObject::Connection callOnTimeout(Functor &&slot); + template + QMetaObject::Connection callOnTimeout(const QObject *context, Functor &&slot, Qt::ConnectionType connectionType = Qt::AutoConnection); +#else + template + QMetaObject::Connection callOnTimeout(Args && ...args) + { + return QObject::connect(this, &QTimer::timeout, std::forward(args)... ); + } + +#endif + +public Q_SLOTS: + void start(int msec); + + void start(); + void stop(); + +Q_SIGNALS: + void timeout(QPrivateSignal); + +public: + void setInterval(std::chrono::milliseconds value); + + std::chrono::milliseconds intervalAsDuration() const + { + return std::chrono::milliseconds(interval()); + } + + std::chrono::milliseconds remainingTimeAsDuration() const + { + return std::chrono::milliseconds(remainingTime()); + } + +#if QT_CORE_REMOVED_SINCE(6, 8) + static void singleShot(std::chrono::milliseconds value, const QObject *receiver, const char *member) + { + singleShot(value, defaultTypeFor(value), receiver, member); + } + static void singleShot(std::chrono::milliseconds interval, Qt::TimerType timerType, + const QObject *receiver, const char *member); +#endif // QT_CORE_REMOVED_SINCE(6, 8) + static void singleShot(std::chrono::nanoseconds value, const QObject *receiver, const char *member) + { + singleShot(value, defaultTypeFor(value), receiver, member); + } + static void singleShot(std::chrono::nanoseconds interval, Qt::TimerType timerType, + const QObject *receiver, const char *member); + + void start(std::chrono::milliseconds value); + +protected: + void timerEvent(QTimerEvent *) override; + +private: + Q_DISABLE_COPY(QTimer) + Q_DECLARE_PRIVATE(QTimer) + friend class QChronoTimer; + + static std::chrono::nanoseconds from_msecs(std::chrono::milliseconds); + + inline int startTimer(int){ return -1;} + inline void killTimer(int){} + + static constexpr Qt::TimerType defaultTypeFor(int msecs) noexcept + { return defaultTypeFor(std::chrono::milliseconds{msecs}); } + + static constexpr Qt::TimerType defaultTypeFor(std::chrono::nanoseconds interval) noexcept + { + // coarse timers are worst in their first firing + // so we prefer a high precision timer for something that happens only once + // unless the timeout is too big, in which case we go for coarse anyway + using namespace std::chrono_literals; + return interval >= 2s ? Qt::CoarseTimer : Qt::PreciseTimer; + } + + QT_CORE_INLINE_SINCE(6, 8) + static void singleShotImpl(int msec, Qt::TimerType timerType, + const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj); + +#if QT_CORE_REMOVED_SINCE(6, 8) + static void singleShotImpl(std::chrono::milliseconds interval, Qt::TimerType timerType, + const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj); +#endif + static void singleShotImpl(std::chrono::nanoseconds interval, Qt::TimerType timerType, + const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj); +}; + +#if QT_CORE_INLINE_IMPL_SINCE(6, 8) +void QTimer::singleShot(int msec, const QObject *receiver, const char *member) +{ singleShot(std::chrono::milliseconds{msec}, receiver, member); } + +void QTimer::singleShot(int msec, Qt::TimerType timerType, const QObject *receiver, + const char *member) +{ singleShot(std::chrono::milliseconds{msec}, timerType, receiver, member); } + +void QTimer::singleShotImpl(int msec, Qt::TimerType timerType, + const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj) +{ + singleShotImpl(std::chrono::milliseconds{msec}, timerType, receiver, slotObj); +} +#endif + +QT_END_NAMESPACE + +#endif // QT_NO_QOBJECT + +#endif // QTIMER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtimezone.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtimezone.h new file mode 100644 index 0000000000000000000000000000000000000000..6e7adc90545f6c24c1b63c107489ea7632360b23 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtimezone.h @@ -0,0 +1,283 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2013 John Layt +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTIMEZONE_H +#define QTIMEZONE_H + +#include +#include +#include +#include +#include + +#include + +#if QT_CONFIG(timezone) && (defined(Q_OS_DARWIN) || defined(Q_QDOC)) +Q_FORWARD_DECLARE_CF_TYPE(CFTimeZone); +Q_FORWARD_DECLARE_OBJC_CLASS(NSTimeZone); +#endif + +QT_BEGIN_NAMESPACE + +class QTimeZonePrivate; + +class Q_CORE_EXPORT QTimeZone +{ + struct ShortData + { +#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN + quintptr mode : 2; +#endif + qintptr offset : sizeof(void *) * 8 - 2; + +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + quintptr mode : 2; +#endif + + // mode is a cycled Qt::TimeSpec, (int(spec) + 1) % 4, so that zero + // (lowest bits of a pointer) matches spec being Qt::TimeZone, for which + // Data holds a QTZP pointer instead of ShortData. + // Passing Qt::TimeZone gets the equivalent of a null QTZP; it is not short. + constexpr ShortData(Qt::TimeSpec spec, int secondsAhead = 0) +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + : offset(spec == Qt::OffsetFromUTC ? secondsAhead : 0), + mode((int(spec) + 1) & 3) +#else + : mode((int(spec) + 1) & 3), + offset(spec == Qt::OffsetFromUTC ? secondsAhead : 0) +#endif + { + } + friend constexpr bool operator==(ShortData lhs, ShortData rhs) + { return lhs.mode == rhs.mode && lhs.offset == rhs.offset; } + constexpr Qt::TimeSpec spec() const { return Qt::TimeSpec((mode + 3) & 3); } + }; + + union Data + { + Data() noexcept; + Data(ShortData sd) : s(sd) {} + Data(const Data &other) noexcept; + Data(Data &&other) noexcept : d(std::exchange(other.d, nullptr)) {} + Data &operator=(const Data &other) noexcept; + Data &operator=(Data &&other) noexcept { swap(other); return *this; } + ~Data(); + + void swap(Data &other) noexcept { qt_ptr_swap(d, other.d); } + // isShort() is equivalent to s.spec() != Qt::TimeZone + bool isShort() const { return s.mode; } // a.k.a. quintptr(d) & 3 + + // Typse must support: out << wrap("C-strings"); + template + void serialize(Stream &out, const Wrap &wrap) const; + + Data(QTimeZonePrivate *dptr) noexcept; + Data &operator=(QTimeZonePrivate *dptr) noexcept; + const QTimeZonePrivate *operator->() const { Q_ASSERT(!isShort()); return d; } + QTimeZonePrivate *operator->() { Q_ASSERT(!isShort()); return d; } + + QTimeZonePrivate *d = nullptr; + ShortData s; + }; + QTimeZone(ShortData sd) : d(sd) {} + +public: + // Sane UTC offsets range from -16 to +16 hours: + static constexpr int MinUtcOffsetSecs = -16 * 3600; + // No known modern zone > 12 hrs West of Greenwich. + // Until 1844, Asia/Manila (in The Philippines) was at 15:56 West. + static constexpr int MaxUtcOffsetSecs = +16 * 3600; + // No known modern zone > 14 hrs East of Greenwich. + // Until 1867, America/Metlakatla (in Alaska) was at 15:13:42 East. + + enum Initialization { LocalTime, UTC }; + + QTimeZone() noexcept; + Q_IMPLICIT QTimeZone(Initialization spec) noexcept + : d(ShortData(spec == UTC ? Qt::UTC : Qt::LocalTime)) {} + +#if QT_CONFIG(timezone) + explicit QTimeZone(int offsetSeconds); + explicit QTimeZone(const QByteArray &ianaId); + QTimeZone(const QByteArray &zoneId, int offsetSeconds, const QString &name, + const QString &abbreviation, QLocale::Territory territory = QLocale::AnyTerritory, + const QString &comment = QString()); +#endif // timezone backends + + QTimeZone(const QTimeZone &other) noexcept; + QTimeZone(QTimeZone &&other) noexcept : d(std::move(other.d)) {} + ~QTimeZone(); + + QTimeZone &operator=(const QTimeZone &other); + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QTimeZone) + + void swap(QTimeZone &other) noexcept + { d.swap(other.d); } + +#if QT_CORE_REMOVED_SINCE(6, 7) + bool operator==(const QTimeZone &other) const; + bool operator!=(const QTimeZone &other) const; +#endif + + bool isValid() const; + + static QTimeZone fromDurationAheadOfUtc(std::chrono::seconds offset) + { + return QTimeZone((offset.count() >= MinUtcOffsetSecs && offset.count() <= MaxUtcOffsetSecs) + ? ShortData(offset.count() ? Qt::OffsetFromUTC : Qt::UTC, + int(offset.count())) + : ShortData(Qt::TimeZone)); + } + static QTimeZone fromSecondsAheadOfUtc(int offset) + { + return fromDurationAheadOfUtc(std::chrono::seconds{offset}); + } + constexpr Qt::TimeSpec timeSpec() const noexcept { return d.s.spec(); } + constexpr int fixedSecondsAheadOfUtc() const noexcept + { return timeSpec() == Qt::OffsetFromUTC ? int(d.s.offset) : 0; } + + static constexpr bool isUtcOrFixedOffset(Qt::TimeSpec spec) noexcept + { return spec == Qt::UTC || spec == Qt::OffsetFromUTC; } + constexpr bool isUtcOrFixedOffset() const noexcept { return isUtcOrFixedOffset(timeSpec()); } + +#if QT_CONFIG(timezone) + QTimeZone asBackendZone() const; + + enum TimeType { + StandardTime = 0, + DaylightTime = 1, + GenericTime = 2 + }; + + enum NameType { + DefaultName = 0, + LongName = 1, + ShortName = 2, + OffsetName = 3 + }; + + struct OffsetData { + QString abbreviation; + QDateTime atUtc; + int offsetFromUtc; + int standardTimeOffset; + int daylightTimeOffset; + }; + typedef QList OffsetDataList; + + bool hasAlternativeName(QByteArrayView alias) const; + QByteArray id() const; + QLocale::Territory territory() const; +# if QT_DEPRECATED_SINCE(6, 6) + QT_DEPRECATED_VERSION_X_6_6("Use territory() instead") + QLocale::Country country() const; +# endif + QString comment() const; + + QString displayName(const QDateTime &atDateTime, + QTimeZone::NameType nameType = QTimeZone::DefaultName, + const QLocale &locale = QLocale()) const; + QString displayName(QTimeZone::TimeType timeType, + QTimeZone::NameType nameType = QTimeZone::DefaultName, + const QLocale &locale = QLocale()) const; + QString abbreviation(const QDateTime &atDateTime) const; + + int offsetFromUtc(const QDateTime &atDateTime) const; + int standardTimeOffset(const QDateTime &atDateTime) const; + int daylightTimeOffset(const QDateTime &atDateTime) const; + + bool hasDaylightTime() const; + bool isDaylightTime(const QDateTime &atDateTime) const; + + OffsetData offsetData(const QDateTime &forDateTime) const; + + bool hasTransitions() const; + OffsetData nextTransition(const QDateTime &afterDateTime) const; + OffsetData previousTransition(const QDateTime &beforeDateTime) const; + OffsetDataList transitions(const QDateTime &fromDateTime, const QDateTime &toDateTime) const; + + static QByteArray systemTimeZoneId(); + static QTimeZone systemTimeZone(); + static QTimeZone utc(); + + static bool isTimeZoneIdAvailable(const QByteArray &ianaId); + + static QList availableTimeZoneIds(); + static QList availableTimeZoneIds(QLocale::Territory territory); + static QList availableTimeZoneIds(int offsetSeconds); + + static QByteArray ianaIdToWindowsId(const QByteArray &ianaId); + static QByteArray windowsIdToDefaultIanaId(const QByteArray &windowsId); + static QByteArray windowsIdToDefaultIanaId(const QByteArray &windowsId, + QLocale::Territory territory); + static QList windowsIdToIanaIds(const QByteArray &windowsId); + static QList windowsIdToIanaIds(const QByteArray &windowsId, + QLocale::Territory territory); + +# if defined(Q_OS_DARWIN) || defined(Q_QDOC) + static QTimeZone fromCFTimeZone(CFTimeZoneRef timeZone); + CFTimeZoneRef toCFTimeZone() const Q_DECL_CF_RETURNS_RETAINED; + static QTimeZone fromNSTimeZone(const NSTimeZone *timeZone); + NSTimeZone *toNSTimeZone() const Q_DECL_NS_RETURNS_AUTORELEASED; +# endif + +# if __cpp_lib_chrono >= 201907L || defined(Q_QDOC) + QT_POST_CXX17_API_IN_EXPORTED_CLASS + static QTimeZone fromStdTimeZonePtr(const std::chrono::time_zone *timeZone) + { + if (!timeZone) + return QTimeZone(); + const std::string_view timeZoneName = timeZone->name(); + return QTimeZone(QByteArrayView(timeZoneName).toByteArray()); + } +# endif +#endif // feature timezone +private: + friend Q_CORE_EXPORT bool comparesEqual(const QTimeZone &lhs, const QTimeZone &rhs) noexcept; + Q_DECLARE_EQUALITY_COMPARABLE(QTimeZone) + +#ifndef QT_NO_DATASTREAM + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &ds, const QTimeZone &tz); +#endif +#ifndef QT_NO_DEBUG_STREAM + friend Q_CORE_EXPORT QDebug operator<<(QDebug dbg, const QTimeZone &tz); +#endif + QTimeZone(QTimeZonePrivate &dd); + friend class QTimeZonePrivate; + friend class QDateTime; + friend class QDateTimePrivate; + Data d; +}; + +#if QT_CONFIG(timezone) +Q_DECLARE_TYPEINFO(QTimeZone::OffsetData, Q_RELOCATABLE_TYPE); +#endif +Q_DECLARE_SHARED(QTimeZone) + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &ds, const QTimeZone &tz); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &ds, QTimeZone &tz); +#endif + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug dbg, const QTimeZone &tz); +#endif + +#if QT_CONFIG(timezone) && __cpp_lib_chrono >= 201907L +// zoned_time +template // QT_POST_CXX17_API_IN_EXPORTED_CLASS +inline QDateTime QDateTime::fromStdZonedTime(const std::chrono::zoned_time< + std::chrono::milliseconds, + const std::chrono::time_zone * + > &time) +{ + const auto sysTime = time.get_sys_time(); + const QTimeZone timeZone = QTimeZone::fromStdTimeZonePtr(time.get_time_zone()); + return fromMSecsSinceEpoch(sysTime.time_since_epoch().count(), timeZone); +} +#endif + +QT_END_NAMESPACE + +#endif // QTIMEZONE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtipccommon.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtipccommon.h new file mode 100644 index 0000000000000000000000000000000000000000..aaa98836b0b1e558bd6ee7c060c28799240396b0 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtipccommon.h @@ -0,0 +1,206 @@ +// Copyright (C) 2022 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QNATIVEIPCKEY_H +#define QNATIVEIPCKEY_H + +#include +#include + +#if QT_CONFIG(sharedmemory) || QT_CONFIG(systemsemaphore) +# include +# include + +QT_BEGIN_NAMESPACE + +class QNativeIpcKeyPrivate; +class QNativeIpcKey +{ + Q_GADGET_EXPORT(Q_CORE_EXPORT) +public: + enum class Type : quint16 { + // 0 is reserved for the invalid type + // keep 1 through 0xff free, except for SystemV + SystemV = 0x51, // 'Q' + + PosixRealtime = 0x100, + Windows, + }; + Q_ENUM(Type) + + static constexpr Type DefaultTypeForOs = +#ifdef Q_OS_WIN + Type::Windows +#else + Type::PosixRealtime +#endif + ; + static Type legacyDefaultTypeForOs() noexcept; + + constexpr QNativeIpcKey() noexcept = default; + + explicit constexpr QNativeIpcKey(Type type) noexcept + : typeAndFlags{type} + { + } + + Q_IMPLICIT QNativeIpcKey(const QString &k, Type type = DefaultTypeForOs) + : key(k), typeAndFlags{type} + { + } + + QNativeIpcKey(const QNativeIpcKey &other) + : d(other.d), key(other.key), typeAndFlags(other.typeAndFlags) + { + if (isSlowPath()) + copy_internal(other); + } + + QNativeIpcKey(QNativeIpcKey &&other) noexcept + : d(std::exchange(other.d, nullptr)), key(std::move(other.key)), + typeAndFlags(std::move(other.typeAndFlags)) + { + if (isSlowPath()) + move_internal(std::move(other)); + } + + ~QNativeIpcKey() + { + if (isSlowPath()) + destroy_internal(); + } + + QNativeIpcKey &operator=(const QNativeIpcKey &other) + { + typeAndFlags = other.typeAndFlags; + key = other.key; + if (isSlowPath() || other.isSlowPath()) + return assign_internal(other); + Q_ASSERT(!d); + return *this; + } + + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QNativeIpcKey) + void swap(QNativeIpcKey &other) noexcept + { + std::swap(d, other.d); + key.swap(other.key); + typeAndFlags.swap(other.typeAndFlags); + } + + bool isEmpty() const noexcept + { + return key.isEmpty(); + } + + bool isValid() const noexcept + { + return type() != Type{}; + } + + constexpr Type type() const noexcept + { + return typeAndFlags.type; + } + + constexpr void setType(Type type) + { + if (isSlowPath()) + return setType_internal(type); + typeAndFlags.type = type; + } + + QString nativeKey() const noexcept + { + return key; + } + void setNativeKey(const QString &newKey) + { + key = newKey; + if (isSlowPath()) + setNativeKey_internal(newKey); + } + + Q_CORE_EXPORT QString toString() const; + Q_CORE_EXPORT static QNativeIpcKey fromString(const QString &string); + +private: + struct TypeAndFlags { + Type type = DefaultTypeForOs; + quint16 reserved1 = {}; + quint32 reserved2 = {}; + + void swap(TypeAndFlags &other) noexcept + { + std::swap(type, other.type); + std::swap(reserved1, other.reserved1); + std::swap(reserved2, other.reserved2); + } + + friend constexpr bool operator==(const TypeAndFlags &lhs, const TypeAndFlags &rhs) noexcept + { + return lhs.type == rhs.type && + lhs.reserved1 == rhs.reserved1 && + lhs.reserved2 == rhs.reserved2; + } + }; + + QNativeIpcKeyPrivate *d = nullptr; + QString key; + TypeAndFlags typeAndFlags; + + friend class QNativeIpcKeyPrivate; + constexpr bool isSlowPath() const noexcept + { return Q_UNLIKELY(d); } + + friend Q_CORE_EXPORT size_t qHash(const QNativeIpcKey &ipcKey, size_t seed) noexcept; + friend size_t qHash(const QNativeIpcKey &ipcKey) noexcept + { return qHash(ipcKey, 0); } + + Q_CORE_EXPORT void copy_internal(const QNativeIpcKey &other); + Q_CORE_EXPORT void move_internal(QNativeIpcKey &&other) noexcept; + Q_CORE_EXPORT QNativeIpcKey &assign_internal(const QNativeIpcKey &other); + Q_CORE_EXPORT void destroy_internal() noexcept; + Q_CORE_EXPORT void setType_internal(Type); + Q_CORE_EXPORT void setNativeKey_internal(const QString &); + Q_DECL_PURE_FUNCTION Q_CORE_EXPORT static int + compare_internal(const QNativeIpcKey &lhs, const QNativeIpcKey &rhs) noexcept; + +#ifdef Q_OS_DARWIN + Q_DECL_CONST_FUNCTION Q_CORE_EXPORT static Type defaultTypeForOs_internal() noexcept; +#endif + friend bool comparesEqual(const QNativeIpcKey &lhs, const QNativeIpcKey &rhs) noexcept + { + if (!(lhs.typeAndFlags == rhs.typeAndFlags)) + return false; + if (lhs.key != rhs.key) + return false; + if (lhs.d == rhs.d) + return true; + return compare_internal(lhs, rhs) == 0; + } + Q_DECLARE_EQUALITY_COMPARABLE(QNativeIpcKey) +}; + +// not a shared type, exactly, but this works too +Q_DECLARE_SHARED(QNativeIpcKey) + +inline auto QNativeIpcKey::legacyDefaultTypeForOs() noexcept -> Type +{ +#if defined(Q_OS_WIN) + return Type::Windows; +#elif defined(QT_POSIX_IPC) + return Type::PosixRealtime; +#elif defined(Q_OS_DARWIN) + return defaultTypeForOs_internal(); +#else + return Type::SystemV; +#endif +} + +QT_END_NAMESPACE + +#endif // QT_CONFIG(sharedmemory) || QT_CONFIG(systemsemaphore) + + +#endif // QNATIVEIPCKEY_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtmetamacros.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtmetamacros.h new file mode 100644 index 0000000000000000000000000000000000000000..71f052dc121cc4cf1b27e5de9f394b10141e3538 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtmetamacros.h @@ -0,0 +1,202 @@ +// Copyright (C) 2019 The Qt Company Ltd. +// Copyright (C) 2019 Olivier Goffart +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTMETAMACROS_H +#define QTMETAMACROS_H + +#include +#include + +QT_BEGIN_NAMESPACE + +#ifndef Q_MOC_OUTPUT_REVISION +#define Q_MOC_OUTPUT_REVISION 68 +#endif + +// The following macros can be defined by tools that understand Qt +// to have the information from the macro. +#ifndef QT_ANNOTATE_CLASS +# define QT_ANNOTATE_CLASS(type, ...) +#endif +#ifndef QT_ANNOTATE_CLASS2 +# define QT_ANNOTATE_CLASS2(type, a1, a2) +#endif +#ifndef QT_ANNOTATE_FUNCTION +# define QT_ANNOTATE_FUNCTION(x) +#endif +#ifndef QT_ANNOTATE_ACCESS_SPECIFIER +# define QT_ANNOTATE_ACCESS_SPECIFIER(x) +#endif + +// The following macros are our "extensions" to C++ +// They are used, strictly speaking, only by the moc. + +#ifndef Q_MOC_RUN +#ifndef QT_NO_META_MACROS +# if defined(QT_NO_KEYWORDS) +# define QT_NO_EMIT +# else +# ifndef QT_NO_SIGNALS_SLOTS_KEYWORDS +# define slots Q_SLOTS +# define signals Q_SIGNALS +# endif +# endif +# define Q_SLOTS QT_ANNOTATE_ACCESS_SPECIFIER(qt_slot) +# define Q_SIGNALS public QT_ANNOTATE_ACCESS_SPECIFIER(qt_signal) +# define Q_PRIVATE_SLOT(d, signature) QT_ANNOTATE_CLASS2(qt_private_slot, d, signature) +# define Q_EMIT +#ifndef QT_NO_EMIT +# define emit +#endif +#ifndef Q_CLASSINFO +# define Q_CLASSINFO(name, value) +#endif +#define Q_PLUGIN_METADATA(x) QT_ANNOTATE_CLASS(qt_plugin_metadata, x) +#define Q_INTERFACES(x) QT_ANNOTATE_CLASS(qt_interfaces, x) +#define Q_PROPERTY(...) QT_ANNOTATE_CLASS(qt_property, __VA_ARGS__) +#define Q_PRIVATE_PROPERTY(d, text) QT_ANNOTATE_CLASS2(qt_private_property, d, text) +#ifndef Q_REVISION +# define Q_REVISION(...) +#endif +#define Q_OVERRIDE(text) QT_ANNOTATE_CLASS(qt_override, text) +#define QDOC_PROPERTY(text) QT_ANNOTATE_CLASS(qt_qdoc_property, text) +#define Q_ENUMS(x) QT_ANNOTATE_CLASS(qt_enums, x) +#define Q_FLAGS(x) QT_ANNOTATE_CLASS(qt_enums, x) +#define Q_ENUM_IMPL(ENUM) \ + friend constexpr const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return &staticMetaObject; } \ + friend constexpr const char *qt_getEnumName(ENUM) noexcept { return #ENUM; } +#define Q_ENUM(x) Q_ENUMS(x) Q_ENUM_IMPL(x) +#define Q_FLAG(x) Q_FLAGS(x) Q_ENUM_IMPL(x) +#define Q_ENUM_NS_IMPL(ENUM) \ + inline constexpr const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return &staticMetaObject; } \ + inline constexpr const char *qt_getEnumName(ENUM) noexcept { return #ENUM; } +#define Q_ENUM_NS(x) Q_ENUMS(x) Q_ENUM_NS_IMPL(x) +#define Q_FLAG_NS(x) Q_FLAGS(x) Q_ENUM_NS_IMPL(x) +#define Q_SCRIPTABLE QT_ANNOTATE_FUNCTION(qt_scriptable) +#define Q_INVOKABLE QT_ANNOTATE_FUNCTION(qt_invokable) +#define Q_SIGNAL QT_ANNOTATE_FUNCTION(qt_signal) +#define Q_SLOT QT_ANNOTATE_FUNCTION(qt_slot) +#define Q_MOC_INCLUDE(...) QT_ANNOTATE_CLASS(qt_moc_include, __VA_ARGS__) +#endif // QT_NO_META_MACROS + +#ifndef QT_NO_TRANSLATION +// full set of tr functions +# define QT_TR_FUNCTIONS \ + static inline QString tr(const char *s, const char *c = nullptr, int n = -1) \ + { return staticMetaObject.tr(s, c, n); } +#else +// inherit the ones from QObject +# define QT_TR_FUNCTIONS +#endif + +#ifdef Q_QDOC +#define QT_TR_FUNCTIONS +#endif + +#define Q_DECL_HIDDEN_STATIC_METACALL Q_DECL_HIDDEN + +#if defined(Q_CC_CLANG) +# if Q_CC_CLANG >= 1100 +# define Q_OBJECT_NO_OVERRIDE_WARNING QT_WARNING_DISABLE_CLANG("-Winconsistent-missing-override") QT_WARNING_DISABLE_CLANG("-Wsuggest-override") +# elif Q_CC_CLANG >= 306 +# define Q_OBJECT_NO_OVERRIDE_WARNING QT_WARNING_DISABLE_CLANG("-Winconsistent-missing-override") +# endif +#elif defined(Q_CC_GNU) && Q_CC_GNU >= 501 +# define Q_OBJECT_NO_OVERRIDE_WARNING QT_WARNING_DISABLE_GCC("-Wsuggest-override") +#elif defined(Q_CC_MSVC) +# define Q_OBJECT_NO_OVERRIDE_WARNING QT_WARNING_DISABLE_MSVC(26433) +#else +# define Q_OBJECT_NO_OVERRIDE_WARNING +#endif + +#if defined(Q_CC_GNU) && Q_CC_GNU >= 600 +# define Q_OBJECT_NO_ATTRIBUTES_WARNING QT_WARNING_DISABLE_GCC("-Wattributes") +#else +# define Q_OBJECT_NO_ATTRIBUTES_WARNING +#endif + +/* qmake ignore Q_OBJECT */ +#define Q_OBJECT \ +public: \ + QT_WARNING_PUSH \ + Q_OBJECT_NO_OVERRIDE_WARNING \ + static const QMetaObject staticMetaObject; \ + virtual const QMetaObject *metaObject() const; \ + virtual void *qt_metacast(const char *); \ + virtual int qt_metacall(QMetaObject::Call, int, void **); \ + QT_TR_FUNCTIONS \ +private: \ + Q_OBJECT_NO_ATTRIBUTES_WARNING \ + Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \ + QT_WARNING_POP \ + QT_DEFINE_TAG_STRUCT(QPrivateSignal); \ + QT_ANNOTATE_CLASS(qt_qobject, "") + +/* qmake ignore Q_OBJECT */ +#define Q_OBJECT_FAKE Q_OBJECT QT_ANNOTATE_CLASS(qt_fake, "") + +#ifndef QT_NO_META_MACROS +/* qmake ignore Q_GADGET_EXPORT */ +#define Q_GADGET_EXPORT(...) \ +public: \ + static __VA_ARGS__ const QMetaObject staticMetaObject; \ + void qt_check_for_QGADGET_macro(); \ + typedef void QtGadgetHelper; \ +private: \ + QT_WARNING_PUSH \ + Q_OBJECT_NO_ATTRIBUTES_WARNING \ + Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \ + QT_WARNING_POP \ + QT_ANNOTATE_CLASS(qt_qgadget, "") \ + /*end*/ + +/* qmake ignore Q_GADGET */ +#define Q_GADGET Q_GADGET_EXPORT() + + /* qmake ignore Q_NAMESPACE_EXPORT */ +#define Q_NAMESPACE_EXPORT(...) \ + extern __VA_ARGS__ const QMetaObject staticMetaObject; \ + QT_ANNOTATE_CLASS(qt_qnamespace, "") \ + /*end*/ + +/* qmake ignore Q_NAMESPACE */ +#define Q_NAMESPACE Q_NAMESPACE_EXPORT() \ + /*end*/ + +#endif // QT_NO_META_MACROS + +#else // Q_MOC_RUN +#define slots slots +#define signals signals +#define Q_SLOTS Q_SLOTS +#define Q_SIGNALS Q_SIGNALS +#define Q_CLASSINFO(name, value) Q_CLASSINFO(name, value) +#define Q_INTERFACES(x) Q_INTERFACES(x) +#define Q_PROPERTY(text) Q_PROPERTY(text) +#define Q_PRIVATE_PROPERTY(d, text) Q_PRIVATE_PROPERTY(d, text) +#define Q_PRIVATE_QPROPERTY(accessor, type, name, setter, ...) Q_PRIVATE_QPROPERTY(accessor, type, name, setter, __VA_ARGS__) +#define Q_PRIVATE_QPROPERTIES_BEGIN +#define Q_PRIVATE_QPROPERTY_IMPL(name) +#define Q_PRIVATE_QPROPERTIES_END +#define Q_REVISION(...) Q_REVISION(__VA_ARGS__) +#define Q_OVERRIDE(text) Q_OVERRIDE(text) +#define Q_ENUMS(x) Q_ENUMS(x) +#define Q_FLAGS(x) Q_FLAGS(x) +#define Q_ENUM(x) Q_ENUM(x) +#define Q_FLAGS(x) Q_FLAGS(x) + /* qmake ignore Q_OBJECT */ +#define Q_OBJECT Q_OBJECT + /* qmake ignore Q_OBJECT */ +#define Q_OBJECT_FAKE Q_OBJECT_FAKE + /* qmake ignore Q_GADGET */ +#define Q_GADGET Q_GADGET +#define Q_SCRIPTABLE Q_SCRIPTABLE +#define Q_INVOKABLE Q_INVOKABLE +#define Q_SIGNAL Q_SIGNAL +#define Q_SLOT Q_SLOT +#endif //Q_MOC_RUN + +QT_END_NAMESPACE + +#endif // QTMETAMACROS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtmochelpers.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtmochelpers.h new file mode 100644 index 0000000000000000000000000000000000000000..96061f06f25f2a6efdb0b82912b83e457313a333 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtmochelpers.h @@ -0,0 +1,86 @@ +// Copyright (C) 2022 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTMOCHELPERS_H +#define QTMOCHELPERS_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists to be used by the code that +// moc generates. This file will not change quickly, but it over the long term, +// it will likely change or even be removed. +// +// We mean it. +// + +#include + +#include // std::min +#include + +#if 0 +#pragma qt_no_master_include +#endif + +QT_BEGIN_NAMESPACE +namespace QtMocHelpers { +// The maximum Size of a string literal is 2 GB on 32-bit and 4 GB on 64-bit +// (but the compiler is likely to give up before you get anywhere near that much) +static constexpr size_t MaxStringSize = + (std::min)(size_t((std::numeric_limits::max)()), + size_t((std::numeric_limits::max)())); + +template constexpr size_t stringDataSizeHelper(std::integer_sequence) +{ + // same as: + // return (0 + ... + Nx); + // but not using the fold expression to avoid exceeding compiler limits + size_t total = 0; + uint sizes[] = { Nx... }; + for (uint n : sizes) + total += n; + return total; +} + +template struct StringData +{ + static_assert(StringSize <= MaxStringSize, "Meta Object data is too big"); + uint offsetsAndSizes[Count] = {}; + char stringdata0[StringSize] = {}; + constexpr StringData() = default; +}; + +template constexpr auto stringData(const char (&...strings)[Nx]) +{ + constexpr size_t StringSize = stringDataSizeHelper({}); + constexpr size_t Count = 2 * sizeof...(Nx); + + StringData result; + const char *inputs[] = { strings... }; + uint sizes[] = { Nx... }; + + uint offset = 0; + char *output = result.stringdata0; + for (size_t i = 0; i < sizeof...(Nx); ++i) { + // copy the input string, including the terminating null + uint len = sizes[i]; + for (uint j = 0; j < len; ++j) + output[offset + j] = inputs[i][j]; + result.offsetsAndSizes[2 * i] = offset + sizeof(result.offsetsAndSizes); + result.offsetsAndSizes[2 * i + 1] = len - 1; + offset += len; + } + + return result; +} + +# define QT_MOC_HAS_STRINGDATA 1 + +} // namespace QtMocHelpers +QT_END_NAMESPACE + +QT_USE_NAMESPACE + +#endif // QTMOCHELPERS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtnoop.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtnoop.h new file mode 100644 index 0000000000000000000000000000000000000000..2babd03efa792642f548a26350046c3b6d03c6fa --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtnoop.h @@ -0,0 +1,20 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTNOOP_H +#define QTNOOP_H + +#if 0 +#pragma qt_sync_stop_processing +#endif + +#ifdef __cplusplus +constexpr +#endif +inline void qt_noop(void) +#ifdef __cplusplus + noexcept +#endif +{} + +#endif // QTNOOP_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtpreprocessorsupport.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtpreprocessorsupport.h new file mode 100644 index 0000000000000000000000000000000000000000..a1235e331cc640bee52e81cd0a596fff34e57947 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtpreprocessorsupport.h @@ -0,0 +1,26 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTPREPROCESSORSUPPORT_H +#define QTPREPROCESSORSUPPORT_H + +#if 0 +#pragma qt_class(QtPreprocessorSupport) +#pragma qt_sync_stop_processing +#endif + +/* These two macros makes it possible to turn the builtin line expander into a + * string literal. */ +#define QT_STRINGIFY2(x) #x +#define QT_STRINGIFY(x) QT_STRINGIFY2(x) + +/* + Avoid "unused parameter" warnings +*/ +#define Q_UNUSED(x) (void)x; + +#if !defined(Q_UNIMPLEMENTED) +# define Q_UNIMPLEMENTED() qWarning("Unimplemented code.") +#endif + +#endif // QTPREPROCESSORSUPPORT_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtranslator.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtranslator.h new file mode 100644 index 0000000000000000000000000000000000000000..c29f6219574b9b0c3531411a6fdb76f8b231f45e --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtranslator.h @@ -0,0 +1,54 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTRANSLATOR_H +#define QTRANSLATOR_H + +#include +#include + +QT_BEGIN_NAMESPACE + + +#ifndef QT_NO_TRANSLATION + +class QLocale; +class QTranslatorPrivate; + +class Q_CORE_EXPORT QTranslator : public QObject +{ + Q_OBJECT +public: + explicit QTranslator(QObject *parent = nullptr); + ~QTranslator(); + + virtual QString translate(const char *context, const char *sourceText, + const char *disambiguation = nullptr, int n = -1) const; + + virtual bool isEmpty() const; + + QString language() const; + QString filePath() const; + + [[nodiscard]] bool load(const QString & filename, + const QString & directory = QString(), + const QString & search_delimiters = QString(), + const QString & suffix = QString()); + [[nodiscard]] bool load(const QLocale & locale, + const QString & filename, + const QString & prefix = QString(), + const QString & directory = QString(), + const QString & suffix = QString()); + [[nodiscard]] bool load(const uchar *data, int len, + const QString &directory = QString()); + +private: + Q_DISABLE_COPY(QTranslator) + Q_DECLARE_PRIVATE(QTranslator) +}; + +#endif // QT_NO_TRANSLATION + +QT_END_NAMESPACE + +#endif // QTRANSLATOR_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtransposeproxymodel.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtransposeproxymodel.h new file mode 100644 index 0000000000000000000000000000000000000000..fb481c5aed0b73c0d16b2bf26613bea6d556bb43 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtransposeproxymodel.h @@ -0,0 +1,49 @@ +// Copyright (C) 2018 Luca Beldi +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTRANSPOSEPROXYMODEL_H +#define QTRANSPOSEPROXYMODEL_H + +#include +#include + +QT_REQUIRE_CONFIG(transposeproxymodel); + +QT_BEGIN_NAMESPACE + +class QTransposeProxyModelPrivate; + +class Q_CORE_EXPORT QTransposeProxyModel : public QAbstractProxyModel +{ + Q_OBJECT + Q_DISABLE_COPY(QTransposeProxyModel) + Q_DECLARE_PRIVATE(QTransposeProxyModel) +public: + explicit QTransposeProxyModel(QObject* parent = nullptr); + ~QTransposeProxyModel(); + void setSourceModel(QAbstractItemModel* newSourceModel) override; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int columnCount(const QModelIndex &parent = QModelIndex()) const override; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) override; + bool setItemData(const QModelIndex &index, const QMap &roles) override; + QSize span(const QModelIndex &index) const override; + QMap itemData(const QModelIndex &index) const override; + QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override; + QModelIndex mapToSource(const QModelIndex &proxyIndex) const override; + QModelIndex parent(const QModelIndex &index) const override; + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; + bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; + bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; + bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override; + bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override; + bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override; + bool moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild) override; + void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override; +protected: + QTransposeProxyModel(QTransposeProxyModelPrivate &, QObject *parent); +}; + +QT_END_NAMESPACE + +#endif // QTRANSPOSEPROXYMODEL_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtresource.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtresource.h new file mode 100644 index 0000000000000000000000000000000000000000..57f0375a5aea366dca02b847bb6aca4a1dbae0ad --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtresource.h @@ -0,0 +1,21 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTRESOURCE_H +#define QTRESOURCE_H + +#include + +#if 0 +#pragma qt_class(QtResource) +#pragma qt_sync_stop_processing +#endif + +#define Q_INIT_RESOURCE(name) \ + do { extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); \ + QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); } while (false) +#define Q_CLEANUP_RESOURCE(name) \ + do { extern int QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); \ + QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); } while (false) + +#endif // QTRESOURCE_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtsan_impl.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtsan_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..72888ad7459321f537cca3b0d6818cbc2d9f7a84 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtsan_impl.h @@ -0,0 +1,79 @@ +// Copyright (C) 2017 Intel Corporation. +// Copyright (C) 2022 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTSAN_IMPL_H +#define QTSAN_IMPL_H + +#include + +#if (__has_feature(thread_sanitizer) || defined(__SANITIZE_THREAD__)) && __has_include() +# define QT_BUILDING_UNDER_TSAN +# include +#endif + +QT_BEGIN_NAMESPACE + +namespace QtTsan { +#ifdef QT_BUILDING_UNDER_TSAN +inline void futexAcquire(void *addr, void *addr2 = nullptr) +{ + // A futex call ensures total ordering on the futex words + // (in either success or failure of the call). Instruct TSAN accordingly, + // as TSAN does not understand the futex(2) syscall (or equivalent). + ::__tsan_acquire(addr); + if (addr2) + ::__tsan_acquire(addr2); +} + +inline void futexRelease(void *addr, void *addr2 = nullptr) +{ + if (addr2) + ::__tsan_release(addr2); + ::__tsan_release(addr); +} + +inline void mutexPreLock(void *addr, unsigned flags) +{ + ::__tsan_mutex_pre_lock(addr, flags); +} + +inline void mutexPostLock(void *addr, unsigned flags, int recursion) +{ + ::__tsan_mutex_post_lock(addr, flags, recursion); +} + +inline void mutexPreUnlock(void *addr, unsigned flags) +{ + ::__tsan_mutex_pre_unlock(addr, flags); +} + +inline void mutexPostUnlock(void *addr, unsigned flags) +{ + ::__tsan_mutex_post_unlock(addr, flags); +} + +enum : unsigned { + MutexWriteReentrant = ::__tsan_mutex_write_reentrant, + TryLock = ::__tsan_mutex_try_lock, + TryLockFailed = ::__tsan_mutex_try_lock_failed, +}; +#else +inline void futexAcquire(void *, void * = nullptr) {} +inline void futexRelease(void *, void * = nullptr) {} + +enum : unsigned { + MutexWriteReentrant, + TryLock, + TryLockFailed, +}; +inline void mutexPreLock(void *, unsigned) {} +inline void mutexPostLock(void *, unsigned, int) {} +inline void mutexPreUnlock(void *, unsigned) {} +inline void mutexPostUnlock(void *, unsigned) {} +#endif // QT_BUILDING_UNDER_TSAN +} // namespace QtTsan + +QT_END_NAMESPACE + +#endif // QTSAN_IMPL_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtsymbolmacros.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtsymbolmacros.h new file mode 100644 index 0000000000000000000000000000000000000000..3c70c78338abf96e24cb1e838ada27b9b0d53f95 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtsymbolmacros.h @@ -0,0 +1,65 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTSYMBOLMACROS_H +#define QTSYMBOLMACROS_H + +#if 0 +# pragma qt_sync_stop_processing +#endif + +// For GHS symbol keeping. +#include +#include + +// For handling namespaced resources. +#ifdef QT_NAMESPACE +# define QT_RCC_MANGLE_NAMESPACE0(x) x +# define QT_RCC_MANGLE_NAMESPACE1(a, b) a##_##b +# define QT_RCC_MANGLE_NAMESPACE2(a, b) QT_RCC_MANGLE_NAMESPACE1(a,b) +# define QT_RCC_MANGLE_NAMESPACE(name) QT_RCC_MANGLE_NAMESPACE2( \ + QT_RCC_MANGLE_NAMESPACE0(name), QT_RCC_MANGLE_NAMESPACE0(QT_NAMESPACE)) +#else +# define QT_RCC_MANGLE_NAMESPACE(name) name +#endif + +// GHS needs special handling to keep a symbol around. +#if defined(Q_CC_GHS) +# define Q_GHS_KEEP_REFERENCE(S) QT_DO_PRAGMA(ghs reference S ##__Fv) +#else +# define Q_GHS_KEEP_REFERENCE(S) +#endif + +// Macros to ensure a symbol is not dropped by the linker even if it's not used. +#define QT_DECLARE_EXTERN_SYMBOL(NAME, RETURN_TYPE) \ + extern RETURN_TYPE NAME(); \ + Q_GHS_KEEP_REFERENCE(NAME) + +#define QT_DECLARE_EXTERN_SYMBOL_INT(NAME) \ + QT_DECLARE_EXTERN_SYMBOL(NAME, int) + +#define QT_DECLARE_EXTERN_SYMBOL_VOID(NAME) \ + QT_DECLARE_EXTERN_SYMBOL(NAME, void) + +#define QT_KEEP_SYMBOL_VAR_NAME(NAME) NAME ## _keep + +#define QT_KEEP_SYMBOL_HELPER(NAME, VAR_NAME) \ + volatile auto VAR_NAME = &NAME; \ + Q_UNUSED(VAR_NAME) + +#define QT_KEEP_SYMBOL(NAME) \ + QT_KEEP_SYMBOL_HELPER(NAME, QT_KEEP_SYMBOL_VAR_NAME(NAME)) + + +// Similar to the ones above, but for rcc resource symbols specifically. +#define QT_GET_RESOURCE_INIT_SYMBOL(NAME) \ + QT_RCC_MANGLE_NAMESPACE(qInitResources_ ## NAME) + +#define QT_DECLARE_EXTERN_RESOURCE(NAME) \ + QT_DECLARE_EXTERN_SYMBOL_INT(QT_GET_RESOURCE_INIT_SYMBOL(NAME)) + +#define QT_KEEP_RESOURCE(NAME) \ + QT_KEEP_SYMBOL(QT_GET_RESOURCE_INIT_SYMBOL(NAME)) + +#endif // QTSYMBOLMACROS_H + diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qttranslation.h b/qt/6.8.1/msvc2022_64/include/QtCore/qttranslation.h new file mode 100644 index 0000000000000000000000000000000000000000..c6513263efc675d7a6603e17a40a7d004b691c04 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qttranslation.h @@ -0,0 +1,44 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTTRANSLATION_H +#define QTTRANSLATION_H + +#include // QT_NO_TRANSLATION should be defined here as well +#include + +#if 0 +#pragma qt_class(QtTranslation) +#pragma qt_sync_stop_processing +#endif + +QT_BEGIN_NAMESPACE + +class QString; + +#define QT_TR_NOOP(x) x +#define QT_TR_NOOP_UTF8(x) x +#define QT_TRANSLATE_NOOP(scope, x) x +#define QT_TRANSLATE_NOOP_UTF8(scope, x) x +#define QT_TRANSLATE_NOOP3(scope, x, comment) {x, comment} +#define QT_TRANSLATE_NOOP3_UTF8(scope, x, comment) {x, comment} + +#ifndef QT_NO_TRANSLATION + +#define QT_TR_N_NOOP(x) x +#define QT_TRANSLATE_N_NOOP(scope, x) x +#define QT_TRANSLATE_N_NOOP3(scope, x, comment) {x, comment} + +// Defined in qcoreapplication.cpp +// The better name qTrId() is reserved for an upcoming function which would +// return a much more powerful QStringFormatter instead of a QString. +Q_CORE_EXPORT QString qtTrId(const char *id, int n = -1); + +#define QT_TRID_NOOP(id) id +#define QT_TRID_N_NOOP(id) id + +QT_END_NAMESPACE + +#endif // QT_NO_TRANSLATION + +#endif /* QTTRANSLATION_H */ diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qttypetraits.h b/qt/6.8.1/msvc2022_64/include/QtCore/qttypetraits.h new file mode 100644 index 0000000000000000000000000000000000000000..f40b73b6a503513bc1be9cba49e63fc0e663709e --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qttypetraits.h @@ -0,0 +1,274 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTTYPETRAITS_H +#define QTTYPETRAITS_H + +#include +#include + +#include +#include +#include +#include +#include + +#if 0 +#pragma qt_class(QtTypeTraits) +#pragma qt_sync_stop_processing +#endif + +QT_BEGIN_NAMESPACE + +// like std::to_underlying +template +constexpr std::underlying_type_t qToUnderlying(Enum e) noexcept +{ + return static_cast>(e); +} + +#ifndef QT_NO_QASCONST +#if QT_DEPRECATED_SINCE(6, 6) + +// this adds const to non-const objects (like std::as_const) +template +QT_DEPRECATED_VERSION_X_6_6("Use std::as_const() instead.") +constexpr typename std::add_const::type &qAsConst(T &t) noexcept { return t; } +// prevent rvalue arguments: +template +void qAsConst(const T &&) = delete; + +#endif // QT_DEPRECATED_SINCE(6, 6) +#endif // QT_NO_QASCONST + +#ifndef QT_NO_QEXCHANGE + +// like std::exchange +template +constexpr T qExchange(T &t, U &&newValue) +noexcept(std::conjunction_v, + std::is_nothrow_assignable>) +{ + T old = std::move(t); + t = std::forward(newValue); + return old; +} + +#endif // QT_NO_QEXCHANGE + +namespace QtPrivate { +// helper to be used to trigger a "dependent static_assert(false)" +// (for instance, in a final `else` branch of a `if constexpr`.) +template struct type_dependent_false : std::false_type {}; +template struct value_dependent_false : std::false_type {}; +} + +namespace QTypeTraits { + +namespace detail { +template && std::is_arithmetic_v && + std::is_floating_point_v == std::is_floating_point_v && + std::is_signed_v == std::is_signed_v && + !std::is_same_v && !std::is_same_v && + !std::is_same_v && !std::is_same_v>> +struct Promoted +{ + using type = decltype(T() + U()); +}; +} + +template +using Promoted = typename detail::Promoted::type; + +/* + The templates below aim to find out whether one can safely instantiate an operator==() or + operator<() for a type. + + This is tricky for containers, as most containers have unconstrained comparison operators, even though they + rely on the corresponding operators for its content. + This is especially true for all of the STL template classes that have a comparison operator defined, and + leads to the situation, that the compiler would try to instantiate the operator, and fail if any + of its template arguments does not have the operator implemented. + + The code tries to cover the relevant cases for Qt and the STL, by checking (recusrsively) the value_type + of a container (if it exists), and checking the template arguments of pair, tuple and variant. +*/ +namespace detail { + +// find out whether T is a conteiner +// this is required to check the value type of containers for the existence of the comparison operator +template +struct is_container : std::false_type {}; +template +struct is_container().begin() != std::declval().end()), bool> +>> : std::true_type {}; + + +// Checks the existence of the comparison operator for the class itself +QT_WARNING_PUSH +QT_WARNING_DISABLE_FLOAT_COMPARE +template +struct has_operator_equal : std::false_type {}; +template +struct has_operator_equal() == std::declval()))>> + : std::true_type {}; +QT_WARNING_POP + +// Two forward declarations +template::value> +struct expand_operator_equal_container; +template +struct expand_operator_equal_tuple; + +// the entry point for the public method +template +using expand_operator_equal = expand_operator_equal_container; + +// if T isn't a container check if it's a tuple like object +template +struct expand_operator_equal_container : expand_operator_equal_tuple {}; +// if T::value_type exists, check first T::value_type, then T itself +template +struct expand_operator_equal_container : + std::conjunction< + std::disjunction< + std::is_same, // avoid endless recursion + expand_operator_equal + >, expand_operator_equal_tuple> {}; + +// recursively check the template arguments of a tuple like object +template +using expand_operator_equal_recursive = std::conjunction...>; + +template +struct expand_operator_equal_tuple : has_operator_equal {}; +template +struct expand_operator_equal_tuple> : expand_operator_equal_recursive {}; +template +struct expand_operator_equal_tuple> : expand_operator_equal_recursive {}; +template +struct expand_operator_equal_tuple> : expand_operator_equal_recursive {}; +template +struct expand_operator_equal_tuple> : expand_operator_equal_recursive {}; + +// the same for operator<(), see above for explanations +template +struct has_operator_less_than : std::false_type{}; +template +struct has_operator_less_than() < std::declval()))>> + : std::true_type{}; + +template::value> +struct expand_operator_less_than_container; +template +struct expand_operator_less_than_tuple; + +template +using expand_operator_less_than = expand_operator_less_than_container; + +template +struct expand_operator_less_than_container : expand_operator_less_than_tuple {}; +template +struct expand_operator_less_than_container : + std::conjunction< + std::disjunction< + std::is_same, + expand_operator_less_than + >, expand_operator_less_than_tuple + > {}; + +template +using expand_operator_less_than_recursive = std::conjunction...>; + +template +struct expand_operator_less_than_tuple : has_operator_less_than {}; +template +struct expand_operator_less_than_tuple> : expand_operator_less_than_recursive {}; +template +struct expand_operator_less_than_tuple> : expand_operator_less_than_recursive {}; +template +struct expand_operator_less_than_tuple> : expand_operator_less_than_recursive {}; +template +struct expand_operator_less_than_tuple> : expand_operator_less_than_recursive {}; + +} + +template +struct is_dereferenceable : std::false_type {}; + +template +struct is_dereferenceable().operator->())> > + : std::true_type {}; + +template +inline constexpr bool is_dereferenceable_v = is_dereferenceable::value; + +template +struct has_operator_equal : detail::expand_operator_equal {}; +template +inline constexpr bool has_operator_equal_v = has_operator_equal::value; + +template +using has_operator_equal_container = std::disjunction, QTypeTraits::has_operator_equal>; + +template +struct has_operator_less_than : detail::expand_operator_less_than {}; +template +inline constexpr bool has_operator_less_than_v = has_operator_less_than::value; + +template +using has_operator_less_than_container = std::disjunction, QTypeTraits::has_operator_less_than>; + +template +using compare_eq_result = std::enable_if_t...>, bool>; + +template +using compare_eq_result_container = std::enable_if_t...>, bool>; + +template +using compare_lt_result = std::enable_if_t...>, bool>; + +template +using compare_lt_result_container = std::enable_if_t...>, bool>; + +namespace detail { + +template +const T &const_reference(); +template +T &reference(); + +} + +template +struct has_ostream_operator : std::false_type {}; +template +struct has_ostream_operator() << detail::const_reference())>> + : std::true_type {}; +template +inline constexpr bool has_ostream_operator_v = has_ostream_operator::value; + +template +using has_ostream_operator_container = std::disjunction, QTypeTraits::has_ostream_operator>; + +template +struct has_istream_operator : std::false_type {}; +template +struct has_istream_operator() >> detail::reference())>> + : std::true_type {}; +template +inline constexpr bool has_istream_operator_v = has_istream_operator::value; +template +using has_istream_operator_container = std::disjunction, QTypeTraits::has_istream_operator>; + +template +inline constexpr bool has_stream_operator_v = has_ostream_operator_v && has_istream_operator_v; + +} // namespace QTypeTraits + +QT_END_NAMESPACE + +#endif // QTTYPETRAITS_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtversion.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtversion.h new file mode 100644 index 0000000000000000000000000000000000000000..d8486b69cfecd766a2129ab04768c3f01bc8285e --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtversion.h @@ -0,0 +1,38 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTVERSION_H +#define QTVERSION_H + +#if 0 +#pragma qt_class(QtVersion) +#pragma qt_sync_stop_processing +#endif + +#ifndef __ASSEMBLER__ + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +/* + * If we're compiling C++ code: + * - and this is a non-namespace build, declare qVersion as extern "C" + * - and this is a namespace build, declare it as a regular function + * (we're already inside QT_BEGIN_NAMESPACE / QT_END_NAMESPACE) + * If we're compiling C code, simply declare the function. If Qt was compiled + * in a namespace, qVersion isn't callable anyway. + */ +#if !defined(QT_NAMESPACE) && defined(__cplusplus) && !defined(Q_QDOC) +extern "C" +#endif +/* defined in qlibraryinfo.cpp */ +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char *qVersion(void) Q_DECL_NOEXCEPT; + +QT_END_NAMESPACE + +#endif // __ASSEMBLER__ + +#endif // QTVERSION_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtversionchecks.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtversionchecks.h new file mode 100644 index 0000000000000000000000000000000000000000..75c8c383a04a165fd82a5d0f164b4173d841fb23 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtversionchecks.h @@ -0,0 +1,114 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTVERSIONCHECKS_H +#define QTVERSIONCHECKS_H + +#if 0 +#pragma qt_class(QtVersionChecks) +#pragma qt_sync_stop_processing +#endif + +#include + +/* + QT_VERSION is (major << 16) | (minor << 8) | patch. +*/ +#define QT_VERSION QT_VERSION_CHECK(QT_VERSION_MAJOR, QT_VERSION_MINOR, QT_VERSION_PATCH) +/* + can be used like #if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)) +*/ +#define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) + +/* + Helper macros to make some simple code active in Qt 6 or Qt 7 only, + like: + struct QT6_ONLY(Q_CORE_EXPORT) QTrivialClass + { + void QT7_ONLY(Q_CORE_EXPORT) void operate(); + } +*/ +#if QT_VERSION_MAJOR == 7 || defined(QT_BOOTSTRAPPED) +# define QT7_ONLY(...) __VA_ARGS__ +# define QT6_ONLY(...) +#elif QT_VERSION_MAJOR == 6 +# define QT7_ONLY(...) +# define QT6_ONLY(...) __VA_ARGS__ +#else +# error Qt major version not 6 or 7 +#endif + +/* Macro and tag type to help overload resolution on functions + that are, e.g., QT_REMOVED_SINCE'ed. Example use: + + #if QT_CORE_REMOVED_SINCE(6, 4) + int size() const; + #endif + qsizetype size(QT6_DECL_NEW_OVERLOAD) const; + + in the normal cpp file: + + qsizetype size(QT6_IMPL_NEW_OVERLOAD) const { + ~~~ + } + + in removed_api.cpp: + + int size() const { return int(size(QT6_CALL_NEW_OVERLOAD)); } +*/ +#ifdef Q_QDOC +# define QT6_DECL_NEW_OVERLOAD +# define QT6_DECL_NEW_OVERLOAD_TAIL +# define QT6_IMPL_NEW_OVERLOAD +# define QT6_IMPL_NEW_OVERLOAD_TAIL +# define QT6_CALL_NEW_OVERLOAD +# define QT6_CALL_NEW_OVERLOAD_TAIL +#else +# define QT6_DECL_NEW_OVERLOAD QT6_ONLY(Qt::Disambiguated_t = Qt::Disambiguated) +# define QT6_DECL_NEW_OVERLOAD_TAIL QT6_ONLY(, QT6_DECL_NEW_OVERLOAD) +# define QT6_IMPL_NEW_OVERLOAD QT6_ONLY(Qt::Disambiguated_t) +# define QT6_IMPL_NEW_OVERLOAD_TAIL QT6_ONLY(, QT6_IMPL_NEW_OVERLOAD) +# define QT6_CALL_NEW_OVERLOAD QT6_ONLY(Qt::Disambiguated) +# define QT6_CALL_NEW_OVERLOAD_TAIL QT6_ONLY(, QT6_CALL_NEW_OVERLOAD) +#endif + +/* + Macro to tag Tech Preview APIs. + It expands to nothing, because we want to use it in places where + nothing is generally allowed (not even an attribute); for instance: + to tag other macros, Q_PROPERTY declarations, and so on. + + Still: use it as if it were an C++ attribute. + + To mark a class as TP: + class QT_TECH_PREVIEW_API Q_CORE_EXPORT QClass { ... }; + + To mark a function: + QT_TECH_PREVIEW_API void qFunction(); + + To mark an enumeration or enumerator: + enum class QT_TECH_PREVIEW_API QEnum { + Enum1, + Enum2 QT_TECH_PREVIEW_API, + }; + + To mark parts of a class: + class QClass : public QObject + { + // Q_OBJECT omitted d/t QTBUG-123229 + + QT_TECH_PREVIEW_API + Q_PROPERTY(int countNG ...) // this is TP + + Q_PROPERTY(int count ...) // this is stable API + + public: + QT_TECH_PREVIEW_API + void f(); // TP + + void g(); // stable + }; +*/ +#define QT_TECH_PREVIEW_API + +#endif /* QTVERSIONCHECKS_H */ diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtypeinfo.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtypeinfo.h new file mode 100644 index 0000000000000000000000000000000000000000..f747ea00f37c11bf6aee10340200b74f8ff46bba --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtypeinfo.h @@ -0,0 +1,187 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTYPEINFO_H +#define QTYPEINFO_H + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QDebug; + +/* + QTypeInfo - type trait functionality +*/ + +namespace QtPrivate { + +// A trivially copyable class must also have a trivial, non-deleted +// destructor [class.prop/1.3], CWG1734. Some implementations don't +// check for a trivial destructor, because of backwards compatibility +// with C++98's definition of trivial copyability. +// Since trivial copiability has implications for the ABI, implementations +// can't "just fix" their traits. So, although formally redundant, we +// explicitly check for trivial destruction here. +template +inline constexpr bool qIsRelocatable = std::is_trivially_copyable_v && std::is_trivially_destructible_v; + +// Denotes types that are trivially default constructible, and for which +// value-initialization can be achieved by filling their storage with 0 bits. +// There is no type trait we can use for this, so we hardcode a list of +// possibilities that we know are OK on the architectures that we support. +// The most notable exception are pointers to data members, which for instance +// on the Itanium ABI are initialized to -1. +template +inline constexpr bool qIsValueInitializationBitwiseZero = + std::is_scalar_v && !std::is_member_object_pointer_v; + +} + +/* + The catch-all template. +*/ + +template +class QTypeInfo +{ +public: + enum { + isPointer [[deprecated("Use std::is_pointer instead")]] = std::is_pointer_v, + isIntegral [[deprecated("Use std::is_integral instead")]] = std::is_integral_v, + isComplex = !std::is_trivial_v, + isRelocatable = QtPrivate::qIsRelocatable, + isValueInitializationBitwiseZero = QtPrivate::qIsValueInitializationBitwiseZero, + }; +}; + +template<> +class QTypeInfo +{ +public: + enum { + isPointer [[deprecated("Use std::is_pointer instead")]] = false, + isIntegral [[deprecated("Use std::is_integral instead")]] = false, + isComplex = false, + isRelocatable = false, + isValueInitializationBitwiseZero = false, + }; +}; + +/*! + \class QTypeInfoMerger + \inmodule QtCore + \internal + + \brief QTypeInfoMerger merges the QTypeInfo flags of T1, T2... and presents them + as a QTypeInfo would do. + + Let's assume that we have a simple set of structs: + + \snippet code/src_corelib_global_qglobal.cpp 50 + + To create a proper QTypeInfo specialization for A struct, we have to check + all sub-components; B, C and D, then take the lowest common denominator and call + Q_DECLARE_TYPEINFO with the resulting flags. An easier and less fragile approach is to + use QTypeInfoMerger, which does that automatically. So struct A would have + the following QTypeInfo definition: + + \snippet code/src_corelib_global_qglobal.cpp 51 +*/ +template +class QTypeInfoMerger +{ + static_assert(sizeof...(Ts) > 0); +public: + static constexpr bool isComplex = ((QTypeInfo::isComplex) || ...); + static constexpr bool isRelocatable = ((QTypeInfo::isRelocatable) && ...); + [[deprecated("Use std::is_pointer instead")]] static constexpr bool isPointer = false; + [[deprecated("Use std::is_integral instead")]] static constexpr bool isIntegral = false; + static constexpr bool isValueInitializationBitwiseZero = false; + static_assert(!isRelocatable || + std::is_copy_constructible_v || + std::is_move_constructible_v, + "All Ts... are Q_RELOCATABLE_TYPE, but T is neither copy- nor move-constructible, " + "so cannot be Q_RELOCATABLE_TYPE. Please mark T as Q_COMPLEX_TYPE manually."); +}; + +// QTypeInfo for std::pair: +// std::pair is spec'ed to be struct { T1 first; T2 second; }, so, unlike tuple<>, +// we _can_ specialize QTypeInfo for pair<>: +template +class QTypeInfo> : public QTypeInfoMerger, T1, T2> {}; + +#define Q_DECLARE_MOVABLE_CONTAINER(CONTAINER) \ +template \ +class QTypeInfo> \ +{ \ +public: \ + enum { \ + isPointer [[deprecated("Use std::is_pointer instead")]] = false, \ + isIntegral [[deprecated("Use std::is_integral instead")]] = false, \ + isComplex = true, \ + isRelocatable = true, \ + isValueInitializationBitwiseZero = false, \ + }; \ +} + +Q_DECLARE_MOVABLE_CONTAINER(QList); +Q_DECLARE_MOVABLE_CONTAINER(QQueue); +Q_DECLARE_MOVABLE_CONTAINER(QStack); +Q_DECLARE_MOVABLE_CONTAINER(QSet); +Q_DECLARE_MOVABLE_CONTAINER(QMap); +Q_DECLARE_MOVABLE_CONTAINER(QMultiMap); +Q_DECLARE_MOVABLE_CONTAINER(QHash); +Q_DECLARE_MOVABLE_CONTAINER(QMultiHash); +Q_DECLARE_MOVABLE_CONTAINER(QCache); + +#undef Q_DECLARE_MOVABLE_CONTAINER + +/* + Specialize a specific type with: + + Q_DECLARE_TYPEINFO(type, flags); + + where 'type' is the name of the type to specialize and 'flags' is + logically-OR'ed combination of the flags below. +*/ +enum { /* TYPEINFO flags */ + Q_COMPLEX_TYPE = 0, + Q_PRIMITIVE_TYPE = 0x1, + Q_RELOCATABLE_TYPE = 0x2, + Q_MOVABLE_TYPE = 0x2, + Q_DUMMY_TYPE = 0x4, +}; + +#define Q_DECLARE_TYPEINFO_BODY(TYPE, FLAGS) \ +class QTypeInfo \ +{ \ +public: \ + enum { \ + isComplex = (((FLAGS) & Q_PRIMITIVE_TYPE) == 0) && !std::is_trivial_v, \ + isRelocatable = !isComplex || ((FLAGS) & Q_RELOCATABLE_TYPE) || QtPrivate::qIsRelocatable, \ + isPointer [[deprecated("Use std::is_pointer instead")]] = std::is_pointer_v< TYPE >, \ + isIntegral [[deprecated("Use std::is_integral instead")]] = std::is_integral< TYPE >::value, \ + isValueInitializationBitwiseZero = QtPrivate::qIsValueInitializationBitwiseZero, \ + }; \ + static_assert(!isRelocatable || \ + std::is_copy_constructible_v || \ + std::is_move_constructible_v, \ + #TYPE " is neither copy- nor move-constructible, so cannot be Q_RELOCATABLE_TYPE"); \ +} + +#define Q_DECLARE_TYPEINFO(TYPE, FLAGS) \ +template<> \ +Q_DECLARE_TYPEINFO_BODY(TYPE, FLAGS) + +/* Specialize QTypeInfo for QFlags */ +template class QFlags; +template +Q_DECLARE_TYPEINFO_BODY(QFlags, Q_PRIMITIVE_TYPE); + +QT_END_NAMESPACE +#endif // QTYPEINFO_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtyperevision.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtyperevision.h new file mode 100644 index 0000000000000000000000000000000000000000..935137d5b6b79a81dd1d349b53ba41d464724a1a --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtyperevision.h @@ -0,0 +1,169 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2022 Intel Corporation. +// Copyright (C) 2015 Keith Gardner +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTYPEREVISION_H +#define QTYPEREVISION_H + +#include +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QDataStream; +class QDebug; + +class QTypeRevision; +Q_CORE_EXPORT size_t qHash(const QTypeRevision &key, size_t seed = 0); + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream& operator<<(QDataStream &out, const QTypeRevision &revision); +Q_CORE_EXPORT QDataStream& operator>>(QDataStream &in, QTypeRevision &revision); +#endif + +class QTypeRevision +{ +public: + template + using if_valid_segment_type = typename std::enable_if< + std::is_integral::value, bool>::type; + + template + using if_valid_value_type = typename std::enable_if< + std::is_integral::value + && (sizeof(Integer) > sizeof(quint16) + || (sizeof(Integer) == sizeof(quint16) + && !std::is_signed::value)), bool>::type; + + template = true> + static constexpr bool isValidSegment(Integer segment) + { + // using extra parentheses around max to avoid expanding it if it is a macro + // and adding zero to cause it to be promoted + constexpr auto Max = (std::numeric_limits::max)() + 0; + constexpr bool HasSufficientRange = Max >= SegmentUnknown; + return segment >= Integer(0) + && (!HasSufficientRange || segment < Integer(SegmentUnknown)); + } + + template = true, + if_valid_segment_type = true> + static constexpr QTypeRevision fromVersion(Major majorVersion, Minor minorVersion) + { + return Q_ASSERT(isValidSegment(majorVersion)), + Q_ASSERT(isValidSegment(minorVersion)), + QTypeRevision(quint8(majorVersion), quint8(minorVersion)); + } + + template = true> + static constexpr QTypeRevision fromMajorVersion(Major majorVersion) + { + return Q_ASSERT(isValidSegment(majorVersion)), + QTypeRevision(quint8(majorVersion), SegmentUnknown); + } + + template = true> + static constexpr QTypeRevision fromMinorVersion(Minor minorVersion) + { + return Q_ASSERT(isValidSegment(minorVersion)), + QTypeRevision(SegmentUnknown, quint8(minorVersion)); + } + + template = true> + static constexpr QTypeRevision fromEncodedVersion(Integer value) + { + return Q_ASSERT((value & ~Integer(0xffff)) == Integer(0)), + QTypeRevision((value & Integer(0xff00)) >> 8, value & Integer(0xff)); + } + + static constexpr QTypeRevision zero() { return QTypeRevision(0, 0); } + + constexpr QTypeRevision() = default; + + constexpr bool hasMajorVersion() const { return m_majorVersion != SegmentUnknown; } + constexpr quint8 majorVersion() const { return m_majorVersion; } + + constexpr bool hasMinorVersion() const { return m_minorVersion != SegmentUnknown; } + constexpr quint8 minorVersion() const { return m_minorVersion; } + + constexpr bool isValid() const { return hasMajorVersion() || hasMinorVersion(); } + + template = true> + constexpr Integer toEncodedVersion() const + { + return Integer(m_majorVersion << 8) | Integer(m_minorVersion); + } + +private: + friend constexpr bool + comparesEqual(const QTypeRevision &lhs, const QTypeRevision &rhs) noexcept + { return lhs.toEncodedVersion() == rhs.toEncodedVersion(); } + friend constexpr Qt::strong_ordering + compareThreeWay(const QTypeRevision &lhs, const QTypeRevision &rhs) noexcept + { + // For both major and minor the following rule applies: + // non-0 ver > unspecified ver > 0 ver + auto cmpUnspecified = [](quint8 leftVer, quint8 rightVer) { + Q_ASSERT(leftVer != rightVer + && (leftVer == QTypeRevision::SegmentUnknown + || rightVer == QTypeRevision::SegmentUnknown)); + if (leftVer != QTypeRevision::SegmentUnknown) + return leftVer > 0 ? Qt::strong_ordering::greater : Qt::strong_ordering::less; + return rightVer > 0 ? Qt::strong_ordering::less : Qt::strong_ordering::greater; + }; + + if (lhs.hasMajorVersion() != rhs.hasMajorVersion()) { + return cmpUnspecified(lhs.majorVersion(), rhs.majorVersion()); + } else { + const auto majorRes = Qt::compareThreeWay(lhs.majorVersion(), rhs.majorVersion()); + if (is_eq(majorRes)) { + if (lhs.hasMinorVersion() != rhs.hasMinorVersion()) + return cmpUnspecified(lhs.minorVersion(), rhs.minorVersion()); + return Qt::compareThreeWay(lhs.minorVersion(), rhs.minorVersion()); + } + return majorRes; + } + } + Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE(QTypeRevision) + + enum { SegmentUnknown = 0xff }; + +#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN + constexpr QTypeRevision(quint8 major, quint8 minor) + : m_minorVersion(minor), m_majorVersion(major) {} + + quint8 m_minorVersion = SegmentUnknown; + quint8 m_majorVersion = SegmentUnknown; +#else + constexpr QTypeRevision(quint8 major, quint8 minor) + : m_majorVersion(major), m_minorVersion(minor) {} + + quint8 m_majorVersion = SegmentUnknown; + quint8 m_minorVersion = SegmentUnknown; +#endif +}; + +static_assert(sizeof(QTypeRevision) == 2); +Q_DECLARE_TYPEINFO(QTypeRevision, Q_RELOCATABLE_TYPE); + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QTypeRevision &revision); +#endif + +QT_END_NAMESPACE + +QT_DECL_METATYPE_EXTERN(QTypeRevision, Q_CORE_EXPORT) + +#endif // QTYPEREVISION_H + +#if !defined(QT_LEAN_HEADERS) || QT_LEAN_HEADERS < 2 +// make QVersionNumber available from +#include +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qtypes.h b/qt/6.8.1/msvc2022_64/include/QtCore/qtypes.h new file mode 100644 index 0000000000000000000000000000000000000000..dd8f884b244f2e937f70a2f33df9235b68a35480 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qtypes.h @@ -0,0 +1,300 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// Copyright (C) 2022 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTYPES_H +#define QTYPES_H + +#include +#include +#include +#include + +#ifdef __cplusplus +# include +# if defined(_HAS_STD_BYTE) && _HAS_STD_BYTE == 0 +# error "Qt requires std::byte, but _HAS_STD_BYTE has been set to 0" +# endif +# include +# if defined(__STDCPP_FLOAT16_T__) && __has_include() +// P1467 implementation - https://wg21.link/p1467 +# include +# endif // defined(__STDCPP_FLOAT16_T__) && __has_include() +# include +#else +# include +#endif + +#if 0 +#pragma qt_class(QtTypes) +#pragma qt_class(QIntegerForSize) +#pragma qt_sync_stop_processing +#endif + +/* + Useful type definitions for Qt +*/ +typedef unsigned char uchar; +typedef unsigned short ushort; +typedef unsigned int uint; +typedef unsigned long ulong; + +QT_BEGIN_NAMESPACE + +/* + Size-dependent types (architecture-dependent byte order) + + Make sure to update QMetaType when changing these typedefs +*/ + +typedef signed char qint8; /* 8 bit signed */ +typedef unsigned char quint8; /* 8 bit unsigned */ +typedef short qint16; /* 16 bit signed */ +typedef unsigned short quint16; /* 16 bit unsigned */ +typedef int qint32; /* 32 bit signed */ +typedef unsigned int quint32; /* 32 bit unsigned */ +// Unlike LL / ULL in C++, for historical reasons, we force the +// result to be of the requested type. +#ifdef __cplusplus +# define Q_INT64_C(c) static_cast(c ## LL) /* signed 64 bit constant */ +# define Q_UINT64_C(c) static_cast(c ## ULL) /* unsigned 64 bit constant */ +#else +# define Q_INT64_C(c) ((long long)(c ## LL)) /* signed 64 bit constant */ +# define Q_UINT64_C(c) ((unsigned long long)(c ## ULL)) /* unsigned 64 bit constant */ +#endif +typedef long long qint64; /* 64 bit signed */ +typedef unsigned long long quint64; /* 64 bit unsigned */ + +typedef qint64 qlonglong; +typedef quint64 qulonglong; + +#ifdef Q_QDOC // QDoc always needs to see the typedefs +# define QT_SUPPORTS_INT128 16 +#elif defined(QT_COMPILER_SUPPORTS_INT128) && !defined(QT_NO_INT128) +# define QT_SUPPORTS_INT128 QT_COMPILER_SUPPORTS_INT128 +# if defined(__GLIBCXX__) && defined(__STRICT_ANSI__) // -ansi/-std=c++NN instead of gnu++NN +# undef QT_SUPPORTS_INT128 // breaks on libstdc++ +# endif +# if defined(__clang__) && defined(_MSVC_STL_VERSION) // Clang with MSVC's STL +# undef QT_SUPPORTS_INT128 // MSVC's STL doesn't support int128 +# endif +#else +# undef QT_SUPPORTS_INT128 +#endif + +#if defined(QT_SUPPORTS_INT128) +__extension__ typedef __int128_t qint128; +__extension__ typedef __uint128_t quint128; + +#ifdef __cplusplus +static_assert(std::is_signed_v, + "Qt requires and to work for q(u)int128."); +#endif + +// limits: +# ifdef __cplusplus /* need to avoid c-style-casts in C++ mode */ +# define QT_C_STYLE_CAST(type, x) static_cast(x) +# else /* but C doesn't have constructor-style casts */ +# define QT_C_STYLE_CAST(type, x) ((type)(x)) +# endif +# ifndef Q_UINT128_MAX /* allow qcompilerdetection.h/user override */ +# define Q_UINT128_MAX QT_C_STYLE_CAST(quint128, -1) +# endif +# define Q_INT128_MAX QT_C_STYLE_CAST(qint128, Q_UINT128_MAX / 2) +# define Q_INT128_MIN (-Q_INT128_MAX - 1) + +# ifdef __cplusplus + namespace QtPrivate::NumberLiterals { + namespace detail { + template + constexpr quint128 construct() { return accu; } + + template + constexpr quint128 construct() + { + if constexpr (C != '\'') { // ignore digit separators + const int digitValue = '0' <= C && C <= '9' ? C - '0' : + 'a' <= C && C <= 'z' ? C - 'a' + 10 : + 'A' <= C && C <= 'Z' ? C - 'A' + 10 : + /* else */ -1 ; + static_assert(digitValue >= 0 && digitValue < base, + "Invalid character"); + // accu * base + digitValue <= MAX, but without overflow: + static_assert(accu <= (Q_UINT128_MAX - digitValue) / base, + "Overflow occurred"); + return construct(); + } else { + return construct(); + } + } + + template + constexpr quint128 parse0xb() + { + constexpr quint128 accu = 0; + if constexpr (C == 'x' || C == 'X') + return construct(); // base 16, skip 'x' + else if constexpr (C == 'b' || C == 'B') + return construct(); // base 2, skip 'b' + else + return construct(); // base 8, include C + } + + template + constexpr quint128 parse0() + { + if constexpr (sizeof...(Cs) == 0) // this was just a literal 0 + return 0; + else + return parse0xb(); + } + + template + constexpr quint128 parse() + { + if constexpr (C == '0') + return parse0(); // base 2, 8, or 16 (or just a literal 0), skip '0' + else + return construct<0, 10, C, Cs...>(); // initial accu 0, base 10, include C + } + } // namespace detail + template + constexpr quint128 operator""_quint128() noexcept + { return QtPrivate::NumberLiterals::detail::parse(); } + template + constexpr qint128 operator""_qint128() noexcept + { return qint128(QtPrivate::NumberLiterals::detail::parse()); } + + #ifndef Q_UINT128_C // allow qcompilerdetection.h/user override + # define Q_UINT128_C(c) ([]{ using namespace QtPrivate::NumberLiterals; return c ## _quint128; }()) + #endif + #ifndef Q_INT128_C // allow qcompilerdetection.h/user override + # define Q_INT128_C(c) ([]{ using namespace QtPrivate::NumberLiterals; return c ## _qint128; }()) + #endif + + } // namespace QtPrivate::NumberLiterals +# endif // __cplusplus +#endif // QT_SUPPORTS_INT128 + +#ifndef __cplusplus +// In C++ mode, we define below using QIntegerForSize template +static_assert(sizeof(ptrdiff_t) == sizeof(size_t), "Weird ptrdiff_t and size_t definitions"); +typedef ptrdiff_t qptrdiff; +typedef ptrdiff_t qsizetype; +typedef ptrdiff_t qintptr; +typedef size_t quintptr; + +#define PRIdQPTRDIFF "td" +#define PRIiQPTRDIFF "ti" + +#define PRIdQSIZETYPE "td" +#define PRIiQSIZETYPE "ti" + +#define PRIdQINTPTR "td" +#define PRIiQINTPTR "ti" + +#define PRIuQUINTPTR "zu" +#define PRIoQUINTPTR "zo" +#define PRIxQUINTPTR "zx" +#define PRIXQUINTPTR "zX" +#endif + +#if defined(QT_COORD_TYPE) +typedef QT_COORD_TYPE qreal; +#else +typedef double qreal; +#endif + +#if defined(__cplusplus) +/* + quintptr are qptrdiff is guaranteed to be the same size as a pointer, i.e. + + sizeof(void *) == sizeof(quintptr) + && sizeof(void *) == sizeof(qptrdiff) + + While size_t and qsizetype are not guaranteed to be the same size as a pointer, + they usually are and we do check for that in qtypes.cpp, just to be sure. +*/ +template struct QIntegerForSize; +template <> struct QIntegerForSize<1> { typedef quint8 Unsigned; typedef qint8 Signed; }; +template <> struct QIntegerForSize<2> { typedef quint16 Unsigned; typedef qint16 Signed; }; +template <> struct QIntegerForSize<4> { typedef quint32 Unsigned; typedef qint32 Signed; }; +template <> struct QIntegerForSize<8> { typedef quint64 Unsigned; typedef qint64 Signed; }; +#if defined(QT_SUPPORTS_INT128) +template <> struct QIntegerForSize<16> { typedef quint128 Unsigned; typedef qint128 Signed; }; +#endif +template struct QIntegerForSizeof: QIntegerForSize { }; +typedef QIntegerForSize::Signed qregisterint; +typedef QIntegerForSize::Unsigned qregisteruint; +typedef QIntegerForSizeof::Unsigned quintptr; +typedef QIntegerForSizeof::Signed qptrdiff; +typedef qptrdiff qintptr; +using qsizetype = QIntegerForSizeof::Signed; + +// These custom definitions are necessary as we're not defining our +// datatypes in terms of the language ones, but in terms of integer +// types that have the sime size. For instance, on a 32-bit platform, +// qptrdiff is int, while ptrdiff_t may be aliased to long; therefore +// using %td to print a qptrdiff would be wrong (and raise -Wformat +// warnings), although both int and long have same bit size on that +// platform. +// +// We know that sizeof(size_t) == sizeof(void *) == sizeof(qptrdiff). +#if SIZE_MAX == 0xffffffffULL +#define PRIuQUINTPTR "u" +#define PRIoQUINTPTR "o" +#define PRIxQUINTPTR "x" +#define PRIXQUINTPTR "X" + +#define PRIdQPTRDIFF "d" +#define PRIiQPTRDIFF "i" + +#define PRIdQINTPTR "d" +#define PRIiQINTPTR "i" + +#define PRIdQSIZETYPE "d" +#define PRIiQSIZETYPE "i" +#elif SIZE_MAX == 0xffffffffffffffffULL +#define PRIuQUINTPTR "llu" +#define PRIoQUINTPTR "llo" +#define PRIxQUINTPTR "llx" +#define PRIXQUINTPTR "llX" + +#define PRIdQPTRDIFF "lld" +#define PRIiQPTRDIFF "lli" + +#define PRIdQINTPTR "lld" +#define PRIiQINTPTR "lli" + +#define PRIdQSIZETYPE "lld" +#define PRIiQSIZETYPE "lli" +#else +#error Unsupported platform (unknown value for SIZE_MAX) +#endif + +// Define a native float16 type +namespace QtPrivate { +#if defined(__STDCPP_FLOAT16_T__) +# define QFLOAT16_IS_NATIVE 1 +using NativeFloat16Type = std::float16_t; +#elif defined(Q_CC_CLANG) && defined(__FLT16_MAX__) && 0 +// disabled due to https://github.com/llvm/llvm-project/issues/56963 +# define QFLOAT16_IS_NATIVE 1 +using NativeFloat16Type = decltype(__FLT16_MAX__); +#elif defined(Q_CC_GNU_ONLY) && defined(__FLT16_MAX__) && defined(__ARM_FP16_FORMAT_IEEE) +# define QFLOAT16_IS_NATIVE 1 +using NativeFloat16Type = __fp16; +#elif defined(Q_CC_GNU_ONLY) && defined(__FLT16_MAX__) && defined(__SSE2__) +# define QFLOAT16_IS_NATIVE 1 +using NativeFloat16Type = _Float16; +#else +# define QFLOAT16_IS_NATIVE 0 +using NativeFloat16Type = void; +#endif +} // QtPrivate + +#endif // __cplusplus + +QT_END_NAMESPACE + +#endif // QTYPES_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qurl.h b/qt/6.8.1/msvc2022_64/include/QtCore/qurl.h new file mode 100644 index 0000000000000000000000000000000000000000..5efcf0f08de74582fd32c2a1174128fb3987af98 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qurl.h @@ -0,0 +1,333 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QURL_H +#define QURL_H + +#include +#include +#include +#include +#include +#include + +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) +Q_FORWARD_DECLARE_CF_TYPE(CFURL); +Q_FORWARD_DECLARE_OBJC_CLASS(NSURL); +#endif + +QT_BEGIN_NAMESPACE + + +class QUrlQuery; +class QUrlPrivate; +class QDataStream; + +template +class QUrlTwoFlags +{ + int i; +public: + constexpr inline QUrlTwoFlags() : i(0) {} + constexpr inline QUrlTwoFlags(E1 f) : i(f) {} + constexpr inline QUrlTwoFlags(E2 f) : i(f) {} + constexpr inline QUrlTwoFlags(QFlag f) : i(f) {} + constexpr inline QUrlTwoFlags(QFlags f) : i(f.operator typename QFlags::Int()) {} + constexpr inline QUrlTwoFlags(QFlags f) : i(f.operator typename QFlags::Int()) {} + + inline QUrlTwoFlags &operator&=(int mask) { i &= mask; return *this; } + inline QUrlTwoFlags &operator&=(uint mask) { i &= mask; return *this; } + inline QUrlTwoFlags &operator&=(QFlags mask) { i &= mask.toInt(); return *this; } + inline QUrlTwoFlags &operator&=(QFlags mask) { i &= mask.toInt(); return *this; } + inline QUrlTwoFlags &operator|=(QUrlTwoFlags f) { i |= f.i; return *this; } + inline QUrlTwoFlags &operator|=(E1 f) { i |= f; return *this; } + inline QUrlTwoFlags &operator|=(E2 f) { i |= f; return *this; } + inline QUrlTwoFlags &operator|=(QFlags mask) { i |= mask.toInt(); return *this; } + inline QUrlTwoFlags &operator|=(QFlags mask) { i |= mask.toInt(); return *this; } + inline QUrlTwoFlags &operator^=(QUrlTwoFlags f) { i ^= f.i; return *this; } + inline QUrlTwoFlags &operator^=(E1 f) { i ^= f; return *this; } + inline QUrlTwoFlags &operator^=(E2 f) { i ^= f; return *this; } + inline QUrlTwoFlags &operator^=(QFlags mask) { i ^= mask.toInt(); return *this; } + inline QUrlTwoFlags &operator^=(QFlags mask) { i ^= mask.toInt(); return *this; } + + constexpr inline operator QFlags() const { return QFlag(i); } + constexpr inline operator QFlags() const { return QFlag(i); } + constexpr inline operator int() const { return i; } + constexpr inline bool operator!() const { return !i; } + + constexpr inline QUrlTwoFlags operator|(QUrlTwoFlags f) const + { return QUrlTwoFlags(QFlag(i | f.i)); } + constexpr inline QUrlTwoFlags operator|(E1 f) const + { return QUrlTwoFlags(QFlag(i | f)); } + constexpr inline QUrlTwoFlags operator|(E2 f) const + { return QUrlTwoFlags(QFlag(i | f)); } + constexpr inline QUrlTwoFlags operator^(QUrlTwoFlags f) const + { return QUrlTwoFlags(QFlag(i ^ f.i)); } + constexpr inline QUrlTwoFlags operator^(E1 f) const + { return QUrlTwoFlags(QFlag(i ^ f)); } + constexpr inline QUrlTwoFlags operator^(E2 f) const + { return QUrlTwoFlags(QFlag(i ^ f)); } + constexpr inline QUrlTwoFlags operator&(int mask) const + { return QUrlTwoFlags(QFlag(i & mask)); } + constexpr inline QUrlTwoFlags operator&(uint mask) const + { return QUrlTwoFlags(QFlag(i & mask)); } + constexpr inline QUrlTwoFlags operator&(E1 f) const + { return QUrlTwoFlags(QFlag(i & f)); } + constexpr inline QUrlTwoFlags operator&(E2 f) const + { return QUrlTwoFlags(QFlag(i & f)); } + constexpr inline QUrlTwoFlags operator~() const + { return QUrlTwoFlags(QFlag(~i)); } + + constexpr inline bool testFlag(E1 f) const { return (i & f) == f && (f != 0 || i == int(f)); } + constexpr inline bool testFlag(E2 f) const { return (i & f) == f && (f != 0 || i == int(f)); } +}; + +template +class QTypeInfo > : public QTypeInfoMerger, E1, E2> {}; + +class QUrl; +// qHash is a friend, but we can't use default arguments for friends (§8.3.6.4) +Q_CORE_EXPORT size_t qHash(const QUrl &url, size_t seed = 0) noexcept; + +class Q_CORE_EXPORT QUrl +{ +public: + enum ParsingMode { + TolerantMode, + StrictMode, + DecodedMode + }; + + // encoding / toString values + enum UrlFormattingOption : unsigned int { + None = 0x0, + RemoveScheme = 0x1, + RemovePassword = 0x2, + RemoveUserInfo = RemovePassword | 0x4, + RemovePort = 0x8, + RemoveAuthority = RemoveUserInfo | RemovePort | 0x10, + RemovePath = 0x20, + RemoveQuery = 0x40, + RemoveFragment = 0x80, + // 0x100 was a private code in Qt 4, keep unused for a while + PreferLocalFile = 0x200, + StripTrailingSlash = 0x400, + RemoveFilename = 0x800, + NormalizePathSegments = 0x1000 + }; + + enum ComponentFormattingOption : unsigned int { + PrettyDecoded = 0x000000, + EncodeSpaces = 0x100000, + EncodeUnicode = 0x200000, + EncodeDelimiters = 0x400000 | 0x800000, + EncodeReserved = 0x1000000, + DecodeReserved = 0x2000000, + // 0x4000000 used to indicate full-decode mode + + FullyEncoded = EncodeSpaces | EncodeUnicode | EncodeDelimiters | EncodeReserved, + FullyDecoded = FullyEncoded | DecodeReserved | 0x4000000 + }; + Q_DECLARE_FLAGS(ComponentFormattingOptions, ComponentFormattingOption) +#ifdef Q_QDOC +private: + // We need to let qdoc think that FormattingOptions is a normal QFlags, but + // it needs to be a QUrlTwoFlags for compiling default arguments of some functions. + template struct QFlags : QUrlTwoFlags + { using QUrlTwoFlags::QUrlTwoFlags; }; +public: + Q_DECLARE_FLAGS(FormattingOptions, UrlFormattingOption) +#else + typedef QUrlTwoFlags FormattingOptions; +#endif + + QUrl(); + QUrl(const QUrl ©) noexcept; + QUrl &operator =(const QUrl ©) noexcept; +#ifdef QT_NO_URL_CAST_FROM_STRING + explicit QUrl(const QString &url, ParsingMode mode = TolerantMode); +#else + QUrl(const QString &url, ParsingMode mode = TolerantMode); + QUrl &operator=(const QString &url); +#endif + QUrl(QUrl &&other) noexcept : d(other.d) + { other.d = nullptr; } + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QUrl) + ~QUrl(); + + void swap(QUrl &other) noexcept { qt_ptr_swap(d, other.d); } + + void setUrl(const QString &url, ParsingMode mode = TolerantMode); + QString url(FormattingOptions options = FormattingOptions(PrettyDecoded)) const; + QString toString(FormattingOptions options = FormattingOptions(PrettyDecoded)) const; + QString toDisplayString(FormattingOptions options = FormattingOptions(PrettyDecoded)) const; + [[nodiscard]] QUrl adjusted(FormattingOptions options) const; + + QByteArray toEncoded(FormattingOptions options = FullyEncoded) const; +#if QT_CORE_REMOVED_SINCE(6, 7) + static QUrl fromEncoded(const QByteArray &url, ParsingMode mode = TolerantMode); +#endif + static QUrl fromEncoded(QByteArrayView input, ParsingMode mode = TolerantMode); + + enum UserInputResolutionOption { + DefaultResolution, + AssumeLocalFile + }; + Q_DECLARE_FLAGS(UserInputResolutionOptions, UserInputResolutionOption) + + static QUrl fromUserInput(const QString &userInput, const QString &workingDirectory = QString(), + UserInputResolutionOptions options = DefaultResolution); + + bool isValid() const; + QString errorString() const; + + bool isEmpty() const; + void clear(); + + void setScheme(const QString &scheme); + QString scheme() const; + + void setAuthority(const QString &authority, ParsingMode mode = TolerantMode); + QString authority(ComponentFormattingOptions options = PrettyDecoded) const; + + void setUserInfo(const QString &userInfo, ParsingMode mode = TolerantMode); + QString userInfo(ComponentFormattingOptions options = PrettyDecoded) const; + + void setUserName(const QString &userName, ParsingMode mode = DecodedMode); + QString userName(ComponentFormattingOptions options = FullyDecoded) const; + + void setPassword(const QString &password, ParsingMode mode = DecodedMode); + QString password(ComponentFormattingOptions = FullyDecoded) const; + + void setHost(const QString &host, ParsingMode mode = DecodedMode); + QString host(ComponentFormattingOptions = FullyDecoded) const; + + void setPort(int port); + int port(int defaultPort = -1) const; + + void setPath(const QString &path, ParsingMode mode = DecodedMode); + QString path(ComponentFormattingOptions options = FullyDecoded) const; + QString fileName(ComponentFormattingOptions options = FullyDecoded) const; + + bool hasQuery() const; + void setQuery(const QString &query, ParsingMode mode = TolerantMode); + void setQuery(const QUrlQuery &query); + QString query(ComponentFormattingOptions = PrettyDecoded) const; + + bool hasFragment() const; + QString fragment(ComponentFormattingOptions options = PrettyDecoded) const; + void setFragment(const QString &fragment, ParsingMode mode = TolerantMode); + + [[nodiscard]] QUrl resolved(const QUrl &relative) const; + + bool isRelative() const; + bool isParentOf(const QUrl &url) const; + + bool isLocalFile() const; + static QUrl fromLocalFile(const QString &localfile); + QString toLocalFile() const; + + void detach(); + bool isDetached() const; + +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator <(const QUrl &url) const; + bool operator ==(const QUrl &url) const; + bool operator !=(const QUrl &url) const; +#endif + + bool matches(const QUrl &url, FormattingOptions options) const; + + static QString fromPercentEncoding(const QByteArray &); + static QByteArray toPercentEncoding(const QString &, + const QByteArray &exclude = QByteArray(), + const QByteArray &include = QByteArray()); +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) + static QUrl fromCFURL(CFURLRef url); + CFURLRef toCFURL() const Q_DECL_CF_RETURNS_RETAINED; + static QUrl fromNSURL(const NSURL *url); + NSURL *toNSURL() const Q_DECL_NS_RETURNS_AUTORELEASED; +#endif + + enum AceProcessingOption : unsigned int { + IgnoreIDNWhitelist = 0x1, + AceTransitionalProcessing = 0x2, + }; + Q_DECLARE_FLAGS(AceProcessingOptions, AceProcessingOption) + +#if QT_CORE_REMOVED_SINCE(6, 3) + static QString fromAce(const QByteArray &); + static QByteArray toAce(const QString &); +#endif + static QString fromAce(const QByteArray &domain, AceProcessingOptions options = {}); + static QByteArray toAce(const QString &domain, AceProcessingOptions options = {}); + + static QStringList idnWhitelist(); + static QStringList toStringList(const QList &uris, FormattingOptions options = FormattingOptions(PrettyDecoded)); + static QList fromStringList(const QStringList &uris, ParsingMode mode = TolerantMode); + + static void setIdnWhitelist(const QStringList &); + friend Q_CORE_EXPORT size_t qHash(const QUrl &url, size_t seed) noexcept; + +private: + friend Q_CORE_EXPORT bool comparesEqual(const QUrl &lhs, const QUrl &rhs); + friend Q_CORE_EXPORT Qt::weak_ordering + compareThreeWay(const QUrl &lhs, const QUrl &rhs); + Q_DECLARE_WEAKLY_ORDERED_NON_NOEXCEPT(QUrl) + + QUrlPrivate *d; + friend class QUrlQuery; + +public: + typedef QUrlPrivate * DataPtr; + inline DataPtr &data_ptr() { return d; } +}; + +Q_DECLARE_SHARED(QUrl) +Q_DECLARE_OPERATORS_FOR_FLAGS(QUrl::ComponentFormattingOptions) +//Q_DECLARE_OPERATORS_FOR_FLAGS(QUrl::FormattingOptions) +Q_DECLARE_OPERATORS_FOR_FLAGS(QUrl::AceProcessingOptions) + +#ifndef Q_QDOC +constexpr inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption f1, QUrl::UrlFormattingOption f2) +{ return QUrl::FormattingOptions(f1) | f2; } +constexpr inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption f1, QUrl::FormattingOptions f2) +{ return f2 | f1; } +constexpr inline QIncompatibleFlag operator|(QUrl::UrlFormattingOption f1, int f2) +{ return QIncompatibleFlag(uint(f1) | f2); } + +// add operators for OR'ing the two types of flags +inline QUrl::FormattingOptions &operator|=(QUrl::FormattingOptions &i, QUrl::ComponentFormattingOptions f) +{ i |= QUrl::UrlFormattingOption(f.toInt()); return i; } +constexpr inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption i, QUrl::ComponentFormattingOption f) +{ return i | QUrl::UrlFormattingOption(qToUnderlying(f)); } +constexpr inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption i, QUrl::ComponentFormattingOptions f) +{ return i | QUrl::UrlFormattingOption(f.toInt()); } +constexpr inline QUrl::FormattingOptions operator|(QUrl::ComponentFormattingOption f, QUrl::UrlFormattingOption i) +{ return i | QUrl::UrlFormattingOption(qToUnderlying(f)); } +constexpr inline QUrl::FormattingOptions operator|(QUrl::ComponentFormattingOptions f, QUrl::UrlFormattingOption i) +{ return i | QUrl::UrlFormattingOption(f.toInt()); } +constexpr inline QUrl::FormattingOptions operator|(QUrl::FormattingOptions i, QUrl::ComponentFormattingOptions f) +{ return i | QUrl::UrlFormattingOption(f.toInt()); } +constexpr inline QUrl::FormattingOptions operator|(QUrl::ComponentFormattingOption f, QUrl::FormattingOptions i) +{ return i | QUrl::UrlFormattingOption(qToUnderlying(f)); } +constexpr inline QUrl::FormattingOptions operator|(QUrl::ComponentFormattingOptions f, QUrl::FormattingOptions i) +{ return i | QUrl::UrlFormattingOption(f.toInt()); } + +//inline QUrl::UrlFormattingOption &operator=(const QUrl::UrlFormattingOption &i, QUrl::ComponentFormattingOptions f) +//{ i = int(f); f; } +#endif // Q_QDOC + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QUrl &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QUrl &); +#endif + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QUrl &); +#endif + +QT_END_NAMESPACE + +#endif // QURL_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qurlquery.h b/qt/6.8.1/msvc2022_64/include/QtCore/qurlquery.h new file mode 100644 index 0000000000000000000000000000000000000000..ee09bdbd84e51fad2da003d7e1a0cc445288c8f9 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qurlquery.h @@ -0,0 +1,88 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QURLQUERY_H +#define QURLQUERY_H + +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +Q_CORE_EXPORT size_t qHash(const QUrlQuery &key, size_t seed = 0) noexcept; + +class QUrlQueryPrivate; +class Q_CORE_EXPORT QUrlQuery +{ +public: + QUrlQuery(); + explicit QUrlQuery(const QUrl &url); + explicit QUrlQuery(const QString &queryString); + QUrlQuery(std::initializer_list> list) + : QUrlQuery() + { + for (const std::pair &item : list) + addQueryItem(item.first, item.second); + } + + QUrlQuery(const QUrlQuery &other); + QUrlQuery(QUrlQuery &&other) noexcept; + QUrlQuery &operator=(const QUrlQuery &other); + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QUrlQuery) + ~QUrlQuery(); + +#if QT_CORE_REMOVED_SINCE(6, 8) + bool operator==(const QUrlQuery &other) const; + bool operator!=(const QUrlQuery &other) const + { return !operator==(other); } +#endif + + void swap(QUrlQuery &other) noexcept { d.swap(other.d); } + + bool isEmpty() const; + bool isDetached() const; + void clear(); + + QString query(QUrl::ComponentFormattingOptions encoding = QUrl::PrettyDecoded) const; + void setQuery(const QString &queryString); + QString toString(QUrl::ComponentFormattingOptions encoding = QUrl::PrettyDecoded) const + { return query(encoding); } + + void setQueryDelimiters(QChar valueDelimiter, QChar pairDelimiter); + QChar queryValueDelimiter() const; + QChar queryPairDelimiter() const; + + void setQueryItems(const QList > &query); + QList > queryItems(QUrl::ComponentFormattingOptions encoding = QUrl::PrettyDecoded) const; + + bool hasQueryItem(const QString &key) const; + void addQueryItem(const QString &key, const QString &value); + void removeQueryItem(const QString &key); + QString queryItemValue(const QString &key, QUrl::ComponentFormattingOptions encoding = QUrl::PrettyDecoded) const; + QStringList allQueryItemValues(const QString &key, QUrl::ComponentFormattingOptions encoding = QUrl::PrettyDecoded) const; + void removeAllQueryItems(const QString &key); + + static constexpr char16_t defaultQueryValueDelimiter() noexcept { return u'='; } + static constexpr char16_t defaultQueryPairDelimiter() noexcept { return u'&'; } + +private: + friend Q_CORE_EXPORT bool comparesEqual(const QUrlQuery &lhs, const QUrlQuery &rhs); + Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QUrlQuery) + friend class QUrl; + friend Q_CORE_EXPORT size_t qHash(const QUrlQuery &key, size_t seed) noexcept; + QSharedDataPointer d; + +public: + typedef QSharedDataPointer DataPtr; + inline DataPtr &data_ptr() { return d; } +}; + +Q_DECLARE_SHARED(QUrlQuery) + +QT_END_NAMESPACE + +#endif // QURLQUERY_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qutf8stringview.h b/qt/6.8.1/msvc2022_64/include/QtCore/qutf8stringview.h new file mode 100644 index 0000000000000000000000000000000000000000..cced45f30b77fad59fce3a9b9b15b1a50c56e64f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qutf8stringview.h @@ -0,0 +1,443 @@ +// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +#ifndef QUTF8STRINGVIEW_H +#define QUTF8STRINGVIEW_H + +#if 0 +#pragma qt_class(QUtf8StringView) +#endif + +#include +#include +#include // for QContainerImplHelper +#include +#include +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtPrivate { +template +using IsCompatibleChar8TypeHelper = std::disjunction< +#ifdef __cpp_char8_t + std::is_same, +#endif + std::is_same, + std::is_same, + std::is_same + >; +template +using IsCompatibleChar8Type + = IsCompatibleChar8TypeHelper>; + +template +struct IsCompatiblePointer8Helper : std::false_type {}; +template +struct IsCompatiblePointer8Helper + : IsCompatibleChar8Type {}; +template +using IsCompatiblePointer8 + = IsCompatiblePointer8Helper>; + +template +struct IsContainerCompatibleWithQUtf8StringView : std::false_type {}; + +template +struct IsContainerCompatibleWithQUtf8StringView()))>, + // ... and that has a suitable size ... + std::is_convertible< + decltype(std::size(std::declval())), + qsizetype + >, + // ... and it's a range as it defines an iterator-like API + IsCompatibleChar8Type()))>::value_type + >, + std::is_convertible< + decltype( std::begin(std::declval()) != std::end(std::declval()) ), + bool + >, + + // This needs to be treated specially due to the empty vs null distinction + std::negation, QByteArray>>, + + // This has a compatible value_type, but explicitly a different encoding + std::negation, QLatin1StringView>>, + + // Don't make an accidental copy constructor + std::negation, QBasicUtf8StringView>, + std::is_same, QBasicUtf8StringView> + >> + >>> : std::true_type {}; + +struct hide_char8_t { +#ifdef __cpp_char8_t + using type = char8_t; +#endif +}; + +struct wrap_char { using type = char; }; + +} // namespace QtPrivate + +#ifdef Q_QDOC +#define QBasicUtf8StringView QUtf8StringView +#else +template +#endif +class QBasicUtf8StringView +{ +public: +#ifndef Q_QDOC + using storage_type = typename std::conditional::type::type; +#else + using storage_type = typename QtPrivate::hide_char8_t; +#endif + typedef const storage_type value_type; + typedef qptrdiff difference_type; + typedef qsizetype size_type; + typedef value_type &reference; + typedef value_type &const_reference; + typedef value_type *pointer; + typedef value_type *const_pointer; + + typedef pointer iterator; + typedef const_pointer const_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + +private: + template + using if_compatible_char = std::enable_if_t::value, bool>; + + template + using if_compatible_pointer = std::enable_if_t::value, bool>; + + template + using if_compatible_qstring_like = std::enable_if_t, bool>; + + template + using if_compatible_container = std::enable_if_t::value, bool>; + + template + static constexpr qsizetype lengthHelperContainer(const Container &c) noexcept + { + return qsizetype(std::size(c)); + } + + // Note: Do not replace with std::size(const Char (&)[N]), because the result + // will be of by one. + template + static constexpr qsizetype lengthHelperContainer(const Char (&str)[N]) noexcept + { + return QtPrivate::lengthHelperContainer(str); + } + + template + static const storage_type *castHelper(const Char *str) noexcept + { return reinterpret_cast(str); } + static constexpr const storage_type *castHelper(const storage_type *str) noexcept + { return str; } + +public: + constexpr QBasicUtf8StringView() noexcept + : m_data(nullptr), m_size(0) {} + constexpr QBasicUtf8StringView(std::nullptr_t) noexcept + : QBasicUtf8StringView() {} + + template = true> + constexpr QBasicUtf8StringView(const Char *str, qsizetype len) + : m_data(castHelper(str)), + m_size((Q_ASSERT(len >= 0), Q_ASSERT(str || !len), len)) {} + + template = true> + constexpr QBasicUtf8StringView(const Char *f, const Char *l) + : QBasicUtf8StringView(f, l - f) {} + +#ifdef Q_QDOC + template + constexpr QBasicUtf8StringView(const Char (&array)[N]) noexcept; + + template + constexpr QBasicUtf8StringView(const Char *str) noexcept; +#else + template = true> + constexpr QBasicUtf8StringView(const Pointer &str) noexcept + : QBasicUtf8StringView(str, QtPrivate::lengthHelperPointer(str)) {} +#endif + +#ifdef Q_QDOC + QBasicUtf8StringView(const QByteArray &str) noexcept; + constexpr QBasicUtf8StringView(const storage_type *d, qsizetype n) noexcept {}; +#else + template = true> + QBasicUtf8StringView(const String &str) noexcept + : QBasicUtf8StringView{str.begin(), str.size()} {} +#endif + + template = true> + constexpr QBasicUtf8StringView(const Container &c) noexcept + : QBasicUtf8StringView(std::data(c), lengthHelperContainer(c)) {} + +#if defined(__cpp_char8_t) && !defined(Q_QDOC) + constexpr QBasicUtf8StringView(QBasicUtf8StringView other) + : QBasicUtf8StringView(other.data(), other.size()) {} +#endif + + template = true> + [[nodiscard]] constexpr static QBasicUtf8StringView fromArray(const Char (&string)[Size]) noexcept + { return QBasicUtf8StringView(string, Size); } + + [[nodiscard]] inline QString toString() const; // defined in qstring.h + + [[nodiscard]] constexpr qsizetype size() const noexcept { return m_size; } + [[nodiscard]] constexpr const_pointer data() const noexcept { return m_data; } +#ifdef __cpp_char8_t + [[nodiscard]] const char8_t *utf8() const noexcept { return reinterpret_cast(m_data); } +#endif + + [[nodiscard]] constexpr storage_type operator[](qsizetype n) const + { verify(n, 1); return m_data[n]; } + + // + // QString API + // + + [[nodiscard]] constexpr storage_type at(qsizetype n) const { return (*this)[n]; } + + [[nodiscard]] + constexpr QBasicUtf8StringView mid(qsizetype pos, qsizetype n = -1) const + { + using namespace QtPrivate; + auto result = QContainerImplHelper::mid(size(), &pos, &n); + return result == QContainerImplHelper::Null ? QBasicUtf8StringView() : QBasicUtf8StringView(m_data + pos, n); + } + [[nodiscard]] + constexpr QBasicUtf8StringView left(qsizetype n) const + { + if (size_t(n) >= size_t(size())) + n = size(); + return QBasicUtf8StringView(m_data, n); + } + [[nodiscard]] + constexpr QBasicUtf8StringView right(qsizetype n) const + { + if (size_t(n) >= size_t(size())) + n = size(); + return QBasicUtf8StringView(m_data + m_size - n, n); + } + + [[nodiscard]] constexpr QBasicUtf8StringView sliced(qsizetype pos) const + { verify(pos, 0); return QBasicUtf8StringView{m_data + pos, m_size - pos}; } + [[nodiscard]] constexpr QBasicUtf8StringView sliced(qsizetype pos, qsizetype n) const + { verify(pos, n); return QBasicUtf8StringView(m_data + pos, n); } + [[nodiscard]] constexpr QBasicUtf8StringView first(qsizetype n) const + { verify(0, n); return sliced(0, n); } + [[nodiscard]] constexpr QBasicUtf8StringView last(qsizetype n) const + { verify(0, n); return sliced(m_size - n, n); } + [[nodiscard]] constexpr QBasicUtf8StringView chopped(qsizetype n) const + { verify(0, n); return sliced(0, m_size - n); } + + constexpr QBasicUtf8StringView &slice(qsizetype pos) + { *this = sliced(pos); return *this; } + constexpr QBasicUtf8StringView &slice(qsizetype pos, qsizetype n) + { *this = sliced(pos, n); return *this; } + + constexpr void truncate(qsizetype n) + { verify(0, n); m_size = n; } + constexpr void chop(qsizetype n) + { verify(0, n); m_size -= n; } + + [[nodiscard]] inline bool isValidUtf8() const noexcept + { + return QByteArrayView(reinterpret_cast(data()), size()).isValidUtf8(); + } + + // + // STL compatibility API: + // + [[nodiscard]] const_iterator begin() const noexcept { return data(); } + [[nodiscard]] const_iterator end() const noexcept { return data() + size(); } + [[nodiscard]] const_iterator cbegin() const noexcept { return begin(); } + [[nodiscard]] const_iterator cend() const noexcept { return end(); } + [[nodiscard]] const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } + [[nodiscard]] const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } + [[nodiscard]] const_reverse_iterator crbegin() const noexcept { return rbegin(); } + [[nodiscard]] const_reverse_iterator crend() const noexcept { return rend(); } + + [[nodiscard]] constexpr bool empty() const noexcept { return size() == 0; } + [[nodiscard]] constexpr storage_type front() const { return Q_ASSERT(!empty()), m_data[0]; } + [[nodiscard]] constexpr storage_type back() const { return Q_ASSERT(!empty()), m_data[m_size - 1]; } + + [[nodiscard]] Q_IMPLICIT operator std::basic_string_view() const noexcept + { return std::basic_string_view(data(), size_t(size())); } + + [[nodiscard]] constexpr qsizetype max_size() const noexcept { return maxSize(); } + + // + // Qt compatibility API: + // + [[nodiscard]] constexpr bool isNull() const noexcept { return !m_data; } + [[nodiscard]] constexpr bool isEmpty() const noexcept { return empty(); } + [[nodiscard]] constexpr qsizetype length() const noexcept + { return size(); } + + [[nodiscard]] int compare(QBasicUtf8StringView other, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { + return QtPrivate::compareStrings(*this, other, cs); + } + + // all defined in qstring.h + [[nodiscard]] inline int compare(QChar other, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + [[nodiscard]] inline int compare(QStringView other, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + [[nodiscard]] inline int compare(QLatin1StringView other, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + [[nodiscard]] inline int compare(const QByteArray &other, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + + [[nodiscard]] inline bool equal(QChar other) const noexcept; + [[nodiscard]] inline bool equal(QStringView other) const noexcept; + [[nodiscard]] inline bool equal(QLatin1StringView other) const noexcept; + [[nodiscard]] inline bool equal(const QByteArray &other) const noexcept; + // end defined in qstring.h + + [[nodiscard]] static constexpr qsizetype maxSize() noexcept + { + // -1 to deal with the pointer one-past-the-end; + return QtPrivate::MaxAllocSize - 1; + } + +private: + [[nodiscard]] static inline int compare(QBasicUtf8StringView lhs, QBasicUtf8StringView rhs) noexcept + { + return QtPrivate::compareStrings(QBasicUtf8StringView(lhs.data(), lhs.size()), + QBasicUtf8StringView(rhs.data(), rhs.size())); + } + + friend bool + comparesEqual(const QBasicUtf8StringView &lhs, const QBasicUtf8StringView &rhs) noexcept + { + return lhs.size() == rhs.size() + && QtPrivate::equalStrings(QBasicUtf8StringView(lhs.data(), lhs.size()), + QBasicUtf8StringView(rhs.data(), rhs.size())); + } + friend Qt::strong_ordering + compareThreeWay(const QBasicUtf8StringView &lhs, const QBasicUtf8StringView &rhs) noexcept + { + const int res = QBasicUtf8StringView::compare(lhs, rhs); + return Qt::compareThreeWay(res, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QBasicUtf8StringView) + + friend bool + comparesEqual(const QBasicUtf8StringView &lhs, const QLatin1StringView &rhs) noexcept + { + return lhs.equal(rhs); + } + friend Qt::strong_ordering + compareThreeWay(const QBasicUtf8StringView &lhs, const QLatin1StringView &rhs) noexcept + { + const int res = lhs.compare(rhs); + return Qt::compareThreeWay(res, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QBasicUtf8StringView, QLatin1StringView) + + friend bool + comparesEqual(const QBasicUtf8StringView &lhs, const QStringView &rhs) noexcept + { return lhs.equal(rhs); } + friend Qt::strong_ordering + compareThreeWay(const QBasicUtf8StringView &lhs, const QStringView &rhs) noexcept + { + const int res = lhs.compare(rhs); + return Qt::compareThreeWay(res, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QBasicUtf8StringView, QStringView) + + friend bool comparesEqual(const QBasicUtf8StringView &lhs, const QChar &rhs) noexcept + { return lhs.equal(rhs); } + friend Qt::strong_ordering + compareThreeWay(const QBasicUtf8StringView &lhs, const QChar &rhs) noexcept + { + const int res = lhs.compare(rhs); + return Qt::compareThreeWay(res, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QBasicUtf8StringView, QChar) + Q_DECLARE_STRONGLY_ORDERED(QBasicUtf8StringView, char16_t) + +#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) + friend bool + comparesEqual(const QBasicUtf8StringView &lhs, const QByteArrayView &rhs) noexcept + { + return lhs.size() == rhs.size() + && QtPrivate::equalStrings(QBasicUtf8StringView(lhs.data(), lhs.size()), + QBasicUtf8StringView(rhs.data(), rhs.size())); + } + friend Qt::strong_ordering + compareThreeWay(const QBasicUtf8StringView &lhs, const QByteArrayView &rhs) noexcept + { + const int res = QtPrivate::compareStrings(QBasicUtf8StringView(lhs.data(), lhs.size()), + QBasicUtf8StringView(rhs.data(), rhs.size())); + return Qt::compareThreeWay(res, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QBasicUtf8StringView, QByteArrayView, QT_ASCII_CAST_WARN) + + friend bool + comparesEqual(const QBasicUtf8StringView &lhs, const QByteArray &rhs) noexcept + { + return lhs.equal(rhs); + } + friend Qt::strong_ordering + compareThreeWay(const QBasicUtf8StringView &lhs, const QByteArray &rhs) noexcept + { + const int res = lhs.compare(rhs); + return Qt::compareThreeWay(res, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QBasicUtf8StringView, QByteArray, QT_ASCII_CAST_WARN) + + friend bool comparesEqual(const QBasicUtf8StringView &lhs, const char *rhs) noexcept + { return comparesEqual(lhs, QByteArrayView(rhs)); } + friend Qt::strong_ordering + compareThreeWay(const QBasicUtf8StringView &lhs, const char *rhs) noexcept + { return compareThreeWay(lhs, QByteArrayView(rhs)); } + Q_DECLARE_STRONGLY_ORDERED(QBasicUtf8StringView, const char *, QT_ASCII_CAST_WARN) +#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) + + Q_ALWAYS_INLINE constexpr void verify([[maybe_unused]] qsizetype pos = 0, + [[maybe_unused]] qsizetype n = 1) const + { + Q_ASSERT(pos >= 0); + Q_ASSERT(pos <= size()); + Q_ASSERT(n >= 0); + Q_ASSERT(n <= size() - pos); + } + const storage_type *m_data; + qsizetype m_size; +}; + +#ifdef Q_QDOC +#undef QBasicUtf8StringView +#else +template +Q_DECLARE_TYPEINFO_BODY(QBasicUtf8StringView, Q_PRIMITIVE_TYPE); + +template , bool> = true> +[[nodiscard]] inline q_no_char8_t::QUtf8StringView qToUtf8StringViewIgnoringNull(const QStringLike &s) noexcept +{ return q_no_char8_t::QUtf8StringView(s.begin(), s.size()); } +#endif // Q_QDOC + +QT_END_NAMESPACE + +#endif /* QUTF8STRINGVIEW_H */ diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/quuid.h b/qt/6.8.1/msvc2022_64/include/QtCore/quuid.h new file mode 100644 index 0000000000000000000000000000000000000000..95252295d6251bce6e3174bb3a5b9f48ef6ea1bb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/quuid.h @@ -0,0 +1,377 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QUUID_H +#define QUUID_H + +#include +#include +#include +#include + +#if defined(Q_OS_WIN) || defined(Q_QDOC) +#ifndef GUID_DEFINED +#define GUID_DEFINED +typedef struct _GUID +{ + ulong Data1; + ushort Data2; + ushort Data3; + uchar Data4[8]; +} GUID, *REFGUID, *LPGUID; +#endif +#endif + +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) +Q_FORWARD_DECLARE_CF_TYPE(CFUUID); +Q_FORWARD_DECLARE_OBJC_CLASS(NSUUID); +#endif + +QT_BEGIN_NAMESPACE + +class Q_CORE_EXPORT QUuid +{ + QUuid(Qt::Initialization) {} +public: + enum Variant { + VarUnknown =-1, + NCS = 0, // 0 - - + DCE = 2, // 1 0 - + Microsoft = 6, // 1 1 0 + Reserved = 7 // 1 1 1 + }; + + enum Version { + VerUnknown =-1, + Time = 1, // 0 0 0 1 + EmbeddedPOSIX = 2, // 0 0 1 0 + Md5 = 3, // 0 0 1 1 + Name = Md5, + Random = 4, // 0 1 0 0 + Sha1 = 5 // 0 1 0 1 + }; + + enum StringFormat { + WithBraces = 0, + WithoutBraces = 1, + Id128 = 3 + }; + + union alignas(16) Id128Bytes { + quint8 data[16]; + quint16 data16[8]; + quint32 data32[4]; + quint64 data64[2]; +#if defined(QT_COMPILER_SUPPORTS_INT128) +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wpedantic") // ISO C++ does not support ‘__int128’ for ‘data128’ + unsigned __int128 data128[1]; +QT_WARNING_POP +#elif defined(QT_SUPPORTS_INT128) +# error "struct QUuid::Id128Bytes should not depend on QT_SUPPORTS_INT128 for ABI reasons." +# error "Adjust the declaration of the `data128` member above so it is always defined if it's " \ + "supported by the current compiler/architecture in any configuration." +#endif + + constexpr explicit operator QByteArrayView() const noexcept + { + return QByteArrayView(data, sizeof(data)); + } + + friend constexpr Id128Bytes qbswap(Id128Bytes b) noexcept + { + // 128-bit byte swap + auto b0 = qbswap(b.data64[0]); + auto b1 = qbswap(b.data64[1]); + b.data64[0] = b1; + b.data64[1] = b0; + return b; + } + }; + + constexpr QUuid() noexcept : data1(0), data2(0), data3(0), data4{0,0,0,0,0,0,0,0} {} + + constexpr QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, + uchar b4, uchar b5, uchar b6, uchar b7, uchar b8) noexcept + : data1(l), data2(w1), data3(w2), data4{b1, b2, b3, b4, b5, b6, b7, b8} {} + explicit inline QUuid(Id128Bytes id128, QSysInfo::Endian order = QSysInfo::BigEndian) noexcept; + + explicit QUuid(QAnyStringView string) noexcept + : QUuid{fromString(string)} {} + static QUuid fromString(QAnyStringView string) noexcept; +#if QT_CORE_REMOVED_SINCE(6, 3) + explicit QUuid(const QString &); + static QUuid fromString(QStringView string) noexcept; + static QUuid fromString(QLatin1StringView string) noexcept; + explicit QUuid(const char *); + explicit QUuid(const QByteArray &); +#endif + QString toString(StringFormat mode = WithBraces) const; + QByteArray toByteArray(StringFormat mode = WithBraces) const; + inline Id128Bytes toBytes(QSysInfo::Endian order = QSysInfo::BigEndian) const noexcept; + QByteArray toRfc4122() const; + + static inline QUuid fromBytes(const void *bytes, QSysInfo::Endian order = QSysInfo::BigEndian); +#if QT_CORE_REMOVED_SINCE(6, 3) + static QUuid fromRfc4122(const QByteArray &); +#endif + static QUuid fromRfc4122(QByteArrayView) noexcept; + + bool isNull() const noexcept; + +#ifdef QT_SUPPORTS_INT128 + static constexpr QUuid fromUInt128(quint128 uuid, QSysInfo::Endian order = QSysInfo::BigEndian) noexcept; + constexpr quint128 toUInt128(QSysInfo::Endian order = QSysInfo::BigEndian) const noexcept; +#endif + +private: + friend constexpr bool comparesEqual(const QUuid &lhs, const QUuid &rhs) noexcept + { + return is_eq(compareThreeWay_helper(lhs, rhs)); + } + static constexpr Qt::strong_ordering + compareThreeWay_helper(const QUuid &lhs, const QUuid &rhs) noexcept + { +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED) + if (const auto c = Qt::compareThreeWay(lhs.data1, rhs.data1); !is_eq(c)) + return c; + if (const auto c = Qt::compareThreeWay(lhs.data2, rhs.data2); !is_eq(c)) + return c; + if (const auto c = Qt::compareThreeWay(lhs.data3, rhs.data3); !is_eq(c)) + return c; +#elif defined(__cpp_lib_bit_cast) && defined(QT_SUPPORTS_INT128) + quint128 lu = qFromBigEndian(std::bit_cast(lhs)); + quint128 ru = qFromBigEndian(std::bit_cast(rhs)); + return Qt::compareThreeWay(lu, ru); +#else + auto make_int = [](const QUuid &u) { + quint64 result = quint64(u.data3) << 48; + result |= quint64(u.data2) << 32; + return qFromBigEndian(result | u.data1); + }; + if (const auto c = Qt::compareThreeWay(make_int(lhs), make_int(rhs)); !is_eq(c)) + return c; +#endif + for (unsigned i = 0; i < sizeof(lhs.data4); ++i) { + if (const auto c = Qt::compareThreeWay(lhs.data4[i], rhs.data4[i]); !is_eq(c)) + return c; + } + return Qt::strong_ordering::equal; + } + friend constexpr Qt::strong_ordering compareThreeWay(const QUuid &lhs, const QUuid &rhs) noexcept + { +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED) + // Keep the old sorting order from before Qt 6.8, which sorted first on + // variant(). We don't need the exact algorithm to achieve same results. + auto fastVariant = [](const QUuid &uuid) { + quint8 v = uuid.data4[0]; + // i.e.: return v >= Microsoft ? v : v >= DCE ? DCE : NCS; + return v >= 0xC0 ? v & 0xE0 : v >= 0x80 ? 0x80 : 0; + }; + if (const auto c = Qt::compareThreeWay(fastVariant(lhs), fastVariant(rhs)); !is_eq(c)) + return c; +#endif + return compareThreeWay_helper(lhs, rhs); + } + +public: +/* To prevent a meta-type creation ambiguity on Windows, we put comparison + macros under NOT QT_CORE_REMOVED_SINCE(6, 8) part. */ +#if QT_CORE_REMOVED_SINCE(6, 8) + constexpr bool operator==(const QUuid &orig) const noexcept + { + return comparesEqual(*this, orig); + } + + constexpr bool operator!=(const QUuid &orig) const noexcept + { + return !operator==(orig); + } + + bool operator<(const QUuid &other) const noexcept; + bool operator>(const QUuid &other) const noexcept; +#else + Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE(QUuid) +#endif // QT_CORE_REMOVED_SINCE(6, 8) +#if defined(Q_OS_WIN) || defined(Q_QDOC) + // On Windows we have a type GUID that is used by the platform API, so we + // provide convenience operators to cast from and to this type. + constexpr QUuid(const GUID &guid) noexcept + : data1(guid.Data1), data2(guid.Data2), data3(guid.Data3), + data4{guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], + guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]} {} + + constexpr QUuid &operator=(const GUID &guid) noexcept + { + *this = QUuid(guid); + return *this; + } + + constexpr operator GUID() const noexcept + { + GUID guid = { data1, data2, data3, { data4[0], data4[1], data4[2], data4[3], data4[4], data4[5], data4[6], data4[7] } }; + return guid; + } +private: + friend constexpr bool comparesEqual(const QUuid &lhs, const GUID &rhs) noexcept + { + return comparesEqual(lhs, QUuid(rhs)); + } +public: +/* To prevent a meta-type creation ambiguity on Windows, we put comparison + macros under NOT QT_CORE_REMOVED_SINCE(6, 8) part. */ +#if QT_CORE_REMOVED_SINCE(6, 8) + constexpr bool operator==(const GUID &guid) const noexcept + { + return comparesEqual(*this, QUuid(guid)); + } + + constexpr bool operator!=(const GUID &guid) const noexcept + { + return !operator==(guid); + } +#else + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QUuid, GUID) +#endif // !QT_CORE_REMOVED_SINCE(6, 8) +#endif +public: + static QUuid createUuid(); +#if QT_CORE_REMOVED_SINCE(6, 8) + static QUuid createUuidV3(const QUuid &ns, const QByteArray &baseData) noexcept; + static QUuid createUuidV5(const QUuid &ns, const QByteArray &baseData) noexcept; +#endif + static QUuid createUuidV5(QUuid ns, QByteArrayView baseData) noexcept; +#ifndef QT_BOOTSTRAPPED + static QUuid createUuidV3(QUuid ns, QByteArrayView baseData) noexcept; +#if !QT_CORE_REMOVED_SINCE(6, 8) + Q_WEAK_OVERLOAD +#endif + static inline QUuid createUuidV3(const QUuid &ns, const QString &baseData) + { + return QUuid::createUuidV3(ns, qToByteArrayViewIgnoringNull(baseData.toUtf8())); + } +#endif +#if !QT_CORE_REMOVED_SINCE(6, 8) + Q_WEAK_OVERLOAD +#endif + static inline QUuid createUuidV5(const QUuid &ns, const QString &baseData) + { + return QUuid::createUuidV5(ns, qToByteArrayViewIgnoringNull(baseData.toUtf8())); + } + + QUuid::Variant variant() const noexcept; + QUuid::Version version() const noexcept; + +#if defined(Q_OS_DARWIN) || defined(Q_QDOC) + static QUuid fromCFUUID(CFUUIDRef uuid); + CFUUIDRef toCFUUID() const Q_DECL_CF_RETURNS_RETAINED; + static QUuid fromNSUUID(const NSUUID *uuid); + NSUUID *toNSUUID() const Q_DECL_NS_RETURNS_AUTORELEASED; +#endif + + uint data1; + ushort data2; + ushort data3; + uchar data4[8]; +}; + +Q_DECLARE_TYPEINFO(QUuid, Q_PRIMITIVE_TYPE); + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QUuid &); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QUuid &); +#endif + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QUuid &); +#endif + +Q_CORE_EXPORT size_t qHash(const QUuid &uuid, size_t seed = 0) noexcept; + +QUuid::QUuid(Id128Bytes uuid, QSysInfo::Endian order) noexcept +{ + char bytes[sizeof uuid]; + if (order == QSysInfo::LittleEndian) + qbswap(uuid, bytes); + else + memcpy(bytes, &uuid, sizeof bytes); + data1 = qFromBigEndian(&bytes[0]); + data2 = qFromBigEndian(&bytes[4]); + data3 = qFromBigEndian(&bytes[6]); + memcpy(data4, &bytes[8], sizeof(data4)); +} + +QUuid::Id128Bytes QUuid::toBytes(QSysInfo::Endian order) const noexcept +{ + Id128Bytes result = {}; + qToBigEndian(data1, &result.data[0]); + qToBigEndian(data2, &result.data[4]); + qToBigEndian(data3, &result.data[6]); + memcpy(&result.data[8], data4, sizeof(data4)); + if (order == QSysInfo::LittleEndian) + return qbswap(result); + return result; +} + +QUuid QUuid::fromBytes(const void *bytes, QSysInfo::Endian order) +{ + Id128Bytes result = {}; + memcpy(result.data, bytes, sizeof(result)); + return QUuid(result, order); +} + +#ifdef QT_SUPPORTS_INT128 +constexpr QUuid QUuid::fromUInt128(quint128 uuid, QSysInfo::Endian order) noexcept +{ + QUuid result = {}; + if (order == QSysInfo::BigEndian) { + result.data1 = qFromBigEndian(int(uuid)); + result.data2 = qFromBigEndian(ushort(uuid >> 32)); + result.data3 = qFromBigEndian(ushort(uuid >> 48)); + for (int i = 0; i < 8; ++i) + result.data4[i] = uchar(uuid >> (64 + i * 8)); + } else { + result.data1 = qFromLittleEndian(uint(uuid >> 96)); + result.data2 = qFromLittleEndian(ushort(uuid >> 80)); + result.data3 = qFromLittleEndian(ushort(uuid >> 64)); + for (int i = 0; i < 8; ++i) + result.data4[i] = uchar(uuid >> (56 - i * 8)); + } + return result; +} + +constexpr quint128 QUuid::toUInt128(QSysInfo::Endian order) const noexcept +{ + quint128 result = {}; + if (order == QSysInfo::BigEndian) { + for (int i = 0; i < 8; ++i) + result |= quint64(data4[i]) << (i * 8); + result = result << 64; + result |= quint64(qToBigEndian(data3)) << 48; + result |= quint64(qToBigEndian(data2)) << 32; + result |= qToBigEndian(data1); + } else { + result = qToLittleEndian(data1); + result = result << 32; + result |= quint64(qToLittleEndian(data2)) << 16; + result |= quint64(qToLittleEndian(data3)); + result = result << 64; + for (int i = 0; i < 8; ++i) + result |= quint64(data4[i]) << (56 - i * 8); + } + return result; +} +#endif + +#if defined(Q_QDOC) +// provide fake declarations of qXXXEndian() functions, so that qDoc could +// distinguish them from the general template +QUuid::Id128Bytes qFromBigEndian(QUuid::Id128Bytes src); +QUuid::Id128Bytes qFromLittleEndian(QUuid::Id128Bytes src); +QUuid::Id128Bytes qToBigEndian(QUuid::Id128Bytes src); +QUuid::Id128Bytes qToLittleEndian(QUuid::Id128Bytes src); +#endif + +QT_END_NAMESPACE + +#endif // QUUID_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qvariant.h b/qt/6.8.1/msvc2022_64/include/QtCore/qvariant.h new file mode 100644 index 0000000000000000000000000000000000000000..afad23eff8a555f0664992f3aa21f8446060ce9e --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qvariant.h @@ -0,0 +1,884 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QVARIANT_H +#define QVARIANT_H + +#include +#include +#include +#include +#ifndef QT_NO_DEBUG_STREAM +#include +#endif + +#include +#include +#include +#include + +#if !defined(QT_LEAN_HEADERS) || QT_LEAN_HEADERS < 1 +# include +# include +# include +# include +# include +# include +#endif + +QT_BEGIN_NAMESPACE + +QT_ENABLE_P0846_SEMANTICS_FOR(get_if) +QT_ENABLE_P0846_SEMANTICS_FOR(get) + +class QBitArray; +class QDataStream; +class QDate; +class QDateTime; +class QEasingCurve; +class QLine; +class QLineF; +class QLocale; +class QModelIndex; +class QPersistentModelIndex; +class QPoint; +class QPointF; +class QRect; +class QRectF; +class QRegularExpression; +class QSize; +class QSizeF; +class QTextFormat; +class QTextLength; +class QTime; +class QTransform; +class QUrl; +class QVariant; + +template +inline T qvariant_cast(const QVariant &); + +namespace QtPrivate { +template<> constexpr inline bool qIsRelocatable = true; +} +class Q_CORE_EXPORT QVariant +{ + template + using if_constructible = std::enable_if_t< + std::conjunction_v< + std::is_copy_constructible>, + std::is_destructible>, + std::is_constructible, Args...> + >, + bool>; + + template + using if_rvalue = std::enable_if_t, bool>; + + struct CborValueStandIn { qint64 n; void *c; int t; }; +public: + struct PrivateShared + { + private: + inline PrivateShared() : ref(1) { } + public: + static int computeOffset(PrivateShared *ps, size_t align); + static size_t computeAllocationSize(size_t size, size_t align); + static PrivateShared *create(size_t size, size_t align); + static void free(PrivateShared *p); + + alignas(8) QAtomicInt ref; + int offset; + + const void *data() const { return reinterpret_cast(this) + offset; } + void *data() { return reinterpret_cast(this) + offset; } + }; + + struct Private + { + static constexpr size_t MaxInternalSize = 3 * sizeof(void *); + template static constexpr bool FitsInInternalSize = S <= MaxInternalSize; + template static constexpr bool CanUseInternalSpace = + (QTypeInfo::isRelocatable && FitsInInternalSize && alignof(T) <= alignof(double)); + static constexpr bool canUseInternalSpace(const QtPrivate::QMetaTypeInterface *type) + { + Q_ASSERT(type); + return QMetaType::TypeFlags(type->flags) & QMetaType::RelocatableType && + size_t(type->size) <= MaxInternalSize && size_t(type->alignment) <= alignof(double); + } + + union + { + uchar data[MaxInternalSize] = {}; + PrivateShared *shared; + double _forAlignment; // we want an 8byte alignment on 32bit systems as well + } data; + quintptr is_shared : 1; + quintptr is_null : 1; + quintptr packedType : sizeof(QMetaType) * 8 - 2; + + constexpr Private() noexcept : is_shared(false), is_null(true), packedType(0) {} + explicit Private(const QtPrivate::QMetaTypeInterface *iface) noexcept; + template explicit Private(std::piecewise_construct_t, const T &t); + + const void *storage() const + { return is_shared ? data.shared->data() : &data.data; } + + // determine internal storage at compile time + template const T &get() const + { return *static_cast(CanUseInternalSpace ? &data.data : data.shared->data()); } + + inline const QtPrivate::QMetaTypeInterface *typeInterface() const + { + return reinterpret_cast(packedType << 2); + } + + inline QMetaType type() const + { + return QMetaType(typeInterface()); + } + }; + +#if QT_DEPRECATED_SINCE(6, 0) + enum QT_DEPRECATED_VERSION_X_6_0("Use QMetaType::Type instead.") Type + { + Invalid = QMetaType::UnknownType, + Bool = QMetaType::Bool, + Int = QMetaType::Int, + UInt = QMetaType::UInt, + LongLong = QMetaType::LongLong, + ULongLong = QMetaType::ULongLong, + Double = QMetaType::Double, + Char = QMetaType::QChar, + Map = QMetaType::QVariantMap, + List = QMetaType::QVariantList, + String = QMetaType::QString, + StringList = QMetaType::QStringList, + ByteArray = QMetaType::QByteArray, + BitArray = QMetaType::QBitArray, + Date = QMetaType::QDate, + Time = QMetaType::QTime, + DateTime = QMetaType::QDateTime, + Url = QMetaType::QUrl, + Locale = QMetaType::QLocale, + Rect = QMetaType::QRect, + RectF = QMetaType::QRectF, + Size = QMetaType::QSize, + SizeF = QMetaType::QSizeF, + Line = QMetaType::QLine, + LineF = QMetaType::QLineF, + Point = QMetaType::QPoint, + PointF = QMetaType::QPointF, +#if QT_CONFIG(regularexpression) + RegularExpression = QMetaType::QRegularExpression, +#endif + Hash = QMetaType::QVariantHash, +#if QT_CONFIG(easingcurve) + EasingCurve = QMetaType::QEasingCurve, +#endif + Uuid = QMetaType::QUuid, +#if QT_CONFIG(itemmodel) + ModelIndex = QMetaType::QModelIndex, + PersistentModelIndex = QMetaType::QPersistentModelIndex, +#endif + LastCoreType = QMetaType::LastCoreType, + + Font = QMetaType::QFont, + Pixmap = QMetaType::QPixmap, + Brush = QMetaType::QBrush, + Color = QMetaType::QColor, + Palette = QMetaType::QPalette, + Image = QMetaType::QImage, + Polygon = QMetaType::QPolygon, + Region = QMetaType::QRegion, + Bitmap = QMetaType::QBitmap, + Cursor = QMetaType::QCursor, +#if QT_CONFIG(shortcut) + KeySequence = QMetaType::QKeySequence, +#endif + Pen = QMetaType::QPen, + TextLength = QMetaType::QTextLength, + TextFormat = QMetaType::QTextFormat, + Transform = QMetaType::QTransform, + Matrix4x4 = QMetaType::QMatrix4x4, + Vector2D = QMetaType::QVector2D, + Vector3D = QMetaType::QVector3D, + Vector4D = QMetaType::QVector4D, + Quaternion = QMetaType::QQuaternion, + PolygonF = QMetaType::QPolygonF, + Icon = QMetaType::QIcon, + LastGuiType = QMetaType::LastGuiType, + + SizePolicy = QMetaType::QSizePolicy, + + UserType = QMetaType::User, + LastType = 0xffffffff // need this so that gcc >= 3.4 allocates 32 bits for Type + }; +#endif + QVariant() noexcept : d() {} + ~QVariant(); + explicit QVariant(QMetaType type, const void *copy = nullptr); + QVariant(const QVariant &other); + +private: + template + using is_noexcept_constructible = std::conjunction< + std::bool_constant>, + std::is_nothrow_constructible + >; + +public: + template = true> + explicit QVariant(std::in_place_type_t, Args&&... args) + noexcept(is_noexcept_constructible, Args...>::value) + : QVariant(std::in_place, QMetaType::fromType>() ) + { + void *data = const_cast(constData()); + new (data) T(std::forward(args)...); + } + + template &, Args...> = true> + explicit QVariant(std::in_place_type_t, std::initializer_list il, Args&&... args) + noexcept(is_noexcept_constructible, + std::initializer_list &, + Args... + >::value) + : QVariant(std::in_place, QMetaType::fromType>()) + { + char *data = static_cast(const_cast(constData())); + new (data) T(il, std::forward(args)...); + } + + // primitives + QVariant(int i) noexcept; + QVariant(uint ui) noexcept; + QVariant(qlonglong ll) noexcept; + QVariant(qulonglong ull) noexcept; + QVariant(bool b) noexcept; + QVariant(double d) noexcept; + QVariant(float f) noexcept; + + // trivial, trivially-copyable or COW + QVariant(QChar qchar) noexcept; + QVariant(QDate date) noexcept; + QVariant(QTime time) noexcept; +#ifndef QT_BOOTSTRAPPED + QVariant(const QBitArray &bitarray) noexcept; +#endif + QVariant(const QByteArray &bytearray) noexcept; + QVariant(const QDateTime &datetime) noexcept; + QVariant(const QHash &hash) noexcept; + QVariant(const QJsonArray &jsonArray) noexcept; + QVariant(const QJsonObject &jsonObject) noexcept; + QVariant(const QList &list) noexcept; + QVariant(const QLocale &locale) noexcept; + QVariant(const QMap &map) noexcept; + QVariant(const QRegularExpression &re) noexcept; + QVariant(const QString &string) noexcept; + QVariant(const QStringList &stringlist) noexcept; + QVariant(const QUrl &url) noexcept; + + // conditionally noexcept trivial or trivially-copyable + // (most of these are noexcept on 64-bit) + QVariant(const QJsonValue &jsonValue) noexcept(Private::FitsInInternalSize); + QVariant(const QModelIndex &modelIndex) noexcept(Private::FitsInInternalSize<8 + 2 * sizeof(quintptr)>); + QVariant(QUuid uuid) noexcept(Private::FitsInInternalSize<16>); +#ifndef QT_NO_GEOM_VARIANT + QVariant(QSize size) noexcept; + QVariant(QSizeF size) noexcept(Private::FitsInInternalSize); + QVariant(QPoint pt) noexcept; + QVariant(QPointF pt) noexcept(Private::FitsInInternalSize); + QVariant(QLine line) noexcept(Private::FitsInInternalSize); + QVariant(QLineF line) noexcept(Private::FitsInInternalSize); + QVariant(QRect rect) noexcept(Private::FitsInInternalSize); + QVariant(QRectF rect) noexcept(Private::FitsInInternalSize); +#endif + + // not noexcept + QVariant(const QEasingCurve &easing) noexcept(false); + QVariant(const QJsonDocument &jsonDocument) noexcept(false); + QVariant(const QPersistentModelIndex &modelIndex) noexcept(false); + +#ifndef QT_NO_CAST_FROM_ASCII + QT_ASCII_CAST_WARN QVariant(const char *str) noexcept(false) + : QVariant(QString::fromUtf8(str)) + {} +#endif + QVariant(QLatin1StringView string) noexcept(false); // converts to QString + +#if !defined(Q_CC_GHS) + // GHS has an ICE with this code; use the simplified version below + template , std::is_member_pointer>, bool> = false> + QVariant(T) = delete; +#else + QVariant(const volatile void *) = delete; +#endif + +#if QT_CORE_REMOVED_SINCE(6, 5) + QVariant(const QSize &size); + QVariant(const QSizeF &size); + QVariant(const QPoint &pt); + QVariant(const QPointF &pt); + QVariant(const QLine &line); + QVariant(const QLineF &line); + QVariant(const QRect &rect); + QVariant(const QRectF &rect); + QVariant(const QUuid &uuid); +#endif + + QVariant& operator=(const QVariant &other); + inline QVariant(QVariant &&other) noexcept : d(other.d) + { other.d = Private(); } + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QVariant) + + inline void swap(QVariant &other) noexcept { std::swap(d, other.d); } + + int userType() const { return typeId(); } + int typeId() const { return metaType().id(); } + + const char *typeName() const; + QMetaType metaType() const; + + bool canConvert(QMetaType targetType) const + { return QMetaType::canConvert(d.type(), targetType); } + bool convert(QMetaType type); + + bool canView(QMetaType targetType) const + { return QMetaType::canView(d.type(), targetType); } + +#if QT_DEPRECATED_SINCE(6, 0) + QT_DEPRECATED_VERSION_6_0 + bool canConvert(int targetTypeId) const + { return QMetaType::canConvert(d.type(), QMetaType(targetTypeId)); } + QT_DEPRECATED_VERSION_6_0 + bool convert(int targetTypeId) + { return convert(QMetaType(targetTypeId)); } +#endif + + inline bool isValid() const; + bool isNull() const; + + void clear(); + + void detach(); + inline bool isDetached() const; + + int toInt(bool *ok = nullptr) const; + uint toUInt(bool *ok = nullptr) const; + qlonglong toLongLong(bool *ok = nullptr) const; + qulonglong toULongLong(bool *ok = nullptr) const; + bool toBool() const; + double toDouble(bool *ok = nullptr) const; + float toFloat(bool *ok = nullptr) const; + qreal toReal(bool *ok = nullptr) const; + QByteArray toByteArray() const; +#ifndef QT_BOOTSTRAPPED + QBitArray toBitArray() const; +#endif + QString toString() const; + QStringList toStringList() const; + QChar toChar() const; + QDate toDate() const; + QTime toTime() const; + QDateTime toDateTime() const; + QList toList() const; + QMap toMap() const; + QHash toHash() const; + +#ifndef QT_NO_GEOM_VARIANT + QPoint toPoint() const; + QPointF toPointF() const; + QRect toRect() const; + QSize toSize() const; + QSizeF toSizeF() const; + QLine toLine() const; + QLineF toLineF() const; + QRectF toRectF() const; +#endif + QLocale toLocale() const; +#if QT_CONFIG(regularexpression) + QRegularExpression toRegularExpression() const; +#endif // QT_CONFIG(regularexpression) +#if QT_CONFIG(easingcurve) + QEasingCurve toEasingCurve() const; +#endif + QUuid toUuid() const; +#ifndef QT_BOOTSTRAPPED + QUrl toUrl() const; + QJsonValue toJsonValue() const; + QJsonObject toJsonObject() const; + QJsonArray toJsonArray() const; + QJsonDocument toJsonDocument() const; +#endif // QT_BOOTSTRAPPED +#if QT_CONFIG(itemmodel) + QModelIndex toModelIndex() const; + QPersistentModelIndex toPersistentModelIndex() const; +#endif + +#ifndef QT_NO_DATASTREAM + void load(QDataStream &ds); + void save(QDataStream &ds) const; +#endif +#if QT_DEPRECATED_SINCE(6, 0) + QT_WARNING_PUSH + QT_WARNING_DISABLE_DEPRECATED + QT_DEPRECATED_VERSION_X_6_0("Use the constructor taking a QMetaType instead.") + explicit QVariant(Type type) + : QVariant(QMetaType(int(type))) + {} + QT_DEPRECATED_VERSION_X_6_0("Use typeId() or metaType().") + Type type() const + { + int type = d.type().id(); + return type >= QMetaType::User ? UserType : static_cast(type); + } + QT_DEPRECATED_VERSION_6_0 + static const char *typeToName(int typeId) + { return QMetaType(typeId).name(); } + QT_DEPRECATED_VERSION_6_0 + static Type nameToType(const char *name) + { + int metaType = QMetaType::fromName(name).id(); + return metaType <= int(UserType) ? QVariant::Type(metaType) : UserType; + } + QT_WARNING_POP +#endif + + void *data(); + const void *constData() const + { return d.storage(); } + inline const void *data() const { return constData(); } + +private: + template + void verifySuitableForEmplace() + { + static_assert(!std::is_reference_v, + "QVariant does not support reference types"); + static_assert(!std::is_const_v, + "QVariant does not support const types"); + static_assert(std::is_copy_constructible_v, + "QVariant requires that the type is copyable"); + static_assert(std::is_destructible_v, + "QVariant requires that the type is destructible"); + } + + template + T &emplaceImpl(Args&&... args) + { + verifySuitableForEmplace(); + auto data = static_cast(prepareForEmplace(QMetaType::fromType())); + return *q20::construct_at(data, std::forward(args)...); + } + +public: + template = true> + T &emplace(Args&&... args) + { + return emplaceImpl(std::forward(args)...); + } + + template &, Args...> = true> + T &emplace(std::initializer_list list, Args&&... args) + { + return emplaceImpl(list, std::forward(args)...); + } + + template, QVariant>>> + void setValue(T &&avalue) + { + using VT = std::decay_t; + QMetaType metaType = QMetaType::fromType(); + // If possible we reuse the current QVariant private. + if (isDetached() && d.type() == metaType) { + *reinterpret_cast(const_cast(constData())) = std::forward(avalue); + d.is_null = false; + } else { + *this = QVariant::fromValue(std::forward(avalue)); + } + } + + void setValue(const QVariant &avalue) + { + *this = avalue; + } + + void setValue(QVariant &&avalue) + { + *this = std::move(avalue); + } + + template + inline T value() const & + { return qvariant_cast(*this); } + + template + inline T view() + { + T t{}; + QMetaType::view(metaType(), data(), QMetaType::fromType(), &t); + return t; + } + + template + inline T value() && + { return qvariant_cast(std::move(*this)); } + + template = true> +#ifndef Q_QDOC + /* needs is_copy_constructible for variants semantics, is_move_constructible so that moveConstruct works + (but copy_constructible implies move_constructble, so don't bother checking) + */ + static inline auto fromValue(T &&value) + noexcept(std::is_nothrow_copy_constructible_v && Private::CanUseInternalSpace) + -> std::enable_if_t, + std::is_destructible>, QVariant> +#else + static inline QVariant fromValue(T &&value) +#endif + { + // handle special cases + using Type = std::remove_cv_t; + if constexpr (std::is_null_pointer_v) + return QVariant::fromMetaType(QMetaType::fromType()); + else if constexpr (std::is_same_v) + return std::forward(value); + else if constexpr (std::is_same_v) + return QVariant(); + QMetaType mt = QMetaType::fromType(); + mt.registerType(); // we want the type stored in QVariant to always be registered + + // We only try to move if the type is actually moveable and not if T is const + // as in const int i; QVariant::fromValue(std::move(i)); + if constexpr (std::conjunction_v, std::negation>>) + return moveConstruct(QMetaType::fromType(), std::addressof(value)); + else + return copyConstruct(mt, std::addressof(value)); + } + + template +#ifndef Q_QDOC + static inline auto fromValue(const T &value) + noexcept(std::is_nothrow_copy_constructible_v && Private::CanUseInternalSpace) + -> std::enable_if_t && std::is_destructible_v, QVariant> +#else + static inline QVariant fromValue(const T &value) +#endif + { + if constexpr (std::is_null_pointer_v) + return QVariant(QMetaType::fromType()); + else if constexpr (std::is_same_v) + return value; + else if constexpr (std::is_same_v) + return QVariant(); + return QVariant(QMetaType::fromType(), std::addressof(value)); + } + + template + static inline QVariant fromStdVariant(const std::variant &value) + { + return fromStdVariantImpl(value); + } + + template + static QVariant fromStdVariant(std::variant &&value) + { + return fromStdVariantImpl(std::move(value)); + } + + static QVariant fromMetaType(QMetaType type, const void *copy = nullptr); + + template + bool canConvert() const + { return canConvert(QMetaType::fromType()); } + + template + bool canView() const + { return canView(QMetaType::fromType()); } + + static QPartialOrdering compare(const QVariant &lhs, const QVariant &rhs); + +private: + template + static QVariant fromStdVariantImpl(StdVariant &&v) + { + if (Q_UNLIKELY(v.valueless_by_exception())) + return QVariant(); + auto visitor = [](auto &&arg) { + return QVariant::fromValue(q23::forward_like(arg)); + }; + return std::visit(visitor, std::forward(v)); + } + + friend bool comparesEqual(const QVariant &a, const QVariant &b) + { return a.equals(b); } + Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QVariant) + +#ifndef QT_NO_DEBUG_STREAM + template + friend auto operator<<(const QDebug &debug, const T &variant) -> std::enable_if_t, QDebug> { + return variant.qdebugHelper(debug); + } + QDebug qdebugHelper(QDebug) const; +#endif + + template + friend T *get_if(QVariant *v) noexcept + { + // data() will detach from is_null, returning non-nullptr + if (!v || v->d.type() != QMetaType::fromType()) + return nullptr; + return static_cast(v->data()); + } + template + friend const T *get_if(const QVariant *v) noexcept + { + // (const) data() will not detach from is_null, return nullptr + if (!v || v->d.is_null || v->d.type() != QMetaType::fromType()) + return nullptr; + return static_cast(v->data()); + } + +#define Q_MK_GET(cvref) \ + template \ + friend T cvref get(QVariant cvref v) \ + { \ + if constexpr (std::is_const_v) \ + Q_ASSERT(!v.d.is_null); \ + Q_ASSERT(v.d.type() == QMetaType::fromType>()); \ + return static_cast(*get_if(&v)); \ + } \ + /* end */ + Q_MK_GET(&) + Q_MK_GET(const &) + Q_MK_GET(&&) + Q_MK_GET(const &&) +#undef Q_MK_GET + + static QVariant moveConstruct(QMetaType type, void *data); + static QVariant copyConstruct(QMetaType type, const void *data); + + template + friend inline T qvariant_cast(const QVariant &); + template + friend inline T qvariant_cast(QVariant &&); + +protected: + Private d; + void create(int type, const void *copy); + void create(QMetaType type, const void *copy); + bool equals(const QVariant &other) const; + bool convert(int type, void *ptr) const; + bool view(int type, void *ptr); + +private: + // force compile error, prevent QVariant(bool) to be called + inline QVariant(void *) = delete; + // QVariant::Type is marked as \obsolete, but we don't want to + // provide a constructor from its intended replacement, + // QMetaType::Type, instead, because the idea behind these + // constructors is flawed in the first place. But we also don't + // want QVariant(QMetaType::String) to compile and falsely be an + // int variant, so delete this constructor: + QVariant(QMetaType::Type) = delete; + + // used to setup the QVariant internals for the "real" inplace ctor + QVariant(std::in_place_t, QMetaType type); + // helper for emplace + void *prepareForEmplace(QMetaType type); + + // These constructors don't create QVariants of the type associated + // with the enum, as expected, but they would create a QVariant of + // type int with the value of the enum value. + // Use QVariant v = QColor(Qt::red) instead of QVariant v = Qt::red for + // example. + QVariant(Qt::GlobalColor) = delete; + QVariant(Qt::BrushStyle) = delete; + QVariant(Qt::PenStyle) = delete; + QVariant(Qt::CursorShape) = delete; +#ifdef QT_NO_CAST_FROM_ASCII + // force compile error when implicit conversion is not wanted + inline QVariant(const char *) = delete; +#endif +public: + typedef Private DataPtr; + inline DataPtr &data_ptr() { return d; } + inline const DataPtr &data_ptr() const { return d; } +}; + +inline bool QVariant::isValid() const +{ + return d.type().isValid(); +} + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &s, QVariant &p); +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &s, const QVariant &p); + +#if QT_DEPRECATED_SINCE(6, 0) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +QT_DEPRECATED_VERSION_6_0 +inline QDataStream &operator>>(QDataStream &s, QVariant::Type &p) +{ + quint32 u; + s >> u; + p = static_cast(u); + return s; +} +QT_DEPRECATED_VERSION_6_0 +inline QDataStream &operator<<(QDataStream &s, const QVariant::Type p) +{ + s << static_cast(p); + return s; +} +QT_WARNING_POP +#endif + +#endif + +inline bool QVariant::isDetached() const +{ return !d.is_shared || d.data.shared->ref.loadRelaxed() == 1; } + +inline void swap(QVariant &value1, QVariant &value2) noexcept +{ value1.swap(value2); } + +#ifndef QT_MOC + +template inline T qvariant_cast(const QVariant &v) +{ + QMetaType targetType = QMetaType::fromType(); + if (v.d.type() == targetType) + return v.d.get(); + if constexpr (std::is_same_v> const *>) { + using nonConstT = std::remove_const_t> *; + QMetaType nonConstTargetType = QMetaType::fromType(); + if (v.d.type() == nonConstTargetType) + return v.d.get(); + } + + T t{}; + QMetaType::convert(v.metaType(), v.constData(), targetType, &t); + return t; +} + +template inline T qvariant_cast(QVariant &&v) +{ + QMetaType targetType = QMetaType::fromType(); + if (v.d.type() == targetType) { + if constexpr (QVariant::Private::CanUseInternalSpace) { + return std::move(*reinterpret_cast(v.d.data.data)); + } else { + if (v.d.data.shared->ref.loadRelaxed() == 1) + return std::move(*reinterpret_cast(v.d.data.shared->data())); + else + return v.d.get(); + } + } + if constexpr (std::is_same_v) { + // if the metatype doesn't match, but we want a QVariant, just return the current variant + return v; + } if constexpr (std::is_same_v> const *>) { + // moving a pointer is pointless, just do the same as the const & overload + using nonConstT = std::remove_const_t> *; + QMetaType nonConstTargetType = QMetaType::fromType(); + if (v.d.type() == nonConstTargetType) + return v.d.get(); + } + + T t{}; + QMetaType::convert(v.metaType(), v.constData(), targetType, &t); + return t; +} + +# ifndef QT_NO_VARIANT +template<> inline QVariant qvariant_cast(const QVariant &v) +{ + if (v.metaType().id() == QMetaType::QVariant) + return *reinterpret_cast(v.constData()); + return v; +} +# endif + +#endif // QT_MOC + +#ifndef QT_NO_DEBUG_STREAM +#if QT_DEPRECATED_SINCE(6, 0) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +QT_DEPRECATED_VERSION_6_0 +Q_CORE_EXPORT QDebug operator<<(QDebug, const QVariant::Type); +QT_WARNING_POP +#endif +#endif + +namespace QtPrivate { +class Q_CORE_EXPORT QVariantTypeCoercer +{ +public: + // ### Qt7: Pass QMetaType as value rather than const ref. + const void *convert(const QVariant &value, const QMetaType &type); + const void *coerce(const QVariant &value, const QMetaType &type); + +private: + QVariant converted; +}; +} + +template +class QVariantRef +{ +private: + const Pointer *m_pointer = nullptr; + +public: + explicit QVariantRef(const Pointer *reference) : m_pointer(reference) {} + QVariantRef(const QVariantRef &) = default; + QVariantRef(QVariantRef &&) = default; + ~QVariantRef() = default; + + operator QVariant() const; + QVariantRef &operator=(const QVariant &value); + QVariantRef &operator=(const QVariantRef &value) { return operator=(QVariant(value)); } + QVariantRef &operator=(QVariantRef &&value) { return operator=(QVariant(value)); } + + friend void swap(QVariantRef a, QVariantRef b) + { + QVariant tmp = a; + a = b; + b = std::move(tmp); + } +}; + +class Q_CORE_EXPORT QVariantConstPointer +{ +private: + QVariant m_variant; + +public: + explicit QVariantConstPointer(QVariant variant); + + QVariant operator*() const; + const QVariant *operator->() const; +}; + +template +class QVariantPointer +{ +private: + const Pointer *m_pointer = nullptr; + +public: + explicit QVariantPointer(const Pointer *pointer) : m_pointer(pointer) {} + QVariantRef operator*() const { return QVariantRef(m_pointer); } + Pointer operator->() const { return *m_pointer; } +}; + +QT_END_NAMESPACE + +#endif // QVARIANT_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qvariantanimation.h b/qt/6.8.1/msvc2022_64/include/QtCore/qvariantanimation.h new file mode 100644 index 0000000000000000000000000000000000000000..b4b52112afdde57de6db9508b95e0421f142040e --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qvariantanimation.h @@ -0,0 +1,87 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QVARIANTANIMATION_H +#define QVARIANTANIMATION_H + +#include +#include +#include +#include +#include + +QT_REQUIRE_CONFIG(animation); + +QT_BEGIN_NAMESPACE + +class QVariantAnimationPrivate; +class Q_CORE_EXPORT QVariantAnimation : public QAbstractAnimation +{ + Q_OBJECT + Q_PROPERTY(QVariant startValue READ startValue WRITE setStartValue) + Q_PROPERTY(QVariant endValue READ endValue WRITE setEndValue) + Q_PROPERTY(QVariant currentValue READ currentValue NOTIFY valueChanged) + Q_PROPERTY(int duration READ duration WRITE setDuration BINDABLE bindableDuration) + Q_PROPERTY(QEasingCurve easingCurve READ easingCurve WRITE setEasingCurve + BINDABLE bindableEasingCurve) + +public: + using KeyValue = std::pair; + typedef QList KeyValues; + + QVariantAnimation(QObject *parent = nullptr); + ~QVariantAnimation(); + + QVariant startValue() const; + void setStartValue(const QVariant &value); + + QVariant endValue() const; + void setEndValue(const QVariant &value); + + QVariant keyValueAt(qreal step) const; + void setKeyValueAt(qreal step, const QVariant &value); + + KeyValues keyValues() const; + void setKeyValues(const KeyValues &values); + + QVariant currentValue() const; + + int duration() const override; + void setDuration(int msecs); + QBindable bindableDuration(); + + QEasingCurve easingCurve() const; + void setEasingCurve(const QEasingCurve &easing); + QBindable bindableEasingCurve(); + + typedef QVariant (*Interpolator)(const void *from, const void *to, qreal progress); + +Q_SIGNALS: + void valueChanged(const QVariant &value); + +protected: + QVariantAnimation(QVariantAnimationPrivate &dd, QObject *parent = nullptr); + bool event(QEvent *event) override; + + void updateCurrentTime(int) override; + void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) override; + + virtual void updateCurrentValue(const QVariant &value); + virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const; + +private: + template friend void qRegisterAnimationInterpolator(QVariant (*func)(const T &, const T &, qreal)); + static void registerInterpolator(Interpolator func, int interpolationType); + + Q_DISABLE_COPY(QVariantAnimation) + Q_DECLARE_PRIVATE(QVariantAnimation) +}; + +template +void qRegisterAnimationInterpolator(QVariant (*func)(const T &from, const T &to, qreal progress)) { + QVariantAnimation::registerInterpolator(reinterpret_cast(reinterpret_cast(func)), qMetaTypeId()); +} + +QT_END_NAMESPACE + +#endif //QVARIANTANIMATION_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qvarianthash.h b/qt/6.8.1/msvc2022_64/include/QtCore/qvarianthash.h new file mode 100644 index 0000000000000000000000000000000000000000..e9825f0003fc9ce5a6f210ad1614fd33de5828ea --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qvarianthash.h @@ -0,0 +1,20 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QVARIANTHASH_H +#define QVARIANTHASH_H + +#if 0 +#pragma qt_class(QVariantHash) +#endif + +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE +QT_END_NAMESPACE + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qvariantlist.h b/qt/6.8.1/msvc2022_64/include/QtCore/qvariantlist.h new file mode 100644 index 0000000000000000000000000000000000000000..4853fd75c0cfde051e2ee7e06d8cf86db48fff0f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qvariantlist.h @@ -0,0 +1,19 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QVARIANTLIST_H +#define QVARIANTLIST_H + +#if 0 +#pragma qt_class(QVariantList) +#endif + +#include + +#include +#include + +QT_BEGIN_NAMESPACE +QT_END_NAMESPACE + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qvariantmap.h b/qt/6.8.1/msvc2022_64/include/QtCore/qvariantmap.h new file mode 100644 index 0000000000000000000000000000000000000000..38a9313b9afe20991f3255bdc8157197ee677953 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qvariantmap.h @@ -0,0 +1,20 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QVARIANTMAP_H +#define QVARIANTMAP_H + +#if 0 +#pragma qt_class(QVariantMap) +#endif + +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE +QT_END_NAMESPACE + +#endif diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qvarlengtharray.h b/qt/6.8.1/msvc2022_64/include/QtCore/qvarlengtharray.h new file mode 100644 index 0000000000000000000000000000000000000000..cbc71ba259b80b610b2c84ca9182694761b99bcd --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qvarlengtharray.h @@ -0,0 +1,1032 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QVARLENGTHARRAY_H +#define QVARLENGTHARRAY_H + +#if 0 +#pragma qt_class(QVarLengthArray) +#pragma qt_sync_stop_processing +#endif + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +template +class QVLAStorage +{ + template class print; +protected: + ~QVLAStorage() = default; + + alignas(Align) char array[Prealloc * (Align > Size ? Align : Size)]; + QT_WARNING_PUSH + QT_WARNING_DISABLE_DEPRECATED + // ensure we maintain BC: std::aligned_storage_t was only specified by a + // minimum size, but for BC we need the substitution to be exact in size: + static_assert(std::is_same_v[Prealloc])>, + print>); + QT_WARNING_POP +}; + +class QVLABaseBase +{ +protected: + ~QVLABaseBase() = default; + + qsizetype a; // capacity + qsizetype s; // size + void *ptr; // data + + Q_ALWAYS_INLINE constexpr void verify([[maybe_unused]] qsizetype pos = 0, + [[maybe_unused]] qsizetype n = 1) const + { + Q_ASSERT(pos >= 0); + Q_ASSERT(pos <= size()); + Q_ASSERT(n >= 0); + Q_ASSERT(n <= size() - pos); + } + + struct free_deleter { + void operator()(void *p) const noexcept { free(p); } + }; + using malloced_ptr = std::unique_ptr; + +public: + using size_type = qsizetype; + + constexpr size_type capacity() const noexcept { return a; } + constexpr size_type size() const noexcept { return s; } + constexpr bool empty() const noexcept { return size() == 0; } +}; + +template +class QVLABase : public QVLABaseBase +{ +protected: + ~QVLABase() = default; + +public: + T *data() noexcept { return static_cast(ptr); } + const T *data() const noexcept { return static_cast(ptr); } + + using iterator = T*; + using const_iterator = const T*; + + iterator begin() noexcept { return data(); } + const_iterator begin() const noexcept { return data(); } + const_iterator cbegin() const noexcept { return begin(); } + iterator end() noexcept { return data() + size(); } + const_iterator end() const noexcept { return data() + size(); } + const_iterator cend() const noexcept { return end(); } + + using reverse_iterator = std::reverse_iterator; + using const_reverse_iterator = std::reverse_iterator; + + reverse_iterator rbegin() noexcept { return reverse_iterator{end()}; } + const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator{end()}; } + const_reverse_iterator crbegin() const noexcept { return rbegin(); } + reverse_iterator rend() noexcept { return reverse_iterator{begin()}; } + const_reverse_iterator rend() const noexcept { return const_reverse_iterator{begin()}; } + const_reverse_iterator crend() const noexcept { return rend(); } + + using value_type = T; + using reference = value_type&; + using const_reference = const value_type&; + using pointer = value_type*; + using const_pointer = const value_type*; + using difference_type = qptrdiff; + + reference front() + { + verify(); + return *begin(); + } + + const_reference front() const + { + verify(); + return *begin(); + } + + reference back() + { + verify(); + return *rbegin(); + } + + const_reference back() const + { + verify(); + return *rbegin(); + } + + void pop_back() + { + verify(); + if constexpr (QTypeInfo::isComplex) + data()[size() - 1].~T(); + --s; + } + + template + qsizetype indexOf(const AT &t, qsizetype from = 0) const; + template + qsizetype lastIndexOf(const AT &t, qsizetype from = -1) const; + template + bool contains(const AT &t) const; + + reference operator[](qsizetype idx) + { + verify(idx); + return data()[idx]; + } + const_reference operator[](qsizetype idx) const + { + verify(idx); + return data()[idx]; + } + + value_type value(qsizetype i) const; + value_type value(qsizetype i, const T& defaultValue) const; + + void replace(qsizetype i, const T &t); + void remove(qsizetype i, qsizetype n = 1); + template + qsizetype removeAll(const AT &t); + template + bool removeOne(const AT &t); + template + qsizetype removeIf(Predicate pred); + + void clear() + { + if constexpr (QTypeInfo::isComplex) + std::destroy_n(data(), size()); + s = 0; + } + + iterator erase(const_iterator begin, const_iterator end); + iterator erase(const_iterator pos) { return erase(pos, pos + 1); } + + static constexpr qsizetype maxSize() noexcept + { + // -1 to deal with the pointer one-past-the-end + return (QtPrivate::MaxAllocSize / sizeof(T)) - 1; + } + constexpr qsizetype max_size() const noexcept + { + return maxSize(); + } + + size_t hash(size_t seed) const noexcept(QtPrivate::QNothrowHashable_v) + { + return qHashRange(begin(), end(), seed); + } +protected: + void growBy(qsizetype prealloc, void *array, qsizetype increment) + { reallocate_impl(prealloc, array, size(), (std::max)(size() * 2, size() + increment)); } + template + reference emplace_back_impl(qsizetype prealloc, void *array, Args&&...args) + { + if (size() == capacity()) // ie. size() != 0 + growBy(prealloc, array, 1); + reference r = *q20::construct_at(end(), std::forward(args)...); + ++s; + return r; + } + template + iterator emplace_impl(qsizetype prealloc, void *array, const_iterator pos, Args&&...arg); + + iterator insert_impl(qsizetype prealloc, void *array, const_iterator pos, qsizetype n, const T &t); + + template + bool equal(const QVLABase &other) const + { + return std::equal(begin(), end(), other.begin(), other.end()); + } + template + bool less_than(const QVLABase &other) const + { + return std::lexicographical_compare(begin(), end(), other.begin(), other.end()); + } + + void append_impl(qsizetype prealloc, void *array, const T *buf, qsizetype n); + void reallocate_impl(qsizetype prealloc, void *array, qsizetype size, qsizetype alloc); + void resize_impl(qsizetype prealloc, void *array, qsizetype sz, const T &v) + { + if (QtPrivate::q_points_into_range(&v, begin(), end())) { + resize_impl(prealloc, array, sz, T(v)); + return; + } + reallocate_impl(prealloc, array, sz, qMax(sz, capacity())); + while (size() < sz) { + q20::construct_at(data() + size(), v); + ++s; + } + } + void resize_impl(qsizetype prealloc, void *array, qsizetype sz) + { + reallocate_impl(prealloc, array, sz, qMax(sz, capacity())); + if constexpr (QTypeInfo::isComplex) { + // call default constructor for new objects (which can throw) + while (size() < sz) { + q20::construct_at(data() + size()); + ++s; + } + } else { + s = sz; + } + } + + void assign_impl(qsizetype prealloc, void *array, qsizetype n, const T &t); + template + void assign_impl(qsizetype prealloc, void *array, Iterator first, Iterator last); + + bool isValidIterator(const const_iterator &i) const + { + const std::less less = {}; + return !less(cend(), i) && !less(i, cbegin()); + } +}; + +// Prealloc = 256 by default, specified in qcontainerfwd.h +template +class QVarLengthArray +#if QT_VERSION >= QT_VERSION_CHECK(7,0,0) || defined(QT_BOOTSTRAPPED) + : public QVLAStorage, + public QVLABase +#else + : public QVLABase, + public QVLAStorage +#endif +{ + template + friend class QVarLengthArray; + using Base = QVLABase; + using Storage = QVLAStorage; + static_assert(Prealloc > 0, "QVarLengthArray Prealloc must be greater than 0."); + static_assert(std::is_nothrow_destructible_v, "Types with throwing destructors are not supported in Qt containers."); + using Base::verify; + + template + using if_copyable = std::enable_if_t, bool>; + template + using if_input_iterator = QtPrivate::IfIsInputIterator; +public: + static constexpr qsizetype PreallocatedSize = Prealloc; + + using size_type = typename Base::size_type; + using value_type = typename Base::value_type; + using pointer = typename Base::pointer; + using const_pointer = typename Base::const_pointer; + using reference = typename Base::reference; + using const_reference = typename Base::const_reference; + using difference_type = typename Base::difference_type; + + using iterator = typename Base::iterator; + using const_iterator = typename Base::const_iterator; + using reverse_iterator = typename Base::reverse_iterator; + using const_reverse_iterator = typename Base::const_reverse_iterator; + + QVarLengthArray() noexcept + { + this->a = Prealloc; + this->s = 0; + this->ptr = this->array; + } + + inline explicit QVarLengthArray(qsizetype size); + +#ifndef Q_QDOC + template = true> +#endif + explicit QVarLengthArray(qsizetype sz, const T &v) + : QVarLengthArray{} + { + resize(sz, v); + } + + QVarLengthArray(const QVarLengthArray &other) + : QVarLengthArray{} + { + append(other.constData(), other.size()); + } + + QVarLengthArray(QVarLengthArray &&other) + noexcept(std::is_nothrow_move_constructible_v) + : Base(other) + { + const auto otherInlineStorage = reinterpret_cast(other.array); + if (data() == otherInlineStorage) { + // inline buffer - move into our inline buffer: + this->ptr = this->array; + QtPrivate::q_uninitialized_relocate_n(otherInlineStorage, size(), data()); + } else { + // heap buffer - we just stole the memory + } + // reset other to internal storage: + other.a = Prealloc; + other.s = 0; + other.ptr = otherInlineStorage; + } + + QVarLengthArray(std::initializer_list args) + : QVarLengthArray(args.begin(), args.end()) + { + } + + template = true> + inline QVarLengthArray(InputIterator first, InputIterator last) + : QVarLengthArray() + { + QtPrivate::reserveIfForwardIterator(this, first, last); + std::copy(first, last, std::back_inserter(*this)); + } + + inline ~QVarLengthArray() + { + if constexpr (QTypeInfo::isComplex) + std::destroy_n(data(), size()); + if (data() != reinterpret_cast(this->array)) + free(data()); + } + inline QVarLengthArray &operator=(const QVarLengthArray &other) + { + if (this != &other) { + clear(); + append(other.constData(), other.size()); + } + return *this; + } + + QVarLengthArray &operator=(QVarLengthArray &&other) + noexcept(std::is_nothrow_move_constructible_v) + { + // we're only required to be self-move-assignment-safe + // when we're in the moved-from state (Hinnant criterion) + // the moved-from state is the empty state, so we're good with the clear() here: + clear(); + Q_ASSERT(capacity() >= Prealloc); + const auto otherInlineStorage = other.array; + if (other.ptr != otherInlineStorage) { + // heap storage: steal the external buffer, reset other to otherInlineStorage + this->a = std::exchange(other.a, Prealloc); + this->ptr = std::exchange(other.ptr, otherInlineStorage); + } else { + // inline storage: move into our storage (doesn't matter whether inline or external) + QtPrivate::q_uninitialized_relocate_n(other.data(), other.size(), data()); + } + this->s = std::exchange(other.s, 0); + return *this; + } + + QVarLengthArray &operator=(std::initializer_list list) + { + assign(list); + return *this; + } + + inline void removeLast() + { + Base::pop_back(); + } +#ifdef Q_QDOC + inline qsizetype size() const { return this->s; } + static constexpr qsizetype maxSize() noexcept { return QVLABase::maxSize(); } + constexpr qsizetype max_size() const noexcept { return QVLABase::max_size(); } +#endif + using Base::size; + using Base::max_size; + inline qsizetype count() const { return size(); } + inline qsizetype length() const { return size(); } + inline T &first() + { + return front(); + } + inline const T &first() const + { + return front(); + } + T &last() + { + return back(); + } + const T &last() const + { + return back(); + } + bool isEmpty() const { return empty(); } + void resize(qsizetype sz) { Base::resize_impl(Prealloc, this->array, sz); } +#ifndef Q_QDOC + template = true> +#endif + void resize(qsizetype sz, const T &v) + { Base::resize_impl(Prealloc, this->array, sz, v); } + using Base::clear; +#ifdef Q_QDOC + inline void clear() { resize(0); } +#endif + void squeeze() { reallocate(size(), size()); } + + using Base::capacity; +#ifdef Q_QDOC + qsizetype capacity() const { return this->a; } +#endif + void reserve(qsizetype sz) { if (sz > capacity()) reallocate(size(), sz); } + +#ifdef Q_QDOC + template + inline qsizetype indexOf(const AT &t, qsizetype from = 0) const; + template + inline qsizetype lastIndexOf(const AT &t, qsizetype from = -1) const; + template + inline bool contains(const AT &t) const; +#endif + using Base::indexOf; + using Base::lastIndexOf; + using Base::contains; + +#ifdef Q_QDOC + inline T &operator[](qsizetype idx) + { + verify(idx); + return data()[idx]; + } + inline const T &operator[](qsizetype idx) const + { + verify(idx); + return data()[idx]; + } +#endif + using Base::operator[]; + inline const T &at(qsizetype idx) const { return operator[](idx); } + +#ifdef Q_QDOC + T value(qsizetype i) const; + T value(qsizetype i, const T &defaultValue) const; +#endif + using Base::value; + + inline void append(const T &t) + { + if (size() == capacity()) + emplace_back(T(t)); + else + emplace_back(t); + } + + void append(T &&t) + { + emplace_back(std::move(t)); + } + + void append(const T *buf, qsizetype sz) + { Base::append_impl(Prealloc, this->array, buf, sz); } + inline QVarLengthArray &operator<<(const T &t) + { append(t); return *this; } + inline QVarLengthArray &operator<<(T &&t) + { append(std::move(t)); return *this; } + inline QVarLengthArray &operator+=(const T &t) + { append(t); return *this; } + inline QVarLengthArray &operator+=(T &&t) + { append(std::move(t)); return *this; } + +#if QT_DEPRECATED_SINCE(6, 3) + QT_DEPRECATED_VERSION_X_6_3("This is slow. If you must, use insert(cbegin(), ~~~) instead.") + void prepend(T &&t); + QT_DEPRECATED_VERSION_X_6_3("This is slow. If you must, use insert(cbegin(), ~~~) instead.") + void prepend(const T &t); +#endif + void insert(qsizetype i, T &&t); + void insert(qsizetype i, const T &t); + void insert(qsizetype i, qsizetype n, const T &t); + + QVarLengthArray &assign(qsizetype n, const T &t) + { Base::assign_impl(Prealloc, this->array, n, t); return *this; } + template = true> + QVarLengthArray &assign(InputIterator first, InputIterator last) + { Base::assign_impl(Prealloc, this->array, first, last); return *this; } + QVarLengthArray &assign(std::initializer_list list) + { assign(list.begin(), list.end()); return *this; } + +#ifdef Q_QDOC + void replace(qsizetype i, const T &t); + void remove(qsizetype i, qsizetype n = 1); + template + qsizetype removeAll(const AT &t); + template + bool removeOne(const AT &t); + template + qsizetype removeIf(Predicate pred); +#endif + using Base::replace; + using Base::remove; + using Base::removeAll; + using Base::removeOne; + using Base::removeIf; + +#ifdef Q_QDOC + inline T *data() { return this->ptr; } + inline const T *data() const { return this->ptr; } +#endif + using Base::data; + inline const T *constData() const { return data(); } +#ifdef Q_QDOC + inline iterator begin() { return data(); } + inline const_iterator begin() const { return data(); } + inline const_iterator cbegin() const { return begin(); } + inline const_iterator constBegin() const { return begin(); } + inline iterator end() { return data() + size(); } + inline const_iterator end() const { return data() + size(); } + inline const_iterator cend() const { return end(); } +#endif + + using Base::begin; + using Base::cbegin; + auto constBegin() const -> const_iterator { return begin(); } + using Base::end; + using Base::cend; + inline const_iterator constEnd() const { return end(); } +#ifdef Q_QDOC + reverse_iterator rbegin() { return reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } + const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } + const_reverse_iterator crbegin() const { return const_reverse_iterator(end()); } + const_reverse_iterator crend() const { return const_reverse_iterator(begin()); } +#endif + using Base::rbegin; + using Base::crbegin; + using Base::rend; + using Base::crend; + + iterator insert(const_iterator before, qsizetype n, const T &x) + { return Base::insert_impl(Prealloc, this->array, before, n, x); } + iterator insert(const_iterator before, T &&x) { return emplace(before, std::move(x)); } + inline iterator insert(const_iterator before, const T &x) { return insert(before, 1, x); } +#ifdef Q_QDOC + iterator erase(const_iterator begin, const_iterator end); + inline iterator erase(const_iterator pos) { return erase(pos, pos + 1); } +#endif + using Base::erase; + + // STL compatibility: +#ifdef Q_QDOC + inline bool empty() const { return isEmpty(); } +#endif + using Base::empty; + inline void push_back(const T &t) { append(t); } + void push_back(T &&t) { append(std::move(t)); } +#ifdef Q_QDOC + inline void pop_back() { removeLast(); } + inline T &front() { return first(); } + inline const T &front() const { return first(); } + inline T &back() { return last(); } + inline const T &back() const { return last(); } +#endif + using Base::pop_back; + using Base::front; + using Base::back; + void shrink_to_fit() { squeeze(); } + template + iterator emplace(const_iterator pos, Args &&...args) + { return Base::emplace_impl(Prealloc, this->array, pos, std::forward(args)...); } + template + T &emplace_back(Args &&...args) + { return Base::emplace_back_impl(Prealloc, this->array, std::forward(args)...); } + + +#ifdef Q_QDOC + template + friend inline bool operator==(const QVarLengthArray &l, const QVarLengthArray &r); + template + friend inline bool operator!=(const QVarLengthArray &l, const QVarLengthArray &r); + template + friend inline bool operator< (const QVarLengthArray &l, const QVarLengthArray &r); + template + friend inline bool operator> (const QVarLengthArray &l, const QVarLengthArray &r); + template + friend inline bool operator<=(const QVarLengthArray &l, const QVarLengthArray &r); + template + friend inline bool operator>=(const QVarLengthArray &l, const QVarLengthArray &r); +#else + template friend + QTypeTraits::compare_eq_result operator==(const QVarLengthArray &l, const QVarLengthArray &r) + { + return l.equal(r); + } + + template friend + QTypeTraits::compare_eq_result operator!=(const QVarLengthArray &l, const QVarLengthArray &r) + { + return !(l == r); + } + + template friend + QTypeTraits::compare_lt_result operator<(const QVarLengthArray &lhs, const QVarLengthArray &rhs) + noexcept(noexcept(std::lexicographical_compare(lhs.begin(), lhs.end(), + rhs.begin(), rhs.end()))) + { + return lhs.less_than(rhs); + } + + template friend + QTypeTraits::compare_lt_result operator>(const QVarLengthArray &lhs, const QVarLengthArray &rhs) + noexcept(noexcept(lhs < rhs)) + { + return rhs < lhs; + } + + template friend + QTypeTraits::compare_lt_result operator<=(const QVarLengthArray &lhs, const QVarLengthArray &rhs) + noexcept(noexcept(lhs < rhs)) + { + return !(lhs > rhs); + } + + template friend + QTypeTraits::compare_lt_result operator>=(const QVarLengthArray &lhs, const QVarLengthArray &rhs) + noexcept(noexcept(lhs < rhs)) + { + return !(lhs < rhs); + } +#endif + +private: + template + bool equal(const QVarLengthArray &other) const + { return Base::equal(other); } + template + bool less_than(const QVarLengthArray &other) const + { return Base::less_than(other); } + + void reallocate(qsizetype sz, qsizetype alloc) + { Base::reallocate_impl(Prealloc, this->array, sz, alloc); } + + using Base::isValidIterator; +}; + +template ::value_type, + QtPrivate::IfIsInputIterator = true> +QVarLengthArray(InputIterator, InputIterator) -> QVarLengthArray; + +template +Q_INLINE_TEMPLATE QVarLengthArray::QVarLengthArray(qsizetype asize) + : QVarLengthArray() +{ + Q_ASSERT_X(asize >= 0, "QVarLengthArray::QVarLengthArray(qsizetype)", + "Size must be greater than or equal to 0."); + + // historically, this ctor worked for non-copyable/non-movable T, so keep it working, why not? + // resize(asize) // this requires a movable or copyable T, can't use, need to do it by hand + + if (asize > Prealloc) { + this->ptr = malloc(asize * sizeof(T)); + Q_CHECK_PTR(this->ptr); + this->a = asize; + } + if constexpr (QTypeInfo::isComplex) + std::uninitialized_default_construct_n(data(), asize); + this->s = asize; +} + +template +template +Q_INLINE_TEMPLATE qsizetype QVLABase::indexOf(const AT &t, qsizetype from) const +{ + if (from < 0) + from = qMax(from + size(), qsizetype(0)); + if (from < size()) { + const T *n = data() + from - 1; + const T *e = end(); + while (++n != e) + if (*n == t) + return n - data(); + } + return -1; +} + +template +template +Q_INLINE_TEMPLATE qsizetype QVLABase::lastIndexOf(const AT &t, qsizetype from) const +{ + if (from < 0) + from += size(); + else if (from >= size()) + from = size() - 1; + if (from >= 0) { + const T *b = begin(); + const T *n = b + from + 1; + while (n != b) { + if (*--n == t) + return n - b; + } + } + return -1; +} + +template +template +Q_INLINE_TEMPLATE bool QVLABase::contains(const AT &t) const +{ + const T *b = begin(); + const T *i = end(); + while (i != b) { + if (*--i == t) + return true; + } + return false; +} + +template +Q_OUTOFLINE_TEMPLATE void QVLABase::append_impl(qsizetype prealloc, void *array, const T *abuf, qsizetype increment) +{ + Q_ASSERT(abuf || increment == 0); + if (increment <= 0) + return; + + const qsizetype asize = size() + increment; + + if (asize >= capacity()) + growBy(prealloc, array, increment); + + if constexpr (QTypeInfo::isComplex) + std::uninitialized_copy_n(abuf, increment, end()); + else + memcpy(static_cast(end()), static_cast(abuf), increment * sizeof(T)); + + this->s = asize; +} + +template +Q_OUTOFLINE_TEMPLATE void QVLABase::assign_impl(qsizetype prealloc, void *array, qsizetype n, const T &t) +{ + Q_ASSERT(n >= 0); + if (n > capacity()) { + reallocate_impl(prealloc, array, 0, capacity()); // clear + resize_impl(prealloc, array, n, t); + } else { + auto mid = (std::min)(n, size()); + std::fill(data(), data() + mid, t); + std::uninitialized_fill(data() + mid, data() + n, t); + s = n; + erase(data() + n, data() + size()); + } +} + +template +template +Q_OUTOFLINE_TEMPLATE void QVLABase::assign_impl(qsizetype prealloc, void *array, Iterator first, Iterator last) +{ + // This function only provides the basic exception guarantee. + constexpr bool IsFwdIt = + std::is_convertible_v::iterator_category, + std::forward_iterator_tag>; + if constexpr (IsFwdIt) { + const qsizetype n = std::distance(first, last); + if (n > capacity()) + reallocate_impl(prealloc, array, 0, n); // clear & reserve n + } + + auto dst = begin(); + const auto dend = end(); + while (true) { + if (first == last) { // ran out of elements to assign + std::destroy(dst, dend); + break; + } + if (dst == dend) { // ran out of existing elements to overwrite + if constexpr (IsFwdIt) { + dst = std::uninitialized_copy(first, last, dst); + break; + } else { + do { + emplace_back_impl(prealloc, array, *first); + } while (++first != last); + return; // size() is already correct (and dst invalidated)! + } + } + *dst = *first; // overwrite existing element + ++dst; + ++first; + } + this->s = dst - begin(); +} + +template +Q_OUTOFLINE_TEMPLATE void QVLABase::reallocate_impl(qsizetype prealloc, void *array, qsizetype asize, qsizetype aalloc) +{ + Q_ASSERT(aalloc >= asize); + Q_ASSERT(data()); + T *oldPtr = data(); + qsizetype osize = size(); + + const qsizetype copySize = qMin(asize, osize); + Q_ASSERT(copySize >= 0); + + if (aalloc != capacity()) { + QVLABaseBase::malloced_ptr guard; + void *newPtr; + qsizetype newA; + if (aalloc > prealloc) { + newPtr = malloc(aalloc * sizeof(T)); + guard.reset(newPtr); + Q_CHECK_PTR(newPtr); // could throw + // by design: in case of QT_NO_EXCEPTIONS malloc must not fail or it crashes here + newA = aalloc; + } else { + newPtr = array; + newA = prealloc; + } + QtPrivate::q_uninitialized_relocate_n(oldPtr, copySize, + reinterpret_cast(newPtr)); + // commit: + ptr = newPtr; + guard.release(); + a = newA; + } + s = copySize; + + // destroy remaining old objects + if constexpr (QTypeInfo::isComplex) { + if (osize > asize) + std::destroy(oldPtr + asize, oldPtr + osize); + } + + if (oldPtr != reinterpret_cast(array) && oldPtr != data()) + free(oldPtr); +} + +template +Q_OUTOFLINE_TEMPLATE T QVLABase::value(qsizetype i) const +{ + if (size_t(i) >= size_t(size())) + return T(); + return operator[](i); +} +template +Q_OUTOFLINE_TEMPLATE T QVLABase::value(qsizetype i, const T &defaultValue) const +{ + return (size_t(i) >= size_t(size())) ? defaultValue : operator[](i); +} + +template +inline void QVarLengthArray::insert(qsizetype i, T &&t) +{ verify(i, 0); + insert(cbegin() + i, std::move(t)); } +template +inline void QVarLengthArray::insert(qsizetype i, const T &t) +{ verify(i, 0); + insert(begin() + i, 1, t); } +template +inline void QVarLengthArray::insert(qsizetype i, qsizetype n, const T &t) +{ verify(i, 0); + insert(begin() + i, n, t); } +template +inline void QVLABase::remove(qsizetype i, qsizetype n) +{ verify(i, n); + erase(begin() + i, begin() + i + n); } +template +template +inline qsizetype QVLABase::removeAll(const AT &t) +{ return QtPrivate::sequential_erase_with_copy(*this, t); } +template +template +inline bool QVLABase::removeOne(const AT &t) +{ return QtPrivate::sequential_erase_one(*this, t); } +template +template +inline qsizetype QVLABase::removeIf(Predicate pred) +{ return QtPrivate::sequential_erase_if(*this, pred); } +#if QT_DEPRECATED_SINCE(6, 3) +template +inline void QVarLengthArray::prepend(T &&t) +{ insert(cbegin(), std::move(t)); } +template +inline void QVarLengthArray::prepend(const T &t) +{ insert(begin(), 1, t); } +#endif + +template +inline void QVLABase::replace(qsizetype i, const T &t) +{ + verify(i); + data()[i] = t; +} + +template +template +Q_OUTOFLINE_TEMPLATE auto QVLABase::emplace_impl(qsizetype prealloc, void *array, const_iterator before, Args &&...args) -> iterator +{ + Q_ASSERT_X(isValidIterator(before), "QVarLengthArray::insert", "The specified const_iterator argument 'before' is invalid"); + Q_ASSERT(size() <= capacity()); + Q_ASSERT(capacity() > 0); + + const qsizetype offset = qsizetype(before - cbegin()); + emplace_back_impl(prealloc, array, std::forward(args)...); + const auto b = begin() + offset; + const auto e = end(); + QtPrivate::q_rotate(b, e - 1, e); + return b; +} + +template +Q_OUTOFLINE_TEMPLATE auto QVLABase::insert_impl(qsizetype prealloc, void *array, const_iterator before, qsizetype n, const T &t) -> iterator +{ + Q_ASSERT_X(isValidIterator(before), "QVarLengthArray::insert", "The specified const_iterator argument 'before' is invalid"); + + const qsizetype offset = qsizetype(before - cbegin()); + resize_impl(prealloc, array, size() + n, t); + const auto b = begin() + offset; + const auto e = end(); + QtPrivate::q_rotate(b, e - n, e); + return b; +} + +template +Q_OUTOFLINE_TEMPLATE auto QVLABase::erase(const_iterator abegin, const_iterator aend) -> iterator +{ + Q_ASSERT_X(isValidIterator(abegin), "QVarLengthArray::erase", "The specified const_iterator argument 'abegin' is invalid"); + Q_ASSERT_X(isValidIterator(aend), "QVarLengthArray::erase", "The specified const_iterator argument 'aend' is invalid"); + + qsizetype f = qsizetype(abegin - cbegin()); + qsizetype l = qsizetype(aend - cbegin()); + qsizetype n = l - f; + + if (n == 0) // avoid UB in std::move() below + return data() + f; + + Q_ASSERT(n > 0); // aend must be reachable from abegin + + if constexpr (!QTypeInfo::isRelocatable) { + std::move(begin() + l, end(), QT_MAKE_CHECKED_ARRAY_ITERATOR(begin() + f, size() - f)); + std::destroy(end() - n, end()); + } else { + std::destroy(abegin, aend); + memmove(static_cast(data() + f), static_cast(data() + l), (size() - l) * sizeof(T)); + } + this->s -= n; + return data() + f; +} + +#ifdef Q_QDOC +// Fake definitions for qdoc, only the redeclaration is used. +template +bool operator==(const QVarLengthArray &l, const QVarLengthArray &r) +{ return bool{}; } +template +bool operator!=(const QVarLengthArray &l, const QVarLengthArray &r) +{ return bool{}; } +template +bool operator< (const QVarLengthArray &l, const QVarLengthArray &r) +{ return bool{}; } +template +bool operator> (const QVarLengthArray &l, const QVarLengthArray &r) +{ return bool{}; } +template +bool operator<=(const QVarLengthArray &l, const QVarLengthArray &r) +{ return bool{}; } +template +bool operator>=(const QVarLengthArray &l, const QVarLengthArray &r) +{ return bool{}; } +#endif + +template +size_t qHash(const QVarLengthArray &key, size_t seed = 0) + noexcept(QtPrivate::QNothrowHashable_v) +{ + return key.hash(seed); +} + +template +qsizetype erase(QVarLengthArray &array, const AT &t) +{ + return array.removeAll(t); +} + +template +qsizetype erase_if(QVarLengthArray &array, Predicate pred) +{ + return array.removeIf(pred); +} + +QT_END_NAMESPACE + +#endif // QVARLENGTHARRAY_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qvector.h b/qt/6.8.1/msvc2022_64/include/QtCore/qvector.h new file mode 100644 index 0000000000000000000000000000000000000000..1ab30150b4174ae434217aecd161ee0acdad0f1f --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qvector.h @@ -0,0 +1,27 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QVECTOR_H +#define QVECTOR_H + +#include +#include + +#if 0 +#pragma qt_class(QVector) +#pragma qt_class(QMutableVectorIterator) +#pragma qt_class(QVectorIterator) +#endif + +QT_BEGIN_NAMESPACE + +#if !defined(QT_NO_JAVA_STYLE_ITERATORS) +template +using QMutableVectorIterator = QMutableListIterator; +template +using QVectorIterator = QListIterator; +#endif + +QT_END_NAMESPACE + +#endif // QVECTOR_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qversionnumber.h b/qt/6.8.1/msvc2022_64/include/QtCore/qversionnumber.h new file mode 100644 index 0000000000000000000000000000000000000000..506b7f708da7b40380e22fadbec05eaea49b768b --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qversionnumber.h @@ -0,0 +1,413 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2022 Intel Corporation. +// Copyright (C) 2015 Keith Gardner +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QVERSIONNUMBER_H +#define QVERSIONNUMBER_H + +#include +#include +#include +#include +#include +#include +#include +#include +#if !defined(QT_LEAN_HEADERS) || QT_LEAN_HEADERS < 2 +#include +#endif // lean headers level 2 + +QT_BEGIN_NAMESPACE + +class QVersionNumber; +Q_CORE_EXPORT size_t qHash(const QVersionNumber &key, size_t seed = 0); + +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &out, const QVersionNumber &version); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &in, QVersionNumber &version); +#endif + +class QVersionNumber +{ + /* + * QVersionNumber stores small values inline, without memory allocation. + * We do that by setting the LSB in the pointer that would otherwise hold + * the longer form of the segments. + * The constants below help us deal with the permutations for 32- and 64-bit, + * little- and big-endian architectures. + */ + enum { + // in little-endian, inline_segments[0] is shared with the pointer's LSB, while + // in big-endian, it's inline_segments[7] + InlineSegmentMarker = Q_BYTE_ORDER == Q_LITTLE_ENDIAN ? 0 : sizeof(void *) - 1, + InlineSegmentStartIdx = !InlineSegmentMarker, // 0 for BE, 1 for LE + InlineSegmentCount = sizeof(void *) - 1 + }; + static_assert(InlineSegmentCount >= 3); // at least major, minor, micro + + struct SegmentStorage + { + // Note: we alias the use of dummy and inline_segments in the use of the + // union below. This is undefined behavior in C++98, but most compilers implement + // the C++11 behavior. The one known exception is older versions of Sun Studio. + union { + quintptr dummy; + qint8 inline_segments[sizeof(void *)]; + QList *pointer_segments; + }; + + // set the InlineSegmentMarker and set length to zero + SegmentStorage() noexcept : dummy(1) {} + + SegmentStorage(const QList &seg) + { + if (dataFitsInline(seg.data(), seg.size())) + setInlineData(seg.data(), seg.size()); + else + setListData(seg); + } + + Q_CORE_EXPORT void setListData(const QList &seg); + + SegmentStorage(const SegmentStorage &other) + { + if (other.isUsingPointer()) + setListData(*other.pointer_segments); + else + dummy = other.dummy; + } + + SegmentStorage &operator=(const SegmentStorage &other) + { + if (isUsingPointer() && other.isUsingPointer()) { + *pointer_segments = *other.pointer_segments; + } else if (other.isUsingPointer()) { + setListData(*other.pointer_segments); + } else { + if (isUsingPointer()) + delete pointer_segments; + dummy = other.dummy; + } + return *this; + } + + SegmentStorage(SegmentStorage &&other) noexcept + : dummy(other.dummy) + { + other.dummy = 1; + } + + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(SegmentStorage) + + void swap(SegmentStorage &other) noexcept + { + std::swap(dummy, other.dummy); + } + + explicit SegmentStorage(QList &&seg) + { + if (dataFitsInline(std::as_const(seg).data(), seg.size())) + setInlineData(std::as_const(seg).data(), seg.size()); + else + setListData(std::move(seg)); + } + + Q_CORE_EXPORT void setListData(QList &&seg); + + explicit SegmentStorage(QSpan args) + : SegmentStorage(args.begin(), args.end()) {} + + explicit SegmentStorage(const int *first, const int *last) + { + if (dataFitsInline(first, last - first)) { + setInlineData(first, last - first); + } else { + setListData(first, last); + } + } + + Q_CORE_EXPORT void setListData(const int *first, const int *last); + + ~SegmentStorage() { if (isUsingPointer()) delete pointer_segments; } + + bool isUsingPointer() const noexcept + { return (inline_segments[InlineSegmentMarker] & 1) == 0; } + + qsizetype size() const noexcept + { return isUsingPointer() ? pointer_segments->size() : (inline_segments[InlineSegmentMarker] >> 1); } + + void setInlineSize(qsizetype len) + { + Q_ASSERT(len <= InlineSegmentCount); + inline_segments[InlineSegmentMarker] = qint8(1 + 2 * len); + } + + Q_CORE_EXPORT void resize(qsizetype len); + + int at(qsizetype index) const + { + return isUsingPointer() ? + pointer_segments->at(index) : + inline_segments[InlineSegmentStartIdx + index]; + } + + void setSegments(int len, int maj, int min = 0, int mic = 0) + { + if (maj == qint8(maj) && min == qint8(min) && mic == qint8(mic)) { + int data[] = { maj, min, mic }; + setInlineData(data, len); + } else { + setVector(len, maj, min, mic); + } + } + + private: + static bool dataFitsInline(const int *data, qsizetype len) + { + if (len > InlineSegmentCount) + return false; + for (qsizetype i = 0; i < len; ++i) + if (data[i] != qint8(data[i])) + return false; + return true; + } + void setInlineData(const int *data, qsizetype len) + { + Q_ASSERT(len <= InlineSegmentCount); + dummy = 1 + len * 2; +#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN + for (qsizetype i = 0; i < len; ++i) + dummy |= quintptr(data[i] & 0xFF) << (8 * (i + 1)); +#elif Q_BYTE_ORDER == Q_BIG_ENDIAN + for (qsizetype i = 0; i < len; ++i) + dummy |= quintptr(data[i] & 0xFF) << (8 * (sizeof(void *) - i - 1)); +#else + // the code above is equivalent to: + setInlineSize(len); + for (qsizetype i = 0; i < len; ++i) + inline_segments[InlineSegmentStartIdx + i] = data[i] & 0xFF; +#endif + } + + Q_CORE_EXPORT void setVector(int len, int maj, int min, int mic); + } m_segments; + + class It + { + const QVersionNumber *v; + qsizetype i; + + friend class QVersionNumber; + explicit constexpr It(const QVersionNumber *vn, qsizetype idx) noexcept : v(vn), i(idx) {} + + friend constexpr bool comparesEqual(const It &lhs, const It &rhs) + { Q_ASSERT(lhs.v == rhs.v); return lhs.i == rhs.i; } + friend constexpr Qt::strong_ordering compareThreeWay(const It &lhs, const It &rhs) + { Q_ASSERT(lhs.v == rhs.v); return Qt::compareThreeWay(lhs.i, rhs.i); } + // macro variant does not exist: Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE_NON_NOEXCEPT(It) + friend constexpr bool operator==(It lhs, It rhs) { + return comparesEqual(lhs, rhs); + } +#ifdef __cpp_lib_three_way_comparison + friend constexpr std::strong_ordering operator<=>(It lhs, It rhs) { + return compareThreeWay(lhs, rhs); + } +#else + friend constexpr bool operator!=(It lhs, It rhs) { + return !operator==(lhs, rhs); + } + friend constexpr bool operator<(It lhs, It rhs) { + return is_lt(compareThreeWay(lhs, rhs)); + } + friend constexpr bool operator<=(It lhs, It rhs) { + return is_lteq(compareThreeWay(lhs, rhs)); + } + friend constexpr bool operator>(It lhs, It rhs) { + return is_gt(compareThreeWay(lhs, rhs)); + } + friend constexpr bool operator>=(It lhs, It rhs) { + return is_gteq(compareThreeWay(lhs, rhs)); + } +#endif + + public: + // Rule Of Zero applies + It() = default; + + using iterator_category = std::random_access_iterator_tag; + using value_type = int; +#ifdef QT_COMPILER_HAS_LWG3346 + using element_type = const int; +#endif + using difference_type = qptrdiff; // difference to container requirements + using size_type = qsizetype; // difference to container requirements + using reference = value_type; // difference to container requirements + using pointer = QtPrivate::ArrowProxy; + + reference operator*() const { return v->segmentAt(i); } + pointer operator->() const { return {**this}; } + + It &operator++() { ++i; return *this; } + It operator++(int) { auto copy = *this; ++*this; return copy; } + + It &operator--() { --i; return *this; } + It operator--(int) { auto copy = *this; --*this; return copy; } + + It &operator+=(difference_type n) { i += n; return *this; } + friend It operator+(It it, difference_type n) { it += n; return it; } + friend It operator+(difference_type n, It it) { return it + n; } + + It &operator-=(difference_type n) { i -= n; return *this; } + friend It operator-(It it, difference_type n) { it -= n; return it; } + + friend difference_type operator-(It lhs, It rhs) + { Q_ASSERT(lhs.v == rhs.v); return lhs.i - rhs.i; } + + reference operator[](difference_type n) const { return *(*this + n); } + }; + +public: + using const_iterator = It; + using const_reverse_iterator = std::reverse_iterator; + + using value_type = It::value_type; + using difference_type = It::difference_type; + using size_type = It::size_type; + using reference = It::reference; + using const_reference = reference; + using pointer = It::pointer; + using const_pointer = pointer; + + inline QVersionNumber() noexcept + : m_segments() + {} + Q_WEAK_OVERLOAD + inline explicit QVersionNumber(const QList &seg) : m_segments(seg) { } + + // compiler-generated copy/move ctor/assignment operators and the destructor are ok + + Q_WEAK_OVERLOAD + explicit QVersionNumber(QList &&seg) : m_segments(std::move(seg)) { } + + inline QVersionNumber(std::initializer_list args) + : m_segments(QSpan{args}) + {} + + explicit QVersionNumber(QSpan args) + : m_segments(args) + {} + + inline explicit QVersionNumber(int maj) + { m_segments.setSegments(1, maj); } + + inline explicit QVersionNumber(int maj, int min) + { m_segments.setSegments(2, maj, min); } + + inline explicit QVersionNumber(int maj, int min, int mic) + { m_segments.setSegments(3, maj, min, mic); } + + [[nodiscard]] inline bool isNull() const noexcept + { return segmentCount() == 0; } + + [[nodiscard]] inline bool isNormalized() const noexcept + { return isNull() || segmentAt(segmentCount() - 1) != 0; } + + [[nodiscard]] inline int majorVersion() const noexcept + { return segmentAt(0); } + + [[nodiscard]] inline int minorVersion() const noexcept + { return segmentAt(1); } + + [[nodiscard]] inline int microVersion() const noexcept + { return segmentAt(2); } + + [[nodiscard]] Q_CORE_EXPORT QVersionNumber normalized() const; + + [[nodiscard]] Q_CORE_EXPORT QList segments() const; + + [[nodiscard]] inline int segmentAt(qsizetype index) const noexcept + { return (m_segments.size() > index) ? m_segments.at(index) : 0; } + + [[nodiscard]] inline qsizetype segmentCount() const noexcept + { return m_segments.size(); } + + [[nodiscard]] const_iterator begin() const noexcept { return const_iterator{this, 0}; } + [[nodiscard]] const_iterator end() const noexcept { return begin() + segmentCount(); } + [[nodiscard]] const_iterator cbegin() const noexcept { return begin(); } + [[nodiscard]] const_iterator cend() const noexcept { return end(); } + + [[nodiscard]] const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator{end()}; } + [[nodiscard]] const_reverse_iterator rend() const noexcept { return const_reverse_iterator{begin()}; } + [[nodiscard]] const_reverse_iterator crbegin() const noexcept { return rbegin(); } + [[nodiscard]] const_reverse_iterator crend() const noexcept { return rend(); } + + [[nodiscard]] const_iterator constBegin() const noexcept { return begin(); } + [[nodiscard]] const_iterator constEnd() const noexcept { return end(); } + + [[nodiscard]] Q_CORE_EXPORT bool isPrefixOf(const QVersionNumber &other) const noexcept; + + [[nodiscard]] Q_CORE_EXPORT static int compare(const QVersionNumber &v1, const QVersionNumber &v2) noexcept; + + [[nodiscard]] Q_CORE_EXPORT static QVersionNumber commonPrefix(const QVersionNumber &v1, const QVersionNumber &v2); + + [[nodiscard]] Q_CORE_EXPORT QString toString() const; + [[nodiscard]] Q_CORE_EXPORT static QVersionNumber fromString(QAnyStringView string, qsizetype *suffixIndex = nullptr); + +#if QT_DEPRECATED_SINCE(6, 4) && QT_POINTER_SIZE != 4 + Q_WEAK_OVERLOAD + QT_DEPRECATED_VERSION_X_6_4("Use the 'qsizetype *suffixIndex' overload.") + [[nodiscard]] static QVersionNumber fromString(QAnyStringView string, int *suffixIndex) + { + QT_WARNING_PUSH + // fromString() writes to *n unconditionally, but GCC can't know that + QT_WARNING_DISABLE_GCC("-Wmaybe-uninitialized") + qsizetype n; + auto r = fromString(string, &n); + if (suffixIndex) { + Q_ASSERT(int(n) == n); + *suffixIndex = int(n); + } + return r; + QT_WARNING_POP + } +#endif + + +#if QT_CORE_REMOVED_SINCE(6, 4) + [[nodiscard]] Q_CORE_EXPORT static QVersionNumber fromString(const QString &string, int *suffixIndex); + [[nodiscard]] Q_CORE_EXPORT static QVersionNumber fromString(QLatin1StringView string, int *suffixIndex); + [[nodiscard]] Q_CORE_EXPORT static QVersionNumber fromString(QStringView string, int *suffixIndex); +#endif + +private: + [[nodiscard]] friend bool comparesEqual(const QVersionNumber &lhs, + const QVersionNumber &rhs) noexcept + { + return lhs.segmentCount() == rhs.segmentCount() && compare(lhs, rhs) == 0; + } + [[nodiscard]] friend Qt::strong_ordering compareThreeWay(const QVersionNumber &lhs, + const QVersionNumber &rhs) noexcept + { + int c = compare(lhs, rhs); + return Qt::compareThreeWay(c, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QVersionNumber) + +#ifndef QT_NO_DATASTREAM + friend Q_CORE_EXPORT QDataStream& operator>>(QDataStream &in, QVersionNumber &version); +#endif + friend Q_CORE_EXPORT size_t qHash(const QVersionNumber &key, size_t seed); +}; + +Q_DECLARE_TYPEINFO(QVersionNumber, Q_RELOCATABLE_TYPE); + +#ifndef QT_NO_DEBUG_STREAM +Q_CORE_EXPORT QDebug operator<<(QDebug, const QVersionNumber &version); +#endif + +QT_END_NAMESPACE + +QT_DECL_METATYPE_EXTERN(QVersionNumber, Q_CORE_EXPORT) + +#endif // QVERSIONNUMBER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qversiontagging.h b/qt/6.8.1/msvc2022_64/include/QtCore/qversiontagging.h new file mode 100644 index 0000000000000000000000000000000000000000..97a0e5c1db0444d13009d0b2b88635b296646149 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qversiontagging.h @@ -0,0 +1,142 @@ +// Copyright (C) 2022 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#if !defined(QVERSIONTAGGING_H) +#define QVERSIONTAGGING_H + +#if 0 +#pragma qt_no_master_include +#endif + +#include +#include +#include +#include + +QT_REQUIRE_CONFIG(version_tagging); + +QT_BEGIN_NAMESPACE + +/* + * Explanation + * + * This file causes all libraries, plugins, and applications that #include this + * file to automatically pull in a symbol found in QtCore that encodes the + * current Qt version number at the time of compilation. The relocation is + * designed so that it's impossible for the dynamic linker to perform lazy + * binding. Instead, it must resolve at load time or fail. That way, attempting + * to load such a library or plugin while an older QtCore is loaded will fail. + * Similarly, if an older QtCore is found when launching an application, the + * application will fail to launch. + * + * It's also possible to inspect which version is required by decoding the + * .qtversion section. The second pointer-sized variable is the required + * version, for example, for Qt 6.4.1: + * + * Hex dump of section [18] '.qtversion', 16 bytes at offset 0x1ee48: + * 0x00000000 b0ffffff ffffffff 01040600 00000000 ................ + * ^^^^^^^^ ^^^^^^^^ + * + * There will only be one copy of the section in the output library or application. + * + * This functionality can be disabled by defining QT_NO_VERSION_TAGGING. It's + * disabled if Qt was built statically. + * + * Windows notes: + * + * On Windows, the address of a __declspec(dllimport) variable is not a + * constant expression, unlike Unix systems. So we instead use the address of + * the import variable, which is created by prefixing the external name with + * "__imp_". Using that variable causes an import of the corresponding symbol + * from QtCore DLL. + * + * With MinGW (GCC and Clang), we use a C++17 inline variable, so the compiler + * and linker automatically merge the variables. The "used" __attribute__ + * tells the compiler to always emit that variable, whether it's used or not. + * + * MSVC has no equivalent to that attribute, so instead we create an extern + * const variable and tell the linker to merge them all via + * __declspec(selectany). + * + * Unix notes: + * + * On Unix, we use the same C++17 inline variable solution as MinGW, but we + * don't need the "__imp_" trick. + * + * Additionally, on ELF systems like Linux and FreeBSD, the symbol in question + * is simply "qt_version_tag" in both QtCore and in this ELF module, but it + * has an ELF version attached to it (see qversiontagging.cpp and + * QtFlagHandlingHelpers.cmake). That way, the error message from the dynamic + * linker will say it can't find version "Qt_6.x". + */ + +namespace QtPrivate { +struct QVersionTag +{ + const void *symbol; + quintptr version; + constexpr QVersionTag(const void *sym, int currentVersion = QT_VERSION) + : symbol(sym), version(currentVersion) + {} +}; +} + +#if !defined(QT_NO_VERSION_TAGGING) && (defined(QT_BUILD_CORE_LIB) || defined(QT_BOOTSTRAPPED) || defined(QT_STATIC)) +// don't make tags in QtCore, bootstrapped systems or if the user asked not to +# define QT_NO_VERSION_TAGGING +#endif + +#if defined(Q_OS_WIN) +# ifdef Q_PROCESSOR_X86_32 +// 32-bit x86 convention does prepend a _ +# define QT_MANGLE_IMPORT_PREFIX _imp__ +# else +// Calling convention on other architectures does not prepend a _ +# define QT_MANGLE_IMPORT_PREFIX __imp_ +# endif +# if defined(Q_CC_MSVC_ONLY) +# pragma section(".qtversion",read,shared) +# define QT_VERSION_TAG_SECTION __declspec(allocate(".qtversion")) +# define QT_VERSION_TAG_ATTRIBUTE __declspec(selectany) extern const +# else +# define QT_VERSION_TAG_ATTRIBUTE __attribute__((used)) constexpr inline +# endif +# define QT_VERSION_TAG2(sym, imp) \ + extern "C" const char * const imp; \ + QT_VERSION_TAG_ATTRIBUTE QT_VERSION_TAG_SECTION QtPrivate::QVersionTag sym ## _used(&imp) +# define QT_VERSION_TAG(sym, imp) QT_VERSION_TAG2(sym, imp) +#elif defined(Q_CC_GNU) && __has_attribute(used) +# ifdef Q_OS_DARWIN +# define QT_VERSION_TAG_SECTION __attribute__((section("__DATA,.qtversion"))) +# endif +# define QT_VERSION_TAG_ATTRIBUTE __attribute__((visibility("hidden"), used)) +# define QT_VERSION_TAG2(sym, imp) \ + extern "C" Q_DECL_IMPORT const char sym; \ + QT_VERSION_TAG_ATTRIBUTE QT_VERSION_TAG_SECTION constexpr inline QtPrivate::QVersionTag sym ## _use(&sym) +# define QT_VERSION_TAG(sym, imp) QT_VERSION_TAG2(sym, imp) +#endif + +#ifdef Q_OF_ELF +# define QT_VERSION_TAG_SYMBOL(prefix, sym, m, n) sym +#else +# define QT_VERSION_TAG_SYMBOL2(prefix, sym, m, n) prefix ## sym ## _ ## m ## _ ## n +# define QT_VERSION_TAG_SYMBOL(prefix, sym, m, n) QT_VERSION_TAG_SYMBOL2(prefix, sym, m, n) +#endif + +#if defined(QT_VERSION_TAG) && !defined(QT_NO_VERSION_TAGGING) +# ifndef QT_VERSION_TAG_SECTION +# define QT_VERSION_TAG_SECTION __attribute__((section(".qtversion"))) +# endif +# define QT_MANGLED_VERSION_TAG_IMPORT QT_VERSION_TAG_SYMBOL(QT_MANGLE_IMPORT_PREFIX, QT_MANGLE_NAMESPACE(qt_version_tag), QT_VERSION_MAJOR, QT_VERSION_MINOR) +# define QT_MANGLED_VERSION_TAG QT_VERSION_TAG_SYMBOL(, QT_MANGLE_NAMESPACE(qt_version_tag), QT_VERSION_MAJOR, QT_VERSION_MINOR) + +QT_VERSION_TAG(QT_MANGLED_VERSION_TAG, QT_MANGLED_VERSION_TAG_IMPORT); + +# undef QT_MANGLED_VERSION_TAG +# undef QT_MANGLED_VERSION_TAG_IMPORT +# undef QT_VERSION_TAG_SECTION +#endif + +QT_END_NAMESPACE + +#endif // QVERSIONTAGGING_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qwaitcondition.h b/qt/6.8.1/msvc2022_64/include/QtCore/qwaitcondition.h new file mode 100644 index 0000000000000000000000000000000000000000..bad8f1404a4d960381b2c81e38bd73c12ccc004c --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qwaitcondition.h @@ -0,0 +1,72 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QWAITCONDITION_H +#define QWAITCONDITION_H + +#include + +QT_BEGIN_NAMESPACE + +#if QT_CONFIG(thread) + +class QWaitConditionPrivate; +class QMutex; +class QReadWriteLock; + +class Q_CORE_EXPORT QWaitCondition +{ +public: + QWaitCondition(); + ~QWaitCondition(); + + bool wait(QMutex *lockedMutex, + QDeadlineTimer deadline = QDeadlineTimer(QDeadlineTimer::Forever)); + bool wait(QMutex *lockedMutex, unsigned long time); + + bool wait(QReadWriteLock *lockedReadWriteLock, + QDeadlineTimer deadline = QDeadlineTimer(QDeadlineTimer::Forever)); + bool wait(QReadWriteLock *lockedReadWriteLock, unsigned long time); + + void wakeOne(); + void wakeAll(); + + void notify_one() { wakeOne(); } + void notify_all() { wakeAll(); } + +private: + Q_DISABLE_COPY(QWaitCondition) + + QWaitConditionPrivate *d; +}; + +#else + +class QMutex; +class QReadWriteLock; + +class Q_CORE_EXPORT QWaitCondition +{ +public: + QWaitCondition() {} + ~QWaitCondition() {} + + bool wait(QMutex *, QDeadlineTimer = QDeadlineTimer(QDeadlineTimer::Forever)) + { return true; } + bool wait(QReadWriteLock *, QDeadlineTimer = QDeadlineTimer(QDeadlineTimer::Forever)) + { return true; } + bool wait(QMutex *, unsigned long) { return true; } + bool wait(QReadWriteLock *, unsigned long) { return true; } + + void wakeOne() {} + void wakeAll() {} + + void notify_one() { wakeOne(); } + void notify_all() { wakeAll(); } +}; + +#endif // QT_CONFIG(thread) + +QT_END_NAMESPACE + +#endif // QWAITCONDITION_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qwineventnotifier.h b/qt/6.8.1/msvc2022_64/include/QtCore/qwineventnotifier.h new file mode 100644 index 0000000000000000000000000000000000000000..1fd6ff5389f20d097da6c15ebd28e4f25a8013ab --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qwineventnotifier.h @@ -0,0 +1,44 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QWINEVENTNOTIFIER_H +#define QWINEVENTNOTIFIER_H + +#include "QtCore/qobject.h" + +#if defined(Q_OS_WIN) || defined(Q_QDOC) + +QT_BEGIN_NAMESPACE + +class QWinEventNotifierPrivate; +class Q_CORE_EXPORT QWinEventNotifier : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QWinEventNotifier) + typedef Qt::HANDLE HANDLE; + +public: + explicit QWinEventNotifier(QObject *parent = nullptr); + explicit QWinEventNotifier(HANDLE hEvent, QObject *parent = nullptr); + ~QWinEventNotifier(); + + void setHandle(HANDLE hEvent); + HANDLE handle() const; + + bool isEnabled() const; + +public Q_SLOTS: + void setEnabled(bool enable); + +Q_SIGNALS: + void activated(HANDLE hEvent, QPrivateSignal); + +protected: + bool event(QEvent *e) override; +}; + +QT_END_NAMESPACE + +#endif // Q_OS_WIN + +#endif // QWINEVENTNOTIFIER_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qxmlstream.h b/qt/6.8.1/msvc2022_64/include/QtCore/qxmlstream.h new file mode 100644 index 0000000000000000000000000000000000000000..aa8bdfb9691b9f09c49258a0de13c543419f7499 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qxmlstream.h @@ -0,0 +1,472 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QXMLSTREAM_H +#define QXMLSTREAM_H + +#include + +#if QT_CONFIG(xmlstream) + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtPrivate { + +class QXmlString { + QStringPrivate m_string; +public: + QXmlString(QStringPrivate &&d) : m_string(std::move(d)) {} + QXmlString(const QString &s) : m_string(s.data_ptr()) {} + QXmlString & operator=(const QString &s) { m_string = s.data_ptr(); return *this; } + QXmlString & operator=(QString &&s) { m_string.swap(s.data_ptr()); return *this; } + inline constexpr QXmlString() {} + + void swap(QXmlString &other) noexcept + { + m_string.swap(other.m_string); + } + + operator QStringView() const noexcept { return QStringView(m_string.data(), m_string.size); } + qsizetype size() const noexcept { return m_string.size; } + bool isNull() const noexcept { return m_string.isNull(); } + +private: + friend bool comparesEqual(const QXmlString &lhs, const QXmlString &rhs) noexcept + { + return QStringView(lhs) == QStringView(rhs); + } + Q_DECLARE_EQUALITY_COMPARABLE(QXmlString) +}; + +} +Q_DECLARE_SHARED_NS_EXT(QtPrivate, QXmlString) + + +class QXmlStreamReaderPrivate; +class QXmlStreamAttributes; +class Q_CORE_EXPORT QXmlStreamAttribute { + QtPrivate::QXmlString m_name, m_namespaceUri, m_qualifiedName, m_value; + uint m_isDefault : 1; + friend class QXmlStreamReaderPrivate; + friend class QXmlStreamAttributes; +public: + QXmlStreamAttribute(); + QXmlStreamAttribute(const QString &qualifiedName, const QString &value); + QXmlStreamAttribute(const QString &namespaceUri, const QString &name, const QString &value); + + inline QStringView namespaceUri() const { return m_namespaceUri; } + inline QStringView name() const { return m_name; } + inline QStringView qualifiedName() const { return m_qualifiedName; } + inline QStringView prefix() const { + return QStringView(m_qualifiedName).left(qMax(0, m_qualifiedName.size() - m_name.size() - 1)); + } + inline QStringView value() const { return m_value; } + inline bool isDefault() const { return m_isDefault; } +#if QT_CORE_REMOVED_SINCE(6, 8) + inline bool operator==(const QXmlStreamAttribute &other) const + { return comparesEqual(*this, other); } + inline bool operator!=(const QXmlStreamAttribute &other) const + { return !operator==(other); } +#endif + +private: + friend bool comparesEqual(const QXmlStreamAttribute &lhs, + const QXmlStreamAttribute &rhs) noexcept + { + if (lhs.m_value != rhs.m_value) + return false; + if (lhs.m_namespaceUri.isNull()) + return lhs.m_qualifiedName == rhs.m_qualifiedName; + return lhs.m_namespaceUri == rhs.m_namespaceUri + && lhs.m_name == rhs.m_name; + } + Q_DECLARE_EQUALITY_COMPARABLE(QXmlStreamAttribute) +}; + +Q_DECLARE_TYPEINFO(QXmlStreamAttribute, Q_RELOCATABLE_TYPE); + +// We export each out-of-line method individually to prevent MSVC from +// exporting the whole QList class. +class QXmlStreamAttributes : public QList +{ +public: + inline QXmlStreamAttributes() {} +#if QT_CORE_REMOVED_SINCE(6, 6) + Q_CORE_EXPORT QStringView value(const QString &namespaceUri, const QString &name) const; + Q_CORE_EXPORT QStringView value(const QString &namespaceUri, QLatin1StringView name) const; + Q_CORE_EXPORT QStringView value(QLatin1StringView namespaceUri, QLatin1StringView name) const; + Q_CORE_EXPORT QStringView value(const QString &qualifiedName) const; + Q_CORE_EXPORT QStringView value(QLatin1StringView qualifiedName) const; +#endif + Q_CORE_EXPORT QStringView value(QAnyStringView namespaceUri, QAnyStringView name) const noexcept; + Q_CORE_EXPORT QStringView value(QAnyStringView qualifiedName) const noexcept; + + Q_CORE_EXPORT void append(const QString &namespaceUri, const QString &name, const QString &value); + Q_CORE_EXPORT void append(const QString &qualifiedName, const QString &value); + + bool hasAttribute(QAnyStringView qualifiedName) const + { + return !value(qualifiedName).isNull(); + } + + bool hasAttribute(QAnyStringView namespaceUri, QAnyStringView name) const + { + return !value(namespaceUri, name).isNull(); + } + + using QList::append; +}; + +class Q_CORE_EXPORT QXmlStreamNamespaceDeclaration { + QtPrivate::QXmlString m_prefix, m_namespaceUri; + + friend class QXmlStreamReaderPrivate; +public: + QXmlStreamNamespaceDeclaration(); + QXmlStreamNamespaceDeclaration(const QString &prefix, const QString &namespaceUri); + + inline QStringView prefix() const { return m_prefix; } + inline QStringView namespaceUri() const { return m_namespaceUri; } +#if QT_CORE_REMOVED_SINCE(6, 8) + inline bool operator==(const QXmlStreamNamespaceDeclaration &other) const + { return comparesEqual(*this, other); } + inline bool operator!=(const QXmlStreamNamespaceDeclaration &other) const + { return !operator==(other); } +#endif +private: + friend bool comparesEqual(const QXmlStreamNamespaceDeclaration &lhs, + const QXmlStreamNamespaceDeclaration &rhs) noexcept + { + return lhs.m_prefix == rhs.m_prefix + && lhs.m_namespaceUri == rhs.m_namespaceUri; + } + Q_DECLARE_EQUALITY_COMPARABLE(QXmlStreamNamespaceDeclaration) +}; + +Q_DECLARE_TYPEINFO(QXmlStreamNamespaceDeclaration, Q_RELOCATABLE_TYPE); +typedef QList QXmlStreamNamespaceDeclarations; + +class Q_CORE_EXPORT QXmlStreamNotationDeclaration { + QtPrivate::QXmlString m_name, m_systemId, m_publicId; + + friend class QXmlStreamReaderPrivate; +public: + QXmlStreamNotationDeclaration(); + + inline QStringView name() const { return m_name; } + inline QStringView systemId() const { return m_systemId; } + inline QStringView publicId() const { return m_publicId; } +#if QT_CORE_REMOVED_SINCE(6, 8) + inline bool operator==(const QXmlStreamNotationDeclaration &other) const + { return comparesEqual(*this, other); } + inline bool operator!=(const QXmlStreamNotationDeclaration &other) const + { return !operator==(other); } +#endif +private: + friend bool comparesEqual(const QXmlStreamNotationDeclaration &lhs, + const QXmlStreamNotationDeclaration &rhs) noexcept + { + return lhs.m_name == rhs.m_name && lhs.m_systemId == rhs.m_systemId + && lhs.m_publicId == rhs.m_publicId; + } + Q_DECLARE_EQUALITY_COMPARABLE(QXmlStreamNotationDeclaration) +}; + +Q_DECLARE_TYPEINFO(QXmlStreamNotationDeclaration, Q_RELOCATABLE_TYPE); +typedef QList QXmlStreamNotationDeclarations; + +class Q_CORE_EXPORT QXmlStreamEntityDeclaration { + QtPrivate::QXmlString m_name, m_notationName, m_systemId, m_publicId, m_value; + + friend class QXmlStreamReaderPrivate; +public: + QXmlStreamEntityDeclaration(); + + inline QStringView name() const { return m_name; } + inline QStringView notationName() const { return m_notationName; } + inline QStringView systemId() const { return m_systemId; } + inline QStringView publicId() const { return m_publicId; } + inline QStringView value() const { return m_value; } +#if QT_CORE_REMOVED_SINCE(6, 8) + inline bool operator==(const QXmlStreamEntityDeclaration &other) const + { return comparesEqual(*this, other); } + inline bool operator!=(const QXmlStreamEntityDeclaration &other) const + { return !operator==(other); } +#endif + +private: + friend bool comparesEqual(const QXmlStreamEntityDeclaration &lhs, + const QXmlStreamEntityDeclaration &rhs) noexcept + { + return lhs.m_name == rhs.m_name + && lhs.m_notationName == rhs.m_notationName + && lhs.m_systemId == rhs.m_systemId + && lhs.m_publicId == rhs.m_publicId + && lhs.m_value == rhs.m_value; + } + Q_DECLARE_EQUALITY_COMPARABLE(QXmlStreamEntityDeclaration) +}; + +Q_DECLARE_TYPEINFO(QXmlStreamEntityDeclaration, Q_RELOCATABLE_TYPE); +typedef QList QXmlStreamEntityDeclarations; + +class Q_CORE_EXPORT QXmlStreamEntityResolver +{ + Q_DISABLE_COPY_MOVE(QXmlStreamEntityResolver) +public: + QXmlStreamEntityResolver() = default; + virtual ~QXmlStreamEntityResolver(); + virtual QString resolveEntity(const QString& publicId, const QString& systemId); + virtual QString resolveUndeclaredEntity(const QString &name); +}; + +#if QT_CONFIG(xmlstreamreader) +class Q_CORE_EXPORT QXmlStreamReader +{ + QDOC_PROPERTY(bool namespaceProcessing READ namespaceProcessing WRITE setNamespaceProcessing) +public: + enum TokenType { + NoToken = 0, + Invalid, + StartDocument, + EndDocument, + StartElement, + EndElement, + Characters, + Comment, + DTD, + EntityReference, + ProcessingInstruction + }; + + + QXmlStreamReader(); + explicit QXmlStreamReader(QIODevice *device); +#if QT_CORE_REMOVED_SINCE(6, 5) + explicit QXmlStreamReader(const QByteArray &data); + explicit QXmlStreamReader(const QString &data); + explicit QXmlStreamReader(const char * data); +#endif // QT_CORE_REMOVED_SINCE(6, 5) + Q_WEAK_OVERLOAD + explicit QXmlStreamReader(const QByteArray &data) + : QXmlStreamReader(data, PrivateConstructorTag{}) { } + explicit QXmlStreamReader(QAnyStringView data); + ~QXmlStreamReader(); + + void setDevice(QIODevice *device); + QIODevice *device() const; +#if QT_CORE_REMOVED_SINCE(6, 5) + void addData(const QByteArray &data); + void addData(const QString &data); + void addData(const char *data); +#endif // QT_CORE_REMOVED_SINCE(6, 5) + Q_WEAK_OVERLOAD + void addData(const QByteArray &data) { addDataImpl(data); } + void addData(QAnyStringView data); + void clear(); + + + bool atEnd() const; + TokenType readNext(); + + bool readNextStartElement(); + void skipCurrentElement(); + + TokenType tokenType() const; + QString tokenString() const; + + void setNamespaceProcessing(bool); + bool namespaceProcessing() const; + + inline bool isStartDocument() const { return tokenType() == StartDocument; } + inline bool isEndDocument() const { return tokenType() == EndDocument; } + inline bool isStartElement() const { return tokenType() == StartElement; } + inline bool isEndElement() const { return tokenType() == EndElement; } + inline bool isCharacters() const { return tokenType() == Characters; } + bool isWhitespace() const; + bool isCDATA() const; + inline bool isComment() const { return tokenType() == Comment; } + inline bool isDTD() const { return tokenType() == DTD; } + inline bool isEntityReference() const { return tokenType() == EntityReference; } + inline bool isProcessingInstruction() const { return tokenType() == ProcessingInstruction; } + + bool isStandaloneDocument() const; + bool hasStandaloneDeclaration() const; + QStringView documentVersion() const; + QStringView documentEncoding() const; + + qint64 lineNumber() const; + qint64 columnNumber() const; + qint64 characterOffset() const; + + QXmlStreamAttributes attributes() const; + + enum ReadElementTextBehaviour { + ErrorOnUnexpectedElement, + IncludeChildElements, + SkipChildElements + }; + QString readElementText(ReadElementTextBehaviour behaviour = ErrorOnUnexpectedElement); + + QStringView name() const; + QStringView namespaceUri() const; + QStringView qualifiedName() const; + QStringView prefix() const; + + QStringView processingInstructionTarget() const; + QStringView processingInstructionData() const; + + QStringView text() const; + + QXmlStreamNamespaceDeclarations namespaceDeclarations() const; + void addExtraNamespaceDeclaration(const QXmlStreamNamespaceDeclaration &extraNamespaceDeclaraction); + void addExtraNamespaceDeclarations(const QXmlStreamNamespaceDeclarations &extraNamespaceDeclaractions); + QXmlStreamNotationDeclarations notationDeclarations() const; + QXmlStreamEntityDeclarations entityDeclarations() const; + QStringView dtdName() const; + QStringView dtdPublicId() const; + QStringView dtdSystemId() const; + + int entityExpansionLimit() const; + void setEntityExpansionLimit(int limit); + + enum Error { + NoError, + UnexpectedElementError, + CustomError, + NotWellFormedError, + PrematureEndOfDocumentError + }; + void raiseError(const QString& message = QString()); + QString errorString() const; + Error error() const; + + inline bool hasError() const + { + return error() != NoError; + } + + void setEntityResolver(QXmlStreamEntityResolver *resolver); + QXmlStreamEntityResolver *entityResolver() const; + +private: + struct PrivateConstructorTag { }; + QXmlStreamReader(const QByteArray &data, PrivateConstructorTag); + void addDataImpl(const QByteArray &data); + + Q_DISABLE_COPY(QXmlStreamReader) + Q_DECLARE_PRIVATE(QXmlStreamReader) + QScopedPointer d_ptr; + +}; +#endif // feature xmlstreamreader + +#if QT_CONFIG(xmlstreamwriter) + +class QXmlStreamWriterPrivate; + +class Q_CORE_EXPORT QXmlStreamWriter +{ + QDOC_PROPERTY(bool autoFormatting READ autoFormatting WRITE setAutoFormatting) + QDOC_PROPERTY(int autoFormattingIndent READ autoFormattingIndent WRITE setAutoFormattingIndent) +public: + QXmlStreamWriter(); + explicit QXmlStreamWriter(QIODevice *device); + explicit QXmlStreamWriter(QByteArray *array); + explicit QXmlStreamWriter(QString *string); + ~QXmlStreamWriter(); + + void setDevice(QIODevice *device); + QIODevice *device() const; + + void setAutoFormatting(bool); + bool autoFormatting() const; + + void setAutoFormattingIndent(int spacesOrTabs); + int autoFormattingIndent() const; + +#if QT_CORE_REMOVED_SINCE(6,5) + void writeAttribute(const QString &qualifiedName, const QString &value); + void writeAttribute(const QString &namespaceUri, const QString &name, const QString &value); +#endif + void writeAttribute(QAnyStringView qualifiedName, QAnyStringView value); + void writeAttribute(QAnyStringView namespaceUri, QAnyStringView name, QAnyStringView value); + + void writeAttribute(const QXmlStreamAttribute& attribute); + void writeAttributes(const QXmlStreamAttributes& attributes); + +#if QT_CORE_REMOVED_SINCE(6,5) + void writeCDATA(const QString &text); + void writeCharacters(const QString &text); + void writeComment(const QString &text); + + void writeDTD(const QString &dtd); + + void writeEmptyElement(const QString &qualifiedName); + void writeEmptyElement(const QString &namespaceUri, const QString &name); + + void writeTextElement(const QString &qualifiedName, const QString &text); + void writeTextElement(const QString &namespaceUri, const QString &name, const QString &text); +#endif + void writeCDATA(QAnyStringView text); + void writeCharacters(QAnyStringView text); + void writeComment(QAnyStringView text); + + void writeDTD(QAnyStringView dtd); + + void writeEmptyElement(QAnyStringView qualifiedName); + void writeEmptyElement(QAnyStringView namespaceUri, QAnyStringView name); + + void writeTextElement(QAnyStringView qualifiedName, QAnyStringView text); + void writeTextElement(QAnyStringView namespaceUri, QAnyStringView name, QAnyStringView text); + + + void writeEndDocument(); + void writeEndElement(); + +#if QT_CORE_REMOVED_SINCE(6,5) + void writeEntityReference(const QString &name); + void writeNamespace(const QString &namespaceUri, const QString &prefix); + void writeDefaultNamespace(const QString &namespaceUri); + void writeProcessingInstruction(const QString &target, const QString &data); +#endif + void writeEntityReference(QAnyStringView name); + void writeNamespace(QAnyStringView namespaceUri, QAnyStringView prefix = {}); + void writeDefaultNamespace(QAnyStringView namespaceUri); + void writeProcessingInstruction(QAnyStringView target, QAnyStringView data = {}); + + void writeStartDocument(); +#if QT_CORE_REMOVED_SINCE(6,5) + void writeStartDocument(const QString &version); + void writeStartDocument(const QString &version, bool standalone); + void writeStartElement(const QString &qualifiedName); + void writeStartElement(const QString &namespaceUri, const QString &name); +#endif + void writeStartDocument(QAnyStringView version); + void writeStartDocument(QAnyStringView version, bool standalone); + void writeStartElement(QAnyStringView qualifiedName); + void writeStartElement(QAnyStringView namespaceUri, QAnyStringView name); + +#if QT_CONFIG(xmlstreamreader) + void writeCurrentToken(const QXmlStreamReader &reader); +#endif + + bool hasError() const; + +private: + Q_DISABLE_COPY(QXmlStreamWriter) + Q_DECLARE_PRIVATE(QXmlStreamWriter) + QScopedPointer d_ptr; +}; +#endif // feature xmlstreamwriter + +QT_END_NAMESPACE + +#endif // feature xmlstream + +#endif // QXMLSTREAM_H diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qxpfunctional.h b/qt/6.8.1/msvc2022_64/include/QtCore/qxpfunctional.h new file mode 100644 index 0000000000000000000000000000000000000000..0d8d34982d65ecc12d8633566423cfc4f38db0fb --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qxpfunctional.h @@ -0,0 +1,195 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +#ifndef QXPFUNCTIONAL_H +#define QXPFUNCTIONAL_H + +#include + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. Types and functions defined in this +// file can reliably be replaced by their std counterparts, once available. +// You may use these definitions in your own code, but be aware that we +// will remove them once Qt depends on the C++ version that supports +// them in namespace std. There will be NO deprecation warning, the +// definitions will JUST go away. +// +// If you can't agree to these terms, don't use these definitions! +// +// We mean it. +// + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace qxp { +// like P0792r9's function_ref: + +// [func.wrap.ref], non-owning wrapper +template class function_ref; // not defined + +// template +// class function_ref; // see below +// +// [func.wrap.ref.general] +// The header provides partial specializations of function_ref for each combination +// of the possible replacements of the placeholders cv and noex where: +// - cv is either const or empty. +// - noex is either true or false. + +namespace detail { + +template +using if_function = std::enable_if_t, bool>; +template +using if_non_function = std::enable_if_t, bool>; + +template +using copy_const_t = std::conditional_t< + std::is_const_v, + std::add_const_t, + To + >; + +template +union BoundEntityType { + template = true> + explicit constexpr BoundEntityType(F *f) + : fun(reinterpret_cast(f)) {} + template = true> + explicit constexpr BoundEntityType(T *t) + : obj(static_cast(t)) {} + Const *obj; + QFunctionPointer fun; +}; + +template +class function_ref_base +{ +protected: + ~function_ref_base() = default; + + using BoundEntityType = detail::BoundEntityType; + + template + using is_invocable_using = std::conditional_t< + noex, + std::is_nothrow_invocable_r, + std::is_invocable_r + >; + + using ThunkPtr = R(*)(BoundEntityType, ArgTypes&&...) noexcept(noex); + + BoundEntityType m_bound_entity; + ThunkPtr m_thunk_ptr; + +public: + template< + class F, + std::enable_if_t, + is_invocable_using + >, bool> = true + > + Q_IMPLICIT function_ref_base(F* f) noexcept + : m_bound_entity(f), + m_thunk_ptr([](BoundEntityType ctx, ArgTypes&&... args) noexcept(noex) -> R { + return q23::invoke_r(reinterpret_cast(ctx.fun), + std::forward(args)...); + }) + {} + + template< + class F, + std::enable_if_t, function_ref_base>>, +#ifdef Q_OS_VXWORKS + // The VxWorks compiler is trying to match this ctor against + // qxp::function_ref in lieu of using the copy-constructor, so ban + // matching against the equivalent qxp::function_ref here. + // This doesn't change anything on other platforms, so to save + // on compile-speed, enable it only for VxWorks: + std::negation< + std::is_same< + q20::remove_cvref_t, + std::conditional_t< + std::is_const_v, + qxp::function_ref, + qxp::function_ref + > + > + >, +#endif // Q_OS_VXWORKS + std::negation>>, + is_invocable_using>&> + >, bool> = true + > + Q_IMPLICIT constexpr function_ref_base(F&& f) noexcept + : m_bound_entity(std::addressof(f)), + m_thunk_ptr([](BoundEntityType ctx, ArgTypes&&... args) noexcept(noex) -> R { + using That = copy_const_t>; + return q23::invoke_r(*static_cast(ctx.obj), + std::forward(args)...); + }) + {} + +protected: + template < + class T, + std::enable_if_t, + std::is_pointer + > + >, bool> = true + > + function_ref_base& operator=(T) = delete; + + // Invocation [func.wrap.ref.inv] + R operator()(ArgTypes... args) const noexcept(noex) + { + return m_thunk_ptr(m_bound_entity, std::forward(args)...); + } + +}; + +} // namespace detail + +#define QT_SPECIALIZE_FUNCTION_REF(cv, noex) \ + template \ + class function_ref \ + : private detail::function_ref_base< noex , cv void, R, ArgTypes...> \ + { \ + using base = detail::function_ref_base< noex , cv void, R, ArgTypes...>; \ + \ + public: \ + using base::base; \ + using base::operator(); \ + } \ + /* end */ + +QT_SPECIALIZE_FUNCTION_REF( , false); +QT_SPECIALIZE_FUNCTION_REF(const, false); +QT_SPECIALIZE_FUNCTION_REF( , true ); +QT_SPECIALIZE_FUNCTION_REF(const, true ); + +#undef QT_SPECIALIZE_FUNCTION_REF + +// deduction guides [func.wrap.ref.deduct] + +template < + class F, + detail::if_function = true +> +function_ref(F*) -> function_ref; + +} // namespace qxp + +QT_END_NAMESPACE + +#endif /* QXPFUNCTIONAL_H */ diff --git a/qt/6.8.1/msvc2022_64/include/QtCore/qxptype_traits.h b/qt/6.8.1/msvc2022_64/include/QtCore/qxptype_traits.h new file mode 100644 index 0000000000000000000000000000000000000000..4497db385c7356e081156db691b34e40ff586e44 --- /dev/null +++ b/qt/6.8.1/msvc2022_64/include/QtCore/qxptype_traits.h @@ -0,0 +1,121 @@ +// Copyright (C) 2023 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz , Giuseppe D'Angelo +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QXPTYPE_TRAITS_H +#define QXPTYPE_TRAITS_H + +#include +#include + +#include + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. Types and functions defined in this +// file can reliably be replaced by their std counterparts, once available. +// You may use these definitions in your own code, but be aware that we +// will remove them once Qt depends on the C++ version that supports +// them in namespace std. There will be NO deprecation warning, the +// definitions will JUST go away. +// +// If you can't agree to these terms, don't use these definitions! +// +// We mean it. +// + +QT_BEGIN_NAMESPACE + +// like std::experimental::{nonesuch,is_detected/_v}(LFTSv2) +namespace qxp { + +struct nonesuch { + ~nonesuch() = delete; + nonesuch(const nonesuch&) = delete; + void operator=(const nonesuch&) = delete; +}; + +namespace _detail { + template class Op, typename...Args> + struct detector { + using value_t = std::false_type; + using type = T; + }; + template class Op, typename...Args> + struct detector>, Op, Args...> { + using value_t = std::true_type; + using type = Op; + }; +} // namespace _detail + +template