7#include "../pickle.hpp"
8#include "../exception.hpp"
16 static constexpr char none = 0;
17 static constexpr char win32 = 1;
18 static constexpr char macos = 2;
19 static constexpr char asio = 3;
31 explicit operator bool()
const noexcept
51 if (t == audio_device_id::none) {
53 }
else if (t == audio_device_id::win32) {
55 for (
auto i = 1_uz; i != std::size(rhs._v); ++i) {
56 if (
auto c = rhs._v[i]) {
78 tt_parse_check(std::size(rhs) <= std::size(r._v),
"win32-audio_device_id pickle size to large {}", rhs);
80 r._v[0] = audio_device_id::win32;
82 for (; i != std::size(rhs); ++i) {
85 if (i != std::size(r._v)) {
91 throw parse_error(
"audio_device_id pickle unknown type {}", t);
98 if (
auto *s = get_if<std::string>(rhs)) {
102 throw parse_error(
"audio_device_id must be encoded as a string, got {}", rhs);
Definition audio_device_id.hpp:14
A dynamic data type.
Definition datum.hpp:213
Exception thrown during parsing on an error.
Definition exception.hpp:26
Encode and decode a type to and from a UTF-8 string.
Definition pickle.hpp:22
T decode(datum rhs) const
Decode a UTF-8 string into a value of a given type.
datum encode(T const &rhs) const noexcept
Encode the value of a type into a UTF-8 string.