-
Notifications
You must be signed in to change notification settings - Fork 505
Expand file tree
/
Copy pathread_only_file.cpp
More file actions
36 lines (31 loc) · 895 Bytes
/
read_only_file.cpp
File metadata and controls
36 lines (31 loc) · 895 Bytes
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
31
32
33
34
35
36
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) Lewis Baker
// Licenced under MIT license. See LICENSE.txt for details.
///////////////////////////////////////////////////////////////////////////////
#include <cppcoro\read_only_file.hpp>
#if CPPCORO_OS_WINNT
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# include <Windows.h>
cppcoro::read_only_file cppcoro::read_only_file::open(
io_service& ioService,
const cppcoro::path& path,
file_share_mode shareMode,
file_buffering_mode bufferingMode)
{
return read_only_file(file::open(
GENERIC_READ,
ioService,
path,
file_open_mode::open_existing,
shareMode,
bufferingMode));
}
cppcoro::read_only_file::read_only_file(
detail::win32::safe_handle&& fileHandle) noexcept
: file(std::move(fileHandle))
, readable_file(detail::win32::safe_handle{})
{
}
#endif