-
Notifications
You must be signed in to change notification settings - Fork 16
/
ArrayMethods.cpp
113 lines (87 loc) · 2.45 KB
/
ArrayMethods.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#include "pch.h"
#include "ArrayMethods.h"
#include "ArrayMethods.g.cpp"
namespace winrt::test_component::implementation
{
using namespace Windows::Foundation;
hstring ArrayMethods::InInt32Array(array_view<int32_t const> value)
{
simulate_rpc_behavior(value);
hstring result;
for (auto&& v : value)
{
result = result + std::to_wstring(v);
}
return result;
}
hstring ArrayMethods::InStringArray(array_view<hstring const> value)
{
simulate_rpc_behavior(value);
hstring result;
for (auto&& v : value)
{
result = result + v;
}
return result;
}
hstring ArrayMethods::InStructArray(array_view<BlittableStruct const> value)
{
simulate_rpc_behavior(value);
hstring result;
for (auto&& v : value)
{
result = result + std::to_wstring(v.First) + std::to_wstring(v.Second);
}
return result;
}
hstring ArrayMethods::InNonBlittableStructArray(array_view<NonBlittableStruct const> value)
{
simulate_rpc_behavior(value);
hstring result;
for (auto&& v : value)
{
result = result + v.First + v.Second + std::to_wstring(v.Third) + v.Fourth;
}
return result;
}
hstring ArrayMethods::InObjectArray(array_view<Windows::Foundation::IInspectable const> value)
{
simulate_rpc_behavior(value);
hstring result;
for (auto&& v : value)
{
result = result + v.as<IStringable>().ToString();
}
return result;
}
hstring ArrayMethods::InStringableArray(array_view<Windows::Foundation::IStringable const> value)
{
simulate_rpc_behavior(value);
hstring result;
for (auto&& v : value)
{
result = result + v.ToString();
}
return result;
}
hstring ArrayMethods::InEnumArray(array_view<Signed const> value)
{
simulate_rpc_behavior(value);
hstring result;
for (auto&& v : value)
{
result = result + InEnum(v);
}
return result;
}
hstring ArrayMethods::InEnum(Signed const& value)
{
switch (value)
{
case Signed::First: return L"First";
case Signed::Second: return L"Second";
case Signed::Third: return L"Third";
}
throw hresult_invalid_argument();
}
}