Files
nearby/cpp/platform/impl/windows/generated/module.g.cpp
T
hai007 2e853156dc Internal change
PiperOrigin-RevId: 380848866
2021-06-22 11:09:32 -07:00

76 lines
2.2 KiB
C++

// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// WARNING: Please don't edit this file. It was generated by C++/WinRT v2.0.210505.3
#include "pch.h"
#include "winrt/base.h"
#include "BluetoothClassicMedium.h"
bool __stdcall winrt_can_unload_now() noexcept
{
if (winrt::get_module_lock())
{
return false;
}
winrt::clear_factory_cache();
return true;
}
void* __stdcall winrt_get_activation_factory([[maybe_unused]] std::wstring_view const& name)
{
auto requal = [](std::wstring_view const& left, std::wstring_view const& right) noexcept
{
return std::equal(left.rbegin(), left.rend(), right.rbegin(), right.rend());
};
if (requal(name, L"location.nearby.windows.BluetoothClassicMedium"))
{
return winrt::detach_abi(winrt::make<winrt::location::nearby::windows::factory_implementation::BluetoothClassicMedium>());
}
return nullptr;
}
int32_t __stdcall WINRT_CanUnloadNow() noexcept
{
#ifdef _WRL_MODULE_H_
if (!::Microsoft::WRL::Module<::Microsoft::WRL::InProc>::GetModule().Terminate())
{
return 1;
}
#endif
return winrt_can_unload_now() ? 0 : 1;
}
int32_t __stdcall WINRT_GetActivationFactory(void* classId, void** factory) noexcept try
{
std::wstring_view const name{ *reinterpret_cast<winrt::hstring*>(&classId) };
*factory = winrt_get_activation_factory(name);
if (*factory)
{
return 0;
}
#ifdef _WRL_MODULE_H_
return ::Microsoft::WRL::Module<::Microsoft::WRL::InProc>::GetModule().GetActivationFactory(static_cast<HSTRING>(classId), reinterpret_cast<::IActivationFactory**>(factory));
#else
return winrt::hresult_class_not_available(name).to_abi();
#endif
}
catch (...) { return winrt::to_hresult(); }