|
Bond 0.9
C++ Bond Runtime Library API Documentation
|
A concrete implementation of OutputStream that performs output operations to a stdio FILE*. More...
#include <bond/io/stdiooutputstream.h>
Public Member Functions | |
| StdioOutputStream (FILE *file) | |
| Constructs a StdioOutputStream object. | |
| StdioOutputStream (const char *fileName) | |
| Constructs a StdioOutputStream object that opens and owns the given file. | |
| StdioOutputStream (StdioFileHandle &&handle) | |
| Constructs a StdioOutputStream object. | |
| StdioOutputStream (StdioOutputStream &&other) | |
| Move-constructs a StdioOutputStream object. | |
| virtual | ~StdioOutputStream () |
| Destroys a StdioOutputStream object, closing the file if it is owned. | |
| StdioOutputStream (const StdioOutputStream &other)=delete | |
| StdioOutputStream & | operator= (const StdioOutputStream &other)=delete |
| StdioOutputStream & | operator= (StdioOutputStream &&other) |
| Closes the file if it is owned and takes over the file of another StdioOutputStream. | |
| bool | IsBound () const |
| Tests whether this stream is currently bound to a FILE object. | |
| virtual void | Close () override |
| Closes the FILE object, whether or not it is owned, and unbinds the stream. | |
| virtual void | Flush () override |
| Flushes any buffered output. | |
| virtual void | VPrint (const char *format, va_list argList) override |
| Writes formatted output to the stream using a variable argument list. | |
| virtual void | Write (uint8_t c) override |
| Writes a single byte to the stream. | |
| virtual void | Write (const uint8_t *bytes, size_t numBytes) override |
| Writes a sequence of bytes to the stream. | |
| virtual pos_t | GetPosition () const override |
| Returns the current position within the stream. | |
| virtual pos_t | GetEndPosition () const override |
| Returns the end position of the stream. | |
| virtual void | SetPosition (off_t offset) override |
| Sets the current position within the stream. | |
| virtual void | SetPositionFromEnd (off_t offset) override |
| Sets the current position relative to the end of the stream. | |
| virtual void | AddOffset (off_t offset) override |
| Advances the current position by the given offset. | |
| virtual bool | IsEof () const override |
| Tests whether the current position is at or beyond the end of the stream. | |
| virtual bool | HasError () const override |
| Tests whether the stream is currently in an error state. | |
| virtual void | ClearError () override |
| Clears the current error state of the stream. | |
| Public Member Functions inherited from Bond::OutputStream | |
| virtual | ~OutputStream () |
| Destroys an OutputStream object. | |
| virtual void | Print (const char *format,...) |
| Writes formatted output to the stream. | |
| Public Member Functions inherited from Bond::Stream | |
| virtual | ~Stream () |
| Destroys a Stream object. | |
Additional Inherited Members | |
| Public Types inherited from Bond::Stream | |
| typedef long | pos_t |
| A type used to represent absolute positions within a stream. | |
| typedef long | off_t |
| A type used to represent relative offsets within a stream. | |
| Static Public Attributes inherited from Bond::Stream | |
| static const int | Eof = -1 |
| A special value returned by single-byte input functions to indicate end of stream. | |
A concrete implementation of OutputStream that performs output operations to a stdio FILE*.
StdioOutputStream adapts a C stdio FILE object to the OutputStream interface. The stream may be bound either to an existing FILE pointer or to a file opened and owned through a StdioFileHandle.
|
inlineexplicit |
Constructs a StdioOutputStream object.
| file | The stdio FILE object to which output will be written. The file is not owned by the StdioOutputStream, so it is not closed when the StdioOutputStream is destroyed, but it is closed by Close(). |
|
explicit |
Constructs a StdioOutputStream object that opens and owns the given file.
An existing file is truncated. Throws a Bond::Exception if the file fails to open.
| fileName | The name of the file to open for writing in binary mode, encoded in UTF-8. |
|
inlineexplicit |
Constructs a StdioOutputStream object.
| handle | An owning file handle whose FILE object will be used for output operations. |
|
inline |
Move-constructs a StdioOutputStream object.
| other | The StdioOutputStream object from which resources will be moved. |
|
inlinevirtual |
Destroys a StdioOutputStream object, closing the file if it is owned.
|
delete |
|
inlineoverridevirtual |
Advances the current position by the given offset.
| offset | The signed amount by which the current position should be adjusted. |
Implements Bond::Stream.
|
inlineoverridevirtual |
Clears the current error state of the stream.
Implements Bond::Stream.
|
overridevirtual |
Closes the FILE object, whether or not it is owned, and unbinds the stream.
Reimplemented from Bond::Stream.
|
inlineoverridevirtual |
Flushes any buffered output.
The default implementation does nothing. Concrete stream implementations may override this function when they buffer output internally or depend on an underlying buffered API.
Reimplemented from Bond::OutputStream.
|
overridevirtual |
Returns the end position of the stream.
Implements Bond::Stream.
|
inlineoverridevirtual |
Returns the current position within the stream.
Implements Bond::Stream.
|
inlineoverridevirtual |
Tests whether the stream is currently in an error state.
Implements Bond::Stream.
|
inline |
Tests whether this stream is currently bound to a FILE object.
|
inlineoverridevirtual |
Tests whether the current position is at or beyond the end of the stream.
Implements Bond::Stream.
|
delete |
| StdioOutputStream & Bond::StdioOutputStream::operator= | ( | StdioOutputStream && | other | ) |
Closes the file if it is owned and takes over the file of another StdioOutputStream.
| other | The StdioOutputStream object from which resources will be moved. |
|
inlineoverridevirtual |
Sets the current position within the stream.
| offset | The absolute position to which the stream should be moved. |
Implements Bond::Stream.
|
inlineoverridevirtual |
Sets the current position relative to the end of the stream.
| offset | The offset from the end position to which the stream should be moved, i.e. the new position is GetEndPosition() + offset, so offset is normally zero or negative. |
Implements Bond::Stream.
|
inlineoverridevirtual |
Writes formatted output to the stream using a variable argument list.
| format | A printf-style format string describing the text to be written. |
| argList | A variable argument list containing the values to be formatted. |
Implements Bond::OutputStream.
|
inlineoverridevirtual |
Writes a sequence of bytes to the stream.
| bytes | The buffer containing the bytes to be written. |
| numBytes | The number of bytes to write. |
Reimplemented from Bond::OutputStream.
|
inlineoverridevirtual |
Writes a single byte to the stream.
| byte | The byte to write. |
Implements Bond::OutputStream.