1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-02 10:45:34 +00:00
openmw/apps/opencs/model/doc/messages.hpp

65 lines
1.5 KiB
C++
Raw Normal View History

#ifndef CSM_DOC_MESSAGES_H
#define CSM_DOC_MESSAGES_H
2022-10-19 17:02:00 +00:00
#include <QMetaType>
#include <algorithm>
#include <string>
#include <vector>
#include "../world/universalid.hpp"
namespace CSMDoc
{
struct Message
{
enum Severity
{
2022-09-22 18:26:05 +00:00
Severity_Info = 0, // no problem
Severity_Warning = 1, // a potential problem, but we are probably fine
Severity_Error = 2, // an error; we are not fine
Severity_SeriousError = 3, // an error so bad we can't even be sure if we are
// reporting it correctly
Severity_Default = 4
};
CSMWorld::UniversalId mId;
std::string mMessage;
std::string mHint;
Severity mSeverity;
Message();
2022-09-22 18:26:05 +00:00
Message(
const CSMWorld::UniversalId& id, const std::string& message, const std::string& hint, Severity severity);
2022-09-22 18:26:05 +00:00
static std::string toString(Severity severity);
};
class Messages
{
2022-09-22 18:26:05 +00:00
public:
typedef std::vector<Message> Collection;
2022-09-22 18:26:05 +00:00
typedef Collection::const_iterator Iterator;
2022-09-22 18:26:05 +00:00
private:
Collection mMessages;
Message::Severity mDefault;
2022-09-22 18:26:05 +00:00
public:
Messages(Message::Severity default_);
2022-09-22 18:26:05 +00:00
void add(const CSMWorld::UniversalId& id, const std::string& message, const std::string& hint = "",
Message::Severity severity = Message::Severity_Default);
2022-09-22 18:26:05 +00:00
Iterator begin() const;
2022-09-22 18:26:05 +00:00
Iterator end() const;
};
}
2022-09-22 18:26:05 +00:00
Q_DECLARE_METATYPE(CSMDoc::Message)
#endif