-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add light-weight message class. Refs #6202
- Loading branch information
1 parent
b1b586a
commit 90ec027
Showing
3 changed files
with
66 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#ifndef MESSAGE_H_ | ||
#define MESSAGE_H_ | ||
|
||
//---------------------------------- | ||
// Includes | ||
//---------------------------------- | ||
#include <QObject> | ||
#include <QString> | ||
|
||
#include "MantidKernel/ClassMacros.h" | ||
#include "MantidKernel/Logger.h" // So we can match the Logger priority | ||
|
||
//---------------------------------------------------------- | ||
// Forward declarations | ||
//---------------------------------------------------------- | ||
|
||
namespace MantidQt | ||
{ | ||
namespace API | ||
{ | ||
/** @class Message | ||
* Provides a simple binding of a text message with a priority | ||
*/ | ||
class Message : public QObject | ||
{ | ||
// No Q_Object macro by design | ||
|
||
public: | ||
/// Priority matches Mantid Logger priority | ||
typedef Mantid::Kernel::Logger::Priority Priority; | ||
|
||
/// Construct a message from a string with a given priority (default=notice) | ||
Message(const QString & text, Priority priority=Priority::PRIO_NOTICE) | ||
: m_text(text), m_priority(priority) | ||
{} | ||
|
||
public: | ||
|
||
/// @returns The message text | ||
inline QString text() const {return m_text;} | ||
/// @returns The message priority | ||
inline Priority priority() const {return m_priority;} | ||
|
||
private: | ||
DISABLE_DEFAULT_CONSTRUCT(Message); | ||
|
||
QString m_text; | ||
Priority m_priority; | ||
}; | ||
|
||
} | ||
} | ||
|
||
#endif //MESSAGE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters