The Version class was designed to store and handle version informations in a
major-minor-micro triplet. The class provides version assignment from various sources,
comparision operators, as well as partial version number setting and retrieval. Version
comparision is done by comparing major, then minor, and finally micro with major
having the strongest weigth, then minor, then micro.
Synopsis
#include <lyric/Version.hpp>
class Version
{
public:
~Version ();
Version (uint32 major = 0, uint32 minor = 0, uint32 micro = 0);
Version (const Version& version);
Version& operator = (const Version& version);
Version& operator << (const String& verstr);
bool operator == (const Version& version) const;
bool operator != (const Version& version) const;
bool operator < (const Version& version) const;
bool operator > (const Version& version) const;
bool operator <= (const Version& version) const;
bool operator >= (const Version& version) const;
uint32 major () const;
uint32 minor () const;
uint32 micro () const;
void major (uint32 val);
void minor (uint32 val);
void micro (uint32 val);
friend:
String& operator << (String& out, const Version& version);
};
Description
-
˜Version () -
Destroys this version. Releases all used resources to the system.
-
Version (uint32 major = 0, uint32 minor = 0, uint32 micro = 0) -
Constructs this version with the given major-minor-micro triplet. Each
unspecified part of the triplet argument is defaulted to zero.
-
Version (const Version& version) -
Constructs this version from the given version. The major-minor-micro
triplet stored in version is cloned into this version.
-
Version& operator = (const Version& version) -
Assigns this version from the rvalue version. The major-minor-micro triplet
stored in version is cloned into this version. A reference to this version is
returned for assignment chaining.
-
bool operator == (const Version& version) const -
Returns true if this version and the rvalue version store the same
major-minor-micro triplet, false if not.
-
bool operator == (const Version& version) const -
Returns true if this version and the rvalue version don’t store the same
major-minor-micro triplet, false if they do.
-
bool operator < (const Version& version) const -
Returns true if this version is smaller than the rvalue version, false if not.
-
bool operator > (const Version& version) const -
Returns true if this version is bigger than the rvalue version, false if not.
-
bool operator <= (const Version& version) const -
Returns true if this version is smaller or equal than the rvalue version, false
if not.
-
bool operator >= (const Version& version) const -
Returns true if this version is bigger or equal than the rvalue version, false
if not.
-
uint32 major () const -
Returns the major part of this version.
-
uint32 minor () const -
Returns the minor part of this version.
-
uint32 micro () const -
Returns the micro part of this version.
-
void major (uint32 val) -
Sets the major part in this version to the given value.
-
void minor (uint32 val) -
Sets the minor part in this version to the given value.
-
void micro (uint32 val) -
Sets the micro part in this version to the given value.
-
String& operator << (String& out, const Version& version) -
Writes the rvalue version in the lvalue output string. The version is writen in
“major.minor.micro” format (each part of the triplet separated by a ’.’ (dot)).