forked from andreasbuhr/cppcoro
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreadable_file.cpp
More file actions
63 lines (58 loc) · 1.38 KB
/
Copy pathreadable_file.cpp
File metadata and controls
63 lines (58 loc) · 1.38 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) Lewis Baker
// Licenced under MIT license. See LICENSE.txt for details.
///////////////////////////////////////////////////////////////////////////////
#include <cppcoro/readable_file.hpp>
#if CPPCORO_OS_WINNT
cppcoro::file_read_operation cppcoro::readable_file::read(
std::uint64_t offset,
void* buffer,
std::size_t byteCount) const noexcept
{
return file_read_operation(
m_fileHandle.handle(),
offset,
buffer,
byteCount);
}
cppcoro::file_read_operation_cancellable cppcoro::readable_file::read(
std::uint64_t offset,
void* buffer,
std::size_t byteCount,
cancellation_token ct) const noexcept
{
return file_read_operation_cancellable(
m_fileHandle.handle(),
offset,
buffer,
byteCount,
std::move(ct));
}
#elif CPPCORO_OS_LINUX
cppcoro::file_read_operation cppcoro::readable_file::read(
std::uint64_t offset,
void* buffer,
std::size_t byteCount) const noexcept
{
return file_read_operation(
m_fileData.fd.fd(),
m_fileData.mq,
offset,
buffer,
byteCount);
}
cppcoro::file_read_operation_cancellable cppcoro::readable_file::read(
std::uint64_t offset,
void* buffer,
std::size_t byteCount,
cancellation_token ct) const noexcept
{
return file_read_operation_cancellable(
m_fileData.fd.fd(),
m_fileData.mq,
offset,
buffer,
byteCount,
std::move(ct));
}
#endif