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
21 changes: 11 additions & 10 deletions cppwinrt/code_writers.h
Original file line number Diff line number Diff line change
Expand Up @@ -3248,19 +3248,12 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable<T, D, %>
type);
}

static void write_namespace_special(writer& w, std::string_view const& namespace_name, cache const& c)
static void write_namespace_special(writer& w, std::string_view const& namespace_name)
{
if (namespace_name == "Windows.Foundation")
{
if (c.find("Windows.Foundation.PropertyValue"))
{
w.write(strings::base_reference_produce);
}
if (c.find("Windows.Foundation.Deferral"))
{
w.write(strings::base_deferral);
}

w.write(strings::base_reference_produce);
w.write(strings::base_deferral);
w.write(strings::base_coroutine_foundation);
}
else if (namespace_name == "Windows.Foundation.Collections")
Expand Down Expand Up @@ -3292,4 +3285,12 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable<T, D, %>
w.write(strings::base_xaml_typename);
}
}

static void write_namespace_special_1(writer& w, std::string_view const& namespace_name)
{
if (namespace_name == "Windows.Foundation")
{
w.write(strings::base_reference_produce_1);
}
}
}
1 change: 1 addition & 0 deletions cppwinrt/cppwinrt.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
<ClInclude Include="..\strings\base_meta.h" />
<ClInclude Include="..\strings\base_natvis.h" />
<ClInclude Include="..\strings\base_reference_produce.h" />
<ClInclude Include="..\strings\base_reference_produce_1.h" />
<ClInclude Include="..\strings\base_security.h" />
<ClInclude Include="..\strings\base_std_hash.h" />
<ClInclude Include="..\strings\base_string.h" />
Expand Down
3 changes: 3 additions & 0 deletions cppwinrt/cppwinrt.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@
<ClInclude Include="..\strings\base_reference_produce.h">
<Filter>strings</Filter>
</ClInclude>
<ClInclude Include="..\strings\base_reference_produce_1.h">
<Filter>strings</Filter>
</ClInclude>
<ClInclude Include="..\strings\base_security.h">
<Filter>strings</Filter>
</ClInclude>
Expand Down
3 changes: 2 additions & 1 deletion cppwinrt/file_writers.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ namespace cppwinrt
auto wrap_type = wrap_type_namespace(w, ns);
w.write_each<write_interface>(members.interfaces);
}
write_namespace_special_1(w, ns);

write_close_file_guard(w);
w.swap();
Expand Down Expand Up @@ -201,7 +202,7 @@ namespace cppwinrt
w.write_each<write_std_hash>(members.classes);
}

write_namespace_special(w, ns, c);
write_namespace_special(w, ns);

write_close_file_guard(w);
w.swap();
Expand Down
28 changes: 0 additions & 28 deletions strings/base_reference_produce.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,35 +397,7 @@ namespace winrt::impl
static auto make(array_view<Windows::Foundation::Rect const> const& value) { return Windows::Foundation::PropertyValue::CreateRectArray(value); }
using itf = Windows::Foundation::IReferenceArray<Windows::Foundation::Rect>;
};
}

WINRT_EXPORT namespace winrt::Windows::Foundation
{
template <typename T>
bool operator==(IReference<T> const& left, IReference<T> const& right)
{
if (get_abi(left) == get_abi(right))
{
return true;
}

if (!left || !right)
{
return false;
}

return left.Value() == right.Value();
}

template <typename T>
bool operator!=(IReference<T> const& left, IReference<T> const& right)
{
return !(left == right);
}
}

namespace winrt::impl
{
template <typename T, typename From>
T unbox_value_type(From&& value)
{
Expand Down
25 changes: 25 additions & 0 deletions strings/base_reference_produce_1.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

WINRT_EXPORT namespace winrt::Windows::Foundation
{
template <typename T>
bool operator==(IReference<T> const& left, IReference<T> const& right)
{
if (get_abi(left) == get_abi(right))
{
return true;
}

if (!left || !right)
{
return false;
}

return left.Value() == right.Value();
}

template <typename T>
bool operator!=(IReference<T> const& left, IReference<T> const& right)
{
return !(left == right);
}
}