// WARNING: Please don't edit this file. It was generated by Swift/WinRT v0.0.1 // swiftlint:disable all import Foundation import CWinRT /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.asyncstatus) public typealias AsyncStatus = __x_ABI_CWindows_CFoundation_CAsyncStatus /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.propertytype) public typealias PropertyType = __x_ABI_CWindows_CFoundation_CPropertyType /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.deferral) public final class Deferral : WinRTClass, IClosable { private typealias SwiftABI = __ABI_Windows_Foundation.IDeferral private typealias CABI = __x_ABI_CWindows_CFoundation_CIDeferral private lazy var _default: SwiftABI! = getInterfaceForCaching() @_spi(WinRTInternal) override public func _getABI() -> UnsafeMutablePointer? { if T.self == CABI.self { return RawPointer(_default) } return super._getABI() } @_spi(WinRTInternal) public static func from(abi: ComPtr<__x_ABI_CWindows_CFoundation_CIDeferral>?) -> Deferral? { guard let abi = abi else { return nil } return .init(fromAbi: WindowsFoundation.IInspectable(abi)) } @_spi(WinRTInternal) public init(fromAbi: WindowsFoundation.IInspectable) { super.init(fromAbi) } override public func queryInterface(_ iid: WindowsFoundation.IID) -> IUnknownRef? { return super.queryInterface(iid) } private static let _IDeferralFactory: __ABI_Windows_Foundation.IDeferralFactory = try! RoGetActivationFactory(HString("Windows.Foundation.Deferral")) public init(_ handler: DeferralCompletedHandler!) { super.init(try! Self._IDeferralFactory.CreateImpl(handler)) } private lazy var _IClosable: __ABI_Windows_Foundation.IClosable! = getInterfaceForCaching() /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.deferral.close) public func close() throws { try _IClosable.CloseImpl() } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.deferral.complete) public func complete() throws { try _default.CompleteImpl() } deinit { _IClosable = nil _default = nil } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.guidhelper) public final class GuidHelper { private static let _IGuidHelperStatics: __ABI_Windows_Foundation.IGuidHelperStatics = try! RoGetActivationFactory(HString("Windows.Foundation.GuidHelper")) /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.guidhelper.createnewguid) public static func createNewGuid() -> Foundation.UUID { return try! _IGuidHelperStatics.CreateNewGuidImpl() } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.guidhelper.empty) public static var empty : Foundation.UUID { get { try! _IGuidHelperStatics.get_EmptyImpl() } } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.memorybuffer) public final class MemoryBuffer : WinRTClass, IClosable, IMemoryBuffer { private typealias SwiftABI = __ABI_Windows_Foundation.IMemoryBuffer private typealias CABI = __x_ABI_CWindows_CFoundation_CIMemoryBuffer private lazy var _default: SwiftABI! = getInterfaceForCaching() @_spi(WinRTInternal) override public func _getABI() -> UnsafeMutablePointer? { if T.self == CABI.self { return RawPointer(_default) } return super._getABI() } @_spi(WinRTInternal) public static func from(abi: ComPtr<__x_ABI_CWindows_CFoundation_CIMemoryBuffer>?) -> MemoryBuffer? { guard let abi = abi else { return nil } return .init(fromAbi: WindowsFoundation.IInspectable(abi)) } @_spi(WinRTInternal) public init(fromAbi: WindowsFoundation.IInspectable) { super.init(fromAbi) } override public func queryInterface(_ iid: WindowsFoundation.IID) -> IUnknownRef? { return super.queryInterface(iid) } private static let _IMemoryBufferFactory: __ABI_Windows_Foundation.IMemoryBufferFactory = try! RoGetActivationFactory(HString("Windows.Foundation.MemoryBuffer")) public init(_ capacity: UInt32) { super.init(try! Self._IMemoryBufferFactory.CreateImpl(capacity)) } private lazy var _IClosable: __ABI_Windows_Foundation.IClosable! = getInterfaceForCaching() /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.memorybuffer.close) public func close() throws { try _IClosable.CloseImpl() } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.memorybuffer.createreference) public func createReference() throws -> AnyIMemoryBufferReference! { try _default.CreateReferenceImpl() } deinit { _IClosable = nil _default = nil } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri) public final class Uri : WinRTClass, IStringable { private typealias SwiftABI = __ABI_Windows_Foundation.IUriRuntimeClass private typealias CABI = __x_ABI_CWindows_CFoundation_CIUriRuntimeClass private lazy var _default: SwiftABI! = getInterfaceForCaching() @_spi(WinRTInternal) override public func _getABI() -> UnsafeMutablePointer? { if T.self == CABI.self { return RawPointer(_default) } return super._getABI() } @_spi(WinRTInternal) public static func from(abi: ComPtr<__x_ABI_CWindows_CFoundation_CIUriRuntimeClass>?) -> Uri? { guard let abi = abi else { return nil } return .init(fromAbi: WindowsFoundation.IInspectable(abi)) } @_spi(WinRTInternal) public init(fromAbi: WindowsFoundation.IInspectable) { super.init(fromAbi) } override public func queryInterface(_ iid: WindowsFoundation.IID) -> IUnknownRef? { return super.queryInterface(iid) } private static let _IUriEscapeStatics: __ABI_Windows_Foundation.IUriEscapeStatics = try! RoGetActivationFactory(HString("Windows.Foundation.Uri")) /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.unescapecomponent) public static func unescapeComponent(_ toUnescape: String) -> String { return try! _IUriEscapeStatics.UnescapeComponentImpl(toUnescape) } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.escapecomponent) public static func escapeComponent(_ toEscape: String) -> String { return try! _IUriEscapeStatics.EscapeComponentImpl(toEscape) } private static let _IUriRuntimeClassFactory: __ABI_Windows_Foundation.IUriRuntimeClassFactory = try! RoGetActivationFactory(HString("Windows.Foundation.Uri")) public init(_ uri: String) { super.init(try! Self._IUriRuntimeClassFactory.CreateUriImpl(uri)) } public init(_ baseUri: String, _ relativeUri: String) { super.init(try! Self._IUriRuntimeClassFactory.CreateWithRelativeUriImpl(baseUri, relativeUri)) } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.equals) public func equals(_ pUri: Uri!) throws -> Bool { try _default.EqualsImpl(pUri) } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.combineuri) public func combineUri(_ relativeUri: String) throws -> Uri! { try _default.CombineUriImpl(relativeUri) } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.absoluteuri) public var absoluteUri : String { get { try! _default.get_AbsoluteUriImpl() } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.displayuri) public var displayUri : String { get { try! _default.get_DisplayUriImpl() } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.domain) public var domain : String { get { try! _default.get_DomainImpl() } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.extension) public var `extension` : String { get { try! _default.get_ExtensionImpl() } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.fragment) public var fragment : String { get { try! _default.get_FragmentImpl() } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.host) public var host : String { get { try! _default.get_HostImpl() } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.password) public var password : String { get { try! _default.get_PasswordImpl() } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.path) public var path : String { get { try! _default.get_PathImpl() } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.port) public var port : Int32 { get { try! _default.get_PortImpl() } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.query) public var query : String { get { try! _default.get_QueryImpl() } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.queryparsed) public var queryParsed : WwwFormUrlDecoder! { get { try! _default.get_QueryParsedImpl() } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.rawuri) public var rawUri : String { get { try! _default.get_RawUriImpl() } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.schemename) public var schemeName : String { get { try! _default.get_SchemeNameImpl() } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.suspicious) public var suspicious : Bool { get { try! _default.get_SuspiciousImpl() } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.username) public var userName : String { get { try! _default.get_UserNameImpl() } } private lazy var _IUriRuntimeClassWithAbsoluteCanonicalUri: __ABI_Windows_Foundation.IUriRuntimeClassWithAbsoluteCanonicalUri! = getInterfaceForCaching() /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.absolutecanonicaluri) public var absoluteCanonicalUri : String { get { try! _IUriRuntimeClassWithAbsoluteCanonicalUri.get_AbsoluteCanonicalUriImpl() } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.displayiri) public var displayIri : String { get { try! _IUriRuntimeClassWithAbsoluteCanonicalUri.get_DisplayIriImpl() } } private lazy var _IStringable: __ABI_Windows_Foundation.IStringable! = getInterfaceForCaching() /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.uri.tostring) public func toString() throws -> String { try _IStringable.ToStringImpl() } deinit { _default = nil _IUriRuntimeClassWithAbsoluteCanonicalUri = nil _IStringable = nil } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.wwwformurldecoder) public final class WwwFormUrlDecoder : WinRTClass, IIterable, IVectorView { public typealias T = AnyIWwwFormUrlDecoderEntry? private typealias SwiftABI = __ABI_Windows_Foundation.IWwwFormUrlDecoderRuntimeClass private typealias CABI = __x_ABI_CWindows_CFoundation_CIWwwFormUrlDecoderRuntimeClass private lazy var _default: SwiftABI! = getInterfaceForCaching() @_spi(WinRTInternal) override public func _getABI() -> UnsafeMutablePointer? { if T.self == CABI.self { return RawPointer(_default) } return super._getABI() } @_spi(WinRTInternal) public static func from(abi: ComPtr<__x_ABI_CWindows_CFoundation_CIWwwFormUrlDecoderRuntimeClass>?) -> WwwFormUrlDecoder? { guard let abi = abi else { return nil } return .init(fromAbi: WindowsFoundation.IInspectable(abi)) } @_spi(WinRTInternal) public init(fromAbi: WindowsFoundation.IInspectable) { super.init(fromAbi) } override public func queryInterface(_ iid: WindowsFoundation.IID) -> IUnknownRef? { return super.queryInterface(iid) } private static let _IWwwFormUrlDecoderRuntimeClassFactory: __ABI_Windows_Foundation.IWwwFormUrlDecoderRuntimeClassFactory = try! RoGetActivationFactory(HString("Windows.Foundation.WwwFormUrlDecoder")) public init(_ query: String) { super.init(try! Self._IWwwFormUrlDecoderRuntimeClassFactory.CreateWwwFormUrlDecoderImpl(query)) } private lazy var _IIterable: IIterableIWwwFormUrlDecoderEntry! = getInterfaceForCaching() /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.wwwformurldecoder.first) public func first() -> AnyIIterator? { try! _IIterable.FirstImpl() } // MARK: Collection public typealias Element = T public var startIndex: Int { 0 } public var endIndex: Int { Int(size) } public func index(after i: Int) -> Int { i+1 } public func index(of: Element) -> Int? { var index: UInt32 = 0 let result = indexOf(of, &index) guard result else { return nil } return Int(index) } public var count: Int { Int(size) } public subscript(position: Int) -> Element { get { getAt(UInt32(position)) } } // MARK: WinRT private lazy var _IVectorView: IVectorViewIWwwFormUrlDecoderEntry! = getInterfaceForCaching() /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.wwwformurldecoder.getat) public func getAt(_ index: UInt32) -> AnyIWwwFormUrlDecoderEntry? { try! _IVectorView.GetAtImpl(index) } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.wwwformurldecoder.indexof) public func indexOf(_ value: AnyIWwwFormUrlDecoderEntry?, _ index: inout UInt32) -> Bool { try! _IVectorView.IndexOfImpl(value, &index) } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.wwwformurldecoder.size) public var size : UInt32 { get { try! _IVectorView.get_SizeImpl() } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.wwwformurldecoder.getfirstvaluebyname) public func getFirstValueByName(_ name: String) throws -> String { try _default.GetFirstValueByNameImpl(name) } deinit { _IIterable = nil _IVectorView = nil _default = nil } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.wwwformurldecoderentry) public final class WwwFormUrlDecoderEntry : WinRTClass, IWwwFormUrlDecoderEntry { private typealias SwiftABI = __ABI_Windows_Foundation.IWwwFormUrlDecoderEntry private typealias CABI = __x_ABI_CWindows_CFoundation_CIWwwFormUrlDecoderEntry private lazy var _default: SwiftABI! = getInterfaceForCaching() @_spi(WinRTInternal) override public func _getABI() -> UnsafeMutablePointer? { if T.self == CABI.self { return RawPointer(_default) } return super._getABI() } @_spi(WinRTInternal) public static func from(abi: ComPtr<__x_ABI_CWindows_CFoundation_CIWwwFormUrlDecoderEntry>?) -> WwwFormUrlDecoderEntry? { guard let abi = abi else { return nil } return .init(fromAbi: WindowsFoundation.IInspectable(abi)) } @_spi(WinRTInternal) public init(fromAbi: WindowsFoundation.IInspectable) { super.init(fromAbi) } override public func queryInterface(_ iid: WindowsFoundation.IID) -> IUnknownRef? { return super.queryInterface(iid) } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.wwwformurldecoderentry.name) public var name : String { get { try! _default.get_NameImpl() } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.wwwformurldecoderentry.value) public var value : String { get { try! _default.get_ValueImpl() } } deinit { _default = nil } } public typealias AsyncActionCompletedHandler = (AnyIAsyncAction?, AsyncStatus) -> () public typealias AsyncActionProgressHandler = (AnyIAsyncActionWithProgress?, TProgress) -> () public typealias AsyncActionWithProgressCompletedHandler = (AnyIAsyncActionWithProgress?, AsyncStatus) -> () public typealias AsyncOperationCompletedHandler = (AnyIAsyncOperation?, AsyncStatus) -> () public typealias AsyncOperationProgressHandler = (AnyIAsyncOperationWithProgress?, TProgress) -> () public typealias AsyncOperationWithProgressCompletedHandler = (AnyIAsyncOperationWithProgress?, AsyncStatus) -> () public typealias DeferralCompletedHandler = () -> () public typealias EventHandler = (Any?, T) -> () public typealias TypedEventHandler = (TSender, TResult) -> () /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.datetime) public struct DateTime: Hashable, Codable { /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.datetime.universaltime) public var universalTime: Int64 = 0 public init() {} public init(universalTime: Int64) { self.universalTime = universalTime } public static func from(abi: __x_ABI_CWindows_CFoundation_CDateTime) -> DateTime { .init(universalTime: abi.UniversalTime) } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.point) public struct Point: Hashable, Codable { /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.point.x) public var x: Float = 0.0 /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.point.y) public var y: Float = 0.0 public init() {} public init(x: Float, y: Float) { self.x = x self.y = y } public static func from(abi: __x_ABI_CWindows_CFoundation_CPoint) -> Point { .init(x: abi.X, y: abi.Y) } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.rect) public struct Rect: Hashable, Codable { /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.rect.x) public var x: Float = 0.0 /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.rect.y) public var y: Float = 0.0 /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.rect.width) public var width: Float = 0.0 /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.rect.height) public var height: Float = 0.0 public init() {} public init(x: Float, y: Float, width: Float, height: Float) { self.x = x self.y = y self.width = width self.height = height } public static func from(abi: __x_ABI_CWindows_CFoundation_CRect) -> Rect { .init(x: abi.X, y: abi.Y, width: abi.Width, height: abi.Height) } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.size) public struct Size: Hashable, Codable { /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.size.width) public var width: Float = 0.0 /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.size.height) public var height: Float = 0.0 public init() {} public init(width: Float, height: Float) { self.width = width self.height = height } public static func from(abi: __x_ABI_CWindows_CFoundation_CSize) -> Size { .init(width: abi.Width, height: abi.Height) } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.timespan) public struct TimeSpan: Hashable, Codable { /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.timespan.duration) public var duration: Int64 = 0 public init() {} public init(duration: Int64) { self.duration = duration } public static func from(abi: __x_ABI_CWindows_CFoundation_CTimeSpan) -> TimeSpan { .init(duration: abi.Duration) } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncaction) public protocol IAsyncAction : IAsyncInfo { /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncaction.getresults) func getResults() throws /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncaction.completed) var completed: WindowsFoundation.AsyncActionCompletedHandler! { get set } } extension IAsyncAction { public func queryInterface(_ iid: WindowsFoundation.IID) -> IUnknownRef? { switch iid { case __ABI_Windows_Foundation.IAsyncActionWrapper.IID: let wrapper = __ABI_Windows_Foundation.IAsyncActionWrapper(self) return wrapper!.queryInterface(iid) case __ABI_Windows_Foundation.IAsyncInfoWrapper.IID: let wrapper = __ABI_Windows_Foundation.IAsyncInfoWrapper(self) return wrapper!.queryInterface(iid) default: return nil } } } public typealias AnyIAsyncAction = any IAsyncAction public extension IAsyncAction { func get() async throws { if status == .started { let event = WaitableEvent() completed = { _, _ in Task { await event.signal() } } await event.wait() } return try getResults() } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncactionwithprogress-1) public protocol IAsyncActionWithProgress : IAsyncInfo { associatedtype TProgress /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncactionwithprogress-1.getresults) func getResults() throws /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncactionwithprogress-1.progress) var progress: WindowsFoundation.AsyncActionProgressHandler? { get set } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncactionwithprogress-1.completed) var completed: WindowsFoundation.AsyncActionWithProgressCompletedHandler? { get set } } public typealias AnyIAsyncActionWithProgress = any IAsyncActionWithProgress /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncinfo) public protocol IAsyncInfo : WinRTInterface { /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncinfo.cancel) func cancel() throws /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncinfo.close) func close() throws /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncinfo.errorcode) var errorCode: HRESULT { get } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncinfo.id) var id: UInt32 { get } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncinfo.status) var status: WindowsFoundation.AsyncStatus { get } } extension IAsyncInfo { public func queryInterface(_ iid: WindowsFoundation.IID) -> IUnknownRef? { switch iid { case __ABI_Windows_Foundation.IAsyncInfoWrapper.IID: let wrapper = __ABI_Windows_Foundation.IAsyncInfoWrapper(self) return wrapper!.queryInterface(iid) default: return nil } } } public typealias AnyIAsyncInfo = any IAsyncInfo /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncoperationwithprogress-2) public protocol IAsyncOperationWithProgress : IAsyncInfo { associatedtype TResult associatedtype TProgress /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncoperationwithprogress-2.getresults) func getResults() throws -> TResult /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncoperationwithprogress-2.progress) var progress: WindowsFoundation.AsyncOperationProgressHandler? { get set } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncoperationwithprogress-2.completed) var completed: WindowsFoundation.AsyncOperationWithProgressCompletedHandler? { get set } } public typealias AnyIAsyncOperationWithProgress = any IAsyncOperationWithProgress public extension IAsyncOperationWithProgress { func get() async throws -> TResult { if status == .started { let event = WaitableEvent() completed = { _, _ in Task { await event.signal() } } await event.wait() } return try getResults() } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncoperation-1) public protocol IAsyncOperation : IAsyncInfo { associatedtype TResult /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncoperation-1.getresults) func getResults() throws -> TResult /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iasyncoperation-1.completed) var completed: WindowsFoundation.AsyncOperationCompletedHandler? { get set } } public typealias AnyIAsyncOperation = any IAsyncOperation public extension IAsyncOperation { func get() async throws -> TResult { if status == .started { let event = WaitableEvent() completed = { _, _ in Task { await event.signal() } } await event.wait() } return try getResults() } } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iclosable) public protocol IClosable : WinRTInterface { /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iclosable.close) func close() throws } extension IClosable { public func queryInterface(_ iid: WindowsFoundation.IID) -> IUnknownRef? { switch iid { case __ABI_Windows_Foundation.IClosableWrapper.IID: let wrapper = __ABI_Windows_Foundation.IClosableWrapper(self) return wrapper!.queryInterface(iid) default: return nil } } } public typealias AnyIClosable = any IClosable /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.igetactivationfactory) public protocol IGetActivationFactory : WinRTInterface { /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.igetactivationfactory.getactivationfactory) func getActivationFactory(_ activatableClassId: String) throws -> Any! } extension IGetActivationFactory { public func queryInterface(_ iid: WindowsFoundation.IID) -> IUnknownRef? { switch iid { case __ABI_Windows_Foundation.IGetActivationFactoryWrapper.IID: let wrapper = __ABI_Windows_Foundation.IGetActivationFactoryWrapper(self) return wrapper!.queryInterface(iid) default: return nil } } } public typealias AnyIGetActivationFactory = any IGetActivationFactory /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.imemorybuffer) public protocol IMemoryBuffer : IClosable { /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.imemorybuffer.createreference) func createReference() throws -> WindowsFoundation.AnyIMemoryBufferReference! } extension IMemoryBuffer { public func queryInterface(_ iid: WindowsFoundation.IID) -> IUnknownRef? { switch iid { case __ABI_Windows_Foundation.IMemoryBufferWrapper.IID: let wrapper = __ABI_Windows_Foundation.IMemoryBufferWrapper(self) return wrapper!.queryInterface(iid) case __ABI_Windows_Foundation.IClosableWrapper.IID: let wrapper = __ABI_Windows_Foundation.IClosableWrapper(self) return wrapper!.queryInterface(iid) default: return nil } } } public typealias AnyIMemoryBuffer = any IMemoryBuffer /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.imemorybufferreference) public protocol IMemoryBufferReference : IClosable, IMemoryBufferByteAccess { /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.imemorybufferreference.capacity) var capacity: UInt32 { get } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.imemorybufferreference.closed) var closed: Event> { get } } extension IMemoryBufferReference { public func queryInterface(_ iid: WindowsFoundation.IID) -> IUnknownRef? { switch iid { case __ABI_Windows_Foundation.IMemoryBufferReferenceWrapper.IID: let wrapper = __ABI_Windows_Foundation.IMemoryBufferReferenceWrapper(self) return wrapper!.queryInterface(iid) case __ABI_Windows_Foundation.IClosableWrapper.IID: let wrapper = __ABI_Windows_Foundation.IClosableWrapper(self) return wrapper!.queryInterface(iid) case __ABI_.IMemoryBufferByteAccessWrapper.IID: let wrapper = __ABI_.IMemoryBufferByteAccessWrapper(self) return wrapper!.queryInterface(iid) default: return nil } } } extension IMemoryBufferReference { public var data: Data { guard let buffer = try? buffer, let ptr = buffer.baseAddress else { return Data() } return Data(bytesNoCopy: ptr, count: buffer.count, deallocator: .none) } } public typealias AnyIMemoryBufferReference = any IMemoryBufferReference /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue) public protocol IPropertyValue : WinRTInterface { /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getuint8) func getUInt8() throws -> UInt8 /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getint16) func getInt16() throws -> Int16 /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getuint16) func getUInt16() throws -> UInt16 /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getint32) func getInt32() throws -> Int32 /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getuint32) func getUInt32() throws -> UInt32 /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getint64) func getInt64() throws -> Int64 /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getuint64) func getUInt64() throws -> UInt64 /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getsingle) func getSingle() throws -> Float /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getdouble) func getDouble() throws -> Double /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getchar16) func getChar16() throws -> Character /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getboolean) func getBoolean() throws -> Bool /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getstring) func getString() throws -> String /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getguid) func getGuid() throws -> Foundation.UUID /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getdatetime) func getDateTime() throws -> WindowsFoundation.DateTime /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.gettimespan) func getTimeSpan() throws -> WindowsFoundation.TimeSpan /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getpoint) func getPoint() throws -> WindowsFoundation.Point /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getsize) func getSize() throws -> WindowsFoundation.Size /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getrect) func getRect() throws -> WindowsFoundation.Rect /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.isnumericscalar) var isNumericScalar: Bool { get } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.type) var type: WindowsFoundation.PropertyType { get } } public typealias AnyIPropertyValue = any IPropertyValue /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ireferencearray-1) public protocol IReferenceArray : IPropertyValue { associatedtype T } public typealias AnyIReferenceArray = any IReferenceArray /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ireference-1) public protocol IReference : IPropertyValue { associatedtype T /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ireference-1.value) var value: T { get } } public typealias AnyIReference = any IReference /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.istringable) public protocol IStringable : WinRTInterface { /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.istringable.tostring) func toString() throws -> String } extension IStringable { public func queryInterface(_ iid: WindowsFoundation.IID) -> IUnknownRef? { switch iid { case __ABI_Windows_Foundation.IStringableWrapper.IID: let wrapper = __ABI_Windows_Foundation.IStringableWrapper(self) return wrapper!.queryInterface(iid) default: return nil } } } public typealias AnyIStringable = any IStringable /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iwwwformurldecoderentry) public protocol IWwwFormUrlDecoderEntry : WinRTInterface { /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iwwwformurldecoderentry.name) var name: String { get } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.iwwwformurldecoderentry.value) var value: String { get } } extension IWwwFormUrlDecoderEntry { public func queryInterface(_ iid: WindowsFoundation.IID) -> IUnknownRef? { switch iid { case __ABI_Windows_Foundation.IWwwFormUrlDecoderEntryWrapper.IID: let wrapper = __ABI_Windows_Foundation.IWwwFormUrlDecoderEntryWrapper(self) return wrapper!.queryInterface(iid) default: return nil } } } public typealias AnyIWwwFormUrlDecoderEntry = any IWwwFormUrlDecoderEntry extension WindowsFoundation.AsyncStatus { public static var canceled : WindowsFoundation.AsyncStatus { __x_ABI_CWindows_CFoundation_CAsyncStatus_Canceled } public static var completed : WindowsFoundation.AsyncStatus { __x_ABI_CWindows_CFoundation_CAsyncStatus_Completed } public static var error : WindowsFoundation.AsyncStatus { __x_ABI_CWindows_CFoundation_CAsyncStatus_Error } public static var started : WindowsFoundation.AsyncStatus { __x_ABI_CWindows_CFoundation_CAsyncStatus_Started } } extension WindowsFoundation.AsyncStatus: @retroactive Hashable, @retroactive Codable {} extension WindowsFoundation.PropertyType { public static var empty : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_Empty } public static var uint8 : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_UInt8 } public static var int16 : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_Int16 } public static var uint16 : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_UInt16 } public static var int32 : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_Int32 } public static var uint32 : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_UInt32 } public static var int64 : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_Int64 } public static var uint64 : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_UInt64 } public static var single : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_Single } public static var double : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_Double } public static var char16 : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_Char16 } public static var boolean : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_Boolean } public static var string : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_String } public static var inspectable : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_Inspectable } public static var dateTime : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_DateTime } public static var timeSpan : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_TimeSpan } public static var guid : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_Guid } public static var point : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_Point } public static var size : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_Size } public static var rect : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_Rect } public static var otherType : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_OtherType } public static var uint8Array : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_UInt8Array } public static var int16Array : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_Int16Array } public static var uint16Array : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_UInt16Array } public static var int32Array : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_Int32Array } public static var uint32Array : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_UInt32Array } public static var int64Array : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_Int64Array } public static var uint64Array : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_UInt64Array } public static var singleArray : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_SingleArray } public static var doubleArray : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_DoubleArray } public static var char16Array : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_Char16Array } public static var booleanArray : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_BooleanArray } public static var stringArray : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_StringArray } public static var inspectableArray : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_InspectableArray } public static var dateTimeArray : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_DateTimeArray } public static var timeSpanArray : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_TimeSpanArray } public static var guidArray : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_GuidArray } public static var pointArray : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_PointArray } public static var sizeArray : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_SizeArray } public static var rectArray : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_RectArray } public static var otherTypeArray : WindowsFoundation.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_OtherTypeArray } } extension WindowsFoundation.PropertyType: @retroactive Hashable, @retroactive Codable {}