2017-08-05 13:09:50 +00:00
|
|
|
#include <nx/KernelVersionHandler.h>
|
2017-07-12 14:02:10 +00:00
|
|
|
|
|
|
|
nx::KernelVersionHandler::KernelVersionHandler() :
|
|
|
|
mIsSet(false),
|
|
|
|
mEntry(0,0)
|
|
|
|
{}
|
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
void nx::KernelVersionHandler::operator=(const KernelVersionHandler & other)
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
2018-06-24 15:01:16 +00:00
|
|
|
mIsSet = other.mIsSet;
|
|
|
|
mEntry.setKernelCapability(other.mEntry.getKernelCapability());
|
2017-07-12 14:02:10 +00:00
|
|
|
}
|
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
bool nx::KernelVersionHandler::operator==(const KernelVersionHandler & other) const
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
2018-06-24 15:01:16 +00:00
|
|
|
return (mIsSet == other.mIsSet) \
|
|
|
|
&& (mEntry.getKernelCapability() == other.mEntry.getKernelCapability());
|
2017-07-12 14:02:10 +00:00
|
|
|
}
|
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
bool nx::KernelVersionHandler::operator!=(const KernelVersionHandler & other) const
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
2018-06-24 15:01:16 +00:00
|
|
|
return !(*this == other);
|
2017-07-12 14:02:10 +00:00
|
|
|
}
|
|
|
|
|
2018-06-29 04:24:39 +00:00
|
|
|
void nx::KernelVersionHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps)
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
2018-06-24 15:01:16 +00:00
|
|
|
if (caps.size() > kMaxKernelCapNum)
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
|
|
|
throw fnd::Exception(kModuleName, "Too many kernel capabilities");
|
|
|
|
}
|
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
if (caps.size() == 0)
|
2017-07-12 14:02:10 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
mEntry.setKernelCapability(caps[0]);
|
|
|
|
|
|
|
|
mIsSet = true;
|
|
|
|
}
|
|
|
|
|
2018-06-29 04:24:39 +00:00
|
|
|
void nx::KernelVersionHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
|
|
|
if (isSet() == false)
|
|
|
|
return;
|
|
|
|
|
|
|
|
caps.addElement(mEntry.getKernelCapability());
|
|
|
|
}
|
|
|
|
|
|
|
|
void nx::KernelVersionHandler::clear()
|
|
|
|
{
|
|
|
|
mIsSet = false;
|
|
|
|
mEntry.setVerMajor(0);
|
|
|
|
mEntry.setVerMinor(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool nx::KernelVersionHandler::isSet() const
|
|
|
|
{
|
|
|
|
return mIsSet;
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
uint16_t nx::KernelVersionHandler::getVerMajor() const
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
|
|
|
return mEntry.getVerMajor();
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
void nx::KernelVersionHandler::setVerMajor(uint16_t major)
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
|
|
|
mEntry.setVerMajor(major);
|
|
|
|
mIsSet = true;
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
uint8_t nx::KernelVersionHandler::getVerMinor() const
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
|
|
|
return mEntry.getVerMinor();
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
void nx::KernelVersionHandler::setVerMinor(uint8_t minor)
|
2017-07-12 14:02:10 +00:00
|
|
|
{
|
|
|
|
mEntry.setVerMinor(minor);
|
|
|
|
mIsSet = true;
|
2018-06-24 15:01:16 +00:00
|
|
|
}
|