Gromacs  2026.0-dev-20251105-11eb1db
 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::test::PosixMemstream Class Reference

#include <testutils/include/testutils/posixmemstream.h>

Description

Open an in-memory string stream that works like a FILE* handle.

This permits writing tests based on the contents of that string after the stream has closed.

When open_memstream() is not supported, provides a minimal functional implementation that writes to stdout. This lets us have test coverage of legacy code on POSIX-compliant systems, which is much better than nothing.

Public Member Functions

FILE * stream ()
 Get the stream.
 
void closeStream ()
 Close the string stream (if supported)
 
std::string toString ()
 Close the stream and return a string. More...
 

Static Public Member Functions

static bool canCheckBufferContents ()
 Return whether checking the buffer contents is supported.
 

Member Function Documentation

std::string gmx::test::PosixMemstream::toString ( )

Close the stream and return a string.

Returns
A string containing the stream contents (if supported), else an emptry string.

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