ゴミ箱
Public Types | Public Member Functions | List of all members
boost::beast::file_stdio Class Reference

#include <file_stdio.hpp>

Public Types

using native_handle_type = FILE *
 

Public Member Functions

 ~file_stdio ()
 
 file_stdio ()=default
 
 file_stdio (file_stdio &&other)
 
file_stdiooperator= (file_stdio &&other)
 
FILE * native_handle () const
 Returns the native handle associated with the file. More...
 
void native_handle (FILE *f)
 
bool is_open () const
 Returns true if the file is open. More...
 
void close (error_code &ec)
 
void open (char const *path, file_mode mode, error_code &ec)
 
std::uint64_t size (error_code &ec) const
 
std::uint64_t pos (error_code &ec) const
 
void seek (std::uint64_t offset, error_code &ec)
 
std::size_t read (void *buffer, std::size_t n, error_code &ec) const
 
std::size_t write (void const *buffer, std::size_t n, error_code &ec)
 

Detailed Description

An implementation of File which uses cstdio.

This class implements a file using the interfaces present in the C++ Standard Library, in <stdio>.

Member Typedef Documentation

The type of the underlying file handle.

This is platform-specific.

Constructor & Destructor Documentation

boost::beast::file_stdio::~file_stdio ( )
inline

Destructor

If the file is open it is first closed.

boost::beast::file_stdio::file_stdio ( )
default

Constructor

There is no open file initially.

boost::beast::file_stdio::file_stdio ( file_stdio &&  other)
inline

Constructor

The moved-from object behaves as if default constructed.

Member Function Documentation

void boost::beast::file_stdio::close ( error_code ec)
inline

Close the file if open

Parameters
ecSet to the error, if any occurred.
bool boost::beast::file_stdio::is_open ( ) const
inline

Returns true if the file is open.

FILE* boost::beast::file_stdio::native_handle ( ) const
inline

Returns the native handle associated with the file.

void boost::beast::file_stdio::native_handle ( FILE *  f)
inline

Set the native handle associated with the file.

If the file is open it is first closed.

Parameters
fThe native file handle to assign.
void boost::beast::file_stdio::open ( char const *  path,
file_mode  mode,
error_code ec 
)
inline

Open a file at the given path with the specified mode

Parameters
pathThe utf-8 encoded path to the file
modeThe file mode to use
ecSet to the error, if any occurred
file_stdio & boost::beast::file_stdio::operator= ( file_stdio &&  other)
inline

Assignment

The moved-from object behaves as if default constructed.

std::uint64_t boost::beast::file_stdio::pos ( error_code ec) const
inline

Return the current position in the open file

Parameters
ecSet to the error, if any occurred
Returns
The offset in bytes from the beginning of the file
std::size_t boost::beast::file_stdio::read ( void *  buffer,
std::size_t  n,
error_code ec 
) const
inline

Read from the open file

Parameters
bufferThe buffer for storing the result of the read
nThe number of bytes to read
ecSet to the error, if any occurred
void boost::beast::file_stdio::seek ( std::uint64_t  offset,
error_code ec 
)
inline

Adjust the current position in the open file

Parameters
offsetThe offset in bytes from the beginning of the file
ecSet to the error, if any occurred
std::uint64_t boost::beast::file_stdio::size ( error_code ec) const
inline

Return the size of the open file

Parameters
ecSet to the error, if any occurred
Returns
The size in bytes
std::size_t boost::beast::file_stdio::write ( void const *  buffer,
std::size_t  n,
error_code ec 
)
inline

Write to the open file

Parameters
bufferThe buffer holding the data to write
nThe number of bytes to write
ecSet to the error, if any occurred

The documentation for this class was generated from the following files: