Gromacs
2024.3
|
#include <gromacs/utility/include/gromacs/utility/stringstream.h>
Text output stream implementation for writing to an in-memory string.
Implementations for the TextOutputStream methods throw std::bad_alloc if reallocation of the string fails.
Public Member Functions | |
const std::string & | toString () const |
Returns the text written to the stream so far. | |
void | write (const char *text) override |
Writes a given string to the stream. | |
void | close () override |
Closes the stream. More... | |
|
overridevirtual |
Closes the stream.
It is not allowed to write to a stream after it has been closed. A method separate from the destructor is provided such that errors that occur while closing the stream (e.g., when closing the file) can be handled using exceptions. The destructor is not allowed to throw, so code that wants to observe such errors needs to call close() after it has finished writing to the stream.
Implements gmx::TextOutputStream.