// C++/WinRT v2.0.250303.1 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #ifndef WINRT_Windows_ApplicationModel_Resources_H #define WINRT_Windows_ApplicationModel_Resources_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.UI.2.h" #include "winrt/impl/Windows.ApplicationModel.Resources.2.h" namespace winrt::impl { template auto consume_Windows_ApplicationModel_Resources_IResourceLoader::GetString(param::hstring const& resource) 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(*(void**)(&resource), &value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetString(*(void**)(&resource), &value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_Resources_IResourceLoader2::GetStringForUri(winrt::Windows::Foundation::Uri const& uri) 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->GetStringForUri(*(void**)(&uri), &value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetStringForUri(*(void**)(&uri), &value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_Resources_IResourceLoaderFactory::CreateResourceLoaderByName(param::hstring const& name) const { void* loader{}; 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->CreateResourceLoaderByName(*(void**)(&name), &loader)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateResourceLoaderByName(*(void**)(&name), &loader)); } return winrt::Windows::ApplicationModel::Resources::ResourceLoader{ loader, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_Resources_IResourceLoaderStatics::GetStringForReference(winrt::Windows::Foundation::Uri const& uri) 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->GetStringForReference(*(void**)(&uri), &value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetStringForReference(*(void**)(&uri), &value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_Resources_IResourceLoaderStatics2::GetForCurrentView() const { void* loader{}; 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->GetForCurrentView(&loader)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetForCurrentView(&loader)); } return winrt::Windows::ApplicationModel::Resources::ResourceLoader{ loader, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_Resources_IResourceLoaderStatics2::GetForCurrentView(param::hstring const& name) const { void* loader{}; 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->GetForCurrentViewWithName(*(void**)(&name), &loader)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetForCurrentViewWithName(*(void**)(&name), &loader)); } return winrt::Windows::ApplicationModel::Resources::ResourceLoader{ loader, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_Resources_IResourceLoaderStatics2::GetForViewIndependentUse() const { void* loader{}; 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->GetForViewIndependentUse(&loader)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetForViewIndependentUse(&loader)); } return winrt::Windows::ApplicationModel::Resources::ResourceLoader{ loader, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_Resources_IResourceLoaderStatics2::GetForViewIndependentUse(param::hstring const& name) const { void* loader{}; 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->GetForViewIndependentUseWithName(*(void**)(&name), &loader)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetForViewIndependentUseWithName(*(void**)(&name), &loader)); } return winrt::Windows::ApplicationModel::Resources::ResourceLoader{ loader, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_Resources_IResourceLoaderStatics3::GetForUIContext(winrt::Windows::UI::UIContext const& context) 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->GetForUIContext(*(void**)(&context), &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetForUIContext(*(void**)(&context), &result)); } return winrt::Windows::ApplicationModel::Resources::ResourceLoader{ result, take_ownership_from_abi }; } template auto consume_Windows_ApplicationModel_Resources_IResourceLoaderStatics4::GetDefaultPriPath(param::hstring const& packageFullName) 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->GetDefaultPriPath(*(void**)(&packageFullName), &value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetDefaultPriPath(*(void**)(&packageFullName), &value)); } return hstring{ value, take_ownership_from_abi }; } #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall GetString(void* resource, void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetString(*reinterpret_cast(&resource))); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall GetStringForUri(void* uri, void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetStringForUri(*reinterpret_cast(&uri))); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall CreateResourceLoaderByName(void* name, void** loader) noexcept final try { clear_abi(loader); typename D::abi_guard guard(this->shim()); *loader = detach_from(this->shim().CreateResourceLoaderByName(*reinterpret_cast(&name))); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall GetStringForReference(void* uri, void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetStringForReference(*reinterpret_cast(&uri))); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall GetForCurrentView(void** loader) noexcept final try { clear_abi(loader); typename D::abi_guard guard(this->shim()); *loader = detach_from(this->shim().GetForCurrentView()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetForCurrentViewWithName(void* name, void** loader) noexcept final try { clear_abi(loader); typename D::abi_guard guard(this->shim()); *loader = detach_from(this->shim().GetForCurrentView(*reinterpret_cast(&name))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetForViewIndependentUse(void** loader) noexcept final try { clear_abi(loader); typename D::abi_guard guard(this->shim()); *loader = detach_from(this->shim().GetForViewIndependentUse()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetForViewIndependentUseWithName(void* name, void** loader) noexcept final try { clear_abi(loader); typename D::abi_guard guard(this->shim()); *loader = detach_from(this->shim().GetForViewIndependentUse(*reinterpret_cast(&name))); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall GetForUIContext(void* context, void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().GetForUIContext(*reinterpret_cast(&context))); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall GetDefaultPriPath(void* packageFullName, void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetDefaultPriPath(*reinterpret_cast(&packageFullName))); return 0; } catch (...) { return to_hresult(); } }; #endif } WINRT_EXPORT namespace winrt::Windows::ApplicationModel::Resources { inline ResourceLoader::ResourceLoader() : ResourceLoader(impl::call_factory_cast([](winrt::Windows::Foundation::IActivationFactory const& f) { return f.template ActivateInstance(); })) { } inline ResourceLoader::ResourceLoader(param::hstring const& name) : ResourceLoader(impl::call_factory([&](IResourceLoaderFactory const& f) { return f.CreateResourceLoaderByName(name); })) { } inline auto ResourceLoader::GetStringForReference(winrt::Windows::Foundation::Uri const& uri) { return impl::call_factory([&](IResourceLoaderStatics const& f) { return f.GetStringForReference(uri); }); } inline auto ResourceLoader::GetForCurrentView() { return impl::call_factory_cast([](IResourceLoaderStatics2 const& f) { return f.GetForCurrentView(); }); } inline auto ResourceLoader::GetForCurrentView(param::hstring const& name) { return impl::call_factory([&](IResourceLoaderStatics2 const& f) { return f.GetForCurrentView(name); }); } inline auto ResourceLoader::GetForViewIndependentUse() { return impl::call_factory_cast([](IResourceLoaderStatics2 const& f) { return f.GetForViewIndependentUse(); }); } inline auto ResourceLoader::GetForViewIndependentUse(param::hstring const& name) { return impl::call_factory([&](IResourceLoaderStatics2 const& f) { return f.GetForViewIndependentUse(name); }); } inline auto ResourceLoader::GetForUIContext(winrt::Windows::UI::UIContext const& context) { return impl::call_factory([&](IResourceLoaderStatics3 const& f) { return f.GetForUIContext(context); }); } inline auto ResourceLoader::GetDefaultPriPath(param::hstring const& packageFullName) { return impl::call_factory([&](IResourceLoaderStatics4 const& f) { return f.GetDefaultPriPath(packageFullName); }); } } 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 {}; #endif #ifdef __cpp_lib_format #endif } #endif