|
||||
File indexing completed on 2025-01-18 09:54:52
0001 /////////////////////////////////////////////////////////////////////////////// 0002 // Copyright (c) Lewis Baker 0003 // Licenced under MIT license. See LICENSE.txt for details. 0004 /////////////////////////////////////////////////////////////////////////////// 0005 #ifndef CPPCORO_READ_WRITE_FILE_HPP_INCLUDED 0006 #define CPPCORO_READ_WRITE_FILE_HPP_INCLUDED 0007 0008 #include <cppcoro/readable_file.hpp> 0009 #include <cppcoro/writable_file.hpp> 0010 #include <cppcoro/file_share_mode.hpp> 0011 #include <cppcoro/file_buffering_mode.hpp> 0012 #include <cppcoro/file_open_mode.hpp> 0013 0014 #include <cppcoro/filesystem.hpp> 0015 0016 namespace cppcoro 0017 { 0018 class read_write_file : public readable_file, public writable_file 0019 { 0020 public: 0021 0022 /// Open a file for read-write access. 0023 /// 0024 /// \param ioContext 0025 /// The I/O context to use when dispatching I/O completion events. 0026 /// When asynchronous write operations on this file complete the 0027 /// completion events will be dispatched to an I/O thread associated 0028 /// with the I/O context. 0029 /// 0030 /// \param pathMode 0031 /// Path of the file to open. 0032 /// 0033 /// \param openMode 0034 /// Specifies how the file should be opened and how to handle cases 0035 /// when the file exists or doesn't exist. 0036 /// 0037 /// \param shareMode 0038 /// Specifies the access to be allowed on the file concurrently with this file access. 0039 /// 0040 /// \param bufferingMode 0041 /// Specifies the modes/hints to provide to the OS that affects the behaviour 0042 /// of its file buffering. 0043 /// 0044 /// \return 0045 /// An object that can be used to write to the file. 0046 /// 0047 /// \throw std::system_error 0048 /// If the file could not be opened for write. 0049 [[nodiscard]] 0050 static read_write_file open( 0051 io_service& ioService, 0052 const cppcoro::filesystem::path& path, 0053 file_open_mode openMode = file_open_mode::create_or_open, 0054 file_share_mode shareMode = file_share_mode::none, 0055 file_buffering_mode bufferingMode = file_buffering_mode::default_); 0056 0057 protected: 0058 0059 #if CPPCORO_OS_WINNT 0060 read_write_file(detail::win32::safe_handle&& fileHandle) noexcept; 0061 #endif 0062 0063 }; 0064 } 0065 0066 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |