#include <systembuf.hpp>
Public Member Functions | |
systembuf (handle_type h, std::size_t bufsize=8192) | |
Protected Member Functions | |
virtual int_type | underflow () |
virtual int_type | overflow (int c) |
virtual int | sync () |
Friends | |
class | ::boost::process::postream |
systembuf provides a std::streambuf implementation for system file handles. Contrarywise to file_handle, this class does not take ownership of the native file handle; this should be taken care of somewhere else.
This class follows the expected semantics of a std::streambuf object. However, it is not copyable to avoid introducing inconsistences with the on-disk file and the in-memory buffers.
boost::process::detail::systembuf::systembuf | ( | handle_type | h, | |
std::size_t | bufsize = 8192 | |||
) | [inline, explicit] |
Constructs a new systembuf for the given file handle.
This constructor creates a new systembuf object that reads or writes data from/to the h native file handle. This handle is not owned by the created systembuf object; the code should take care of it externally.
This class buffers input and output; the buffer size may be tuned through the bufsize parameter, which defaults to 8192 bytes.
virtual int_type boost::process::detail::systembuf::underflow | ( | ) | [inline, protected, virtual] |
Reads new data from the native file handle.
This operation is called by input methods when there is no more data in the input buffer. The function fills the buffer with new data, if available.
virtual int_type boost::process::detail::systembuf::overflow | ( | int | c | ) | [inline, protected, virtual] |
Makes room in the write buffer for additional data.
This operation is called by output methods when there is no more space in the output buffer to hold a new element. The function first flushes the buffer's contents to disk and then clears it to leave room for more characters. The given c character is stored at the beginning of the new space.
*(pptr() - 1) is c.
virtual int boost::process::detail::systembuf::sync | ( | ) | [inline, protected, virtual] |
Flushes the output buffer to disk.
Synchronizes the systembuf buffers with the contents of the file associated to this object through the native file handle. The output buffer is flushed to disk and cleared to leave new room for more data.