// C++/WinRT v2.0.250303.1 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #ifndef WINRT_Windows_Foundation_H #define WINRT_Windows_Foundation_H #include "winrt/base.h" static_assert(winrt::check_version(CPPWINRT_VERSION, "2.0.250303.1"), "Mismatched C++/WinRT headers."); #define CPPWINRT_VERSION "2.0.250303.1" #include "winrt/impl/Windows.Foundation.Collections.2.h" #include "winrt/impl/Windows.Foundation.2.h" namespace winrt::impl { template auto consume_Windows_Foundation_IAsyncAction::Completed(winrt::Windows::Foundation::AsyncActionCompletedHandler const& handler) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->put_Completed(*(void**)(&handler))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->put_Completed(*(void**)(&handler))); } } template auto consume_Windows_Foundation_IAsyncAction::Completed() const { void* handler{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Completed(&handler)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Completed(&handler)); } return winrt::Windows::Foundation::AsyncActionCompletedHandler{ handler, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IAsyncAction::GetResults() const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetResults()); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetResults()); } } template auto consume_Windows_Foundation_IAsyncActionWithProgress::Progress(winrt::Windows::Foundation::AsyncActionProgressHandler const& handler) const { if constexpr (!std::is_same_v>) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason, D const*>(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t>**)&_winrt_casted_result; check_hresult(_winrt_abi_type->put_Progress(*(void**)(&handler))); } else { auto const _winrt_abi_type = *(abi_t>**)this; check_hresult(_winrt_abi_type->put_Progress(*(void**)(&handler))); } } template auto consume_Windows_Foundation_IAsyncActionWithProgress::Progress() const { void* winrt_impl_result{}; if constexpr (!std::is_same_v>) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason, D const*>(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t>**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Progress(&winrt_impl_result)); } else { auto const _winrt_abi_type = *(abi_t>**)this; check_hresult(_winrt_abi_type->get_Progress(&winrt_impl_result)); } return winrt::Windows::Foundation::AsyncActionProgressHandler{ winrt_impl_result, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IAsyncActionWithProgress::Completed(winrt::Windows::Foundation::AsyncActionWithProgressCompletedHandler const& handler) const { if constexpr (!std::is_same_v>) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason, D const*>(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t>**)&_winrt_casted_result; check_hresult(_winrt_abi_type->put_Completed(*(void**)(&handler))); } else { auto const _winrt_abi_type = *(abi_t>**)this; check_hresult(_winrt_abi_type->put_Completed(*(void**)(&handler))); } } template auto consume_Windows_Foundation_IAsyncActionWithProgress::Completed() const { void* winrt_impl_result{}; if constexpr (!std::is_same_v>) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason, D const*>(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t>**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Completed(&winrt_impl_result)); } else { auto const _winrt_abi_type = *(abi_t>**)this; check_hresult(_winrt_abi_type->get_Completed(&winrt_impl_result)); } return winrt::Windows::Foundation::AsyncActionWithProgressCompletedHandler{ winrt_impl_result, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IAsyncActionWithProgress::GetResults() const { if constexpr (!std::is_same_v>) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason, D const*>(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t>**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetResults()); } else { auto const _winrt_abi_type = *(abi_t>**)this; check_hresult(_winrt_abi_type->GetResults()); } } template auto consume_Windows_Foundation_IAsyncInfo::Id() const { uint32_t winrt_impl_result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Id(&winrt_impl_result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Id(&winrt_impl_result)); } return winrt_impl_result; } template auto consume_Windows_Foundation_IAsyncInfo::Status() const { winrt::Windows::Foundation::AsyncStatus winrt_impl_result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Status(reinterpret_cast(&winrt_impl_result))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Status(reinterpret_cast(&winrt_impl_result))); } return winrt_impl_result; } template auto consume_Windows_Foundation_IAsyncInfo::ErrorCode() const { winrt::hresult winrt_impl_result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_ErrorCode(put_abi(winrt_impl_result))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_ErrorCode(put_abi(winrt_impl_result))); } return winrt_impl_result; } template auto consume_Windows_Foundation_IAsyncInfo::Cancel() const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Cancel()); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Cancel()); } } template auto consume_Windows_Foundation_IAsyncInfo::Close() const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Close()); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Close()); } } template auto consume_Windows_Foundation_IAsyncOperationWithProgress::Progress(winrt::Windows::Foundation::AsyncOperationProgressHandler const& handler) const { if constexpr (!std::is_same_v>) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason, D const*>(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t>**)&_winrt_casted_result; check_hresult(_winrt_abi_type->put_Progress(*(void**)(&handler))); } else { auto const _winrt_abi_type = *(abi_t>**)this; check_hresult(_winrt_abi_type->put_Progress(*(void**)(&handler))); } } template auto consume_Windows_Foundation_IAsyncOperationWithProgress::Progress() const { void* winrt_impl_result{}; if constexpr (!std::is_same_v>) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason, D const*>(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t>**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Progress(&winrt_impl_result)); } else { auto const _winrt_abi_type = *(abi_t>**)this; check_hresult(_winrt_abi_type->get_Progress(&winrt_impl_result)); } return winrt::Windows::Foundation::AsyncOperationProgressHandler{ winrt_impl_result, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IAsyncOperationWithProgress::Completed(winrt::Windows::Foundation::AsyncOperationWithProgressCompletedHandler const& handler) const { if constexpr (!std::is_same_v>) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason, D const*>(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t>**)&_winrt_casted_result; check_hresult(_winrt_abi_type->put_Completed(*(void**)(&handler))); } else { auto const _winrt_abi_type = *(abi_t>**)this; check_hresult(_winrt_abi_type->put_Completed(*(void**)(&handler))); } } template auto consume_Windows_Foundation_IAsyncOperationWithProgress::Completed() const { void* winrt_impl_result{}; if constexpr (!std::is_same_v>) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason, D const*>(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t>**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Completed(&winrt_impl_result)); } else { auto const _winrt_abi_type = *(abi_t>**)this; check_hresult(_winrt_abi_type->get_Completed(&winrt_impl_result)); } return winrt::Windows::Foundation::AsyncOperationWithProgressCompletedHandler{ winrt_impl_result, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IAsyncOperationWithProgress::GetResults() const { TResult winrt_impl_result{ empty_value() }; if constexpr (!std::is_same_v>) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason, D const*>(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t>**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetResults(put_abi(winrt_impl_result))); } else { auto const _winrt_abi_type = *(abi_t>**)this; check_hresult(_winrt_abi_type->GetResults(put_abi(winrt_impl_result))); } return winrt_impl_result; } template auto consume_Windows_Foundation_IAsyncOperation::Completed(winrt::Windows::Foundation::AsyncOperationCompletedHandler const& handler) const { if constexpr (!std::is_same_v>) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason, D const*>(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t>**)&_winrt_casted_result; check_hresult(_winrt_abi_type->put_Completed(*(void**)(&handler))); } else { auto const _winrt_abi_type = *(abi_t>**)this; check_hresult(_winrt_abi_type->put_Completed(*(void**)(&handler))); } } template auto consume_Windows_Foundation_IAsyncOperation::Completed() const { void* winrt_impl_result{}; if constexpr (!std::is_same_v>) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason, D const*>(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t>**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Completed(&winrt_impl_result)); } else { auto const _winrt_abi_type = *(abi_t>**)this; check_hresult(_winrt_abi_type->get_Completed(&winrt_impl_result)); } return winrt::Windows::Foundation::AsyncOperationCompletedHandler{ winrt_impl_result, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IAsyncOperation::GetResults() const { TResult winrt_impl_result{ empty_value() }; if constexpr (!std::is_same_v>) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason, D const*>(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t>**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetResults(put_abi(winrt_impl_result))); } else { auto const _winrt_abi_type = *(abi_t>**)this; check_hresult(_winrt_abi_type->GetResults(put_abi(winrt_impl_result))); } return winrt_impl_result; } template auto consume_Windows_Foundation_IClosable::Close() const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Close()); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Close()); } } template auto consume_Windows_Foundation_IDeferral::Complete() const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Complete()); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Complete()); } } template auto consume_Windows_Foundation_IDeferralFactory::Create(winrt::Windows::Foundation::DeferralCompletedHandler const& handler) const { void* result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Create(*(void**)(&handler), &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Create(*(void**)(&handler), &result)); } return winrt::Windows::Foundation::Deferral{ result, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IGetActivationFactory::GetActivationFactory(param::hstring const& activatableClassId) const { void* factory{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetActivationFactory(*(void**)(&activatableClassId), &factory)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetActivationFactory(*(void**)(&activatableClassId), &factory)); } return winrt::Windows::Foundation::IInspectable{ factory, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IGuidHelperStatics::CreateNewGuid() const { winrt::guid result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateNewGuid(put_abi(result))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateNewGuid(put_abi(result))); } return result; } template auto consume_Windows_Foundation_IGuidHelperStatics::Empty() const { winrt::guid value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Empty(put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Empty(put_abi(value))); } return value; } template auto consume_Windows_Foundation_IGuidHelperStatics::Equals(winrt::guid const& target, winrt::guid const& value) const { bool result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Equals(impl::bind_in(target), impl::bind_in(value), &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Equals(impl::bind_in(target), impl::bind_in(value), &result)); } return result; } template auto consume_Windows_Foundation_IMemoryBuffer::CreateReference() const { void* reference{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateReference(&reference)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateReference(&reference)); } return winrt::Windows::Foundation::IMemoryBufferReference{ reference, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IMemoryBufferFactory::Create(uint32_t capacity) const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Create(capacity, &value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Create(capacity, &value)); } return winrt::Windows::Foundation::MemoryBuffer{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IMemoryBufferReference::Capacity() const { uint32_t value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Capacity(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Capacity(&value)); } return value; } template auto consume_Windows_Foundation_IMemoryBufferReference::Closed(winrt::Windows::Foundation::TypedEventHandler const& handler) const { winrt::event_token cookie{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->add_Closed(*(void**)(&handler), put_abi(cookie))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->add_Closed(*(void**)(&handler), put_abi(cookie))); } return cookie; } template auto consume_Windows_Foundation_IMemoryBufferReference::Closed(auto_revoke_t, winrt::Windows::Foundation::TypedEventHandler const& handler) const { return impl::make_event_revoker(this, Closed(handler)); } template auto consume_Windows_Foundation_IMemoryBufferReference::Closed(winrt::event_token const& cookie) const noexcept { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; _winrt_abi_type->remove_Closed(impl::bind_in(cookie)); } else { auto const _winrt_abi_type = *(abi_t**)this; _winrt_abi_type->remove_Closed(impl::bind_in(cookie)); } } template auto consume_Windows_Foundation_IPropertyValue::Type() const { winrt::Windows::Foundation::PropertyType value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Type(reinterpret_cast(&value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Type(reinterpret_cast(&value))); } return value; } template auto consume_Windows_Foundation_IPropertyValue::IsNumericScalar() const { bool value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_IsNumericScalar(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_IsNumericScalar(&value)); } return value; } template auto consume_Windows_Foundation_IPropertyValue::GetUInt8() const { uint8_t value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetUInt8(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetUInt8(&value)); } return value; } template auto consume_Windows_Foundation_IPropertyValue::GetInt16() const { int16_t value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetInt16(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetInt16(&value)); } return value; } template auto consume_Windows_Foundation_IPropertyValue::GetUInt16() const { uint16_t value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetUInt16(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetUInt16(&value)); } return value; } template auto consume_Windows_Foundation_IPropertyValue::GetInt32() const { int32_t value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetInt32(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetInt32(&value)); } return value; } template auto consume_Windows_Foundation_IPropertyValue::GetUInt32() const { uint32_t value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetUInt32(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetUInt32(&value)); } return value; } template auto consume_Windows_Foundation_IPropertyValue::GetInt64() const { int64_t value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetInt64(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetInt64(&value)); } return value; } template auto consume_Windows_Foundation_IPropertyValue::GetUInt64() const { uint64_t value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetUInt64(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetUInt64(&value)); } return value; } template auto consume_Windows_Foundation_IPropertyValue::GetSingle() const { float value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetSingle(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetSingle(&value)); } return value; } template auto consume_Windows_Foundation_IPropertyValue::GetDouble() const { double value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetDouble(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetDouble(&value)); } return value; } template auto consume_Windows_Foundation_IPropertyValue::GetChar16() const { char16_t value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetChar16(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetChar16(&value)); } return value; } template auto consume_Windows_Foundation_IPropertyValue::GetBoolean() const { bool value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetBoolean(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetBoolean(&value)); } return value; } template auto consume_Windows_Foundation_IPropertyValue::GetString() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetString(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetString(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValue::GetGuid() const { winrt::guid value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetGuid(put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetGuid(put_abi(value))); } return value; } template auto consume_Windows_Foundation_IPropertyValue::GetDateTime() const { winrt::Windows::Foundation::DateTime value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetDateTime(put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetDateTime(put_abi(value))); } return value; } template auto consume_Windows_Foundation_IPropertyValue::GetTimeSpan() const { winrt::Windows::Foundation::TimeSpan value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetTimeSpan(put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetTimeSpan(put_abi(value))); } return value; } template auto consume_Windows_Foundation_IPropertyValue::GetPoint() const { winrt::Windows::Foundation::Point value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetPoint(put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetPoint(put_abi(value))); } return value; } template auto consume_Windows_Foundation_IPropertyValue::GetSize() const { winrt::Windows::Foundation::Size value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetSize(put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetSize(put_abi(value))); } return value; } template auto consume_Windows_Foundation_IPropertyValue::GetRect() const { winrt::Windows::Foundation::Rect value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetRect(put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetRect(put_abi(value))); } return value; } template auto consume_Windows_Foundation_IPropertyValue::GetUInt8Array(com_array& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetUInt8Array(impl::put_size_abi(value), put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetUInt8Array(impl::put_size_abi(value), put_abi(value))); } } template auto consume_Windows_Foundation_IPropertyValue::GetInt16Array(com_array& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetInt16Array(impl::put_size_abi(value), put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetInt16Array(impl::put_size_abi(value), put_abi(value))); } } template auto consume_Windows_Foundation_IPropertyValue::GetUInt16Array(com_array& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetUInt16Array(impl::put_size_abi(value), put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetUInt16Array(impl::put_size_abi(value), put_abi(value))); } } template auto consume_Windows_Foundation_IPropertyValue::GetInt32Array(com_array& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetInt32Array(impl::put_size_abi(value), put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetInt32Array(impl::put_size_abi(value), put_abi(value))); } } template auto consume_Windows_Foundation_IPropertyValue::GetUInt32Array(com_array& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetUInt32Array(impl::put_size_abi(value), put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetUInt32Array(impl::put_size_abi(value), put_abi(value))); } } template auto consume_Windows_Foundation_IPropertyValue::GetInt64Array(com_array& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetInt64Array(impl::put_size_abi(value), put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetInt64Array(impl::put_size_abi(value), put_abi(value))); } } template auto consume_Windows_Foundation_IPropertyValue::GetUInt64Array(com_array& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetUInt64Array(impl::put_size_abi(value), put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetUInt64Array(impl::put_size_abi(value), put_abi(value))); } } template auto consume_Windows_Foundation_IPropertyValue::GetSingleArray(com_array& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetSingleArray(impl::put_size_abi(value), put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetSingleArray(impl::put_size_abi(value), put_abi(value))); } } template auto consume_Windows_Foundation_IPropertyValue::GetDoubleArray(com_array& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetDoubleArray(impl::put_size_abi(value), put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetDoubleArray(impl::put_size_abi(value), put_abi(value))); } } template auto consume_Windows_Foundation_IPropertyValue::GetChar16Array(com_array& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetChar16Array(impl::put_size_abi(value), put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetChar16Array(impl::put_size_abi(value), put_abi(value))); } } template auto consume_Windows_Foundation_IPropertyValue::GetBooleanArray(com_array& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetBooleanArray(impl::put_size_abi(value), put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetBooleanArray(impl::put_size_abi(value), put_abi(value))); } } template auto consume_Windows_Foundation_IPropertyValue::GetStringArray(com_array& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetStringArray(impl::put_size_abi(value), put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetStringArray(impl::put_size_abi(value), put_abi(value))); } } template auto consume_Windows_Foundation_IPropertyValue::GetInspectableArray(com_array& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetInspectableArray(impl::put_size_abi(value), put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetInspectableArray(impl::put_size_abi(value), put_abi(value))); } } template auto consume_Windows_Foundation_IPropertyValue::GetGuidArray(com_array& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetGuidArray(impl::put_size_abi(value), put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetGuidArray(impl::put_size_abi(value), put_abi(value))); } } template auto consume_Windows_Foundation_IPropertyValue::GetDateTimeArray(com_array& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetDateTimeArray(impl::put_size_abi(value), put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetDateTimeArray(impl::put_size_abi(value), put_abi(value))); } } template auto consume_Windows_Foundation_IPropertyValue::GetTimeSpanArray(com_array& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetTimeSpanArray(impl::put_size_abi(value), put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetTimeSpanArray(impl::put_size_abi(value), put_abi(value))); } } template auto consume_Windows_Foundation_IPropertyValue::GetPointArray(com_array& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetPointArray(impl::put_size_abi(value), put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetPointArray(impl::put_size_abi(value), put_abi(value))); } } template auto consume_Windows_Foundation_IPropertyValue::GetSizeArray(com_array& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetSizeArray(impl::put_size_abi(value), put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetSizeArray(impl::put_size_abi(value), put_abi(value))); } } template auto consume_Windows_Foundation_IPropertyValue::GetRectArray(com_array& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetRectArray(impl::put_size_abi(value), put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetRectArray(impl::put_size_abi(value), put_abi(value))); } } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateEmpty() const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateEmpty(&propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateEmpty(&propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateUInt8(uint8_t value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateUInt8(value, &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateUInt8(value, &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateInt16(int16_t value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateInt16(value, &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateInt16(value, &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateUInt16(uint16_t value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateUInt16(value, &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateUInt16(value, &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateInt32(int32_t value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateInt32(value, &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateInt32(value, &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateUInt32(uint32_t value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateUInt32(value, &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateUInt32(value, &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateInt64(int64_t value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateInt64(value, &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateInt64(value, &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateUInt64(uint64_t value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateUInt64(value, &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateUInt64(value, &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateSingle(float value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateSingle(value, &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateSingle(value, &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateDouble(double value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateDouble(value, &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateDouble(value, &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateChar16(char16_t value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateChar16(value, &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateChar16(value, &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateBoolean(bool value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateBoolean(value, &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateBoolean(value, &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateString(param::hstring const& value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateString(*(void**)(&value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateString(*(void**)(&value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateInspectable(winrt::Windows::Foundation::IInspectable const& value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateInspectable(*(void**)(&value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateInspectable(*(void**)(&value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateGuid(winrt::guid const& value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateGuid(impl::bind_in(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateGuid(impl::bind_in(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateDateTime(winrt::Windows::Foundation::DateTime const& value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateDateTime(impl::bind_in(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateDateTime(impl::bind_in(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateTimeSpan(winrt::Windows::Foundation::TimeSpan const& value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateTimeSpan(impl::bind_in(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateTimeSpan(impl::bind_in(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreatePoint(winrt::Windows::Foundation::Point const& value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreatePoint(impl::bind_in(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreatePoint(impl::bind_in(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateSize(winrt::Windows::Foundation::Size const& value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateSize(impl::bind_in(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateSize(impl::bind_in(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateRect(winrt::Windows::Foundation::Rect const& value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateRect(impl::bind_in(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateRect(impl::bind_in(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateUInt8Array(array_view value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateUInt8Array(value.size(), get_abi(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateUInt8Array(value.size(), get_abi(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateInt16Array(array_view value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateInt16Array(value.size(), get_abi(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateInt16Array(value.size(), get_abi(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateUInt16Array(array_view value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateUInt16Array(value.size(), get_abi(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateUInt16Array(value.size(), get_abi(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateInt32Array(array_view value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateInt32Array(value.size(), get_abi(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateInt32Array(value.size(), get_abi(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateUInt32Array(array_view value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateUInt32Array(value.size(), get_abi(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateUInt32Array(value.size(), get_abi(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateInt64Array(array_view value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateInt64Array(value.size(), get_abi(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateInt64Array(value.size(), get_abi(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateUInt64Array(array_view value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateUInt64Array(value.size(), get_abi(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateUInt64Array(value.size(), get_abi(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateSingleArray(array_view value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateSingleArray(value.size(), get_abi(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateSingleArray(value.size(), get_abi(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateDoubleArray(array_view value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateDoubleArray(value.size(), get_abi(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateDoubleArray(value.size(), get_abi(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateChar16Array(array_view value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateChar16Array(value.size(), get_abi(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateChar16Array(value.size(), get_abi(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateBooleanArray(array_view value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateBooleanArray(value.size(), get_abi(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateBooleanArray(value.size(), get_abi(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateStringArray(array_view value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateStringArray(value.size(), get_abi(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateStringArray(value.size(), get_abi(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateInspectableArray(array_view value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateInspectableArray(value.size(), get_abi(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateInspectableArray(value.size(), get_abi(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateGuidArray(array_view value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateGuidArray(value.size(), get_abi(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateGuidArray(value.size(), get_abi(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateDateTimeArray(array_view value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateDateTimeArray(value.size(), get_abi(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateDateTimeArray(value.size(), get_abi(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateTimeSpanArray(array_view value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateTimeSpanArray(value.size(), get_abi(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateTimeSpanArray(value.size(), get_abi(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreatePointArray(array_view value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreatePointArray(value.size(), get_abi(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreatePointArray(value.size(), get_abi(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateSizeArray(array_view value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateSizeArray(value.size(), get_abi(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateSizeArray(value.size(), get_abi(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IPropertyValueStatics::CreateRectArray(array_view value) const { void* propertyValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateRectArray(value.size(), get_abi(value), &propertyValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateRectArray(value.size(), get_abi(value), &propertyValue)); } return winrt::Windows::Foundation::IInspectable{ propertyValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IReferenceArray::Value() const { uint32_t winrt_impl_result_impl_size{}; T* winrt_impl_result{}; if constexpr (!std::is_same_v>) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason, D const*>(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t>**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Value(&winrt_impl_result_impl_size, &winrt_impl_result)); } else { auto const _winrt_abi_type = *(abi_t>**)this; check_hresult(_winrt_abi_type->get_Value(&winrt_impl_result_impl_size, &winrt_impl_result)); } return com_array{ winrt_impl_result, winrt_impl_result_impl_size, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IReference::Value() const { T winrt_impl_result{ empty_value() }; if constexpr (!std::is_same_v>) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason, D const*>(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t>**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Value(put_abi(winrt_impl_result))); } else { auto const _winrt_abi_type = *(abi_t>**)this; check_hresult(_winrt_abi_type->get_Value(put_abi(winrt_impl_result))); } return winrt_impl_result; } template auto consume_Windows_Foundation_IStringable::ToString() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->ToString(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->ToString(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IUriEscapeStatics::UnescapeComponent(param::hstring const& toUnescape) const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->UnescapeComponent(*(void**)(&toUnescape), &value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->UnescapeComponent(*(void**)(&toUnescape), &value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IUriEscapeStatics::EscapeComponent(param::hstring const& toEscape) const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->EscapeComponent(*(void**)(&toEscape), &value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->EscapeComponent(*(void**)(&toEscape), &value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IUriRuntimeClass::AbsoluteUri() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_AbsoluteUri(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_AbsoluteUri(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IUriRuntimeClass::DisplayUri() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_DisplayUri(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_DisplayUri(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IUriRuntimeClass::Domain() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Domain(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Domain(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IUriRuntimeClass::Extension() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Extension(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Extension(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IUriRuntimeClass::Fragment() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Fragment(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Fragment(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IUriRuntimeClass::Host() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Host(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Host(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IUriRuntimeClass::Password() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Password(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Password(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IUriRuntimeClass::Path() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Path(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Path(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IUriRuntimeClass::Query() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Query(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Query(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IUriRuntimeClass::QueryParsed() const { void* ppWwwFormUrlDecoder{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_QueryParsed(&ppWwwFormUrlDecoder)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_QueryParsed(&ppWwwFormUrlDecoder)); } return winrt::Windows::Foundation::WwwFormUrlDecoder{ ppWwwFormUrlDecoder, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IUriRuntimeClass::RawUri() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_RawUri(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_RawUri(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IUriRuntimeClass::SchemeName() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_SchemeName(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_SchemeName(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IUriRuntimeClass::UserName() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_UserName(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_UserName(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IUriRuntimeClass::Port() const { int32_t value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Port(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Port(&value)); } return value; } template auto consume_Windows_Foundation_IUriRuntimeClass::Suspicious() const { bool value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Suspicious(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Suspicious(&value)); } return value; } template auto consume_Windows_Foundation_IUriRuntimeClass::Equals(winrt::Windows::Foundation::Uri const& pUri) const { bool value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Equals(*(void**)(&pUri), &value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Equals(*(void**)(&pUri), &value)); } return value; } template auto consume_Windows_Foundation_IUriRuntimeClass::CombineUri(param::hstring const& relativeUri) const { void* instance{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CombineUri(*(void**)(&relativeUri), &instance)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CombineUri(*(void**)(&relativeUri), &instance)); } return winrt::Windows::Foundation::Uri{ instance, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IUriRuntimeClassFactory::CreateUri(param::hstring const& uri) const { void* instance{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateUri(*(void**)(&uri), &instance)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateUri(*(void**)(&uri), &instance)); } return winrt::Windows::Foundation::Uri{ instance, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IUriRuntimeClassFactory::CreateWithRelativeUri(param::hstring const& baseUri, param::hstring const& relativeUri) const { void* instance{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateWithRelativeUri(*(void**)(&baseUri), *(void**)(&relativeUri), &instance)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateWithRelativeUri(*(void**)(&baseUri), *(void**)(&relativeUri), &instance)); } return winrt::Windows::Foundation::Uri{ instance, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IUriRuntimeClassWithAbsoluteCanonicalUri::AbsoluteCanonicalUri() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_AbsoluteCanonicalUri(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_AbsoluteCanonicalUri(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IUriRuntimeClassWithAbsoluteCanonicalUri::DisplayIri() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_DisplayIri(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_DisplayIri(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IWwwFormUrlDecoderEntry::Name() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Name(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Name(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IWwwFormUrlDecoderEntry::Value() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Value(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Value(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IWwwFormUrlDecoderRuntimeClass::GetFirstValueByName(param::hstring const& name) const { void* phstrValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetFirstValueByName(*(void**)(&name), &phstrValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetFirstValueByName(*(void**)(&name), &phstrValue)); } return hstring{ phstrValue, take_ownership_from_abi }; } template auto consume_Windows_Foundation_IWwwFormUrlDecoderRuntimeClassFactory::CreateWwwFormUrlDecoder(param::hstring const& query) const { void* instance{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateWwwFormUrlDecoder(*(void**)(&query), &instance)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateWwwFormUrlDecoder(*(void**)(&query), &instance)); } return winrt::Windows::Foundation::WwwFormUrlDecoder{ instance, take_ownership_from_abi }; } template struct delegate final : implements_delegate { delegate(H&& handler) : implements_delegate(std::forward(handler)) {} int32_t __stdcall Invoke(void* asyncInfo, int32_t asyncStatus) noexcept final try { (*this)(*reinterpret_cast(&asyncInfo), *reinterpret_cast(&asyncStatus)); return 0; } catch (...) { return to_hresult(); } }; template struct delegate, H> final : implements_delegate, H> { delegate(H&& handler) : implements_delegate, H>(std::forward(handler)) {} int32_t __stdcall Invoke(void* asyncInfo, arg_in progressInfo) noexcept final try { (*this)(*reinterpret_cast const*>(&asyncInfo), *reinterpret_cast(&progressInfo)); return 0; } catch (...) { return to_hresult(); } }; template struct delegate, H> final : implements_delegate, H> { delegate(H&& handler) : implements_delegate, H>(std::forward(handler)) {} int32_t __stdcall Invoke(void* asyncInfo, int32_t asyncStatus) noexcept final try { (*this)(*reinterpret_cast const*>(&asyncInfo), *reinterpret_cast(&asyncStatus)); return 0; } catch (...) { return to_hresult(); } }; template struct delegate, H> final : implements_delegate, H> { delegate(H&& handler) : implements_delegate, H>(std::forward(handler)) {} int32_t __stdcall Invoke(void* asyncInfo, int32_t asyncStatus) noexcept final try { (*this)(*reinterpret_cast const*>(&asyncInfo), *reinterpret_cast(&asyncStatus)); return 0; } catch (...) { return to_hresult(); } }; template struct delegate, H> final : implements_delegate, H> { delegate(H&& handler) : implements_delegate, H>(std::forward(handler)) {} int32_t __stdcall Invoke(void* asyncInfo, arg_in progressInfo) noexcept final try { (*this)(*reinterpret_cast const*>(&asyncInfo), *reinterpret_cast(&progressInfo)); return 0; } catch (...) { return to_hresult(); } }; template struct delegate, H> final : implements_delegate, H> { delegate(H&& handler) : implements_delegate, H>(std::forward(handler)) {} int32_t __stdcall Invoke(void* asyncInfo, int32_t asyncStatus) noexcept final try { (*this)(*reinterpret_cast const*>(&asyncInfo), *reinterpret_cast(&asyncStatus)); return 0; } catch (...) { return to_hresult(); } }; template struct delegate final : implements_delegate { delegate(H&& handler) : implements_delegate(std::forward(handler)) {} int32_t __stdcall Invoke() noexcept final try { (*this)(); return 0; } catch (...) { return to_hresult(); } }; template struct delegate, H> final : implements_delegate, H> { delegate(H&& handler) : implements_delegate, H>(std::forward(handler)) {} int32_t __stdcall Invoke(void* sender, arg_in args) noexcept final try { (*this)(*reinterpret_cast(&sender), *reinterpret_cast(&args)); return 0; } catch (...) { return to_hresult(); } }; template struct delegate, H> final : implements_delegate, H> { delegate(H&& handler) : implements_delegate, H>(std::forward(handler)) {} int32_t __stdcall Invoke(arg_in sender, arg_in args) noexcept final try { (*this)(*reinterpret_cast(&sender), *reinterpret_cast(&args)); return 0; } catch (...) { return to_hresult(); } }; template struct produce : produce_base { int32_t __stdcall put_Completed(void* handler) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Completed(*reinterpret_cast(&handler)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Completed(void** handler) noexcept final try { clear_abi(handler); typename D::abi_guard guard(this->shim()); *handler = detach_from(this->shim().Completed()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetResults() noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().GetResults(); return 0; } catch (...) { return to_hresult(); } }; template struct produce> : produce_base> { int32_t __stdcall put_Progress(void* handler) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Progress(*reinterpret_cast const*>(&handler)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Progress(void** winrt_impl_result) noexcept final try { clear_abi(winrt_impl_result); typename D::abi_guard guard(this->shim()); *winrt_impl_result = detach_from>(this->shim().Progress()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_Completed(void* handler) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Completed(*reinterpret_cast const*>(&handler)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Completed(void** winrt_impl_result) noexcept final try { clear_abi(winrt_impl_result); typename D::abi_guard guard(this->shim()); *winrt_impl_result = detach_from>(this->shim().Completed()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetResults() noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().GetResults(); return 0; } catch (...) { return to_hresult(); } }; template struct produce : produce_base { int32_t __stdcall get_Id(uint32_t* winrt_impl_result) noexcept final try { typename D::abi_guard guard(this->shim()); *winrt_impl_result = detach_from(this->shim().Id()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Status(int32_t* winrt_impl_result) noexcept final try { typename D::abi_guard guard(this->shim()); *winrt_impl_result = detach_from(this->shim().Status()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_ErrorCode(winrt::hresult* winrt_impl_result) noexcept final try { zero_abi(winrt_impl_result); typename D::abi_guard guard(this->shim()); *winrt_impl_result = detach_from(this->shim().ErrorCode()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall Cancel() noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Cancel(); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall Close() noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Close(); return 0; } catch (...) { return to_hresult(); } }; template struct produce> : produce_base> { int32_t __stdcall put_Progress(void* handler) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Progress(*reinterpret_cast const*>(&handler)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Progress(void** winrt_impl_result) noexcept final try { clear_abi(winrt_impl_result); typename D::abi_guard guard(this->shim()); *winrt_impl_result = detach_from>(this->shim().Progress()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_Completed(void* handler) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Completed(*reinterpret_cast const*>(&handler)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Completed(void** winrt_impl_result) noexcept final try { clear_abi(winrt_impl_result); typename D::abi_guard guard(this->shim()); *winrt_impl_result = detach_from>(this->shim().Completed()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetResults(arg_out winrt_impl_result) noexcept final try { clear_abi(winrt_impl_result); typename D::abi_guard guard(this->shim()); *winrt_impl_result = detach_from(this->shim().GetResults()); return 0; } catch (...) { return to_hresult(); } }; template struct produce> : produce_base> { int32_t __stdcall put_Completed(void* handler) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Completed(*reinterpret_cast const*>(&handler)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Completed(void** winrt_impl_result) noexcept final try { clear_abi(winrt_impl_result); typename D::abi_guard guard(this->shim()); *winrt_impl_result = detach_from>(this->shim().Completed()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetResults(arg_out winrt_impl_result) noexcept final try { clear_abi(winrt_impl_result); typename D::abi_guard guard(this->shim()); *winrt_impl_result = detach_from(this->shim().GetResults()); return 0; } catch (...) { return to_hresult(); } }; template struct produce : produce_base { int32_t __stdcall Close() noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Close(); return 0; } catch (...) { return to_hresult(); } }; #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall Complete() noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Complete(); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall Create(void* handler, void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().Create(*reinterpret_cast(&handler))); return 0; } catch (...) { return to_hresult(); } }; #endif template struct produce : produce_base { int32_t __stdcall GetActivationFactory(void* activatableClassId, void** factory) noexcept final try { clear_abi(factory); typename D::abi_guard guard(this->shim()); *factory = detach_from(this->shim().GetActivationFactory(*reinterpret_cast(&activatableClassId))); return 0; } catch (...) { return to_hresult(); } }; #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall CreateNewGuid(winrt::guid* result) noexcept final try { typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().CreateNewGuid()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Empty(winrt::guid* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Empty()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall Equals(winrt::guid const& target, winrt::guid const& value, bool* result) noexcept final try { typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().Equals(*reinterpret_cast(&target), *reinterpret_cast(&value))); return 0; } catch (...) { return to_hresult(); } }; #endif template struct produce : produce_base { int32_t __stdcall CreateReference(void** reference) noexcept final try { clear_abi(reference); typename D::abi_guard guard(this->shim()); *reference = detach_from(this->shim().CreateReference()); return 0; } catch (...) { return to_hresult(); } }; #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall Create(uint32_t capacity, void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Create(capacity)); return 0; } catch (...) { return to_hresult(); } }; #endif template struct produce : produce_base { int32_t __stdcall get_Capacity(uint32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Capacity()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall add_Closed(void* handler, winrt::event_token* cookie) noexcept final try { zero_abi(cookie); typename D::abi_guard guard(this->shim()); *cookie = detach_from(this->shim().Closed(*reinterpret_cast const*>(&handler))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall remove_Closed(winrt::event_token cookie) noexcept final { typename D::abi_guard guard(this->shim()); this->shim().Closed(*reinterpret_cast(&cookie)); return 0; } }; template struct produce : produce_base { int32_t __stdcall get_Type(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Type()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_IsNumericScalar(bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().IsNumericScalar()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetUInt8(uint8_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetUInt8()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetInt16(int16_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetInt16()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetUInt16(uint16_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetUInt16()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetInt32(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetInt32()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetUInt32(uint32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetUInt32()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetInt64(int64_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetInt64()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetUInt64(uint64_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetUInt64()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetSingle(float* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetSingle()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetDouble(double* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetDouble()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetChar16(char16_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetChar16()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetBoolean(bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetBoolean()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetString(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetString()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetGuid(winrt::guid* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetGuid()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetDateTime(int64_t* value) noexcept final try { zero_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetDateTime()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetTimeSpan(int64_t* value) noexcept final try { zero_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetTimeSpan()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetPoint(winrt::Windows::Foundation::Point* value) noexcept final try { zero_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetPoint()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetSize(winrt::Windows::Foundation::Size* value) noexcept final try { zero_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetSize()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetRect(winrt::Windows::Foundation::Rect* value) noexcept final try { zero_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetRect()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetUInt8Array(uint32_t* __valueSize, uint8_t** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); this->shim().GetUInt8Array(detach_abi(__valueSize, value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetInt16Array(uint32_t* __valueSize, int16_t** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); this->shim().GetInt16Array(detach_abi(__valueSize, value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetUInt16Array(uint32_t* __valueSize, uint16_t** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); this->shim().GetUInt16Array(detach_abi(__valueSize, value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetInt32Array(uint32_t* __valueSize, int32_t** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); this->shim().GetInt32Array(detach_abi(__valueSize, value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetUInt32Array(uint32_t* __valueSize, uint32_t** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); this->shim().GetUInt32Array(detach_abi(__valueSize, value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetInt64Array(uint32_t* __valueSize, int64_t** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); this->shim().GetInt64Array(detach_abi(__valueSize, value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetUInt64Array(uint32_t* __valueSize, uint64_t** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); this->shim().GetUInt64Array(detach_abi(__valueSize, value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetSingleArray(uint32_t* __valueSize, float** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); this->shim().GetSingleArray(detach_abi(__valueSize, value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetDoubleArray(uint32_t* __valueSize, double** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); this->shim().GetDoubleArray(detach_abi(__valueSize, value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetChar16Array(uint32_t* __valueSize, char16_t** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); this->shim().GetChar16Array(detach_abi(__valueSize, value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetBooleanArray(uint32_t* __valueSize, bool** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); this->shim().GetBooleanArray(detach_abi(__valueSize, value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetStringArray(uint32_t* __valueSize, void*** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); this->shim().GetStringArray(detach_abi(__valueSize, value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetInspectableArray(uint32_t* __valueSize, void*** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); this->shim().GetInspectableArray(detach_abi(__valueSize, value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetGuidArray(uint32_t* __valueSize, winrt::guid** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); this->shim().GetGuidArray(detach_abi(__valueSize, value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetDateTimeArray(uint32_t* __valueSize, int64_t** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); this->shim().GetDateTimeArray(detach_abi(__valueSize, value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetTimeSpanArray(uint32_t* __valueSize, int64_t** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); this->shim().GetTimeSpanArray(detach_abi(__valueSize, value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetPointArray(uint32_t* __valueSize, winrt::Windows::Foundation::Point** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); this->shim().GetPointArray(detach_abi(__valueSize, value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetSizeArray(uint32_t* __valueSize, winrt::Windows::Foundation::Size** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); this->shim().GetSizeArray(detach_abi(__valueSize, value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetRectArray(uint32_t* __valueSize, winrt::Windows::Foundation::Rect** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); this->shim().GetRectArray(detach_abi(__valueSize, value)); return 0; } catch (...) { return to_hresult(); } }; #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall CreateEmpty(void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateEmpty()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateUInt8(uint8_t value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateUInt8(value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateInt16(int16_t value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateInt16(value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateUInt16(uint16_t value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateUInt16(value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateInt32(int32_t value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateInt32(value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateUInt32(uint32_t value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateUInt32(value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateInt64(int64_t value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateInt64(value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateUInt64(uint64_t value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateUInt64(value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateSingle(float value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateSingle(value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateDouble(double value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateDouble(value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateChar16(char16_t value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateChar16(value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateBoolean(bool value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateBoolean(value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateString(void* value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateString(*reinterpret_cast(&value))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateInspectable(void* value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateInspectable(*reinterpret_cast(&value))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateGuid(winrt::guid value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateGuid(*reinterpret_cast(&value))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateDateTime(int64_t value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateDateTime(*reinterpret_cast(&value))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateTimeSpan(int64_t value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateTimeSpan(*reinterpret_cast(&value))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreatePoint(winrt::Windows::Foundation::Point value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreatePoint(*reinterpret_cast(&value))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateSize(winrt::Windows::Foundation::Size value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateSize(*reinterpret_cast(&value))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateRect(winrt::Windows::Foundation::Rect value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateRect(*reinterpret_cast(&value))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateUInt8Array(uint32_t __valueSize, uint8_t* value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateUInt8Array(array_view(reinterpret_cast(value), reinterpret_cast(value) + __valueSize))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateInt16Array(uint32_t __valueSize, int16_t* value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateInt16Array(array_view(reinterpret_cast(value), reinterpret_cast(value) + __valueSize))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateUInt16Array(uint32_t __valueSize, uint16_t* value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateUInt16Array(array_view(reinterpret_cast(value), reinterpret_cast(value) + __valueSize))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateInt32Array(uint32_t __valueSize, int32_t* value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateInt32Array(array_view(reinterpret_cast(value), reinterpret_cast(value) + __valueSize))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateUInt32Array(uint32_t __valueSize, uint32_t* value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateUInt32Array(array_view(reinterpret_cast(value), reinterpret_cast(value) + __valueSize))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateInt64Array(uint32_t __valueSize, int64_t* value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateInt64Array(array_view(reinterpret_cast(value), reinterpret_cast(value) + __valueSize))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateUInt64Array(uint32_t __valueSize, uint64_t* value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateUInt64Array(array_view(reinterpret_cast(value), reinterpret_cast(value) + __valueSize))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateSingleArray(uint32_t __valueSize, float* value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateSingleArray(array_view(reinterpret_cast(value), reinterpret_cast(value) + __valueSize))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateDoubleArray(uint32_t __valueSize, double* value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateDoubleArray(array_view(reinterpret_cast(value), reinterpret_cast(value) + __valueSize))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateChar16Array(uint32_t __valueSize, char16_t* value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateChar16Array(array_view(reinterpret_cast(value), reinterpret_cast(value) + __valueSize))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateBooleanArray(uint32_t __valueSize, bool* value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateBooleanArray(array_view(reinterpret_cast(value), reinterpret_cast(value) + __valueSize))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateStringArray(uint32_t __valueSize, void** value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateStringArray(array_view(reinterpret_cast(value), reinterpret_cast(value) + __valueSize))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateInspectableArray(uint32_t __valueSize, void** value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateInspectableArray(array_view(reinterpret_cast(value), reinterpret_cast(value) + __valueSize))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateGuidArray(uint32_t __valueSize, winrt::guid* value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateGuidArray(array_view(reinterpret_cast(value), reinterpret_cast(value) + __valueSize))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateDateTimeArray(uint32_t __valueSize, int64_t* value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateDateTimeArray(array_view(reinterpret_cast(value), reinterpret_cast(value) + __valueSize))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateTimeSpanArray(uint32_t __valueSize, int64_t* value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateTimeSpanArray(array_view(reinterpret_cast(value), reinterpret_cast(value) + __valueSize))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreatePointArray(uint32_t __valueSize, winrt::Windows::Foundation::Point* value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreatePointArray(array_view(reinterpret_cast(value), reinterpret_cast(value) + __valueSize))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateSizeArray(uint32_t __valueSize, winrt::Windows::Foundation::Size* value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateSizeArray(array_view(reinterpret_cast(value), reinterpret_cast(value) + __valueSize))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateRectArray(uint32_t __valueSize, winrt::Windows::Foundation::Rect* value, void** propertyValue) noexcept final try { clear_abi(propertyValue); typename D::abi_guard guard(this->shim()); *propertyValue = detach_from(this->shim().CreateRectArray(array_view(reinterpret_cast(value), reinterpret_cast(value) + __valueSize))); return 0; } catch (...) { return to_hresult(); } }; #endif template struct produce> : produce_base> { int32_t __stdcall get_Value(uint32_t* __winrt_impl_resultSize, T** winrt_impl_result) noexcept final try { clear_abi(winrt_impl_result); typename D::abi_guard guard(this->shim()); std::tie(*__winrt_impl_resultSize, *winrt_impl_result) = detach_abi(this->shim().Value()); return 0; } catch (...) { return to_hresult(); } }; template struct produce> : produce_base> { int32_t __stdcall get_Value(arg_out winrt_impl_result) noexcept final try { clear_abi(winrt_impl_result); typename D::abi_guard guard(this->shim()); *winrt_impl_result = detach_from(this->shim().Value()); return 0; } catch (...) { return to_hresult(); } }; template struct produce : produce_base { int32_t __stdcall ToString(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().ToString()); return 0; } catch (...) { return to_hresult(); } }; #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall UnescapeComponent(void* toUnescape, void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().UnescapeComponent(*reinterpret_cast(&toUnescape))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall EscapeComponent(void* toEscape, void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().EscapeComponent(*reinterpret_cast(&toEscape))); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_AbsoluteUri(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().AbsoluteUri()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_DisplayUri(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().DisplayUri()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Domain(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Domain()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Extension(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Extension()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Fragment(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Fragment()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Host(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Host()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Password(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Password()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Path(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Path()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Query(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Query()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_QueryParsed(void** ppWwwFormUrlDecoder) noexcept final try { clear_abi(ppWwwFormUrlDecoder); typename D::abi_guard guard(this->shim()); *ppWwwFormUrlDecoder = detach_from(this->shim().QueryParsed()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_RawUri(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().RawUri()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_SchemeName(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().SchemeName()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_UserName(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().UserName()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Port(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Port()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Suspicious(bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Suspicious()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall Equals(void* pUri, bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Equals(*reinterpret_cast(&pUri))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CombineUri(void* relativeUri, void** instance) noexcept final try { clear_abi(instance); typename D::abi_guard guard(this->shim()); *instance = detach_from(this->shim().CombineUri(*reinterpret_cast(&relativeUri))); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall CreateUri(void* uri, void** instance) noexcept final try { clear_abi(instance); typename D::abi_guard guard(this->shim()); *instance = detach_from(this->shim().CreateUri(*reinterpret_cast(&uri))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateWithRelativeUri(void* baseUri, void* relativeUri, void** instance) noexcept final try { clear_abi(instance); typename D::abi_guard guard(this->shim()); *instance = detach_from(this->shim().CreateWithRelativeUri(*reinterpret_cast(&baseUri), *reinterpret_cast(&relativeUri))); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_AbsoluteCanonicalUri(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().AbsoluteCanonicalUri()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_DisplayIri(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().DisplayIri()); return 0; } catch (...) { return to_hresult(); } }; #endif template struct produce : produce_base { int32_t __stdcall get_Name(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Name()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Value(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Value()); return 0; } catch (...) { return to_hresult(); } }; #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall GetFirstValueByName(void* name, void** phstrValue) noexcept final try { clear_abi(phstrValue); typename D::abi_guard guard(this->shim()); *phstrValue = detach_from(this->shim().GetFirstValueByName(*reinterpret_cast(&name))); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall CreateWwwFormUrlDecoder(void* query, void** instance) noexcept final try { clear_abi(instance); typename D::abi_guard guard(this->shim()); *instance = detach_from(this->shim().CreateWwwFormUrlDecoder(*reinterpret_cast(&query))); return 0; } catch (...) { return to_hresult(); } }; #endif } WINRT_EXPORT namespace winrt::Windows::Foundation { inline Deferral::Deferral(winrt::Windows::Foundation::DeferralCompletedHandler const& handler) : Deferral(impl::call_factory([&](IDeferralFactory const& f) { return f.Create(handler); })) { } inline auto GuidHelper::CreateNewGuid() { return impl::call_factory_cast([](IGuidHelperStatics const& f) { return f.CreateNewGuid(); }); } inline auto GuidHelper::Empty() { return impl::call_factory_cast([](IGuidHelperStatics const& f) { return f.Empty(); }); } inline auto GuidHelper::Equals(winrt::guid const& target, winrt::guid const& value) { return impl::call_factory([&](IGuidHelperStatics const& f) { return f.Equals(target, value); }); } inline MemoryBuffer::MemoryBuffer(uint32_t capacity) : MemoryBuffer(impl::call_factory([&](IMemoryBufferFactory const& f) { return f.Create(capacity); })) { } inline auto PropertyValue::CreateEmpty() { return impl::call_factory_cast([](IPropertyValueStatics const& f) { return f.CreateEmpty(); }); } inline auto PropertyValue::CreateUInt8(uint8_t value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateUInt8(value); }); } inline auto PropertyValue::CreateInt16(int16_t value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateInt16(value); }); } inline auto PropertyValue::CreateUInt16(uint16_t value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateUInt16(value); }); } inline auto PropertyValue::CreateInt32(int32_t value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateInt32(value); }); } inline auto PropertyValue::CreateUInt32(uint32_t value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateUInt32(value); }); } inline auto PropertyValue::CreateInt64(int64_t value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateInt64(value); }); } inline auto PropertyValue::CreateUInt64(uint64_t value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateUInt64(value); }); } inline auto PropertyValue::CreateSingle(float value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateSingle(value); }); } inline auto PropertyValue::CreateDouble(double value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateDouble(value); }); } inline auto PropertyValue::CreateChar16(char16_t value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateChar16(value); }); } inline auto PropertyValue::CreateBoolean(bool value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateBoolean(value); }); } inline auto PropertyValue::CreateString(param::hstring const& value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateString(value); }); } inline auto PropertyValue::CreateInspectable(winrt::Windows::Foundation::IInspectable const& value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateInspectable(value); }); } inline auto PropertyValue::CreateGuid(winrt::guid const& value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateGuid(value); }); } inline auto PropertyValue::CreateDateTime(winrt::Windows::Foundation::DateTime const& value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateDateTime(value); }); } inline auto PropertyValue::CreateTimeSpan(winrt::Windows::Foundation::TimeSpan const& value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateTimeSpan(value); }); } inline auto PropertyValue::CreatePoint(winrt::Windows::Foundation::Point const& value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreatePoint(value); }); } inline auto PropertyValue::CreateSize(winrt::Windows::Foundation::Size const& value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateSize(value); }); } inline auto PropertyValue::CreateRect(winrt::Windows::Foundation::Rect const& value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateRect(value); }); } inline auto PropertyValue::CreateUInt8Array(array_view value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateUInt8Array(value); }); } inline auto PropertyValue::CreateInt16Array(array_view value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateInt16Array(value); }); } inline auto PropertyValue::CreateUInt16Array(array_view value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateUInt16Array(value); }); } inline auto PropertyValue::CreateInt32Array(array_view value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateInt32Array(value); }); } inline auto PropertyValue::CreateUInt32Array(array_view value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateUInt32Array(value); }); } inline auto PropertyValue::CreateInt64Array(array_view value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateInt64Array(value); }); } inline auto PropertyValue::CreateUInt64Array(array_view value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateUInt64Array(value); }); } inline auto PropertyValue::CreateSingleArray(array_view value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateSingleArray(value); }); } inline auto PropertyValue::CreateDoubleArray(array_view value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateDoubleArray(value); }); } inline auto PropertyValue::CreateChar16Array(array_view value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateChar16Array(value); }); } inline auto PropertyValue::CreateBooleanArray(array_view value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateBooleanArray(value); }); } inline auto PropertyValue::CreateStringArray(array_view value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateStringArray(value); }); } inline auto PropertyValue::CreateInspectableArray(array_view value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateInspectableArray(value); }); } inline auto PropertyValue::CreateGuidArray(array_view value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateGuidArray(value); }); } inline auto PropertyValue::CreateDateTimeArray(array_view value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateDateTimeArray(value); }); } inline auto PropertyValue::CreateTimeSpanArray(array_view value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateTimeSpanArray(value); }); } inline auto PropertyValue::CreatePointArray(array_view value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreatePointArray(value); }); } inline auto PropertyValue::CreateSizeArray(array_view value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateSizeArray(value); }); } inline auto PropertyValue::CreateRectArray(array_view value) { return impl::call_factory([&](IPropertyValueStatics const& f) { return f.CreateRectArray(value); }); } inline auto Uri::UnescapeComponent(param::hstring const& toUnescape) { return impl::call_factory([&](IUriEscapeStatics const& f) { return f.UnescapeComponent(toUnescape); }); } inline auto Uri::EscapeComponent(param::hstring const& toEscape) { return impl::call_factory([&](IUriEscapeStatics const& f) { return f.EscapeComponent(toEscape); }); } inline Uri::Uri(param::hstring const& uri) : Uri(impl::call_factory([&](IUriRuntimeClassFactory const& f) { return f.CreateUri(uri); })) { } inline Uri::Uri(param::hstring const& baseUri, param::hstring const& relativeUri) : Uri(impl::call_factory([&](IUriRuntimeClassFactory const& f) { return f.CreateWithRelativeUri(baseUri, relativeUri); })) { } inline WwwFormUrlDecoder::WwwFormUrlDecoder(param::hstring const& query) : WwwFormUrlDecoder(impl::call_factory([&](IWwwFormUrlDecoderRuntimeClassFactory const& f) { return f.CreateWwwFormUrlDecoder(query); })) { } template AsyncActionCompletedHandler::AsyncActionCompletedHandler(L handler) : AsyncActionCompletedHandler(impl::make_delegate(std::forward(handler))) { } template AsyncActionCompletedHandler::AsyncActionCompletedHandler(F* handler) : AsyncActionCompletedHandler([=](auto&&... args) { return handler(args...); }) { } template AsyncActionCompletedHandler::AsyncActionCompletedHandler(O* object, M method) : AsyncActionCompletedHandler([=](auto&&... args) { return ((*object).*(method))(args...); }) { } template AsyncActionCompletedHandler::AsyncActionCompletedHandler(com_ptr&& object, M method) : AsyncActionCompletedHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); }) { } template AsyncActionCompletedHandler::AsyncActionCompletedHandler(weak_ref&& object, LM&& lambda_or_method) : AsyncActionCompletedHandler([o = std::move(object), lm = std::forward(lambda_or_method)](auto&&... args) { if (auto s = o.get()) { if constexpr (std::is_member_function_pointer_v) ((*s).*(lm))(args...); else lm(args...); } }) { } template AsyncActionCompletedHandler::AsyncActionCompletedHandler(std::shared_ptr&& object, M method) : AsyncActionCompletedHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); }) { } template AsyncActionCompletedHandler::AsyncActionCompletedHandler(std::weak_ptr&& object, LM&& lambda_or_method) : AsyncActionCompletedHandler([o = std::move(object), lm = std::forward(lambda_or_method)](auto&&... args) { if (auto s = o.lock()) { if constexpr (std::is_member_function_pointer_v) ((*s).*(lm))(args...); else lm(args...); } }) { } inline auto AsyncActionCompletedHandler::operator()(winrt::Windows::Foundation::IAsyncAction const& asyncInfo, winrt::Windows::Foundation::AsyncStatus const& asyncStatus) const { check_hresult((*(impl::abi_t**)this)->Invoke(*(void**)(&asyncInfo), static_cast(asyncStatus))); } template template AsyncActionProgressHandler::AsyncActionProgressHandler(L handler) : AsyncActionProgressHandler(impl::make_delegate>(std::forward(handler))) { } template template AsyncActionProgressHandler::AsyncActionProgressHandler(F* handler) : AsyncActionProgressHandler([=](auto&&... args) { return handler(args...); }) { } template template AsyncActionProgressHandler::AsyncActionProgressHandler(O* object, M method) : AsyncActionProgressHandler([=](auto&&... args) { return ((*object).*(method))(args...); }) { } template template AsyncActionProgressHandler::AsyncActionProgressHandler(com_ptr&& object, M method) : AsyncActionProgressHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); }) { } template template AsyncActionProgressHandler::AsyncActionProgressHandler(weak_ref&& object, LM&& lambda_or_method) : AsyncActionProgressHandler([o = std::move(object), lm = std::forward(lambda_or_method)](auto&&... args) { if (auto s = o.get()) { if constexpr (std::is_member_function_pointer_v) ((*s).*(lm))(args...); else lm(args...); } }) { } template template AsyncActionProgressHandler::AsyncActionProgressHandler(std::shared_ptr&& object, M method) : AsyncActionProgressHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); }) { } template template AsyncActionProgressHandler::AsyncActionProgressHandler(std::weak_ptr&& object, LM&& lambda_or_method) : AsyncActionProgressHandler([o = std::move(object), lm = std::forward(lambda_or_method)](auto&&... args) { if (auto s = o.lock()) { if constexpr (std::is_member_function_pointer_v) ((*s).*(lm))(args...); else lm(args...); } }) { } template auto AsyncActionProgressHandler::operator()(winrt::Windows::Foundation::IAsyncActionWithProgress const& asyncInfo, impl::param_type const& progressInfo) const { check_hresult((*(impl::abi_t>**)this)->Invoke(*(void**)(&asyncInfo), impl::bind_in(progressInfo))); } template template AsyncActionWithProgressCompletedHandler::AsyncActionWithProgressCompletedHandler(L handler) : AsyncActionWithProgressCompletedHandler(impl::make_delegate>(std::forward(handler))) { } template template AsyncActionWithProgressCompletedHandler::AsyncActionWithProgressCompletedHandler(F* handler) : AsyncActionWithProgressCompletedHandler([=](auto&&... args) { return handler(args...); }) { } template template AsyncActionWithProgressCompletedHandler::AsyncActionWithProgressCompletedHandler(O* object, M method) : AsyncActionWithProgressCompletedHandler([=](auto&&... args) { return ((*object).*(method))(args...); }) { } template template AsyncActionWithProgressCompletedHandler::AsyncActionWithProgressCompletedHandler(com_ptr&& object, M method) : AsyncActionWithProgressCompletedHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); }) { } template template AsyncActionWithProgressCompletedHandler::AsyncActionWithProgressCompletedHandler(weak_ref&& object, LM&& lambda_or_method) : AsyncActionWithProgressCompletedHandler([o = std::move(object), lm = std::forward(lambda_or_method)](auto&&... args) { if (auto s = o.get()) { if constexpr (std::is_member_function_pointer_v) ((*s).*(lm))(args...); else lm(args...); } }) { } template template AsyncActionWithProgressCompletedHandler::AsyncActionWithProgressCompletedHandler(std::shared_ptr&& object, M method) : AsyncActionWithProgressCompletedHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); }) { } template template AsyncActionWithProgressCompletedHandler::AsyncActionWithProgressCompletedHandler(std::weak_ptr&& object, LM&& lambda_or_method) : AsyncActionWithProgressCompletedHandler([o = std::move(object), lm = std::forward(lambda_or_method)](auto&&... args) { if (auto s = o.lock()) { if constexpr (std::is_member_function_pointer_v) ((*s).*(lm))(args...); else lm(args...); } }) { } template auto AsyncActionWithProgressCompletedHandler::operator()(winrt::Windows::Foundation::IAsyncActionWithProgress const& asyncInfo, winrt::Windows::Foundation::AsyncStatus const& asyncStatus) const { check_hresult((*(impl::abi_t>**)this)->Invoke(*(void**)(&asyncInfo), static_cast(asyncStatus))); } template template AsyncOperationCompletedHandler::AsyncOperationCompletedHandler(L handler) : AsyncOperationCompletedHandler(impl::make_delegate>(std::forward(handler))) { } template template AsyncOperationCompletedHandler::AsyncOperationCompletedHandler(F* handler) : AsyncOperationCompletedHandler([=](auto&&... args) { return handler(args...); }) { } template template AsyncOperationCompletedHandler::AsyncOperationCompletedHandler(O* object, M method) : AsyncOperationCompletedHandler([=](auto&&... args) { return ((*object).*(method))(args...); }) { } template template AsyncOperationCompletedHandler::AsyncOperationCompletedHandler(com_ptr&& object, M method) : AsyncOperationCompletedHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); }) { } template template AsyncOperationCompletedHandler::AsyncOperationCompletedHandler(weak_ref&& object, LM&& lambda_or_method) : AsyncOperationCompletedHandler([o = std::move(object), lm = std::forward(lambda_or_method)](auto&&... args) { if (auto s = o.get()) { if constexpr (std::is_member_function_pointer_v) ((*s).*(lm))(args...); else lm(args...); } }) { } template template AsyncOperationCompletedHandler::AsyncOperationCompletedHandler(std::shared_ptr&& object, M method) : AsyncOperationCompletedHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); }) { } template template AsyncOperationCompletedHandler::AsyncOperationCompletedHandler(std::weak_ptr&& object, LM&& lambda_or_method) : AsyncOperationCompletedHandler([o = std::move(object), lm = std::forward(lambda_or_method)](auto&&... args) { if (auto s = o.lock()) { if constexpr (std::is_member_function_pointer_v) ((*s).*(lm))(args...); else lm(args...); } }) { } template auto AsyncOperationCompletedHandler::operator()(winrt::Windows::Foundation::IAsyncOperation const& asyncInfo, winrt::Windows::Foundation::AsyncStatus const& asyncStatus) const { check_hresult((*(impl::abi_t>**)this)->Invoke(*(void**)(&asyncInfo), static_cast(asyncStatus))); } template template AsyncOperationProgressHandler::AsyncOperationProgressHandler(L handler) : AsyncOperationProgressHandler(impl::make_delegate>(std::forward(handler))) { } template template AsyncOperationProgressHandler::AsyncOperationProgressHandler(F* handler) : AsyncOperationProgressHandler([=](auto&&... args) { return handler(args...); }) { } template template AsyncOperationProgressHandler::AsyncOperationProgressHandler(O* object, M method) : AsyncOperationProgressHandler([=](auto&&... args) { return ((*object).*(method))(args...); }) { } template template AsyncOperationProgressHandler::AsyncOperationProgressHandler(com_ptr&& object, M method) : AsyncOperationProgressHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); }) { } template template AsyncOperationProgressHandler::AsyncOperationProgressHandler(weak_ref&& object, LM&& lambda_or_method) : AsyncOperationProgressHandler([o = std::move(object), lm = std::forward(lambda_or_method)](auto&&... args) { if (auto s = o.get()) { if constexpr (std::is_member_function_pointer_v) ((*s).*(lm))(args...); else lm(args...); } }) { } template template AsyncOperationProgressHandler::AsyncOperationProgressHandler(std::shared_ptr&& object, M method) : AsyncOperationProgressHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); }) { } template template AsyncOperationProgressHandler::AsyncOperationProgressHandler(std::weak_ptr&& object, LM&& lambda_or_method) : AsyncOperationProgressHandler([o = std::move(object), lm = std::forward(lambda_or_method)](auto&&... args) { if (auto s = o.lock()) { if constexpr (std::is_member_function_pointer_v) ((*s).*(lm))(args...); else lm(args...); } }) { } template auto AsyncOperationProgressHandler::operator()(winrt::Windows::Foundation::IAsyncOperationWithProgress const& asyncInfo, impl::param_type const& progressInfo) const { check_hresult((*(impl::abi_t>**)this)->Invoke(*(void**)(&asyncInfo), impl::bind_in(progressInfo))); } template template AsyncOperationWithProgressCompletedHandler::AsyncOperationWithProgressCompletedHandler(L handler) : AsyncOperationWithProgressCompletedHandler(impl::make_delegate>(std::forward(handler))) { } template template AsyncOperationWithProgressCompletedHandler::AsyncOperationWithProgressCompletedHandler(F* handler) : AsyncOperationWithProgressCompletedHandler([=](auto&&... args) { return handler(args...); }) { } template template AsyncOperationWithProgressCompletedHandler::AsyncOperationWithProgressCompletedHandler(O* object, M method) : AsyncOperationWithProgressCompletedHandler([=](auto&&... args) { return ((*object).*(method))(args...); }) { } template template AsyncOperationWithProgressCompletedHandler::AsyncOperationWithProgressCompletedHandler(com_ptr&& object, M method) : AsyncOperationWithProgressCompletedHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); }) { } template template AsyncOperationWithProgressCompletedHandler::AsyncOperationWithProgressCompletedHandler(weak_ref&& object, LM&& lambda_or_method) : AsyncOperationWithProgressCompletedHandler([o = std::move(object), lm = std::forward(lambda_or_method)](auto&&... args) { if (auto s = o.get()) { if constexpr (std::is_member_function_pointer_v) ((*s).*(lm))(args...); else lm(args...); } }) { } template template AsyncOperationWithProgressCompletedHandler::AsyncOperationWithProgressCompletedHandler(std::shared_ptr&& object, M method) : AsyncOperationWithProgressCompletedHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); }) { } template template AsyncOperationWithProgressCompletedHandler::AsyncOperationWithProgressCompletedHandler(std::weak_ptr&& object, LM&& lambda_or_method) : AsyncOperationWithProgressCompletedHandler([o = std::move(object), lm = std::forward(lambda_or_method)](auto&&... args) { if (auto s = o.lock()) { if constexpr (std::is_member_function_pointer_v) ((*s).*(lm))(args...); else lm(args...); } }) { } template auto AsyncOperationWithProgressCompletedHandler::operator()(winrt::Windows::Foundation::IAsyncOperationWithProgress const& asyncInfo, winrt::Windows::Foundation::AsyncStatus const& asyncStatus) const { check_hresult((*(impl::abi_t>**)this)->Invoke(*(void**)(&asyncInfo), static_cast(asyncStatus))); } template DeferralCompletedHandler::DeferralCompletedHandler(L handler) : DeferralCompletedHandler(impl::make_delegate(std::forward(handler))) { } template DeferralCompletedHandler::DeferralCompletedHandler(F* handler) : DeferralCompletedHandler([=](auto&&... args) { return handler(args...); }) { } template DeferralCompletedHandler::DeferralCompletedHandler(O* object, M method) : DeferralCompletedHandler([=](auto&&... args) { return ((*object).*(method))(args...); }) { } template DeferralCompletedHandler::DeferralCompletedHandler(com_ptr&& object, M method) : DeferralCompletedHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); }) { } template DeferralCompletedHandler::DeferralCompletedHandler(weak_ref&& object, LM&& lambda_or_method) : DeferralCompletedHandler([o = std::move(object), lm = std::forward(lambda_or_method)](auto&&... args) { if (auto s = o.get()) { if constexpr (std::is_member_function_pointer_v) ((*s).*(lm))(args...); else lm(args...); } }) { } template DeferralCompletedHandler::DeferralCompletedHandler(std::shared_ptr&& object, M method) : DeferralCompletedHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); }) { } template DeferralCompletedHandler::DeferralCompletedHandler(std::weak_ptr&& object, LM&& lambda_or_method) : DeferralCompletedHandler([o = std::move(object), lm = std::forward(lambda_or_method)](auto&&... args) { if (auto s = o.lock()) { if constexpr (std::is_member_function_pointer_v) ((*s).*(lm))(args...); else lm(args...); } }) { } inline auto DeferralCompletedHandler::operator()() const { check_hresult((*(impl::abi_t**)this)->Invoke()); } template template EventHandler::EventHandler(L handler) : EventHandler(impl::make_delegate>(std::forward(handler))) { } template template EventHandler::EventHandler(F* handler) : EventHandler([=](auto&&... args) { return handler(args...); }) { } template template EventHandler::EventHandler(O* object, M method) : EventHandler([=](auto&&... args) { return ((*object).*(method))(args...); }) { } template template EventHandler::EventHandler(com_ptr&& object, M method) : EventHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); }) { } template template EventHandler::EventHandler(weak_ref&& object, LM&& lambda_or_method) : EventHandler([o = std::move(object), lm = std::forward(lambda_or_method)](auto&&... args) { if (auto s = o.get()) { if constexpr (std::is_member_function_pointer_v) ((*s).*(lm))(args...); else lm(args...); } }) { } template template EventHandler::EventHandler(std::shared_ptr&& object, M method) : EventHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); }) { } template template EventHandler::EventHandler(std::weak_ptr&& object, LM&& lambda_or_method) : EventHandler([o = std::move(object), lm = std::forward(lambda_or_method)](auto&&... args) { if (auto s = o.lock()) { if constexpr (std::is_member_function_pointer_v) ((*s).*(lm))(args...); else lm(args...); } }) { } template auto EventHandler::operator()(winrt::Windows::Foundation::IInspectable const& sender, impl::param_type const& args) const { check_hresult((*(impl::abi_t>**)this)->Invoke(*(void**)(&sender), impl::bind_in(args))); } template template TypedEventHandler::TypedEventHandler(L handler) : TypedEventHandler(impl::make_delegate>(std::forward(handler))) { } template template TypedEventHandler::TypedEventHandler(F* handler) : TypedEventHandler([=](auto&&... args) { return handler(args...); }) { } template template TypedEventHandler::TypedEventHandler(O* object, M method) : TypedEventHandler([=](auto&&... args) { return ((*object).*(method))(args...); }) { } template template TypedEventHandler::TypedEventHandler(com_ptr&& object, M method) : TypedEventHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); }) { } template template TypedEventHandler::TypedEventHandler(weak_ref&& object, LM&& lambda_or_method) : TypedEventHandler([o = std::move(object), lm = std::forward(lambda_or_method)](auto&&... args) { if (auto s = o.get()) { if constexpr (std::is_member_function_pointer_v) ((*s).*(lm))(args...); else lm(args...); } }) { } template template TypedEventHandler::TypedEventHandler(std::shared_ptr&& object, M method) : TypedEventHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); }) { } template template TypedEventHandler::TypedEventHandler(std::weak_ptr&& object, LM&& lambda_or_method) : TypedEventHandler([o = std::move(object), lm = std::forward(lambda_or_method)](auto&&... args) { if (auto s = o.lock()) { if constexpr (std::is_member_function_pointer_v) ((*s).*(lm))(args...); else lm(args...); } }) { } template auto TypedEventHandler::operator()(impl::param_type const& sender, impl::param_type const& args) const { check_hresult((*(impl::abi_t>**)this)->Invoke(impl::bind_in(sender), impl::bind_in(args))); } } namespace std { #ifndef WINRT_LEAN_AND_MEAN template<> struct hash : winrt::impl::hash_base {}; template struct hash> : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template struct hash> : winrt::impl::hash_base {}; template struct hash> : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template struct hash> : winrt::impl::hash_base {}; template struct hash> : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; #endif #ifdef __cpp_lib_format template<> struct formatter : formatter {}; #endif } namespace winrt::impl { template struct reference : implements, Windows::Foundation::IReference, Windows::Foundation::IPropertyValue> { reference(T const& value) : m_value(value) { } T Value() const { return m_value; } Windows::Foundation::PropertyType Type() const noexcept { return Windows::Foundation::PropertyType::OtherType; } static constexpr bool IsNumericScalar() noexcept { return std::is_arithmetic_v || std::is_enum_v; } uint8_t GetUInt8() const { return to_scalar(); } int16_t GetInt16() const { return to_scalar(); } uint16_t GetUInt16() const { return to_scalar(); } int32_t GetInt32() const { return to_scalar(); } uint32_t GetUInt32() const { return to_scalar(); } int64_t GetInt64() const { return to_scalar(); } uint64_t GetUInt64() const { return to_scalar(); } float GetSingle() { throw hresult_not_implemented(); } double GetDouble() { throw hresult_not_implemented(); } char16_t GetChar16() { throw hresult_not_implemented(); } bool GetBoolean() { throw hresult_not_implemented(); } hstring GetString() { throw hresult_not_implemented(); } guid GetGuid() { throw hresult_not_implemented(); } Windows::Foundation::DateTime GetDateTime() { throw hresult_not_implemented(); } Windows::Foundation::TimeSpan GetTimeSpan() { throw hresult_not_implemented(); } Windows::Foundation::Point GetPoint() { throw hresult_not_implemented(); } Windows::Foundation::Size GetSize() { throw hresult_not_implemented(); } Windows::Foundation::Rect GetRect() { throw hresult_not_implemented(); } void GetUInt8Array(com_array &) { throw hresult_not_implemented(); } void GetInt16Array(com_array &) { throw hresult_not_implemented(); } void GetUInt16Array(com_array &) { throw hresult_not_implemented(); } void GetInt32Array(com_array &) { throw hresult_not_implemented(); } void GetUInt32Array(com_array &) { throw hresult_not_implemented(); } void GetInt64Array(com_array &) { throw hresult_not_implemented(); } void GetUInt64Array(com_array &) { throw hresult_not_implemented(); } void GetSingleArray(com_array &) { throw hresult_not_implemented(); } void GetDoubleArray(com_array &) { throw hresult_not_implemented(); } void GetChar16Array(com_array &) { throw hresult_not_implemented(); } void GetBooleanArray(com_array &) { throw hresult_not_implemented(); } void GetStringArray(com_array &) { throw hresult_not_implemented(); } void GetInspectableArray(com_array &) { throw hresult_not_implemented(); } void GetGuidArray(com_array &) { throw hresult_not_implemented(); } void GetDateTimeArray(com_array &) { throw hresult_not_implemented(); } void GetTimeSpanArray(com_array &) { throw hresult_not_implemented(); } void GetPointArray(com_array &) { throw hresult_not_implemented(); } void GetSizeArray(com_array &) { throw hresult_not_implemented(); } void GetRectArray(com_array &) { throw hresult_not_implemented(); } private: template To to_scalar() const { if constexpr (IsNumericScalar()) { return static_cast(m_value); } else { throw hresult_not_implemented(); } } T m_value; }; template struct reference_traits { static auto make(T const& value) { return winrt::make>(value); } using itf = Windows::Foundation::IReference; }; template <> struct reference_traits { static auto make(uint8_t value) { return Windows::Foundation::PropertyValue::CreateUInt8(value); } using itf = Windows::Foundation::IReference; }; template <> struct reference_traits { static auto make(uint16_t value) { return Windows::Foundation::PropertyValue::CreateUInt16(value); } using itf = Windows::Foundation::IReference; }; template <> struct reference_traits { static auto make(int16_t value) { return Windows::Foundation::PropertyValue::CreateInt16(value); } using itf = Windows::Foundation::IReference; }; template <> struct reference_traits { static auto make(uint32_t value) { return Windows::Foundation::PropertyValue::CreateUInt32(value); } using itf = Windows::Foundation::IReference; }; template <> struct reference_traits { static auto make(int32_t value) { return Windows::Foundation::PropertyValue::CreateInt32(value); } using itf = Windows::Foundation::IReference; }; template <> struct reference_traits { static auto make(uint64_t value) { return Windows::Foundation::PropertyValue::CreateUInt64(value); } using itf = Windows::Foundation::IReference; }; template <> struct reference_traits { static auto make(int64_t value) { return Windows::Foundation::PropertyValue::CreateInt64(value); } using itf = Windows::Foundation::IReference; }; template <> struct reference_traits { static auto make(float value) { return Windows::Foundation::PropertyValue::CreateSingle(value); } using itf = Windows::Foundation::IReference; }; template <> struct reference_traits { static auto make(double value) { return Windows::Foundation::PropertyValue::CreateDouble(value); } using itf = Windows::Foundation::IReference; }; template <> struct reference_traits { static auto make(char16_t value) { return Windows::Foundation::PropertyValue::CreateChar16(value); } using itf = Windows::Foundation::IReference; }; template <> struct reference_traits { static auto make(bool value) { return Windows::Foundation::PropertyValue::CreateBoolean(value); } using itf = Windows::Foundation::IReference; }; template <> struct reference_traits { static auto make(hstring const& value) { return Windows::Foundation::PropertyValue::CreateString(value); } using itf = Windows::Foundation::IReference; }; template <> struct reference_traits { static auto make(Windows::Foundation::IInspectable const& value) { return Windows::Foundation::PropertyValue::CreateInspectable(value); } using itf = Windows::Foundation::IInspectable; }; template <> struct reference_traits { static auto make(guid const& value) { return Windows::Foundation::PropertyValue::CreateGuid(value); } using itf = Windows::Foundation::IReference; }; template <> struct reference_traits { static auto make(GUID const& value) { return Windows::Foundation::PropertyValue::CreateGuid(reinterpret_cast(value)); } using itf = Windows::Foundation::IReference; }; template <> struct reference_traits { static auto make(Windows::Foundation::DateTime value) { return Windows::Foundation::PropertyValue::CreateDateTime(value); } using itf = Windows::Foundation::IReference; }; template <> struct reference_traits { static auto make(Windows::Foundation::TimeSpan value) { return Windows::Foundation::PropertyValue::CreateTimeSpan(value); } using itf = Windows::Foundation::IReference; }; template <> struct reference_traits { static auto make(Windows::Foundation::Point const& value) { return Windows::Foundation::PropertyValue::CreatePoint(value); } using itf = Windows::Foundation::IReference; }; template <> struct reference_traits { static auto make(Windows::Foundation::Size const& value) { return Windows::Foundation::PropertyValue::CreateSize(value); } using itf = Windows::Foundation::IReference; }; template <> struct reference_traits { static auto make(Windows::Foundation::Rect const& value) { return Windows::Foundation::PropertyValue::CreateRect(value); } using itf = Windows::Foundation::IReference; }; template <> struct reference_traits> { static auto make(array_view const& value) { return Windows::Foundation::PropertyValue::CreateUInt8Array(value); } using itf = Windows::Foundation::IReferenceArray; }; template <> struct reference_traits> { static auto make(array_view const& value) { return Windows::Foundation::PropertyValue::CreateInt16Array(value); } using itf = Windows::Foundation::IReferenceArray; }; template <> struct reference_traits> { static auto make(array_view const& value) { return Windows::Foundation::PropertyValue::CreateUInt16Array(value); } using itf = Windows::Foundation::IReferenceArray; }; template <> struct reference_traits> { static auto make(array_view const& value) { return Windows::Foundation::PropertyValue::CreateInt32Array(value); } using itf = Windows::Foundation::IReferenceArray; }; template <> struct reference_traits> { static auto make(com_array const& value) { return Windows::Foundation::PropertyValue::CreateUInt32Array(value); } using itf = Windows::Foundation::IReferenceArray; }; template <> struct reference_traits> { static auto make(array_view const& value) { return Windows::Foundation::PropertyValue::CreateInt64Array(value); } using itf = Windows::Foundation::IReferenceArray; }; template <> struct reference_traits> { static auto make(array_view const& value) { return Windows::Foundation::PropertyValue::CreateUInt64Array(value); } using itf = Windows::Foundation::IReferenceArray; }; template <> struct reference_traits> { static auto make(array_view const& value) { return Windows::Foundation::PropertyValue::CreateSingleArray(value); } using itf = Windows::Foundation::IReferenceArray; }; template <> struct reference_traits> { static auto make(array_view const& value) { return Windows::Foundation::PropertyValue::CreateDoubleArray(value); } using itf = Windows::Foundation::IReferenceArray; }; template <> struct reference_traits> { static auto make(array_view const& value) { return Windows::Foundation::PropertyValue::CreateChar16Array(value); } using itf = Windows::Foundation::IReferenceArray; }; template <> struct reference_traits> { static auto make(array_view const& value) { return Windows::Foundation::PropertyValue::CreateBooleanArray(value); } using itf = Windows::Foundation::IReferenceArray; }; template <> struct reference_traits> { static auto make(array_view const& value) { return Windows::Foundation::PropertyValue::CreateStringArray(value); } using itf = Windows::Foundation::IReferenceArray; }; template <> struct reference_traits> { static auto make(array_view const& value) { return Windows::Foundation::PropertyValue::CreateInspectableArray(value); } using itf = Windows::Foundation::IReferenceArray; }; template <> struct reference_traits> { static auto make(array_view const& value) { return Windows::Foundation::PropertyValue::CreateGuidArray(value); } using itf = Windows::Foundation::IReferenceArray; }; template <> struct reference_traits> { static auto make(array_view const& value) { return Windows::Foundation::PropertyValue::CreateGuidArray(reinterpret_cast const&>(value)); } using itf = Windows::Foundation::IReferenceArray; }; template <> struct reference_traits> { static auto make(array_view const& value) { return Windows::Foundation::PropertyValue::CreateDateTimeArray(value); } using itf = Windows::Foundation::IReferenceArray; }; template <> struct reference_traits> { static auto make(array_view const& value) { return Windows::Foundation::PropertyValue::CreateTimeSpanArray(value); } using itf = Windows::Foundation::IReferenceArray; }; template <> struct reference_traits> { static auto make(array_view const& value) { return Windows::Foundation::PropertyValue::CreatePointArray(value); } using itf = Windows::Foundation::IReferenceArray; }; template <> struct reference_traits> { static auto make(array_view const& value) { return Windows::Foundation::PropertyValue::CreateSizeArray(value); } using itf = Windows::Foundation::IReferenceArray; }; template <> struct reference_traits> { static auto make(array_view const& value) { return Windows::Foundation::PropertyValue::CreateRectArray(value); } using itf = Windows::Foundation::IReferenceArray; }; } WINRT_EXPORT namespace winrt::Windows::Foundation { template bool operator==(IReference const& left, IReference const& right) { if (get_abi(left) == get_abi(right)) { return true; } if (!left || !right) { return false; } return left.Value() == right.Value(); } template bool operator!=(IReference const& left, IReference const& right) { return !(left == right); } } namespace winrt::impl { template T unbox_value_type(From&& value) { if (!value) { throw hresult_no_interface(); } if constexpr (std::is_enum_v) { if (auto temp = value.template try_as>()) { return temp.Value(); } else { return static_cast(value.template as>>().Value()); } } else if constexpr (std::is_same_v>) { T result; reinterpret_cast&>(result) = value.template as::itf>().Value(); return result; } else { return value.template as::itf>().Value(); } } template Ret unbox_value_type_or(From&& value, U&& default_value) { if constexpr (std::is_enum_v) { if (auto temp = value.template try_as>()) { return temp.Value(); } if (auto temp = value.template try_as>>()) { return static_cast(temp.Value()); } } else if constexpr (std::is_same_v>) { if (auto temp = value.template try_as::itf>()) { T result; reinterpret_cast&>(result) = temp.Value(); return result; } } else { if (auto temp = value.template try_as::itf>()) { return temp.Value(); } } return default_value; } template , int>> auto as(From* ptr) { if constexpr (impl::is_com_interface_v) { return unbox_value_type(reinterpret_cast(ptr)); } else { return unbox_value_type(reinterpret_cast const&>(ptr)); } } template , int>> auto try_as(From* ptr) noexcept { using type = std::conditional_t, Windows::Foundation::IUnknown, com_ptr>; return unbox_value_type_or>(reinterpret_cast(ptr), std::nullopt); } } WINRT_EXPORT namespace winrt { inline Windows::Foundation::IInspectable box_value(param::hstring const& value) { return Windows::Foundation::IReference(*(hstring*)(&value)); } template , int> = 0> Windows::Foundation::IInspectable box_value(T const& value) { if constexpr (std::is_base_of_v) { return value; } else { return impl::reference_traits::make(value); } } template T unbox_value(Windows::Foundation::IInspectable const& value) { if constexpr (std::is_base_of_v) { return value.as(); } else { return impl::unbox_value_type(value); } } template , int> = 0> hstring unbox_value_or(Windows::Foundation::IInspectable const& value, param::hstring const& default_value) { if (value) { if (auto temp = value.try_as>()) { return temp.Value(); } } return *(hstring*)(&default_value); } template , int> = 0> T unbox_value_or(Windows::Foundation::IInspectable const& value, T const& default_value) { if (value) { if constexpr (std::is_base_of_v) { if (auto temp = value.try_as()) { return temp; } } else { return impl::unbox_value_type_or(value, default_value); } } return default_value; } template using optional = typename impl::reference_traits::itf; } WINRT_EXPORT namespace winrt { #ifdef WINRT_IMPL_COROUTINES template struct deferrable_event_args { Windows::Foundation::Deferral GetDeferral() { slim_lock_guard const guard(m_lock); if (m_handle) { // Cannot ask for deferral after the event handler returned. throw hresult_illegal_method_call(); } Windows::Foundation::Deferral deferral{ {static_cast(*this).get_strong(), &deferrable_event_args::one_deferral_completed } }; ++m_outstanding_deferrals; return deferral; } [[nodiscard]] Windows::Foundation::IAsyncAction wait_for_deferrals() { struct awaitable : impl::suspend_always { bool await_suspend(coroutine_handle handle) { return m_deferrable.await_suspend(handle); } deferrable_event_args& m_deferrable; }; co_await awaitable{ {}, *this }; } private: using coroutine_handle = impl::coroutine_handle<>; void one_deferral_completed() { coroutine_handle resume = nullptr; { slim_lock_guard const guard(m_lock); if (m_outstanding_deferrals <= 0) { throw hresult_illegal_method_call(); } if (--m_outstanding_deferrals == 0) { resume = m_handle; } } if (resume) { impl::resume_background(resume); } } bool await_suspend(coroutine_handle handle) noexcept { slim_lock_guard const guard(m_lock); m_handle = handle; return m_outstanding_deferrals > 0; } slim_mutex m_lock; int32_t m_outstanding_deferrals = 0; coroutine_handle m_handle = nullptr; }; #endif } namespace winrt::impl { template struct async_completed_handler; template using async_completed_handler_t = typename async_completed_handler::type; template <> struct async_completed_handler { using type = Windows::Foundation::AsyncActionCompletedHandler; }; template struct async_completed_handler> { using type = Windows::Foundation::AsyncActionWithProgressCompletedHandler; }; template struct async_completed_handler> { using type = Windows::Foundation::AsyncOperationCompletedHandler; }; template struct async_completed_handler> { using type = Windows::Foundation::AsyncOperationWithProgressCompletedHandler; }; inline void check_sta_blocking_wait() noexcept { // Note: A blocking wait on the UI thread for an asynchronous operation can cause a deadlock. // See https://docs.microsoft.com/windows/uwp/cpp-and-winrt-apis/concurrency#block-the-calling-thread WINRT_ASSERT(!is_sta_thread()); } template std::pair make_delegate_with_shared_state(H&& handler) { auto d = make_delegate(std::forward(handler)); auto abi = reinterpret_cast*>(get_abi(d)); return { std::move(d), abi }; } template auto wait_for_completed(Async const& async, uint32_t const timeout) { struct shared_type { handle event{ check_pointer(WINRT_IMPL_CreateEventW(nullptr, true, false, nullptr)) }; Windows::Foundation::AsyncStatus status{ Windows::Foundation::AsyncStatus::Started }; void operator()(Async const&, Windows::Foundation::AsyncStatus operation_status) noexcept { status = operation_status; WINRT_VERIFY(WINRT_IMPL_SetEvent(event.get())); } }; auto [delegate, shared] = make_delegate_with_shared_state>(shared_type{}); async.Completed(delegate); WINRT_IMPL_WaitForSingleObject(shared->event.get(), timeout); return shared->status; } template auto wait_for(Async const& async, Windows::Foundation::TimeSpan const& timeout) { check_sta_blocking_wait(); auto const milliseconds = std::chrono::duration_cast(timeout).count(); WINRT_ASSERT((milliseconds >= 0) && (static_cast(milliseconds) < 0xFFFFFFFFull)); // Within uint32_t range and not INFINITE return wait_for_completed(async, static_cast(milliseconds)); } inline void check_status_canceled(Windows::Foundation::AsyncStatus status) { if (status == Windows::Foundation::AsyncStatus::Canceled) { throw hresult_canceled(); } } template auto wait_get(Async const& async) { check_sta_blocking_wait(); auto status = async.Status(); if (status == Windows::Foundation::AsyncStatus::Started) { status = wait_for_completed(async, 0xFFFFFFFF); // INFINITE } check_status_canceled(status); return async.GetResults(); } struct ignore_apartment_context {}; template struct disconnect_aware_handler : private std::conditional_t { disconnect_aware_handler(Awaiter* awaiter, coroutine_handle<> handle) noexcept : m_awaiter(awaiter), m_handle(handle) { } disconnect_aware_handler(disconnect_aware_handler&& other) = default; ~disconnect_aware_handler() { if (m_handle.value) Complete(); } template void operator()(Async&&, Windows::Foundation::AsyncStatus status) { m_awaiter.value->status = status; Complete(); } private: movable_primitive m_awaiter; movable_primitive, nullptr> m_handle; void Complete() { if (m_awaiter.value->suspending.exchange(false, std::memory_order_release)) { m_handle.value = nullptr; // resumption deferred to await_suspend } else { auto handle = m_handle.detach(); if constexpr (preserve_context) { if (!resume_apartment(*this, handle, &m_awaiter.value->failure)) { handle.resume(); } } else { handle.resume(); } } } }; #ifdef WINRT_IMPL_COROUTINES template struct await_adapter : cancellable_awaiter> { template await_adapter(T&& async) : async(std::forward(async)) { } std::conditional_t async; Windows::Foundation::AsyncStatus status = Windows::Foundation::AsyncStatus::Started; int32_t failure = 0; std::atomic suspending = true; void enable_cancellation(cancellable_promise* promise) { promise->set_canceller([](void* parameter) { cancel_asynchronously(reinterpret_cast(parameter)->async); }, this); } bool await_ready() const noexcept { return false; } template bool await_suspend(coroutine_handle handle) { this->set_cancellable_promise_from_handle(handle); return register_completed_callback(handle); } auto await_resume() const { check_hresult(failure); check_status_canceled(status); return async.GetResults(); } private: bool register_completed_callback(coroutine_handle<> handle) { if constexpr (!preserve_context) { // Ensure that the illegal delegate assignment propagates properly. suspending.store(true, std::memory_order_relaxed); } async.Completed(disconnect_aware_handler(this, handle)); return suspending.exchange(false, std::memory_order_acquire); } static fire_and_forget cancel_asynchronously(Async async) { co_await winrt::resume_background(); try { async.Cancel(); } catch (hresult_error const&) { } } }; #endif template auto consume_Windows_Foundation_IAsyncAction::get() const { impl::wait_get(static_cast(static_cast(*this))); } template auto consume_Windows_Foundation_IAsyncAction::wait_for(Windows::Foundation::TimeSpan const& timeout) const { return impl::wait_for(static_cast(static_cast(*this)), timeout); } template auto consume_Windows_Foundation_IAsyncOperation::get() const { return impl::wait_get(static_cast const&>(static_cast(*this))); } template auto consume_Windows_Foundation_IAsyncOperation::wait_for(Windows::Foundation::TimeSpan const& timeout) const { return impl::wait_for(static_cast const&>(static_cast(*this)), timeout); } template auto consume_Windows_Foundation_IAsyncActionWithProgress::get() const { impl::wait_get(static_cast const&>(static_cast(*this))); } template auto consume_Windows_Foundation_IAsyncActionWithProgress::wait_for(Windows::Foundation::TimeSpan const& timeout) const { return impl::wait_for(static_cast const&>(static_cast(*this)), timeout); } template auto consume_Windows_Foundation_IAsyncOperationWithProgress::get() const { return impl::wait_get(static_cast const&>(static_cast(*this))); } template auto consume_Windows_Foundation_IAsyncOperationWithProgress::wait_for(Windows::Foundation::TimeSpan const& timeout) const { return impl::wait_for(static_cast const&>(static_cast(*this)), timeout); } } #ifdef WINRT_IMPL_COROUTINES WINRT_EXPORT namespace winrt { template>> inline impl::await_adapter, false> resume_agile(Async&& async) { return { std::forward(async) }; }; } WINRT_EXPORT namespace winrt::Windows::Foundation { inline impl::await_adapter operator co_await(IAsyncAction const& async) { return{ async }; } template impl::await_adapter> operator co_await(IAsyncActionWithProgress const& async) { return{ async }; } template impl::await_adapter> operator co_await(IAsyncOperation const& async) { return{ async }; } template impl::await_adapter> operator co_await(IAsyncOperationWithProgress const& async) { return{ async }; } } #endif WINRT_EXPORT namespace winrt { struct get_progress_token_t {}; inline get_progress_token_t get_progress_token() noexcept { return{}; } struct get_cancellation_token_t {}; inline get_cancellation_token_t get_cancellation_token() noexcept { return{}; } } namespace winrt::impl { template struct cancellation_token { cancellation_token(Promise* promise) noexcept : m_promise(promise) { } bool await_ready() const noexcept { return true; } void await_suspend(coroutine_handle<>) const noexcept { } cancellation_token await_resume() const noexcept { return *this; } bool operator()() const noexcept { return m_promise->Status() == Windows::Foundation::AsyncStatus::Canceled; } void callback(winrt::delegate<>&& cancel) const noexcept { m_promise->cancellation_callback(std::move(cancel)); } bool enable_propagation(bool value = true) const noexcept { return m_promise->enable_cancellation_propagation(value); } private: Promise* m_promise; }; template struct progress_token { progress_token(Promise* promise) noexcept : m_promise(promise) { } bool await_ready() const noexcept { return true; } void await_suspend(coroutine_handle<>) const noexcept { } progress_token await_resume() const noexcept { return *this; } void operator()(Progress const& result) const { m_promise->set_progress(result); } template void set_result(T&& value) const { static_assert(!std::is_same_v, "Setting preliminary results requires IAsync...WithProgress"); m_promise->return_value(std::forward(value)); } private: Promise* m_promise; }; template struct promise_base : implements, cancellable_promise { using AsyncStatus = Windows::Foundation::AsyncStatus; unsigned long __stdcall Release() noexcept { uint32_t const remaining = this->subtract_reference(); if (remaining == 0) { std::atomic_thread_fence(std::memory_order_acquire); coroutine_handle::from_promise(*static_cast(this)).destroy(); } return remaining; } void Completed(async_completed_handler_t const& handler) { AsyncStatus status; { slim_lock_guard const guard(m_lock); if (m_completed_assigned) { throw hresult_illegal_delegate_assignment(); } m_completed_assigned = true; status = m_status.load(std::memory_order_relaxed); if (status == AsyncStatus::Started) { m_completed = make_agile_delegate(handler); return; } } if (handler) { winrt::impl::invoke(handler, *this, status); } } auto Completed() noexcept { slim_lock_guard const guard(m_lock); return m_completed; } uint32_t Id() const noexcept { return 1; } AsyncStatus Status() noexcept { // It's okay to race against another thread that is changing the // status. In the case where the promise was published from another // thread, we need acquire in order to preserve causality. return m_status.load(std::memory_order_acquire); } hresult ErrorCode() noexcept { try { slim_lock_guard const guard(m_lock); rethrow_if_failed(m_status.load(std::memory_order_relaxed)); return 0; } catch (...) { return to_hresult(); } } void Cancel() noexcept { winrt::delegate<> cancel; { slim_lock_guard const guard(m_lock); if (m_status.load(std::memory_order_relaxed) == AsyncStatus::Started) { m_status.store(AsyncStatus::Canceled, std::memory_order_relaxed); m_exception = std::make_exception_ptr(hresult_canceled()); cancel = std::move(m_cancel); } } if (cancel) { cancel(); } cancellable_promise::cancel(); } void Close() const noexcept { } auto GetResults() { slim_lock_guard const guard(m_lock); auto status = m_status.load(std::memory_order_relaxed); if constexpr (std::is_same_v) { if (status == AsyncStatus::Completed) { return static_cast(this)->get_return_value(); } rethrow_if_failed(status); WINRT_ASSERT(status == AsyncStatus::Started); throw hresult_illegal_method_call(); } else { if (status == AsyncStatus::Completed || status == AsyncStatus::Started) { return static_cast(this)->copy_return_value(); } WINRT_ASSERT(status == AsyncStatus::Error || status == AsyncStatus::Canceled); std::rethrow_exception(m_exception); } } AsyncInterface get_return_object() const noexcept { return *this; } void get_return_value() const noexcept { } void copy_return_value() const noexcept { } void set_completed() noexcept { async_completed_handler_t handler; AsyncStatus status; { slim_lock_guard const guard(m_lock); status = m_status.load(std::memory_order_relaxed); if (status == AsyncStatus::Started) { status = AsyncStatus::Completed; m_status.store(status, std::memory_order_relaxed); } handler = std::move(this->m_completed); } if (handler) { winrt::impl::invoke(handler, *this, status); } } suspend_never initial_suspend() const noexcept { return{}; } struct final_suspend_awaiter { promise_base* promise; bool await_ready() const noexcept { return false; } void await_resume() const noexcept { } bool await_suspend(coroutine_handle<>) const noexcept { promise->set_completed(); uint32_t const remaining = promise->subtract_reference(); if (remaining == 0) { std::atomic_thread_fence(std::memory_order_acquire); } return remaining > 0; } }; auto final_suspend() noexcept { return final_suspend_awaiter{ this }; } void unhandled_exception() noexcept { slim_lock_guard const guard(m_lock); WINRT_ASSERT(m_status.load(std::memory_order_relaxed) == AsyncStatus::Started || m_status.load(std::memory_order_relaxed) == AsyncStatus::Canceled); m_exception = std::current_exception(); try { std::rethrow_exception(m_exception); } catch (hresult_canceled const&) { m_status.store(AsyncStatus::Canceled, std::memory_order_relaxed); } catch (...) { m_status.store(AsyncStatus::Error, std::memory_order_relaxed); } } template Expression&& await_transform(Expression&& expression) { if (Status() == AsyncStatus::Canceled) { throw winrt::hresult_canceled(); } return std::forward(expression); } cancellation_token await_transform(get_cancellation_token_t) noexcept { return{ static_cast(this) }; } progress_token await_transform(get_progress_token_t) noexcept { return{ static_cast(this) }; } void cancellation_callback(winrt::delegate<>&& cancel) noexcept { { slim_lock_guard const guard(m_lock); if (m_status.load(std::memory_order_relaxed) != AsyncStatus::Canceled) { m_cancel = std::move(cancel); return; } } if (cancel) { cancel(); } } #if defined(_DEBUG) && !defined(WINRT_NO_MAKE_DETECTION) void use_make_function_to_create_this_object() final { } #endif protected: void rethrow_if_failed(AsyncStatus status) const { if (status == AsyncStatus::Error || status == AsyncStatus::Canceled) { std::rethrow_exception(m_exception); } } std::exception_ptr m_exception{}; slim_mutex m_lock; async_completed_handler_t m_completed; winrt::delegate<> m_cancel; std::atomic m_status; bool m_completed_assigned{ false }; }; } #ifdef __cpp_lib_coroutine namespace std #else namespace std::experimental #endif { template struct coroutine_traits { struct promise_type final : winrt::impl::promise_base { void return_void() const noexcept { } }; }; template struct coroutine_traits, Args...> { struct promise_type final : winrt::impl::promise_base, TProgress> { using ProgressHandler = winrt::Windows::Foundation::AsyncActionProgressHandler; void Progress(ProgressHandler const& handler) noexcept { winrt::slim_lock_guard const guard(this->m_lock); m_progress = winrt::impl::make_agile_delegate(handler); } ProgressHandler Progress() noexcept { winrt::slim_lock_guard const guard(this->m_lock); return m_progress; } void return_void() const noexcept { } void set_progress(TProgress const& result) { if (auto handler = Progress()) { winrt::impl::invoke(handler, *this, result); } } ProgressHandler m_progress; }; }; template struct coroutine_traits, Args...> { struct promise_type final : winrt::impl::promise_base> { TResult get_return_value() noexcept { return std::move(m_result); } TResult copy_return_value() noexcept { return m_result; } void return_value(TResult&& value) noexcept { m_result = std::move(value); } void return_value(TResult const& value) noexcept { m_result = value; } TResult m_result{ winrt::impl::empty_value() }; }; }; template struct coroutine_traits, Args...> { struct promise_type final : winrt::impl::promise_base, TProgress> { using ProgressHandler = winrt::Windows::Foundation::AsyncOperationProgressHandler; void Progress(ProgressHandler const& handler) noexcept { winrt::slim_lock_guard const guard(this->m_lock); m_progress = winrt::impl::make_agile_delegate(handler); } ProgressHandler Progress() noexcept { winrt::slim_lock_guard const guard(this->m_lock); return m_progress; } TResult get_return_value() noexcept { return std::move(m_result); } TResult copy_return_value() noexcept { return m_result; } void return_value(TResult&& value) noexcept { winrt::slim_lock_guard const guard(this->m_lock); m_result = std::move(value); } void return_value(TResult const& value) noexcept { winrt::slim_lock_guard const guard(this->m_lock); m_result = value; } void set_progress(TProgress const& result) { if (auto handler = Progress()) { winrt::impl::invoke(handler, *this, result); } } TResult m_result{ winrt::impl::empty_value() }; ProgressHandler m_progress; }; }; } WINRT_EXPORT namespace winrt { #ifdef WINRT_IMPL_COROUTINES template Windows::Foundation::IAsyncAction when_all(T... async) { (void(co_await async), ...); co_return; } template T when_any(T const& first, Rest const& ... rest) { static_assert(impl::has_category_v, "T must be WinRT async type such as IAsyncAction or IAsyncOperation."); static_assert((std::is_same_v && ...), "All when_any parameters must be the same type."); struct shared_type { handle event{ check_pointer(WINRT_IMPL_CreateEventW(nullptr, true, false, nullptr)) }; Windows::Foundation::AsyncStatus status{ Windows::Foundation::AsyncStatus::Started }; T result; void operator()(T const& sender, Windows::Foundation::AsyncStatus operation_status) noexcept { auto sender_abi = *(impl::unknown_abi**)&sender; if (nullptr == _InterlockedCompareExchangePointer(reinterpret_cast(&result), sender_abi, nullptr)) { sender_abi->AddRef(); status = operation_status; WINRT_VERIFY(WINRT_IMPL_SetEvent(event.get())); } } }; auto [delegate, shared] = impl::make_delegate_with_shared_state>(shared_type{}); auto completed = [delegate = std::move(delegate)](T const& async) { async.Completed(delegate); }; completed(first); (completed(rest), ...); co_await resume_on_signal(shared->event.get()); impl::check_status_canceled(shared->status); co_return shared->result.GetResults(); } #endif } WINRT_EXPORT namespace winrt { inline hstring to_hstring(Windows::Foundation::IStringable const& stringable) { return stringable.ToString(); } } #ifdef __cpp_lib_format template auto std::formatter::format(winrt::Windows::Foundation::IStringable const& obj, FormatContext& fc) const { return std::formatter::format(obj.ToString(), fc); } #endif #ifndef WINRT_LEAN_AND_MEAN inline std::wostream& operator<<(std::wostream& stream, winrt::Windows::Foundation::IStringable const& stringable) { stream << stringable.ToString(); return stream; } #endif #endif