GCF LOGO VCL LOGO

Represents version information as a major, minor, revision number triplet. More...

#include <GCF3/Version>

Public Member Functions

 Version (quint16 major=0, quint16 minor=0, quint16 revision=0)
 
 Version (const Version &other)
 
 Version (const QString &versionStr)
 
 ~Version ()
 
bool operator== (const Version &other) const
 
Versionoperator= (const Version &other)
 
bool isValid () const
 
bool isBaseVersion () const
 
bool operator< (const Version &other) const
 
bool operator> (const Version &other) const
 
bool operator<= (const Version &other) const
 
bool operator>= (const Version &other) const
 
bool operator!= (const Version &other) const
 
quint16 major () const
 
quint16 minor () const
 
quint16 revision () const
 
 operator QString () const
 
QString toString () const
 

Detailed Description

You can construct a version object by

  • specifying major, minor, revision numbers
  • parsing version from a string

A version object will be invalid if major or minor or revision numbers

  • are greater than 65535
  • are non-numeric values

You can check for the validity of a version number via the isValid() method.

Constructor & Destructor Documentation

GCF::Version::Version ( quint16  major = 0,
quint16  minor = 0,
quint16  revision = 0 
)

Constructs a version object

Parameters
majormajor component of the version number
minorminor component of the version number
revisioncomponent of the version number
GCF::Version::Version ( const Version other)

Copy constructor, copies contents of another version object into this version object.

Parameters
otherthe other version object from which version information is copied
GCF::Version::Version ( const QString &  versionStr)
explicit

Constructs a version object from a string representation of it.

Parameters
versionStrstring representation of the version. Example "10.8.4"
Note
If versionStr contains an invalid version representation, then isValid() will return false.
See Also
toString()
GCF::Version::~Version ( )

Destructor

Member Function Documentation

bool GCF::Version::operator== ( const Version other) const

Comparison operator.

Parameters
otherthe version against which this version object would be compared
Returns
true if this version is equal to other, false otherwise.
GCF::Version & GCF::Version::operator= ( const Version other)

Assignment operator

Parameters
otherversion object, whose data will be copied on to this version object
Returns
A reference to the modified version object
bool GCF::Version::isValid ( ) const

A version is considered valid, if major() returns a value greater than or equal to 1.

Returns
true, if the version object is valid. False otherwise.
bool GCF::Version::isBaseVersion ( ) const

A version is considered base-version, if major() is 1, minor() is 0 and revision() is 0.

Returns
true, if the version object represents base-version. False otherwise.
bool GCF::Version::operator< ( const Version other) const

Less than operator.

Returns
true, if this version is less than the other version. False otherwise.
bool GCF::Version::operator> ( const Version other) const

Greater than operator.

Returns
true, if this version is greater than the other version. False otherwise.
bool GCF::Version::operator<= ( const Version other) const

Less than or equal to operator

Returns
true, if this version is less than or equal to the other version. False otherwise.
bool GCF::Version::operator>= ( const Version other) const

Greater than or equal to operator.

Returns
true, if this version is greater than or equal to the other version. False otherwise.
bool GCF::Version::operator!= ( const Version other) const

Not equal to operator.

Returns
true, if this version is not equal to the other version. False otherwise.
quint16 GCF::Version::major ( ) const
Returns
the major component of this version
quint16 GCF::Version::minor ( ) const
Returns
the minor component of this version
quint16 GCF::Version::revision ( ) const
Returns
the revision component of this version
GCF::Version::operator QString ( ) const
Returns
a string representation of this version object
QString GCF::Version::toString ( ) const
Returns
a string representation of this version object