123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- #ifndef BOOST_BEAST_CORE_FILE_STDIO_HPP
- #define BOOST_BEAST_CORE_FILE_STDIO_HPP
- #include <boost/beast/core/detail/config.hpp>
- #include <boost/beast/core/error.hpp>
- #include <boost/beast/core/file_base.hpp>
- #include <cstdio>
- #include <cstdint>
- namespace boost {
- namespace beast {
- class file_stdio
- {
- std::FILE* f_ = nullptr;
- public:
-
- using native_handle_type = std::FILE*;
-
- BOOST_BEAST_DECL
- ~file_stdio();
-
- file_stdio() = default;
-
- BOOST_BEAST_DECL
- file_stdio(file_stdio&& other);
-
- BOOST_BEAST_DECL
- file_stdio& operator=(file_stdio&& other);
-
- std::FILE*
- native_handle() const
- {
- return f_;
- }
-
- BOOST_BEAST_DECL
- void
- native_handle(std::FILE* f);
-
- bool
- is_open() const
- {
- return f_ != nullptr;
- }
-
- 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) const;
-
- 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) const;
-
- 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_stdio.ipp>
- #endif
- #endif
|