Gromacs  2016.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions
gmx::StandardInputStream Class Reference

#include <gromacs/utility/filestream.h>

+ Inheritance diagram for gmx::StandardInputStream:
+ Collaboration diagram for gmx::StandardInputStream:

Description

Text input stream implementation for reading from stdin.

Implementations for the TextInputStream methods throw FileIOError on any I/O error.

Public Member Functions

bool isInteractive () const
 Returns whether stdin is an interactive terminal. More...
 
virtual bool readLine (std::string *line)
 Reads a line (with newline included) from the stream. More...
 
virtual void close ()
 Closes the stream. More...
 

Static Public Member Functions

static StandardInputStreaminstance ()
 Returns a stream for accessing stdin. More...
 

Member Function Documentation

virtual void gmx::StandardInputStream::close ( )
inlinevirtual

Closes the stream.

It is not allowed to read from a stream after it has been closed. See TextOutputStream::close() for rationale for a close() method separate from the destructor. For input, failures during close should be rare, but it is clearer to keep the interface symmetric.

Implements gmx::TextInputStream.

StandardInputStream & gmx::StandardInputStream::instance ( )
static

Returns a stream for accessing stdin.

Does not throw.

bool gmx::StandardInputStream::isInteractive ( ) const

Returns whether stdin is an interactive terminal.

Only works on Unix, otherwise always returns true.

Does not throw.

bool gmx::StandardInputStream::readLine ( std::string *  line)
virtual

Reads a line (with newline included) from the stream.

Parameters
[out]lineString to receive the line.
Returns
false if nothing was read because the stream ended.

On error or when false is returned, line will be empty.

Implements gmx::TextInputStream.


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