Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:51

0001 ///////////////////////////////////////////////////////////////////////////////
0002 // Copyright (c) Lewis Baker
0003 // Licenced under MIT license. See LICENSE.txt for details.
0004 ///////////////////////////////////////////////////////////////////////////////
0005 #ifndef CPPCORO_FILE_HPP_INCLUDED
0006 #define CPPCORO_FILE_HPP_INCLUDED
0007 
0008 #include <cppcoro/config.hpp>
0009 
0010 #include <cppcoro/file_open_mode.hpp>
0011 #include <cppcoro/file_share_mode.hpp>
0012 #include <cppcoro/file_buffering_mode.hpp>
0013 
0014 #if CPPCORO_OS_WINNT
0015 # include <cppcoro/detail/win32.hpp>
0016 #endif
0017 
0018 #include <cppcoro/filesystem.hpp>
0019 
0020 namespace cppcoro
0021 {
0022     class io_service;
0023 
0024     class file
0025     {
0026     public:
0027 
0028         file(file&& other) noexcept = default;
0029 
0030         virtual ~file();
0031 
0032         /// Get the size of the file in bytes.
0033         std::uint64_t size() const;
0034 
0035     protected:
0036 
0037 #if CPPCORO_OS_WINNT
0038         file(detail::win32::safe_handle&& fileHandle) noexcept;
0039 
0040         static detail::win32::safe_handle open(
0041             detail::win32::dword_t fileAccess,
0042             io_service& ioService,
0043             const cppcoro::filesystem::path& path,
0044             file_open_mode openMode,
0045             file_share_mode shareMode,
0046             file_buffering_mode bufferingMode);
0047 
0048         detail::win32::safe_handle m_fileHandle;
0049 #endif
0050 
0051     };
0052 }
0053 
0054 #endif