Added an MmapFile helper and changed iffexplore and treexplore to use it. WIP: MveDecoder Misc. changes/fixes
33 lines
556 B
C++
33 lines
556 B
C++
#ifndef WC3RE_UTIL_HH__
|
|
#define WC3RE_UTIL_HH__
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
#include "common.hh"
|
|
|
|
class MmapFile {
|
|
public:
|
|
MmapFile(std::string fileName);
|
|
MmapFile(MmapFile const& copy) = delete;
|
|
MmapFile(MmapFile && move);
|
|
|
|
~MmapFile();
|
|
|
|
MmapFile& operator=(MmapFile const& copy) = delete;
|
|
MmapFile& operator=(MmapFile && move);
|
|
|
|
std::string const& name() const;
|
|
size_t size() const;
|
|
char const* data() const;
|
|
|
|
operator bool() const;
|
|
private:
|
|
std::string name_;
|
|
FILEUPtr fd_;
|
|
size_t size_;
|
|
void *base_;
|
|
};
|
|
|
|
#endif
|