160 constexpr bool has_choices =
sizeof...(Choices) != 0;
161 constexpr bool has_single_choice =
sizeof...(Choices) == 1;
162 constexpr bool has_enum = ((Choices == SPA_CHOICE_Enum) || ...);
163 constexpr bool has_range = ((Choices == SPA_CHOICE_Range) || ...);
166 using ReturnType = std::conditional_t<has_choices,
167 std::conditional_t<has_single_choice,
168 std::conditional_t<has_enum,
172 std::variant<SpaEnum<T>, SpaRange<T>>
174 std::variant<SpaEnum<T>, SpaRange<T>>>;
177 return spaVisitChoice(pod, spaObjectType, objectProperty,
178 [](
const spa_pod &format_pod) -> std::optional<ReturnType> {
179 spa_choice_type choice_type = spa_choice_type(SPA_POD_CHOICE_TYPE(&format_pod));
180 if constexpr (has_enum || !has_choices) {
181 if (choice_type == SPA_CHOICE_Enum)
182 return SpaEnum<T>::parse(&format_pod);
185 if constexpr (has_range || !has_choices) {
186 if (choice_type == SPA_CHOICE_Range)
187 return SpaRange<T>::parse(&format_pod);