forked from microsoft/CsWinRT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClass.cpp
1775 lines (1602 loc) · 51.1 KB
/
Class.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "pch.h"
#include "Class.h"
#include "Class.g.cpp"
using namespace std::chrono;
using namespace winrt;
using namespace Windows::Foundation;
namespace WF = Windows::Foundation;
using namespace Collections;
using namespace Microsoft::UI::Xaml::Data;
using namespace Microsoft::UI::Xaml::Interop;
using Windows::UI::Xaml::Interop::TypeName;
namespace winrt::TestComponentCSharp::implementation
{
namespace statics
{
static int _int {};
static winrt::event<EventHandler<int32_t>> _intChanged {};
static winrt::hstring _string;
static winrt::event<TypedEventHandler<TestComponentCSharp::Class, hstring>> _stringChanged {};
static int _readWrite{};
}
template <typename K, typename V>
struct key_value_pair : implements<key_value_pair<K, V>, IKeyValuePair<K, V>>
{
key_value_pair(K key, V value) :
m_key(std::move(key)),
m_value(std::move(value))
{
}
K Key() const
{
return m_key;
}
V Value() const
{
return m_value;
}
private:
K m_key;
V m_value;
};
struct bindable_vector : winrt::implements<bindable_vector, IBindableVector, IBindableIterable>
{
IBindableVector _wrapped;
bindable_vector(IBindableVector wrapped)
{
_wrapped = wrapped;
}
IBindableIterator First() const
{
return _wrapped.First();
}
WF::IInspectable GetAt(uint32_t index) const
{
return _wrapped.GetAt(index);
}
uint32_t Size() const
{
return _wrapped.Size();
}
IBindableVectorView GetView() const
{
return _wrapped.GetView();
}
bool IndexOf(WF::IInspectable const& value, uint32_t& index) const
{
return _wrapped.IndexOf(value, index);
}
void SetAt(uint32_t index, WF::IInspectable const& value) const
{
_wrapped.SetAt(index, value);
}
void InsertAt(uint32_t index, WF::IInspectable const& value) const
{
_wrapped.InsertAt(index, value);
}
void RemoveAt(uint32_t index) const
{
_wrapped.RemoveAt(index);
}
void Append(WF::IInspectable const& value) const
{
_wrapped.Append(value);
}
void RemoveAtEnd() const
{
_wrapped.RemoveAtEnd();
}
void Clear() const
{
_wrapped.Clear();
}
};
struct bindable_observable_vector : winrt::implements<bindable_observable_vector, IBindableObservableVector, IBindableIterable, IBindableVector>
{
IBindableObservableVector _wrapped;
bindable_observable_vector(IBindableObservableVector wrapped)
{
_wrapped = wrapped;
}
IBindableIterator First()
{
return _wrapped.First();
}
WF::IInspectable GetAt(uint32_t index)
{
return _wrapped.GetAt(index);
}
uint32_t Size()
{
return _wrapped.Size();
}
IBindableVectorView GetView()
{
return _wrapped.GetView();
}
bool IndexOf(WF::IInspectable const& value, uint32_t& index)
{
return _wrapped.IndexOf(value, index);
}
void SetAt(uint32_t index, WF::IInspectable const& value)
{
return _wrapped.SetAt(index, value);
}
void InsertAt(uint32_t index, WF::IInspectable const& value)
{
return _wrapped.InsertAt(index, value);
}
void RemoveAt(uint32_t index)
{
return _wrapped.RemoveAt(index);
}
void Append(WF::IInspectable const& value)
{
_wrapped.Append(value);
}
void RemoveAtEnd()
{
_wrapped.RemoveAtEnd();
}
void Clear()
{
_wrapped.Clear();
}
winrt::event_token VectorChanged(BindableVectorChangedEventHandler const& handler)
{
return _wrapped.VectorChanged(handler);
}
void VectorChanged(winrt::event_token const& token) noexcept
{
_wrapped.VectorChanged(token);
}
};
struct data_errors_changed_event_args : implements<data_errors_changed_event_args, IDataErrorsChangedEventArgs>
{
data_errors_changed_event_args(winrt::hstring name) :
m_name(name)
{
}
hstring PropertyName() const
{
return m_name;
}
void PropertyName(param::hstring const& name)
{
m_name = name;
}
private:
winrt::hstring m_name;
};
Class::Class() :
Class(0, L"")
{
}
Class::Class(int32_t intProperty) :
Class(intProperty, L"")
{
}
Class::Class(int32_t intProperty, hstring const& stringProperty) :
_int(intProperty),
_string(stringProperty),
_stringPair(make<key_value_pair<hstring, hstring>>(L"", L"")),
_uri(nullptr)
{
_nonBlittableStruct.refs.ref32 = 42;
_syncHandle.attach(::CreateEventW(nullptr, false, false, nullptr));
if (!_syncHandle)
{
winrt::throw_last_error();
}
_strings = winrt::single_threaded_vector<hstring>({ L"foo", L"bar" });
}
void Class::TypeProperty(Windows::UI::Xaml::Interop::TypeName val)
{
_typeProperty = val;
}
Windows::UI::Xaml::Interop::TypeName Class::TypeProperty()
{
return _typeProperty;
}
winrt::hstring Class::GetTypePropertyAbiName()
{
return _typeProperty.Name;
}
winrt::hstring Class::GetTypePropertyKind()
{
switch (_typeProperty.Kind)
{
case Windows::UI::Xaml::Interop::TypeKind::Custom:
return winrt::hstring(L"Custom");
case Windows::UI::Xaml::Interop::TypeKind::Metadata:
return winrt::hstring(L"Metadata");
default:
return winrt::hstring(L"Primitive");
}
}
Windows::UI::Xaml::Interop::TypeName TypeProperty()
{
return Windows::UI::Xaml::Interop::TypeName();
}
int32_t Class::StaticIntProperty()
{
return statics::_int;
}
void Class::StaticIntProperty(int32_t value)
{
statics::_int = value;
statics::_intChanged(/*todo*/ nullptr, statics::_int);
}
winrt::event_token Class::StaticIntPropertyChanged(EventHandler<int32_t> const& handler)
{
return statics::_intChanged.add(handler);
}
void Class::StaticIntPropertyChanged(winrt::event_token const& token) noexcept
{
statics::_intChanged.remove(token);
}
hstring Class::StaticStringProperty()
{
return statics::_string;
}
void Class::StaticStringProperty(hstring const& value)
{
statics::_string = value;
}
winrt::event_token Class::StaticStringPropertyChanged(TypedEventHandler<TestComponentCSharp::Class, hstring> const& handler)
{
return statics::_stringChanged.add(handler);
}
void Class::StaticStringPropertyChanged(winrt::event_token const& token) noexcept
{
statics::_stringChanged.remove(token);
}
void Class::StaticGetString()
{
statics::_stringChanged(/*todo*/ nullptr, statics::_string);
}
void Class::StaticSetString(TestComponentCSharp::ProvideString const& provideString)
{
statics::_string = provideString();
}
int32_t Class::StaticReadWriteProperty()
{
return statics::_readWrite;
}
void Class::StaticReadWriteProperty(int32_t value)
{
statics::_readWrite = value;
}
TimeSpan Class::FromSeconds(int32_t seconds)
{
return std::chrono::seconds{seconds};
}
DateTime Class::Now()
{
return winrt::clock::now();
}
winrt::event_token Class::Event0(TestComponentCSharp::EventHandler0 const& handler)
{
return _event0.add(handler);
}
void Class::Event0(winrt::event_token const& token) noexcept
{
_event0.remove(token);
}
void Class::InvokeEvent0()
{
_event0();
}
winrt::event_token Class::Event1(TestComponentCSharp::EventHandler1 const& handler)
{
return _event1.add(handler);
}
void Class::Event1(winrt::event_token const& token) noexcept
{
_event1.remove(token);
}
void Class::InvokeEvent1(TestComponentCSharp::Class const& sender)
{
_event1(sender);
}
winrt::event_token Class::Event2(TestComponentCSharp::EventHandler2 const& handler)
{
return _event2.add(handler);
}
void Class::Event2(winrt::event_token const& token) noexcept
{
_event2.remove(token);
}
void Class::InvokeEvent2(TestComponentCSharp::Class const& sender, int32_t arg0)
{
_event2(sender, arg0);
}
winrt::event_token Class::Event3(TestComponentCSharp::EventHandler3 const& handler)
{
return _event3.add(handler);
}
void Class::Event3(winrt::event_token const& token) noexcept
{
_event3.remove(token);
}
void Class::InvokeEvent3(TestComponentCSharp::Class const& sender, int32_t arg0, hstring const& arg1)
{
_event3(sender, arg0, arg1);
}
winrt::event_token Class::CollectionEvent(TestComponentCSharp::EventHandlerCollection const& handler)
{
return _collectionEvent.add(handler);
}
void Class::CollectionEvent(winrt::event_token const& token) noexcept
{
_collectionEvent.remove(token);
}
void Class::InvokeCollectionEvent(TestComponentCSharp::Class const& sender, IVector<int32_t> const& arg0, IMap<int32_t, hstring> const& arg1)
{
_collectionEvent(sender, arg0, arg1);
}
winrt::event_token Class::GuidEvent(TestComponentCSharp::EventWithGuid const& handler)
{
return _guidEvent.add(handler);
}
void Class::GuidEvent(winrt::event_token const& token) noexcept
{
_guidEvent.remove(token);
}
void Class::InvokeGuidEvent(winrt::guid const& correlationGuid)
{
_guidEvent(correlationGuid);
}
winrt::event_token Class::NestedEvent(EventHandler<IVector<int32_t>> const& handler)
{
return _nestedEvent.add(handler);
}
void Class::NestedEvent(winrt::event_token const& token) noexcept
{
_nestedEvent.remove(token);
}
void Class::InvokeNestedEvent(TestComponentCSharp::Class const& sender, IVector<int32_t> const& arg0)
{
_nestedEvent(sender, arg0);
}
winrt::event_token Class::NestedTypedEvent(TypedEventHandler<TestComponentCSharp::Class, IVector<hstring>> const& handler)
{
return _nestedTypedEvent.add(handler);
}
void Class::NestedTypedEvent(winrt::event_token const& token) noexcept
{
_nestedTypedEvent.remove(token);
}
void Class::InvokeNestedTypedEvent(TestComponentCSharp::Class const& sender, IVector<hstring> const& arg0)
{
_nestedTypedEvent(sender, arg0);
}
winrt::event_token Class::ReturnEvent(TestComponentCSharp::EventWithReturn const& handler)
{
return _returnEvent.add(handler);
}
void Class::ReturnEvent(winrt::event_token const& token) noexcept
{
_returnEvent.remove(token);
}
int32_t Class::InvokeReturnEvent(int32_t const& arg0)
{
_returnEvent(arg0);
return arg0;
}
winrt::guid Class::TestReturnGuid(winrt::guid const& arg)
{
return arg;
}
int32_t Class::IntProperty()
{
return _int;
}
void Class::IntProperty(int32_t value)
{
_int = value;
_intChanged(*this, _int);
}
winrt::event_token Class::IntPropertyChanged(EventHandler<int32_t> const& handler)
{
auto eventToken = _intChanged.add(handler);
_lastIntChangedEventToken = eventToken;
return eventToken;
}
void Class::IntPropertyChanged(winrt::event_token const& token) noexcept
{
_intChanged.remove(token);
}
void Class::RaiseIntChanged()
{
_intChanged(*this, _int);
}
void Class::RemoveLastIntPropertyChangedHandler()
{
_intChanged.remove(_lastIntChangedEventToken);
}
void Class::CallForInt(TestComponentCSharp::ProvideInt const& provideInt)
{
_int = provideInt();
}
bool Class::BoolProperty()
{
return _bool;
}
void Class::BoolProperty(bool value)
{
_bool = value;
_boolChanged(*this, _bool);
}
winrt::event_token Class::BoolPropertyChanged(EventHandler<bool> const& handler)
{
return _boolChanged.add(handler);
}
void Class::BoolPropertyChanged(winrt::event_token const& token) noexcept
{
_boolChanged.remove(token);
}
void Class::RaiseBoolChanged()
{
_boolChanged(*this, _bool);
}
void Class::CallForBool(TestComponentCSharp::ProvideBool const& provideBool)
{
_bool = provideBool();
_boolChanged(*this, _bool);
}
TestComponentCSharp::EnumValue Class::EnumProperty()
{
return _enumValue;
}
void Class::EnumProperty(TestComponentCSharp::EnumValue const& value)
{
_enumValue = value;
}
winrt::event_token Class::EnumPropertyChanged(Windows::Foundation::EventHandler<TestComponentCSharp::EnumValue> const& handler)
{
return _enumChanged.add(handler);
}
void Class::EnumPropertyChanged(winrt::event_token const& token) noexcept
{
_enumChanged.remove(token);
}
void Class::RaiseEnumChanged()
{
_enumChanged(*this, _enumValue);
}
void Class::CallForEnum(TestComponentCSharp::ProvideEnum const& provide)
{
_enumValue = provide();
_enumChanged(*this, _enumValue);
}
TestComponentCSharp::EnumStruct Class::EnumStructProperty()
{
return _enumStruct;
}
void Class::EnumStructProperty(TestComponentCSharp::EnumStruct const& value)
{
_enumStruct = value;
}
winrt::event_token Class::EnumStructPropertyChanged(Windows::Foundation::EventHandler<TestComponentCSharp::EnumStruct> const& handler)
{
return _enumStructChanged.add(handler);
}
void Class::EnumStructPropertyChanged(winrt::event_token const& token) noexcept
{
_enumStructChanged.remove(token);
}
void Class::RaiseEnumStructChanged()
{
_enumStructChanged(*this, _enumStruct);
}
void Class::CallForEnumStruct(TestComponentCSharp::ProvideEnumStruct const& provide)
{
_enumStruct = provide();
_enumStructChanged(*this, _enumStruct);
}
com_array<TestComponentCSharp::EnumValue> Class::EnumsProperty()
{
return { _enums.begin(), _enums.end() };
}
void Class::EnumsProperty(array_view<TestComponentCSharp::EnumValue const> value)
{
_enums.assign(value.begin(), value.end());
}
void Class::CallForEnums(TestComponentCSharp::ProvideEnums const& provide)
{
EnumsProperty(provide());
}
com_array<TestComponentCSharp::EnumStruct> Class::EnumStructsProperty()
{
return { _enumStructs.begin(), _enumStructs.end() };
}
void Class::EnumStructsProperty(array_view<TestComponentCSharp::EnumStruct const> value)
{
_enumStructs.assign(value.begin(), value.end());
}
void Class::CallForEnumStructs(TestComponentCSharp::ProvideEnumStructs const& provide)
{
EnumStructsProperty(provide());
}
TestComponentCSharp::FlagValue Class::FlagProperty()
{
return _flagValue;
}
void Class::FlagProperty(TestComponentCSharp::FlagValue const& value)
{
_flagValue = value;
}
winrt::event_token Class::FlagPropertyChanged(Windows::Foundation::EventHandler<TestComponentCSharp::FlagValue> const& handler)
{
return _flagChanged.add(handler);
}
void Class::FlagPropertyChanged(winrt::event_token const& token) noexcept
{
_flagChanged.remove(token);
}
void Class::RaiseFlagChanged()
{
_flagChanged(*this, _flagValue);
}
void Class::CallForFlag(TestComponentCSharp::ProvideFlag const& provide)
{
_flagValue = provide();
_flagChanged(*this, _flagValue);
}
TestComponentCSharp::FlagStruct Class::FlagStructProperty()
{
return _flagStruct;
}
void Class::FlagStructProperty(TestComponentCSharp::FlagStruct const& value)
{
_flagStruct = value;
}
winrt::event_token Class::FlagStructPropertyChanged(Windows::Foundation::EventHandler<TestComponentCSharp::FlagStruct> const& handler)
{
return _flagStructChanged.add(handler);
}
void Class::FlagStructPropertyChanged(winrt::event_token const& token) noexcept
{
_flagStructChanged.remove(token);
}
void Class::RaiseFlagStructChanged()
{
_flagStructChanged(*this, _flagStruct);
}
void Class::CallForFlagStruct(TestComponentCSharp::ProvideFlagStruct const& provide)
{
_flagStruct = provide();
_flagStructChanged(*this, _flagStruct);
}
com_array<TestComponentCSharp::FlagValue> Class::FlagsProperty()
{
return { _flags.begin(), _flags.end() };
}
void Class::FlagsProperty(array_view<TestComponentCSharp::FlagValue const> value)
{
_flags.assign(value.begin(), value.end());
}
void Class::CallForFlags(TestComponentCSharp::ProvideFlags const& provide)
{
FlagsProperty(provide());
}
com_array<TestComponentCSharp::FlagStruct> Class::FlagStructsProperty()
{
return { _flagStructs.begin(), _flagStructs.end() };
}
void Class::FlagStructsProperty(array_view<TestComponentCSharp::FlagStruct const> value)
{
_flagStructs.assign(value.begin(), value.end());
}
void Class::CallForFlagStructs(TestComponentCSharp::ProvideFlagStructs const& provide)
{
FlagStructsProperty(provide());
}
hstring Class::StringProperty()
{
return _string;
}
void Class::StringProperty(hstring const& value)
{
_string = value;
}
winrt::event_token Class::StringPropertyChanged(TypedEventHandler<TestComponentCSharp::Class, hstring> const& handler)
{
return _stringChanged.add(handler);
}
void Class::StringPropertyChanged(winrt::event_token const& token) noexcept
{
_stringChanged.remove(token);
}
void Class::RaiseStringChanged()
{
_stringChanged(*this, _string);
}
void Class::CallForString(TestComponentCSharp::ProvideString const& provideString)
{
_string = provideString();
}
hstring Class::StringProperty2()
{
return _string2;
}
void Class::StringProperty2(hstring const& value)
{
_string2 = value;
}
IVector<hstring> Class::StringsProperty()
{
return _strings;
}
void Class::StringsProperty(IVector<hstring> const& value)
{
_strings = value;
}
WF::IInspectable Class::ObjectProperty()
{
return _object;
}
void Class::ObjectProperty(WF::IInspectable const& value)
{
if (auto uri = value.try_as<Windows::Foundation::Uri>())
{
_uri = uri;
}
_object = value;
}
void Class::RaiseObjectChanged()
{
_objectChanged(*this, _object);
}
void Class::CallForObject(TestComponentCSharp::ProvideObject const& provideObject)
{
_object = provideObject();
}
winrt::event_token Class::ObjectPropertyChanged(EventHandler<WF::IInspectable> const& handler)
{
return _objectChanged.add(handler);
}
void Class::ObjectPropertyChanged(winrt::event_token const& token) noexcept
{
_objectChanged.remove(token);
}
IIterable<WF::IInspectable> Class::ObjectIterableProperty()
{
return _objectIterable;
}
void Class::ObjectIterableProperty(IIterable<WF::IInspectable> const& value)
{
for (auto element : value)
{
}
_objectIterable = value;
}
void Class::RaiseObjectIterableChanged()
{
_objectIterableChanged(*this, _objectIterable);
}
void Class::CallForObjectIterable(TestComponentCSharp::ProvideObjectIterable const& provideObjectIterable)
{
_objectIterable = provideObjectIterable();
}
winrt::event_token Class::ObjectIterablePropertyChanged(EventHandler<IIterable<WF::IInspectable>> const& handler)
{
return _objectIterableChanged.add(handler);
}
void Class::ObjectIterablePropertyChanged(winrt::event_token const& token) noexcept
{
_objectIterableChanged.remove(token);
}
IIterable<IIterable<WF::Point>> Class::IterableOfPointIterablesProperty()
{
return _pointIterableIterable;
}
void Class::IterableOfPointIterablesProperty(IIterable<IIterable<WF::Point>> const& value)
{
for (auto points : value)
{
for (auto point : points)
{
}
}
_pointIterableIterable = value;
}
IIterable<IIterable<WF::IInspectable>> Class::IterableOfObjectIterablesProperty()
{
return _objectIterableIterable;
}
void Class::IterableOfObjectIterablesProperty(IIterable<IIterable<WF::IInspectable>> const& value)
{
for (auto objects : value)
{
for (auto object : objects)
{
}
}
_objectIterableIterable = value;
}
Uri Class::UriProperty()
{
return _uri;
}
void Class::UriProperty(Uri const& value)
{
_uri = value;
}
void Class::RaiseUriChanged()
{
_uriChanged(*this, _uri);
}
void Class::CallForUri(TestComponentCSharp::ProvideUri const& provideUri)
{
_uri = provideUri();
}
winrt::event_token Class::UriPropertyChanged(EventHandler<Uri> const& handler)
{
return _uriChanged.add(handler);
}
void Class::UriPropertyChanged(winrt::event_token const& token) noexcept
{
_uriChanged.remove(token);
}
Windows::Foundation::Collections::IVector<Windows::Foundation::IInspectable> Class::GetUriVectorAsIInspectableVector()
{
return single_threaded_vector<Windows::Foundation::IInspectable>({ Uri(L"https://microsoft.com"), Uri(L"https://github.com") });
};
IAsyncOperation<int32_t> Class::GetIntAsync()
{
co_return _int;
}
IAsyncOperationWithProgress<hstring, int32_t> Class::GetStringAsync()
{
co_return _string;
}
IKeyValuePair<hstring, hstring> Class::StringPairProperty()
{
return _stringPair;
}
void Class::StringPairProperty(IKeyValuePair<hstring, hstring> const& value)
{
_stringPair = value;
}
void Class::RaiseStringPairChanged()
{
_stringPairChanged(*this, _stringPair);
}
void Class::CallForStringPair(TestComponentCSharp::ProvideStringPair const& provideStringPair)
{
_stringPair = provideStringPair();
}
winrt::event_token Class::StringPairPropertyChanged(EventHandler<IKeyValuePair<hstring, hstring>> const& handler)
{
return _stringPairChanged.add(handler);
}
void Class::StringPairPropertyChanged(winrt::event_token const& token) noexcept
{
_stringPairChanged.remove(token);
}
TestComponentCSharp::ProvideUri Class::GetUriDelegate() noexcept
{
TestComponentCSharp::ProvideUri handler = [] { return Windows::Foundation::Uri(L"http://microsoft.com"); };
return handler;
}
void Class::AddUriHandler(TestComponentCSharp::IUriHandler uriHandler)
{
TestComponentCSharp::ProvideUri handler = [] { return Windows::Foundation::Uri(L"http://github.com"); };
uriHandler.AddUriHandler(handler);
}
BlittableStruct Class::BlittableStructProperty()
{
return _blittableStruct.blittable;
}
void Class::BlittableStructProperty(BlittableStruct const& value)
{
_blittableStruct.blittable = value;
}
BlittableStruct Class::GetBlittableStruct()
{
return _blittableStruct.blittable;
}
void Class::OutBlittableStruct(BlittableStruct& value)
{
value = _blittableStruct.blittable;
}
void Class::SetBlittableStruct(BlittableStruct const& value)
{
_blittableStruct.blittable = value;
}
ComposedBlittableStruct Class::ComposedBlittableStructProperty()
{
return _blittableStruct;
}
void Class::ComposedBlittableStructProperty(ComposedBlittableStruct const& value)
{
_blittableStruct = value;
}
ComposedBlittableStruct Class::GetComposedBlittableStruct()
{
return _blittableStruct;
}
void Class::OutComposedBlittableStruct(ComposedBlittableStruct& value)
{
value = _blittableStruct;
}
void Class::SetComposedBlittableStruct(ComposedBlittableStruct const& value)
{
_blittableStruct = value;
}
NonBlittableStringStruct Class::NonBlittableStringStructProperty()
{
return _nonBlittableStruct.strings;
}
void Class::NonBlittableStringStructProperty(NonBlittableStringStruct const& value)
{
_nonBlittableStruct.strings = value;
}
NonBlittableStringStruct Class::GetNonBlittableStringStruct()
{
return _nonBlittableStruct.strings;
}
void Class::OutNonBlittableStringStruct(NonBlittableStringStruct& value)
{
value = _nonBlittableStruct.strings;
}
void Class::SetNonBlittableStringStruct(NonBlittableStringStruct const& value)
{
_nonBlittableStruct.strings = value;
}
NonBlittableBoolStruct Class::NonBlittableBoolStructProperty()
{
return _nonBlittableStruct.bools;
}
void Class::NonBlittableBoolStructProperty(NonBlittableBoolStruct const& value)
{
_nonBlittableStruct.bools = value;
}
NonBlittableBoolStruct Class::GetNonBlittableBoolStruct()
{
return _nonBlittableStruct.bools;
}
void Class::OutNonBlittableBoolStruct(NonBlittableBoolStruct& value)
{
value = _nonBlittableStruct.bools;
}
void Class::SetNonBlittableBoolStruct(NonBlittableBoolStruct const& value)
{
_nonBlittableStruct.bools = value;
}
NonBlittableRefStruct Class::NonBlittableRefStructProperty()
{
return _nonBlittableStruct.refs;
}
void Class::NonBlittableRefStructProperty(NonBlittableRefStruct const& value)
{
_nonBlittableStruct.refs = value;
}
NonBlittableRefStruct Class::GetNonBlittableRefStruct()
{
return _nonBlittableStruct.refs;
}
void Class::OutNonBlittableRefStruct(NonBlittableRefStruct& value)
{
value = _nonBlittableStruct.refs;
}
void Class::SetNonBlittableRefStruct(NonBlittableRefStruct const& value)
{
_nonBlittableStruct.refs = value;
}
TestComponentCSharp::ComposedNonBlittableStruct Class::ComposedNonBlittableStructProperty()
{
return _nonBlittableStruct;
}
void Class::ComposedNonBlittableStructProperty(TestComponentCSharp::ComposedNonBlittableStruct const& value)
{
_nonBlittableStruct = value;
}
TestComponentCSharp::ComposedNonBlittableStruct Class::GetComposedNonBlittableStruct()
{
return _nonBlittableStruct;
}
void Class::OutComposedNonBlittableStruct(TestComponentCSharp::ComposedNonBlittableStruct& value)
{
value = _nonBlittableStruct;
}
void Class::SetComposedNonBlittableStruct(TestComponentCSharp::ComposedNonBlittableStruct const& value)
{
_nonBlittableStruct = value;
}
void Class::SetInts(array_view<int32_t const> ints)
{
_ints.assign( ints.begin(), ints.end() );
}
com_array<int32_t> Class::GetInts()
{
return { _ints.begin(), _ints.end() };
}
void Class::FillInts(array_view<int32_t> ints)
{
std::copy(_ints.begin(), _ints.end(), ints.begin());
}