1 #ifndef MESSAGEFACILITY_EXTENSIONS_QT_MF_MSG_H
2 #define MESSAGEFACILITY_EXTENSIONS_QT_MF_MSG_H
7 #include <QtCore/QString>
8 #include <QtGui/QColor>
16 #include "messagefacility/Utilities/ELseverityLevel.h"
47 qt_mf_msg(std::string hostname, std::string category, std::string application, pid_t pid, timeval
time);
62 QString
const&
text(
bool mode)
const {
return mode ? shortText_ : text_; }
67 QColor
const&
color()
const {
return color_; }
72 sev_code_t
sev()
const {
return sev_; }
77 QString
const&
host()
const {
return host_; }
82 QString
const&
cat()
const {
return cat_; }
87 QString
const&
app()
const {
return app_; }
92 timeval
time()
const {
return time_; }
97 size_t seq()
const {
return seq_; }
115 void setMessage(std::string prefix,
int iteration, std::string msg);
120 void setHostAddr(std::string hostaddr) { hostaddr_ = QString(hostaddr.c_str()).toHtmlEscaped(); }
125 void setFileName(std::string file) { file_ = QString(file.c_str()).toHtmlEscaped(); }
130 void setLineNumber(std::string line) { line_ = QString(line.c_str()).toHtmlEscaped(); }
135 void setModule(std::string module) { module_ = QString(module.c_str()).toHtmlEscaped(); }
140 void setEventID(std::string eventID) { eventID_ = QString(eventID.c_str()).toHtmlEscaped(); }
157 static size_t sequence;
160 QString application_;
174 typedef std::list<qt_mf_msg> msgs_t;
210 msgs_t::iterator
get()
const {
return iter_; };
213 msgs_t::iterator iter_;
220 typedef std::list<msg_iter_t> msg_iters_t;
224 typedef std::map<QString, msg_iters_t> msg_iters_map_t;
QString const & app() const
Get the application of the message
void updateText()
Parse fields and create HTML string representing message
void setEventID(std::string eventID)
Set the Event ID of the message
timeval time() const
Get the message timestamp
size_t seq() const
Get the sequence number of the message
void setFileName(std::string file)
Set the file name field
Qt wrapper around MessageFacility message
sev_code_t sev() const
Get the severity of the message
void setSeverityLevel(sev_code_t sev)
Set the severity code of the message (Viewer levels)
msg_iter_t(msgs_t::iterator it)
Construct a msg_iter_t
QString const & host() const
Get the host from which the message came
void setMessage(std::string prefix, int iteration, std::string msg)
Set the message
bool operator<(msg_iter_t const &other) const
Comparison operator, based on message sequence number
Iterator for the msgs_t type
qt_mf_msg()
Default message constructor.
void setSeverity(mf::ELseverityLevel sev)
Set the Severity of the message (MF levels)
void setHostAddr(std::string hostaddr)
Set the hostaddr field
QString const & text(bool mode) const
Get the text of the message
void setLineNumber(std::string line)
Set the line number field
QString const & cat() const
Get the category of the message
bool operator==(msg_iter_t const &other) const
Equality operator. Equality is based on the message's sequence number
void setModule(std::string module)
Set the module name
QColor const & color() const
Get the severity-based color of the message