diff options
Diffstat (limited to 'api/logic/ProblemProvider.h')
-rw-r--r-- | api/logic/ProblemProvider.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/api/logic/ProblemProvider.h b/api/logic/ProblemProvider.h new file mode 100644 index 00000000..64a31c59 --- /dev/null +++ b/api/logic/ProblemProvider.h @@ -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; +}; |