Skip to content

Commit ede55c0

Browse files
authored
compact (#617)
Co-authored-by: Kenny Kerr <[email protected]>
1 parent b95c4f3 commit ede55c0

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

cppwinrt/component_writers.h

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ namespace cppwinrt
106106
if (settings.component_opt)
107107
{
108108
auto format = R"(
109-
if (requal(name, L"%.%"))
109+
if (requal(name, "%.%"))
110110
{
111111
return winrt_make_%();
112112
}
@@ -120,7 +120,7 @@ namespace cppwinrt
120120
else
121121
{
122122
auto format = R"(
123-
if (requal(name, L"%.%"))
123+
if (requal(name, "%.%"))
124124
{
125125
return winrt::detach_abi(winrt::make<winrt::@::factory_implementation::%>());
126126
}
@@ -149,9 +149,11 @@ bool __stdcall %_can_unload_now() noexcept
149149
return true;
150150
}
151151
152-
void* __stdcall %_get_activation_factory([[maybe_unused]] std::wstring_view const& name)
152+
void* __stdcall %_get_activation_factory([[maybe_unused]] std::wstring_view const& wname)
153153
{
154-
auto requal = [](std::wstring_view const& left, std::wstring_view const& right) noexcept
154+
auto name = winrt::to_string(wname);
155+
156+
auto requal = [](std::string_view const& left, std::string_view const& right) noexcept
155157
{
156158
return std::equal(left.rbegin(), left.rend(), right.rbegin(), right.rend());
157159
};
@@ -750,7 +752,7 @@ catch (...) { return winrt::to_hresult(); }
750752
%
751753
hstring GetRuntimeClassName() const
752754
{
753-
return L"%.%";
755+
return name_of<class_type>();
754756
}
755757
%%%% };
756758
}
@@ -820,8 +822,6 @@ catch (...) { return winrt::to_hresult(); }
820822
type_name,
821823
type_name,
822824
composable_base_name,
823-
type_namespace,
824-
type_name,
825825
bind<write_component_class_override_constructors>(type),
826826
bind<write_component_override_dispatch_base>(type),
827827
bind<write_component_base_call>(type),
@@ -839,7 +839,7 @@ catch (...) { return winrt::to_hresult(); }
839839
840840
hstring GetRuntimeClassName() const
841841
{
842-
return L"%.%";
842+
return name_of<instance_type>();
843843
}
844844
% };
845845
}
@@ -851,8 +851,6 @@ catch (...) { return winrt::to_hresult(); }
851851
bind<write_component_factory_interfaces>(factories),
852852
type_namespace,
853853
type_name,
854-
type_namespace,
855-
type_name,
856854
bind<write_component_forwarders>(factories));
857855
}
858856

0 commit comments

Comments
 (0)