2014-12-07 17:57:47 +00:00
|
|
|
#include "messages.hpp"
|
|
|
|
|
2015-06-20 15:56:42 +00:00
|
|
|
CSMDoc::Message::Message() {}
|
|
|
|
|
2015-06-20 14:55:34 +00:00
|
|
|
CSMDoc::Message::Message (const CSMWorld::UniversalId& id, const std::string& message,
|
2015-06-20 17:04:19 +00:00
|
|
|
const std::string& hint, Severity severity)
|
|
|
|
: mId (id), mMessage (message), mHint (hint), mSeverity (severity)
|
2015-06-20 14:55:34 +00:00
|
|
|
{}
|
|
|
|
|
2015-07-16 12:46:02 +00:00
|
|
|
std::string CSMDoc::Message::toString (Severity severity)
|
|
|
|
{
|
|
|
|
switch (severity)
|
|
|
|
{
|
|
|
|
case CSMDoc::Message::Severity_Info: return "Information";
|
|
|
|
case CSMDoc::Message::Severity_Warning: return "Warning";
|
|
|
|
case CSMDoc::Message::Severity_Error: return "Error";
|
|
|
|
case CSMDoc::Message::Severity_SeriousError: return "Serious Error";
|
|
|
|
case CSMDoc::Message::Severity_Default: break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2015-06-20 14:55:34 +00:00
|
|
|
|
2015-06-20 17:46:38 +00:00
|
|
|
CSMDoc::Messages::Messages (Message::Severity default_)
|
2015-06-20 17:04:19 +00:00
|
|
|
: mDefault (default_)
|
|
|
|
{}
|
|
|
|
|
2014-12-07 17:57:47 +00:00
|
|
|
void CSMDoc::Messages::add (const CSMWorld::UniversalId& id, const std::string& message,
|
2015-06-20 17:04:19 +00:00
|
|
|
const std::string& hint, Message::Severity severity)
|
2014-12-07 17:57:47 +00:00
|
|
|
{
|
2015-06-20 17:04:19 +00:00
|
|
|
if (severity==Message::Severity_Default)
|
|
|
|
severity = mDefault;
|
2015-07-16 12:46:02 +00:00
|
|
|
|
2015-06-20 17:04:19 +00:00
|
|
|
mMessages.push_back (Message (id, message, hint, severity));
|
2014-12-07 17:57:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CSMDoc::Messages::push_back (const std::pair<CSMWorld::UniversalId, std::string>& data)
|
|
|
|
{
|
|
|
|
add (data.first, data.second);
|
|
|
|
}
|
|
|
|
|
|
|
|
CSMDoc::Messages::Iterator CSMDoc::Messages::begin() const
|
|
|
|
{
|
|
|
|
return mMessages.begin();
|
|
|
|
}
|
|
|
|
|
|
|
|
CSMDoc::Messages::Iterator CSMDoc::Messages::end() const
|
|
|
|
{
|
|
|
|
return mMessages.end();
|
2015-03-11 14:54:45 +00:00
|
|
|
}
|