#include #include #include #include namespace kapi::devices { namespace { struct driver_match_category_t final : kstd::error_category { [[nodiscard]] auto name() const noexcept -> std::string_view override { return "driver_match"; } [[nodiscard]] auto message(int value) const noexcept -> std::string_view override { switch (static_cast(value)) { case driver_match_errc::no_match: return "driver does not match this device"; default: return "unknown driver matching error"; } } [[nodiscard]] auto default_error_condition(int value) const noexcept -> kstd::error_condition override { if (value == std::to_underlying(driver_match_errc::no_match)) { return make_error_condition(kstd::errc::not_supported); } return kstd::error_category::default_error_condition(value); } } constexpr driver_match_category_instance{}; } // namespace auto driver_match_category() noexcept -> kstd::error_category const & { return driver_match_category_instance; } } // namespace kapi::devices