EHS/src/Version.cpp

71 lines
1.5 KiB
C++

#include "ehs/Version.h"
namespace ehs
{
Version::Version()
: major(0), minor(0), patch(0)
{
}
Version::Version(const UInt_32 major, const UInt_32 minor, const UInt_32 patch)
: major(major), minor(minor), patch(patch)
{
}
Version::Version(const Version& version)
: major(version.major), minor(version.minor), patch(version.patch)
{
}
Version& Version::operator=(const Version& version)
{
if (this == &version)
return *this;
major = version.major;
minor = version.minor;
patch = version.patch;
return *this;
}
bool Version::operator==(const Version& version) const
{
return major == version.major && minor == version.minor && patch == version.patch;
}
bool Version::operator!=(const Version& version) const
{
return major != version.major || minor != version.minor || patch != version.patch;
}
unsigned int Version::operator[](const UInt_32 i) const
{
switch (i)
{
case 0:
return major;
case 1:
return minor;
case 2:
return patch;
default:
return major;
}
}
unsigned int& Version::operator[](const UInt_32 i)
{
switch (i)
{
case 0:
return major;
case 1:
return minor;
case 2:
return patch;
default:
return major;
}
}
}