boost::process::detail::systembuf Class Reference

#include <systembuf.hpp>

List of all members.

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


Detailed Description

std::streambuf implementation for system file handles.

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.


Constructor & Destructor Documentation

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.

See also:
pistream and postream


Member Function Documentation

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.

Precondition:
All input positions are exhausted (gptr() >= egptr()).
Postcondition:
The input buffer has new data, if available.
Returns:
traits_type::eof() if a read error occurrs or there are no more data to be read. Otherwise returns traits_type::to_int_type(*gptr()).

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.

Precondition:
All output positions are exhausted (pptr() >= epptr()).
Postcondition:
The output buffer has more space if no errors occurred during the write to disk.

*(pptr() - 1) is c.

Returns:
traits_type::eof() if a write error occurrs. Otherwise returns traits_type::not_eof(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.

Returns:
0 on success, -1 if an error occurred.


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

Generated on Mon Sep 22 01:00:43 2008 by  doxygen 1.5.5