aboutsummaryrefslogtreecommitdiff
path: root/include/mglpp/system
diff options
context:
space:
mode:
Diffstat (limited to 'include/mglpp/system')
-rw-r--r--include/mglpp/system/MemoryMappedFile.hpp30
-rw-r--r--include/mglpp/system/Utf8.hpp11
2 files changed, 41 insertions, 0 deletions
diff --git a/include/mglpp/system/MemoryMappedFile.hpp b/include/mglpp/system/MemoryMappedFile.hpp
new file mode 100644
index 0000000..508518a
--- /dev/null
+++ b/include/mglpp/system/MemoryMappedFile.hpp
@@ -0,0 +1,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 */
diff --git a/include/mglpp/system/Utf8.hpp b/include/mglpp/system/Utf8.hpp
new file mode 100644
index 0000000..4f6a39a
--- /dev/null
+++ b/include/mglpp/system/Utf8.hpp
@@ -0,0 +1,11 @@
+#ifndef MGLPP_UTF8_HPP
+#define MGLPP_UTF8_HPP
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace mgl {
+ bool utf8_decode(const unsigned char *str, size_t size, uint32_t *decoded_codepoint, size_t *codepoint_length);
+}
+
+#endif /* MGLPP_UTF8_HPP */