|
Bond 0.9
Bond Standard Library API Documentation
|
An abstract interface for performing both unformatted and formatted output operations. More...
Public Member Functions | |
| void | Close () |
| Flushes any unwritten output and closes the stream. | |
| void | Flush () |
| Flushes any unwritten output. | |
| OutputStream * | PrintStr (const char *str) |
| Writes a string of characters to the output stream. Writing stops at the first null character. | |
| OutputStream * | PrintB (bool value) |
| Writes a formatted Boolean value to the output stream. | |
| OutputStream * | PrintC (char value) |
| Writes a single character to the output stream. | |
| OutputStream * | PrintI (int value) |
| Writes a formatted int to the output stream. | |
| OutputStream * | PrintUI (uint value) |
| Writes a formatted uint to the output stream. | |
| OutputStream * | PrintL (long value) |
| Writes a formatted long to the output stream. | |
| OutputStream * | PrintUL (ulong value) |
| Writes a formatted ulong to the output stream. | |
| OutputStream * | PrintF (float value) |
| Writes a formatted float to the output stream. | |
| OutputStream * | PrintD (double value) |
| Writes a formatted double to the output stream. | |
| OutputStream * | Put (uchar byte) |
| Writes a single unformatted byte to the output stream. | |
| OutputStream * | Write (void *bytes, uint numBytes) |
| Writes an array of unformatted bytes to the output stream. | |
| int | GetFlags () const |
| Returns the stream's current format flags as a bitmask of values from the IO::Flags enum. | |
| OutputStream * | SetFlags (int flags) |
| Enables the format flags in the given bitmask of values from the IO::Flags enum. | |
| OutputStream * | UnsetFlags (int flags) |
| Disables the format flags in the given bitmask of values from the IO::Flags enum. | |
| OutputStream * | ClearFlags () |
| Disables all of the format flags. | |
| int | GetPrecision () const |
| Returns the precision used when writing floating-point values. The default is 6. | |
| OutputStream * | SetPrecision (int precision) |
| Assigns the precision used when writing floating-point values. | |
| int | GetWidth () const |
| Returns the current minimum field width. | |
| OutputStream * | SetWidth (int width) |
| Assigns the minimum field width of the next formatted output operation. | |
| int | GetPosition () const |
| Returns the stream's current position measured in bytes. | |
| int | GetEndPosition () const |
| Returns the position of the stream's end measured in bytes. | |
| void | SetPosition (int offset) |
| Sets the stream's position relative to its beginning measured in bytes. | |
| void | SetPositionFromEnd (int offset) |
| Sets the stream's position relative to its end measured in bytes. | |
| void | AddOffset (int offset) |
| Moves the stream by the specified number of bytes relative to its current position. | |
| bool | IsEof () const |
| Returns whether the end of the stream has been reached. | |
| bool | HasError () const |
| Returns whether an error has occurred during an output operation. | |
| void | ClearError () |
| Clears the error flag. | |
An abstract interface for performing both unformatted and formatted output operations.
Except for Close, using a stream after it has been closed raises an error.
| void Bond::OutputStream::AddOffset | ( | int | offset | ) |
Moves the stream by the specified number of bytes relative to its current position.
| offset | The number of bytes by which the stream is repositioned. |
| void Bond::OutputStream::ClearError | ( | ) |
Clears the error flag.
| OutputStream * Bond::OutputStream::ClearFlags | ( | ) |
Disables all of the format flags.
The format flags modify how the stream formats output.
| void Bond::OutputStream::Close | ( | ) |
Flushes any unwritten output and closes the stream.
Closing a stream that is already closed has no effect. Closing a stream does not free it.
| void Bond::OutputStream::Flush | ( | ) |
Flushes any unwritten output.
| int Bond::OutputStream::GetEndPosition | ( | ) | const |
Returns the position of the stream's end measured in bytes.
| int Bond::OutputStream::GetFlags | ( | ) | const |
Returns the stream's current format flags as a bitmask of values from the IO::Flags enum.
The format flags modify how the stream formats output.
| int Bond::OutputStream::GetPosition | ( | ) | const |
Returns the stream's current position measured in bytes.
| int Bond::OutputStream::GetPrecision | ( | ) | const |
Returns the precision used when writing floating-point values. The default is 6.
| int Bond::OutputStream::GetWidth | ( | ) | const |
Returns the current minimum field width.
The width is reset to 0 by every formatted output operation.
| bool Bond::OutputStream::HasError | ( | ) | const |
Returns whether an error has occurred during an output operation.
| bool Bond::OutputStream::IsEof | ( | ) | const |
Returns whether the end of the stream has been reached.
| OutputStream * Bond::OutputStream::PrintB | ( | bool | value | ) |
Writes a formatted Boolean value to the output stream.
If the IO::BoolAlpha flag is set, the values true and false are written as the strings "true" and "false" respectively, otherwise they are written as the integers 1 and 0 as by PrintI.
| value | The Boolean value to be written to the stream. |
| OutputStream * Bond::OutputStream::PrintC | ( | char | value | ) |
Writes a single character to the output stream.
The character is padded to the field width (see SetWidth) with spaces, on the left, or on the right if the IO::Left flag is set.
| value | The character to be written to the stream. |
| OutputStream * Bond::OutputStream::PrintD | ( | double | value | ) |
Writes a formatted double to the output stream.
If the IO::Fixed or IO::Scientific flag is set, the number is written in decimal notation or scientific notation respectively, with the precision (see SetPrecision) giving the number of digits after the decimal point. If neither flag is set, the precision gives the number of significant digits, trailing zeros are removed, and the number is written in scientific notation if its exponent is less than -4 or greater than or equal to the precision, otherwise in decimal notation. The value is padded to the field width (see SetWidth). If the IO::Zero flag is set, it is zero padded to the left. If the IO::Left flag is set, the value is left-justified instead of right-justified, and padded with spaces. If the IO::ShowPoint flag is set, a decimal point is always written and trailing zeros are kept.
| value | The floating-point number to be written to the stream. |
| OutputStream * Bond::OutputStream::PrintF | ( | float | value | ) |
Writes a formatted float to the output stream.
If the IO::Fixed or IO::Scientific flag is set, the number is written in decimal notation or scientific notation respectively, with the precision (see SetPrecision) giving the number of digits after the decimal point. If neither flag is set, the precision gives the number of significant digits, trailing zeros are removed, and the number is written in scientific notation if its exponent is less than -4 or greater than or equal to the precision, otherwise in decimal notation. The value is padded to the field width (see SetWidth). If the IO::Zero flag is set, it is zero padded to the left. If the IO::Left flag is set, the value is left-justified instead of right-justified, and padded with spaces. If the IO::ShowPoint flag is set, a decimal point is always written and trailing zeros are kept.
| value | The floating-point number to be written to the stream. |
| OutputStream * Bond::OutputStream::PrintI | ( | int | value | ) |
Writes a formatted int to the output stream.
If the IO::Hex or IO::Oct flag is set, the integer is written in base 16 or 8 respectively, otherwise it is written in base 10. If the IO::ShowBase flag is set in addition to IO::Hex, the string "0x" is written before a non-zero number. If the IO::ShowBase flag is set in addition to IO::Oct, the number is written with a leading "0". The value is padded to the field width (see SetWidth). If the IO::Zero flag is set, it is zero padded to the left. If the IO::Left flag is set, the value is left-justified instead of right-justified, and padded with spaces.
| value | The integer to be written to the stream. |
| OutputStream * Bond::OutputStream::PrintL | ( | long | value | ) |
Writes a formatted long to the output stream.
If the IO::Hex or IO::Oct flag is set, the integer is written in base 16 or 8 respectively, otherwise it is written in base 10. If the IO::ShowBase flag is set in addition to IO::Hex, the string "0x" is written before a non-zero number. If the IO::ShowBase flag is set in addition to IO::Oct, the number is written with a leading "0". The value is padded to the field width (see SetWidth). If the IO::Zero flag is set, it is zero padded to the left. If the IO::Left flag is set, the value is left-justified instead of right-justified, and padded with spaces.
| value | The integer to be written to the stream. |
| OutputStream * Bond::OutputStream::PrintStr | ( | const char * | str | ) |
Writes a string of characters to the output stream. Writing stops at the first null character.
The string is padded to the field width (see SetWidth) with spaces, on the left, or on the right if the IO::Left flag is set.
| str | Pointer to a string of characters to be written to the stream. |
| OutputStream * Bond::OutputStream::PrintUI | ( | uint | value | ) |
Writes a formatted uint to the output stream.
If the IO::Hex or IO::Oct flag is set, the integer is written in base 16 or 8 respectively, otherwise it is written in base 10. If the IO::ShowBase flag is set in addition to IO::Hex, the string "0x" is written before a non-zero number. If the IO::ShowBase flag is set in addition to IO::Oct, the number is written with a leading "0". The value is padded to the field width (see SetWidth). If the IO::Zero flag is set, it is zero padded to the left. If the IO::Left flag is set, the value is left-justified instead of right-justified, and padded with spaces.
| value | The integer to be written to the stream. |
| OutputStream * Bond::OutputStream::PrintUL | ( | ulong | value | ) |
Writes a formatted ulong to the output stream.
If the IO::Hex or IO::Oct flag is set, the integer is written in base 16 or 8 respectively, otherwise it is written in base 10. If the IO::ShowBase flag is set in addition to IO::Hex, the string "0x" is written before a non-zero number. If the IO::ShowBase flag is set in addition to IO::Oct, the number is written with a leading "0". The value is padded to the field width (see SetWidth). If the IO::Zero flag is set, it is zero padded to the left. If the IO::Left flag is set, the value is left-justified instead of right-justified, and padded with spaces.
| value | The integer to be written to the stream. |
| OutputStream * Bond::OutputStream::Put | ( | uchar | byte | ) |
Writes a single unformatted byte to the output stream.
| byte | The byte to be written to the stream. |
| OutputStream * Bond::OutputStream::SetFlags | ( | int | flags | ) |
| void Bond::OutputStream::SetPosition | ( | int | offset | ) |
Sets the stream's position relative to its beginning measured in bytes.
| offset | The number of bytes from the beginning to which the stream is repositioned. |
| void Bond::OutputStream::SetPositionFromEnd | ( | int | offset | ) |
Sets the stream's position relative to its end measured in bytes.
| offset | The number of bytes from the end to which the stream is repositioned. |
| OutputStream * Bond::OutputStream::SetPrecision | ( | int | precision | ) |
Assigns the precision used when writing floating-point values.
If the IO::Fixed or IO::Scientific flag is set, the precision is the number of digits written after the decimal point, otherwise it is the maximum number of significant digits. Unlike the field width, the precision remains in effect until it is changed.
| precision | The new precision. |
| OutputStream * Bond::OutputStream::SetWidth | ( | int | width | ) |
Assigns the minimum field width of the next formatted output operation.
The minimum field width specifies the minimum number of characters to be written in a formatted output operation. If the number of characters in the written value is less than the field width, it is padded to the left, or to the right if the IO::Left flag is set. It is padded with spaces, except for numbers written with the IO::Zero flag set. The width applies only to the next formatted output operation, after which it is reset to 0.
| width | The new minimum field width. |
| OutputStream * Bond::OutputStream::UnsetFlags | ( | int | flags | ) |
| OutputStream * Bond::OutputStream::Write | ( | void * | bytes, |
| uint | numBytes ) |
Writes an array of unformatted bytes to the output stream.
| bytes | Pointer to the array of bytes to be written to the stream. |
| numBytes | The number of bytes to be written. |