150 constexpr bool has_choices =
sizeof...(Choices) != 0;
151 constexpr bool has_single_choice =
sizeof...(Choices) == 1;
152 constexpr bool has_enum = ((Choices == SPA_CHOICE_Enum) || ...);
153 constexpr bool has_range = ((Choices == SPA_CHOICE_Range) || ...);
156 using ReturnType = std::conditional_t<has_choices,
157 std::conditional_t<has_single_choice,
158 std::conditional_t<has_enum,
162 std::variant<SpaEnum<T>, SpaRange<T>>
164 std::variant<SpaEnum<T>, SpaRange<T>>>;
167 return spaVisitChoice(pod, spaObjectType, objectProperty,
168 [](
const spa_pod &format_pod) -> std::optional<ReturnType> {
169 spa_choice_type choice_type = spa_choice_type(SPA_POD_CHOICE_TYPE(&format_pod));
170 if constexpr (has_enum || !has_choices) {
171 if (choice_type == SPA_CHOICE_Enum)
172 return SpaEnum<T>::parse(&format_pod);
175 if constexpr (has_range || !has_choices) {
176 if (choice_type == SPA_CHOICE_Range)
177 return SpaRange<T>::parse(&format_pod);