Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QTypeRevision Class Reference

\inmodule QtCore More...

#include <qtyperevision.h>

+ Collaboration diagram for QTypeRevision:

Public Types

template<typename Integer >
using if_valid_segment_type
 
template<typename Integer >
using if_valid_value_type
 

Public Member Functions

constexpr QTypeRevision ()=default
 Produces an invalid revision.
 
constexpr bool hasMajorVersion () const
 Returns true if the major version is known, otherwise false.
 
constexpr quint8 majorVersion () const
 Returns the major version encoded in the revision.
 
constexpr bool hasMinorVersion () const
 Returns true if the minor version is known, otherwise false.
 
constexpr quint8 minorVersion () const
 Returns the minor version encoded in the revision.
 
constexpr bool isValid () const
 Returns true if the major version or the minor version is known, otherwise false.
 
template<typename Integer , if_valid_value_type< Integer > = true>
constexpr Integer toEncodedVersion () const
 Transforms the revision into an integer value, encoding the minor version into the least significant byte, and the major version into the second least significant byte.
 

Static Public Member Functions

template<typename Integer , if_valid_segment_type< Integer > = true>
static constexpr bool isValidSegment (Integer segment)
 Returns true if the given number can be used as either major or minor version in a QTypeRevision.
 
template<typename Major , typename Minor , if_valid_segment_type< Major > = true, if_valid_segment_type< Minor > = true>
static constexpr QTypeRevision fromVersion (Major majorVersion, Minor minorVersion)
 Produces a QTypeRevision from the given majorVersion and minorVersion, both of which need to be a valid segments.
 
template<typename Major , if_valid_segment_type< Major > = true>
static constexpr QTypeRevision fromMajorVersion (Major majorVersion)
 Produces a QTypeRevision from the given majorVersion with an invalid minor version.
 
template<typename Minor , if_valid_segment_type< Minor > = true>
static constexpr QTypeRevision fromMinorVersion (Minor minorVersion)
 Produces a QTypeRevision from the given minorVersion with an invalid major version.
 
template<typename Integer , if_valid_value_type< Integer > = true>
static constexpr QTypeRevision fromEncodedVersion (Integer value)
 Produces a QTypeRevision from the given value.
 
static constexpr QTypeRevision zero ()
 Produces a QTypeRevision with major and minor version {0}.
 

Friends

constexpr bool comparesEqual (const QTypeRevision &lhs, const QTypeRevision &rhs) noexcept
 
constexpr Qt::strong_ordering compareThreeWay (const QTypeRevision &lhs, const QTypeRevision &rhs) noexcept
 

Related Symbols

(Note that these are not member symbols.)

QDataStreamoperator<< (QDataStream &out, const QTypeRevision &revision)
 
QDataStreamoperator>> (QDataStream &in, QTypeRevision &revision)
 

Detailed Description

\inmodule QtCore

Since
6.0

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 expressed as increments of the major version. The return values of \l QMetaMethod::revision() and \l QMetaProperty::revision() can be passed to \l QTypeRevision::fromEncodedVersion(). The resulting major and minor versions specify in which Qt versions the properties and methods were added.

See also
QMetaMethod::revision(), QMetaProperty::revision()

Definition at line 30 of file qtyperevision.h.

Member Typedef Documentation

◆ if_valid_segment_type

template<typename Integer >
using QTypeRevision::if_valid_segment_type
Initial value:
typename std::enable_if<
std::is_integral<Integer>::value, bool>::type
GLenum type

Definition at line 34 of file qtyperevision.h.

◆ if_valid_value_type

template<typename Integer >
using QTypeRevision::if_valid_value_type
Initial value:
typename std::enable_if<
std::is_integral<Integer>::value
&& (sizeof(Integer) > sizeof(quint16)
|| (sizeof(Integer) == sizeof(quint16)
&& !std::is_signed<Integer>::value)), bool>::type
unsigned short quint16
Definition qtypes.h:48

Definition at line 38 of file qtyperevision.h.

Constructor & Destructor Documentation

