#include <Version.h>
Public Types | |
enum | PhaseEnum { eDevelopment , eAlpha , eBeta , eRelease } |
enum representing the phase of the version | |
Public Member Functions | |
Version (const char *buildDate=__DATE__) | |
default ctor, sets to the minimum version | |
Version (const char *version, unsigned int major, unsigned int minor, unsigned int release, PhaseEnum phase, unsigned int phaseNumber, bool is64bit, unsigned int buildNumber, const char *date=__DATE__) | |
make the version | |
Version (const std::string &v, const char *date=__DATE__) | |
void | parseFromString (const std::string &lrSource, const char *lpDate=__DATE__) |
make it from a std::string. This breaks it down into fields | |
unsigned int | majorNumber () const |
get major number | |
unsigned int | minorNumber () const |
get minor number | |
unsigned int | releaseNumber () const |
get release number | |
std::string | getVersionString () const |
get build version string | |
unsigned int | buildNumber () const |
get build number (jenkins build number, or 0) | |
PhaseEnum | phase () const |
get the phase | |
bool | isRelease () const |
is this a release | |
const char * | phaseNameString () const |
get the phase as a (0- or 1-letter) string | |
unsigned int | phaseNumber () const |
get phase number (the "build number"; this is zero for any final release) | |
std::string | phaseStringFull () const |
Returns the phase string with letter and number (e. g. "001234b"), or a blank string if none. | |
const std::string & | buildDate (void) const |
get the build date, which returns the date passed into the ctor | |
bool | is64Bit () const |
64 bit bool flag | |
const char * | getBitString () const |
get the 32/64 bit flag as a string | |
std::string | getArchitectureString () const |
get the architecure string ("arm64" or "x86_64") | |
bool | isCompatible (const Version &v) const |
std::string | string () const |
Return equivalent of string passed to constructor. | |
std::string | majorMinorString () const |
std::string | majorMinorReleaseString () const |
std::string | releasePhaseString () const |
std::string | doubleString () const |
long long | majorMinorReleasePhaseInteger () const |
double | majorMinorReleasePhaseDouble () const |
std::string | majMinRelPhaseStr (void) const |
Simple testing function - check by reading output. | |
Static Public Member Functions | |
static const char * | phaseNameString (PhaseEnum phase) |
get the phase as a string | |
Protected Attributes | |
std::string | _version |
product version (11.0dev) | |
unsigned int | _major |
product major version | |
unsigned int | _minor |
product minor version | |
unsigned int | _release |
product release version | |
PhaseEnum | _phase |
the phase the product is in | |
unsigned int | _phaseNumber |
if the phase is alpha or beta, what is number for that | |
std::string | _buildDate |
the date the object's constructor was compiled on | |
bool | _is64Bit |
object was compiled as 64 bit | |
unsigned int | _buildNumber |
Class that wraps up version numbers and logic
We have a hierarchy of three release numbers, these are...
With this logic 5.0.0 and 5.0.1 are compatible versions that work the same way, but with 5.0.1 having bugs fixed and so on.
To manage alpha/beta builds we also have a 'phase', which indicates whether the software is in development, alpha, beta or release. If the software is not in release, we have to have a fourth number indicating the alpha/beta number.
The final number is the build number, which represents the current repository version.
We also have logic to turn a version into and out of a string as well a comparison to see which release is greater than another.
So,
The string that represents the version number fits the following regex... (0..9)+"."(0..9)+"v"(0..9)+[(d|a|b|p)(0..9)+]
NOTE: there is special case for version comparisons for dev builds. A dev build is considered not less than or greater than any other build for the same major and minor version, but not equal to either. This is because dev versions can (in theory) proceed right through from v1a1 to full release of v99 and still not provide incompatibilities, and any incompatibility still wouldn't be detected by the current system of having dev builds at v0. e. g. 5.2v0d0 < 5.2v1 is false; 5.2v0d0 > 5.2v1 is false; 5.2v0d0 == 5.2v1 is false. Still, 5.2v0d0 < 5.3v1 is true, etc.
DD::Image::Version::Version | ( | const char * | buildDate = __DATE__ | ) |
default ctor, sets to the minimum version
make an empty which defaults to 0.0v0a1
NEVER OVERRIDE THE DATE. THIS IS THE MECHANISM WE USE TO BE SURE THE BUILD DATE IS THE DATE THE OBJECT WAS COMPILED, NOT THE DATE THE LIBRARY WAS COMPILED. (Yes I am shouting.)
DD::Image::Version::Version | ( | const char * | version, |
unsigned int | major, | ||
unsigned int | minor, | ||
unsigned int | release, | ||
PhaseEnum | phase, | ||
unsigned int | phaseNumber, | ||
bool | is64bit, | ||
unsigned int | buildNumber, | ||
const char * | date = __DATE__ |
||
) |
make the version
NEVER OVERRIDE THE DATE. THIS IS THE MECHANISM WE USE TO BE SURE THE BUILD DATE IS THE DATE THE OBJECT WAS COMPILED, NOT THE DATE THE LIBRARY WAS COMPILED. (Yes I am shouting.)
DD::Image::Version::Version | ( | const std::string & | v, |
const char * | date = __DATE__ |
||
) |
make it from a std::string. This breaks it down into fields. NOTE: must be an explicit std::string, as passing a const char* will use a different constructor.
References parseFromString().
|
inline |
is the other version compatible with this version
References majorNumber(), and minorNumber().
std::string DD::Image::Version::string | ( | ) | const |
Return equivalent of string passed to constructor.
Return the string description of major, minor, release, and phase. Does not include date or bits
References majorNumber(), minorNumber(), phase(), phaseStringFull(), and releaseNumber().
Referenced by DD::Image::VersionStreamPut().
std::string DD::Image::Version::majorMinorString | ( | ) | const |
Returns the major and minor numbers in a double-style string
References majorNumber(), and minorNumber().
std::string DD::Image::Version::majorMinorReleaseString | ( | ) | const |
Returns the major, minor, and release numbers in a string
References majorNumber(), minorNumber(), and releaseNumber().
std::string DD::Image::Version::releasePhaseString | ( | ) | const |
Returns the release and phase identifiers in a string
References phaseStringFull(), and releaseNumber().
std::string DD::Image::Version::doubleString | ( | ) | const |
Returns a string version of majorMinorReleasePhaseDouble(). 5.1v2b3 returns "5.102000003". Deprecated. Please avoid using double strings.
References majorMinorReleasePhaseDouble().
long long DD::Image::Version::majorMinorReleasePhaseInteger | ( | ) | const |
Return an integer representation of the major, minor, release, and build. This number will increase for a "newer" version, and is the value of the kDDImageVersionInteger macro. 5.1v2.000003b returns 5102000003. Note however that 5.1v2 returns 51200, so direct integer comparisons of version numbers are not completely reliable. Deprecated. Please use the class comparison methods instead.
References majorNumber(), minorNumber(), phaseNumber(), and releaseNumber().
Referenced by majorMinorReleasePhaseDouble().
double DD::Image::Version::majorMinorReleasePhaseDouble | ( | ) | const |
Returns a double version of majorMinorReleasePhaseInteger(). 5.1v2.000003b returns 5.102000003. Deprecated. Please use the class comparison methods instead.
References majorMinorReleasePhaseInteger().
Referenced by doubleString().
|
inline |
Simple testing function - check by reading output.
same as string(); for back-compatibility
©2024 The Foundry Visionmongers, Ltd. All Rights Reserved. |