diff --git a/swiftwinrt/abi_writer.h b/swiftwinrt/abi_writer.h index a1b781ae..4d54aee2 100644 --- a/swiftwinrt/abi_writer.h +++ b/swiftwinrt/abi_writer.h @@ -102,9 +102,8 @@ namespace swiftwinrt // on the swift side static std::set removed_types = { "Windows.Foundation.Collections.CollectionChange", - "Windows.Foundation.Collections.IVectorChangedEventArgs" - }; - + "Windows.Foundation.Collections.IVectorChangedEventArgs", + }; static bool should_write(metadata_type const& type) { return !removed_types.contains(type.swift_full_name()); @@ -115,7 +114,6 @@ namespace swiftwinrt // Forced dependencies w.write(R"^-^(// Header files for imported files #include "inspectable.h" -#include "AsyncInfo.h" #include "EventToken.h" #include "windowscontracts.h" )^-^"); diff --git a/swiftwinrt/code_writers.h b/swiftwinrt/code_writers.h index 0c6c25f8..72047f17 100644 --- a/swiftwinrt/code_writers.h +++ b/swiftwinrt/code_writers.h @@ -7,10 +7,8 @@ namespace swiftwinrt { static void write_enum_def(writer& w, enum_type const& type) { - // Async status is defined in it's own header with a nice name of AsyncStatus. // Metadata attributes don't have backing code - if (get_full_type_name(type) == "Windows.Foundation.AsyncStatus" || - type.swift_logical_namespace() == "Windows.Foundation.Metadata" || !can_write(w, type)) + if (type.swift_logical_namespace() == "Windows.Foundation.Metadata" || !can_write(w, type)) { return; } @@ -19,8 +17,7 @@ namespace swiftwinrt static void write_enum_extension(writer& w, enum_type const& type) { - if (get_full_type_name(type) == "Windows.Foundation.AsyncStatus" || - type.swift_logical_namespace() == "Windows.Foundation.Metadata" || !can_write(w, type)) + if (type.swift_logical_namespace() == "Windows.Foundation.Metadata" || !can_write(w, type)) { return; } @@ -1184,7 +1181,7 @@ public static func makeAbi() -> CABI { auto implements = w.write_temp("%", bind_each([&](writer& w, std::pair const& iface) { s(); write_swift_type_identifier(w, *iface.second.type); - }, interfaces)); + }, interfaces)); // check the type name is a collection so we don't get any potential unknown or unwanted // typenames like IMapChangedEventArgs diff --git a/swiftwinrt/code_writers/can_write.h b/swiftwinrt/code_writers/can_write.h index 77fd3178..5af6e94b 100644 --- a/swiftwinrt/code_writers/can_write.h +++ b/swiftwinrt/code_writers/can_write.h @@ -9,11 +9,6 @@ namespace swiftwinrt { return can_write(w, *typed); } - if (auto mapped = dynamic_cast(type)) - { - // TODO: https://linear.app/the-browser-company/issue/WIN-103/swiftwinrt-write-iasyncinfo - if (mapped->type().TypeName() == "IAsyncInfo") return false; - } return true; } diff --git a/swiftwinrt/file_writers.h b/swiftwinrt/file_writers.h index cde77822..31a683bd 100644 --- a/swiftwinrt/file_writers.h +++ b/swiftwinrt/file_writers.h @@ -131,6 +131,14 @@ namespace swiftwinrt auto package_template = find_resource(RESOURCE_TYPE_OTHER_FILE_STR, RESOURCE_NAME_CWINRT_PACKAGE_SWIFT_STR); fill_template_placeholders_to_file(package_template, dir_path / "Package.swift"); } + + auto support_files = get_named_resources_of_type( + GetModuleHandle(nullptr), RESOURCE_TYPE_C_INCLUDE_FILE_STR, /* make_lowercase: */ true); + for (const auto& support_file : support_files) + { + auto path = dir_path / "include" / (support_file.first + ".h"); + fill_template_placeholders_to_file(support_file.second, path); + } } static void write_namespace_abi(std::string_view const& ns, type_cache const& members, include_only_used_filter const& filter) diff --git a/swiftwinrt/helpers.h b/swiftwinrt/helpers.h index eab54783..89a25bcb 100644 --- a/swiftwinrt/helpers.h +++ b/swiftwinrt/helpers.h @@ -809,7 +809,6 @@ namespace swiftwinrt } if (mapped->swift_type_name() == "EventRegistrationToken") return param_category::struct_type; if (mapped->swift_type_name() == "IAsyncInfo") return param_category::object_type; - if (mapped->swift_type_name() == "AsyncStatus") return param_category::enum_type; if (mapped->swift_type_name() == "HResult") return param_category::fundamental_type; assert(false); // unexpected mapped type } diff --git a/swiftwinrt/main.cpp b/swiftwinrt/main.cpp index d0aea539..87ceed5d 100644 --- a/swiftwinrt/main.cpp +++ b/swiftwinrt/main.cpp @@ -376,6 +376,7 @@ Where is one or more of: for (auto& ns : namespaces) { module_group.add([&, &ns = ns] + { auto types = mdCache.compile_namespaces({ ns }, mf); write_namespace_abi (ns, types, mf); diff --git a/swiftwinrt/metadata_cache.cpp b/swiftwinrt/metadata_cache.cpp index df1d082c..c40a48d4 100644 --- a/swiftwinrt/metadata_cache.cpp +++ b/swiftwinrt/metadata_cache.cpp @@ -60,17 +60,6 @@ void metadata_cache::process_namespace_types( target.enums.reserve(members.enums.size()); for (auto const& e : members.enums) { - // 'AsyncStatus' is an enum - if (isFoundationNamespace) - { - if (auto ptr = mapped_type::from_typedef(e)) - { - [[maybe_unused]] auto [itr, added] = table.emplace(e.TypeName(), *ptr); - XLANG_ASSERT(added); - continue; - } - } - target.enums.emplace_back(e); [[maybe_unused]] auto [itr, added] = table.emplace(e.TypeName(), target.enums.back()); XLANG_ASSERT(added); @@ -113,16 +102,6 @@ void metadata_cache::process_namespace_types( target.interfaces.reserve(members.interfaces.size()); for (auto const& i : members.interfaces) { - // 'IAsyncInfo' is an interface - if (isFoundationNamespace) - { - if (auto ptr = mapped_type::from_typedef(i)) - { - [[maybe_unused]] auto [itr, added] = table.emplace(i.TypeName(), *ptr); - XLANG_ASSERT(added); - continue; - } - } target.interfaces.emplace_back(i); [[maybe_unused]] auto [itr, added] = table.emplace(i.TypeName(), target.interfaces.back()); XLANG_ASSERT(added); @@ -473,11 +452,7 @@ void metadata_cache::process_interface_dependencies(init_state& state, interface for (auto const& interfaces : get_interfaces(state, type.type())) { - // TODO: https://linear.app/the-browser-company/issue/WIN-103/swiftwinrt-write-iasyncinfo - if (!interfaces.first.ends_with("IAsyncInfo")) - { - type.required_interfaces.push_back(interfaces); - } + type.required_interfaces.push_back(interfaces); } for (auto const& method : type.type().MethodList()) diff --git a/swiftwinrt/metadata_filter.cpp b/swiftwinrt/metadata_filter.cpp index d645bdef..3bdf3db2 100644 --- a/swiftwinrt/metadata_filter.cpp +++ b/swiftwinrt/metadata_filter.cpp @@ -34,7 +34,7 @@ namespace swiftwinrt inline void add_interface_dependencies_to_queue(processing_queue& to_process, interface_type const& type) { - for (auto& member : type.functions) + for (const auto& member : type.functions) { if (member.return_type) { @@ -45,7 +45,15 @@ namespace swiftwinrt to_process.emplace(param.type); } } + for (const auto& prop : type.properties) + { + to_process.emplace(prop.type); + } + for (const auto& event : type.events) + { + to_process.emplace(event.type); + } for (auto& [_, required] : type.required_interfaces) { to_process.emplace(required.type); diff --git a/swiftwinrt/resources.h b/swiftwinrt/resources.h index 4e7a3301..077d824e 100644 --- a/swiftwinrt/resources.h +++ b/swiftwinrt/resources.h @@ -4,6 +4,9 @@ #define RESOURCE_TYPE_SWIFT_SUPPORT_FILE SWIFT_SUPPORT_FILE #define RESOURCE_TYPE_SWIFT_SUPPORT_FILE_STR "SWIFT_SUPPORT_FILE" +#define RESOURCE_TYPE_C_INCLUDE_FILE C_HEADER_FILE +#define RESOURCE_TYPE_C_INCLUDE_FILE_STR "C_HEADER_FILE" + #define RESOURCE_TYPE_OTHER_FILE OTHER_FILE #define RESOURCE_TYPE_OTHER_FILE_STR "OTHER_FILE" diff --git a/swiftwinrt/resources.rc b/swiftwinrt/resources.rc index 2b68ce66..85ce2b94 100644 --- a/swiftwinrt/resources.rc +++ b/swiftwinrt/resources.rc @@ -32,4 +32,4 @@ EventSource RESOURCE_TYPE_SWIFT_SUPPORT_FILE "Resources\\Support\\Events\\EventS WinRTDelegate RESOURCE_TYPE_SWIFT_SUPPORT_FILE "Resources\\Support\\Events\\WinRTDelegate.swift" RESOURCE_NAME_CWINRT_SHIM_C RESOURCE_TYPE_OTHER_FILE "Resources\\CWinRT\\shim.c" -RESOURCE_NAME_CWINRT_PACKAGE_SWIFT RESOURCE_TYPE_OTHER_FILE "Resources\\CWinRT\\Package.swift" \ No newline at end of file +RESOURCE_NAME_CWINRT_PACKAGE_SWIFT RESOURCE_TYPE_OTHER_FILE "Resources\\CWinRT\\Package.swift" diff --git a/tests/test_component/Sources/CWinRT/include/test_component.Delegates.h b/tests/test_component/Sources/CWinRT/include/test_component.Delegates.h index 871cf690..b4b8a709 100644 --- a/tests/test_component/Sources/CWinRT/include/test_component.Delegates.h +++ b/tests/test_component/Sources/CWinRT/include/test_component.Delegates.h @@ -3,7 +3,6 @@ #pragma once // Header files for imported files #include "inspectable.h" -#include "AsyncInfo.h" #include "EventToken.h" #include "windowscontracts.h" #include "Windows.Foundation.h" diff --git a/tests/test_component/Sources/CWinRT/include/test_component.h b/tests/test_component/Sources/CWinRT/include/test_component.h index bf1b124a..69993742 100644 --- a/tests/test_component/Sources/CWinRT/include/test_component.h +++ b/tests/test_component/Sources/CWinRT/include/test_component.h @@ -3,7 +3,6 @@ #pragma once // Header files for imported files #include "inspectable.h" -#include "AsyncInfo.h" #include "EventToken.h" #include "windowscontracts.h" #include "Windows.Foundation.h" diff --git a/tests/test_component/Sources/test_component/Windows.Foundation+ABI.swift b/tests/test_component/Sources/test_component/Windows.Foundation+ABI.swift index 8d7a1d58..e30fa06a 100644 --- a/tests/test_component/Sources/test_component/Windows.Foundation+ABI.swift +++ b/tests/test_component/Sources/test_component/Windows.Foundation+ABI.swift @@ -5,6 +5,10 @@ private var IID___x_ABI_CWindows_CFoundation_CIAsyncAction: IID { IID(Data1: 0x5A648006, Data2: 0x843A, Data3: 0x4DA9, Data4: ( 0x86,0x5B,0x9D,0x26,0xE5,0xDF,0xAD,0x7B ))// 5A648006-843A-4DA9-865B-9D26E5DFAD7B } +private var IID___x_ABI_CWindows_CFoundation_CIAsyncInfo: IID { + IID(Data1: 0x00000036, Data2: 0x0000, Data3: 0x0000, Data4: ( 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 ))// 00000036-0000-0000-C000-000000000046 +} + private var IID___x_ABI_CWindows_CFoundation_CIClosable: IID { IID(Data1: 0x30D5A829, Data2: 0x7FA4, Data3: 0x4026, Data4: ( 0x83,0xBB,0xD7,0x5B,0xAE,0x4E,0xA9,0x9E ))// 30D5A829-7FA4-4026-83BB-D75BAE4EA99E } @@ -79,11 +83,12 @@ public enum __ABI_Windows_Foundation { GetIids: { let size = MemoryLayout.size - let iids = CoTaskMemAlloc(UInt64(size) * 3).assumingMemoryBound(to: IID.self) + let iids = CoTaskMemAlloc(UInt64(size) * 4).assumingMemoryBound(to: IID.self) iids[0] = IUnknown.IID iids[1] = IInspectable.IID iids[2] = __ABI_Windows_Foundation.IAsyncActionWrapper.IID - $1!.pointee = 3 + iids[3] = __ABI_Windows_Foundation.IAsyncInfoWrapper.IID + $1!.pointee = 4 $2!.pointee = iids return S_OK }, @@ -126,6 +131,140 @@ public enum __ABI_Windows_Foundation { ) public typealias IAsyncActionWrapper = InterfaceWrapperBase<__IMPL_Windows_Foundation.IAsyncActionImpl> + open class IAsyncInfo: test_component.IInspectable { + override public class var IID: IID { IID___x_ABI_CWindows_CFoundation_CIAsyncInfo } + + open func get_IdImpl() throws -> UINT32 { + var result: UINT32 = 0 + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIAsyncInfo.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.get_Id(pThis, &result)) + } + return result + } + + open func get_StatusImpl() throws -> __x_ABI_CWindows_CFoundation_CAsyncStatus { + var result: __x_ABI_CWindows_CFoundation_CAsyncStatus = .init(0) + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIAsyncInfo.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.get_Status(pThis, &result)) + } + return result + } + + open func get_ErrorCodeImpl() throws -> HRESULT { + var result: HRESULT = 0 + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIAsyncInfo.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.get_ErrorCode(pThis, &result)) + } + return result + } + + open func CancelImpl() throws { + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIAsyncInfo.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.Cancel(pThis)) + } + } + + open func CloseImpl() throws { + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIAsyncInfo.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.Close(pThis)) + } + } + + } + + internal static var IAsyncInfoVTable: __x_ABI_CWindows_CFoundation_CIAsyncInfoVtbl = .init( + QueryInterface: { + guard let pUnk = $0, let riid = $1, let ppvObject = $2 else { return E_INVALIDARG } + ppvObject.pointee = nil + + switch riid.pointee { + case IUnknown.IID, IInspectable.IID, ISwiftImplemented.IID, IAgileObject.IID, IAsyncInfoWrapper.IID: + _ = pUnk.pointee.lpVtbl.pointee.AddRef(pUnk) + ppvObject.pointee = UnsafeMutableRawPointer(pUnk) + return S_OK + default: + guard let instance = IAsyncInfoWrapper.tryUnwrapFrom(raw: pUnk), + let iUnknownRef = instance.queryInterface(riid.pointee) else { return failWith(err: E_NOINTERFACE )} + ppvObject.pointee = UnsafeMutableRawPointer(iUnknownRef.ref) + return S_OK + + } + }, + + AddRef: { + guard let wrapper = IAsyncInfoWrapper.fromRaw($0) else { return 1 } + _ = wrapper.retain() + return ULONG(_getRetainCount(wrapper.takeUnretainedValue())) + }, + + Release: { + guard let wrapper = IAsyncInfoWrapper.fromRaw($0) else { return 1 } + return ULONG(_getRetainCount(wrapper.takeRetainedValue())) + }, + + GetIids: { + let size = MemoryLayout.size + let iids = CoTaskMemAlloc(UInt64(size) * 3).assumingMemoryBound(to: IID.self) + iids[0] = IUnknown.IID + iids[1] = IInspectable.IID + iids[2] = __ABI_Windows_Foundation.IAsyncInfoWrapper.IID + $1!.pointee = 3 + $2!.pointee = iids + return S_OK + }, + + GetRuntimeClassName: { + _ = $0 + let hstring = try! HString("Windows.Foundation.IAsyncInfo").detach() + $1!.pointee = hstring + return S_OK + }, + + GetTrustLevel: { + _ = $0 + $1!.pointee = TrustLevel(rawValue: 0) + return S_OK + }, + + get_Id: { + guard let __unwrapped__instance = IAsyncInfoWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let result = __unwrapped__instance.id + $1?.initialize(to: result) + return S_OK + }, + + get_Status: { + guard let __unwrapped__instance = IAsyncInfoWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let result = __unwrapped__instance.status + $1?.initialize(to: result) + return S_OK + }, + + get_ErrorCode: { + guard let __unwrapped__instance = IAsyncInfoWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let result = __unwrapped__instance.errorCode + $1?.initialize(to: result) + return S_OK + }, + + Cancel: { + do { + guard let __unwrapped__instance = IAsyncInfoWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + try __unwrapped__instance.cancel() + return S_OK + } catch { return failWith(err: E_FAIL) } + }, + + Close: { + do { + guard let __unwrapped__instance = IAsyncInfoWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + try __unwrapped__instance.close() + return S_OK + } catch { return failWith(err: E_FAIL) } + } + ) + + public typealias IAsyncInfoWrapper = InterfaceWrapperBase<__IMPL_Windows_Foundation.IAsyncInfoImpl> open class IClosable: test_component.IInspectable { override public class var IID: IID { IID___x_ABI_CWindows_CFoundation_CIClosable } @@ -761,7 +900,7 @@ extension __ABI_Windows_Foundation { open class AsyncActionCompletedHandler: test_component.IUnknown { override public class var IID: IID { IID___x_ABI_CWindows_CFoundation_CIAsyncActionCompletedHandler } - open func InvokeImpl(_ asyncInfo: UnsafeMutablePointer<__x_ABI_CWindows_CFoundation_CIAsyncAction>?, _ asyncStatus: AsyncStatus) throws { + open func InvokeImpl(_ asyncInfo: UnsafeMutablePointer<__x_ABI_CWindows_CFoundation_CIAsyncAction>?, _ asyncStatus: __x_ABI_CWindows_CFoundation_CAsyncStatus) throws { _ = try perform(as: __x_ABI_CWindows_CFoundation_CIAsyncActionCompletedHandler.self) { pThis in try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, asyncInfo, asyncStatus)) } @@ -800,7 +939,7 @@ extension __ABI_Windows_Foundation { Invoke: { guard let __unwrapped__instance = AsyncActionCompletedHandlerWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncAction? = __ABI_Windows_Foundation.IAsyncActionWrapper.unwrapFrom(abi: $1) - let asyncStatus: AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = $2 __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } diff --git a/tests/test_component/Sources/test_component/Windows.Foundation+Impl.swift b/tests/test_component/Sources/test_component/Windows.Foundation+Impl.swift index 8b5270d6..1a8863e9 100644 --- a/tests/test_component/Sources/test_component/Windows.Foundation+Impl.swift +++ b/tests/test_component/Sources/test_component/Windows.Foundation+Impl.swift @@ -37,6 +37,91 @@ public enum __IMPL_Windows_Foundation { } } + internal lazy var _IAsyncInfo: __ABI_Windows_Foundation.IAsyncInfo = try! _default.QueryInterface() + public func cancel() throws { + try _IAsyncInfo.CancelImpl() + } + + public func close() throws { + try _IAsyncInfo.CloseImpl() + } + + public var errorCode : HRESULT { + get { + let result = try! _IAsyncInfo.get_ErrorCodeImpl() + return result + } + + } + + public var id : UInt32 { + get { + let result = try! _IAsyncInfo.get_IdImpl() + return result + } + + } + + public var status : AsyncStatus { + get { + let result = try! _IAsyncInfo.get_StatusImpl() + return result + } + + } + + } + + public class IAsyncInfoImpl : IAsyncInfo, WinRTAbiBridge { + public typealias CABI = __x_ABI_CWindows_CFoundation_CIAsyncInfo + public typealias SwiftABI = __ABI_Windows_Foundation.IAsyncInfo + public typealias SwiftProjection = AnyIAsyncInfo + private (set) public var _default: SwiftABI + public var thisPtr: test_component.IInspectable { _default } + public static func from(abi: UnsafeMutablePointer?) -> SwiftProjection? { + guard let abi = abi else { return nil } + return IAsyncInfoImpl(abi) + } + public init(_ fromAbi: UnsafeMutablePointer) { + _default = SwiftABI(fromAbi) + } + + public static func makeAbi() -> CABI { + let vtblPtr = withUnsafeMutablePointer(to: &__ABI_Windows_Foundation.IAsyncInfoVTable) { $0 } + return .init(lpVtbl: vtblPtr) + } + public func cancel() throws { + try _default.CancelImpl() + } + + public func close() throws { + try _default.CloseImpl() + } + + public var errorCode : HRESULT { + get { + let result = try! _default.get_ErrorCodeImpl() + return result + } + + } + + public var id : UInt32 { + get { + let result = try! _default.get_IdImpl() + return result + } + + } + + public var status : AsyncStatus { + get { + let result = try! _default.get_StatusImpl() + return result + } + + } + } public class IClosableImpl : IClosable, WinRTAbiBridge { @@ -193,6 +278,18 @@ public class IAsyncAction_MakeFromAbi : MakeFromAbi { } } +@_spi(__MakeFromAbi_DoNotImport) +public class IAsyncInfo_MakeFromAbi : MakeFromAbi { + public typealias CABI = __x_ABI_CWindows_CFoundation_CIAsyncInfo + public typealias SwiftABI = __ABI_Windows_Foundation.IAsyncInfo + public typealias SwiftProjection = AnyIAsyncInfo + public static func from(abi: UnsafeMutableRawPointer?) -> SwiftProjection? { + guard let abi else { return nil } + let swiftAbi: SwiftABI = try! test_component.IInspectable(abi).QueryInterface() + return __IMPL_Windows_Foundation.IAsyncInfoImpl(RawPointer(swiftAbi)!) + } +} + @_spi(__MakeFromAbi_DoNotImport) public class IClosable_MakeFromAbi : MakeFromAbi { public typealias CABI = __x_ABI_CWindows_CFoundation_CIClosable diff --git a/tests/test_component/Sources/test_component/Windows.Foundation.swift b/tests/test_component/Sources/test_component/Windows.Foundation.swift index aad60d84..b02383bd 100644 --- a/tests/test_component/Sources/test_component/Windows.Foundation.swift +++ b/tests/test_component/Sources/test_component/Windows.Foundation.swift @@ -1,6 +1,7 @@ // WARNING: Please don't edit this file. It was generated by Swift/WinRT v0.0.1 import Ctest_component +public typealias AsyncStatus = __x_ABI_CWindows_CFoundation_CAsyncStatus public typealias PropertyType = __x_ABI_CWindows_CFoundation_CPropertyType public typealias AsyncActionCompletedHandler = (AnyIAsyncAction?, AsyncStatus) -> () public struct DateTime: Hashable, Codable { @@ -68,7 +69,7 @@ public struct TimeSpan: Hashable, Codable { } } -public protocol IAsyncAction : WinRTInterface { +public protocol IAsyncAction : IAsyncInfo { func getResults() throws var completed: test_component.AsyncActionCompletedHandler! { get set } } @@ -79,12 +80,35 @@ extension IAsyncAction { 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 protocol IAsyncInfo : WinRTInterface { + func cancel() throws + func close() throws + var errorCode: HRESULT { get } + var id: UInt32 { get } + var status: test_component.AsyncStatus { get } +} + +extension IAsyncInfo { + public func queryInterface(_ iid: 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 + public protocol IClosable : WinRTInterface { func close() throws } @@ -145,6 +169,22 @@ public typealias AnyIStringable = any IStringable public protocol IReference : IPropertyValue { var value: Any { get } } +extension test_component.AsyncStatus { + public static var canceled : test_component.AsyncStatus { + __x_ABI_CWindows_CFoundation_CAsyncStatus_Canceled + } + public static var completed : test_component.AsyncStatus { + __x_ABI_CWindows_CFoundation_CAsyncStatus_Completed + } + public static var error : test_component.AsyncStatus { + __x_ABI_CWindows_CFoundation_CAsyncStatus_Error + } + public static var started : test_component.AsyncStatus { + __x_ABI_CWindows_CFoundation_CAsyncStatus_Started + } +} +extension test_component.AsyncStatus: Hashable, Codable {} + extension test_component.PropertyType { public static var empty : test_component.PropertyType { __x_ABI_CWindows_CFoundation_CPropertyType_Empty