33 MapMode mapMode, std::error_code& ec);
40 : m_size(rhs.m_size), m_mapping(rhs.m_mapping) {
41 rhs.m_mapping =
nullptr;
43 m_fileHandle = rhs.m_fileHandle;
44 rhs.m_fileHandle =
nullptr;
53 m_mapping = rhs.m_mapping;
54 rhs.m_mapping =
nullptr;
56 m_fileHandle = rhs.m_fileHandle;
57 rhs.m_fileHandle =
nullptr;
62 explicit operator bool()
const {
return m_mapping !=
nullptr; }
67 uint64_t
size()
const {
return m_size; }
68 uint8_t*
data()
const {
return static_cast<uint8_t*
>(m_mapping); }
70 return static_cast<const uint8_t*
>(m_mapping);
80 void* m_mapping =
nullptr;
Definition: MappedFileRegion.h:23
MappedFileRegion(fs::file_t f, uint64_t length, uint64_t offset, MapMode mapMode, std::error_code &ec)
~MappedFileRegion()
Definition: MappedFileRegion.h:34
MappedFileRegion(MappedFileRegion &&rhs)
Definition: MappedFileRegion.h:39
MappedFileRegion & operator=(const MappedFileRegion &)=delete
MappedFileRegion & operator=(MappedFileRegion &&rhs)
Definition: MappedFileRegion.h:48
static size_t GetAlignment()
Returns required alignment.
uint8_t * data() const
Definition: MappedFileRegion.h:68
MappedFileRegion(const MappedFileRegion &)=delete
MapMode
Definition: MappedFileRegion.h:25
@ kPriv
May modify via data, but changes are lost on destruction.
Definition: MappedFileRegion.h:28
@ kReadOnly
May only access map via const_data as read only.
Definition: MappedFileRegion.h:26
@ kReadWrite
May access map via data and modify it. Written to path.
Definition: MappedFileRegion.h:27
const uint8_t * const_data() const
Definition: MappedFileRegion.h:69
MappedFileRegion()=default
uint64_t size() const
Definition: MappedFileRegion.h:67
int file_t
Definition: fs.h:32
Definition: ntcore_cpp.h:26