Work to add C style entry points to library that allow most functionality
This commit is contained in:
45
src/Diagnostics/Diagnostics.cpp
Normal file
45
src/Diagnostics/Diagnostics.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#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);
|
||||
}
|
||||
|
||||
@@ -21,31 +21,18 @@ public:
|
||||
_diagnostics.clear();
|
||||
}
|
||||
|
||||
void 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 LogError(DiagnosticCode code, unsigned int start, unsigned int length){
|
||||
Log(DiagnosticSeverity::Error, code, start, length);
|
||||
}
|
||||
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);
|
||||
|
||||
void LogWarning(DiagnosticCode code, unsigned int start, unsigned int length){
|
||||
Log(DiagnosticSeverity::Warning, code, start, length);
|
||||
}
|
||||
bool HasErrors();
|
||||
|
||||
void LogInfo(DiagnosticCode code, unsigned int start, unsigned int length){
|
||||
Log(DiagnosticSeverity::Info, code, start, length);
|
||||
}
|
||||
vector<Diagnostic> GetDiagnostics();
|
||||
|
||||
bool HasErrors(){
|
||||
return _hasErrors;
|
||||
}
|
||||
int DiagnosticsCount();
|
||||
|
||||
vector<Diagnostic> GetDiagnostics(){
|
||||
return _diagnostics;
|
||||
}
|
||||
Diagnostic* GetDiagnosticAt(int position);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user