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 "../utility/utility.hpp"
8#include "../macros.hpp"
9#include <format>
10#include <string_view>
11
12hi_export_module(hikogui.audio.audio_device_state);
13
14hi_export namespace hi { inline namespace v1 {
15
16hi_export enum class audio_device_state { uninitialized, active, disabled, not_present, unplugged };
17
18// clang-format off
19hi_export constexpr auto audio_device_state_metadata = enum_metadata{
20 audio_device_state::uninitialized, "uninitialized",
21 audio_device_state::active, "active",
22 audio_device_state::disabled, "disabled",
23 audio_device_state::not_present, "not_present",
24 audio_device_state::unplugged, "unplugged",
25};
26// clang-format on
27
28hi_export [[nodiscard]] constexpr std::string_view to_string(audio_device_state const& rhs) noexcept
29{
30 return audio_device_state_metadata[rhs];
31}
32
33}} // namespace hi::inline v1
34
35// XXX #617 MSVC bug does not handle partial specialization in modules.
36hi_export template<>
37struct std::formatter<hi::audio_device_state, char> : std::formatter<std::string_view, char> {
38 auto format(hi::audio_device_state const& t, auto& fc) const
39 {
40 return std::formatter<std::string_view, char>::format(hi::audio_device_state_metadata[t], fc);
41 }
42};
The HikoGUI namespace.
Definition array_generic.hpp:20
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
T to_string(T... args)