aboutsummaryrefslogtreecommitdiff
path: root/include/mglpp/system/MemoryMappedFile.hpp
blob: 508518ad5a134c08848106906faa4f0248c5b425 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef MGLPP_MEMORY_MAPPED_FILE_HPP
#define MGLPP_MEMORY_MAPPED_FILE_HPP

extern "C" {
#include <mgl/system/fileutils.h>
}

namespace mgl {
    class MemoryMappedFile {
    public:
        struct LoadOptions {
            bool readable;
            bool writable;
        };

        MemoryMappedFile();
        ~MemoryMappedFile();
        
        bool load(const char *filepath, LoadOptions load_options = { true, true });

        void* data();
        size_t size();

        const mgl_memory_mapped_file* internal_mapped_file() const;
    private:
        mgl_memory_mapped_file memory_mapped_file;
    };
}

#endif /* MGLPP_MEMORY_MAPPED_FILE_HPP */