1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-24 09:23:53 +00:00
openmw/apps/opencs/model/doc/messages.cpp

61 lines
1.4 KiB
C++
Raw Normal View History

#include "messages.hpp"
2022-10-19 17:02:00 +00:00
#include <apps/opencs/model/world/universalid.hpp>
2022-09-22 18:26:05 +00:00
CSMDoc::Message::Message()
: mSeverity(Severity_Default)
{
}
2022-09-22 18:26:05 +00:00
CSMDoc::Message::Message(
const CSMWorld::UniversalId& id, const std::string& message, const std::string& hint, Severity severity)
: mId(id)
, mMessage(message)
, mHint(hint)
, mSeverity(severity)
{
}
2022-09-22 18:26:05 +00:00
std::string CSMDoc::Message::toString(Severity severity)
{
switch (severity)
{
2022-09-22 18:26:05 +00:00
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 "";
}
2022-09-22 18:26:05 +00:00
CSMDoc::Messages::Messages(Message::Severity default_)
: mDefault(default_)
{
}
2022-09-22 18:26:05 +00:00
void CSMDoc::Messages::add(
const CSMWorld::UniversalId& id, const std::string& message, const std::string& hint, Message::Severity severity)
{
2022-09-22 18:26:05 +00:00
if (severity == Message::Severity_Default)
severity = mDefault;
2022-09-22 18:26:05 +00:00
mMessages.push_back(Message(id, message, hint, severity));
}
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
}