Closes #13
This commit is contained in:
1 parent
bce707daf6
commit
51fcdb88ac
174 files changed
+5220
-2213
No files matched your search
@@ -3,7 +3,9 @@
|
||||
#define DBC_STATEMENT_HANDLER_H
|
||||
|
||||
#include "dbc_database.h"
|
||||
#include "dbc_diagnostic.h"
|
||||
#include "typefactory.h"
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
@@ -15,6 +17,17 @@ struct PendingValueDescriptions {
|
||||
std::size_t lineNumber;
|
||||
};
|
||||
|
||||
/** Carries deferred validation locations without parsing exception text. */
|
||||
class DbcDiagnosticError : public std::runtime_error {
|
||||
public:
|
||||
DbcDiagnosticError(DbcDiagnosticCode code, const std::string &filePath,
|
||||
std::size_t lineNumber, const std::string &message)
|
||||
: std::runtime_error(filePath + ":" + std::to_string(lineNumber) + ": " + message),
|
||||
diagnostic{DbcDiagnosticSeverity::Error, code, filePath, lineNumber, message} {}
|
||||
|
||||
DbcDiagnostic diagnostic;
|
||||
};
|
||||
|
||||
/** Mutable state belonging to one file parse. Handlers do not retain it. */
|
||||
struct DbcParseContext {
|
||||
DbcDatabase &database;
|
||||
@@ -68,6 +81,12 @@ public:
|
||||
void Handle(const std::string &line, DbcParseContext &context) const override;
|
||||
};
|
||||
|
||||
/** Common header metadata does not change the supported decode definitions. */
|
||||
class DbcHeaderHandler : public DbcStatementHandler {
|
||||
public:
|
||||
void Handle(const std::string &line, DbcParseContext &context) const override;
|
||||
};
|
||||
|
||||
/** Exact-key dispatch to handlers created once per registration via TypeFactory. */
|
||||
class DbcStatementDispatcher {
|
||||
public:
|
||||
|
||||
Reference in new issue
Block a user