9#include "access_mode.hpp"
10#include "seek_whence.hpp"
11#include "../utility/utility.hpp"
12#include "../macros.hpp"
15hi_export_module(hikogui.file.file : impl);
17namespace hi {
inline namespace v1 {
namespace detail {
41 throw io_error(std::format(
"{}: Invalid AccessMode; expecting Readable and/or Writeable.", path.string()));
73 throw io_error(std::format(
"{}: Invalid AccessMode; expecting CreateFile and/or OpenFile.", path.string()));
105 std::filesystem::create_directories(
directory);
118 return _file_handle ==
nullptr;
133 hi_assert_not_null(_file_handle);
163 hi_assert_not_null(_file_handle);
225 throw io_error(
"Could not write to file. Reached end-of-file.");
260 HANDLE _file_handle =
nullptr;
Rules for working with win32 headers.
seek_whence
The position in the file to seek from.
Definition seek_whence.hpp:14
access_mode
The mode in which way to open a file.
Definition access_mode.hpp:17
@ current
Continue from the current position.
@ end
Start from the end of the file.
@ begin
Start from the beginning of the file.
@ truncate
After the file has been opened, truncate it.
@ read_lock
Lock the file for reading, i.e. shared-lock.
@ sequential
Hint that the data should be prefetched.
@ create
Create file if it does not exist, or fail.
@ open
Open file if it exist, or fail.
@ random
Hint the data should not be prefetched.
@ write_through
Hint that writes should be send directly to disk.
@ write_lock
Lock the file for writing, i.e. exclusive-lock.
@ rename
Allow renaming an open file.
@ read
Allow read access to a file.
@ write
Allow write access to a file.
@ create_directories
Create directory hierarchy, if the file could not be created.
DOXYGEN BUG.
Definition algorithm.hpp:16
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
std::string get_last_error_message()
Get the OS error message from the last error received on this thread.
Definition exception_win32_impl.hpp:31
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
Definition file_file_win32_impl.hpp:19
Exception thrown during I/O on an error.
Definition exception_intf.hpp:172