Skip to content

Commit 122b732

Browse files
authored
Windows test (#905)
1 parent 1935608 commit 122b732

File tree

5 files changed

+27
-20
lines changed

5 files changed

+27
-20
lines changed

cppwinrt/code_writers.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2111,7 +2111,7 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable<T, D, %>
21112111
D& shim() noexcept { return *static_cast<D*>(this); }
21122112
D const& shim() const noexcept { return *static_cast<const D*>(this); }
21132113
public:
2114-
using % = winrt::%;
2114+
using % = %;
21152115
% };
21162116
)";
21172117

@@ -3207,7 +3207,7 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable<T, D, %>
32073207
{
32083208
auto generics = type.GenericParam();
32093209

3210-
w.write(" template<%> struct hash<winrt::%> : winrt::impl::hash_base {};\n",
3210+
w.write(" template<%> struct hash<%> : winrt::impl::hash_base {};\n",
32113211
bind<write_generic_typenames>(generics),
32123212
type);
32133213
}

cppwinrt/type_writers.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ namespace cppwinrt
273273

274274
if (!empty(generics))
275275
{
276-
write("@::%<%>", ns, remove_tick(name), bind_list(", ", generics));
276+
write("winrt::@::%<%>", ns, remove_tick(name), bind_list(", ", generics));
277277
return;
278278
}
279279

@@ -301,7 +301,7 @@ namespace cppwinrt
301301
else if (name == "Vector3") { name = "float3"; }
302302
else if (name == "Vector4") { name = "float4"; }
303303

304-
write("@::%", ns, name);
304+
write("winrt::@::%", ns, name);
305305
}
306306
else if (category == category::struct_type)
307307
{
@@ -311,7 +311,7 @@ namespace cppwinrt
311311
}
312312
else if ((name == "Point" || name == "Size" || name == "Rect") && ns == "Windows.Foundation")
313313
{
314-
write("@::%", ns, name);
314+
write("winrt::@::%", ns, name);
315315
}
316316
else if (delegate_types)
317317
{
@@ -343,11 +343,11 @@ namespace cppwinrt
343343
else if (name == "Vector3") { name = "float3"; }
344344
else if (name == "Vector4") { name = "float4"; }
345345

346-
write("@::%", ns, name);
346+
write("winrt::@::%", ns, name);
347347
}
348348
else
349349
{
350-
write("@::%", ns, name);
350+
write("winrt::@::%", ns, name);
351351
}
352352
}
353353
}
@@ -400,14 +400,14 @@ namespace cppwinrt
400400

401401
if (consume_types)
402402
{
403-
static constexpr std::string_view iterable("Windows::Foundation::Collections::IIterable<"sv);
404-
static constexpr std::string_view vector_view("Windows::Foundation::Collections::IVectorView<"sv);
405-
static constexpr std::string_view map_view("Windows::Foundation::Collections::IMapView<"sv);
406-
static constexpr std::string_view vector("Windows::Foundation::Collections::IVector<"sv);
407-
static constexpr std::string_view map("Windows::Foundation::Collections::IMap<"sv);
403+
static constexpr std::string_view iterable("winrt::Windows::Foundation::Collections::IIterable<"sv);
404+
static constexpr std::string_view vector_view("winrt::Windows::Foundation::Collections::IVectorView<"sv);
405+
static constexpr std::string_view map_view("winrt::Windows::Foundation::Collections::IMapView<"sv);
406+
static constexpr std::string_view vector("winrt::Windows::Foundation::Collections::IVector<"sv);
407+
static constexpr std::string_view map("winrt::Windows::Foundation::Collections::IMap<"sv);
408408

409409
consume_types = false;
410-
auto full_name = write_temp("@::%<%>", ns, name, bind_list(", ", type.GenericArgs()));
410+
auto full_name = write_temp("winrt::@::%<%>", ns, name, bind_list(", ", type.GenericArgs()));
411411
consume_types = true;
412412

413413
if (starts_with(full_name, iterable))
@@ -459,7 +459,7 @@ namespace cppwinrt
459459
}
460460
else
461461
{
462-
write("@::%<%>", ns, name, bind_list(", ", type.GenericArgs()));
462+
write("winrt::@::%<%>", ns, name, bind_list(", ", type.GenericArgs()));
463463
}
464464
}
465465
}

test/test_component/Windows.Class.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
namespace winrt::test_component::Windows::implementation
66
{
7-
void Class::StaticMethod()
7+
void Class::StaticMethod(winrt::test_component::Windows::Struct const&)
88
{
99
throw hresult_not_implemented();
1010
}
11-
void Class::Method()
11+
void Class::Method(winrt::Windows::Foundation::Uri const&)
1212
{
1313
throw hresult_not_implemented();
1414
}

test/test_component/Windows.Class.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ namespace winrt::test_component::Windows::implementation
77
{
88
Class() = default;
99

10-
static void StaticMethod();
11-
void Method();
10+
static void StaticMethod(winrt::test_component::Windows::Struct const& param);
11+
void Method(winrt::Windows::Foundation::Uri const& param);
1212
};
1313
}
1414
namespace winrt::test_component::Windows::factory_implementation

test/test_component/test_component.idl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,18 @@ namespace test_component
280280

281281
namespace Windows
282282
{
283+
struct Struct
284+
{
285+
Windows.Foundation.Rect rect;
286+
Windows.Foundation.Numerics.Matrix3x2 matrix;
287+
Windows.Foundation.IReference<Windows.Foundation.Rect> ref_rect;
288+
};
289+
283290
runtimeclass Class
284291
{
285292
Class();
286-
static void StaticMethod();
287-
void Method();
293+
static void StaticMethod(Struct param);
294+
void Method(Windows.Foundation.Uri param);
288295
}
289296
}
290297
}

0 commit comments

Comments
 (0)