File indexing completed on 2026-08-17 08:39:20
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_COBALT_IO_STREAM_FILE_HPP
0009 #define BOOST_COBALT_IO_STREAM_FILE_HPP
0010
0011 #include <boost/asio/basic_stream_file.hpp>
0012
0013 #include <boost/cobalt/io/detail/config.hpp>
0014 #include <boost/cobalt/config.hpp>
0015 #include <boost/cobalt/io/buffer.hpp>
0016 #include <boost/cobalt/io/file.hpp>
0017 #include <boost/cobalt/io/ops.hpp>
0018 #include <boost/cobalt/io/stream.hpp>
0019 #include <boost/cobalt/op.hpp>
0020
0021 #include <boost/system/result.hpp>
0022
0023 namespace boost::cobalt::io
0024 {
0025
0026
0027 struct BOOST_SYMBOL_VISIBLE stream_file : file, stream
0028 {
0029 BOOST_COBALT_IO_DECL stream_file(const cobalt::executor & executor = this_thread::get_executor());
0030 BOOST_COBALT_IO_DECL stream_file(const char * path, file::flags open_flags,
0031 const cobalt::executor & executor = this_thread::get_executor());
0032 BOOST_COBALT_IO_DECL stream_file(const std::string & path, file::flags open_flags,
0033 const cobalt::executor & executor = this_thread::get_executor());
0034 BOOST_COBALT_IO_DECL stream_file(const native_handle_type & native_file,
0035 const cobalt::executor & executor = this_thread::get_executor());
0036 BOOST_COBALT_IO_DECL stream_file(stream_file && sf) noexcept;
0037
0038 [[nodiscard]] write_op write_some(const_buffer_sequence buffer)
0039 {
0040 return {buffer, this, initiate_write_some_};
0041 }
0042 [[nodiscard]] read_op read_some(mutable_buffer_sequence buffer)
0043 {
0044 return {buffer, this, initiate_read_some_};
0045 }
0046 BOOST_COBALT_IO_DECL system::result<std::uint64_t> seek(
0047 std::int64_t offset,
0048 seek_basis whence);
0049
0050 private:
0051 BOOST_COBALT_IO_DECL static void initiate_read_some_(void *, mutable_buffer_sequence, boost::cobalt::completion_handler<system::error_code, std::size_t>);
0052 BOOST_COBALT_IO_DECL static void initiate_write_some_(void *, const_buffer_sequence, boost::cobalt::completion_handler<system::error_code, std::size_t>);
0053
0054 #if defined(BOOST_ASIO_HAS_FILE)
0055 asio::basic_stream_file<executor> implementation_;
0056 #endif
0057 };
0058
0059
0060 }
0061 #endif