summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IVector.cs
blob: 6982911a13a1b697b99e934b623b0e686b2d1c7a (plain)
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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

//

using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;

// Windows.Foundation.Collections.IVector`1 and IVectorView`1 cannot be referenced from managed
// code because they're hidden by the metadata adapter. We redeclare the interfaces manually
// to be able to talk to native WinRT objects.
namespace System.Runtime.InteropServices.WindowsRuntime
{
    [ComImport]
    [Guid("913337e9-11a1-4345-a3a2-4e7f956e222d")]
    [WindowsRuntimeImport]
    internal interface IVector<T> : IIterable<T>
    {
        [Pure]
        T GetAt(uint index);
        [Pure]
        uint Size { get; }
        [Pure]
        IReadOnlyList<T> GetView();  // Really an IVectorView<T>.
        [Pure]
        bool IndexOf(T value, out uint index);
        void SetAt(uint index, T value);
        void InsertAt(uint index, T value);
        void RemoveAt(uint index);
        void Append(T value);
        void RemoveAtEnd();
        void Clear();
        [Pure]
        uint GetMany(uint startIndex, [Out] T[] items);
        void ReplaceAll(T[] items);
    }

    // Same as IVector - the only difference is that GetView returns IVectorView<T>
    [ComImport]
    [Guid("913337e9-11a1-4345-a3a2-4e7f956e222d")]
    [WindowsRuntimeImport]
    internal interface IVector_Raw<T> : IIterable<T>
    {
        [Pure]
        T GetAt(uint index);
        [Pure]
        uint Size { get; }
        [Pure]
        IVectorView<T> GetView();
        [Pure]
        bool IndexOf(T value, out uint index);
        void SetAt(uint index, T value);
        void InsertAt(uint index, T value);
        void RemoveAt(uint index);
        void Append(T value);
        void RemoveAtEnd();
        void Clear();
    }

    [ComImport]
    [Guid("bbe1fa4c-b0e3-4583-baef-1f1b2e483e56")]
    [WindowsRuntimeImport]
    internal interface IVectorView<T> : IIterable<T>
    {
        [Pure]
        T GetAt(uint index);
        [Pure]
        uint Size { get; }
        [Pure]
        bool IndexOf(T value, out uint index);
        [Pure]
        uint GetMany(uint startIndex, [Out] T[] items);
    }

    [ComImport]
    [Guid("393de7de-6fd0-4c0d-bb71-47244a113e93")]
    [WindowsRuntimeImport]
    internal interface IBindableVector : IBindableIterable
    {
        [Pure]
        object GetAt(uint index);
        [Pure]
        uint Size { get; }
        [Pure]
        IBindableVectorView GetView();
        [Pure]
        bool IndexOf(object value, out uint index);
        void SetAt(uint index, object value);
        void InsertAt(uint index, object value);
        void RemoveAt(uint index);
        void Append(object value);
        void RemoveAtEnd();
        void Clear();
    }

    [ComImport]
    [Guid("346dd6e7-976e-4bc3-815d-ece243bc0f33")]
    [WindowsRuntimeImport]
    internal interface IBindableVectorView : IBindableIterable
    {
        [Pure]
        object GetAt(uint index);
        [Pure]
        uint Size { get; }
        [Pure]
        bool IndexOf(object value, out uint index);
    }
}