windows.foundation.collections.idl 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /*
  2. * Copyright 2021 Rémi Bernon for CodeWeavers
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  17. */
  18. #ifdef __WIDL__
  19. #pragma winrt ns_prefix
  20. #endif
  21. import "inspectable.idl";
  22. import "asyncinfo.idl";
  23. import "windowscontracts.idl";
  24. /* import "eventtoken.idl"; */
  25. namespace Windows {
  26. namespace Foundation {
  27. cpp_quote("#ifdef __cplusplus")
  28. cpp_quote("} /* extern \"C\" */")
  29. cpp_quote("namespace ABI { namespace Windows { namespace Foundation { namespace Internal {")
  30. cpp_quote("template <class T> struct GetAbiType { typedef T type; };")
  31. cpp_quote("template <class T> struct GetLogicalType { typedef T type; };")
  32. cpp_quote("template <class L, class A> struct AggregateType {};")
  33. cpp_quote("template <class L, class A> struct GetAbiType<AggregateType<L, A> > { typedef A type; };")
  34. cpp_quote("template <class L, class A> struct GetLogicalType<AggregateType<L, A> > { typedef L type; };")
  35. cpp_quote("}}}}")
  36. cpp_quote("extern \"C\" {")
  37. cpp_quote("#endif")
  38. #ifdef __WIDL__
  39. [
  40. contract(Windows.Foundation.FoundationContract, 1.0),
  41. uuid(9de1c535-6ae1-11e0-84e1-18a905bcc53f)
  42. ]
  43. delegate HRESULT EventHandler<T>([in] IInspectable *sender, [in] T args);
  44. interface IAsyncOperation<TResult>;
  45. [
  46. contract(Windows.Foundation.FoundationContract, 1.0),
  47. uuid(fcdcf02c-e5d8-4478-915a-4d90b74b83a5)
  48. ]
  49. delegate HRESULT AsyncOperationCompletedHandler<TResult>([in] Windows.Foundation.IAsyncOperation<TResult> *info,
  50. [in] AsyncStatus status);
  51. [
  52. contract(Windows.Foundation.FoundationContract, 1.0),
  53. uuid(9fc2b0bb-e446-44e2-aa61-9cab8f636af2)
  54. ]
  55. interface IAsyncOperation<TResult> : IInspectable
  56. {
  57. [propput] HRESULT Completed([in] Windows.Foundation.AsyncOperationCompletedHandler<TResult> *handler);
  58. [propget] HRESULT Completed([out, retval] Windows.Foundation.AsyncOperationCompletedHandler<TResult> **handler);
  59. HRESULT GetResults([out, retval] TResult *results);
  60. }
  61. [
  62. contract(Windows.Foundation.FoundationContract, 1.0),
  63. uuid(9de1c534-6ae1-11e0-84e1-18a905bcc53f)
  64. ]
  65. delegate HRESULT TypedEventHandler<TSender, TArgs>([in] TSender sender, [in] TArgs args);
  66. [
  67. contract(Windows.Foundation.FoundationContract, 1.0),
  68. uuid(61c17706-2d65-11e0-9ae8-d48564015472)
  69. ]
  70. interface IReference<T> : IInspectable
  71. {
  72. [propget] HRESULT Value([out, retval] T *value);
  73. }
  74. namespace Collections
  75. {
  76. [
  77. contract(Windows.Foundation.FoundationContract, 1.0),
  78. uuid(6a79e863-4300-459a-9966-cbb660963ee1)
  79. ]
  80. interface IIterator<T> : IInspectable
  81. {
  82. [propget] HRESULT Current([out, retval] T *value);
  83. [propget] HRESULT HasCurrent([out, retval] BOOL *value);
  84. HRESULT MoveNext([out, retval] BOOL *value);
  85. HRESULT GetMany([in] UINT32 items_size, [out] T *items, [out, retval] UINT32 *value);
  86. }
  87. [
  88. contract(Windows.Foundation.FoundationContract, 1.0),
  89. uuid(faa585ea-6214-4217-afda-7f46de5869b3)
  90. ]
  91. interface IIterable<T> : IInspectable
  92. {
  93. HRESULT First([out, retval] Windows.Foundation.Collections.IIterator<T> **value);
  94. }
  95. [
  96. contract(Windows.Foundation.FoundationContract, 1.0),
  97. uuid(02b51929-c1c4-4a7e-8940-0312b5c18500)
  98. ]
  99. interface IKeyValuePair<K, V> : IInspectable
  100. {
  101. [propget] HRESULT Key([out, retval] K *key);
  102. [propget] HRESULT Value([out, retval] V *value);
  103. }
  104. [
  105. contract(Windows.Foundation.FoundationContract, 1.0),
  106. uuid(e480ce40-a338-4ada-adcf-272272e48cb9)
  107. ]
  108. interface IMapView<K, V> : IInspectable
  109. requires Windows.Foundation.Collections.IIterable<Windows.Foundation.Collections.IKeyValuePair<K, V> *>
  110. {
  111. HRESULT Lookup([in] K key, [out, retval] V *value);
  112. [propget] HRESULT Size([out, retval] unsigned int *size);
  113. HRESULT HasKey([in] K key, [out, retval] boolean *found);
  114. HRESULT Split([out] Windows.Foundation.Collections.IMapView<K, V> **first,
  115. [out] Windows.Foundation.Collections.IMapView<K, V> **second);
  116. }
  117. [
  118. contract(Windows.Foundation.FoundationContract, 1.0),
  119. uuid(bbe1fa4c-b0e3-4583-baef-1f1b2e483e56)
  120. ]
  121. interface IVectorView<T> : IInspectable
  122. requires Windows.Foundation.Collections.IIterable<T>
  123. {
  124. HRESULT GetAt([in] UINT32 index, [out, retval] T *value);
  125. [propget] HRESULT Size([out, retval] UINT32 *value);
  126. HRESULT IndexOf([in, optional] T element, [out] UINT32 *index, [out, retval] BOOLEAN *value);
  127. HRESULT GetMany([in] UINT32 start_index, [in] UINT32 items_size, [out] T *items, [out, retval] UINT32 *value);
  128. }
  129. [
  130. contract(Windows.Foundation.FoundationContract, 1.0),
  131. uuid(913337e9-11a1-4345-a3a2-4e7f956e222d)
  132. ]
  133. interface IVector<T> : IInspectable
  134. requires Windows.Foundation.Collections.IIterable<T>
  135. {
  136. HRESULT GetAt([in, optional] UINT32 index, [out, retval] T *value);
  137. [propget] HRESULT Size([out, retval] UINT32 *value);
  138. HRESULT GetView([out, retval] Windows.Foundation.Collections.IVectorView<T> **value);
  139. HRESULT IndexOf([in, optional] T element, [out] UINT32 *index, [out, retval] BOOLEAN *value);
  140. HRESULT SetAt([in] UINT32 index, [in, optional] T value);
  141. HRESULT InsertAt([in] UINT32 index, [in, optional] T value);
  142. HRESULT RemoveAt([in] UINT32 index);
  143. HRESULT Append([in, optional] T value);
  144. HRESULT RemoveAtEnd();
  145. HRESULT Clear();
  146. HRESULT GetMany([in] UINT32 start_index, [in] UINT32 items_size, [out] T *items, [out, retval] UINT32 *value);
  147. HRESULT ReplaceAll([in] UINT32 count, [in] T *items);
  148. }
  149. }
  150. #endif
  151. }
  152. }