Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:35:03

0001 ///////////////////////////////////////////////////////////////////////////////
0002 // Copyright (c) Lewis Baker
0003 // Licenced under MIT license. See LICENSE.txt for details.
0004 ///////////////////////////////////////////////////////////////////////////////
0005 #ifndef CPPCORO_FILE_SHARE_MODE_HPP_INCLUDED
0006 #define CPPCORO_FILE_SHARE_MODE_HPP_INCLUDED
0007 
0008 namespace cppcoro
0009 {
0010     enum class file_share_mode
0011     {
0012         /// Don't allow any other processes to open the file concurrently.
0013         none = 0,
0014 
0015         /// Allow other processes to open the file in read-only mode
0016         /// concurrently with this process opening the file.
0017         read = 1,
0018 
0019         /// Allow other processes to open the file in write-only mode
0020         /// concurrently with this process opening the file.
0021         write = 2,
0022 
0023         /// Allow other processes to open the file in read and/or write mode
0024         /// concurrently with this process opening the file.
0025         read_write = read | write,
0026 
0027         /// Allow other processes to delete the file while this process
0028         /// has the file open.
0029         delete_ = 4
0030     };
0031 
0032     constexpr file_share_mode operator|(file_share_mode a, file_share_mode b)
0033     {
0034         return static_cast<file_share_mode>(
0035             static_cast<int>(a) | static_cast<int>(b));
0036     }
0037 
0038     constexpr file_share_mode operator&(file_share_mode a, file_share_mode b)
0039     {
0040         return static_cast<file_share_mode>(
0041             static_cast<int>(a) & static_cast<int>(b));
0042     }
0043 }
0044 
0045 #endif