nstool/lib/libhac/source/KernelVersionHandler.cpp

80 lines
1.7 KiB
C++
Raw Normal View History

2018-08-07 07:17:51 +00:00
#include <nn/hac/KernelVersionHandler.h>
2018-08-07 07:17:51 +00:00
nn::hac::KernelVersionHandler::KernelVersionHandler() :
mIsSet(false),
mEntry(0,0)
{}
2018-08-07 07:17:51 +00:00
void nn::hac::KernelVersionHandler::operator=(const KernelVersionHandler & other)
{
mIsSet = other.mIsSet;
mEntry.setKernelCapability(other.mEntry.getKernelCapability());
}
2018-08-07 07:17:51 +00:00
bool nn::hac::KernelVersionHandler::operator==(const KernelVersionHandler & other) const
{
return (mIsSet == other.mIsSet) \
&& (mEntry.getKernelCapability() == other.mEntry.getKernelCapability());
}
2018-08-07 07:17:51 +00:00
bool nn::hac::KernelVersionHandler::operator!=(const KernelVersionHandler & other) const
{
return !(*this == other);
}
2018-08-07 07:17:51 +00:00
void nn::hac::KernelVersionHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps)
{
if (caps.size() > kMaxKernelCapNum)
{
throw fnd::Exception(kModuleName, "Too many kernel capabilities");
}
if (caps.size() == 0)
return;
mEntry.setKernelCapability(caps[0]);
mIsSet = true;
}
2018-08-07 07:17:51 +00:00
void nn::hac::KernelVersionHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const
{
if (isSet() == false)
return;
caps.addElement(mEntry.getKernelCapability());
}
2018-08-07 07:17:51 +00:00
void nn::hac::KernelVersionHandler::clear()
{
mIsSet = false;
mEntry.setVerMajor(0);
mEntry.setVerMinor(0);
}
2018-08-07 07:17:51 +00:00
bool nn::hac::KernelVersionHandler::isSet() const
{
return mIsSet;
}
2018-08-07 07:17:51 +00:00
uint16_t nn::hac::KernelVersionHandler::getVerMajor() const
{
return mEntry.getVerMajor();
}
2018-08-07 07:17:51 +00:00
void nn::hac::KernelVersionHandler::setVerMajor(uint16_t major)
{
mEntry.setVerMajor(major);
mIsSet = true;
}
2018-08-07 07:17:51 +00:00
uint8_t nn::hac::KernelVersionHandler::getVerMinor() const
{
return mEntry.getVerMinor();
}
2018-08-07 07:17:51 +00:00
void nn::hac::KernelVersionHandler::setVerMinor(uint8_t minor)
{
mEntry.setVerMinor(minor);
mIsSet = true;
}