This commit is contained in:
45
src/Diagnostics/DiagnosticsHolder.cpp
Normal file
45
src/Diagnostics/DiagnosticsHolder.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#include "DiagnosticsHolder.hpp"
|
||||
|
||||
vector<Diagnostic> DiagnosticsHolder::GetDiagnostics() {
|
||||
return _diagnostics;
|
||||
}
|
||||
|
||||
void DiagnosticsHolder::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 DiagnosticsHolder::LogError(DiagnosticCode code, unsigned int start, unsigned int length) {
|
||||
Log(DiagnosticSeverity::Error, code, start, length);
|
||||
}
|
||||
|
||||
void DiagnosticsHolder::LogWarning(DiagnosticCode code, unsigned int start, unsigned int length) {
|
||||
Log(DiagnosticSeverity::Warning, code, start, length);
|
||||
}
|
||||
|
||||
void DiagnosticsHolder::LogInfo(DiagnosticCode code, unsigned int start, unsigned int length) {
|
||||
Log(DiagnosticSeverity::Info, code, start, length);
|
||||
}
|
||||
|
||||
bool DiagnosticsHolder::HasErrors() {
|
||||
return _hasErrors;
|
||||
}
|
||||
|
||||
int DiagnosticsHolder::DiagnosticsCount() {
|
||||
return _diagnostics.size();
|
||||
}
|
||||
|
||||
Diagnostic *DiagnosticsHolder::GetDiagnosticAt(int position) {
|
||||
return &_diagnostics[position];
|
||||
}
|
||||
|
||||
extern "C" int GetDiagnosticsCount (DiagnosticsHolder* diagnostics){
|
||||
return diagnostics->DiagnosticsCount();
|
||||
}
|
||||
|
||||
extern "C" Diagnostic* GetDiagnosticAt(DiagnosticsHolder* diagnostics, int position){
|
||||
return diagnostics->GetDiagnosticAt(position);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user