Public Member Functions | Private Attributes | List of all members
ecl::IConsole Class Reference

Device for reading from standard output. More...

#include <console.hpp>

Public Member Functions

const Errorerror () const
 Returns the most recent error status. More...
 
 IConsole ()
 Default constructor. More...
 
bool open ()
 Dummy handle to satisfy the input device concept. More...
 
long read (char &c)
 Read a character from standard input. More...
 
long read (char *s, const unsigned long &n)
 Reads a character string from standard input. More...
 
virtual ~IConsole ()
 

Private Attributes

Error error_handler
 

Detailed Description

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 209 of file console.hpp.

Constructor & Destructor Documentation

◆ IConsole()

ecl::IConsole::IConsole ( )
inline

Default constructor.

Definition at line 216 of file console.hpp.

◆ ~IConsole()

virtual ecl::IConsole::~IConsole ( )
inlinevirtual

Definition at line 217 of file console.hpp.

Member Function Documentation

◆ error()

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.

Returns

Definition at line 266 of file console.hpp.

◆ open()

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.

Returns
bool : always returns true (it is always open).

Definition at line 229 of file console.hpp.

◆ read() [1/2]

long ecl::IConsole::read ( char &  c)

Read a character from standard input.

Reads a single character from standard input.

Parameters
c: character to read into from standard input.
Exceptions
StandardException: throws if reading returned an error [debug mode only].

Definition at line 96 of file console.cpp.

◆ read() [2/2]

long ecl::IConsole::read ( char *  s,
const unsigned long &  n 
)

Reads a character string from standard input.

Reads a character string from standard input.

Parameters
s: character string to read into from standard input.
n: the number of bytes to read.
Exceptions
StandardException: throws if reading returned an error [debug mode only].

Definition at line 110 of file console.cpp.

Member Data Documentation

◆ error_handler

Error ecl::IConsole::error_handler
private

Definition at line 268 of file console.hpp.


The documentation for this class was generated from the following files:


ecl_devices
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:45