123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- #ifndef BOOST_BEAST_CORE_FILE_WIN32_HPP
- #define BOOST_BEAST_CORE_FILE_WIN32_HPP
- #include <boost/beast/core/detail/config.hpp>
- #if ! defined(BOOST_BEAST_USE_WIN32_FILE)
- # ifdef _WIN32
- # define BOOST_BEAST_USE_WIN32_FILE 1
- # else
- # define BOOST_BEAST_USE_WIN32_FILE 0
- # endif
- #endif
- #if BOOST_BEAST_USE_WIN32_FILE
- #include <boost/beast/core/error.hpp>
- #include <boost/beast/core/file_base.hpp>
- #include <boost/winapi/basic_types.hpp>
- #include <boost/winapi/handles.hpp>
- #include <cstdio>
- #include <cstdint>
- namespace boost {
- namespace beast {
- class file_win32
- {
- boost::winapi::HANDLE_ h_ =
- boost::winapi::INVALID_HANDLE_VALUE_;
- public:
-
- #if BOOST_BEAST_DOXYGEN
- using native_handle_type = HANDLE;
- #else
- using native_handle_type = boost::winapi::HANDLE_;
- #endif
-
- BOOST_BEAST_DECL
- ~file_win32();
-
- file_win32() = default;
-
- BOOST_BEAST_DECL
- file_win32(file_win32&& other);
-
- BOOST_BEAST_DECL
- file_win32& operator=(file_win32&& other);
-
- native_handle_type
- native_handle()
- {
- return h_;
- }
-
- BOOST_BEAST_DECL
- void
- native_handle(native_handle_type h);
-
- bool
- is_open() const
- {
- return h_ != boost::winapi::INVALID_HANDLE_VALUE_;
- }
-
- BOOST_BEAST_DECL
- void
- close(error_code& ec);
-
- BOOST_BEAST_DECL
- void
- open(char const* path, file_mode mode, error_code& ec);
-
- BOOST_BEAST_DECL
- std::uint64_t
- size(error_code& ec) const;
-
- BOOST_BEAST_DECL
- std::uint64_t
- pos(error_code& ec);
-
- BOOST_BEAST_DECL
- void
- seek(std::uint64_t offset, error_code& ec);
-
- BOOST_BEAST_DECL
- std::size_t
- read(void* buffer, std::size_t n, error_code& ec);
-
- BOOST_BEAST_DECL
- std::size_t
- write(void const* buffer, std::size_t n, error_code& ec);
- };
- }
- }
- #ifdef BOOST_BEAST_HEADER_ONLY
- #include <boost/beast/core/impl/file_win32.ipp>
- #endif
- #endif
- #endif
|