Device for reading from standard output. More...
#include <console.hpp>
Public Member Functions | |
const Error & | error () const |
Returns the most recent error status. | |
IConsole () | |
Default constructor. | |
bool | open () |
Dummy handle to satisfy the input device concept. | |
long | read (char &c) ecl_assert_throw_decl(StandardException) |
Read a character from standard input. | |
long | read (char *s, const unsigned long &n) ecl_assert_throw_decl(StandardException) |
Reads a character string from standard input. | |
virtual | ~IConsole () |
Private Attributes | |
Error | error_handler |
Device for reading from standard output.
Device for reading from standard output. It creates a wrapper class around the stdout handle from cstdio to implement an ecl output device. Do not use this directly, it serves only as the device handle for the console stream classes.
One peculiarity of this device, is that it will strip newlines from the incoming input. This is a characteristic exclusive to the input console device because of its interactive nature with the user.
Definition at line 202 of file console.hpp.
ecl::IConsole::IConsole | ( | ) | [inline] |
Default constructor.
Definition at line 207 of file console.hpp.
virtual ecl::IConsole::~IConsole | ( | ) | [inline, virtual] |
Definition at line 208 of file console.hpp.
const Error& ecl::IConsole::error | ( | ) | const [inline] |
Returns the most recent error status.
Use this to check on the status of the object after a method has been called. Mostly this is here to serve as a graceful fallback for when exceptions are disabled.
Definition at line 257 of file console.hpp.
bool ecl::IConsole::open | ( | ) | [inline] |
Dummy handle to satisfy the input device concept.
For console devices this does nothing - the standard input is always open. It is just a dummy handle built to ensure the input device concept is satisfied.
Definition at line 220 of file console.hpp.
long ecl::IConsole::read | ( | char & | c | ) |
Read a character from standard input.
Reads a single character from standard input.
c | : character to read into from standard input. |
StandardException | : throws if reading returned an error [debug mode only]. |
Definition at line 92 of file console.cpp.
long ecl::IConsole::read | ( | char * | s, |
const unsigned long & | n | ||
) |
Reads a character string from standard input.
Reads a character string from standard input.
s | : character string to read into from standard input. |
n | : the number of bytes to read. |
StandardException | : throws if reading returned an error [debug mode only]. |
Definition at line 106 of file console.cpp.
Error ecl::IConsole::error_handler [private] |
Definition at line 259 of file console.hpp.