Sen API
Sen Libraries
Loading...
Searching...
No Matches
error_reporter.h
Go to the documentation of this file.
1// === error_reporter.h ================================================================================================
2// Sen Infrastructure
3// Released under the Apache License v2.0 (SPDX-License-Identifier Apache-2.0).
4// See the LICENSE.txt file for more information.
5// © Airbus SAS, Airbus Helicopters, and Airbus Defence and Space SAU/GmbH/SAS.
6// =====================================================================================================================
7
8#ifndef SEN_CORE_LANG_ERROR_REPORTER_H
9#define SEN_CORE_LANG_ERROR_REPORTER_H
10
11#include "code_location.h"
12
13// std
14#include <cstddef>
15#include <functional>
16#include <string>
17
18namespace sen::lang
19{
20
23
26{
27public:
29 using ReportFunc = std::function<void(const CodeLocation&, const std::string&, std::size_t, bool isWarning)>;
30
36 static void report(const CodeLocation& loc,
37 const std::string& message,
38 std::size_t width = 0U,
39 bool isWarning = false);
40};
41
43
44} // namespace sen::lang
45
46#endif // SEN_CORE_LANG_ERROR_REPORTER_H
Utility class for reporting errors in the source code.
Definition error_reporter.h:26
std::function< void(const CodeLocation &, const std::string &, std::size_t, bool isWarning)> ReportFunc
A function that reports the error to some sink.
Definition error_reporter.h:29
static void report(const CodeLocation &loc, const std::string &message, std::size_t width=0U, bool isWarning=false)
Reports an error using the defined function.
Location of a character in a program.
Definition code_location.h:21
Definition code_location.h:14