11#include "file_file.hpp"
12#include "file_view_win32_impl.hpp"
13#include "../container/module.hpp"
14#include "../macros.hpp"
19hi_export_module(hikogui.file.file_view : intf);
24hi_warning_ignore_msvc(26490);
26namespace hi {
inline namespace v1 {
54 _pimpl(
std::make_shared<detail::file_view_impl>(
file.pimpl(), offset, size))
59 std::filesystem::path
const& path,
69 hi_assert_not_null(_pimpl);
70 return _pimpl->offset();
75 hi_assert_not_null(_pimpl);
76 return _pimpl->size();
87 if (_pimpl->unmapped()) {
110 if (
auto pimpl = std::exchange(_pimpl,
nullptr)) {
119 hi_assert_not_null(_pimpl);
120 return _pimpl->void_span();
127 hi_assert_not_null(_pimpl);
128 return _pimpl->const_void_span();
135 void flush(hi::void_span span)
const noexcept
137 hi_assert_not_null(_pimpl);
138 return _pimpl->flush(span);
144 if constexpr (std::is_const_v<T>) {
151 [[
nodiscard]]
friend std::string_view as_string_view(file_view
const& view)
noexcept
153 hi_assert(view.offset() == 0);
154 return as_string_view(view.const_void_span());
157 [[
nodiscard]]
friend bstring_view as_bstring_view(file_view
const& view)
noexcept
159 hi_assert(view.offset() == 0);
160 return as_bstring_view(view.const_void_span());
access_mode
The mode in which way to open a file.
Definition access_mode.hpp:17
@ open_for_read
Default open a file for reading.
@ other
The gui_event does not have associated data.
DOXYGEN BUG.
Definition algorithm.hpp:16
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
A File object.
Definition file_file_intf.hpp:30
Map a file into virtual memory.
Definition file_view_intf.hpp:36
void_span void_span() const noexcept
Span to the mapping into memory.
Definition file_view_intf.hpp:117
const_void_span const_void_span() const noexcept
Definition file_view_intf.hpp:125
void flush(hi::void_span span) const noexcept
Flush changes in memory to the open file view.
Definition file_view_intf.hpp:135
file_view(file const &file, std::size_t offset=0, std::size_t size=0)
Create a file-view from a file-mapping.
Definition file_view_intf.hpp:53
bool unmapped() const noexcept
Check if this file view is closed.
Definition file_view_intf.hpp:84