14namespace hi::inline
v1 {
16enum class network_event : uint16_t {
26 address_list_change = 0x0100,
27 routing_interface_changed = 0x0200
30[[nodiscard]]
constexpr network_event operator|(network_event
const& lhs, network_event
const& rhs)
noexcept
32 return static_cast<network_event
>(to_underlying(lhs) | to_underlying(rhs));
35[[nodiscard]]
constexpr network_event operator&(network_event
const& lhs, network_event
const& rhs)
noexcept
37 return static_cast<network_event
>(to_underlying(lhs) & to_underlying(rhs));
40constexpr network_event& operator|=(network_event& lhs, network_event
const& rhs)
noexcept
42 return lhs = lhs | rhs;
45[[nodiscard]]
constexpr bool to_bool(network_event
const& rhs)
noexcept
47 return to_bool(to_underlying(rhs));
52[[nodiscard]]
constexpr size_t bit(network_event
const& rhs)
noexcept
54 hi_assert(std::popcount(to_underlying(rhs)) == 1);
55 return std::countr_zero(to_underlying(rhs));
58enum class network_error : uint8_t {
70constexpr static size_t network_event_max = 10;
77 constexpr network_events() noexcept : events(network_event::none), errors{} {}
Utilities to assert and bound check.
#define hi_assert(expression,...)
Assert if expression is true.
Definition assert.hpp:87
@ read
Allow read access to a file.
@ write
Allow write access to a file.
DOXYGEN BUG.
Definition algorithm.hpp:15
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:52
Definition network_event.hpp:72