diff --git a/cppwinrt/code_writers.h b/cppwinrt/code_writers.h index 5817abb64..37f5f4327 100644 --- a/cppwinrt/code_writers.h +++ b/cppwinrt/code_writers.h @@ -2111,7 +2111,7 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable D& shim() noexcept { return *static_cast(this); } D const& shim() const noexcept { return *static_cast(this); } public: - using % = winrt::%; + using % = %; % }; )"; @@ -3207,7 +3207,7 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable { auto generics = type.GenericParam(); - w.write(" template<%> struct hash : winrt::impl::hash_base {};\n", + w.write(" template<%> struct hash<%> : winrt::impl::hash_base {};\n", bind(generics), type); } diff --git a/cppwinrt/type_writers.h b/cppwinrt/type_writers.h index 0f3ca983e..a41b3086c 100644 --- a/cppwinrt/type_writers.h +++ b/cppwinrt/type_writers.h @@ -273,7 +273,7 @@ namespace cppwinrt if (!empty(generics)) { - write("@::%<%>", ns, remove_tick(name), bind_list(", ", generics)); + write("winrt::@::%<%>", ns, remove_tick(name), bind_list(", ", generics)); return; } @@ -301,7 +301,7 @@ namespace cppwinrt else if (name == "Vector3") { name = "float3"; } else if (name == "Vector4") { name = "float4"; } - write("@::%", ns, name); + write("winrt::@::%", ns, name); } else if (category == category::struct_type) { @@ -311,7 +311,7 @@ namespace cppwinrt } else if ((name == "Point" || name == "Size" || name == "Rect") && ns == "Windows.Foundation") { - write("@::%", ns, name); + write("winrt::@::%", ns, name); } else if (delegate_types) { @@ -343,11 +343,11 @@ namespace cppwinrt else if (name == "Vector3") { name = "float3"; } else if (name == "Vector4") { name = "float4"; } - write("@::%", ns, name); + write("winrt::@::%", ns, name); } else { - write("@::%", ns, name); + write("winrt::@::%", ns, name); } } } @@ -400,14 +400,14 @@ namespace cppwinrt if (consume_types) { - static constexpr std::string_view iterable("Windows::Foundation::Collections::IIterable<"sv); - static constexpr std::string_view vector_view("Windows::Foundation::Collections::IVectorView<"sv); - static constexpr std::string_view map_view("Windows::Foundation::Collections::IMapView<"sv); - static constexpr std::string_view vector("Windows::Foundation::Collections::IVector<"sv); - static constexpr std::string_view map("Windows::Foundation::Collections::IMap<"sv); + static constexpr std::string_view iterable("winrt::Windows::Foundation::Collections::IIterable<"sv); + static constexpr std::string_view vector_view("winrt::Windows::Foundation::Collections::IVectorView<"sv); + static constexpr std::string_view map_view("winrt::Windows::Foundation::Collections::IMapView<"sv); + static constexpr std::string_view vector("winrt::Windows::Foundation::Collections::IVector<"sv); + static constexpr std::string_view map("winrt::Windows::Foundation::Collections::IMap<"sv); consume_types = false; - auto full_name = write_temp("@::%<%>", ns, name, bind_list(", ", type.GenericArgs())); + auto full_name = write_temp("winrt::@::%<%>", ns, name, bind_list(", ", type.GenericArgs())); consume_types = true; if (starts_with(full_name, iterable)) @@ -459,7 +459,7 @@ namespace cppwinrt } else { - write("@::%<%>", ns, name, bind_list(", ", type.GenericArgs())); + write("winrt::@::%<%>", ns, name, bind_list(", ", type.GenericArgs())); } } } diff --git a/test/test_component/Windows.Class.cpp b/test/test_component/Windows.Class.cpp index bbed99356..483ebaa50 100644 --- a/test/test_component/Windows.Class.cpp +++ b/test/test_component/Windows.Class.cpp @@ -4,11 +4,11 @@ namespace winrt::test_component::Windows::implementation { - void Class::StaticMethod() + void Class::StaticMethod(winrt::test_component::Windows::Struct const&) { throw hresult_not_implemented(); } - void Class::Method() + void Class::Method(winrt::Windows::Foundation::Uri const&) { throw hresult_not_implemented(); } diff --git a/test/test_component/Windows.Class.h b/test/test_component/Windows.Class.h index f720364f1..b1ddc72d8 100644 --- a/test/test_component/Windows.Class.h +++ b/test/test_component/Windows.Class.h @@ -7,8 +7,8 @@ namespace winrt::test_component::Windows::implementation { Class() = default; - static void StaticMethod(); - void Method(); + static void StaticMethod(winrt::test_component::Windows::Struct const& param); + void Method(winrt::Windows::Foundation::Uri const& param); }; } namespace winrt::test_component::Windows::factory_implementation diff --git a/test/test_component/test_component.idl b/test/test_component/test_component.idl index b3455f362..a3274e4c3 100644 --- a/test/test_component/test_component.idl +++ b/test/test_component/test_component.idl @@ -280,11 +280,18 @@ namespace test_component namespace Windows { + struct Struct + { + Windows.Foundation.Rect rect; + Windows.Foundation.Numerics.Matrix3x2 matrix; + Windows.Foundation.IReference ref_rect; + }; + runtimeclass Class { Class(); - static void StaticMethod(); - void Method(); + static void StaticMethod(Struct param); + void Method(Windows.Foundation.Uri param); } } }