HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
file_mapping.hpp
1// Copyright Take Vos 2019, 2021.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "file.hpp"
8#include <memory>
9#include <unordered_map>
10
11namespace hi::inline v1 {
12
20public:
24
28
31 file_handle mapHandle;
32
39
49 file_mapping(std::filesystem::path const &path, access_mode accessMode, std::size_t size);
51
52 file_mapping(file_mapping const &other) = delete;
53 file_mapping(file_mapping &&other) = delete;
54 file_mapping &operator=(file_mapping const &other) = delete;
55 file_mapping &operator=(file_mapping &&other) = delete;
56
59 [[nodiscard]] access_mode accessMode() const noexcept
60 {
61 return file->_access_mode;
62 }
63
66 [[nodiscard]] std::filesystem::path const &path() const noexcept
67 {
68 return file->_path;
69 }
70
71private:
79 [[nodiscard]] static std::shared_ptr<hi::file> findOrOpenFile(std::filesystem::path const &path, access_mode accessMode);
80};
81
82} // namespace hi::inline v1
DOXYGEN BUG.
Definition algorithm.hpp:15
access_mode
Definition file.hpp:20
A File object.
Definition file.hpp:66
Definition file_mapping.hpp:19
file_mapping(std::shared_ptr< hi::file > const &file, std::size_t size)
file_handle mapHandle
Definition file_mapping.hpp:31
std::shared_ptr< file > file
Definition file_mapping.hpp:23
access_mode accessMode() const noexcept
Definition file_mapping.hpp:59
std::size_t size
Definition file_mapping.hpp:27
std::filesystem::path const & path() const noexcept
Definition file_mapping.hpp:66
file_mapping(std::filesystem::path const &path, access_mode accessMode, std::size_t size)