46 lines
1.3 KiB
C++
46 lines
1.3 KiB
C++
#include "Diagnostics.hpp"
|
|
|
|
vector<Diagnostic> Diagnostics::GetDiagnostics() {
|
|
return _diagnostics;
|
|
}
|
|
|
|
void Diagnostics::Log(DiagnosticSeverity severity, DiagnosticCode code, unsigned int start, unsigned int length) {
|
|
_diagnostics.emplace_back(severity, code, start, length);
|
|
if (severity >= DiagnosticSeverity::Error){
|
|
_hasErrors = true;
|
|
}
|
|
}
|
|
|
|
void Diagnostics::LogError(DiagnosticCode code, unsigned int start, unsigned int length) {
|
|
Log(DiagnosticSeverity::Error, code, start, length);
|
|
}
|
|
|
|
void Diagnostics::LogWarning(DiagnosticCode code, unsigned int start, unsigned int length) {
|
|
Log(DiagnosticSeverity::Warning, code, start, length);
|
|
}
|
|
|
|
void Diagnostics::LogInfo(DiagnosticCode code, unsigned int start, unsigned int length) {
|
|
Log(DiagnosticSeverity::Info, code, start, length);
|
|
}
|
|
|
|
bool Diagnostics::HasErrors() {
|
|
return _hasErrors;
|
|
}
|
|
|
|
int Diagnostics::DiagnosticsCount() {
|
|
return _diagnostics.size();
|
|
}
|
|
|
|
Diagnostic *Diagnostics::GetDiagnosticAt(int position) {
|
|
return &_diagnostics[position];
|
|
}
|
|
|
|
extern "C" int GetDiagnosticsCount (Diagnostics* diagnostics){
|
|
return diagnostics->DiagnosticsCount();
|
|
}
|
|
|
|
extern "C" Diagnostic* GetDiagnosticAt(Diagnostics* diagnostics, int position){
|
|
return diagnostics->GetDiagnosticAt(position);
|
|
}
|
|
|