Gromacs
2018.8
|
#include <gromacs/utility/messagestringcollector.h>
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. | |
void gmx::MessageStringCollector::finishContext | ( | ) |
Ends a context started with startContext().
bool gmx::MessageStringCollector::isEmpty | ( | ) | const |
Returns true if any messages have been added.
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.
[in] | name | Short description of the context. |