forked from lewissbaker/cppcoro
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfile_share_mode.hpp
More file actions
45 lines (37 loc) · 1.32 KB
/
file_share_mode.hpp
File metadata and controls
45 lines (37 loc) · 1.32 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
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) Lewis Baker
// Licenced under MIT license. See LICENSE.txt for details.
///////////////////////////////////////////////////////////////////////////////
#ifndef CPPCORO_FILE_SHARE_MODE_HPP_INCLUDED
#define CPPCORO_FILE_SHARE_MODE_HPP_INCLUDED
namespace cppcoro
{
enum class file_share_mode
{
/// Don't allow any other processes to open the file concurrently.
none = 0,
/// Allow other processes to open the file in read-only mode
/// concurrently with this process opening the file.
read = 1,
/// Allow other processes to open the file in write-only mode
/// concurrently with this process opening the file.
write = 2,
/// Allow other processes to open the file in read and/or write mode
/// concurrently with this process opening the file.
read_write = read | write,
/// Allow other processes to delete the file while this process
/// has the file open.
delete_ = 4
};
constexpr file_share_mode operator|(file_share_mode a, file_share_mode b)
{
return static_cast<file_share_mode>(
static_cast<int>(a) | static_cast<int>(b));
}
constexpr file_share_mode operator&(file_share_mode a, file_share_mode b)
{
return static_cast<file_share_mode>(
static_cast<int>(a) & static_cast<int>(b));
}
}
#endif