![]() |
Qt 6.x
The Qt SDK
|
\inmodule QtCore More...
#include <qversionnumber.h>
Public Member Functions | |
QVersionNumber () noexcept | |
Produces a null version. | |
QVersionNumber (const QList< int > &seg) | |
Constructs a version number from the list of numbers contained in seg. | |
QVersionNumber (QList< int > &&seg) | |
Move-constructs a version number from the list of numbers contained in seg. | |
QVersionNumber (std::initializer_list< int > args) | |
Construct a version number from the std::initializer_list specified by args. | |
template<qsizetype N> | |
QVersionNumber (const QVarLengthArray< int, N > &sec) | |
QVersionNumber (int maj) | |
Constructs a QVersionNumber consisting of just the major version number maj. | |
QVersionNumber (int maj, int min) | |
Constructs a QVersionNumber consisting of the major and minor version numbers maj and min, respectively. | |
QVersionNumber (int maj, int min, int mic) | |
Constructs a QVersionNumber consisting of the major, minor, and micro version numbers maj, min and mic, respectively. | |
bool | isNull () const noexcept |
Returns true if there are zero numerical segments, otherwise returns false . | |
bool | isNormalized () const noexcept |
Returns true if the version number does not contain any trailing zeros, otherwise returns false . | |
int | majorVersion () const noexcept |
Returns the major version number, that is, the first segment. | |
int | minorVersion () const noexcept |
Returns the minor version number, that is, the second segment. | |
int | microVersion () const noexcept |
Returns the micro version number, that is, the third segment. | |
Q_CORE_EXPORT QVersionNumber | normalized () const |
Returns an equivalent version number but with all trailing zeros removed. | |
Q_CORE_EXPORT QList< int > | segments () const |
Returns all of the numerical segments. | |
int | segmentAt (qsizetype index) const noexcept |
Returns the segment value at index. | |
qsizetype | segmentCount () const noexcept |
Returns the number of integers stored in segments(). | |
Q_CORE_EXPORT bool | isPrefixOf (const QVersionNumber &other) const noexcept |
Returns true if the current version number is contained in the other version number, otherwise returns false . | |
Q_CORE_EXPORT QString | toString () const |
Returns a string with all of the segments delimited by a period ( {.}). | |
Static Public Member Functions | |
static Q_CORE_EXPORT int | compare (const QVersionNumber &v1, const QVersionNumber &v2) noexcept |
Compares v1 with v2 and returns an integer less than, equal to, or greater than zero, depending on whether v1 is less than, equal to, or greater than v2, respectively. | |
static Q_CORE_EXPORT QVersionNumber | commonPrefix (const QVersionNumber &v1, const QVersionNumber &v2) |
QVersionNumber QVersionNumber::commonPrefix(const QVersionNumber &v1,
const QVersionNumber &v2) | |
static Q_CORE_EXPORT QVersionNumber | fromString (QAnyStringView string, qsizetype *suffixIndex=nullptr) |
Friends | |
bool | operator> (const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept |
Returns true if lhs is greater than rhs; otherwise returns false . | |
bool | operator>= (const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept |
Returns true if lhs is greater than or equal to rhs; otherwise returns false . | |
bool | operator< (const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept |
Returns true if lhs is less than rhs; otherwise returns false . | |
bool | operator<= (const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept |
Returns true if lhs is less than or equal to rhs; otherwise returns false . | |
bool | operator== (const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept |
Returns true if lhs is equal to rhs; otherwise returns false . | |
bool | operator!= (const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept |
Returns true if lhs is not equal to rhs; otherwise returns false . | |
Q_CORE_EXPORT QDataStream & | operator>> (QDataStream &in, QVersionNumber &version) |
Reads a version number from stream in and stores it in version. | |
Q_CORE_EXPORT size_t | qHash (const QVersionNumber &key, size_t seed) |
Related Symbols | |
(Note that these are not member symbols.) | |
QDataStream & | operator<< (QDataStream &out, const QVersionNumber &version) |
Writes the version number version to stream out. | |
QDataStream & | operator>> (QDataStream &in, QVersionNumber &version) |
Reads a version number from stream in and stores it in version. | |
\inmodule QtCore
The QVersionNumber class contains a version number with an arbitrary number of segments.
Definition at line 26 of file qversionnumber.h.
|
inlinenoexcept |
Produces a null version.
Definition at line 192 of file qversionnumber.h.
Referenced by commonPrefix().
|
inlineexplicit |
Constructs a version number from the list of numbers contained in seg.
Definition at line 195 of file qversionnumber.h.
|
inlineexplicit |
Move-constructs a version number from the list of numbers contained in seg.
This constructor is only enabled if the compiler supports C++11 move semantics.
Definition at line 199 of file qversionnumber.h.
|
inline |
Construct a version number from the std::initializer_list specified by args.
This constructor is only enabled if the compiler supports C++11 initializer lists.
Definition at line 201 of file qversionnumber.h.
|
inlineexplicit |
Constructs a version number from the list of numbers contained in seg.
Definition at line 206 of file qversionnumber.h.
|
inlineexplicit |
Constructs a QVersionNumber consisting of just the major version number maj.
Definition at line 210 of file qversionnumber.h.
|
inlineexplicit |
Constructs a QVersionNumber consisting of the major and minor version numbers maj and min, respectively.
Definition at line 213 of file qversionnumber.h.
|
inlineexplicit |
Constructs a QVersionNumber consisting of the major, minor, and micro version numbers maj, min and mic, respectively.
Definition at line 216 of file qversionnumber.h.
|
static |
QVersionNumber QVersionNumber::commonPrefix(const QVersionNumber &v1, const QVersionNumber &v2)
Returns a version number that is a parent version of both v1 and v2.
Definition at line 285 of file qversionnumber.cpp.
References QVersionNumber(), i, and qMin().
|
staticnoexcept |
Compares v1 with v2 and returns an integer less than, equal to, or greater than zero, depending on whether v1 is less than, equal to, or greater than v2, respectively.
Comparisons are performed by comparing the segments of v1 and v2 starting at index 0 and working towards the end of the longer list.
Definition at line 236 of file qversionnumber.cpp.
References i, Q_LIKELY, qint8, and qMin().
Referenced by Object::equalityExample().
|
static |
Constructs a QVersionNumber from a specially formatted string of non-negative decimal numbers delimited by a period ({.}).
Once the numerical segments have been parsed, the remainder of the string is considered to be the suffix string. The start index of that string will be stored in suffixIndex if it is not null.
{int*}.Definition at line 442 of file qversionnumber.cpp.
References from_string().
Referenced by bluetoothdVersion(), findDependencyInfo(), and qRequireVersion().
|
inlinenoexcept |
Returns true
if the version number does not contain any trailing zeros, otherwise returns false
.
Definition at line 222 of file qversionnumber.h.
References isNull(), segmentAt(), and segmentCount().
|
inlinenoexcept |
Returns true
if there are zero numerical segments, otherwise returns false
.
Definition at line 219 of file qversionnumber.h.
References segmentCount().
Referenced by bluetoothdVersion(), QWindowsDirect2DIntegration::create(), QBasicPlatformVulkanInstance::initInstance(), isNormalized(), and matches().
|
noexcept |
Returns true
if the current version number is contained in the other version number, otherwise returns false
.
Definition at line 212 of file qversionnumber.cpp.
References i, other(), and segmentCount().
|
inlinenoexcept |
Returns the major version number, that is, the first segment.
This function is equivalent to segmentAt(0). If this QVersionNumber object is null, this function returns 0.
Definition at line 225 of file qversionnumber.h.
References segmentAt().
Referenced by QBasicPlatformVulkanInstance::initInstance().
|
inlinenoexcept |
Returns the micro version number, that is, the third segment.
This function is equivalent to segmentAt(2). If this QVersionNumber object does not contain a micro number, this function returns 0.
Definition at line 231 of file qversionnumber.h.
References segmentAt().
Referenced by QBasicPlatformVulkanInstance::initInstance().
|
inlinenoexcept |
Returns the minor version number, that is, the second segment.
This function is equivalent to segmentAt(1). If this QVersionNumber object does not contain a minor number, this function returns 0.
Definition at line 228 of file qversionnumber.h.
References segmentAt().
Referenced by QBasicPlatformVulkanInstance::initInstance().
QVersionNumber QVersionNumber::normalized | ( | ) | const |
Returns an equivalent version number but with all trailing zeros removed.
To check if two numbers are equivalent, use normalized() on both version numbers before performing the compare.
Definition at line 190 of file qversionnumber.cpp.
References i.
Referenced by qRequireVersion().
|
inlinenoexcept |
Returns the segment value at index.
If the index does not exist, returns 0.
Definition at line 238 of file qversionnumber.h.
Referenced by isNormalized(), majorVersion(), microVersion(), minorVersion(), toString(), and GpuDescription::toVariant().
|
inlinenoexcept |
Returns the number of integers stored in segments().
Definition at line 241 of file qversionnumber.h.
Referenced by isNormalized(), isNull(), and toString().
QList< int > QVersionNumber::segments | ( | ) | const |
Returns all of the numerical segments.
Definition at line 151 of file qversionnumber.cpp.
References i, and segmentCount().
Referenced by operator<<().
QString QVersionNumber::toString | ( | ) | const |
Returns a string with all of the segments delimited by a period ({.}).
Definition at line 363 of file qversionnumber.cpp.
References i, QString::number(), qMax(), QString::reserve(), segmentAt(), and segmentCount().
Referenced by QWindowsDirect2DIntegration::create(), operator<<(), GpuDescription::toString(), and GpuDescription::toVariant().
|
friend |
Returns true
if lhs is not equal to rhs; otherwise returns false
.
Definition at line 294 of file qversionnumber.h.
|
friend |
Returns true
if lhs is less than rhs; otherwise returns false
.
Definition at line 285 of file qversionnumber.h.
|
related |
Writes the version number version to stream out.
Note that this has nothing to do with QDataStream::version().
Definition at line 493 of file qversionnumber.cpp.
References out, and segments().
|
friend |
Returns true
if lhs is less than or equal to rhs; otherwise returns false
.
Definition at line 288 of file qversionnumber.h.
|
friend |
Returns true
if lhs is equal to rhs; otherwise returns false
.
Definition at line 291 of file qversionnumber.h.
|
friend |
Returns true
if lhs is greater than rhs; otherwise returns false
.
Definition at line 279 of file qversionnumber.h.
|
friend |
Returns true
if lhs is greater than or equal to rhs; otherwise returns false
.
Definition at line 282 of file qversionnumber.h.
|
related |
Reads a version number from stream in and stores it in version.
Note that this has nothing to do with QDataStream::version().
Definition at line 507 of file qversionnumber.cpp.
|
friend |
Reads a version number from stream in and stores it in version.
Note that this has nothing to do with QDataStream::version().
Definition at line 507 of file qversionnumber.cpp.
|
friend |