EHS/src/Version.cpp

71 lines
1.5 KiB
C++
Raw Normal View History

2023-12-17 15:00:08 -08:00
#include "Version.h"
2023-12-17 03:29:08 -08:00
namespace lwe
{
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;
}
}
}