| 79 | } |
| 80 | |
| 81 | std::optional<UIDelegateStatePtr> UIDelegate::populateUI( |
| 82 | const trait::TraitsDataConstPtr& uiTraitsData, const access::UIAccess uiAccess, |
| 83 | UIDelegateRequestInterfacePtr uiRequestInterface, const ContextConstPtr& context) { |
| 84 | if (uiRequestInterface == nullptr) { |
| 85 | throw errors::InputValidationException{"UI delegate request cannot be null."}; |
| 86 | } |
| 87 | |
| 88 | auto maybeUIDelegateStateInterface = uiDelegateInterface_->populateUI( |
| 89 | uiTraitsData, uiAccess, managerApi::UIDelegateRequest::make(std::move(uiRequestInterface)), |
| 90 | context, hostSession_); |
| 91 | |
| 92 | if (!maybeUIDelegateStateInterface.has_value()) { |
| 93 | return std::nullopt; |
| 94 | } |
| 95 | |
| 96 | auto uiDelegateStateInterface = std::move(*maybeUIDelegateStateInterface); |
| 97 | if (uiDelegateStateInterface == nullptr) { |
| 98 | throw errors::InputValidationException{"UI delegate state is null."}; |
| 99 | } |
| 100 | |
| 101 | return UIDelegateState::make(std::move(uiDelegateStateInterface)); |
| 102 | } |
| 103 | |
| 104 | } // namespace ui::hostApi |
| 105 | } // namespace OPENASSETIO_CORE_ABI_VERSION |