00001
00002 #include <string.h>
00003 #include <kore/version.h>
00004
00005 using namespace kore;
00006
00007 Version::Version()
00008 {
00009 setVersion();
00010 }
00011 Version::Version(const int major,const int minor,const int revision,const char* version)
00012 {
00013 setVersion(major, minor, revision, version);
00014 }
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 Version::~Version()
00025 {
00026
00027
00028 }
00029
00030 const int Version::major() const
00031 {
00032 return _major;
00033 }
00034 const int Version::minor() const
00035 {
00036 return _minor;
00037 }
00038 const int Version::revision() const
00039 {
00040 return _revision;
00041 }
00042 const char* Version::string() const
00043 {
00044 return _version;
00045 }
00046 Version::operator const char*() const
00047 {
00048 return _version;
00049 }
00050 const bool Version::operator ==(const Version& other) const
00051 {
00052 return (this == &other) || ((_major == other._major) && (_minor == other._minor) && (_revision == other._revision));
00053 }
00054 const bool Version::operator !=(const Version& other) const
00055 {
00056 return !(*this == other);
00057 }
00058 const bool Version::operator <(const Version& other) const
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 }
00064 const bool Version::operator <=(const Version& other) const
00065 {
00066 return (*this == other) || (*this < other);
00067 }
00068 const bool Version::operator >(const Version& other) const
00069 {
00070 return !(*this <= other);
00071 }
00072 const bool Version::operator >=(const Version& other) const
00073 {
00074 return !(*this < other);
00075 }
00076 const bool Version::operator &(const Version& other) const
00077 {
00078 return true;
00079 }
00080 const bool Version::operator &&(const Version& other) const
00081 {
00082 return true;
00083 }
00084
00085 void Version::setMajor(const int major)
00086 {
00087 _major = major;
00088 }
00089 void Version::setMinor(const int minor)
00090 {
00091 _minor = minor;
00092 }
00093 void Version::setRevision(const int revision)
00094 {
00095 _revision = revision;
00096 }
00097 void Version::setString(const char* version)
00098 {
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109 _version = version;
00110 }
00111 void Version::setVersion(const int major,const int minor,const int revision,const char* version)
00112 {
00113 setMajor(major);
00114 setMinor(minor);
00115 setRevision(revision);
00116 setString(version);
00117 }