2019-06-18 17:56:47 +00:00
|
|
|
#include <utility>
|
|
|
|
|
2019-05-21 11:56:08 +00:00
|
|
|
|
|
|
|
#ifndef PORYGONLANG_DIAGNOSTIC_HPP
|
|
|
|
#define PORYGONLANG_DIAGNOSTIC_HPP
|
|
|
|
|
2019-06-18 17:56:47 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
2019-05-21 11:56:08 +00:00
|
|
|
#include "DiagnosticSeverity.hpp"
|
|
|
|
#include "DiagnosticCode.hpp"
|
|
|
|
|
2019-06-18 14:39:36 +00:00
|
|
|
namespace Porygon::Diagnostics {
|
|
|
|
class Diagnostic {
|
|
|
|
DiagnosticSeverity _severity;
|
|
|
|
DiagnosticCode _code;
|
|
|
|
unsigned int _start;
|
|
|
|
unsigned int _length;
|
2019-06-18 17:56:47 +00:00
|
|
|
std::vector<std::string> _arguments;
|
2019-06-19 13:49:44 +00:00
|
|
|
std::string* _message;
|
2019-06-18 14:39:36 +00:00
|
|
|
public:
|
2019-07-04 16:24:49 +00:00
|
|
|
Diagnostic(DiagnosticSeverity severity, DiagnosticCode code, unsigned int start, unsigned int length, std::vector<std::string> arguments)
|
|
|
|
: _severity(severity), _code(code), _start(start), _length(length), _arguments(std::move(arguments)), _message(
|
|
|
|
nullptr)
|
|
|
|
{
|
2019-06-19 13:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
~Diagnostic(){
|
|
|
|
delete _message;
|
2019-06-18 14:39:36 +00:00
|
|
|
}
|
2019-05-21 13:11:00 +00:00
|
|
|
|
2019-07-04 17:08:13 +00:00
|
|
|
inline DiagnosticSeverity GetSeverity() {
|
2019-06-18 14:39:36 +00:00
|
|
|
return _severity;
|
|
|
|
}
|
2019-05-21 13:11:00 +00:00
|
|
|
|
2019-07-04 17:08:13 +00:00
|
|
|
inline DiagnosticCode GetCode() {
|
2019-06-18 14:39:36 +00:00
|
|
|
return _code;
|
|
|
|
}
|
2019-05-21 13:11:00 +00:00
|
|
|
|
2019-07-04 17:08:13 +00:00
|
|
|
inline unsigned int GetStartPosition() {
|
2019-06-18 14:39:36 +00:00
|
|
|
return _start;
|
|
|
|
}
|
2019-05-21 11:56:08 +00:00
|
|
|
|
2019-07-04 17:08:13 +00:00
|
|
|
inline unsigned int GetLength() {
|
2019-06-18 14:39:36 +00:00
|
|
|
return _length;
|
|
|
|
}
|
2019-06-18 17:56:47 +00:00
|
|
|
|
2019-07-04 17:08:13 +00:00
|
|
|
inline std::vector<std::string> GetArguments(){
|
2019-06-18 17:56:47 +00:00
|
|
|
return _arguments;
|
|
|
|
}
|
2019-06-19 13:49:44 +00:00
|
|
|
|
2019-07-04 17:08:13 +00:00
|
|
|
inline void SetMessage(std::string* s){
|
2019-06-19 13:49:44 +00:00
|
|
|
this -> _message = s;
|
|
|
|
}
|
|
|
|
|
2019-07-04 17:08:13 +00:00
|
|
|
inline std::string* GetMessage(){
|
2019-06-19 13:49:44 +00:00
|
|
|
return _message;
|
|
|
|
}
|
2019-06-18 14:39:36 +00:00
|
|
|
};
|
|
|
|
}
|
2019-05-21 11:56:08 +00:00
|
|
|
#endif //PORYGONLANG_DIAGNOSTIC_HPP
|