Message class
Forward declaration of the Message template class.
Base template class for formatted message output.
Base template class for formatted message output with customizable prefixes.
Base class for creating formatted messages with customizable prefixes, colors, and styles. Messages support stream-like insertion operators for building content incrementally. This class is used as the base for Exception, Warning, Info, and Success message types.
The Message class handles:
- Formatted output with colored prefixes
- Automatic indentation for multi-line messages
- Stream-like insertion operators for content
- Integration with the Alert tag types (NewLine, Raise, etc.)
Example usage (through derived classes):
Exception() << "Error in function: " << funcName << NewLine << "Invalid parameter value: " << value << Raise;
Constructors, destructors, conversion operators
Public functions
- auto what() const -> const char* noexcept
- Gets the message content as a C-string.
-
template<class T>auto operator<<(const T& v) -> std::enable_if_t<Internal::
CanBeOutput<T>::Value, Message&> noexcept - Stream insertion operator for arbitrary streamable types.
- auto operator<<(const NewLineT&) -> Message&
- Stream insertion operator for NewLine tag.
- auto operator<<(const RaiseT&) -> void
- Stream insertion operator for Raise tag.
- auto raise() const -> void virtual
- Raises (outputs) the message to the user.
- auto setOutputStream(std::ostream& os) -> void
- Sets the output stream for this message.
Function documentation
std::enable_if_t<Internal:: CanBeOutput<T>::Value, Message&> Rodin:: Alert:: Message<_1>:: operator<<(const T& v) noexcept
Stream insertion operator for arbitrary streamable types.
| Template parameters | |
|---|---|
| T | The type to insert (must be streamable). |
| Parameters | |
| v | The value to insert into the message. |
| Returns | Reference to this Message object for method chaining. |
Appends content to the message. Handles automatic indentation when content follows a newline. Only enabled for types that can be output to an ostream.
Message& Rodin:: Alert:: Message<_1>:: operator<<(const NewLineT&)
Stream insertion operator for NewLine tag.
| Returns | Reference to this Message object for method chaining. |
|---|
Inserts a newline character and marks the next insertion for automatic indentation to align with the message prefix.
void Rodin:: Alert:: Message<_1>:: setOutputStream(std::ostream& os)
Sets the output stream for this message.
| Parameters | |
|---|---|
| os | The new output stream. |
Changes where the message will be output when raised.