summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qtypeinfo.h
Commit message (Collapse)AuthorAgeFilesLines
* QTypeInfo: move QLinkedlist declaration to qlinkedlist.hMarc Mutz2019-05-141-1/+0
| | | | | | | This is in preparation of deprecating QLinkedList. Change-Id: Id5018b7fbc89f8b76b86e97cd09d18b4b8cb6234 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove remaining Q_DECL_NOEXCEPT/Q_DECL_NOTHROW usageAllan Sandfeld Jensen2019-04-041-1/+1
| | | | | Change-Id: I91ac9e714a465cab226b211812aa46e8fe5ff2ab Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTypeInfo: use C++11 type traits to deduce if a type is static or complexLars Knoll2018-12-101-4/+24
| | | | | | | | | | | | | | | | | | | All types that can be trivially copied and destructed are by definition relocatable, and we should apply those semantics when moving them in memory. Types that are trivial, are by definition not complex and should be treated as such. [ChangeLog][QtCore] Qt Containers and meta type system now use C++11 type traits (std::is_trivial, std::is_trivially_copyable and std::is_trivially_destructible) to detect the class of a type not explicitly set by Q_DECLARE_TYPEINFO. (Q_DECLARE_TYPEINFO is still needed for QList.) Done-with: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Change-Id: Iebb87ece425ea919e86169d06cd509c54a074282 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-02-281-1/+8
|\ | | | | | | Change-Id: I7d84cfed0b2a122d334b8a920e6e4f18472d2f11
| * QTypeInfo: record whether it was specializedMarc Mutz2017-02-231-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is one of the pillars of my static container checking toolbox, one of the main checks being that every type put into a Qt container has been marked up with Q_DECLARE_TYPEINFO. Obviously, we cannot upstream such a checker and inflict it upon the world, but we can put some foundations in. This is the most central one. Change-Id: I9185facb2f37ba9fcc12c9aae5675eed454d755c Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * QTypeInfo: don't treat enums and (extended) integral types as complexMarc Mutz2017-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We fully specialize QTypeInfo for most C++ built-in types, but enums and extended integral types (like GCC's int128_t) were not covered. Now that we depend on <type_traits>, we can stop pessimizing enums and extended integral types in QVector and QVLA by defaulting QTypeInfo::isComplex to true for such types. Fix a test that checked that enums were complex types. This should have been a XFAIL test. Enums are not complex types. Change-Id: Ibb0fb38cc83e980a428b5573d1db5666593418ae Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QTypeInfo: make long double primitive in Qt 6 on DarwinGiuseppe D'Angelo2017-02-221-4/+6
|/ | | | | | | | | | I don't know the historical reasons for that, but C++11 mandates long double as a type. On Darwin this means that long double was a complex type, so the best for now is to mark it relocatable. Change-Id: Ic933947a282ad963d5d0168c2768cc98fdd456bc Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use std::enable_if instead of QEnableIfAlexander Volkov2017-01-271-1/+1
| | | | | | Change-Id: Ideca8283141484cb6da47c50333f5c96e416f082 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Remove compiler-specific implementations of Q_IS_ENUMKai Koehne2016-11-091-4/+2
| | | | | | | | | | | Since the macro is now just a wrapper for std::is_enum, its use is also deprecated. [ChangeLog][QtCore][Global] Q_IS_ENUM is deprecated. Use std::is_enum<>::value instead. Change-Id: I09b9f4559c02c81f338cace927873318f2acafde Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace custom type traits with std one'sKai Koehne2016-11-081-3/+4
| | | | | | | | | | | | | | | | | | Remove most type traits from qtypetraits.h, but keep the custom implementation of is_signed/is_unsigned. This gets rid of BSD-3 licensed code from Google in a public header (hugh!). The custom implementations for is_signed/is_unsigned are kept because the implementations in gcc's standard headers do not work as we expect for enums - both is_signed and is_unsigned always returns false there - see also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59027 [ChangeLog][QtCore][General] Qt now relies on type traits from the C++ standard library. Change-Id: I3f2188b46949f04ca4482a6ac9afd3482103f0e1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-03-211-2/+2
|\ | | | | | | | | | | | | | | | | Conflicts: src/widgets/styles/qgtkstyle_p.cpp tests/auto/corelib/io/qtextstream/test/test.pro tests/auto/corelib/plugin/plugin.pro Change-Id: I512bc1b36acf3933ed2b96c00f476ee3819c1f4b
| * QTypeInfoQuery: Add public inheritance specifiersGabriel de Dietrich2016-03-171-2/+2
| | | | | | | | | | | | | | | | | | Their absence offends PySide's shiboken. Change-Id: I137d17e280276f7ffadba6d16b7c230a6880cf05 Reviewed-by: Louai Al-Khanji <louai.al-khanji@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Mark QHash/QMap as relocatable and movable-come-Qt 6Marc Mutz2016-02-091-0/+26
| | | | | | | | | | | | | | | | | | | | They were forgotten from the movable containers for Qt 5.0. Make sure we don't forget for 6.0, either. Until then, mark with new Q_RELOCATABLE_TYPE. Change-Id: I279a96c02a718a1432040303bb0d001739f59a17 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add Intel copyright to files that Intel has had non-trivial contributionThiago Macieira2016-01-211-0/+1
| | | | | | | | | | | | | | | | | | I wrote a script to help find the files, but I reviewed the contributions manually to be sure I wasn't claiming copyright for search & replace, adding Q_DECL_NOTHROW or adding "We mean it" headers. Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Define QTypeInfo for char16_t, char32_t and wchar_t in Qt 5Thiago Macieira2015-10-231-1/+13
|/ | | | | | | | | | | | | Commits 0b700fb6f92662adaf632c6e83c12a3751c3174b and 0e4d94edd0caac9d2378a00a0aa961a0be3ad796 defined QTypeInfo for those three only for Qt 6 (and forced C++11 support). Define them in Qt 5, keeping compatibility with QList storage. That is, these types are defined to be primitive and static at the same time, for the benefit of QList. Change-Id: I9cac3a70af156971022c1e6084cb5538c050f826 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* Add QTypeInfo::isRelocatableThiago Macieira2015-08-101-12/+49
| | | | | | | | | | It's the same as movable (i.e., the opposite of QTypeInfo::isStatic), except that it won't trigger the QList change in memory layout. For Qt 6, we should merge the two. Change-Id: Ib306f8f647014b399b87ffff13f1ece29e4b6e5c Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Introduce Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6Marc Mutz2015-07-181-2/+11
| | | | | | | | | | | | | ... with classical semantics, meaning movable-come-Qt6, and complex-until-then. Whether or not we want a new flag for movable-except- in-QList is an orthogonal question, and should not hold back the slew of commits that introduce use of this macro. Change-Id: I3a6be08c314fcd7f3315af138625c38196debda5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Remove qSwap specialization from Q_DECLARE_SHAREDMarc Mutz2015-01-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | The way swapping is supposed to work is: 1. Each type supplies a swap() function or function template in its namespace. Any good STL implementation will find it there through ADL. As will the primary qSwap() template. 2. Each use of swap() in Qt, in particular in template code, should use qSwap() instead of std::swap() or the using+swap-trick, because qSwap() automatically enables ADL. It also has a sophisticated conditional noexcept specification that can be used in the custom swap() functions' own noexcept clause. This change also allows us to convert implicitly-shared classes' member-swap functions to noexcept one at a time, because the specialization will no longer be in conflict with the primary template regarding exception specifications. The primary's specification could, of course, be reused here, but it's complex and if the machinery around it is changed later on, it will not affect Q_DECLARE_SHARED classes. Change-Id: I3389a655a9fd8de370f363c8fcef60269a9f506c Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Don't specialize std::swap, just overload it in the global namespaceThiago Macieira2015-01-091-8/+3
| | | | | | | | | | | | | | This is the modern, correct way of providing a swap operation. See http://stackoverflow.com/a/8439357/134841 for more information. By changing this, we also fix Qt building with ICC and libc++. This patch also adds a noexcept() rule to match what the C++11 standard requires. Change-Id: I18f22fe7c92cf253e94168e1312346b4c183f536 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Remove QHashDummyNode and avoid undifined behaviorOlivier Goffart2014-07-081-1/+1
| | | | | | | | | | | | | A lot of code in QHash is doing casting to QHashNode while the pointer may be of type QHashDummyNode. This is a lot of undefined behavior. Remove QHashDummyNode and specialize QHashNode for QHashDummyValue instead. QHashDummyValue is the only type for which QTypeInfo::isDummy is true. Q_DUMMY and QTypeInfo::isDummy are internal API, so is QHashDummyNode, so we can remove them. Task-number: QTBUG-40029 Change-Id: I60c2ff0933075b9202bde89a9992746052f75133 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use QtPrivate::is_integral instead of listing each integer typeThiago Macieira2014-02-121-26/+24
| | | | | | | | | | | This changes the code added by 0e4d94edd0caac9d2378a00a0aa961a0be3ad796 by removing the Q_INTEGRAL_TYPE enum value and instead relying on our private copy of typetraits. Change-Id: Icb6c814a36125de0d712421b97e11e8abc0f7416 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-01-101-1/+1
|\ | | | | | | Change-Id: I99af0bef7f1c931533a324ebcfb27c40ee871a5e
| * don't make msvc see digraphsOswald Buddenhagen2014-01-091-1/+1
| | | | | | | | | | | | | | | | Task-number: QTBUG-35816 Change-Id: I996a86233f771d6a466c5c5eb6116df14cd00dbd Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Add QTypeInfo<T>::isIntegral traitThiago Macieira2014-01-091-13/+30
|/ | | | | | | | | | This allows us to know whether a given type is an integer or not. It's going to be useful for QAtomicInteger, to know whether certain operations can be performed on the type. Change-Id: Ie64b24993e4021b44c97952d7d3973759fef3d4c Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Doc: Fix spelling errorDebao Zhang2013-06-201-1/+1
| | | | | Change-Id: I9225ffeddfe17bc4f56ecd9a9c4656403840f828 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-291-3/+0
| | | | | | | | | | | The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix direct compilation of qtypeinfo.h and othersThiago Macieira2012-12-181-2/+2
| | | | | | | | | | | | | | qtypeinfo.h is included by qglobal.h, so it needs to include that before the #ifdef. Otherwise, we get a circular dependency problem with qflags.h: ./QtCore/../../src/corelib/global/qflags.h:60:27: error: "Q_PRIMITIVE_TYPE" has not been declared Also, take the opportunity to fix the other headers that are included from qglobal.h to avoid similar problems in the future. Change-Id: I99a56f42775c24bdcc796995b06509c1ca0cb849 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Doc: Add \inmodule QtCore to all QtCore class doc bodiesThiago Macieira2012-08-231-0/+1
| | | | | Change-Id: I19100755c97cc155c76a859e19940e9f9222d34e Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Introduce QTypeInfoMerger.Jędrzej Nowacki2012-07-271-0/+32
| | | | | | | | | | | | QTypeInfoMerger class was created to allow "inheriting" QTypeInfo traits. The class implementation was based on the QTypeInfo<QPair<>> specialization, therefore the specialization was refactored to use the new class. Change-Id: I4ff3e5eac1d55da086dad84274cce2b2c0a721be Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Q_DECLARE_SHARED: mark the type movableMarc Mutz2012-07-101-0/+1
| | | | | | | | | | All implicitly shared classes are by definition movable, so this patch adds Q_DECLARE_TYPEINFO(Type, Q_MOVABLE_TYPE) to Q_DECLARE_SHARED. Change-Id: Idf8989ae1a7ed6d1ac13fccb7eaef7395a875350 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Q_DECLARE_SHARED: fix docs; require and use member-swapMarc Mutz2012-07-061-5/+5
| | | | | | | | | | | | | | | By requiring a member-swap, this macro becomes applicable to a wider range of types (e.g. QFont, which has another member besides 'd'), while at the same time avoiding the encapsulation leak that is data_ptr(). There have been concerns over breaking existing users of this macro, but for some time now, Q_DECLARE_SHARED only works within QT_BEGIN_NAMESPACE anyway, so its a safe bet that all users of this macro are in-tree. Change-Id: I7fdd9dba204554af8d3f9768b97bb42847a5acf4 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove references to QT_NO_STL from QtCoreThiago Macieira2012-04-071-4/+0
| | | | | | | | QT_NO_STL is now no longer defined, so remove the conditionals and select the STL side. Change-Id: Ieedd248ae16e5a128b4ac287f850b3ebc8fb6181 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* QtGlobal: remove qIsDetached()Marc Mutz2012-03-011-4/+0
| | | | | | | | | | | | | | | | | | There's not a single in-tree user of this function, and the concept is a broken one in MT programs: By the time qIsDetached() returns, the result can already be different due to another thread taking a copy, or a copy in another thread being destroyed (note that this doesn't require mutex use by the user, since we promise (implicitly, if not explicitly) that you can copy from const objects without holding a lock). QTBUG-10813 talks about a use in QCache::trim(), but 677cf76340f88e0fe51c1f75aa512b6d835414ca removed it, so there's no reason to keep it anymore. Change-Id: I20380c12bdf00ac764b89d84392f0f34727b1971 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* QFlags: mark as Q_PRIMITIVE_TYPEMarc Mutz2012-02-291-0/+4
| | | | | | | | | | | | | | | | | I originally tried to put Q_DECLARE_TYPEINFOs into Q_DECLARE_OPERATORS_FOR_FLAGS, to declare not only the flags type, but also the underlying enum as primitive, but too many users (arguably correctly) used Q_DECLARE_OPERATORS_FOR_FLAGS at (non-global) namespace scope where QTypeInfo would have been specialised in the wrong namespace. So specialise QTypeInfo for QFlags<T> only. Change-Id: I4af6e29aefbd9460a3d2bc6405f03cdf6b1096bc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Move QTypeInfo out of qglobal.h and into a separate headerBradley T. Hughes2012-02-201-0/+216
qtypeinfo.h is still included from qglobal.h, and defines QTypeInfo as well as all the specializations for built-in and default Qt types. Change-Id: I24116174de288a730cbb7aa2f80d346d2b2f9408 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>