7#include "../utility/module.hpp"
13namespace hi::inline
v1 {
15enum class network_event : uint16_t {
25 address_list_change = 0x0100,
26 routing_interface_changed = 0x0200
29[[nodiscard]]
constexpr network_event operator|(network_event
const& lhs, network_event
const& rhs)
noexcept
31 return static_cast<network_event
>(to_underlying(lhs) | to_underlying(rhs));
34[[nodiscard]]
constexpr network_event operator&(network_event
const& lhs, network_event
const& rhs)
noexcept
36 return static_cast<network_event
>(to_underlying(lhs) & to_underlying(rhs));
39constexpr network_event& operator|=(network_event& lhs, network_event
const& rhs)
noexcept
41 return lhs = lhs | rhs;
44[[nodiscard]]
constexpr bool to_bool(network_event
const& rhs)
noexcept
46 return to_bool(to_underlying(rhs));
51[[nodiscard]]
constexpr size_t bit(network_event
const& rhs)
noexcept
53 hi_assert(std::popcount(to_underlying(rhs)) == 1);
54 return std::countr_zero(to_underlying(rhs));
57enum class network_error : uint8_t {
69constexpr static size_t network_event_max = 10;
76 constexpr network_events() noexcept : events(network_event::none), errors{} {}
#define hi_assert(expression,...)
Assert if expression is true.
Definition assert.hpp:199
@ read
Allow read access to a file.
@ write
Allow write access to a file.
DOXYGEN BUG.
Definition algorithm.hpp:13
constexpr size_t bit(network_event const &rhs) noexcept
Get the bit index of the single bit of the network_event mask.
Definition network_event.hpp:51
Definition network_event.hpp:71