Gromacs  2019-beta2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::StringOutputStream Class Reference

#include <gromacs/utility/stringstream.h>

+ Inheritance diagram for gmx::StringOutputStream:
+ Collaboration diagram for gmx::StringOutputStream:


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...

Member Function Documentation

void gmx::StringOutputStream::close ( )

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.

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