◆ QTypeRevision()

QTypeRevision::QTypeRevision ( )
constexprdefault

Produces an invalid revision.

See also
isValid()

Referenced by fromEncodedVersion(), fromMajorVersion(), fromMinorVersion(), fromVersion(), and zero().

+ Here is the caller graph for this function:

Member Function Documentation

◆ fromEncodedVersion()

template<typename Integer , if_valid_value_type< Integer > = true>
template< typename Integer, QTypeRevision::if_valid_value_type< Integer >=true > static QTypeRevision QTypeRevision::fromEncodedVersion ( Integer value)
inlinestaticconstexpr

Produces a QTypeRevision from the given value.

value encodes both the minor and major versions in the least significant and second least significant byte, respectively.

value must not have any bits outside the least significant two bytes set. Integer needs to be at least 16 bits wide, and must not have a sign bit in the least significant 16 bits.

See also
toEncodedVersion()

Definition at line 78 of file qtyperevision.h.

References QTypeRevision(), and Q_ASSERT.

Referenced by availableRevisions(), QmlTypesClassDescription::collect(), getRevision(), isRevisionAllowed(), QQmlPropertyData::load(), QQmlPropertyData::load(), operator>>(), QQmlPrivate::revisionClassInfo(), QQmlPrivate::revisionClassInfos(), and QmlTypeRegistrar::write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromMajorVersion()

template<typename Major , if_valid_segment_type< Major > = true>
template< typename Major, QTypeRevision::if_valid_segment_type< Major >=true > static QTypeRevision QTypeRevision::fromMajorVersion ( Major majorVersion)
inlinestaticconstexpr

Produces a QTypeRevision from the given majorVersion with an invalid minor version.

majorVersion needs to be a valid segment.

See also
isValidSegment()

Definition at line 64 of file qtyperevision.h.

References QTypeRevision(), isValidSegment(), majorVersion(), and Q_ASSERT.

Referenced by assignVersions(), QmlIR::IRBuilder::extractVersion(), QQmlMetaTypeData::propertyCache(), qmlProtectModule(), qmlRegisterAnonymousSequentialContainer(), qmlRegisterNamespaceAndRevisions(), QQmlPrivate::qmlRegisterSequenceAndRevisions(), QQmlPrivate::qmlRegisterSingletonAndRevisions(), QQmlPrivate::qmlRegisterTypeAndRevisions(), QQmlPrivate::qmlRegisterTypeAndRevisions< QQmlTypeNotAvailable, void >(), resolveImport(), and resolveModuleVersion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromMinorVersion()

template<typename Minor , if_valid_segment_type< Minor > = true>
template< typename Minor, QTypeRevision::if_valid_segment_type< Minor >=true > static QTypeRevision QTypeRevision::fromMinorVersion ( Minor minorVersion)
inlinestaticconstexpr

Produces a QTypeRevision from the given minorVersion with an invalid major version.

minorVersion needs to be a valid segment.

See also
isValidSegment()

Definition at line 71 of file qtyperevision.h.

References QTypeRevision(), isValidSegment(), minorVersion(), and Q_ASSERT.

Referenced by Moc::parsePropertyAttributes(), Moc::parseRevision(), QQmlPrivate::qmlregister(), qmlRegisterAnonymousType(), qmlRegisterCustomType(), qmlRegisterExtendedUncreatableType(), qmlRegisterRevision(), qmlRegisterType(), qmlRegisterUncreatableType(), QQmlTypeModuleVersion::type(), and QQmlImports::validVersion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromVersion()

template<typename Major , typename Minor , if_valid_segment_type< Major > = true, if_valid_segment_type< Minor > = true>
template< typename Major, typename Minor, QTypeRevision::if_valid_segment_type< Major >=true, QTypeRevision::if_valid_segment_type< Minor >=true > static QTypeRevision QTypeRevision::fromVersion ( Major majorVersion,
Minor minorVersion )
inlinestaticconstexpr

◆ hasMajorVersion()

◆ hasMinorVersion()

