diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2024-03-01 19:22:49 +0100 |
---|---|---|
committer | Ivan Solovev <ivan.solovev@qt.io> | 2024-03-13 20:34:22 +0100 |
commit | e55ee873e9f3e9f6047333434d5c9a4ddfe2bf6b (patch) | |
tree | 601c243f8806754dd27ee159761c7d02f5460369 /src/corelib/tools/qtyperevision.cpp | |
parent | 81dcb7c8be963faece04dc8a674fdd89c34b7d92 (diff) |
QTypeRevision: use comparison helper macros
QTypeRevision consists of two quint8 values: major and minor version.
Each of the versions can be unknown.
The rules for comparing with the unknown version are as follows:
zero version < unknown version < non-zero version
At the same time, two unknown versions are considered equal.
This makes the comparison a bit tricky, but it still fits into the
category of strong ordering.
Replace the existing friend relational operators with helper functions
and comparison helper macros, making this type strongly ordered.
Update the unit-tests to use the new comparison helper test functions.
As the test functions check the reversed arguments as well, we can
reduce the number of rows for the data-driven comparison test.
Fixes: QTBUG-120359
Change-Id: Ib6f1037fc7b5fed148e35ee48b56b05dcd36b3b4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/tools/qtyperevision.cpp')
-rw-r--r-- | src/corelib/tools/qtyperevision.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/corelib/tools/qtyperevision.cpp b/src/corelib/tools/qtyperevision.cpp index c505e47f2f..6426236288 100644 --- a/src/corelib/tools/qtyperevision.cpp +++ b/src/corelib/tools/qtyperevision.cpp @@ -26,6 +26,7 @@ QT_IMPL_METATYPE_EXTERN(QTypeRevision) \brief The QTypeRevision class contains a lightweight representation of a version number with two 8-bit segments, major and minor, either of which can be unknown. + \compares strong Use this class to describe revisions of a type. Compatible revisions can be expressed as increments of the minor version. Breaking changes can be |