-
Notifications
You must be signed in to change notification settings - Fork 123
Expand file tree
/
Copy pathCustomIterableTest.cpp
More file actions
39 lines (34 loc) · 1.05 KB
/
CustomIterableTest.cpp
File metadata and controls
39 lines (34 loc) · 1.05 KB
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
#include "pch.h"
#include "CustomIterableTest.h"
#include "CustomIterableTest.g.cpp"
namespace winrt::TestComponentCSharp::implementation
{
CustomIterableTest::CustomIterableTest()
{
_iterable = winrt::single_threaded_vector(std::vector{ 1, 2, 4 });
}
CustomIterableTest::CustomIterableTest(winrt::Windows::Foundation::Collections::IIterable<int32_t> const& iterable)
{
_iterable = iterable;
}
CustomIterableTest::CustomIterableTest(bool useCustomIterator)
:CustomIterableTest()
{
_useCustomIterator = useCustomIterator;
}
winrt::TestComponentCSharp::CustomIterableTest CustomIterableTest::CreateWithCustomIterator()
{
return winrt::make<CustomIterableTest>(true);
}
winrt::Windows::Foundation::Collections::IIterator<int32_t> CustomIterableTest::First()
{
if (_useCustomIterator)
{
return winrt::TestComponentCSharp::CustomIteratorTest(_iterable.First());
}
else
{
return _iterable.First();
}
}
}