148 constexpr bool has_choices =
sizeof...(Choices) != 0;
149 constexpr bool has_single_choice =
sizeof...(Choices) == 1;
150 constexpr bool has_enum = ((Choices == SPA_CHOICE_Enum) || ...);
151 constexpr bool has_range = ((Choices == SPA_CHOICE_Range) || ...);
154 using ReturnType = std::conditional_t<has_choices,
155 std::conditional_t<has_single_choice,
156 std::conditional_t<has_enum,
160 std::variant<SpaEnum<T>, SpaRange<T>>
162 std::variant<SpaEnum<T>, SpaRange<T>>>;
165 return spaVisitChoice(pod, spaObjectType, objectProperty,
166 [](
const spa_pod &format_pod) -> std::optional<ReturnType> {
167 spa_choice_type choice_type = spa_choice_type(SPA_POD_CHOICE_TYPE(&format_pod));
168 if constexpr (has_enum || !has_choices) {
169 if (choice_type == SPA_CHOICE_Enum)
170 return SpaEnum<T>::parse(&format_pod);
173 if constexpr (has_range || !has_choices) {
174 if (choice_type == SPA_CHOICE_Range)
175 return SpaRange<T>::parse(&format_pod);