//
-// Copyright (c) 2015-2016 Vinnie Falco (vinnie dot falco at gmail dot com)
+// Copyright (c) 2015-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_BEAST_CORE_FILE_POSIX_HPP
#define BOOST_BEAST_CORE_FILE_POSIX_HPP
-#include <boost/config.hpp>
+#include <boost/beast/core/detail/config.hpp>
#if ! defined(BOOST_BEAST_NO_POSIX_FILE)
# if ! defined(__APPLE__) && ! defined(__linux__)
/** An implementation of File for POSIX systems.
- This class implements a @b File using POSIX interfaces.
+ This class implements a <em>File</em> using POSIX interfaces.
*/
class file_posix
{
int fd_ = -1;
+ BOOST_BEAST_DECL
+ static
+ int
+ native_close(int& fd);
+
public:
/** The type of the underlying file handle.
If the file is open it is first closed.
*/
+ BOOST_BEAST_DECL
~file_posix();
/** Constructor
The moved-from object behaves as if default constructed.
*/
+ BOOST_BEAST_DECL
file_posix(file_posix&& other);
/** Assignment
The moved-from object behaves as if default constructed.
*/
+ BOOST_BEAST_DECL
file_posix& operator=(file_posix&& other);
/// Returns the native handle associated with the file.
@param fd The native file handle to assign.
*/
+ BOOST_BEAST_DECL
void
native_handle(native_handle_type fd);
@param ec Set to the error, if any occurred.
*/
+ BOOST_BEAST_DECL
void
close(error_code& ec);
@param ec Set to the error, if any occurred
*/
+ BOOST_BEAST_DECL
void
open(char const* path, file_mode mode, error_code& ec);
@return The size in bytes
*/
+ BOOST_BEAST_DECL
std::uint64_t
size(error_code& ec) const;
@return The offset in bytes from the beginning of the file
*/
+ BOOST_BEAST_DECL
std::uint64_t
pos(error_code& ec) const;
@param ec Set to the error, if any occurred
*/
+ BOOST_BEAST_DECL
void
seek(std::uint64_t offset, error_code& ec);
@param ec Set to the error, if any occurred
*/
+ BOOST_BEAST_DECL
std::size_t
read(void* buffer, std::size_t n, error_code& ec) const;
@param ec Set to the error, if any occurred
*/
+ BOOST_BEAST_DECL
std::size_t
write(void const* buffer, std::size_t n, error_code& ec);
};
} // beast
} // boost
+#ifdef BOOST_BEAST_HEADER_ONLY
#include <boost/beast/core/impl/file_posix.ipp>
+#endif
#endif