Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions cppwinrt/code_writers.h
Original file line number Diff line number Diff line change
Expand Up @@ -1619,7 +1619,7 @@ namespace cppwinrt
else if (optional)
{
auto format = R"( if (%) *% = nullptr;
Windows::Foundation::IInspectable winrt_impl_%;
winrt::Windows::Foundation::IInspectable winrt_impl_%;
)";

w.write(format, param_name, param_name, param_name);
Expand Down Expand Up @@ -1961,7 +1961,7 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable<T, D, %>

if (!found)
{
w.write(", Windows::Foundation::IInspectable");
w.write(", winrt::Windows::Foundation::IInspectable");
}
}

Expand Down Expand Up @@ -2314,11 +2314,11 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable<T, D, %>
if (empty(generics))
{
auto format = R"( struct __declspec(empty_bases) % :
Windows::Foundation::IInspectable,
winrt::Windows::Foundation::IInspectable,
impl::consume_t<%>%
{
%(std::nullptr_t = nullptr) noexcept {}
%(void* ptr, take_ownership_from_abi_t) noexcept : Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
%(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
%(% const&) noexcept = default;
%(%&&) noexcept = default;
%& operator=(% const&) & noexcept = default;
Expand Down Expand Up @@ -2349,11 +2349,11 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable<T, D, %>

auto format = R"( template <%>
struct __declspec(empty_bases) % :
Windows::Foundation::IInspectable,
winrt::Windows::Foundation::IInspectable,
impl::consume_t<%>%
{%
%(std::nullptr_t = nullptr) noexcept {}
%(void* ptr, take_ownership_from_abi_t) noexcept : Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
%(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
%(% const&) noexcept = default;
%(%&&) noexcept = default;
%& operator=(% const&) & noexcept = default;
Expand Down Expand Up @@ -2925,7 +2925,7 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable<T, D, %>

auto format = R"( inline %::%(%)
{
Windows::Foundation::IInspectable %, %;
winrt::Windows::Foundation::IInspectable %, %;
*this = % { return f.%(%%%, %); });
}
)";
Expand Down Expand Up @@ -3056,15 +3056,15 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable<T, D, %>
if (has_fastabi(type))
{
format = R"( inline %::%() :
%(impl::call_factory_cast<%(*)(Windows::Foundation::IActivationFactory const&), %>([](Windows::Foundation::IActivationFactory const& f) { return impl::fast_activate<%>(f); }))
%(impl::call_factory_cast<%(*)(winrt::Windows::Foundation::IActivationFactory const&), %>([](winrt::Windows::Foundation::IActivationFactory const& f) { return impl::fast_activate<%>(f); }))
{
}
)";
}
else
{
format = R"( inline %::%() :
%(impl::call_factory_cast<%(*)(Windows::Foundation::IActivationFactory const&), %>([](Windows::Foundation::IActivationFactory const& f) { return f.template ActivateInstance<%>(); }))
%(impl::call_factory_cast<%(*)(winrt::Windows::Foundation::IActivationFactory const&), %>([](winrt::Windows::Foundation::IActivationFactory const& f) { return f.template ActivateInstance<%>(); }))
{
}
)";
Expand Down
4 changes: 2 additions & 2 deletions cppwinrt/component_writers.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ catch (...) { return winrt::to_hresult(); }

if (!default_constructor)
{
w.write(R"( [[noreturn]] Windows::Foundation::IInspectable ActivateInstance() const
w.write(R"( [[noreturn]] winrt::Windows::Foundation::IInspectable ActivateInstance() const
{
throw hresult_not_implemented();
}
Expand Down Expand Up @@ -831,7 +831,7 @@ catch (...) { return winrt::to_hresult(); }
auto format = R"(namespace winrt::@::factory_implementation
{
template <typename D, typename T, typename... I>
struct __declspec(empty_bases) %T : implements<D, Windows::Foundation::IActivationFactory%, I...>
struct __declspec(empty_bases) %T : implements<D, winrt::Windows::Foundation::IActivationFactory%, I...>
{
using instance_type = @::%;

Expand Down
2 changes: 1 addition & 1 deletion cppwinrt/type_writers.h
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ namespace cppwinrt
}
else
{
write("Windows::Foundation::IInspectable");
write("winrt::Windows::Foundation::IInspectable");
}
}
else
Expand Down
15 changes: 15 additions & 0 deletions test/test_component/Windows.Class.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "pch.h"
#include "Windows.Class.h"
#include "Windows.Class.g.cpp"

namespace winrt::test_component::Windows::implementation
{
void Class::StaticMethod()
{
throw hresult_not_implemented();
}
void Class::Method()
{
throw hresult_not_implemented();
}
}
19 changes: 19 additions & 0 deletions test/test_component/Windows.Class.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once
#include "Windows.Class.g.h"

namespace winrt::test_component::Windows::implementation
{
struct Class : ClassT<Class>
{
Class() = default;

static void StaticMethod();
void Method();
};
}
namespace winrt::test_component::Windows::factory_implementation
{
struct Class : ClassT<Class, implementation::Class>
{
};
}
10 changes: 10 additions & 0 deletions test/test_component/test_component.idl
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,14 @@ namespace test_component
}
}
}

namespace Windows
{
runtimeclass Class
{
Class();
static void StaticMethod();
void Method();
}
}
}
2 changes: 2 additions & 0 deletions test/test_component/test_component.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@
<ClCompile Include="Velocity.Class1.cpp" />
<ClCompile Include="Velocity.Class2.cpp" />
<ClCompile Include="Velocity.Class4.cpp" />
<ClCompile Include="Windows.Class.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Class.h" />
Expand All @@ -628,6 +629,7 @@
<ClInclude Include="Velocity.Class1.h" />
<ClInclude Include="Velocity.Class2.h" />
<ClInclude Include="Velocity.Class4.h" />
<ClInclude Include="Windows.Class.h" />
</ItemGroup>
<ItemGroup>
<None Include="exports.def" />
Expand Down