|
||||
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_ONLY_FILE_HPP_INCLUDED 0006 #define CPPCORO_READ_ONLY_FILE_HPP_INCLUDED 0007 0008 #include <cppcoro/readable_file.hpp> 0009 #include <cppcoro/file_share_mode.hpp> 0010 #include <cppcoro/file_buffering_mode.hpp> 0011 0012 #include <cppcoro/filesystem.hpp> 0013 0014 namespace cppcoro 0015 { 0016 class read_only_file : public readable_file 0017 { 0018 public: 0019 0020 /// Open a file for read-only access. 0021 /// 0022 /// \param ioContext 0023 /// The I/O context to use when dispatching I/O completion events. 0024 /// When asynchronous read operations on this file complete the 0025 /// completion events will be dispatched to an I/O thread associated 0026 /// with the I/O context. 0027 /// 0028 /// \param path 0029 /// Path of the file to open. 0030 /// 0031 /// \param shareMode 0032 /// Specifies the access to be allowed on the file concurrently with this file access. 0033 /// 0034 /// \param bufferingMode 0035 /// Specifies the modes/hints to provide to the OS that affects the behaviour 0036 /// of its file buffering. 0037 /// 0038 /// \return 0039 /// An object that can be used to read from the file. 0040 /// 0041 /// \throw std::system_error 0042 /// If the file could not be opened for read. 0043 [[nodiscard]] 0044 static read_only_file open( 0045 io_service& ioService, 0046 const cppcoro::filesystem::path& path, 0047 file_share_mode shareMode = file_share_mode::read, 0048 file_buffering_mode bufferingMode = file_buffering_mode::default_); 0049 0050 protected: 0051 0052 #if CPPCORO_OS_WINNT 0053 read_only_file(detail::win32::safe_handle&& fileHandle) noexcept; 0054 #endif 0055 0056 }; 0057 } 0058 0059 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |