ROSE 0.11.145.147
|
A single message.
A message consists of a string and can be in a partial, completed, or canceled state. More text can be added to a message while it is in the partial state, but once the message is marked as completed or canceled the text becomes immutable. Messages also have properties, which are fed into the plumbing lattice and adjusted as they traverse to the final destinations during a process called "baking".
Thread safety: This object uses global state, but is otherwise not thread-safe except where noted.
#include <Sawyer/Message.h>
Public Member Functions | |
Mesg () | |
Creates a new, partial message that is empty. | |
Mesg (const std::string &facilityName, Importance imp) | |
Creates a new, partial message that is empty. | |
Mesg (const MesgProps &props) | |
Creates a new, partial message that is empty. | |
Mesg (const std::string &mesg) | |
Creates a new, completed message with the specified text. | |
Mesg (const std::string &facilityName, Importance imp, const std::string &mesg) | |
Creates a new, completed message with the specified text. | |
Mesg (const MesgProps &props, const std::string &mesg) | |
Creates a new, completed message with the specified text. | |
unsigned | id () const |
Return unique message ID. | |
const std::string & | text () const |
Return the message text. | |
bool | isComplete () const |
Returns true if the message has entered the completed state. | |
bool | isCanceled () const |
Returns true if the message has entered the canceled state. | |
bool | isEmpty () const |
Returns true if the message has no text. | |
bool | hasText () const |
Returns true if the message has text other than white space. | |
void | complete () |
Cause the message to enter the completed state. | |
void | cancel () |
Cause the message to enter the canceled state. | |
void | post (const BakedDestinations &) const |
Send a message to its final destinations. | |
const MesgProps & | properties () const |
Returns a reference to message properties. | |
MesgProps & | properties () |
Returns a reference to message properties. | |
void | insert (const std::string &) |
Append additional text to the end of the message. | |
void | insert (char) |
Append additional text to the end of the message. | |
|
inline |
|
inline |
Creates a new, partial message that is empty.
Sets the facility name and importance properties as specified.
Definition at line 529 of file Message.h.
References Sawyer::Message::MesgProps::facilityName, and Sawyer::Message::MesgProps::importance.
|
inlineexplicit |
|
inlineexplicit |
|
inline |
Creates a new, completed message with the specified text.
Also sets the facility name and importance properties as specified.
Definition at line 545 of file Message.h.
References Sawyer::Message::MesgProps::facilityName, and Sawyer::Message::MesgProps::importance.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
bool Sawyer::Message::Mesg::hasText | ( | ) | const |
Returns true if the message has text other than white space.
This is similar, but not identical to the inverse of the isEmpty method.
|
inline |
Returns a reference to message properties.
Once a message's properties are "baked" by sending them through the plumbing lattice, changing the message properties has no effect on the text that is emitted by the message sinks. A stream typically bakes the message when the first text is inserted.
|
inline |
Returns a reference to message properties.
Once a message's properties are "baked" by sending them through the plumbing lattice, changing the message properties has no effect on the text that is emitted by the message sinks. A stream typically bakes the message when the first text is inserted.
|
inline |
|
inline |
void Sawyer::Message::Mesg::insert | ( | const std::string & | ) |
Append additional text to the end of the message.
If the message is in the completed or canceled state then an std::runtime_error is thrown.
void Sawyer::Message::Mesg::insert | ( | char | ) |
Append additional text to the end of the message.
If the message is in the completed or canceled state then an std::runtime_error is thrown.