oeistream
class oeistream : public oestream
This class represents oeistream.
Defines the platform independent interface and implementation for a generic input data stream class.
The following methods are publicly inherited from oestream:
- The following classes derive from this class:
Constructors
oeistream() -> oeistream
Creates an instance of an oeistream. This class is designed to provide an interface and some functionality; however, this class does not define a data source and therefore instances of this class have no independent functionality.
close
close() -> None
Closes the input stream. All future attempts to read from this stream will fail until it is opened again with new input.
get
get(c: str) -> bool
get(str: signed) -> bool
Gets the next byte off of the stream and assigns its value to the parameter ‘c’. Returns whether or not the byte read equals EOF.
getbyte
getbyte() -> int
Returns the next byte off of the stream.
getline
getline(sbuffer: str) -> bool
getline(sbuffer: str, max: oesize_t) -> bool
Retrieves the next text line from the stream and directly copies its contents into the ‘buffer’ parameter. The newline character is not copied with the rest of the contents, though a null terminator, ‘0’, is placed at the end of the contents. The ‘max’ parameter specifies the maximum size of the memory passed in as the ‘buffer’ argument. If a newline character is not found within ‘max - 1’ characters, only the specified number of characters will be copied into the buffer and all the remaining characters in the stream before the next newline character will be discarded.
gettoken
gettoken(sbuffer: str, max: oesize_t) -> bool
Retrieves the next whitespace delimited token from the stream and directly copies its contents into the ‘buffer’ parameter. This function discards the whitespace characters read when searching for the next token. The ‘max’ parameter specifies the maximum number of characters allowed per token. If a whitespace character is not found within the specified number of characters, only the specified number of characters will be copied into the buffer and all the remaining characters in the stream before the next whitespace character will be discarded.
open
open(name: str) -> bool
open(buffer: str, len: oesize_t) -> bool
Opens the input stream with data from the specified sources. Passing a ‘name’ parameter will result in invocation of a protected virtual method to appropriate handle the specified input source. Passing a pointer to a character buffer along with the buffer’s size will result in the stream wrapping the ‘buffer’ and using that as the stream data source. Returns whether or not data can now be read from the stream.
peekbyte
peekbyte() -> int
Returns the value of the next byte without removing that byte from
the input stream. Returns -1 if the stream is not valid.
read
read(sbuffer: str) -> oesize_t
Reads the next len number of bytes off of the stream, stores them
in the specified ‘buffer’ and returns the number of bytes actually
read. It is the user’s responsibility when using any of the three
char * versions to make sure that the specified ‘buffer’ has been
properly allocated and has enough room to store len bytes. This
function does not add a NULL terminator to the end of the
buffer.
The version that takes a std::string without a size will
read the entire contents of the stream into the string, or until
std::bad_alloc is thrown when the system runs out of
memory.
skip
skip(len: oefpos_t) -> bool
Discards the next number of bytes specified by ‘len’ in the stream. Returns whether or not there are any bytes left in the stream.
skipbyte
skipbyte() -> bool
Discards the next byte in the stream. Returns whether or not there are any bytes left in the stream.
skipline
skipline() -> bool
Discards the next text line in the stream. Returns whether or not there are any bytes left in the stream.