HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
audio_device_state.hpp
1// Copyright Take Vos 2022.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "../enum_metadata.hpp"
8#include <format>
9#include <string_view>
10
11namespace hi::inline v1 {
12
13enum class audio_device_state { uninitialized, active, disabled, not_present, unplugged };
14
15// clang-format off
16constexpr auto audio_device_state_metadata = enum_metadata{
17 audio_device_state::uninitialized, "uninitialized",
18 audio_device_state::active, "active",
19 audio_device_state::disabled, "disabled",
20 audio_device_state::not_present, "not_present",
21 audio_device_state::unplugged, "unplugged",
22};
23// clang-format on
24
25[[nodiscard]] constexpr std::string_view to_string(audio_device_state const& rhs) noexcept
26{
27 return audio_device_state_metadata[rhs];
28}
29
30} // namespace hi::inline v1
31
32template<typename CharT>
33struct std::formatter<hi::audio_device_state, CharT> : std::formatter<std::string_view, CharT> {
34 auto format(hi::audio_device_state const& t, auto& fc)
35 {
36 return std::formatter<std::string_view, CharT>::format(hi::audio_device_state_metadata[t], fc);
37 }
38};
DOXYGEN BUG.
Definition algorithm.hpp:15
The HikoGUI namespace.
Definition ascii.hpp:19
T to_string(T... args)