123 unsigned objectProperty)
127 if constexpr (
std::is_enum_v<T>) {
128 return spa_pod_parse_object(&pod, spaObjectType,
nullptr, objectProperty,
130 }
else if constexpr (
std::is_same_v<T,
int>) {
131 return spa_pod_parse_object(&pod, spaObjectType,
nullptr, objectProperty,
132 SPA_POD_Int(&value));
133 }
else if constexpr (
std::is_same_v<T, spa_rectangle>) {
134 return spa_pod_parse_object(&pod, spaObjectType,
nullptr, objectProperty,
135 SPA_POD_Rectangle(&value));
136 }
else if constexpr (
std::is_same_v<T, spa_fraction>) {
137 return spa_pod_parse_object(&pod, spaObjectType,
nullptr, objectProperty,
138 SPA_POD_Fraction(&value));
140#if !(Q_CC_GNU_ONLY && Q_CC_GNU < 1300
)
141 static_assert(
false);
143 Q_UNREACHABLE_RETURN(-1);
171 constexpr bool has_choices =
sizeof...(Choices) != 0;
172 constexpr bool has_single_choice =
sizeof...(Choices) == 1;
173 constexpr bool has_enum = ((Choices == SPA_CHOICE_Enum) || ...);
174 constexpr bool has_range = ((Choices == SPA_CHOICE_Range) || ...);
177 using ReturnType = std::conditional_t<has_choices,
178 std::conditional_t<has_single_choice,
179 std::conditional_t<has_enum,
183 std::variant<SpaEnum<T>, SpaRange<T>>
185 std::variant<SpaEnum<T>, SpaRange<T>>>;
188 return spaVisitChoice(pod, spaObjectType, objectProperty,
189 [](
const spa_pod &format_pod) -> std::optional<ReturnType> {
190 spa_choice_type choice_type = spa_choice_type(SPA_POD_CHOICE_TYPE(&format_pod));
191 if constexpr (has_enum || !has_choices) {
192 if (choice_type == SPA_CHOICE_Enum)
193 return SpaEnum<T>::parse(&format_pod);
196 if constexpr (has_range || !has_choices) {
197 if (choice_type == SPA_CHOICE_Range)
198 return SpaRange<T>::parse(&format_pod);