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

#include <gromacs/utility/messagestringcollector.h>

Description

Helper class for collecting message strings, optionally with context.

After strings have been collected, they can be formatted into one long string for, e.g., printing out or for including in an exception.

Public Member Functions

void startContext (const char *name)
 Starts a context for messages. More...
 
void startContext (const std::string &name)
 Convenience wrapper for startContext(const char *).
 
void append (const char *message)
 Adds a new message.
 
void append (const std::string &message)
 Adds a new message.
 
void finishContext ()
 Ends a context started with startContext(). More...
 
void clear ()
 Clears all collected messages.
 
bool isEmpty () const
 Returns true if any messages have been added. More...
 
std::string toString () const
 Returns all collected messages as one string.
 

Member Function Documentation

void gmx::MessageStringCollector::finishContext ( )

Ends a context started with startContext().

See Also
MessageStringContext
bool gmx::MessageStringCollector::isEmpty ( ) const

Returns true if any messages have been added.

Returns
true if append() has been called at least once.

The return value is identical to toString().empty(). Calls to startContext() or finishContext() only do not cause this function to return true.

void gmx::MessageStringCollector::startContext ( const char *  name)

Starts a context for messages.

Parameters
[in]nameShort description of the context.
See Also
finishContext()
MessageStringContext

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