nstool/lib/libhac/source/HandleTableSizeHandler.cpp

67 lines
1.5 KiB
C++
Raw Permalink Normal View History

2018-08-07 07:17:51 +00:00
#include <nn/hac/HandleTableSizeHandler.h>
2018-08-07 07:17:51 +00:00
nn::hac::HandleTableSizeHandler::HandleTableSizeHandler() :
mIsSet(false),
mEntry(0)
{}
2018-08-07 07:17:51 +00:00
void nn::hac::HandleTableSizeHandler::operator=(const HandleTableSizeHandler & other)
{
mIsSet = other.mIsSet;
mEntry.setKernelCapability(other.mEntry.getKernelCapability());
}
2018-08-07 07:17:51 +00:00
bool nn::hac::HandleTableSizeHandler::operator==(const HandleTableSizeHandler & other) const
{
return (mIsSet == other.mIsSet) \
&& (mEntry.getKernelCapability() == other.mEntry.getKernelCapability());
}
2018-08-07 07:17:51 +00:00
bool nn::hac::HandleTableSizeHandler::operator!=(const HandleTableSizeHandler & other) const
{
return !(*this == other);
}
2018-08-07 07:17:51 +00:00
void nn::hac::HandleTableSizeHandler::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::HandleTableSizeHandler::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::HandleTableSizeHandler::clear()
{
mIsSet = false;
mEntry.setHandleTableSize(0);
}
2018-08-07 07:17:51 +00:00
bool nn::hac::HandleTableSizeHandler::isSet() const
{
return mIsSet;
}
2018-08-07 07:17:51 +00:00
uint16_t nn::hac::HandleTableSizeHandler::getHandleTableSize() const
{
return mEntry.getHandleTableSize();
}
2018-08-07 07:17:51 +00:00
void nn::hac::HandleTableSizeHandler::setHandleTableSize(uint16_t size)
{
mEntry.setHandleTableSize(size);
mIsSet = true;
}