File indexing completed on 2025-01-30 09:34:04
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_BEAST_CORE_FILE_WIN32_HPP
0011 #define BOOST_BEAST_CORE_FILE_WIN32_HPP
0012
0013 #include <boost/beast/core/detail/config.hpp>
0014
0015 #if ! defined(BOOST_BEAST_USE_WIN32_FILE)
0016 # ifdef _WIN32
0017 # define BOOST_BEAST_USE_WIN32_FILE 1
0018 # else
0019 # define BOOST_BEAST_USE_WIN32_FILE 0
0020 # endif
0021 #endif
0022
0023 #if BOOST_BEAST_USE_WIN32_FILE
0024
0025 #include <boost/beast/core/error.hpp>
0026 #include <boost/beast/core/file_base.hpp>
0027 #include <boost/winapi/basic_types.hpp>
0028 #include <boost/winapi/handles.hpp>
0029 #include <cstdio>
0030 #include <cstdint>
0031
0032 namespace boost {
0033 namespace beast {
0034
0035
0036
0037
0038
0039 class file_win32
0040 {
0041 boost::winapi::HANDLE_ h_ =
0042 boost::winapi::INVALID_HANDLE_VALUE_;
0043
0044 public:
0045
0046
0047
0048
0049 #if BOOST_BEAST_DOXYGEN
0050 using native_handle_type = HANDLE;
0051 #else
0052 using native_handle_type = boost::winapi::HANDLE_;
0053 #endif
0054
0055
0056
0057
0058
0059 BOOST_BEAST_DECL
0060 ~file_win32();
0061
0062
0063
0064
0065
0066 file_win32() = default;
0067
0068
0069
0070
0071
0072 BOOST_BEAST_DECL
0073 file_win32(file_win32&& other);
0074
0075
0076
0077
0078
0079 BOOST_BEAST_DECL
0080 file_win32& operator=(file_win32&& other);
0081
0082
0083 native_handle_type
0084 native_handle()
0085 {
0086 return h_;
0087 }
0088
0089
0090
0091
0092
0093
0094
0095 BOOST_BEAST_DECL
0096 void
0097 native_handle(native_handle_type h);
0098
0099
0100 bool
0101 is_open() const
0102 {
0103 return h_ != boost::winapi::INVALID_HANDLE_VALUE_;
0104 }
0105
0106
0107
0108
0109
0110 BOOST_BEAST_DECL
0111 void
0112 close(error_code& ec);
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122 BOOST_BEAST_DECL
0123 void
0124 open(char const* path, file_mode mode, error_code& ec);
0125
0126
0127
0128
0129
0130
0131
0132 BOOST_BEAST_DECL
0133 std::uint64_t
0134 size(error_code& ec) const;
0135
0136
0137
0138
0139
0140
0141
0142 BOOST_BEAST_DECL
0143 std::uint64_t
0144 pos(error_code& ec);
0145
0146
0147
0148
0149
0150
0151
0152 BOOST_BEAST_DECL
0153 void
0154 seek(std::uint64_t offset, error_code& ec);
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164 BOOST_BEAST_DECL
0165 std::size_t
0166 read(void* buffer, std::size_t n, error_code& ec);
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176 BOOST_BEAST_DECL
0177 std::size_t
0178 write(void const* buffer, std::size_t n, error_code& ec);
0179 };
0180
0181 }
0182 }
0183
0184 #ifdef BOOST_BEAST_HEADER_ONLY
0185 #include <boost/beast/core/impl/file_win32.ipp>
0186 #endif
0187
0188 #endif
0189
0190 #endif