|
Bond 0.9
Bond Standard Library API Documentation
|
An abstract interface for performing both unformatted and formatted input operations. More...
Public Member Functions | |
| void | Close () |
| Discards any unread input and closes the stream. | |
| void | ScanStr (char *str, uint bufferSize) |
| Reads a string of characters from the input stream into a character buffer. | |
| bool | ScanB () |
| Reads and returns a formatted Boolean value from the input stream. | |
| char | ScanC () |
| Reads and returns a single character from the input stream. | |
| int | ScanI () |
| Reads and returns a formatted integer as an int from the input stream. | |
| uint | ScanUI () |
| Reads and returns a formatted unsigned integer as a uint from the input stream. | |
| long | ScanL () |
| Reads and returns a formatted integer as a long from the input stream. | |
| ulong | ScanUL () |
| Reads and returns a formatted unsigned integer as a ulong from the input stream. | |
| float | ScanF () |
| Reads and returns a formatted floating-point number as a float from the input stream. | |
| double | ScanD () |
| Reads and returns a formatted floating-point number as a double from the input stream. | |
| int | Get () |
| Reads and returns a single unformatted byte from the input stream. | |
| uint | Read (void *bytes, uint numBytes) |
| Attempts to read the specified number of unformatted bytes into the given buffer. | |
| int | GetFlags () const |
| Returns the stream's current format flags as a bitmask of values from the IO::Flags enum. | |
| InputStream * | SetFlags (int flags) |
| Enables the format format flags in the given bitmask of values from the IO::Flags enum if they are not already enabled. | |
| InputStream * | UnsetFlags (int flags) |
| Disables the format format flags in the given bitmask of values from the IO::Flags enum if they are not already disabled. | |
| InputStream * | ClearFlags () |
| Disables all of the format flags. | |
| 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 input operation. | |
| void | ClearError () |
| Clears the error flag. | |
An abstract interface for performing both unformatted and formatted input operations.
| void Bond::InputStream::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::InputStream::ClearError | ( | ) |
Clears the error flag.
| InputStream * Bond::InputStream::ClearFlags | ( | ) |
Disables all of the format flags.
The format flags modify how the stream interprets input.
| void Bond::InputStream::Close | ( | ) |
Discards any unread input and closes the stream.
| int Bond::InputStream::Get | ( | ) |
Reads and returns a single unformatted byte from the input stream.
If the end of the stream has been reached and there is no data to return, the value IO::Eof is returned.
| int Bond::InputStream::GetEndPosition | ( | ) | const |
Returns the position of the stream's end measured in bytes.
| int Bond::InputStream::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 interprets input.
| int Bond::InputStream::GetPosition | ( | ) | const |
Returns the stream's current position measured in bytes.
| bool Bond::InputStream::HasError | ( | ) | const |
Returns whether an error has occurred during an input operation.
| bool Bond::InputStream::IsEof | ( | ) | const |
Returns whether the end of the stream has been reached.
| uint Bond::InputStream::Read | ( | void * | bytes, |
| uint | numBytes ) |
Attempts to read the specified number of unformatted bytes into the given buffer.
Fewer bytes may be read if the end of the stream is reached or the stream is closed.
| bytes | The buffer into which the read bytes are stored. |
| numBytes | The requested number of bytes to be read. |
| bool Bond::InputStream::ScanB | ( | ) |
Reads and returns a formatted Boolean value from the input stream.
If the IO::BoolAlpha flag is set, an attempt is made to read the strings "true" or "false", otherwise an integer is read. If a non-zero value, or the string "true" is read, the value true is returned. If no input that could be interpreted as a bool is read, HasError() returns true.
| char Bond::InputStream::ScanC | ( | ) |
Reads and returns a single character from the input stream.
| double Bond::InputStream::ScanD | ( | ) |
Reads and returns a formatted floating-point number as a double from the input stream.
If no input that could be interpreted as a floating-point number is read, HasError() returns true.
| float Bond::InputStream::ScanF | ( | ) |
Reads and returns a formatted floating-point number as a float from the input stream.
If no input that could be interpreted as a floating-point number is read, HasError() returns true.
| int Bond::InputStream::ScanI | ( | ) |
Reads and returns a formatted integer as an int from the input stream.
If the IO::Dec, IO::Hex or IO::Oct flag is set, the integer is read in base 10, 16 or 8 respectively. If none of those flags are set, the integer is read in base 16 if it begins with 0x, in base 8 if it begins with 0, or in base 10 otherwise. If no input that could be interpreted as an integer is read, HasError() returns true.
| long Bond::InputStream::ScanL | ( | ) |
Reads and returns a formatted integer as a long from the input stream.
If the IO::Dec, IO::Hex or IO::Oct flag is set, the integer is read in base 10, 16 or 8 respectively. If none of those flags are set, the integer is read in base 16 if it begins with 0x, in base 8 if it begins with 0, or in base 10 otherwise. If no input that could be interpreted as an integer is read, HasError() returns true.
| void Bond::InputStream::ScanStr | ( | char * | str, |
| uint | bufferSize ) |
Reads a string of characters from the input stream into a character buffer.
The scan stops at the first whitespace character or when the buffer is full. The string is null terminated. At most bufferSize-1 characters are read to leave space for the null terminator.
| str | Pointer to a character buffer where characters are stored. |
| bufferSize | Length of the buffer pointed to by str. |
| uint Bond::InputStream::ScanUI | ( | ) |
Reads and returns a formatted unsigned integer as a uint from the input stream.
If the IO::Dec, IO::Hex or IO::Oct flag is set, the integer is read in base 10, 16 or 8 respectively. If none of those flags are set, the integer is read in base 16 if it begins with 0x, in base 8 if it begins with 0, or in base 10 otherwise. If no input that could be interpreted as an integer is read, HasError() returns true.
| ulong Bond::InputStream::ScanUL | ( | ) |
Reads and returns a formatted unsigned integer as a ulong from the input stream.
If the IO::Dec, IO::Hex or IO::Oct flag is set, the integer is read in base 10, 16 or 8 respectively. If none of those flags are set, the integer is read in base 16 if it begins with 0x, in base 8 if it begins with 0, or in base 10 otherwise. If no input that could be interpreted as an integer is read, HasError() returns true.
| InputStream * Bond::InputStream::SetFlags | ( | int | flags | ) |
Enables the format format flags in the given bitmask of values from the IO::Flags enum if they are not already enabled.
All other flags are left untouched. The format flags modify how the stream interprets input.
| flags | The bitmask of flags from the IO::Flags enum to enable. |
| void Bond::InputStream::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::InputStream::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. |
| InputStream * Bond::InputStream::UnsetFlags | ( | int | flags | ) |
Disables the format format flags in the given bitmask of values from the IO::Flags enum if they are not already disabled.
All other flags are left untouched. The format flags modify how the stream interprets input.
| flags | The bitmask of flags from the IO::Flags enum to disable. |