NOISSUE Rough refactor of ProfilePatch and VersionFile internals.
They are now distinct classes with distinct responsibilities. * ProfilePatch is an entry in MinecraftProfile and can hold VersionFile or Meta::Version. * VersionFile is the basic element that holds version information loaded from JSON. * Meta::Version is the loader class for VersionFile(s) from a server.
This commit is contained in:
54
api/logic/ProblemProvider.h
Normal file
54
api/logic/ProblemProvider.h
Normal file
@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
enum class ProblemSeverity
|
||||
{
|
||||
None,
|
||||
Warning,
|
||||
Error
|
||||
};
|
||||
|
||||
class PatchProblem
|
||||
{
|
||||
public:
|
||||
PatchProblem(ProblemSeverity severity, const QString & description)
|
||||
{
|
||||
m_severity = severity;
|
||||
m_description = description;
|
||||
}
|
||||
const QString & getDescription() const
|
||||
{
|
||||
return m_description;
|
||||
}
|
||||
const ProblemSeverity getSeverity() const
|
||||
{
|
||||
return m_severity;
|
||||
}
|
||||
private:
|
||||
ProblemSeverity m_severity;
|
||||
QString m_description;
|
||||
};
|
||||
|
||||
class ProblemProvider
|
||||
{
|
||||
public:
|
||||
virtual const QList<PatchProblem>& getProblems()
|
||||
{
|
||||
return m_problems;
|
||||
}
|
||||
virtual void addProblem(ProblemSeverity severity, const QString &description)
|
||||
{
|
||||
if(severity > m_problemSeverity)
|
||||
{
|
||||
m_problemSeverity = severity;
|
||||
}
|
||||
m_problems.append(PatchProblem(severity, description));
|
||||
}
|
||||
virtual ProblemSeverity getProblemSeverity()
|
||||
{
|
||||
return m_problemSeverity;
|
||||
}
|
||||
|
||||
private:
|
||||
QList<PatchProblem> m_problems;
|
||||
ProblemSeverity m_problemSeverity = ProblemSeverity::None;
|
||||
};
|
Reference in New Issue
Block a user