6#include <QtCore/qversionnumber.h>
7#include <QtCore/qhash.h>
8#include <QtCore/private/qlocale_tools_p.h>
9#include <QtCore/qcollator.h>
11#ifndef QT_NO_DATASTREAM
12# include <QtCore/qdatastream.h>
15#ifndef QT_NO_DEBUG_STREAM
16# include <QtCore/qdebug.h>
153 if (m_segments.isUsingPointer())
154 return *m_segments.pointer_segments;
193 for (
i = m_segments.size();
i; --
i)
194 if (m_segments.at(
i - 1) != 0)
217 if (segmentAt(
i) !=
other.segmentAt(
i))
240 if (
Q_LIKELY(!
v1.m_segments.isUsingPointer() && !
v2.m_segments.isUsingPointer())) {
242 const qint8 *ptr1 =
v1.m_segments.inline_segments + InlineSegmentStartIdx;
243 const qint8 *ptr2 =
v2.m_segments.inline_segments + InlineSegmentStartIdx;
244 commonlen =
qMin(
v1.m_segments.size(),
245 v2.m_segments.size());
247 if (
int x = ptr1[
i] - ptr2[
i])
250 commonlen =
qMin(
v1.segmentCount(),
v2.segmentCount());
252 if (
v1.segmentAt(
i) !=
v2.segmentAt(
i))
253 return v1.segmentAt(
i) -
v2.segmentAt(
i);
259 if (
v1.segmentCount() > commonlen) {
261 if (
v1.segmentAt(commonlen) != 0)
262 return v1.segmentAt(commonlen);
265 }
else if (
v2.segmentCount() > commonlen) {
267 if (
v2.segmentAt(commonlen) != 0)
268 return -
v2.segmentAt(commonlen);
290 for (
i = 0;
i < commonlen; ++
i) {
291 if (
v1.segmentAt(
i) !=
v2.segmentAt(
i))
407 const char *lastGoodEnd =
start;
408 const char *endOfString =
string.end();
413 if (used <= 0 || value >
qulonglong(std::numeric_limits<int>::max()))
417 lastGoodEnd =
start - 1;
418 }
while (
start < endOfString && *lastGoodEnd ==
'.');
421 *suffixIndex = lastGoodEnd -
string.begin();
444 return string.visit([=] (
auto string) {
return from_string(
string, suffixIndex); });
447void QVersionNumber::SegmentStorage::setListData(
const QList<int> &seg)
452void QVersionNumber::SegmentStorage::setListData(
QList<int> &&seg)
454 pointer_segments =
new QList<int>(std::move(seg));
457void QVersionNumber::SegmentStorage::setListData(
const int *
first,
const int *last)
462void QVersionNumber::SegmentStorage::resize(
qsizetype len)
464 if (isUsingPointer())
465 pointer_segments->resize(
len);
470void QVersionNumber::SegmentStorage::setVector(
int len,
int maj,
int min,
int mic)
474 pointer_segments->data()[0] = maj;
476 pointer_segments->data()[1] =
min;
478 pointer_segments->data()[2] = mic;
483#ifndef QT_NO_DATASTREAM
509 if (!version.m_segments.isUsingPointer())
510 version.m_segments.pointer_segments =
new QList<int>;
511 in >> *version.m_segments.pointer_segments;
516#ifndef QT_NO_DEBUG_STREAM
520 debug.nospace().noquote();
536 for (
int i = 0;
i <
key.segmentCount(); ++
i)
675#ifndef QT_NO_DATASTREAM
704#ifndef QT_NO_DEBUG_STREAM
717 debug.noquote() <<
"invalid";
\inmodule QtCore\reentrant
size_t qHash(const QVersionNumber &key, size_t seed)
size_t qHash(const QTypeRevision &key, size_t seed)
void resize(qsizetype size)
\macro QT_RESTRICTED_CAST_FROM_ASCII
void reserve(qsizetype size)
Ensures the string has space for at least size characters.
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static constexpr QTypeRevision fromEncodedVersion(Integer value)
Produces a QTypeRevision from the given value.
constexpr bool hasMinorVersion() const
Returns true if the minor version is known, otherwise false.
constexpr bool hasMajorVersion() const
Returns true if the major version is known, otherwise false.
constexpr Integer toEncodedVersion() const
Transforms the revision into an integer value, encoding the minor version into the least significant ...
constexpr quint8 minorVersion() const
Returns the minor version encoded in the revision.
constexpr quint8 majorVersion() const
Returns the major version encoded in the revision.
iterator begin() noexcept
Q_CORE_EXPORT bool isPrefixOf(const QVersionNumber &other) const noexcept
Returns true if the current version number is contained in the other version number,...
static Q_CORE_EXPORT QVersionNumber commonPrefix(const QVersionNumber &v1, const QVersionNumber &v2)
QVersionNumber QVersionNumber::commonPrefix(const QVersionNumber &v1, ...
QVersionNumber() noexcept
Produces a null version.
static Q_CORE_EXPORT QVersionNumber fromString(QAnyStringView string, qsizetype *suffixIndex=nullptr)
Q_CORE_EXPORT QList< int > segments() const
Returns all of the numerical segments.
qsizetype segmentCount() const noexcept
Returns the number of integers stored in segments().
Q_CORE_EXPORT QString toString() const
Returns a string with all of the segments delimited by a period ({.}).
Q_CORE_EXPORT QVersionNumber normalized() const
Returns an equivalent version number but with all trailing zeros removed.
int segmentAt(qsizetype index) const noexcept
Returns the segment value at index.
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,...
QHash< int, QWidget * > hash
[35multi]
Combined button and popup list for selecting options.
constexpr const T & min(const T &a, const T &b)
static jboolean copy(JNIEnv *, jobject)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
size_t qHash(const QFileSystemWatcherPathKey &key, size_t seed=0)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLint GLfloat GLfloat GLfloat v2
GLint GLint GLint GLint GLint x
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
static int segmentCount(const QPainterPath &path, qreal pathLength)
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
QT_BEGIN_NAMESPACE typedef signed char qint8
QDataStream & operator<<(QDataStream &out, const QVersionNumber &version)
QDataStream & operator>>(QDataStream &in, QVersionNumber &version)
static QVersionNumber from_string(QLatin1StringView string, qsizetype *suffixIndex)
void qt_to_latin1(uchar *dst, const char16_t *uc, qsizetype len)
QTextStream out(stdout)
[7]