Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

kore::Version Class Reference

class kore::Version - common version information (major/minor/revision/string) helper class. More...

#include <version.h>

List of all members.

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


Detailed Description

class kore::Version - common version information (major/minor/revision/string) helper class.

Definition at line 14 of file version.h.


Constructor & Destructor Documentation

Version::Version const int    major,
const int    minor = 0,
const int    revision = 0,
const char *    version = 0
 

Create a Version instance: <major>.<minor>.<revision>.

Parameters:
major  - Major version number (default = 0)
minor  - Minor version number (default = 0)
revision  - Revision number (default = 0)
version  - Version string (usually "<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 }

Version::~Version   [virtual]
 

Copy constructor.

Parameters:
other  - version to be copied

Definition at line 24 of file version.cpp.

00025 {
00026     // let the user deal with allocated memory
00027 //    delete _version;
00028 }

Version::Version   [protected]
 

Default constructor.

Definition at line 7 of file version.cpp.

References setVersion().

00008 {
00009     setVersion();
00010 }


Member Function Documentation

const int Version::major   const [virtual]
 

Get the major version number.

Returns:
- 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 }

const int Version::minor   const [virtual]
 

Get the minor version number.

Returns:
- 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 }

const bool Version::operator & const Version &    other const [virtual]
 

Checks if the current version is binary compatible with the specified one.

Parameters:
other  - the other version to compare against
Returns:
true - if the two versions are binary compatible, false otherwise

Definition at line 76 of file version.cpp.

00077 {
00078     return true;
00079 }

const bool Version::operator && const Version &    other const [virtual]
 

Checks if the current version is source compatible with the specified one.

Parameters:
other  - the other version to compare against
Returns:
true - if the two versions are source compatible, false otherwise

Definition at line 80 of file version.cpp.

00081 {
00082     return true;
00083 }

Version::operator const char *   const [virtual]
 

Get the version string (usually "<major>.<minor>.<revision>").

Returns:
- the version number string

Definition at line 46 of file version.cpp.

References _version.

00047 {
00048     return _version;
00049 }

const bool Version::operator!= const Version &    other const [virtual]
 

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.

Parameters:
other  - the other version to compare against
Returns:
true - if the two versions match (i.e. are the same), false otherwise

Definition at line 54 of file version.cpp.

00055 {
00056     return !(*this == other);
00057 }

const bool Version::operator< const Version &    other const [virtual]
 

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.

Parameters:
other  - the other version to compare against
Returns:
true - if the corrent version is older (smaller), false otherwise

Definition at line 58 of file version.cpp.

References _major, _minor, and _revision.

00059 {
00060     return (this != &other) && ((_major < other._major) ||
00061         (( _major == other._major) && (_minor < other._minor)) ||
00062         (( _major == other._major) && (_minor == other._minor) && (_revision < other._revision)));
00063 }

const bool Version::operator<= const Version &    other const [virtual]
 

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.

Parameters:
other  - the other version to compare against
Returns:
true - if the corrent version is older (smaller), false otherwise

Definition at line 64 of file version.cpp.

00065 {
00066     return (*this == other) || (*this < other);
00067 }

const bool Version::operator== const Version &    other const [virtual]
 

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.

Parameters:
other  - the other version to compare against
Returns:
true - if the two versions match (i.e. are the same), false otherwise

Definition at line 50 of file version.cpp.

References _major, _minor, and _revision.

00051 {
00052     return (this == &other) || ((_major == other._major) && (_minor == other._minor) && (_revision == other._revision));
00053 }

const bool Version::operator> const Version &    other const [virtual]
 

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.

Parameters:
other  - the other version to compare against
Returns:
true - if the corrent version is newer (bigger), false otherwise

Definition at line 68 of file version.cpp.

00069 {
00070     return !(*this <= other);
00071 }

const bool Version::operator>= const Version &    other const [virtual]
 

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.

Parameters:
other  - the other version to compare against
Returns:
true - if the corrent version is older (smaller), false otherwise

Definition at line 72 of file version.cpp.

00073 {
00074     return !(*this < other);
00075 }

const int Version::revision   const [virtual]
 

Get the revision number.

Returns:
- the revision number

Definition at line 38 of file version.cpp.

References _revision.

Referenced by setRevision(), setVersion(), and Version().

00039 {
00040     return _revision;
00041 }

void Version::setMajor const int    major = 0 [protected]
 

Set the major version number.

Parameters:
major  - the major version number

Definition at line 85 of file version.cpp.

References _major, and major().

Referenced by setVersion().

00086 {
00087     _major = major;
00088 }

void Version::setMinor const int    minor = 0 [protected]
 

Set the minor version number.

Parameters:
minor  - the minor version number

Definition at line 89 of file version.cpp.

References _minor, and minor().

Referenced by setVersion().

00090 {
00091     _minor = minor;
00092 }

void Version::setRevision const int    revision = 0 [protected]
 

Set the revision number.

Parameters:
revision  - the revision number

Definition at line 93 of file version.cpp.

References _revision, and revision().

Referenced by setVersion().

00094 {
00095     _revision = revision;
00096 }

void Version::setString const char *    version = 0 [protected]
 

Set the version string.

Parameters:
version  - 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 }

void Version::setVersion const int    major = 0,
const int    minor = 0,
const int    revision = 0,
const char *    version = 0
[protected]
 

Set the version information: major/minor/revision/string.

Parameters:
major  - the major version number
minor  - the minor version number
revision  - the revision number
version  - the version string

Definition at line 111 of file version.cpp.

References major(), minor(), revision(), setMajor(), setMinor(), setRevision(), and setString().

Referenced by Version().

00112 {
00113     setMajor(major);
00114     setMinor(minor);
00115     setRevision(revision);
00116     setString(version);
00117 }

const char * Version::string   const [virtual]
 

Get the version string (usually "<major>.<minor>.<revision>").

Returns:
- the version number string

Definition at line 42 of file version.cpp.

References _version.

00043 {
00044     return _version;
00045 }


Member Data Documentation

int kore::Version::_major [private]
 

Definition at line 152 of file version.h.

Referenced by major(), operator<(), operator==(), and setMajor().

int kore::Version::_minor [private]
 

Definition at line 154 of file version.h.

Referenced by minor(), operator<(), operator==(), and setMinor().

int kore::Version::_revision [private]
 

Definition at line 156 of file version.h.

Referenced by operator<(), operator==(), revision(), and setRevision().

const char* kore::Version::_version [private]
 

Definition at line 158 of file version.h.

Referenced by operator const char *(), setString(), and string().


The documentation for this class was generated from the following files:
Generated on Sat Feb 16 08:40:52 2002 for Korelib by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001