1 #include "messages.hpp"
2
Message()3 CSMDoc::Message::Message() : mSeverity(Severity_Default){}
4
Message(const CSMWorld::UniversalId & id,const std::string & message,const std::string & hint,Severity severity)5 CSMDoc::Message::Message (const CSMWorld::UniversalId& id, const std::string& message,
6 const std::string& hint, Severity severity)
7 : mId (id), mMessage (message), mHint (hint), mSeverity (severity)
8 {}
9
toString(Severity severity)10 std::string CSMDoc::Message::toString (Severity severity)
11 {
12 switch (severity)
13 {
14 case CSMDoc::Message::Severity_Info: return "Information";
15 case CSMDoc::Message::Severity_Warning: return "Warning";
16 case CSMDoc::Message::Severity_Error: return "Error";
17 case CSMDoc::Message::Severity_SeriousError: return "Serious Error";
18 case CSMDoc::Message::Severity_Default: break;
19 }
20
21 return "";
22 }
23
24
Messages(Message::Severity default_)25 CSMDoc::Messages::Messages (Message::Severity default_)
26 : mDefault (default_)
27 {}
28
add(const CSMWorld::UniversalId & id,const std::string & message,const std::string & hint,Message::Severity severity)29 void CSMDoc::Messages::add (const CSMWorld::UniversalId& id, const std::string& message,
30 const std::string& hint, Message::Severity severity)
31 {
32 if (severity==Message::Severity_Default)
33 severity = mDefault;
34
35 mMessages.push_back (Message (id, message, hint, severity));
36 }
37
begin() const38 CSMDoc::Messages::Iterator CSMDoc::Messages::begin() const
39 {
40 return mMessages.begin();
41 }
42
end() const43 CSMDoc::Messages::Iterator CSMDoc::Messages::end() const
44 {
45 return mMessages.end();
46 }
47