UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
hds_messenger.hpp
1 /* hds_messenger.hpp */
2 /* $Id$ */
3 #ifndef __hds_messenger_hpp
4 #define __hds_messenger_hpp
5 
6 #include <QString>
7 #include <QVariant>
8 
9 #include <hds_batch/defines.hpp>
10 #include <hds_batch/errors.hpp>
11 
13 namespace hds
14 {
16  class Messenger
17  {
18  public:
19 
21  enum MsgType
22  {
35  };
36 
38  struct Message
39  {
40  Message():
42  Message(const MsgType &itype, const QVariant &idata):
43  type(itype), data(idata){;}
44 
46  QVariant data;
49  void info() const;
50  };
51 
53  Messenger();
54 
56  virtual ~Messenger();
57 
58 
61  virtual void sendMsg(const Message &msg) const = 0;
62 
66  virtual Message getMsg() const = 0;
67 
68 
70  void info(const QString &str) const
71  {sendMsg(Message(INFO_MSG, str));}
72 
74  void warning(const QString &str) const
75  {sendMsg(Message(WARNING_MSG, str));}
76 
78  void error(const QString &str) const
79  {sendMsg(Message(ERROR_MSG, str));}
80 
82  void debug(const QString &str) const
83  {sendMsg(Message(DEBUG_MSG, str));}
84  };
85 };
86 
87 #endif /* hds_messenger.hpp */
Definition: hds_messenger.hpp:33
Definition: hds_messenger.hpp:30
Definition: hds_messenger.hpp:31
MsgType type
Definition: hds_messenger.hpp:45
void info(const QString &str) const
Definition: hds_messenger.hpp:70
void error(const QString &str) const
Definition: hds_messenger.hpp:78
virtual void sendMsg(const Message &msg) const =0
Definition: hds_messenger.hpp:32
QVariant data
Definition: hds_messenger.hpp:46
Definition: hds_messenger.hpp:26
Definition: hds_messenger.hpp:25
virtual Message getMsg() const =0
void warning(const QString &str) const
Definition: hds_messenger.hpp:74
Definition: hds_messenger.hpp:23
MsgType
Definition: hds_messenger.hpp:21
void debug(const QString &str) const
Definition: hds_messenger.hpp:82
Definition: hds_messenger.hpp:28
Definition: hds_messenger.hpp:16
Definition: hds_messenger.hpp:34
virtual ~Messenger()
Definition: hds_messenger.hpp:27
Definition: hds_messenger.hpp:38