![]() |
The Simons
|
#include <Input.h>
Inheritance diagram for Input:
The Input class provides the ANSII standard C++ implementation of an input filesystem. It implements the FileStream protocol for opening and closing a filesystem. It implements the Stream protocol for detecting the state of a Stream. Operations that connect to the filesystem may raise a NotFound exception if the filesystem cannot be found and a NoResponse exception if the filesystem fails, or is already in use. The parent of TextInput and ByteInput, Input defines the abstract protocols for reading values of all the basic types Boolean, Character, Natural, Integer and Decimal. It also defines the protocol for reading Character[] array and String objects.
Public Member Functions | |
Input () | |
Construct a standard Input stream. | |
virtual | ~Input () |
Release an unused Input stream. | |
Input (StringID) | |
Construct an Input file stream. | |
virtual Void | open () |
Open this Input stream for reading. | |
virtual Void | close () |
Close this Input stream. | |
virtual Boolean | exists () const |
Test if this Input stream exists. | |
virtual Boolean | empty () const |
Test if this Input stream is empty. | |
virtual Boolean | ready () const |
Test if this Input stream is ready. | |
virtual Boolean | failed () const |
Test if this Input stream has failed. | |
virtual Boolean | source () const |
Test if this Input is a source. | |
virtual InputID | get (Boolean &) |
Read in a Boolean value. | |
virtual InputID | get (Character &) |
Read in a Character value. | |
virtual InputID | get (Natural &) |
Read in a Natural value. | |
virtual InputID | get (Integer &) |
Read in an Integer value. | |
virtual InputID | get (Decimal &) |
Read in a Decimal value. | |
virtual InputID | get (StringID &, Character= '\n') |
Read in a String, up to a delimiter Character. | |
virtual InputID | get (Character[], Natural, Character= '\n') |
Read in a Character array, up to a delimiter Character. | |
virtual InputID | skip (Character= '\n') |
Skip input up to and including a delimiter Character. | |
Protected Member Functions | |
Input (const Input &) | |
Copy another Input stream. | |
Protected Attributes | |
std::istream * | filesystem |
The input stream pathname. |
|
Copy another Input stream. Required by C++ to ensure that copying an Input faithfully copies a FileStream. Constructs a shallow copy of the other Input. Shares any file pathname but leaves the underlying filesystem closed.
|
|
Construct a standard Input stream. Constructs an Input stream onto the standard input (keyboard). By default, the pathname is null.
|
|
Release an unused Input stream. Performs all closing actions to disconnect from the underlying filesystem. |
|
Construct an Input file stream. Constructs an Input stream onto the given path name. When opened, this Input stream will connect to the named file.
|
|
Close this Input stream. Provided this Input is open, closes the connection to the underlying filesystem. Otherwise, has no effect, since this Input is not connected. Reimplemented from Stream. |
|
Test if this Input stream is empty. Use this method to test for the end-of-file marker. Peeks ahead to see if the next item on the Input stream is the end-of-file marker.
Reimplemented from Stream. |
|
Test if this Input stream exists. Use this method to test if the connection with the underlying filesystem was successfully opened.
Reimplemented from Stream. |
|
Test if this Input stream has failed. Use this method to test if this Input stream failed to complete the previous input operation.
Reimplemented from Stream. |
|
Read in a Character array, up to a delimiter Character. The Character array must be exactly of the specified length. Attempts to read a sequence of Character values into the array argument, until length-1 values have been read or the delimiter Character is encountered. Leaves the delimiter on the Input stream. Sets the last Character to the terminating null byte. This method is abstract in Input.
Reimplemented in TextInput. |
|
Read in a String, up to a delimiter Character. Attempts to read a sequence of Character values into the String argument, until the delimiter Character is encountered. Leaves the delimiter on the Input stream. May throw a ReadFailure exception if reading fails. This method is abstract in Input.
Reimplemented in TextInput. |
|
Read in a Decimal value. Attempts to read the next value from this Input stream, skipping leading white space. The argument refers to a variable in which the value will be stored. May throw a ReadFailure exception if reading fails. This method is abstract in Input.
Reimplemented in TextInput. |
|
Read in an Integer value. Attempts to read the next value from this Input stream, skipping leading white space. The argument refers to a variable in which the value will be stored. May throw a ReadFailure exception if reading fails. This method is abstract in Input.
Reimplemented in TextInput. |
|
Read in a Natural value. Attempts to read the next value from this Input stream, skipping leading white space. The argument refers to a variable in which the value will be stored. May throw a ReadFailure exception if reading fails. This method is abstract in Input.
Reimplemented in TextInput. |
|
Read in a Character value. Attempts to read the next value from this Input stream, skipping leading white space. The argument refers to a variable in which the value will be stored. May throw a ReadFailure exception if reading fails. This method is abstract in Input.
Reimplemented in TextInput. |
|
Read in a Boolean value. Attempts to read the next value from this Input stream, skipping leading white space. The argument refers to a variable in which the value will be stored. May throw a ReadFailure exception if reading fails. This method is abstract in Input.
Reimplemented in TextInput. |
|
Open this Input stream for reading. Provided this Input is closed, opens a connection to the underlying filesystem. Otherwise, raises a DeviceBusy exception, since the stream is busy. If the requested Input stream cannot be opened, releases the filesystem and raises a NotFound exception. Reimplemented from Stream. |
|
Test if this Input stream is ready. Use this method to test if the Input stream is ready for the next input operation.
Reimplemented from Stream. |
|
Skip input up to and including a delimiter Character. Skips all input up to and including the delimiter Character. Complements methods that read data up to, but not including, a delimiter.
Reimplemented in TextInput. |
|
Test if this Input is a source. Trivially returns true for Input streams.
Reimplemented from Stream. |
|
The input stream pathname.
|