PorygonLang/src/Diagnostics/DiagnosticsHolder.hpp

40 lines
971 B
C++
Raw Normal View History

2019-05-21 11:56:08 +00:00
2019-06-06 17:01:54 +00:00
#ifndef PORYGONLANG_DIAGNOSTICSHOLDER_HPP
#define PORYGONLANG_DIAGNOSTICSHOLDER_HPP
2019-05-21 11:56:08 +00:00
#include <vector>
#include "DiagnosticSeverity.hpp"
#include "DiagnosticCode.hpp"
#include "Diagnostic.hpp"
using namespace std;
2019-06-06 17:01:54 +00:00
class DiagnosticsHolder {
2019-05-21 11:56:08 +00:00
bool _hasErrors;
vector<Diagnostic> _diagnostics;
public:
2019-06-06 17:01:54 +00:00
DiagnosticsHolder(){
2019-05-21 11:56:08 +00:00
_hasErrors = false;
}
2019-06-06 17:01:54 +00:00
~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);
2019-05-21 11:56:08 +00:00
bool HasErrors();
2019-05-21 11:56:08 +00:00
vector<Diagnostic> GetDiagnostics();
2019-05-21 11:56:08 +00:00
int DiagnosticsCount();
Diagnostic* GetDiagnosticAt(int position);
2019-05-21 11:56:08 +00:00
};
2019-06-06 17:01:54 +00:00
#endif //PORYGONLANG_DIAGNOSTICSHOLDER_HPP