#include <version.h>
Public Methods | |
Version (const int major,const int minor=0, const int revision=0, const char *version=0) | |
Create a Version instance: <major>.<minor>.<revision>. More... | |
virtual | ~Version () |
Copy constructor. More... | |
virtual const int | major () const |
Get the major version number. More... | |
virtual const int | minor () const |
Get the minor version number. More... | |
virtual const int | revision () const |
Get the revision number. More... | |
virtual const char * | string () const |
Get the version string (usually "<major>.<minor>.<revision>"). More... | |
virtual | operator const char * () const |
Get the version string (usually "<major>.<minor>.<revision>"). More... | |
virtual const bool | operator== (const Version &other) const |
Compares to version to see if they match Two versions match if they have the same major, minor and revision Note: the version string is ignored when performing version comparison. More... | |
virtual const bool | operator!= (const Version &other) const |
Compares to version to see if they don't match v1 != v2 if and only if !(v1 == v2) Note: the version string is ignored when performing version comparison. More... | |
virtual const bool | operator< (const Version &other) const |
Checks of the current version is older (smaller) than the specified one The comparison is performed on major, minor and revision, in this order Note: the version string is ignored when performing version comparison. More... | |
virtual const bool | operator<= (const Version &other) const |
The combined result of == and < v1 <= v2 if and only if (v1 == v2) || (v1 < v2) Note: the version string is ignored when performing version comparison. More... | |
virtual const bool | operator> (const Version &other) const |
Checks of the current version is newer (bigger) than the specified one The comparison is performed on major, minor and revision, in this order Note: the version string is ignored when performing version comparison. More... | |
virtual const bool | operator>= (const Version &other) const |
The combined result of == and > v1 >= v2 if and only if (v1 == v2) || (v1 > v2) Note: the version string is ignored when performing version comparison. More... | |
virtual const bool | operator & (const Version &other) const |
Checks if the current version is binary compatible with the specified one. More... | |
virtual const bool | operator && (const Version &other) const |
Checks if the current version is source compatible with the specified one. More... | |
Protected Methods | |
Version () | |
Default constructor. More... | |
void | setMajor (const int major=0) |
Set the major version number. More... | |
void | setMinor (const int minor=0) |
Set the minor version number. More... | |
void | setRevision (const int revision=0) |
Set the revision number. More... | |
void | setString (const char *version=0) |
Set the version string. More... | |
void | setVersion (const int major=0, const int minor=0, const int revision=0, const char *version=0) |
Set the version information: major/minor/revision/string. More... | |
Private Attributes | |
int | _major |
int | _minor |
int | _revision |
const char * | _version |
Definition at line 14 of file version.h.
|
Create a Version instance: <major>.<minor>.<revision>.
Definition at line 11 of file version.cpp. References major(), minor(), revision(), and setVersion().
00012 { 00013 setVersion(major, minor, revision, version); 00014 } |
|
Copy constructor.
Definition at line 24 of file version.cpp.
00025 { 00026 // let the user deal with allocated memory 00027 // delete _version; 00028 } |
|
Default constructor.
Definition at line 7 of file version.cpp. References setVersion().
00008 { 00009 setVersion(); 00010 } |
|
Get the major version number.
Definition at line 30 of file version.cpp. References _major. Referenced by setMajor(), setVersion(), and Version().
00031 { 00032 return _major; 00033 } |
|
Get the minor version number.
Definition at line 34 of file version.cpp. References _minor. Referenced by setMinor(), setVersion(), and Version().
00035 { 00036 return _minor; 00037 } |
|
Checks if the current version is binary compatible with the specified one.
Definition at line 76 of file version.cpp.
00077 { 00078 return true; 00079 } |
|
Checks if the current version is source compatible with the specified one.
Definition at line 80 of file version.cpp.
00081 { 00082 return true; 00083 } |
|
Get the version string (usually "<major>.<minor>.<revision>").
Definition at line 46 of file version.cpp. References _version.
00047 { 00048 return _version; 00049 } |
|
Compares to version to see if they don't match v1 != v2 if and only if !(v1 == v2) Note: the version string is ignored when performing version comparison.
Definition at line 54 of file version.cpp.
00055 { 00056 return !(*this == other); 00057 } |
|
Checks of the current version is older (smaller) than the specified one The comparison is performed on major, minor and revision, in this order Note: the version string is ignored when performing version comparison.
Definition at line 58 of file version.cpp. References _major, _minor, and _revision.
|
|
The combined result of == and < v1 <= v2 if and only if (v1 == v2) || (v1 < v2) Note: the version string is ignored when performing version comparison.
Definition at line 64 of file version.cpp.
00065 { 00066 return (*this == other) || (*this < other); 00067 } |
|
Compares to version to see if they match Two versions match if they have the same major, minor and revision Note: the version string is ignored when performing version comparison.
Definition at line 50 of file version.cpp. References _major, _minor, and _revision.
|
|
Checks of the current version is newer (bigger) than the specified one The comparison is performed on major, minor and revision, in this order Note: the version string is ignored when performing version comparison.
Definition at line 68 of file version.cpp.
00069 { 00070 return !(*this <= other); 00071 } |
|
The combined result of == and > v1 >= v2 if and only if (v1 == v2) || (v1 > v2) Note: the version string is ignored when performing version comparison.
Definition at line 72 of file version.cpp.
00073 { 00074 return !(*this < other); 00075 } |
|
Get the revision number.
Definition at line 38 of file version.cpp. References _revision. Referenced by setRevision(), setVersion(), and Version().
00039 { 00040 return _revision; 00041 } |
|
Set the major version number.
Definition at line 85 of file version.cpp. References _major, and major(). Referenced by setVersion().
|
|
Set the minor version number.
Definition at line 89 of file version.cpp. References _minor, and minor(). Referenced by setVersion().
|
|
Set the revision number.
Definition at line 93 of file version.cpp. References _revision, and revision(). Referenced by setVersion().
|
|
Set the version string.
Definition at line 97 of file version.cpp. References _version. Referenced by setVersion().
00098 { 00099 // let the user deal with allocated memory 00100 /* delete _version; 00101 _version = 0; 00102 if( version ) 00103 { 00104 size_t len = strlen(version); 00105 _version = new char[len+1]; 00106 strcpy( _version, version ); 00107 } 00108 */ 00109 _version = version; 00110 } |
|
Set the version information: major/minor/revision/string.
Definition at line 111 of file version.cpp. References major(), minor(), revision(), setMajor(), setMinor(), setRevision(), and setString(). Referenced by Version().
|
|
Get the version string (usually "<major>.<minor>.<revision>").
Definition at line 42 of file version.cpp. References _version.
00043 { 00044 return _version; 00045 } |
|
Definition at line 152 of file version.h. Referenced by major(), operator<(), operator==(), and setMajor(). |
|
Definition at line 154 of file version.h. Referenced by minor(), operator<(), operator==(), and setMinor(). |
|
Definition at line 156 of file version.h. Referenced by operator<(), operator==(), revision(), and setRevision(). |
|
Definition at line 158 of file version.h. Referenced by operator const char *(), setString(), and string(). |