Messaging¶
Collection of classes representing messages that are exchanged among ct4l entities.
For example, warnings and errors in a parsing procedure are communicated to the caller via message objects. Also, any implementation of the Observer pattern or any other notification mechanism must exchange message objects.
Each kind of message extends the class ct4l::Message,
which allows for the following data to be stored in its instances:
code: an element of
ct4l::MessageCode, indicating a category to which the message belongstype: the type of the message, also indicating its priority, being an element of
ct4l::Message::Levelshort_text: a short description (or the subject) of the message
details: an optional detailed description
Message with column/row location¶
The class ct4l::RowColMessage represents messages
containing an indication of the row and column (whose meanings are given by the context)
they refer to. For example, when parsing a formula, a parser may produce
messages with the location of the exact row and column in which a parsing error or warning has occurred.
API¶
-
class
ct4l::Message¶ An interface to a message that is emmited by an algorithm.
- Author
Vitor Greati
Subclassed by ct4l::RowColMessage
Public Types
Public Functions
-
virtual
~Message()¶ Virtual destructor.
-
Message(decltype(_code) code, decltype(_level) level, const decltype(_short_text) &short_text, const decltype(_details) &details)¶ Full constructor.
-
Message(decltype(_code) code, decltype(_level) level, const decltype(_short_text) &short_text)¶ Simpler constructor, not taking a detailed message.
-
inline decltype(_code)
code() const¶ The message code.
- Return
the message code
-
inline decltype(_level)
level() const¶ The message level.
- Return
the message level
-
inline decltype(_short_text)
short_text() const¶ The short text of the message.
A brief description, if more details are to be provided.
- Return
short text message
-
inline decltype(_details)
details() const¶ Details given to the message.
- Return
message details
-
virtual std::string
to_str() const¶ Provide a string representation of the message.
- Return
a string representation of the message
-
enum
ct4l::MessageCode¶ Codes for messages.
Values:
-
enumerator
FMLA_PARSER_MESSAGE¶
-
enumerator
FMLA_LEXER_MESSAGE¶
-
enumerator
-
class
ct4l::RowColMessage: public ct4l::Message¶ A message that makes specific reference to a row and a column in a given context.
- Author
Vitor Greati
Public Functions
-
RowColMessage(MessageCode code, Level level, const std::string &short_text, decltype(_location) location)¶ Basic constructor.
-
inline decltype(_location)
location() const¶ The location (row,col) associated to this message.
- Return
a partir (row,col)
-
virtual std::string
to_str() const override¶ The string representation of the message.