OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
messages.hpp
Go to the documentation of this file.
1 #ifndef CSM_DOC_MESSAGES_H
2 #define CSM_DOC_MESSAGES_H
3 
4 #include <string>
5 #include <vector>
6 
7 #include <QMetaType>
8 
9 #include "../world/universalid.hpp"
10 
11 namespace CSMDoc
12 {
13  struct Message
14  {
15  enum Severity
16  {
17  Severity_Info = 0, // no problem
18  Severity_Warning = 1, // a potential problem, but we are probably fine
19  Severity_Error = 2, // an error; we are not fine
20  Severity_SeriousError = 3, // an error so bad we can't even be sure if we are
21  // reporting it correctly
23  };
24 
26  std::string mMessage;
27  std::string mHint;
29 
30  Message();
31 
32  Message (const CSMWorld::UniversalId& id, const std::string& message,
33  const std::string& hint, Severity severity);
34 
35  static std::string toString (Severity severity);
36  };
37 
38  class Messages
39  {
40  public:
41 
42  typedef std::vector<Message> Collection;
43 
44  typedef Collection::const_iterator Iterator;
45 
46  private:
47 
50 
51  public:
52 
53  Messages (Message::Severity default_);
54 
55  void add (const CSMWorld::UniversalId& id, const std::string& message,
56  const std::string& hint = "",
58 
60  void push_back (const std::pair<CSMWorld::UniversalId, std::string>& data);
61 
62  Iterator begin() const;
63 
64  Iterator end() const;
65  };
66 }
67 
68 Q_DECLARE_METATYPE (CSMDoc::Message)
69 
70 #endif
Iterator begin() const
Definition: messages.cpp:43
void message(CodeContainer &code, Literals &literals, const std::string &message, int buttons)
Definition: generator.cpp:537
static std::string toString(Severity severity)
Definition: messages.cpp:10
Definition: messages.hpp:18
Iterator end() const
Definition: messages.cpp:48
Collection mMessages
Definition: messages.hpp:48
Definition: messages.hpp:17
Definition: messages.hpp:13
void add(const CSMWorld::UniversalId &id, const std::string &message, const std::string &hint="", Message::Severity severity=Message::Severity_Default)
Definition: messages.cpp:29
Definition: messages.hpp:38
std::string mHint
Definition: messages.hpp:27
Definition: messages.hpp:22
Severity mSeverity
Definition: messages.hpp:28
Collection::const_iterator Iterator
Definition: messages.hpp:44
void push_back(const std::pair< CSMWorld::UniversalId, std::string > &data)
Definition: messages.cpp:38
Definition: messages.hpp:20
CSMWorld::UniversalId mId
Definition: messages.hpp:25
Severity
Definition: messages.hpp:15
std::vector< Message > Collection
Definition: messages.hpp:42
Message()
Definition: messages.cpp:3
std::string mMessage
Definition: messages.hpp:26
Message::Severity mDefault
Definition: messages.hpp:49
Messages(Message::Severity default_)
Definition: messages.cpp:25
Definition: messages.hpp:19
Definition: universalid.hpp:12