LCOV - code coverage report
Current view: top level - boost/capy - error.hpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 100.0 % 2 2
Test Date: 2026-01-15 18:27:21 Functions: 100.0 % 1 1

            Line data    Source code
       1              : //
       2              : // Copyright (c) 2025 Vinnie Falco (vinnie.falco@gmail.com)
       3              : //
       4              : // Distributed under the Boost Software License, Version 1.0. (See accompanying
       5              : // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       6              : //
       7              : // Official repository: https://github.com/cppalliance/capy
       8              : //
       9              : 
      10              : #ifndef BOOST_CAPY_ERROR_HPP
      11              : #define BOOST_CAPY_ERROR_HPP
      12              : 
      13              : #include <boost/capy/detail/config.hpp>
      14              : #include <boost/system/error_category.hpp>
      15              : #include <boost/system/is_error_code_enum.hpp>
      16              : 
      17              : namespace boost {
      18              : namespace capy {
      19              : 
      20              : /** Error codes returned from algorithms and operations.
      21              : 
      22              :     Return `error::eof` when originating an eof error.
      23              :     Check `ec == cond::eof` for portable comparison.
      24              : */
      25              : enum class error
      26              : {
      27              :     eof = 1
      28              : };
      29              : 
      30              : //-----------------------------------------------
      31              : 
      32              : } // capy
      33              : 
      34              : namespace system {
      35              : template<>
      36              : struct is_error_code_enum<
      37              :     ::boost::capy::error>
      38              : {
      39              :     static bool const value = true;
      40              : };
      41              : } // system
      42              : 
      43              : namespace capy {
      44              : 
      45              : //-----------------------------------------------
      46              : 
      47              : namespace detail {
      48              :  
      49              : struct BOOST_SYMBOL_VISIBLE
      50              :     error_cat_type
      51              :     : system::error_category
      52              : {
      53              :     BOOST_CAPY_DECL const char* name(
      54              :         ) const noexcept override;
      55              :     BOOST_CAPY_DECL std::string message(
      56              :         int) const override;
      57              :     BOOST_CAPY_DECL char const* message(
      58              :         int, char*, std::size_t
      59              :             ) const noexcept override;
      60              :     BOOST_SYSTEM_CONSTEXPR error_cat_type()
      61              :         : error_category(0x884562ca8e2fc5fd)
      62              :     {
      63              :     }
      64              : };
      65              : 
      66              : BOOST_CAPY_DECL extern error_cat_type error_cat;
      67              : 
      68              : } // detail
      69              : 
      70              : //-----------------------------------------------
      71              : 
      72              : inline
      73              : BOOST_SYSTEM_CONSTEXPR
      74              : system::error_code
      75           63 : make_error_code(
      76              :     error ev) noexcept
      77              : {
      78              :     return system::error_code{
      79              :         static_cast<std::underlying_type<
      80              :             error>::type>(ev),
      81           63 :         detail::error_cat};
      82              : }
      83              : 
      84              : } // capy
      85              : } // boost
      86              : 
      87              : #endif
        

Generated by: LCOV version 2.3