Blaze 0.0.1
The ultra high-performance JSON Schema evaluator
Loading...
Searching...
No Matches
binpack_error.h
1#ifndef SOURCEMETA_BLAZE_BINPACK_ERROR_H_
2#define SOURCEMETA_BLAZE_BINPACK_ERROR_H_
3
4#ifndef SOURCEMETA_BLAZE_BINPACK_EXPORT
5#include <sourcemeta/blaze/binpack_export.h>
6#endif
7
8#include <exception> // std::exception
9#include <string> // std::string
10#include <string_view> // std::string_view
11#include <utility> // std::move
12
13namespace sourcemeta::blaze {
14
15// Exporting symbols that depends on the standard C++ library is considered
16// safe.
17// https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4275?view=msvc-170&redirectedfrom=MSDN
18#if defined(_MSC_VER)
19#pragma warning(disable : 4251 4275)
20#endif
21
24class SOURCEMETA_BLAZE_BINPACK_EXPORT BinPackEncodingError
25 : public std::exception {
26public:
27 BinPackEncodingError(std::string name) : name_{std::move(name)} {}
28
29 [[nodiscard]] auto what() const noexcept -> const char * override {
30 return "The encoding is not recognized";
31 }
32
34 [[nodiscard]] auto name() const noexcept -> std::string_view {
35 return this->name_;
36 }
37
38private:
39 std::string name_;
40};
41
42#if defined(_MSC_VER)
43#pragma warning(default : 4251 4275)
44#endif
45
46} // namespace sourcemeta::blaze
47
48#endif
auto name() const noexcept -> std::string_view
The name of the encoding that could not be recognized.
Definition binpack_error.h:34