Back to home page

EIC code displayed by LXR

 
 

    


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

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