nstool/lib/libhac/source/HandleTableSizeEntry.cpp

69 lines
1.6 KiB
C++
Raw Permalink Normal View History

2018-08-07 07:17:51 +00:00
#include <nn/hac/HandleTableSizeEntry.h>
2018-08-07 07:17:51 +00:00
nn::hac::HandleTableSizeEntry::HandleTableSizeEntry() :
mCap(kCapId),
mHandleTableSize(0)
{}
2018-08-07 07:17:51 +00:00
nn::hac::HandleTableSizeEntry::HandleTableSizeEntry(const KernelCapabilityEntry & kernel_cap) :
mCap(kCapId),
mHandleTableSize(0)
{
setKernelCapability(kernel_cap);
}
2018-08-07 07:17:51 +00:00
nn::hac::HandleTableSizeEntry::HandleTableSizeEntry(uint16_t size) :
mCap(kCapId),
mHandleTableSize(0)
{
setHandleTableSize(size);
}
2018-08-07 07:17:51 +00:00
void nn::hac::HandleTableSizeEntry::operator=(const HandleTableSizeEntry& other)
{
mHandleTableSize = other.mHandleTableSize;
updateCapField();
}
2018-08-07 07:17:51 +00:00
bool nn::hac::HandleTableSizeEntry::operator==(const HandleTableSizeEntry& other) const
{
return (mHandleTableSize == other.mHandleTableSize);
}
2018-08-07 07:17:51 +00:00
bool nn::hac::HandleTableSizeEntry::operator!=(const HandleTableSizeEntry& other) const
{
return !(*this == other);
}
2018-08-07 07:17:51 +00:00
const nn::hac::KernelCapabilityEntry & nn::hac::HandleTableSizeEntry::getKernelCapability() const
{
return mCap;
}
2018-08-07 07:17:51 +00:00
void nn::hac::HandleTableSizeEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap)
{
if (kernel_cap.getType() != kCapId)
{
throw fnd::Exception(kModuleName, "KernelCapabilityEntry is not type 'HandleTableSize'");
}
mCap = kernel_cap;
processCapField();
}
2018-08-07 07:17:51 +00:00
uint16_t nn::hac::HandleTableSizeEntry::getHandleTableSize() const
{
return mHandleTableSize;
}
2018-08-07 07:17:51 +00:00
void nn::hac::HandleTableSizeEntry::setHandleTableSize(uint16_t size)
{
if (size > kMaxHandleTableSize)
{
throw fnd::Exception(kModuleName, "Illegal HandleTableSize. (range: 0-1023 inclusive)");
}
mHandleTableSize = size;
updateCapField();
}