Bifrost SDK
Bifrost SDK documentation
Amino::Message Class Referencefinal

A Message object that of a specific MessageKind, optional MessageClass, and a MessageText that relates to an optional Source. More...

#include <Message.h>

Public Member Functions

AMINO_CORE_SHARED_DECL Message ()
 Default constructor (empty message). More...
 
AMINO_CORE_SHARED_DECL Message (Source source, MessageKind kind, MessageClass cls, MessageText text)
 Constructs a message with the given Source, MessageKind, MessageClass, and MessageText. More...
 
template<typename Arg , typename... Args>
 Message (Source source, MessageKind kind, MessageClass cls, MessageText text, Arg const &arg, Args const &... args)
 Constructs a message with the given Source, MessageKind, MessageClass, and MessageText and format arguments. More...
 
AMINO_CORE_SHARED_DECL Message (Message const &o)
 Copy constructor. More...
 
AMINO_CORE_SHARED_DECL Message (Message &&o) noexcept
 Move constructor. More...
 
AMINO_CORE_SHARED_DECL Messageoperator= (Message const &o)
 Copy assignment operator. More...
 
AMINO_CORE_SHARED_DECL Messageoperator= (Message &&o) noexcept
 Move assignment operator. More...
 
AMINO_CORE_SHARED_DECL ~Message ()
 Destructor. More...
 
AMINO_CORE_SHARED_DECL Source const & getSource () const
 Get the source of the message. More...
 
AMINO_CORE_SHARED_DECL MessageKind getKind () const
 Get the kind of message. More...
 
AMINO_CORE_SHARED_DECL MessageClass getClass () const
 Get the message class. More...
 
AMINO_CORE_SHARED_DECL String getText () const
 Get the message text. More...
 
template<typename Os >
AMINO_INTERNAL_FORCEINLINE void toStream (Os &os, bool newline=true) const
 Write the formatted message to the given output stream. More...
 
AMINO_CORE_SHARED_DECL String getFormattedText () const
 Get the formatted text of the message. More...
 
AMINO_CORE_SHARED_DECL bool isValid () const
 Whether the message is valid or not (not default constructed). More...
 
 operator bool () const
 Whether the message is valid or not (not default constructed). More...
 

Static Public Member Functions

static constexpr StringView toString (MessageKind kind)
 Get the string representation of the MessageKind. More...
 

Detailed Description

A Message object that of a specific MessageKind, optional MessageClass, and a MessageText that relates to an optional Source.

The MessageKind indicates the severity of the message (error, warning, info, debug).

The MessageClass allows for categorizing messages into different classes, which can be useful for filtering or grouping messages.

The MessageText contains the actual message text, which can include format specifiers that will be replaced with the given format arguments when the message is constructed.

The Source can be used to indicate the provenance of the message, which can be used for example to retreive some datamodel entities for which the message was created.

Definition at line 170 of file Message.h.

Constructor & Destructor Documentation

◆ Message() [1/5]

AMINO_CORE_SHARED_DECL Amino::Message::Message ( )

Default constructor (empty message).

◆ Message() [2/5]

AMINO_CORE_SHARED_DECL Amino::Message::Message ( Source  source,
MessageKind  kind,
MessageClass  cls,
MessageText  text 
)

Constructs a message with the given Source, MessageKind, MessageClass, and MessageText.

◆ Message() [3/5]

template<typename Arg , typename... Args>
Amino::Message::Message ( Source  source,
MessageKind  kind,
MessageClass  cls,
MessageText  text,
Arg const &  arg,
Args const &...  args 
)
inline

Constructs a message with the given Source, MessageKind, MessageClass, and MessageText and format arguments.

See MessageText for details about the format text and format arguments.

Definition at line 204 of file Message.h.

◆ Message() [4/5]

AMINO_CORE_SHARED_DECL Amino::Message::Message ( Message const &  o)

Copy constructor.

◆ Message() [5/5]

AMINO_CORE_SHARED_DECL Amino::Message::Message ( Message &&  o)
noexcept

Move constructor.

◆ ~Message()

AMINO_CORE_SHARED_DECL Amino::Message::~Message ( )

Destructor.

Member Function Documentation

◆ getClass()

AMINO_CORE_SHARED_DECL MessageClass Amino::Message::getClass ( ) const

Get the message class.

◆ getFormattedText()

AMINO_CORE_SHARED_DECL String Amino::Message::getFormattedText ( ) const

Get the formatted text of the message.

(Same format as toStream but returns a String instead of writing to an output stream.)

◆ getKind()

AMINO_CORE_SHARED_DECL MessageKind Amino::Message::getKind ( ) const

Get the kind of message.

◆ getSource()

AMINO_CORE_SHARED_DECL Source const & Amino::Message::getSource ( ) const

Get the source of the message.

◆ getText()

AMINO_CORE_SHARED_DECL String Amino::Message::getText ( ) const

Get the message text.

◆ isValid()

AMINO_CORE_SHARED_DECL bool Amino::Message::isValid ( ) const

Whether the message is valid or not (not default constructed).

Referenced by operator bool().

◆ operator bool()

Amino::Message::operator bool ( ) const
inlineexplicit

Whether the message is valid or not (not default constructed).

Definition at line 234 of file Message.h.

References isValid().

◆ operator=() [1/2]

AMINO_CORE_SHARED_DECL Message & Amino::Message::operator= ( Message &&  o)
noexcept

Move assignment operator.

◆ operator=() [2/2]

AMINO_CORE_SHARED_DECL Message & Amino::Message::operator= ( Message const &  o)

Copy assignment operator.

◆ toStream()

template<typename Os >
AMINO_INTERNAL_FORCEINLINE void Amino::Message::toStream ( Os &  os,
bool  newline = true 
) const
inline

Write the formatted message to the given output stream.

Definition at line 251 of file Message.h.

◆ toString()

static constexpr StringView Amino::Message::toString ( MessageKind  kind)
inlinestaticconstexpr

Get the string representation of the MessageKind.

Definition at line 175 of file Message.h.

References Amino::eDebug, Amino::eError, Amino::eInfo, and Amino::eWarning.