diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-09-08 10:10:12 +0200 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2016-12-01 13:02:47 +0000 |
commit | 048447346bc1b78992be3ce4bf3292fc272f7e1a (patch) | |
tree | feb3a31098cba1ee7c6d090ac85e51778494c7ba /doc | |
parent | f4a33e345eb658996e171daa6478fdc2ef62ff17 (diff) |
QPointerUniqueId: make fit for release
- Declare as Q_MOVABLE_TYPE
- Prevent QList<QPointerUniqueId> from being instantiated
(use QVector instead)
- Add equality relational operators
- Add qHash() overload
- Replace non-default ctor with named ctor.
- Add Q_DECL_NOTHROW.
- Add Q_DECL_CONSTEXPR.
- Rename numeric() -> numericId().
- Update docs.
The extension vector for this class calls for additional
properties to be added later, but these are not user-
settable. It thus suffices to rely on the only data
member, a qint64, which can be reinterpreted to an index
into an array or hash with actual objects. This allows
to make the class a Trivial Type (ie. no overhead over
an int) while still supporting later extension. Cf.
QSslEllipticCurve as another example of such a class.
The extension has to maintain the following invariants,
encoded into user code by way of being used in inline
functions:
- m_numericId == -1 <=> !isValid()
This is trivial to support. An extension could not and
still cannot reinterpret the qint64 member as a d-pointer,
but a d-pointer is only necessary for user-settable
properties where updating a central private data structure
would cause too much contention.
Add a test.
Since this type is used in other modules, keep the existing
functions, but mark them as deprecated with the expectation
that these compat functions be removed before 5.8.0 final.
Task-number: QTBUG-54616
Change-Id: Ia3ede0ecaeeef4cd3ffa94a72b1050bd409713a5
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'doc')
0 files changed, 0 insertions, 0 deletions