14#ifndef WPIUTIL_WPI_VERSIONTUPLE_H
15#define WPIUTIL_WPI_VERSIONTUPLE_H
25template <
typename HasherT, support::endianness Endianness>
34 unsigned HasMinor : 1;
36 unsigned Subminor : 31;
37 unsigned HasSubminor : 1;
40 unsigned HasBuild : 1;
44 : Major(0), Minor(0), HasMinor(false), Subminor(0), HasSubminor(false),
45 Build(0), HasBuild(false) {}
48 : Major(Major), Minor(0), HasMinor(false), Subminor(0),
49 HasSubminor(false), Build(0), HasBuild(false) {}
52 : Major(Major), Minor(Minor), HasMinor(true), Subminor(0),
53 HasSubminor(false), Build(0), HasBuild(false) {}
57 : Major(Major), Minor(Minor), HasMinor(true), Subminor(Subminor),
58 HasSubminor(true), Build(0), HasBuild(false) {}
61 unsigned Subminor,
unsigned Build)
62 : Major(Major), Minor(Minor), HasMinor(true), Subminor(Subminor),
63 HasSubminor(true), Build(Build), HasBuild(true) {}
68 return Major == 0 && Minor == 0 && Subminor == 0 && Build == 0;
111 if (Result.Build == 0) {
112 Result.HasBuild =
false;
113 if (Result.Subminor == 0) {
114 Result.HasSubminor =
false;
115 if (Result.Minor == 0)
116 Result.HasMinor =
false;
125 return X.Major == Y.Major && X.Minor == Y.Minor &&
126 X.Subminor == Y.Subminor && X.Build == Y.Build;
142 return std::tie(X.Major, X.Minor, X.Subminor, X.Build) <
143 std::tie(Y.Major, Y.Minor, Y.Subminor, Y.Build);
This file defines DenseMapInfo traits for DenseMap.
Definition: VersionTuple.h:26
Represents a version number in the form major[.minor[.subminor[.build]]].
Definition: VersionTuple.h:30
friend bool operator<=(const VersionTuple &X, const VersionTuple &Y)
Determine whether one version number precedes or is equivalent to another.
Definition: VersionTuple.h:159
VersionTuple withoutBuild() const
Return a version tuple that contains only the first 3 version components.
Definition: VersionTuple.h:96
constexpr VersionTuple()
Definition: VersionTuple.h:43
std::optional< unsigned > getBuild() const
Retrieve the build version number, if provided.
Definition: VersionTuple.h:89
constexpr VersionTuple(unsigned Major, unsigned Minor, unsigned Subminor)
Definition: VersionTuple.h:55
std::optional< unsigned > getSubminor() const
Retrieve the subminor version number, if provided.
Definition: VersionTuple.h:82
friend bool operator!=(const VersionTuple &X, const VersionTuple &Y)
Determine if two version numbers are not equivalent.
Definition: VersionTuple.h:133
constexpr VersionTuple(unsigned Major, unsigned Minor)
Definition: VersionTuple.h:51
friend bool operator<(const VersionTuple &X, const VersionTuple &Y)
Determine whether one version number precedes another.
Definition: VersionTuple.h:141
friend bool operator>=(const VersionTuple &X, const VersionTuple &Y)
Determine whether one version number follows or is equivalent to another.
Definition: VersionTuple.h:168
VersionTuple normalize() const
Return a version tuple that contains only components that are non-zero.
Definition: VersionTuple.h:109
std::optional< unsigned > getMinor() const
Retrieve the minor version number, if provided.
Definition: VersionTuple.h:75
bool empty() const
Determine whether this version information is empty (e.g., all version components are zero).
Definition: VersionTuple.h:67
VersionTuple withMajorReplaced(unsigned NewMajor) const
Return a version tuple that contains a different major version but everything else is the same.
Definition: VersionTuple.h:104
constexpr VersionTuple(unsigned Major, unsigned Minor, unsigned Subminor, unsigned Build)
Definition: VersionTuple.h:60
unsigned getMajor() const
Retrieve the major version number.
Definition: VersionTuple.h:72
friend bool operator==(const VersionTuple &X, const VersionTuple &Y)
Determine if two version numbers are equivalent.
Definition: VersionTuple.h:124
friend bool operator>(const VersionTuple &X, const VersionTuple &Y)
Determine whether one version number follows another.
Definition: VersionTuple.h:150
constexpr VersionTuple(unsigned Major)
Definition: VersionTuple.h:47
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:43
Definition: ntcore_cpp.h:26