bool QTypeRevision::hasMinorVersion ( ) const
inlineconstexpr

Returns true if the minor version is known, otherwise false.

See also
minorVersion(), hasMajorVersion()

Definition at line 91 of file qtyperevision.h.

Referenced by assignVersions(), QQmlType::availableInVersion(), QQmlImportInstance::getVersionedScripts(), handleInMinorVersion(), QQmlPropertyCache::isAllowedInRevision(), isValid(), isVersionAllowed(), QQmlMetaType::matchingModuleVersion(), operator<<(), QQmlMetaTypeData::propertyCache(), qQmlResolveImportPaths(), and QQmlMetaType::registerModule().

+ Here is the caller graph for this function:

◆ isValid()

bool QTypeRevision::isValid ( ) const
inlineconstexpr

Returns true if the major version or the minor version is known, otherwise false.

See also
hasMajorVersion(), hasMinorVersion()

Definition at line 94 of file qtyperevision.h.

References hasMajorVersion(), and hasMinorVersion().

Referenced by QQmlImports::addFileImport(), QQmlImports::addLibraryImport(), QmlTypesClassDescription::collect(), QQmlPropertyCache::createStandalone(), doRegisterSingletonAndRevisions(), doRegisterTypeAndRevisions(), isRevisionAllowed(), QQmlImportDatabase::lockModule(), operator<(), QQmlDirParser::parse(), QQmlTypeLoader::Blob::updateQmldir(), QQmlImports::updateQmldirContent(), QQmlImports::validVersion(), and QmlTypeRegistrar::write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isValidSegment()

template<typename Integer , if_valid_segment_type< Integer > = true>
template< typename Integer, QTypeRevision::if_valid_segment_type< Integer >=true > static bool QTypeRevision::isValidSegment ( Integer segment)
inlinestaticconstexpr

Returns true if the given number can be used as either major or minor version in a QTypeRevision.

The valid range for segment is {>= 0} and {< 255}.

Definition at line 45 of file qtyperevision.h.

Referenced by fromMajorVersion(), fromMinorVersion(), fromVersion(), Moc::parsePropertyAttributes(), Moc::parseRevision(), and QQmlTypeModuleVersion::type().

+ Here is the caller graph for this function:

◆ majorVersion()

◆ minorVersion()

quint8 QTypeRevision::minorVersion ( ) const
inlineconstexpr

◆ toEncodedVersion()

template<typename Integer , if_valid_value_type< Integer > = true>
template< typename Integer, QTypeRevision::if_valid_value_type< Integer >=true > Integer QTypeRevision::toEncodedVersion ( ) const
inlineconstexpr

Transforms the revision into an integer value, encoding the minor version into the least significant byte, and the major version into the second least significant byte.

Integer needs to be at least 16 bits wide, and must not have a sign bit in the least significant 16 bits.

See also
fromEncodedVersion()

Definition at line 97 of file qtyperevision.h.

Referenced by operator<<(), Moc::parsePropertyAttributes(), and Moc::testFunctionRevision().

+ Here is the caller graph for this function:

◆ zero()

Friends And Related Symbol Documentation

◆ comparesEqual

constexpr bool comparesEqual ( const QTypeRevision & lhs,
const QTypeRevision & rhs )
friend

Definition at line 104 of file qtyperevision.h.

◆ compareThreeWay

constexpr Qt::strong_ordering compareThreeWay ( const QTypeRevision & lhs,
const QTypeRevision & rhs )
friend

Definition at line 107 of file qtyperevision.h.

◆ operator<<()

QDataStream & operator<< ( QDataStream & out,
const QTypeRevision & revision )
related
Since
6.0

Writes the revision revision to stream out.

Definition at line 165 of file qtyperevision.cpp.

References out, and toEncodedVersion().

+ Here is the call graph for this function:

◆ operator>>()

QDataStream & operator>> ( QDataStream & in,
QTypeRevision & revision )
related
Since
6.0

Reads a revision from stream in and stores it in revision.

Definition at line 177 of file qtyperevision.cpp.

References fromEncodedVersion().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: