|
libkeepass 0.2.0
KeePass key database importer/exporter library
|
Read-only memory mapping of a file. More...
#include <mapped_file.hh>
Public Member Functions | |
| MappedFile (const std::string &path) | |
Opens and maps the file at path. | |
| ~MappedFile () | |
| Unmaps the file and releases all handles. | |
| MappedFile (const MappedFile &)=delete | |
| MappedFile & | operator= (const MappedFile &)=delete |
| MappedFile (MappedFile &&)=delete | |
| MappedFile & | operator= (MappedFile &&)=delete |
| const char * | data () const noexcept |
| Returns a pointer to the first mapped byte (nullptr for an empty file). | |
| std::size_t | size () const noexcept |
| Returns the size of the mapping in bytes. | |
| bool | empty () const noexcept |
| Returns whether the file is empty. | |
Read-only memory mapping of a file.
On POSIX systems the file is mapped with mmap; on Windows a read-only file mapping is created with CreateFileMapping/ The mapping is released when the object is destroyed. The file must not be truncated while the mapping is alive (the operating system may deliver MapViewOfFile.SIGBUS/raise an exception on access to the missing pages).
|
explicit |
Opens and maps the file at path.
| FileNotFoundError | if the path does not exist. |
| IoError | if the file cannot be opened or mapped. |