Gromacs
2025.0-dev-20241011-013a99c
|
#include <gromacs/utility/include/gromacs/utility/stringstream.h>
Helper class to convert static string data to a stream.
Provides a text input stream that returns lines from a string
Public Member Functions | |
StringInputStream (const std::string &input) | |
Constructor that stores input lines in a string. More... | |
StringInputStream (const std::vector< std::string > &input) | |
Constructor that stores input lines in a string. More... | |
StringInputStream (ArrayRef< const char *const > const &input) | |
Constructor that stores input lines in a string. More... | |
bool | readLine (std::string *line) override |
Reads a line (with newline included) from the stream. More... | |
void | close () override |
Closes the stream. More... | |
|
explicit |
Constructor that stores input lines in a string.
The string is internally but no processing is done.
[in] | input | String to be served by the stream. |
|
explicit |
Constructor that stores input lines in a string.
The vector of strings is stored as a string separated by newline.
[in] | input | String to be served by the stream. |
|
explicit |
Constructor that stores input lines in a string.
The array of char * is stored as a string separated by newline.
[in] | input | Array of char * to be served by the stream. |
|
inlineoverridevirtual |
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.
|
overridevirtual |
Reads a line (with newline included) from the stream.
[out] | line | String to receive the line. |
false
if nothing was read because the stream ended.On error or when false
is returned, line
will be empty.
Implements gmx::TextInputStream.