Closes #13
This commit is contained in:
1 parent
bce707daf6
commit
51fcdb88ac
174 files changed
+5220
-2213
No files matched your search
@@ -0,0 +1,46 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
#ifndef DBC_DIAGNOSTIC_H
|
||||
#define DBC_DIAGNOSTIC_H
|
||||
|
||||
#include "dbc_database.h"
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
enum class DbcDiagnosticSeverity {
|
||||
Warning,
|
||||
Error
|
||||
};
|
||||
|
||||
/** Stable categories; messages provide the details. */
|
||||
enum class DbcDiagnosticCode {
|
||||
FileOpenError,
|
||||
FileReadError,
|
||||
InvalidStatement,
|
||||
InvalidValueDescription,
|
||||
InvalidMultiplexing,
|
||||
UnsupportedStatement
|
||||
};
|
||||
|
||||
struct DbcDiagnostic {
|
||||
DbcDiagnosticSeverity severity;
|
||||
DbcDiagnosticCode code;
|
||||
std::string filePath;
|
||||
std::size_t lineNumber; // One-based physical line; zero for file-level errors.
|
||||
std::string message;
|
||||
};
|
||||
|
||||
struct DbcParseResult {
|
||||
DbcDatabase database;
|
||||
std::vector<DbcDiagnostic> diagnostics;
|
||||
|
||||
bool HasErrors() const {
|
||||
for (const DbcDiagnostic &diagnostic : diagnostics) {
|
||||
if (diagnostic.severity == DbcDiagnosticSeverity::Error)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* DBC_DIAGNOSTIC_H */
|
||||
Reference in new issue
Block a user