Header file quick_status_code_from_enum.hpp

#include "generic_code.hpp"

namespace system_error2
{
    template <class Enum>
    using quick_status_code_from_enum_code = status_code<_quick_status_code_from_enum_domain<Enum>>;

    template <class Enum>
    struct quick_status_code_from_enum_defaults;

    template <class Enum>
    class _quick_status_code_from_enum_domain;

    template <class Enum>constexpr _quick_status_code_from_enum_domain<Enum>quick_status_code_from_enum_domain = {};

    static constexpr _quick_status_code_from_enum_domain<Enum> const& _quick_status_code_from_enum_domain<Enum>::get();

    namespace mixins
    {
        template <class Base, class Enum>
        struct mixin<Base, _quick_status_code_from_enum_domain<Enum>;
    }
}

Alias template system_error2::quick_status_code_from_enum_code

template <class Enum>
using quick_status_code_from_enum_code = status_code<_quick_status_code_from_enum_domain<Enum>>;

A status code wrapping Enum generated from quick_status_code_from_enum.


Struct system_error2::quick_status_code_from_enum_defaults

template <class Enum>
struct quick_status_code_from_enum_defaults
{
    struct mapping;

    template <class Base>
    struct mixin;
};

Defaults for an implementation of quick_status_code_from_enum<Enum>

Struct system_error2::quick_status_code_from_enum_defaults::mapping

struct mapping
{
    using enumeration_type = Enum;

    Enum const value;

    char const* message;

    std::initializer_list<errc> const code_mappings;
};

Used within quick_status_code_from_enum to define a mapping of enumeration value with its status code

Member variables

Type alias system_error2::quick_status_code_from_enum_defaults::mapping::enumeration_type

using enumeration_type = Enum;

The enumeration type



Struct system_error2::quick_status_code_from_enum_defaults::mixin

template <class Base>
struct mixin
: Base
{
    using Base::Base;
};

Used within quick_status_code_from_enum to define mixins for the status code wrapping Enum



Class system_error2::_quick_status_code_from_enum_domain

template <class Enum>
class _quick_status_code_from_enum_domain
: public status_code_domain
{
public:
    using value_type = Enum;

    constexpr _quick_status_code_from_enum_domain();

    _quick_status_code_from_enum_domain(const _quick_status_code_from_enum_domain<Enum>&) = default;

    _quick_status_code_from_enum_domain(_quick_status_code_from_enum_domain<Enum>&&) = default;

    _quick_status_code_from_enum_domain<Enum>& operator=(const _quick_status_code_from_enum_domain<Enum>&) = default;

    _quick_status_code_from_enum_domain<Enum>& operator=(_quick_status_code_from_enum_domain<Enum>&&) = default;

    ~_quick_status_code_from_enum_domain() = default;

    static constexpr const _quick_status_code_from_enum_domain<Enum>& get();

    virtual system_error2::status_code_domain::string_ref name() const noexcept;

protected:
    static constexpr const typename _src::mapping* _find_mapping(system_error2::_quick_status_code_from_enum_domain::value_type v) noexcept;

    virtual bool _do_failure(status_code<void> const& code) const noexcept;

    virtual bool _do_equivalent(status_code<void> const& code1, status_code<void> const& code2) const noexcept;

    virtual system_error2::generic_code _generic_code(status_code<void> const& code) const noexcept;

    virtual system_error2::status_code_domain::string_ref _do_message(status_code<void> const& code) const noexcept;

    virtual void _do_throw_exception(status_code<void> const& code) const;
};

The implementation of the domain for status codes wrapping Enum generated from quick_status_code_from_enum.

Type alias system_error2::_quick_status_code_from_enum_domain::value_type

using value_type = Enum;

The value type of the quick status code from enum