// C++/WinRT v2.0.250303.1 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #ifndef WINRT_Windows_ApplicationModel_CommunicationBlocking_H #define WINRT_Windows_ApplicationModel_CommunicationBlocking_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/Windows.ApplicationModel.h" #include "winrt/impl/Windows.Foundation.2.h" #include "winrt/impl/Windows.Foundation.Collections.2.h" #include "winrt/impl/Windows.ApplicationModel.CommunicationBlocking.2.h" namespace winrt::impl { template auto consume_Windows_ApplicationModel_CommunicationBlocking_ICommunicationBlockingAccessManagerStatics::IsBlockingActive() 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_IsBlockingActive(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_IsBlockingActive(&value)); } return value; } template auto consume_Windows_ApplicationModel_CommunicationBlocking_ICommunicationBlockingAccessManagerStatics::IsBlockedNumberAsync(param::hstring const& number) 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->IsBlockedNumberAsync(*(void**)(&number), &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->IsBlockedNumberAsync(*(void**)(&number), &result)); } return winrt::Windows::Foundation::IAsyncOperation{ result, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_CommunicationBlocking_ICommunicationBlockingAccessManagerStatics::ShowBlockNumbersUI(param::iterable const& phoneNumbers) 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->ShowBlockNumbersUI(*(void**)(&phoneNumbers), &value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->ShowBlockNumbersUI(*(void**)(&phoneNumbers), &value)); } return value; } template auto consume_Windows_ApplicationModel_CommunicationBlocking_ICommunicationBlockingAccessManagerStatics::ShowUnblockNumbersUI(param::iterable const& phoneNumbers) 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->ShowUnblockNumbersUI(*(void**)(&phoneNumbers), &value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->ShowUnblockNumbersUI(*(void**)(&phoneNumbers), &value)); } return value; } template auto consume_Windows_ApplicationModel_CommunicationBlocking_ICommunicationBlockingAccessManagerStatics::ShowBlockedCallsUI() 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->ShowBlockedCallsUI()); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->ShowBlockedCallsUI()); } } template auto consume_Windows_ApplicationModel_CommunicationBlocking_ICommunicationBlockingAccessManagerStatics::ShowBlockedMessagesUI() 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->ShowBlockedMessagesUI()); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->ShowBlockedMessagesUI()); } } template auto consume_Windows_ApplicationModel_CommunicationBlocking_ICommunicationBlockingAppManagerStatics::IsCurrentAppActiveBlockingApp() 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_IsCurrentAppActiveBlockingApp(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_IsCurrentAppActiveBlockingApp(&value)); } return value; } template auto consume_Windows_ApplicationModel_CommunicationBlocking_ICommunicationBlockingAppManagerStatics::ShowCommunicationBlockingSettingsUI() 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->ShowCommunicationBlockingSettingsUI()); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->ShowCommunicationBlockingSettingsUI()); } } template auto consume_Windows_ApplicationModel_CommunicationBlocking_ICommunicationBlockingAppManagerStatics2::RequestSetAsActiveBlockingAppAsync() 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->RequestSetAsActiveBlockingAppAsync(&result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->RequestSetAsActiveBlockingAppAsync(&result)); } return winrt::Windows::Foundation::IAsyncOperation{ result, take_ownership_from_abi }; } #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_IsBlockingActive(bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().IsBlockingActive()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall IsBlockedNumberAsync(void* number, void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from>(this->shim().IsBlockedNumberAsync(*reinterpret_cast(&number))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall ShowBlockNumbersUI(void* phoneNumbers, bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().ShowBlockNumbersUI(*reinterpret_cast const*>(&phoneNumbers))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall ShowUnblockNumbersUI(void* phoneNumbers, bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().ShowUnblockNumbersUI(*reinterpret_cast const*>(&phoneNumbers))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall ShowBlockedCallsUI() noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().ShowBlockedCallsUI(); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall ShowBlockedMessagesUI() noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().ShowBlockedMessagesUI(); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_IsCurrentAppActiveBlockingApp(bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().IsCurrentAppActiveBlockingApp()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall ShowCommunicationBlockingSettingsUI() noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().ShowCommunicationBlockingSettingsUI(); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall RequestSetAsActiveBlockingAppAsync(void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from>(this->shim().RequestSetAsActiveBlockingAppAsync()); return 0; } catch (...) { return to_hresult(); } }; #endif } WINRT_EXPORT namespace winrt::Windows::ApplicationModel::CommunicationBlocking { inline auto CommunicationBlockingAccessManager::IsBlockingActive() { return impl::call_factory_cast([](ICommunicationBlockingAccessManagerStatics const& f) { return f.IsBlockingActive(); }); } inline auto CommunicationBlockingAccessManager::IsBlockedNumberAsync(param::hstring const& number) { return impl::call_factory([&](ICommunicationBlockingAccessManagerStatics const& f) { return f.IsBlockedNumberAsync(number); }); } inline auto CommunicationBlockingAccessManager::ShowBlockNumbersUI(param::iterable const& phoneNumbers) { return impl::call_factory([&](ICommunicationBlockingAccessManagerStatics const& f) { return f.ShowBlockNumbersUI(phoneNumbers); }); } inline auto CommunicationBlockingAccessManager::ShowUnblockNumbersUI(param::iterable const& phoneNumbers) { return impl::call_factory([&](ICommunicationBlockingAccessManagerStatics const& f) { return f.ShowUnblockNumbersUI(phoneNumbers); }); } inline auto CommunicationBlockingAccessManager::ShowBlockedCallsUI() { impl::call_factory_cast([](ICommunicationBlockingAccessManagerStatics const& f) { return f.ShowBlockedCallsUI(); }); } inline auto CommunicationBlockingAccessManager::ShowBlockedMessagesUI() { impl::call_factory_cast([](ICommunicationBlockingAccessManagerStatics const& f) { return f.ShowBlockedMessagesUI(); }); } inline auto CommunicationBlockingAppManager::IsCurrentAppActiveBlockingApp() { return impl::call_factory_cast([](ICommunicationBlockingAppManagerStatics const& f) { return f.IsCurrentAppActiveBlockingApp(); }); } inline auto CommunicationBlockingAppManager::ShowCommunicationBlockingSettingsUI() { impl::call_factory_cast([](ICommunicationBlockingAppManagerStatics const& f) { return f.ShowCommunicationBlockingSettingsUI(); }); } inline auto CommunicationBlockingAppManager::RequestSetAsActiveBlockingAppAsync() { return impl::call_factory_cast(*)(ICommunicationBlockingAppManagerStatics2 const&), CommunicationBlockingAppManager, ICommunicationBlockingAppManagerStatics2>([](ICommunicationBlockingAppManagerStatics2 const& f) { return f.RequestSetAsActiveBlockingAppAsync(); }); } } 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 {}; #endif #ifdef __cpp_lib_format #endif } #endif