PorygonLang/src/Diagnostics/DiagnosticsHolder.hpp

44 lines
1.1 KiB
C++

#ifndef PORYGONLANG_DIAGNOSTICSHOLDER_HPP
#define PORYGONLANG_DIAGNOSTICSHOLDER_HPP
#include <vector>
#include "DiagnosticSeverity.hpp"
#include "DiagnosticCode.hpp"
#include "Diagnostic.hpp"
using namespace std;
namespace Porygon::Diagnostics {
class DiagnosticsHolder {
bool _hasErrors;
vector<Diagnostic> _diagnostics;
public:
DiagnosticsHolder() {
_hasErrors = false;
}
~DiagnosticsHolder() {
_diagnostics.clear();
}
void Log(DiagnosticSeverity severity, DiagnosticCode code, unsigned int start, unsigned int length);
void LogError(DiagnosticCode code, unsigned int start, unsigned int length);
void LogWarning(DiagnosticCode code, unsigned int start, unsigned int length);
void LogInfo(DiagnosticCode code, unsigned int start, unsigned int length);
bool HasErrors();
vector<Diagnostic> GetDiagnostics();
int DiagnosticsCount();
Diagnostic *GetDiagnosticAt(int position);
};
}
#endif //PORYGONLANG_DIAGNOSTICSHOLDER_HPP