From a38d92ae0ae5d40574545f7163cbd24a874232ec Mon Sep 17 00:00:00 2001 From: vinocher-bc Date: Thu, 1 Aug 2024 10:14:40 -0700 Subject: [PATCH] Generate enums as structs, replace extension with .init --- swiftwinrt/code_writers.h | 54 ++- swiftwinrt/code_writers/common_writers.h | 4 + swiftwinrt/code_writers/struct_writers.cpp | 11 +- swiftwinrt/code_writers/type_writers.cpp | 2 +- swiftwinrt/file_writers.h | 1 - .../Windows.Foundation+ABI.swift | 16 +- .../Windows.Foundation.Collections+ABI.swift | 6 +- .../Windows.Foundation.Collections.swift | 30 +- .../test_component/Windows.Foundation.swift | 243 ++++++------- .../test_component/Windows.Storage+ABI.swift | 98 +++--- .../Windows.Storage.FileProperties+ABI.swift | 12 +- .../Windows.Storage.FileProperties.swift | 205 +++++------ .../Windows.Storage.Search+ABI.swift | 56 +-- .../Windows.Storage.Search.swift | 210 +++++------ .../Windows.Storage.Streams+ABI.swift | 4 +- .../Windows.Storage.Streams.swift | 48 ++- .../test_component/Windows.Storage.swift | 254 +++++++------- .../test_component/test_component+ABI.swift | 58 +-- .../test_component+Generics.swift | 130 +++---- .../test_component/test_component.swift | 331 ++++++++---------- 20 files changed, 820 insertions(+), 953 deletions(-) diff --git a/swiftwinrt/code_writers.h b/swiftwinrt/code_writers.h index be432529..e1aaf4cd 100644 --- a/swiftwinrt/code_writers.h +++ b/swiftwinrt/code_writers.h @@ -5,50 +5,28 @@ #include "metadata_cache.h" namespace swiftwinrt { - static void write_enum_def(writer& w, enum_type const& type) - { - // Metadata attributes don't have backing code - if (type.swift_logical_namespace() == "Windows.Foundation.Metadata" || !can_write(w, type)) - { - return; - } - - write_documentation_comment(w, type); - w.write("public typealias % = %\n", type, bind_type_mangled(type)); - } - static void write_enum_extension(writer& w, enum_type const& type) { if (type.swift_logical_namespace() == "Windows.Foundation.Metadata" || !can_write(w, type)) { return; } - w.write("extension % {\n", get_full_swift_type_name(w, type)); + w.write("public struct % : RawRepresentable, Hashable, Codable, Sendable {\n", type.type().TypeName()); + w.write(" public var rawValue: Swift.Int32\n\n"); + w.write(" public init(rawValue: Swift.Int32 = 0) {\n"); + w.write(" self.rawValue = rawValue\n"); + w.write(" }\n\n"); { - auto format = R"( public static var % : % { - %_% - } -)"; + auto format = " public static let % = Self(rawValue: %)\n\n"; for (const auto& field : type.type().FieldList()) { if (field.Constant()) { - // this enum is not written by our ABI tool, so it doesn't use a mangled name - if (get_full_type_name(type) == "Windows.Foundation.Collections.CollectionChange") - { - w.write(format, get_swift_name(field), get_full_swift_type_name(w, type), type, field.Name()); - } - else - { - // we use mangled names for enums because otherwise the WinAppSDK enums collide with the Windows ones - w.write(format, get_swift_name(field), get_full_swift_type_name(w, type), bind_type_mangled(type), field.Name()); - } + w.write(format, get_swift_name(field), field.Constant().ValueInt32()); } } } w.write("}\n"); - - w.write("extension %: ^@retroactive Hashable, ^@retroactive Codable, ^@retroactive ^@unchecked Sendable {}\n\n", get_full_swift_type_name(w, type)); } static void write_guid_value(writer& w, std::vector const& args) @@ -244,6 +222,10 @@ namespace swiftwinrt // api call for easy passing to the ABI w.write("%", local_name); } + else if (category == param_category::enum_type) + { + w.write(".init(rawValue: %.rawValue)", param_name); + } else if (is_type_blittable(category)) { // fundamentals and enums can be simply copied @@ -307,6 +289,10 @@ namespace swiftwinrt w.write("&%.val", local_param_name); } } + else if (category == param_category::enum_type) + { + w.write("&%", local_param_name); + } else if (is_blittable) { w.write("&%", param_name); @@ -1667,6 +1653,16 @@ vtable); local_param_name); guard.push("WindowsDeleteString(%)\n", local_param_name); } + else if (category == param_category::enum_type) + { + w.write("var %: % = .init(rawValue: %.rawValue)\n", + local_param_name, + bind_type_mangled(param.type), + param_name); + guard.push("% = .init(rawValue: %.rawValue)\n", + param_name, + local_param_name); + } else if (category == param_category::struct_type && is_struct_blittable(signature_type) && !is_guid(category)) diff --git a/swiftwinrt/code_writers/common_writers.h b/swiftwinrt/code_writers/common_writers.h index f65f3ae5..7f5badd3 100644 --- a/swiftwinrt/code_writers/common_writers.h +++ b/swiftwinrt/code_writers/common_writers.h @@ -302,6 +302,10 @@ namespace swiftwinrt w.write(".from(abi: %)", name); } } + else if (category == param_category::enum_type) + { + w.write(".init(rawValue: %.rawValue)", name); + } else if (is_type_blittable(category)) { // fundamental types can just be simply copied to since the types match diff --git a/swiftwinrt/code_writers/struct_writers.cpp b/swiftwinrt/code_writers/struct_writers.cpp index 774672a7..e20f3531 100644 --- a/swiftwinrt/code_writers/struct_writers.cpp +++ b/swiftwinrt/code_writers/struct_writers.cpp @@ -41,13 +41,22 @@ namespace swiftwinrt { s(); - if (dynamic_cast(field.type)) + auto category = get_category(field.type); + + if (category == param_category::struct_type) { w.write("%: .from(swift: swift.%)", get_abi_name(field), get_swift_name(field) ); } + else if (category == param_category::enum_type) + { + w.write("%: .init(rawValue: swift.%.rawValue)", + get_abi_name(field), + get_swift_name(field) + ); + } else { w.write("%: swift.%", diff --git a/swiftwinrt/code_writers/type_writers.cpp b/swiftwinrt/code_writers/type_writers.cpp index 059f535a..6cf7de37 100644 --- a/swiftwinrt/code_writers/type_writers.cpp +++ b/swiftwinrt/code_writers/type_writers.cpp @@ -296,7 +296,7 @@ void swiftwinrt::write_default_init_assignment(writer& w, metadata_type const& s } else if (category == param_category::enum_type) { - w.write(" = .init(0)"); + w.write(" = .init(rawValue: 0)"); } else if (is_boolean(&sig)) { diff --git a/swiftwinrt/file_writers.h b/swiftwinrt/file_writers.h index b08c3065..7f6e4048 100644 --- a/swiftwinrt/file_writers.h +++ b/swiftwinrt/file_writers.h @@ -197,7 +197,6 @@ namespace swiftwinrt w.swift_module = get_swift_module(ns); w.cache = members.cache; - w.write("%", w.filter.bind_each(members.enums)); w.write("%", w.filter.bind_each(members.classes)); w.write("%", w.filter.bind_each(members.delegates)); w.write("%", w.filter.bind_each(members.structs)); 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 70e3e3c0..778f95f4 100644 --- a/tests/test_component/Sources/test_component/Windows.Foundation+ABI.swift +++ b/tests/test_component/Sources/test_component/Windows.Foundation+ABI.swift @@ -206,11 +206,11 @@ public enum __ABI_Windows_Foundation { } open func get_StatusImpl() throws -> test_component.AsyncStatus { - var result: __x_ABI_CWindows_CFoundation_CAsyncStatus = .init(0) + var result: __x_ABI_CWindows_CFoundation_CAsyncStatus = .init(rawValue: 0) _ = try perform(as: __x_ABI_CWindows_CFoundation_CIAsyncInfo.self) { pThis in try CHECKED(pThis.pointee.lpVtbl.pointee.get_Status(pThis, &result)) } - return result + return .init(rawValue: result.rawValue) } open func get_ErrorCodeImpl() throws -> HRESULT { @@ -273,7 +273,7 @@ public enum __ABI_Windows_Foundation { get_Status: { guard let __unwrapped__instance = IAsyncInfoWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let result = __unwrapped__instance.status - $1?.initialize(to: result) + $1?.initialize(to: .init(rawValue: result.rawValue)) return S_OK }, @@ -534,11 +534,11 @@ public enum __ABI_Windows_Foundation { override public class var IID: test_component.IID { IID___x_ABI_CWindows_CFoundation_CIPropertyValue } open func get_TypeImpl() throws -> test_component.PropertyType { - var value: __x_ABI_CWindows_CFoundation_CPropertyType = .init(0) + var value: __x_ABI_CWindows_CFoundation_CPropertyType = .init(rawValue: 0) _ = try perform(as: __x_ABI_CWindows_CFoundation_CIPropertyValue.self) { pThis in try CHECKED(pThis.pointee.lpVtbl.pointee.get_Type(pThis, &value)) } - return value + return .init(rawValue: value.rawValue) } open func get_IsNumericScalarImpl() throws -> Bool { @@ -726,7 +726,7 @@ public enum __ABI_Windows_Foundation { get_Type: { guard let __unwrapped__instance = IPropertyValueWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let value = __unwrapped__instance.type - $1?.initialize(to: value) + $1?.initialize(to: .init(rawValue: value.rawValue)) return S_OK }, @@ -1334,7 +1334,7 @@ extension __ABI_Windows_Foundation { let asyncInfoWrapper = __ABI_Windows_Foundation.IAsyncActionWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_CWindows_CFoundation_CIAsyncActionCompletedHandler.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -1350,7 +1350,7 @@ extension __ABI_Windows_Foundation { do { guard let __unwrapped__instance = AsyncActionCompletedHandlerWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncAction? = __ABI_Windows_Foundation.IAsyncActionWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } diff --git a/tests/test_component/Sources/test_component/Windows.Foundation.Collections+ABI.swift b/tests/test_component/Sources/test_component/Windows.Foundation.Collections+ABI.swift index 3053759a..98e73f35 100644 --- a/tests/test_component/Sources/test_component/Windows.Foundation.Collections+ABI.swift +++ b/tests/test_component/Sources/test_component/Windows.Foundation.Collections+ABI.swift @@ -102,11 +102,11 @@ public enum __ABI_Windows_Foundation_Collections { override public class var IID: test_component.IID { IID___x_ABI_CWindows_CFoundation_CCollections_CIVectorChangedEventArgs } open func get_CollectionChangeImpl() throws -> test_component.CollectionChange { - var value: __x_ABI_CWindows_CFoundation_CCollections_CCollectionChange = .init(0) + var value: __x_ABI_CWindows_CFoundation_CCollections_CCollectionChange = .init(rawValue: 0) _ = try perform(as: __x_ABI_CWindows_CFoundation_CCollections_CIVectorChangedEventArgs.self) { pThis in try CHECKED(pThis.pointee.lpVtbl.pointee.get_CollectionChange(pThis, &value)) } - return value + return .init(rawValue: value.rawValue) } open func get_IndexImpl() throws -> UInt32 { @@ -150,7 +150,7 @@ public enum __ABI_Windows_Foundation_Collections { get_CollectionChange: { guard let __unwrapped__instance = IVectorChangedEventArgsWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let value = __unwrapped__instance.collectionChange - $1?.initialize(to: value) + $1?.initialize(to: .init(rawValue: value.rawValue)) return S_OK }, diff --git a/tests/test_component/Sources/test_component/Windows.Foundation.Collections.swift b/tests/test_component/Sources/test_component/Windows.Foundation.Collections.swift index cdb08e2d..da54f9b8 100644 --- a/tests/test_component/Sources/test_component/Windows.Foundation.Collections.swift +++ b/tests/test_component/Sources/test_component/Windows.Foundation.Collections.swift @@ -3,8 +3,6 @@ import Foundation import Ctest_component -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.collectionchange) -public typealias CollectionChange = __x_ABI_CWindows_CFoundation_CCollections_CCollectionChange /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.propertyset) public final class PropertySet : WinRTClass, IObservableMap, IMap, IIterable, IPropertySet { public typealias K = String @@ -489,19 +487,19 @@ public protocol IVector : IIterable, Collection where Element == T, Index == public typealias AnyIVector = any IVector -extension test_component.CollectionChange { - public static var reset : test_component.CollectionChange { - CollectionChange_Reset - } - public static var itemInserted : test_component.CollectionChange { - CollectionChange_ItemInserted - } - public static var itemRemoved : test_component.CollectionChange { - CollectionChange_ItemRemoved - } - public static var itemChanged : test_component.CollectionChange { - CollectionChange_ItemChanged +public struct CollectionChange : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 + + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } -} -extension test_component.CollectionChange: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} + public static let reset = Self(rawValue: 0) + + public static let itemInserted = Self(rawValue: 1) + + public static let itemRemoved = Self(rawValue: 2) + + public static let itemChanged = Self(rawValue: 3) + +} diff --git a/tests/test_component/Sources/test_component/Windows.Foundation.swift b/tests/test_component/Sources/test_component/Windows.Foundation.swift index 531a633c..963c807e 100644 --- a/tests/test_component/Sources/test_component/Windows.Foundation.swift +++ b/tests/test_component/Sources/test_component/Windows.Foundation.swift @@ -3,10 +3,6 @@ import Foundation import Ctest_component -/// [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 @@ -714,146 +710,109 @@ extension IWwwFormUrlDecoderEntry { } public typealias AnyIWwwFormUrlDecoderEntry = any IWwwFormUrlDecoderEntry -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 +public struct AsyncStatus : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 + + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let canceled = Self(rawValue: 2) + + public static let completed = Self(rawValue: 1) + + public static let error = Self(rawValue: 3) + + public static let started = Self(rawValue: 0) + } -extension test_component.AsyncStatus: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct PropertyType : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.PropertyType { - public static var empty : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_Empty - } - public static var uint8 : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_UInt8 - } - public static var int16 : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_Int16 - } - public static var uint16 : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_UInt16 - } - public static var int32 : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_Int32 - } - public static var uint32 : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_UInt32 - } - public static var int64 : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_Int64 - } - public static var uint64 : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_UInt64 - } - public static var single : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_Single - } - public static var double : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_Double - } - public static var char16 : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_Char16 - } - public static var boolean : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_Boolean - } - public static var string : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_String - } - public static var inspectable : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_Inspectable - } - public static var dateTime : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_DateTime - } - public static var timeSpan : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_TimeSpan - } - public static var guid : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_Guid - } - public static var point : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_Point - } - public static var size : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_Size - } - public static var rect : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_Rect - } - public static var otherType : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_OtherType - } - public static var uint8Array : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_UInt8Array - } - public static var int16Array : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_Int16Array - } - public static var uint16Array : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_UInt16Array - } - public static var int32Array : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_Int32Array - } - public static var uint32Array : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_UInt32Array - } - public static var int64Array : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_Int64Array - } - public static var uint64Array : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_UInt64Array - } - public static var singleArray : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_SingleArray - } - public static var doubleArray : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_DoubleArray - } - public static var char16Array : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_Char16Array - } - public static var booleanArray : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_BooleanArray - } - public static var stringArray : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_StringArray - } - public static var inspectableArray : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_InspectableArray - } - public static var dateTimeArray : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_DateTimeArray - } - public static var timeSpanArray : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_TimeSpanArray - } - public static var guidArray : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_GuidArray - } - public static var pointArray : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_PointArray + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } - public static var sizeArray : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_SizeArray - } - public static var rectArray : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_RectArray - } - public static var otherTypeArray : test_component.PropertyType { - __x_ABI_CWindows_CFoundation_CPropertyType_OtherTypeArray - } -} -extension test_component.PropertyType: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} + public static let empty = Self(rawValue: 0) + + public static let uint8 = Self(rawValue: 1) + + public static let int16 = Self(rawValue: 2) + + public static let uint16 = Self(rawValue: 3) + + public static let int32 = Self(rawValue: 4) + + public static let uint32 = Self(rawValue: 5) + + public static let int64 = Self(rawValue: 6) + + public static let uint64 = Self(rawValue: 7) + + public static let single = Self(rawValue: 8) + + public static let double = Self(rawValue: 9) + + public static let char16 = Self(rawValue: 10) + + public static let boolean = Self(rawValue: 11) + + public static let string = Self(rawValue: 12) + + public static let inspectable = Self(rawValue: 13) + + public static let dateTime = Self(rawValue: 14) + + public static let timeSpan = Self(rawValue: 15) + + public static let guid = Self(rawValue: 16) + + public static let point = Self(rawValue: 17) + + public static let size = Self(rawValue: 18) + + public static let rect = Self(rawValue: 19) + + public static let otherType = Self(rawValue: 20) + + public static let uint8Array = Self(rawValue: 1025) + + public static let int16Array = Self(rawValue: 1026) + + public static let uint16Array = Self(rawValue: 1027) + + public static let int32Array = Self(rawValue: 1028) + + public static let uint32Array = Self(rawValue: 1029) + + public static let int64Array = Self(rawValue: 1030) + + public static let uint64Array = Self(rawValue: 1031) + + public static let singleArray = Self(rawValue: 1032) + + public static let doubleArray = Self(rawValue: 1033) + + public static let char16Array = Self(rawValue: 1034) + + public static let booleanArray = Self(rawValue: 1035) + + public static let stringArray = Self(rawValue: 1036) + + public static let inspectableArray = Self(rawValue: 1037) + + public static let dateTimeArray = Self(rawValue: 1038) + + public static let timeSpanArray = Self(rawValue: 1039) + + public static let guidArray = Self(rawValue: 1040) + + public static let pointArray = Self(rawValue: 1041) + + public static let sizeArray = Self(rawValue: 1042) + + public static let rectArray = Self(rawValue: 1043) + + public static let otherTypeArray = Self(rawValue: 1044) + +} diff --git a/tests/test_component/Sources/test_component/Windows.Storage+ABI.swift b/tests/test_component/Sources/test_component/Windows.Storage+ABI.swift index bfb2361e..9e390d1c 100644 --- a/tests/test_component/Sources/test_component/Windows.Storage+ABI.swift +++ b/tests/test_component/Sources/test_component/Windows.Storage+ABI.swift @@ -109,7 +109,7 @@ public enum __ABI_Windows_Storage { let (textOperation) = try ComPtrs.initialize { textOperationAbi in let _absolutePath = try! HString(absolutePath) _ = try perform(as: __x_ABI_CWindows_CStorage_CIPathIOStatics.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.ReadTextWithEncodingAsync(pThis, _absolutePath.get(), encoding, &textOperationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.ReadTextWithEncodingAsync(pThis, _absolutePath.get(), .init(rawValue: encoding.rawValue), &textOperationAbi)) } } return test_component.__x_ABI_C__FIAsyncOperation_1_HSTRINGWrapper.unwrapFrom(abi: textOperation) @@ -131,7 +131,7 @@ public enum __ABI_Windows_Storage { let _absolutePath = try! HString(absolutePath) let _contents = try! HString(contents) _ = try perform(as: __x_ABI_CWindows_CStorage_CIPathIOStatics.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.WriteTextWithEncodingAsync(pThis, _absolutePath.get(), _contents.get(), encoding, &textOperationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.WriteTextWithEncodingAsync(pThis, _absolutePath.get(), _contents.get(), .init(rawValue: encoding.rawValue), &textOperationAbi)) } } return __ABI_Windows_Foundation.IAsyncActionWrapper.unwrapFrom(abi: textOperation) @@ -153,7 +153,7 @@ public enum __ABI_Windows_Storage { let _absolutePath = try! HString(absolutePath) let _contents = try! HString(contents) _ = try perform(as: __x_ABI_CWindows_CStorage_CIPathIOStatics.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.AppendTextWithEncodingAsync(pThis, _absolutePath.get(), _contents.get(), encoding, &textOperationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.AppendTextWithEncodingAsync(pThis, _absolutePath.get(), _contents.get(), .init(rawValue: encoding.rawValue), &textOperationAbi)) } } return __ABI_Windows_Foundation.IAsyncActionWrapper.unwrapFrom(abi: textOperation) @@ -173,7 +173,7 @@ public enum __ABI_Windows_Storage { let (linesOperation) = try ComPtrs.initialize { linesOperationAbi in let _absolutePath = try! HString(absolutePath) _ = try perform(as: __x_ABI_CWindows_CStorage_CIPathIOStatics.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.ReadLinesWithEncodingAsync(pThis, _absolutePath.get(), encoding, &linesOperationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.ReadLinesWithEncodingAsync(pThis, _absolutePath.get(), .init(rawValue: encoding.rawValue), &linesOperationAbi)) } } return test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVector_1_HSTRINGWrapper.unwrapFrom(abi: linesOperation) @@ -197,7 +197,7 @@ public enum __ABI_Windows_Storage { let linesWrapper = test_component.__x_ABI_C__FIIterable_1_HSTRINGWrapper(lines) let _lines = try! linesWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_CWindows_CStorage_CIPathIOStatics.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.WriteLinesWithEncodingAsync(pThis, _absolutePath.get(), _lines, encoding, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.WriteLinesWithEncodingAsync(pThis, _absolutePath.get(), _lines, .init(rawValue: encoding.rawValue), &operationAbi)) } } return __ABI_Windows_Foundation.IAsyncActionWrapper.unwrapFrom(abi: operation) @@ -221,7 +221,7 @@ public enum __ABI_Windows_Storage { let linesWrapper = test_component.__x_ABI_C__FIIterable_1_HSTRINGWrapper(lines) let _lines = try! linesWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_CWindows_CStorage_CIPathIOStatics.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.AppendLinesWithEncodingAsync(pThis, _absolutePath.get(), _lines, encoding, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.AppendLinesWithEncodingAsync(pThis, _absolutePath.get(), _lines, .init(rawValue: encoding.rawValue), &operationAbi)) } } return __ABI_Windows_Foundation.IAsyncActionWrapper.unwrapFrom(abi: operation) @@ -273,7 +273,7 @@ public enum __ABI_Windows_Storage { open func OpenAsyncImpl(_ accessMode: test_component.FileAccessMode) throws -> test_component.AnyIAsyncOperation? { let (operation) = try ComPtrs.initialize { operationAbi in _ = try perform(as: __x_ABI_CWindows_CStorage_CIStorageFile.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.OpenAsync(pThis, accessMode, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.OpenAsync(pThis, .init(rawValue: accessMode.rawValue), &operationAbi)) } } return test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams__CIRandomAccessStreamWrapper.unwrapFrom(abi: operation) @@ -317,7 +317,7 @@ public enum __ABI_Windows_Storage { let _destinationFolder = try! destinationFolderWrapper?.toABI { $0 } let _desiredNewName = try! HString(desiredNewName) _ = try perform(as: __x_ABI_CWindows_CStorage_CIStorageFile.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.CopyOverload(pThis, _destinationFolder, _desiredNewName.get(), option, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.CopyOverload(pThis, _destinationFolder, _desiredNewName.get(), .init(rawValue: option.rawValue), &operationAbi)) } } return test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFileWrapper.unwrapFrom(abi: operation) @@ -363,7 +363,7 @@ public enum __ABI_Windows_Storage { let _destinationFolder = try! destinationFolderWrapper?.toABI { $0 } let _desiredNewName = try! HString(desiredNewName) _ = try perform(as: __x_ABI_CWindows_CStorage_CIStorageFile.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.MoveOverload(pThis, _destinationFolder, _desiredNewName.get(), option, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.MoveOverload(pThis, _destinationFolder, _desiredNewName.get(), .init(rawValue: option.rawValue), &operationAbi)) } } return __ABI_Windows_Foundation.IAsyncActionWrapper.unwrapFrom(abi: operation) @@ -430,7 +430,7 @@ public enum __ABI_Windows_Storage { OpenAsync: { do { guard let __unwrapped__instance = IStorageFileWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let accessMode: test_component.FileAccessMode = $1 + let accessMode: test_component.FileAccessMode = .init(rawValue: $1.rawValue) let operation = try __unwrapped__instance.openAsync(accessMode) let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams__CIRandomAccessStreamWrapper(operation) operationWrapper?.copyTo($2) @@ -476,7 +476,7 @@ public enum __ABI_Windows_Storage { guard let __unwrapped__instance = IStorageFileWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let destinationFolder: test_component.AnyIStorageFolder? = __ABI_Windows_Storage.IStorageFolderWrapper.unwrapFrom(abi: ComPtr($1)) let desiredNewName: String = .init(from: $2) - let option: test_component.NameCollisionOption = $3 + let option: test_component.NameCollisionOption = .init(rawValue: $3.rawValue) let operation = try __unwrapped__instance.copyAsync(destinationFolder, desiredNewName, option) let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFileWrapper(operation) operationWrapper?.copyTo($4) @@ -523,7 +523,7 @@ public enum __ABI_Windows_Storage { guard let __unwrapped__instance = IStorageFileWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let destinationFolder: test_component.AnyIStorageFolder? = __ABI_Windows_Storage.IStorageFolderWrapper.unwrapFrom(abi: ComPtr($1)) let desiredNewName: String = .init(from: $2) - let option: test_component.NameCollisionOption = $3 + let option: test_component.NameCollisionOption = .init(rawValue: $3.rawValue) let operation = try __unwrapped__instance.moveAsync(destinationFolder, desiredNewName, option) let operationWrapper = __ABI_Windows_Foundation.IAsyncActionWrapper(operation) operationWrapper?.copyTo($4) @@ -550,7 +550,7 @@ public enum __ABI_Windows_Storage { open func OpenWithOptionsAsyncImpl(_ accessMode: test_component.FileAccessMode, _ options: test_component.StorageOpenOptions) throws -> test_component.AnyIAsyncOperation? { let (operation) = try ComPtrs.initialize { operationAbi in _ = try perform(as: __x_ABI_CWindows_CStorage_CIStorageFile2.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.OpenWithOptionsAsync(pThis, accessMode, options, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.OpenWithOptionsAsync(pThis, .init(rawValue: accessMode.rawValue), .init(rawValue: options.rawValue), &operationAbi)) } } return test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams__CIRandomAccessStreamWrapper.unwrapFrom(abi: operation) @@ -559,7 +559,7 @@ public enum __ABI_Windows_Storage { open func OpenTransactedWriteWithOptionsAsyncImpl(_ options: test_component.StorageOpenOptions) throws -> test_component.AnyIAsyncOperation? { let (operation) = try ComPtrs.initialize { operationAbi in _ = try perform(as: __x_ABI_CWindows_CStorage_CIStorageFile2.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.OpenTransactedWriteWithOptionsAsync(pThis, options, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.OpenTransactedWriteWithOptionsAsync(pThis, .init(rawValue: options.rawValue), &operationAbi)) } } return test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageStreamTransactionWrapper.unwrapFrom(abi: operation) @@ -598,8 +598,8 @@ public enum __ABI_Windows_Storage { OpenWithOptionsAsync: { do { guard let __unwrapped__instance = IStorageFile2Wrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let accessMode: test_component.FileAccessMode = $1 - let options: test_component.StorageOpenOptions = $2 + let accessMode: test_component.FileAccessMode = .init(rawValue: $1.rawValue) + let options: test_component.StorageOpenOptions = .init(rawValue: $2.rawValue) let operation = try __unwrapped__instance.openAsync(accessMode, options) let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams__CIRandomAccessStreamWrapper(operation) operationWrapper?.copyTo($3) @@ -610,7 +610,7 @@ public enum __ABI_Windows_Storage { OpenTransactedWriteWithOptionsAsync: { do { guard let __unwrapped__instance = IStorageFile2Wrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let options: test_component.StorageOpenOptions = $1 + let options: test_component.StorageOpenOptions = .init(rawValue: $1.rawValue) let operation = try __unwrapped__instance.openTransactedWriteAsync(options) let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageStreamTransactionWrapper(operation) operationWrapper?.copyTo($2) @@ -765,7 +765,7 @@ public enum __ABI_Windows_Storage { let (operation) = try ComPtrs.initialize { operationAbi in let _desiredName = try! HString(desiredName) _ = try perform(as: __x_ABI_CWindows_CStorage_CIStorageFolder.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.CreateFileAsync(pThis, _desiredName.get(), options, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.CreateFileAsync(pThis, _desiredName.get(), .init(rawValue: options.rawValue), &operationAbi)) } } return test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFileWrapper.unwrapFrom(abi: operation) @@ -785,7 +785,7 @@ public enum __ABI_Windows_Storage { let (operation) = try ComPtrs.initialize { operationAbi in let _desiredName = try! HString(desiredName) _ = try perform(as: __x_ABI_CWindows_CStorage_CIStorageFolder.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.CreateFolderAsync(pThis, _desiredName.get(), options, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.CreateFolderAsync(pThis, _desiredName.get(), .init(rawValue: options.rawValue), &operationAbi)) } } return test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper.unwrapFrom(abi: operation) @@ -894,7 +894,7 @@ public enum __ABI_Windows_Storage { do { guard let __unwrapped__instance = IStorageFolderWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let desiredName: String = .init(from: $1) - let options: test_component.CreationCollisionOption = $2 + let options: test_component.CreationCollisionOption = .init(rawValue: $2.rawValue) let operation = try __unwrapped__instance.createFileAsync(desiredName, options) let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFileWrapper(operation) operationWrapper?.copyTo($3) @@ -917,7 +917,7 @@ public enum __ABI_Windows_Storage { do { guard let __unwrapped__instance = IStorageFolderWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let desiredName: String = .init(from: $1) - let options: test_component.CreationCollisionOption = $2 + let options: test_component.CreationCollisionOption = .init(rawValue: $2.rawValue) let operation = try __unwrapped__instance.createFolderAsync(desiredName, options) let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper(operation) operationWrapper?.copyTo($3) @@ -1092,7 +1092,7 @@ public enum __ABI_Windows_Storage { let (operation) = try ComPtrs.initialize { operationAbi in let _desiredName = try! HString(desiredName) _ = try perform(as: __x_ABI_CWindows_CStorage_CIStorageItem.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.RenameAsync(pThis, _desiredName.get(), option, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.RenameAsync(pThis, _desiredName.get(), .init(rawValue: option.rawValue), &operationAbi)) } } return __ABI_Windows_Foundation.IAsyncActionWrapper.unwrapFrom(abi: operation) @@ -1110,7 +1110,7 @@ public enum __ABI_Windows_Storage { open func DeleteAsyncImpl(_ option: test_component.StorageDeleteOption) throws -> test_component.AnyIAsyncAction? { let (operation) = try ComPtrs.initialize { operationAbi in _ = try perform(as: __x_ABI_CWindows_CStorage_CIStorageItem.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.DeleteAsync(pThis, option, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.DeleteAsync(pThis, .init(rawValue: option.rawValue), &operationAbi)) } } return __ABI_Windows_Foundation.IAsyncActionWrapper.unwrapFrom(abi: operation) @@ -1142,11 +1142,11 @@ public enum __ABI_Windows_Storage { } open func get_AttributesImpl() throws -> test_component.FileAttributes { - var value: __x_ABI_CWindows_CStorage_CFileAttributes = .init(0) + var value: __x_ABI_CWindows_CStorage_CFileAttributes = .init(rawValue: 0) _ = try perform(as: __x_ABI_CWindows_CStorage_CIStorageItem.self) { pThis in try CHECKED(pThis.pointee.lpVtbl.pointee.get_Attributes(pThis, &value)) } - return value + return .init(rawValue: value.rawValue) } open func get_DateCreatedImpl() throws -> test_component.DateTime { @@ -1160,7 +1160,7 @@ public enum __ABI_Windows_Storage { open func IsOfTypeImpl(_ type: test_component.StorageItemTypes) throws -> Bool { var value: boolean = 0 _ = try perform(as: __x_ABI_CWindows_CStorage_CIStorageItem.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.IsOfType(pThis, type, &value)) + try CHECKED(pThis.pointee.lpVtbl.pointee.IsOfType(pThis, .init(rawValue: type.rawValue), &value)) } return .init(from: value) } @@ -1210,7 +1210,7 @@ public enum __ABI_Windows_Storage { do { guard let __unwrapped__instance = IStorageItemWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let desiredName: String = .init(from: $1) - let option: test_component.NameCollisionOption = $2 + let option: test_component.NameCollisionOption = .init(rawValue: $2.rawValue) let operation = try __unwrapped__instance.renameAsync(desiredName, option) let operationWrapper = __ABI_Windows_Foundation.IAsyncActionWrapper(operation) operationWrapper?.copyTo($3) @@ -1231,7 +1231,7 @@ public enum __ABI_Windows_Storage { DeleteAsync: { do { guard let __unwrapped__instance = IStorageItemWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let option: test_component.StorageDeleteOption = $1 + let option: test_component.StorageDeleteOption = .init(rawValue: $1.rawValue) let operation = try __unwrapped__instance.deleteAsync(option) let operationWrapper = __ABI_Windows_Foundation.IAsyncActionWrapper(operation) operationWrapper?.copyTo($2) @@ -1266,7 +1266,7 @@ public enum __ABI_Windows_Storage { get_Attributes: { guard let __unwrapped__instance = IStorageItemWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let value = __unwrapped__instance.attributes - $1?.initialize(to: value) + $1?.initialize(to: .init(rawValue: value.rawValue)) return S_OK }, @@ -1280,7 +1280,7 @@ public enum __ABI_Windows_Storage { IsOfType: { do { guard let __unwrapped__instance = IStorageItemWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let type: test_component.StorageItemTypes = $1 + let type: test_component.StorageItemTypes = .init(rawValue: $1.rawValue) let value = try __unwrapped__instance.isOfType(type) $2?.initialize(to: .init(from: value)) return S_OK @@ -1370,7 +1370,7 @@ public enum __ABI_Windows_Storage { open func GetThumbnailAsyncOverloadDefaultSizeDefaultOptionsImpl(_ mode: test_component.ThumbnailMode) throws -> test_component.AnyIAsyncOperation? { let (operation) = try ComPtrs.initialize { operationAbi in _ = try perform(as: __x_ABI_CWindows_CStorage_CIStorageItemProperties.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.GetThumbnailAsyncOverloadDefaultSizeDefaultOptions(pThis, mode, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.GetThumbnailAsyncOverloadDefaultSizeDefaultOptions(pThis, .init(rawValue: mode.rawValue), &operationAbi)) } } return test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper.unwrapFrom(abi: operation) @@ -1379,7 +1379,7 @@ public enum __ABI_Windows_Storage { open func GetThumbnailAsyncOverloadDefaultOptionsImpl(_ mode: test_component.ThumbnailMode, _ requestedSize: UInt32) throws -> test_component.AnyIAsyncOperation? { let (operation) = try ComPtrs.initialize { operationAbi in _ = try perform(as: __x_ABI_CWindows_CStorage_CIStorageItemProperties.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.GetThumbnailAsyncOverloadDefaultOptions(pThis, mode, requestedSize, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.GetThumbnailAsyncOverloadDefaultOptions(pThis, .init(rawValue: mode.rawValue), requestedSize, &operationAbi)) } } return test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper.unwrapFrom(abi: operation) @@ -1388,7 +1388,7 @@ public enum __ABI_Windows_Storage { open func GetThumbnailAsyncImpl(_ mode: test_component.ThumbnailMode, _ requestedSize: UInt32, _ options: test_component.ThumbnailOptions) throws -> test_component.AnyIAsyncOperation? { let (operation) = try ComPtrs.initialize { operationAbi in _ = try perform(as: __x_ABI_CWindows_CStorage_CIStorageItemProperties.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.GetThumbnailAsync(pThis, mode, requestedSize, options, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.GetThumbnailAsync(pThis, .init(rawValue: mode.rawValue), requestedSize, .init(rawValue: options.rawValue), &operationAbi)) } } return test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper.unwrapFrom(abi: operation) @@ -1460,7 +1460,7 @@ public enum __ABI_Windows_Storage { GetThumbnailAsyncOverloadDefaultSizeDefaultOptions: { do { guard let __unwrapped__instance = IStorageItemPropertiesWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let mode: test_component.ThumbnailMode = $1 + let mode: test_component.ThumbnailMode = .init(rawValue: $1.rawValue) let operation = try __unwrapped__instance.getThumbnailAsync(mode) let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper(operation) operationWrapper?.copyTo($2) @@ -1471,7 +1471,7 @@ public enum __ABI_Windows_Storage { GetThumbnailAsyncOverloadDefaultOptions: { do { guard let __unwrapped__instance = IStorageItemPropertiesWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let mode: test_component.ThumbnailMode = $1 + let mode: test_component.ThumbnailMode = .init(rawValue: $1.rawValue) let requestedSize: UInt32 = $2 let operation = try __unwrapped__instance.getThumbnailAsync(mode, requestedSize) let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper(operation) @@ -1483,9 +1483,9 @@ public enum __ABI_Windows_Storage { GetThumbnailAsync: { do { guard let __unwrapped__instance = IStorageItemPropertiesWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let mode: test_component.ThumbnailMode = $1 + let mode: test_component.ThumbnailMode = .init(rawValue: $1.rawValue) let requestedSize: UInt32 = $2 - let options: test_component.ThumbnailOptions = $3 + let options: test_component.ThumbnailOptions = .init(rawValue: $3.rawValue) let operation = try __unwrapped__instance.getThumbnailAsync(mode, requestedSize, options) let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper(operation) operationWrapper?.copyTo($4) @@ -1529,7 +1529,7 @@ public enum __ABI_Windows_Storage { open func GetScaledImageAsThumbnailAsyncOverloadDefaultSizeDefaultOptionsImpl(_ mode: test_component.ThumbnailMode) throws -> test_component.AnyIAsyncOperation? { let (operation) = try ComPtrs.initialize { operationAbi in _ = try perform(as: __x_ABI_CWindows_CStorage_CIStorageItemProperties2.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.GetScaledImageAsThumbnailAsyncOverloadDefaultSizeDefaultOptions(pThis, mode, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.GetScaledImageAsThumbnailAsyncOverloadDefaultSizeDefaultOptions(pThis, .init(rawValue: mode.rawValue), &operationAbi)) } } return test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper.unwrapFrom(abi: operation) @@ -1538,7 +1538,7 @@ public enum __ABI_Windows_Storage { open func GetScaledImageAsThumbnailAsyncOverloadDefaultOptionsImpl(_ mode: test_component.ThumbnailMode, _ requestedSize: UInt32) throws -> test_component.AnyIAsyncOperation? { let (operation) = try ComPtrs.initialize { operationAbi in _ = try perform(as: __x_ABI_CWindows_CStorage_CIStorageItemProperties2.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.GetScaledImageAsThumbnailAsyncOverloadDefaultOptions(pThis, mode, requestedSize, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.GetScaledImageAsThumbnailAsyncOverloadDefaultOptions(pThis, .init(rawValue: mode.rawValue), requestedSize, &operationAbi)) } } return test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper.unwrapFrom(abi: operation) @@ -1547,7 +1547,7 @@ public enum __ABI_Windows_Storage { open func GetScaledImageAsThumbnailAsyncImpl(_ mode: test_component.ThumbnailMode, _ requestedSize: UInt32, _ options: test_component.ThumbnailOptions) throws -> test_component.AnyIAsyncOperation? { let (operation) = try ComPtrs.initialize { operationAbi in _ = try perform(as: __x_ABI_CWindows_CStorage_CIStorageItemProperties2.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.GetScaledImageAsThumbnailAsync(pThis, mode, requestedSize, options, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.GetScaledImageAsThumbnailAsync(pThis, .init(rawValue: mode.rawValue), requestedSize, .init(rawValue: options.rawValue), &operationAbi)) } } return test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper.unwrapFrom(abi: operation) @@ -1587,7 +1587,7 @@ public enum __ABI_Windows_Storage { GetScaledImageAsThumbnailAsyncOverloadDefaultSizeDefaultOptions: { do { guard let __unwrapped__instance = IStorageItemProperties2Wrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let mode: test_component.ThumbnailMode = $1 + let mode: test_component.ThumbnailMode = .init(rawValue: $1.rawValue) let operation = try __unwrapped__instance.getScaledImageAsThumbnailAsync(mode) let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper(operation) operationWrapper?.copyTo($2) @@ -1598,7 +1598,7 @@ public enum __ABI_Windows_Storage { GetScaledImageAsThumbnailAsyncOverloadDefaultOptions: { do { guard let __unwrapped__instance = IStorageItemProperties2Wrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let mode: test_component.ThumbnailMode = $1 + let mode: test_component.ThumbnailMode = .init(rawValue: $1.rawValue) let requestedSize: UInt32 = $2 let operation = try __unwrapped__instance.getScaledImageAsThumbnailAsync(mode, requestedSize) let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper(operation) @@ -1610,9 +1610,9 @@ public enum __ABI_Windows_Storage { GetScaledImageAsThumbnailAsync: { do { guard let __unwrapped__instance = IStorageItemProperties2Wrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let mode: test_component.ThumbnailMode = $1 + let mode: test_component.ThumbnailMode = .init(rawValue: $1.rawValue) let requestedSize: UInt32 = $2 - let options: test_component.ThumbnailOptions = $3 + let options: test_component.ThumbnailOptions = .init(rawValue: $3.rawValue) let operation = try __unwrapped__instance.getScaledImageAsThumbnailAsync(mode, requestedSize, options) let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper(operation) operationWrapper?.copyTo($4) @@ -1678,11 +1678,11 @@ public enum __ABI_Windows_Storage { override public class var IID: test_component.IID { IID___x_ABI_CWindows_CStorage_CIStorageLibraryChange } internal func get_ChangeTypeImpl() throws -> test_component.StorageLibraryChangeType { - var value: __x_ABI_CWindows_CStorage_CStorageLibraryChangeType = .init(0) + var value: __x_ABI_CWindows_CStorage_CStorageLibraryChangeType = .init(rawValue: 0) _ = try perform(as: __x_ABI_CWindows_CStorage_CIStorageLibraryChange.self) { pThis in try CHECKED(pThis.pointee.lpVtbl.pointee.get_ChangeType(pThis, &value)) } - return value + return .init(rawValue: value.rawValue) } internal func get_PathImpl() throws -> String { @@ -1704,7 +1704,7 @@ public enum __ABI_Windows_Storage { internal func IsOfTypeImpl(_ type: test_component.StorageItemTypes) throws -> Bool { var value: boolean = 0 _ = try perform(as: __x_ABI_CWindows_CStorage_CIStorageLibraryChange.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.IsOfType(pThis, type, &value)) + try CHECKED(pThis.pointee.lpVtbl.pointee.IsOfType(pThis, .init(rawValue: type.rawValue), &value)) } return .init(from: value) } @@ -1833,7 +1833,7 @@ public enum __ABI_Windows_Storage { open func FailAndCloseImpl(_ failureMode: test_component.StreamedFileFailureMode) throws { _ = try perform(as: __x_ABI_CWindows_CStorage_CIStreamedFileDataRequest.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.FailAndClose(pThis, failureMode)) + try CHECKED(pThis.pointee.lpVtbl.pointee.FailAndClose(pThis, .init(rawValue: failureMode.rawValue))) } } @@ -1870,7 +1870,7 @@ public enum __ABI_Windows_Storage { FailAndClose: { do { guard let __unwrapped__instance = IStreamedFileDataRequestWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let failureMode: test_component.StreamedFileFailureMode = $1 + let failureMode: test_component.StreamedFileFailureMode = .init(rawValue: $1.rawValue) try __unwrapped__instance.failAndClose(failureMode) return S_OK } catch { return failWith(err: E_FAIL) } diff --git a/tests/test_component/Sources/test_component/Windows.Storage.FileProperties+ABI.swift b/tests/test_component/Sources/test_component/Windows.Storage.FileProperties+ABI.swift index de809753..6093705f 100644 --- a/tests/test_component/Sources/test_component/Windows.Storage.FileProperties+ABI.swift +++ b/tests/test_component/Sources/test_component/Windows.Storage.FileProperties+ABI.swift @@ -238,11 +238,11 @@ public enum __ABI_Windows_Storage_FileProperties { } internal func get_OrientationImpl() throws -> test_component.PhotoOrientation { - var value: __x_ABI_CWindows_CStorage_CFileProperties_CPhotoOrientation = .init(0) + var value: __x_ABI_CWindows_CStorage_CFileProperties_CPhotoOrientation = .init(rawValue: 0) _ = try perform(as: __x_ABI_CWindows_CStorage_CFileProperties_CIImageProperties.self) { pThis in try CHECKED(pThis.pointee.lpVtbl.pointee.get_Orientation(pThis, &value)) } - return value + return .init(rawValue: value.rawValue) } internal func get_PeopleNamesImpl() throws -> test_component.AnyIVectorView? { @@ -621,11 +621,11 @@ public enum __ABI_Windows_Storage_FileProperties { } internal func get_TypeImpl() throws -> test_component.ThumbnailType { - var value: __x_ABI_CWindows_CStorage_CFileProperties_CThumbnailType = .init(0) + var value: __x_ABI_CWindows_CStorage_CFileProperties_CThumbnailType = .init(rawValue: 0) _ = try perform(as: __x_ABI_CWindows_CStorage_CFileProperties_CIThumbnailProperties.self) { pThis in try CHECKED(pThis.pointee.lpVtbl.pointee.get_Type(pThis, &value)) } - return value + return .init(rawValue: value.rawValue) } } @@ -793,11 +793,11 @@ public enum __ABI_Windows_Storage_FileProperties { } internal func get_OrientationImpl() throws -> test_component.VideoOrientation { - var value: __x_ABI_CWindows_CStorage_CFileProperties_CVideoOrientation = .init(0) + var value: __x_ABI_CWindows_CStorage_CFileProperties_CVideoOrientation = .init(rawValue: 0) _ = try perform(as: __x_ABI_CWindows_CStorage_CFileProperties_CIVideoProperties.self) { pThis in try CHECKED(pThis.pointee.lpVtbl.pointee.get_Orientation(pThis, &value)) } - return value + return .init(rawValue: value.rawValue) } } diff --git a/tests/test_component/Sources/test_component/Windows.Storage.FileProperties.swift b/tests/test_component/Sources/test_component/Windows.Storage.FileProperties.swift index 73580df1..8d66c374 100644 --- a/tests/test_component/Sources/test_component/Windows.Storage.FileProperties.swift +++ b/tests/test_component/Sources/test_component/Windows.Storage.FileProperties.swift @@ -3,18 +3,6 @@ import Foundation import Ctest_component -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.fileproperties.photoorientation) -public typealias PhotoOrientation = __x_ABI_CWindows_CStorage_CFileProperties_CPhotoOrientation -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.fileproperties.propertyprefetchoptions) -public typealias PropertyPrefetchOptions = __x_ABI_CWindows_CStorage_CFileProperties_CPropertyPrefetchOptions -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.fileproperties.thumbnailmode) -public typealias ThumbnailMode = __x_ABI_CWindows_CStorage_CFileProperties_CThumbnailMode -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.fileproperties.thumbnailoptions) -public typealias ThumbnailOptions = __x_ABI_CWindows_CStorage_CFileProperties_CThumbnailOptions -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.fileproperties.thumbnailtype) -public typealias ThumbnailType = __x_ABI_CWindows_CStorage_CFileProperties_CThumbnailType -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.fileproperties.videoorientation) -public typealias VideoOrientation = __x_ABI_CWindows_CStorage_CFileProperties_CVideoOrientation /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.fileproperties.basicproperties) public final class BasicProperties : WinRTClass, IStorageItemExtraProperties { private typealias SwiftABI = __ABI_Windows_Storage_FileProperties.IBasicProperties @@ -757,120 +745,113 @@ extension IStorageItemExtraProperties { } public typealias AnyIStorageItemExtraProperties = any IStorageItemExtraProperties -extension test_component.PhotoOrientation { - public static var unspecified : test_component.PhotoOrientation { - __x_ABI_CWindows_CStorage_CFileProperties_CPhotoOrientation_Unspecified - } - public static var normal : test_component.PhotoOrientation { - __x_ABI_CWindows_CStorage_CFileProperties_CPhotoOrientation_Normal - } - public static var flipHorizontal : test_component.PhotoOrientation { - __x_ABI_CWindows_CStorage_CFileProperties_CPhotoOrientation_FlipHorizontal - } - public static var rotate180 : test_component.PhotoOrientation { - __x_ABI_CWindows_CStorage_CFileProperties_CPhotoOrientation_Rotate180 - } - public static var flipVertical : test_component.PhotoOrientation { - __x_ABI_CWindows_CStorage_CFileProperties_CPhotoOrientation_FlipVertical - } - public static var transpose : test_component.PhotoOrientation { - __x_ABI_CWindows_CStorage_CFileProperties_CPhotoOrientation_Transpose - } - public static var rotate270 : test_component.PhotoOrientation { - __x_ABI_CWindows_CStorage_CFileProperties_CPhotoOrientation_Rotate270 - } - public static var transverse : test_component.PhotoOrientation { - __x_ABI_CWindows_CStorage_CFileProperties_CPhotoOrientation_Transverse - } - public static var rotate90 : test_component.PhotoOrientation { - __x_ABI_CWindows_CStorage_CFileProperties_CPhotoOrientation_Rotate90 +public struct PhotoOrientation : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 + + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let unspecified = Self(rawValue: 0) + + public static let normal = Self(rawValue: 1) + + public static let flipHorizontal = Self(rawValue: 2) + + public static let rotate180 = Self(rawValue: 3) + + public static let flipVertical = Self(rawValue: 4) + + public static let transpose = Self(rawValue: 5) + + public static let rotate270 = Self(rawValue: 6) + + public static let transverse = Self(rawValue: 7) + + public static let rotate90 = Self(rawValue: 8) + } -extension test_component.PhotoOrientation: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct PropertyPrefetchOptions : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.PropertyPrefetchOptions { - public static var none : test_component.PropertyPrefetchOptions { - __x_ABI_CWindows_CStorage_CFileProperties_CPropertyPrefetchOptions_None - } - public static var musicProperties : test_component.PropertyPrefetchOptions { - __x_ABI_CWindows_CStorage_CFileProperties_CPropertyPrefetchOptions_MusicProperties - } - public static var videoProperties : test_component.PropertyPrefetchOptions { - __x_ABI_CWindows_CStorage_CFileProperties_CPropertyPrefetchOptions_VideoProperties - } - public static var imageProperties : test_component.PropertyPrefetchOptions { - __x_ABI_CWindows_CStorage_CFileProperties_CPropertyPrefetchOptions_ImageProperties - } - public static var documentProperties : test_component.PropertyPrefetchOptions { - __x_ABI_CWindows_CStorage_CFileProperties_CPropertyPrefetchOptions_DocumentProperties - } - public static var basicProperties : test_component.PropertyPrefetchOptions { - __x_ABI_CWindows_CStorage_CFileProperties_CPropertyPrefetchOptions_BasicProperties + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let none = Self(rawValue: 0) + + public static let musicProperties = Self(rawValue: 1) + + public static let videoProperties = Self(rawValue: 2) + + public static let imageProperties = Self(rawValue: 4) + + public static let documentProperties = Self(rawValue: 8) + + public static let basicProperties = Self(rawValue: 16) + } -extension test_component.PropertyPrefetchOptions: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct ThumbnailMode : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.ThumbnailMode { - public static var picturesView : test_component.ThumbnailMode { - __x_ABI_CWindows_CStorage_CFileProperties_CThumbnailMode_PicturesView - } - public static var videosView : test_component.ThumbnailMode { - __x_ABI_CWindows_CStorage_CFileProperties_CThumbnailMode_VideosView - } - public static var musicView : test_component.ThumbnailMode { - __x_ABI_CWindows_CStorage_CFileProperties_CThumbnailMode_MusicView - } - public static var documentsView : test_component.ThumbnailMode { - __x_ABI_CWindows_CStorage_CFileProperties_CThumbnailMode_DocumentsView - } - public static var listView : test_component.ThumbnailMode { - __x_ABI_CWindows_CStorage_CFileProperties_CThumbnailMode_ListView - } - public static var singleItem : test_component.ThumbnailMode { - __x_ABI_CWindows_CStorage_CFileProperties_CThumbnailMode_SingleItem + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let picturesView = Self(rawValue: 0) + + public static let videosView = Self(rawValue: 1) + + public static let musicView = Self(rawValue: 2) + + public static let documentsView = Self(rawValue: 3) + + public static let listView = Self(rawValue: 4) + + public static let singleItem = Self(rawValue: 5) + } -extension test_component.ThumbnailMode: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct ThumbnailOptions : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.ThumbnailOptions { - public static var none : test_component.ThumbnailOptions { - __x_ABI_CWindows_CStorage_CFileProperties_CThumbnailOptions_None - } - public static var returnOnlyIfCached : test_component.ThumbnailOptions { - __x_ABI_CWindows_CStorage_CFileProperties_CThumbnailOptions_ReturnOnlyIfCached - } - public static var resizeThumbnail : test_component.ThumbnailOptions { - __x_ABI_CWindows_CStorage_CFileProperties_CThumbnailOptions_ResizeThumbnail - } - public static var useCurrentScale : test_component.ThumbnailOptions { - __x_ABI_CWindows_CStorage_CFileProperties_CThumbnailOptions_UseCurrentScale + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let none = Self(rawValue: 0) + + public static let returnOnlyIfCached = Self(rawValue: 1) + + public static let resizeThumbnail = Self(rawValue: 2) + + public static let useCurrentScale = Self(rawValue: 4) + } -extension test_component.ThumbnailOptions: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct ThumbnailType : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.ThumbnailType { - public static var image : test_component.ThumbnailType { - __x_ABI_CWindows_CStorage_CFileProperties_CThumbnailType_Image - } - public static var icon : test_component.ThumbnailType { - __x_ABI_CWindows_CStorage_CFileProperties_CThumbnailType_Icon + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let image = Self(rawValue: 0) + + public static let icon = Self(rawValue: 1) + } -extension test_component.ThumbnailType: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct VideoOrientation : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.VideoOrientation { - public static var normal : test_component.VideoOrientation { - __x_ABI_CWindows_CStorage_CFileProperties_CVideoOrientation_Normal - } - public static var rotate90 : test_component.VideoOrientation { - __x_ABI_CWindows_CStorage_CFileProperties_CVideoOrientation_Rotate90 + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } - public static var rotate180 : test_component.VideoOrientation { - __x_ABI_CWindows_CStorage_CFileProperties_CVideoOrientation_Rotate180 - } - public static var rotate270 : test_component.VideoOrientation { - __x_ABI_CWindows_CStorage_CFileProperties_CVideoOrientation_Rotate270 - } -} -extension test_component.VideoOrientation: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} + public static let normal = Self(rawValue: 0) + + public static let rotate90 = Self(rawValue: 90) + + public static let rotate180 = Self(rawValue: 180) + + public static let rotate270 = Self(rawValue: 270) + +} diff --git a/tests/test_component/Sources/test_component/Windows.Storage.Search+ABI.swift b/tests/test_component/Sources/test_component/Windows.Storage.Search+ABI.swift index 6d5872ae..226eacad 100644 --- a/tests/test_component/Sources/test_component/Windows.Storage.Search+ABI.swift +++ b/tests/test_component/Sources/test_component/Windows.Storage.Search+ABI.swift @@ -53,16 +53,16 @@ public enum __ABI_Windows_Storage_Search { } internal func get_FolderDepthImpl() throws -> test_component.FolderDepth { - var value: __x_ABI_CWindows_CStorage_CSearch_CFolderDepth = .init(0) + var value: __x_ABI_CWindows_CStorage_CSearch_CFolderDepth = .init(rawValue: 0) _ = try perform(as: __x_ABI_CWindows_CStorage_CSearch_CIQueryOptions.self) { pThis in try CHECKED(pThis.pointee.lpVtbl.pointee.get_FolderDepth(pThis, &value)) } - return value + return .init(rawValue: value.rawValue) } internal func put_FolderDepthImpl(_ value: test_component.FolderDepth) throws { _ = try perform(as: __x_ABI_CWindows_CStorage_CSearch_CIQueryOptions.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.put_FolderDepth(pThis, value)) + try CHECKED(pThis.pointee.lpVtbl.pointee.put_FolderDepth(pThis, .init(rawValue: value.rawValue))) } } @@ -112,16 +112,16 @@ public enum __ABI_Windows_Storage_Search { } internal func get_IndexerOptionImpl() throws -> test_component.IndexerOption { - var value: __x_ABI_CWindows_CStorage_CSearch_CIndexerOption = .init(0) + var value: __x_ABI_CWindows_CStorage_CSearch_CIndexerOption = .init(rawValue: 0) _ = try perform(as: __x_ABI_CWindows_CStorage_CSearch_CIQueryOptions.self) { pThis in try CHECKED(pThis.pointee.lpVtbl.pointee.get_IndexerOption(pThis, &value)) } - return value + return .init(rawValue: value.rawValue) } internal func put_IndexerOptionImpl(_ value: test_component.IndexerOption) throws { _ = try perform(as: __x_ABI_CWindows_CStorage_CSearch_CIQueryOptions.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.put_IndexerOption(pThis, value)) + try CHECKED(pThis.pointee.lpVtbl.pointee.put_IndexerOption(pThis, .init(rawValue: value.rawValue))) } } @@ -143,11 +143,11 @@ public enum __ABI_Windows_Storage_Search { } internal func get_DateStackOptionImpl() throws -> test_component.DateStackOption { - var value: __x_ABI_CWindows_CStorage_CSearch_CDateStackOption = .init(0) + var value: __x_ABI_CWindows_CStorage_CSearch_CDateStackOption = .init(rawValue: 0) _ = try perform(as: __x_ABI_CWindows_CStorage_CSearch_CIQueryOptions.self) { pThis in try CHECKED(pThis.pointee.lpVtbl.pointee.get_DateStackOption(pThis, &value)) } - return value + return .init(rawValue: value.rawValue) } internal func SaveToStringImpl() throws -> String { @@ -167,7 +167,7 @@ public enum __ABI_Windows_Storage_Search { internal func SetThumbnailPrefetchImpl(_ mode: test_component.ThumbnailMode, _ requestedSize: UInt32, _ options: test_component.ThumbnailOptions) throws { _ = try perform(as: __x_ABI_CWindows_CStorage_CSearch_CIQueryOptions.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.SetThumbnailPrefetch(pThis, mode, requestedSize, options)) + try CHECKED(pThis.pointee.lpVtbl.pointee.SetThumbnailPrefetch(pThis, .init(rawValue: mode.rawValue), requestedSize, .init(rawValue: options.rawValue))) } } @@ -175,7 +175,7 @@ public enum __ABI_Windows_Storage_Search { let propertiesToRetrieveWrapper = test_component.__x_ABI_C__FIIterable_1_HSTRINGWrapper(propertiesToRetrieve) let _propertiesToRetrieve = try! propertiesToRetrieveWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_CWindows_CStorage_CSearch_CIQueryOptions.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.SetPropertyPrefetch(pThis, options, _propertiesToRetrieve)) + try CHECKED(pThis.pointee.lpVtbl.pointee.SetPropertyPrefetch(pThis, .init(rawValue: options.rawValue), _propertiesToRetrieve)) } } @@ -189,7 +189,7 @@ public enum __ABI_Windows_Storage_Search { let fileTypeFilterWrapper = test_component.__x_ABI_C__FIIterable_1_HSTRINGWrapper(fileTypeFilter) let _fileTypeFilter = try! fileTypeFilterWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_CWindows_CStorage_CSearch_CIQueryOptionsFactory.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.CreateCommonFileQuery(pThis, query, _fileTypeFilter, &queryOptionsAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.CreateCommonFileQuery(pThis, .init(rawValue: query.rawValue), _fileTypeFilter, &queryOptionsAbi)) } } return IQueryOptions(queryOptions!) @@ -198,7 +198,7 @@ public enum __ABI_Windows_Storage_Search { internal func CreateCommonFolderQueryImpl(_ query: test_component.CommonFolderQuery) throws -> IQueryOptions { let (queryOptions) = try ComPtrs.initialize { queryOptionsAbi in _ = try perform(as: __x_ABI_CWindows_CStorage_CSearch_CIQueryOptionsFactory.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.CreateCommonFolderQuery(pThis, query, &queryOptionsAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.CreateCommonFolderQuery(pThis, .init(rawValue: query.rawValue), &queryOptionsAbi)) } } return IQueryOptions(queryOptions!) @@ -281,7 +281,7 @@ public enum __ABI_Windows_Storage_Search { open func CreateFileQueryImpl(_ query: test_component.CommonFileQuery) throws -> test_component.StorageFileQueryResult? { let (value) = try ComPtrs.initialize { valueAbi in _ = try perform(as: __x_ABI_CWindows_CStorage_CSearch_CIStorageFolderQueryOperations.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.CreateFileQuery(pThis, query, &valueAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.CreateFileQuery(pThis, .init(rawValue: query.rawValue), &valueAbi)) } } return .from(abi: value) @@ -308,7 +308,7 @@ public enum __ABI_Windows_Storage_Search { open func CreateFolderQueryImpl(_ query: test_component.CommonFolderQuery) throws -> test_component.StorageFolderQueryResult? { let (value) = try ComPtrs.initialize { valueAbi in _ = try perform(as: __x_ABI_CWindows_CStorage_CSearch_CIStorageFolderQueryOperations.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.CreateFolderQuery(pThis, query, &valueAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.CreateFolderQuery(pThis, .init(rawValue: query.rawValue), &valueAbi)) } } return .from(abi: value) @@ -344,7 +344,7 @@ public enum __ABI_Windows_Storage_Search { open func GetFilesAsyncImpl(_ query: test_component.CommonFileQuery, _ startIndex: UInt32, _ maxItemsToRetrieve: UInt32) throws -> test_component.AnyIAsyncOperation?>? { let (operation) = try ComPtrs.initialize { operationAbi in _ = try perform(as: __x_ABI_CWindows_CStorage_CSearch_CIStorageFolderQueryOperations.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.GetFilesAsync(pThis, query, startIndex, maxItemsToRetrieve, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.GetFilesAsync(pThis, .init(rawValue: query.rawValue), startIndex, maxItemsToRetrieve, &operationAbi)) } } return test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFileWrapper.unwrapFrom(abi: operation) @@ -353,7 +353,7 @@ public enum __ABI_Windows_Storage_Search { open func GetFilesAsyncOverloadDefaultStartAndCountImpl(_ query: test_component.CommonFileQuery) throws -> test_component.AnyIAsyncOperation?>? { let (operation) = try ComPtrs.initialize { operationAbi in _ = try perform(as: __x_ABI_CWindows_CStorage_CSearch_CIStorageFolderQueryOperations.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.GetFilesAsyncOverloadDefaultStartAndCount(pThis, query, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.GetFilesAsyncOverloadDefaultStartAndCount(pThis, .init(rawValue: query.rawValue), &operationAbi)) } } return test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFileWrapper.unwrapFrom(abi: operation) @@ -362,7 +362,7 @@ public enum __ABI_Windows_Storage_Search { open func GetFoldersAsyncImpl(_ query: test_component.CommonFolderQuery, _ startIndex: UInt32, _ maxItemsToRetrieve: UInt32) throws -> test_component.AnyIAsyncOperation?>? { let (operation) = try ComPtrs.initialize { operationAbi in _ = try perform(as: __x_ABI_CWindows_CStorage_CSearch_CIStorageFolderQueryOperations.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.GetFoldersAsync(pThis, query, startIndex, maxItemsToRetrieve, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.GetFoldersAsync(pThis, .init(rawValue: query.rawValue), startIndex, maxItemsToRetrieve, &operationAbi)) } } return test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper.unwrapFrom(abi: operation) @@ -371,7 +371,7 @@ public enum __ABI_Windows_Storage_Search { open func GetFoldersAsyncOverloadDefaultStartAndCountImpl(_ query: test_component.CommonFolderQuery) throws -> test_component.AnyIAsyncOperation?>? { let (operation) = try ComPtrs.initialize { operationAbi in _ = try perform(as: __x_ABI_CWindows_CStorage_CSearch_CIStorageFolderQueryOperations.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.GetFoldersAsyncOverloadDefaultStartAndCount(pThis, query, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.GetFoldersAsyncOverloadDefaultStartAndCount(pThis, .init(rawValue: query.rawValue), &operationAbi)) } } return test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper.unwrapFrom(abi: operation) @@ -397,7 +397,7 @@ public enum __ABI_Windows_Storage_Search { open func IsCommonFolderQuerySupportedImpl(_ query: test_component.CommonFolderQuery) throws -> Bool { var value: boolean = 0 _ = try perform(as: __x_ABI_CWindows_CStorage_CSearch_CIStorageFolderQueryOperations.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.IsCommonFolderQuerySupported(pThis, query, &value)) + try CHECKED(pThis.pointee.lpVtbl.pointee.IsCommonFolderQuerySupported(pThis, .init(rawValue: query.rawValue), &value)) } return .init(from: value) } @@ -405,7 +405,7 @@ public enum __ABI_Windows_Storage_Search { open func IsCommonFileQuerySupportedImpl(_ query: test_component.CommonFileQuery) throws -> Bool { var value: boolean = 0 _ = try perform(as: __x_ABI_CWindows_CStorage_CSearch_CIStorageFolderQueryOperations.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.IsCommonFileQuerySupported(pThis, query, &value)) + try CHECKED(pThis.pointee.lpVtbl.pointee.IsCommonFileQuerySupported(pThis, .init(rawValue: query.rawValue), &value)) } return .init(from: value) } @@ -462,7 +462,7 @@ public enum __ABI_Windows_Storage_Search { CreateFileQuery: { do { guard let __unwrapped__instance = IStorageFolderQueryOperationsWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let query: test_component.CommonFileQuery = $1 + let query: test_component.CommonFileQuery = .init(rawValue: $1.rawValue) let value = try __unwrapped__instance.createFileQuery(query) value?.copyTo($2) return S_OK @@ -491,7 +491,7 @@ public enum __ABI_Windows_Storage_Search { CreateFolderQuery: { do { guard let __unwrapped__instance = IStorageFolderQueryOperationsWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let query: test_component.CommonFolderQuery = $1 + let query: test_component.CommonFolderQuery = .init(rawValue: $1.rawValue) let value = try __unwrapped__instance.createFolderQuery(query) value?.copyTo($2) return S_OK @@ -530,7 +530,7 @@ public enum __ABI_Windows_Storage_Search { GetFilesAsync: { do { guard let __unwrapped__instance = IStorageFolderQueryOperationsWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let query: test_component.CommonFileQuery = $1 + let query: test_component.CommonFileQuery = .init(rawValue: $1.rawValue) let startIndex: UInt32 = $2 let maxItemsToRetrieve: UInt32 = $3 let operation = try __unwrapped__instance.getFilesAsync(query, startIndex, maxItemsToRetrieve) @@ -543,7 +543,7 @@ public enum __ABI_Windows_Storage_Search { GetFilesAsyncOverloadDefaultStartAndCount: { do { guard let __unwrapped__instance = IStorageFolderQueryOperationsWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let query: test_component.CommonFileQuery = $1 + let query: test_component.CommonFileQuery = .init(rawValue: $1.rawValue) let operation = try __unwrapped__instance.getFilesAsync(query) let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFileWrapper(operation) operationWrapper?.copyTo($2) @@ -554,7 +554,7 @@ public enum __ABI_Windows_Storage_Search { GetFoldersAsync: { do { guard let __unwrapped__instance = IStorageFolderQueryOperationsWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let query: test_component.CommonFolderQuery = $1 + let query: test_component.CommonFolderQuery = .init(rawValue: $1.rawValue) let startIndex: UInt32 = $2 let maxItemsToRetrieve: UInt32 = $3 let operation = try __unwrapped__instance.getFoldersAsync(query, startIndex, maxItemsToRetrieve) @@ -567,7 +567,7 @@ public enum __ABI_Windows_Storage_Search { GetFoldersAsyncOverloadDefaultStartAndCount: { do { guard let __unwrapped__instance = IStorageFolderQueryOperationsWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let query: test_component.CommonFolderQuery = $1 + let query: test_component.CommonFolderQuery = .init(rawValue: $1.rawValue) let operation = try __unwrapped__instance.getFoldersAsync(query) let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper(operation) operationWrapper?.copyTo($2) @@ -600,7 +600,7 @@ public enum __ABI_Windows_Storage_Search { IsCommonFolderQuerySupported: { do { guard let __unwrapped__instance = IStorageFolderQueryOperationsWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let query: test_component.CommonFolderQuery = $1 + let query: test_component.CommonFolderQuery = .init(rawValue: $1.rawValue) let value = try __unwrapped__instance.isCommonFolderQuerySupported(query) $2?.initialize(to: .init(from: value)) return S_OK @@ -610,7 +610,7 @@ public enum __ABI_Windows_Storage_Search { IsCommonFileQuerySupported: { do { guard let __unwrapped__instance = IStorageFolderQueryOperationsWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let query: test_component.CommonFileQuery = $1 + let query: test_component.CommonFileQuery = .init(rawValue: $1.rawValue) let value = try __unwrapped__instance.isCommonFileQuerySupported(query) $2?.initialize(to: .init(from: value)) return S_OK diff --git a/tests/test_component/Sources/test_component/Windows.Storage.Search.swift b/tests/test_component/Sources/test_component/Windows.Storage.Search.swift index c9cabb3f..a20dee7c 100644 --- a/tests/test_component/Sources/test_component/Windows.Storage.Search.swift +++ b/tests/test_component/Sources/test_component/Windows.Storage.Search.swift @@ -3,18 +3,6 @@ import Foundation import Ctest_component -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.search.commonfilequery) -public typealias CommonFileQuery = __x_ABI_CWindows_CStorage_CSearch_CCommonFileQuery -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.search.commonfolderquery) -public typealias CommonFolderQuery = __x_ABI_CWindows_CStorage_CSearch_CCommonFolderQuery -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.search.datestackoption) -public typealias DateStackOption = __x_ABI_CWindows_CStorage_CSearch_CDateStackOption -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.search.folderdepth) -public typealias FolderDepth = __x_ABI_CWindows_CStorage_CSearch_CFolderDepth -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.search.indexedstate) -public typealias IndexedState = __x_ABI_CWindows_CStorage_CSearch_CIndexedState -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.search.indexeroption) -public typealias IndexerOption = __x_ABI_CWindows_CStorage_CSearch_CIndexerOption /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.search.queryoptions) public final class QueryOptions : WinRTClass { private typealias SwiftABI = __ABI_Windows_Storage_Search.IQueryOptions @@ -523,123 +511,115 @@ extension IStorageQueryResultBase { } public typealias AnyIStorageQueryResultBase = any IStorageQueryResultBase -extension test_component.CommonFileQuery { - public static var defaultQuery : test_component.CommonFileQuery { - __x_ABI_CWindows_CStorage_CSearch_CCommonFileQuery_DefaultQuery - } - public static var orderByName : test_component.CommonFileQuery { - __x_ABI_CWindows_CStorage_CSearch_CCommonFileQuery_OrderByName - } - public static var orderByTitle : test_component.CommonFileQuery { - __x_ABI_CWindows_CStorage_CSearch_CCommonFileQuery_OrderByTitle - } - public static var orderByMusicProperties : test_component.CommonFileQuery { - __x_ABI_CWindows_CStorage_CSearch_CCommonFileQuery_OrderByMusicProperties - } - public static var orderBySearchRank : test_component.CommonFileQuery { - __x_ABI_CWindows_CStorage_CSearch_CCommonFileQuery_OrderBySearchRank - } - public static var orderByDate : test_component.CommonFileQuery { - __x_ABI_CWindows_CStorage_CSearch_CCommonFileQuery_OrderByDate +public struct CommonFileQuery : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 + + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let defaultQuery = Self(rawValue: 0) + + public static let orderByName = Self(rawValue: 1) + + public static let orderByTitle = Self(rawValue: 2) + + public static let orderByMusicProperties = Self(rawValue: 3) + + public static let orderBySearchRank = Self(rawValue: 4) + + public static let orderByDate = Self(rawValue: 5) + } -extension test_component.CommonFileQuery: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct CommonFolderQuery : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.CommonFolderQuery { - public static var defaultQuery : test_component.CommonFolderQuery { - __x_ABI_CWindows_CStorage_CSearch_CCommonFolderQuery_DefaultQuery - } - public static var groupByYear : test_component.CommonFolderQuery { - __x_ABI_CWindows_CStorage_CSearch_CCommonFolderQuery_GroupByYear - } - public static var groupByMonth : test_component.CommonFolderQuery { - __x_ABI_CWindows_CStorage_CSearch_CCommonFolderQuery_GroupByMonth - } - public static var groupByArtist : test_component.CommonFolderQuery { - __x_ABI_CWindows_CStorage_CSearch_CCommonFolderQuery_GroupByArtist - } - public static var groupByAlbum : test_component.CommonFolderQuery { - __x_ABI_CWindows_CStorage_CSearch_CCommonFolderQuery_GroupByAlbum - } - public static var groupByAlbumArtist : test_component.CommonFolderQuery { - __x_ABI_CWindows_CStorage_CSearch_CCommonFolderQuery_GroupByAlbumArtist - } - public static var groupByComposer : test_component.CommonFolderQuery { - __x_ABI_CWindows_CStorage_CSearch_CCommonFolderQuery_GroupByComposer - } - public static var groupByGenre : test_component.CommonFolderQuery { - __x_ABI_CWindows_CStorage_CSearch_CCommonFolderQuery_GroupByGenre - } - public static var groupByPublishedYear : test_component.CommonFolderQuery { - __x_ABI_CWindows_CStorage_CSearch_CCommonFolderQuery_GroupByPublishedYear - } - public static var groupByRating : test_component.CommonFolderQuery { - __x_ABI_CWindows_CStorage_CSearch_CCommonFolderQuery_GroupByRating - } - public static var groupByTag : test_component.CommonFolderQuery { - __x_ABI_CWindows_CStorage_CSearch_CCommonFolderQuery_GroupByTag - } - public static var groupByAuthor : test_component.CommonFolderQuery { - __x_ABI_CWindows_CStorage_CSearch_CCommonFolderQuery_GroupByAuthor - } - public static var groupByType : test_component.CommonFolderQuery { - __x_ABI_CWindows_CStorage_CSearch_CCommonFolderQuery_GroupByType + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let defaultQuery = Self(rawValue: 0) + + public static let groupByYear = Self(rawValue: 100) + + public static let groupByMonth = Self(rawValue: 101) + + public static let groupByArtist = Self(rawValue: 102) + + public static let groupByAlbum = Self(rawValue: 103) + + public static let groupByAlbumArtist = Self(rawValue: 104) + + public static let groupByComposer = Self(rawValue: 105) + + public static let groupByGenre = Self(rawValue: 106) + + public static let groupByPublishedYear = Self(rawValue: 107) + + public static let groupByRating = Self(rawValue: 108) + + public static let groupByTag = Self(rawValue: 109) + + public static let groupByAuthor = Self(rawValue: 110) + + public static let groupByType = Self(rawValue: 111) + } -extension test_component.CommonFolderQuery: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct DateStackOption : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.DateStackOption { - public static var none : test_component.DateStackOption { - __x_ABI_CWindows_CStorage_CSearch_CDateStackOption_None - } - public static var year : test_component.DateStackOption { - __x_ABI_CWindows_CStorage_CSearch_CDateStackOption_Year - } - public static var month : test_component.DateStackOption { - __x_ABI_CWindows_CStorage_CSearch_CDateStackOption_Month + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let none = Self(rawValue: 0) + + public static let year = Self(rawValue: 1) + + public static let month = Self(rawValue: 2) + } -extension test_component.DateStackOption: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct FolderDepth : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.FolderDepth { - public static var shallow : test_component.FolderDepth { - __x_ABI_CWindows_CStorage_CSearch_CFolderDepth_Shallow - } - public static var deep : test_component.FolderDepth { - __x_ABI_CWindows_CStorage_CSearch_CFolderDepth_Deep + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let shallow = Self(rawValue: 0) + + public static let deep = Self(rawValue: 1) + } -extension test_component.FolderDepth: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct IndexedState : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.IndexedState { - public static var unknown : test_component.IndexedState { - __x_ABI_CWindows_CStorage_CSearch_CIndexedState_Unknown - } - public static var notIndexed : test_component.IndexedState { - __x_ABI_CWindows_CStorage_CSearch_CIndexedState_NotIndexed - } - public static var partiallyIndexed : test_component.IndexedState { - __x_ABI_CWindows_CStorage_CSearch_CIndexedState_PartiallyIndexed - } - public static var fullyIndexed : test_component.IndexedState { - __x_ABI_CWindows_CStorage_CSearch_CIndexedState_FullyIndexed + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let unknown = Self(rawValue: 0) + + public static let notIndexed = Self(rawValue: 1) + + public static let partiallyIndexed = Self(rawValue: 2) + + public static let fullyIndexed = Self(rawValue: 3) + } -extension test_component.IndexedState: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct IndexerOption : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.IndexerOption { - public static var useIndexerWhenAvailable : test_component.IndexerOption { - __x_ABI_CWindows_CStorage_CSearch_CIndexerOption_UseIndexerWhenAvailable - } - public static var onlyUseIndexer : test_component.IndexerOption { - __x_ABI_CWindows_CStorage_CSearch_CIndexerOption_OnlyUseIndexer + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } - public static var doNotUseIndexer : test_component.IndexerOption { - __x_ABI_CWindows_CStorage_CSearch_CIndexerOption_DoNotUseIndexer - } - public static var onlyUseIndexerAndOptimizeForIndexedProperties : test_component.IndexerOption { - __x_ABI_CWindows_CStorage_CSearch_CIndexerOption_OnlyUseIndexerAndOptimizeForIndexedProperties - } -} -extension test_component.IndexerOption: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} + public static let useIndexerWhenAvailable = Self(rawValue: 0) + + public static let onlyUseIndexer = Self(rawValue: 1) + + public static let doNotUseIndexer = Self(rawValue: 2) + + public static let onlyUseIndexerAndOptimizeForIndexedProperties = Self(rawValue: 3) + +} diff --git a/tests/test_component/Sources/test_component/Windows.Storage.Streams+ABI.swift b/tests/test_component/Sources/test_component/Windows.Storage.Streams+ABI.swift index c9bfe36d..0c6669c2 100644 --- a/tests/test_component/Sources/test_component/Windows.Storage.Streams+ABI.swift +++ b/tests/test_component/Sources/test_component/Windows.Storage.Streams+ABI.swift @@ -222,7 +222,7 @@ public enum __ABI_Windows_Storage_Streams { let bufferWrapper = __ABI_Windows_Storage_Streams.IBufferWrapper(buffer) let _buffer = try! bufferWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_CWindows_CStorage_CStreams_CIInputStream.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.ReadAsync(pThis, _buffer, count, options, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.ReadAsync(pThis, _buffer, count, .init(rawValue: options.rawValue), &operationAbi)) } } return test_component.__x_ABI_C__FIAsyncOperationWithProgress_2___x_ABI_CWindows__CStorage__CStreams__CIBuffer_UINT32Wrapper.unwrapFrom(abi: operation) @@ -264,7 +264,7 @@ public enum __ABI_Windows_Storage_Streams { guard let __unwrapped__instance = IInputStreamWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let buffer: test_component.AnyIBuffer? = __ABI_Windows_Storage_Streams.IBufferWrapper.unwrapFrom(abi: ComPtr($1)) let count: UInt32 = $2 - let options: test_component.InputStreamOptions = $3 + let options: test_component.InputStreamOptions = .init(rawValue: $3.rawValue) let operation = try __unwrapped__instance.readAsync(buffer, count, options) let operationWrapper = test_component.__x_ABI_C__FIAsyncOperationWithProgress_2___x_ABI_CWindows__CStorage__CStreams__CIBuffer_UINT32Wrapper(operation) operationWrapper?.copyTo($4) diff --git a/tests/test_component/Sources/test_component/Windows.Storage.Streams.swift b/tests/test_component/Sources/test_component/Windows.Storage.Streams.swift index ce1dd256..7be53984 100644 --- a/tests/test_component/Sources/test_component/Windows.Storage.Streams.swift +++ b/tests/test_component/Sources/test_component/Windows.Storage.Streams.swift @@ -3,10 +3,6 @@ import Foundation import Ctest_component -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.streams.inputstreamoptions) -public typealias InputStreamOptions = __x_ABI_CWindows_CStorage_CStreams_CInputStreamOptions -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.streams.unicodeencoding) -public typealias UnicodeEncoding = __x_ABI_CWindows_CStorage_CStreams_CUnicodeEncoding /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.streams.buffer) public final class Buffer : WinRTClass, IBufferByteAccess, IBuffer { private typealias SwiftABI = __ABI_Windows_Storage_Streams.IBuffer @@ -273,29 +269,31 @@ extension IRandomAccessStreamWithContentType { } public typealias AnyIRandomAccessStreamWithContentType = any IRandomAccessStreamWithContentType -extension test_component.InputStreamOptions { - public static var none : test_component.InputStreamOptions { - __x_ABI_CWindows_CStorage_CStreams_CInputStreamOptions_None - } - public static var partial : test_component.InputStreamOptions { - __x_ABI_CWindows_CStorage_CStreams_CInputStreamOptions_Partial - } - public static var readAhead : test_component.InputStreamOptions { - __x_ABI_CWindows_CStorage_CStreams_CInputStreamOptions_ReadAhead +public struct InputStreamOptions : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 + + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let none = Self(rawValue: 0) + + public static let partial = Self(rawValue: 1) + + public static let readAhead = Self(rawValue: 2) + } -extension test_component.InputStreamOptions: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct UnicodeEncoding : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.UnicodeEncoding { - public static var utf8 : test_component.UnicodeEncoding { - __x_ABI_CWindows_CStorage_CStreams_CUnicodeEncoding_Utf8 + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } - public static var utf16LE : test_component.UnicodeEncoding { - __x_ABI_CWindows_CStorage_CStreams_CUnicodeEncoding_Utf16LE - } - public static var utf16BE : test_component.UnicodeEncoding { - __x_ABI_CWindows_CStorage_CStreams_CUnicodeEncoding_Utf16BE - } -} -extension test_component.UnicodeEncoding: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} + public static let utf8 = Self(rawValue: 0) + + public static let utf16LE = Self(rawValue: 1) + + public static let utf16BE = Self(rawValue: 2) + +} diff --git a/tests/test_component/Sources/test_component/Windows.Storage.swift b/tests/test_component/Sources/test_component/Windows.Storage.swift index 52b050a1..b0cb8b90 100644 --- a/tests/test_component/Sources/test_component/Windows.Storage.swift +++ b/tests/test_component/Sources/test_component/Windows.Storage.swift @@ -3,24 +3,6 @@ import Foundation import Ctest_component -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.creationcollisionoption) -public typealias CreationCollisionOption = __x_ABI_CWindows_CStorage_CCreationCollisionOption -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.fileaccessmode) -public typealias FileAccessMode = __x_ABI_CWindows_CStorage_CFileAccessMode -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.fileattributes) -public typealias FileAttributes = __x_ABI_CWindows_CStorage_CFileAttributes -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.namecollisionoption) -public typealias NameCollisionOption = __x_ABI_CWindows_CStorage_CNameCollisionOption -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.storagedeleteoption) -public typealias StorageDeleteOption = __x_ABI_CWindows_CStorage_CStorageDeleteOption -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.storageitemtypes) -public typealias StorageItemTypes = __x_ABI_CWindows_CStorage_CStorageItemTypes -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.storagelibrarychangetype) -public typealias StorageLibraryChangeType = __x_ABI_CWindows_CStorage_CStorageLibraryChangeType -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.storageopenoptions) -public typealias StorageOpenOptions = __x_ABI_CWindows_CStorage_CStorageOpenOptions -/// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.streamedfilefailuremode) -public typealias StreamedFileFailureMode = __x_ABI_CWindows_CStorage_CStreamedFileFailureMode /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.storage.pathio) public final class PathIO { private static let _IPathIOStatics: __ABI_Windows_Storage.IPathIOStatics = try! RoGetActivationFactory("Windows.Storage.PathIO") @@ -1277,147 +1259,147 @@ extension IStreamedFileDataRequest { } public typealias AnyIStreamedFileDataRequest = any IStreamedFileDataRequest -extension test_component.CreationCollisionOption { - public static var generateUniqueName : test_component.CreationCollisionOption { - __x_ABI_CWindows_CStorage_CCreationCollisionOption_GenerateUniqueName - } - public static var replaceExisting : test_component.CreationCollisionOption { - __x_ABI_CWindows_CStorage_CCreationCollisionOption_ReplaceExisting - } - public static var failIfExists : test_component.CreationCollisionOption { - __x_ABI_CWindows_CStorage_CCreationCollisionOption_FailIfExists - } - public static var openIfExists : test_component.CreationCollisionOption { - __x_ABI_CWindows_CStorage_CCreationCollisionOption_OpenIfExists +public struct CreationCollisionOption : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 + + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let generateUniqueName = Self(rawValue: 0) + + public static let replaceExisting = Self(rawValue: 1) + + public static let failIfExists = Self(rawValue: 2) + + public static let openIfExists = Self(rawValue: 3) + } -extension test_component.CreationCollisionOption: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct FileAccessMode : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.FileAccessMode { - public static var read : test_component.FileAccessMode { - __x_ABI_CWindows_CStorage_CFileAccessMode_Read - } - public static var readWrite : test_component.FileAccessMode { - __x_ABI_CWindows_CStorage_CFileAccessMode_ReadWrite + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let read = Self(rawValue: 0) + + public static let readWrite = Self(rawValue: 1) + } -extension test_component.FileAccessMode: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct FileAttributes : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.FileAttributes { - public static var normal : test_component.FileAttributes { - __x_ABI_CWindows_CStorage_CFileAttributes_Normal - } - public static var readOnly : test_component.FileAttributes { - __x_ABI_CWindows_CStorage_CFileAttributes_ReadOnly - } - public static var directory : test_component.FileAttributes { - __x_ABI_CWindows_CStorage_CFileAttributes_Directory - } - public static var archive : test_component.FileAttributes { - __x_ABI_CWindows_CStorage_CFileAttributes_Archive - } - public static var temporary : test_component.FileAttributes { - __x_ABI_CWindows_CStorage_CFileAttributes_Temporary - } - public static var locallyIncomplete : test_component.FileAttributes { - __x_ABI_CWindows_CStorage_CFileAttributes_LocallyIncomplete + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let normal = Self(rawValue: 0) + + public static let readOnly = Self(rawValue: 1) + + public static let directory = Self(rawValue: 16) + + public static let archive = Self(rawValue: 32) + + public static let temporary = Self(rawValue: 256) + + public static let locallyIncomplete = Self(rawValue: 512) + } -extension test_component.FileAttributes: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct NameCollisionOption : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.NameCollisionOption { - public static var generateUniqueName : test_component.NameCollisionOption { - __x_ABI_CWindows_CStorage_CNameCollisionOption_GenerateUniqueName - } - public static var replaceExisting : test_component.NameCollisionOption { - __x_ABI_CWindows_CStorage_CNameCollisionOption_ReplaceExisting - } - public static var failIfExists : test_component.NameCollisionOption { - __x_ABI_CWindows_CStorage_CNameCollisionOption_FailIfExists + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let generateUniqueName = Self(rawValue: 0) + + public static let replaceExisting = Self(rawValue: 1) + + public static let failIfExists = Self(rawValue: 2) + } -extension test_component.NameCollisionOption: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct StorageDeleteOption : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.StorageDeleteOption { - public static var `default` : test_component.StorageDeleteOption { - __x_ABI_CWindows_CStorage_CStorageDeleteOption_Default - } - public static var permanentDelete : test_component.StorageDeleteOption { - __x_ABI_CWindows_CStorage_CStorageDeleteOption_PermanentDelete + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let `default` = Self(rawValue: 0) + + public static let permanentDelete = Self(rawValue: 1) + } -extension test_component.StorageDeleteOption: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct StorageItemTypes : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.StorageItemTypes { - public static var none : test_component.StorageItemTypes { - __x_ABI_CWindows_CStorage_CStorageItemTypes_None - } - public static var file : test_component.StorageItemTypes { - __x_ABI_CWindows_CStorage_CStorageItemTypes_File - } - public static var folder : test_component.StorageItemTypes { - __x_ABI_CWindows_CStorage_CStorageItemTypes_Folder + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let none = Self(rawValue: 0) + + public static let file = Self(rawValue: 1) + + public static let folder = Self(rawValue: 2) + } -extension test_component.StorageItemTypes: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct StorageLibraryChangeType : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.StorageLibraryChangeType { - public static var created : test_component.StorageLibraryChangeType { - __x_ABI_CWindows_CStorage_CStorageLibraryChangeType_Created - } - public static var deleted : test_component.StorageLibraryChangeType { - __x_ABI_CWindows_CStorage_CStorageLibraryChangeType_Deleted - } - public static var movedOrRenamed : test_component.StorageLibraryChangeType { - __x_ABI_CWindows_CStorage_CStorageLibraryChangeType_MovedOrRenamed - } - public static var contentsChanged : test_component.StorageLibraryChangeType { - __x_ABI_CWindows_CStorage_CStorageLibraryChangeType_ContentsChanged - } - public static var movedOutOfLibrary : test_component.StorageLibraryChangeType { - __x_ABI_CWindows_CStorage_CStorageLibraryChangeType_MovedOutOfLibrary - } - public static var movedIntoLibrary : test_component.StorageLibraryChangeType { - __x_ABI_CWindows_CStorage_CStorageLibraryChangeType_MovedIntoLibrary - } - public static var contentsReplaced : test_component.StorageLibraryChangeType { - __x_ABI_CWindows_CStorage_CStorageLibraryChangeType_ContentsReplaced - } - public static var indexingStatusChanged : test_component.StorageLibraryChangeType { - __x_ABI_CWindows_CStorage_CStorageLibraryChangeType_IndexingStatusChanged - } - public static var encryptionChanged : test_component.StorageLibraryChangeType { - __x_ABI_CWindows_CStorage_CStorageLibraryChangeType_EncryptionChanged - } - public static var changeTrackingLost : test_component.StorageLibraryChangeType { - __x_ABI_CWindows_CStorage_CStorageLibraryChangeType_ChangeTrackingLost + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let created = Self(rawValue: 0) + + public static let deleted = Self(rawValue: 1) + + public static let movedOrRenamed = Self(rawValue: 2) + + public static let contentsChanged = Self(rawValue: 3) + + public static let movedOutOfLibrary = Self(rawValue: 4) + + public static let movedIntoLibrary = Self(rawValue: 5) + + public static let contentsReplaced = Self(rawValue: 6) + + public static let indexingStatusChanged = Self(rawValue: 7) + + public static let encryptionChanged = Self(rawValue: 8) + + public static let changeTrackingLost = Self(rawValue: 9) + } -extension test_component.StorageLibraryChangeType: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct StorageOpenOptions : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.StorageOpenOptions { - public static var none : test_component.StorageOpenOptions { - __x_ABI_CWindows_CStorage_CStorageOpenOptions_None - } - public static var allowOnlyReaders : test_component.StorageOpenOptions { - __x_ABI_CWindows_CStorage_CStorageOpenOptions_AllowOnlyReaders - } - public static var allowReadersAndWriters : test_component.StorageOpenOptions { - __x_ABI_CWindows_CStorage_CStorageOpenOptions_AllowReadersAndWriters + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let none = Self(rawValue: 0) + + public static let allowOnlyReaders = Self(rawValue: 1) + + public static let allowReadersAndWriters = Self(rawValue: 2) + } -extension test_component.StorageOpenOptions: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct StreamedFileFailureMode : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.StreamedFileFailureMode { - public static var failed : test_component.StreamedFileFailureMode { - __x_ABI_CWindows_CStorage_CStreamedFileFailureMode_Failed - } - public static var currentlyUnavailable : test_component.StreamedFileFailureMode { - __x_ABI_CWindows_CStorage_CStreamedFileFailureMode_CurrentlyUnavailable + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } - public static var incomplete : test_component.StreamedFileFailureMode { - __x_ABI_CWindows_CStorage_CStreamedFileFailureMode_Incomplete - } -} -extension test_component.StreamedFileFailureMode: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} + public static let failed = Self(rawValue: 0) + + public static let currentlyUnavailable = Self(rawValue: 1) + + public static let incomplete = Self(rawValue: 2) + +} diff --git a/tests/test_component/Sources/test_component/test_component+ABI.swift b/tests/test_component/Sources/test_component/test_component+ABI.swift index ba036543..28d6c6e9 100644 --- a/tests/test_component/Sources/test_component/test_component+ABI.swift +++ b/tests/test_component/Sources/test_component/test_component+ABI.swift @@ -625,7 +625,7 @@ public enum __ABI_test_component { internal func InEnumImpl(_ value: test_component.Signed) throws -> String { var result: HSTRING? _ = try perform(as: __x_ABI_Ctest__component_CIClass.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.InEnum(pThis, value, &result)) + try CHECKED(pThis.pointee.lpVtbl.pointee.InEnum(pThis, .init(rawValue: value.rawValue), &result)) } return .init(from: result) } @@ -680,9 +680,11 @@ public enum __ABI_test_component { } internal func OutEnumImpl(_ value: inout test_component.Signed) throws { + var _value: __x_ABI_Ctest__component_CSigned = .init(rawValue: value.rawValue) _ = try perform(as: __x_ABI_Ctest__component_CIClass.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.OutEnum(pThis, &value)) + try CHECKED(pThis.pointee.lpVtbl.pointee.OutEnum(pThis, &_value)) } + value = .init(rawValue: _value.rawValue) } internal func ReturnObjectImpl() throws -> Any? { @@ -695,11 +697,11 @@ public enum __ABI_test_component { } internal func ReturnEnumImpl() throws -> test_component.Signed { - var result: __x_ABI_Ctest__component_CSigned = .init(0) + var result: __x_ABI_Ctest__component_CSigned = .init(rawValue: 0) _ = try perform(as: __x_ABI_Ctest__component_CIClass.self) { pThis in try CHECKED(pThis.pointee.lpVtbl.pointee.ReturnEnum(pThis, &result)) } - return result + return .init(rawValue: result.rawValue) } internal func ReturnReferenceEnumImpl() throws -> test_component.Signed? { @@ -712,16 +714,16 @@ public enum __ABI_test_component { } internal func get_EnumPropertyImpl() throws -> test_component.Fruit { - var value: __x_ABI_Ctest__component_CFruit = .init(0) + var value: __x_ABI_Ctest__component_CFruit = .init(rawValue: 0) _ = try perform(as: __x_ABI_Ctest__component_CIClass.self) { pThis in try CHECKED(pThis.pointee.lpVtbl.pointee.get_EnumProperty(pThis, &value)) } - return value + return .init(rawValue: value.rawValue) } internal func put_EnumPropertyImpl(_ value: test_component.Fruit) throws { _ = try perform(as: __x_ABI_Ctest__component_CIClass.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.put_EnumProperty(pThis, value)) + try CHECKED(pThis.pointee.lpVtbl.pointee.put_EnumProperty(pThis, .init(rawValue: value.rawValue))) } } @@ -879,7 +881,7 @@ public enum __ABI_test_component { let (value) = try ComPtrs.initialize { valueAbi in let _name = try! HString(name) _ = try perform(as: __x_ABI_Ctest__component_CIClassFactory.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.CreateInstance2(pThis, _name.get(), fruit, &valueAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.CreateInstance2(pThis, _name.get(), .init(rawValue: fruit.rawValue), &valueAbi)) } } return IClass(value!) @@ -940,7 +942,7 @@ public enum __ABI_test_component { let implementationWrapper = __ABI_test_component.IIAmImplementableWrapper(implementation) let _implementation = try! implementationWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_Ctest__component_CIClassFactory2.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.CreateInstance(pThis, _name.get(), fruit, _implementation, &valueAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.CreateInstance(pThis, _name.get(), .init(rawValue: fruit.rawValue), _implementation, &valueAbi)) } } return IClass(value!) @@ -1246,7 +1248,7 @@ public enum __ABI_test_component { open func InEnumImpl(_ value: test_component.Signed) throws -> String { var result: HSTRING? _ = try perform(as: __x_ABI_Ctest__component_CIIAmImplementable.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.InEnum(pThis, value, &result)) + try CHECKED(pThis.pointee.lpVtbl.pointee.InEnum(pThis, .init(rawValue: value.rawValue), &result)) } return .init(from: result) } @@ -1292,9 +1294,11 @@ public enum __ABI_test_component { } open func OutEnumImpl(_ value: inout test_component.Signed) throws { + var _value: __x_ABI_Ctest__component_CSigned = .init(rawValue: value.rawValue) _ = try perform(as: __x_ABI_Ctest__component_CIIAmImplementable.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.OutEnum(pThis, &value)) + try CHECKED(pThis.pointee.lpVtbl.pointee.OutEnum(pThis, &_value)) } + value = .init(rawValue: _value.rawValue) } open func ReturnObjectImpl() throws -> Any? { @@ -1307,24 +1311,24 @@ public enum __ABI_test_component { } open func ReturnEnumImpl() throws -> test_component.Signed { - var result: __x_ABI_Ctest__component_CSigned = .init(0) + var result: __x_ABI_Ctest__component_CSigned = .init(rawValue: 0) _ = try perform(as: __x_ABI_Ctest__component_CIIAmImplementable.self) { pThis in try CHECKED(pThis.pointee.lpVtbl.pointee.ReturnEnum(pThis, &result)) } - return result + return .init(rawValue: result.rawValue) } open func get_EnumPropertyImpl() throws -> test_component.Fruit { - var value: __x_ABI_Ctest__component_CFruit = .init(0) + var value: __x_ABI_Ctest__component_CFruit = .init(rawValue: 0) _ = try perform(as: __x_ABI_Ctest__component_CIIAmImplementable.self) { pThis in try CHECKED(pThis.pointee.lpVtbl.pointee.get_EnumProperty(pThis, &value)) } - return value + return .init(rawValue: value.rawValue) } open func put_EnumPropertyImpl(_ value: test_component.Fruit) throws { _ = try perform(as: __x_ABI_Ctest__component_CIIAmImplementable.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.put_EnumProperty(pThis, value)) + try CHECKED(pThis.pointee.lpVtbl.pointee.put_EnumProperty(pThis, .init(rawValue: value.rawValue))) } } @@ -1431,7 +1435,7 @@ public enum __ABI_test_component { InEnum: { do { guard let __unwrapped__instance = IIAmImplementableWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let value: test_component.Signed = $1 + let value: test_component.Signed = .init(rawValue: $1.rawValue) let result = try __unwrapped__instance.inEnum(value) $2?.initialize(to: try! HString(result).detach()) return S_OK @@ -1493,9 +1497,9 @@ public enum __ABI_test_component { OutEnum: { do { guard let __unwrapped__instance = IIAmImplementableWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - var value: test_component.Signed = .init(0) + var value: test_component.Signed = .init(rawValue: 0) try __unwrapped__instance.outEnum(&value) - $1?.initialize(to: value) + $1?.initialize(to: .init(rawValue: value.rawValue)) return S_OK } catch { return failWith(err: E_FAIL) } }, @@ -1514,7 +1518,7 @@ public enum __ABI_test_component { do { guard let __unwrapped__instance = IIAmImplementableWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let result = try __unwrapped__instance.returnEnum() - $1?.initialize(to: result) + $1?.initialize(to: .init(rawValue: result.rawValue)) return S_OK } catch { return failWith(err: E_FAIL) } }, @@ -1522,13 +1526,13 @@ public enum __ABI_test_component { get_EnumProperty: { guard let __unwrapped__instance = IIAmImplementableWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let value = __unwrapped__instance.enumProperty - $1?.initialize(to: value) + $1?.initialize(to: .init(rawValue: value.rawValue)) return S_OK }, put_EnumProperty: { guard let __unwrapped__instance = IIAmImplementableWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } - let value: test_component.Fruit = $1 + let value: test_component.Fruit = .init(rawValue: $1.rawValue) __unwrapped__instance.enumProperty = value return S_OK }, @@ -2074,23 +2078,23 @@ public enum __ABI_test_component { override public class var IID: test_component.IID { IID___x_ABI_Ctest__component_CIStaticClassStatics } internal func get_EnumPropertyImpl() throws -> test_component.Fruit { - var value: __x_ABI_Ctest__component_CFruit = .init(0) + var value: __x_ABI_Ctest__component_CFruit = .init(rawValue: 0) _ = try perform(as: __x_ABI_Ctest__component_CIStaticClassStatics.self) { pThis in try CHECKED(pThis.pointee.lpVtbl.pointee.get_EnumProperty(pThis, &value)) } - return value + return .init(rawValue: value.rawValue) } internal func put_EnumPropertyImpl(_ value: test_component.Fruit) throws { _ = try perform(as: __x_ABI_Ctest__component_CIStaticClassStatics.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.put_EnumProperty(pThis, value)) + try CHECKED(pThis.pointee.lpVtbl.pointee.put_EnumProperty(pThis, .init(rawValue: value.rawValue))) } } internal func InEnumImpl(_ value: test_component.Signed) throws -> String { var result: HSTRING? _ = try perform(as: __x_ABI_Ctest__component_CIStaticClassStatics.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.InEnum(pThis, value, &result)) + try CHECKED(pThis.pointee.lpVtbl.pointee.InEnum(pThis, .init(rawValue: value.rawValue), &result)) } return .init(from: result) } @@ -2767,7 +2771,7 @@ extension __x_ABI_Ctest__component_CBlittableStruct { } extension __x_ABI_Ctest__component_CStructWithEnum { public static func from(swift: test_component.StructWithEnum) -> __x_ABI_Ctest__component_CStructWithEnum { - .init(Names: swift.names) + .init(Names: .init(rawValue: swift.names.rawValue)) } } extension ComposableImpl where CABI == __x_ABI_Ctest__component_CIBaseOverrides { diff --git a/tests/test_component/Sources/test_component/test_component+Generics.swift b/tests/test_component/Sources/test_component/test_component+Generics.swift index 715e7de0..997a1702 100644 --- a/tests/test_component/Sources/test_component/test_component+Generics.swift +++ b/tests/test_component/Sources/test_component/test_component+Generics.swift @@ -22,7 +22,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1_booleanVTable: __x_AB do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1_booleanWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation? = test_component.__x_ABI_C__FIAsyncOperation_1_booleanWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -36,7 +36,7 @@ internal class AsyncOperationCompletedHandlerBool: test_component.IUnknown { let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1_booleanWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1_boolean.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -75,7 +75,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1_intVTable: __x_ABI_C_ do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1_intWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation? = test_component.__x_ABI_C__FIAsyncOperation_1_intWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -89,7 +89,7 @@ internal class AsyncOperationCompletedHandlerInt32: test_component.IUnknown { let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1_intWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1_int.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -128,7 +128,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1_HSTRINGVTable: __x_AB do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1_HSTRINGWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation? = test_component.__x_ABI_C__FIAsyncOperation_1_HSTRINGWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -142,7 +142,7 @@ internal class AsyncOperationCompletedHandlerString: test_component.IUnknown { let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1_HSTRINGWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1_HSTRING.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -181,7 +181,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1_UINT32VTable: __x_ABI do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1_UINT32Wrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation? = test_component.__x_ABI_C__FIAsyncOperation_1_UINT32Wrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -195,7 +195,7 @@ internal class AsyncOperationCompletedHandlerUInt32: test_component.IUnknown { let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1_UINT32Wrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1_UINT32.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -234,7 +234,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIMap_2_HS do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIMap_2_HSTRING_IInspectableWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation?>? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIMap_2_HSTRING_IInspectableWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -248,7 +248,7 @@ internal class AsyncOperationCompletedHandlerIMapString_Any: test_component.IUnk let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIMap_2_HSTRING_IInspectableWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIMap_2_HSTRING_IInspectable.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -287,7 +287,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVectorVi do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CIStorageItemWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation?>? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CIStorageItemWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -301,7 +301,7 @@ internal class AsyncOperationCompletedHandlerIVectorViewIStorageItem: test_compo let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CIStorageItemWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CIStorageItem.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -340,7 +340,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVectorVi do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFileWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation?>? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFileWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -354,7 +354,7 @@ internal class AsyncOperationCompletedHandlerIVectorViewStorageFile: test_compon let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFileWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFile.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -393,7 +393,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVectorVi do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation?>? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -407,7 +407,7 @@ internal class AsyncOperationCompletedHandlerIVectorViewStorageFolder: test_comp let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFolder.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -446,7 +446,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVectorVi do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageLibraryChangeWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation?>? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageLibraryChangeWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -460,7 +460,7 @@ internal class AsyncOperationCompletedHandlerIVectorViewStorageLibraryChange: te let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageLibraryChangeWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageLibraryChange.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -499,7 +499,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVector_1 do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVector_1_HSTRINGWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation?>? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVector_1_HSTRINGWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -513,7 +513,7 @@ internal class AsyncOperationCompletedHandlerIVectorString: test_component.IUnkn let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVector_1_HSTRINGWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVector_1_HSTRING.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -552,7 +552,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CFileProperties__CBasicPropertiesWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CBasicPropertiesWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -566,7 +566,7 @@ internal class AsyncOperationCompletedHandlerBasicProperties: test_component.IUn let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CBasicPropertiesWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CFileProperties__CBasicProperties.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -605,7 +605,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CFileProperties__CDocumentPropertiesWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CDocumentPropertiesWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -619,7 +619,7 @@ internal class AsyncOperationCompletedHandlerDocumentProperties: test_component. let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CDocumentPropertiesWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CFileProperties__CDocumentProperties.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -658,7 +658,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CFileProperties__CImagePropertiesWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CImagePropertiesWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -672,7 +672,7 @@ internal class AsyncOperationCompletedHandlerImageProperties: test_component.IUn let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CImagePropertiesWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CFileProperties__CImageProperties.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -711,7 +711,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CFileProperties__CMusicPropertiesWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CMusicPropertiesWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -725,7 +725,7 @@ internal class AsyncOperationCompletedHandlerMusicProperties: test_component.IUn let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CMusicPropertiesWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CFileProperties__CMusicProperties.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -764,7 +764,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -778,7 +778,7 @@ internal class AsyncOperationCompletedHandlerStorageItemThumbnail: test_componen let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnail.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -817,7 +817,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CFileProperties__CVideoPropertiesWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CVideoPropertiesWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -831,7 +831,7 @@ internal class AsyncOperationCompletedHandlerVideoProperties: test_component.IUn let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CVideoPropertiesWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CFileProperties__CVideoProperties.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -870,7 +870,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CIStorageItemWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CIStorageItemWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -884,7 +884,7 @@ internal class AsyncOperationCompletedHandlerIStorageItem: test_component.IUnkno let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CIStorageItemWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CIStorageItem.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -923,7 +923,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CSearch__CIndexedStateWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CSearch__CIndexedStateWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -937,7 +937,7 @@ internal class AsyncOperationCompletedHandlerIndexedState: test_component.IUnkno let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CSearch__CIndexedStateWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CSearch__CIndexedState.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -976,7 +976,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStorageFileWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFileWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -990,7 +990,7 @@ internal class AsyncOperationCompletedHandlerStorageFile: test_component.IUnknow let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFileWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStorageFile.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -1029,7 +1029,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -1043,7 +1043,7 @@ internal class AsyncOperationCompletedHandlerStorageFolder: test_component.IUnkn let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStorageFolder.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -1082,7 +1082,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStorageStreamTransactionWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageStreamTransactionWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -1096,7 +1096,7 @@ internal class AsyncOperationCompletedHandlerStorageStreamTransaction: test_comp let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageStreamTransactionWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStorageStreamTransaction.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -1135,7 +1135,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStreams__CIBufferWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams__CIBufferWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -1149,7 +1149,7 @@ internal class AsyncOperationCompletedHandlerIBuffer: test_component.IUnknown { let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams__CIBufferWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStreams__CIBuffer.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -1188,7 +1188,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStreams__CIInputStreamWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams__CIInputStreamWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -1202,7 +1202,7 @@ internal class AsyncOperationCompletedHandlerIInputStream: test_component.IUnkno let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams__CIInputStreamWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStreams__CIInputStream.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -1241,7 +1241,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStreams__CIRandomAccessStreamWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams__CIRandomAccessStreamWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -1255,7 +1255,7 @@ internal class AsyncOperationCompletedHandlerIRandomAccessStream: test_component let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams__CIRandomAccessStreamWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStreams__CIRandomAccessStream.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -1294,7 +1294,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStreams__CIRandomAccessStreamWithContentTypeWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperation? = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams__CIRandomAccessStreamWithContentTypeWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -1308,7 +1308,7 @@ internal class AsyncOperationCompletedHandlerIRandomAccessStreamWithContentType: let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams__CIRandomAccessStreamWithContentTypeWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStreams__CIRandomAccessStreamWithContentType.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -1506,7 +1506,7 @@ internal var __x_ABI_C__FIAsyncOperationWithProgressCompletedHandler_2_int_doubl do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationWithProgressCompletedHandler_2_int_doubleWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperationWithProgress? = test_component.__x_ABI_C__FIAsyncOperationWithProgress_2_int_doubleWrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -1520,7 +1520,7 @@ internal class AsyncOperationWithProgressCompletedHandlerInt32_Double: test_comp let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperationWithProgress_2_int_doubleWrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationWithProgressCompletedHandler_2_int_double.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -1559,7 +1559,7 @@ internal var __x_ABI_C__FIAsyncOperationWithProgressCompletedHandler_2_UINT32_UI do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationWithProgressCompletedHandler_2_UINT32_UINT32Wrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperationWithProgress? = test_component.__x_ABI_C__FIAsyncOperationWithProgress_2_UINT32_UINT32Wrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -1573,7 +1573,7 @@ internal class AsyncOperationWithProgressCompletedHandlerUInt32_UInt32: test_com let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperationWithProgress_2_UINT32_UINT32Wrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationWithProgressCompletedHandler_2_UINT32_UINT32.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -1612,7 +1612,7 @@ internal var __x_ABI_C__FIAsyncOperationWithProgressCompletedHandler_2___x_ABI_C do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperationWithProgressCompletedHandler_2___x_ABI_CWindows__CStorage__CStreams__CIBuffer_UINT32Wrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let asyncInfo: test_component.AnyIAsyncOperationWithProgress? = test_component.__x_ABI_C__FIAsyncOperationWithProgress_2___x_ABI_CWindows__CStorage__CStreams__CIBuffer_UINT32Wrapper.unwrapFrom(abi: ComPtr($1)) - let asyncStatus: test_component.AsyncStatus = $2 + let asyncStatus: test_component.AsyncStatus = .init(rawValue: $2.rawValue) try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK } catch { return failWith(err: E_FAIL) } @@ -1626,7 +1626,7 @@ internal class AsyncOperationWithProgressCompletedHandlerIBuffer_UInt32: test_co let asyncInfoWrapper = test_component.__x_ABI_C__FIAsyncOperationWithProgress_2___x_ABI_CWindows__CStorage__CStreams__CIBuffer_UINT32Wrapper(asyncInfo) let _asyncInfo = try! asyncInfoWrapper?.toABI { $0 } _ = try perform(as: __x_ABI_C__FIAsyncOperationWithProgressCompletedHandler_2___x_ABI_CWindows__CStorage__CStreams__CIBuffer_UINT32.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, asyncStatus)) + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _asyncInfo, .init(rawValue: asyncStatus.rawValue))) } } @@ -5555,7 +5555,7 @@ internal var __x_ABI_C__FIMapChangedEventArgs_1_HSTRINGVTable: __x_ABI_C__FIMapC get_CollectionChange: { guard let __unwrapped__instance = __x_ABI_C__FIMapChangedEventArgs_1_HSTRINGWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let result = __unwrapped__instance.collectionChange - $1?.initialize(to: result) + $1?.initialize(to: .init(rawValue: result.rawValue)) return S_OK }, @@ -5571,11 +5571,11 @@ internal class IMapChangedEventArgsString: test_component.IInspectable { override public class var IID: test_component.IID { IID___x_ABI_C__FIMapChangedEventArgs_1_HSTRING } internal func get_CollectionChangeImpl() throws -> test_component.CollectionChange { - var result: __x_ABI_CWindows_CFoundation_CCollections_CCollectionChange = .init(0) + var result: __x_ABI_CWindows_CFoundation_CCollections_CCollectionChange = .init(rawValue: 0) _ = try perform(as: __x_ABI_C__FIMapChangedEventArgs_1_HSTRING.self) { pThis in try CHECKED(pThis.pointee.lpVtbl.pointee.get_CollectionChange(pThis, &result)) } - return result + return .init(rawValue: result.rawValue) } internal func get_KeyImpl() throws -> String { @@ -15149,7 +15149,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CSearch__ do { guard let __unwrapped__instance = __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CSearch__CIndexedStateWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let result = try __unwrapped__instance.getResults() - $1?.initialize(to: result) + $1?.initialize(to: .init(rawValue: result.rawValue)) return S_OK } catch { return failWith(err: E_FAIL) } } @@ -15176,11 +15176,11 @@ internal class IAsyncOperationIndexedState: test_component.IInspectable { } internal func GetResultsImpl() throws -> test_component.IndexedState { - var result: __x_ABI_CWindows_CStorage_CSearch_CIndexedState = .init(0) + var result: __x_ABI_CWindows_CStorage_CSearch_CIndexedState = .init(rawValue: 0) _ = try perform(as: __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CSearch__CIndexedState.self) { pThis in try CHECKED(pThis.pointee.lpVtbl.pointee.GetResults(pThis, &result)) } - return result + return .init(rawValue: result.rawValue) } } @@ -16509,9 +16509,9 @@ internal enum __x_ABI_C__FIReference_1___x_ABI_Ctest__zcomponent__CSignedBridge: static func from(abi: ComPtr?) -> SwiftProjection? { guard let val = abi else { return nil } - var result: __x_ABI_Ctest__component_CSigned = .init(0) + var result: __x_ABI_Ctest__component_CSigned = .init(rawValue: 0) try! CHECKED(val.get().pointee.lpVtbl.pointee.get_Value(val.get(), &result)) - return result + return .init(rawValue: result.rawValue) } static func makeAbi() -> CABI { @@ -16551,7 +16551,7 @@ internal var __x_ABI_C__FIReference_1___x_ABI_Ctest__zcomponent__CSignedVTable: get_Value: { guard let __unwrapped__instance = __x_ABI_C__FIReference_1___x_ABI_Ctest__zcomponent__CSignedWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } let result = __unwrapped__instance - $1?.initialize(to: result) + $1?.initialize(to: .init(rawValue: result.rawValue)) return S_OK } ) diff --git a/tests/test_component/Sources/test_component/test_component.swift b/tests/test_component/Sources/test_component/test_component.swift index 850b4fdc..302e4188 100644 --- a/tests/test_component/Sources/test_component/test_component.swift +++ b/tests/test_component/Sources/test_component/test_component.swift @@ -3,11 +3,6 @@ import Foundation import Ctest_component -public typealias Fruit = __x_ABI_Ctest__component_CFruit -public typealias Keywords = __x_ABI_Ctest__component_CKeywords -public typealias Signed = __x_ABI_Ctest__component_CSigned -public typealias SwiftifiableNames = __x_ABI_Ctest__component_CSwiftifiableNames -public typealias Unsigned = __x_ABI_Ctest__component_CUnsigned public final class AsyncMethods { private static let _IAsyncMethodsStatics: __ABI_test_component.IAsyncMethodsStatics = try! RoGetActivationFactory("test_component.AsyncMethods") public static func getCompletedAsync(_ result: Int32) throws -> AnyIAsyncOperation! { @@ -1747,13 +1742,13 @@ public struct SimpleEventArgs: Hashable, Codable, Sendable { } public struct StructWithEnum: Hashable, Codable, Sendable { - public var names: SwiftifiableNames = .init(0) + public var names: SwiftifiableNames = .init(rawValue: 0) public init() {} public init(names: SwiftifiableNames) { self.names = names } public static func from(abi: __x_ABI_Ctest__component_CStructWithEnum) -> StructWithEnum { - .init(names: abi.Names) + .init(names: .init(rawValue: abi.Names.rawValue)) } } @@ -1968,197 +1963,159 @@ extension WithKeyword { } public typealias AnyWithKeyword = any WithKeyword -extension test_component.Fruit { - public static var banana : test_component.Fruit { - __x_ABI_Ctest__component_CFruit_Banana - } - public static var apple : test_component.Fruit { - __x_ABI_Ctest__component_CFruit_Apple - } - public static var orange : test_component.Fruit { - __x_ABI_Ctest__component_CFruit_Orange - } - public static var pineapple : test_component.Fruit { - __x_ABI_Ctest__component_CFruit_Pineapple +public struct Fruit : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 + + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let banana = Self(rawValue: 0) + + public static let apple = Self(rawValue: 1) + + public static let orange = Self(rawValue: 2) + + public static let pineapple = Self(rawValue: 3) + } -extension test_component.Fruit: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct Keywords : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.Keywords { - public static var `as` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_As - } - public static var `break` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Break - } - public static var `case` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Case - } - public static var `catch` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Catch - } - public static var `class` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Class - } - public static var `continue` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Continue - } - public static var `default` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Default - } - public static var `defer` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Defer - } - public static var `do` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Do - } - public static var `else` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Else - } - public static var `enum` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Enum - } - public static var `extension` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Extension - } - public static var `fallthrough` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Fallthrough - } - public static var `false` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_False - } - public static var `for` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_For - } - public static var `func` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Func - } - public static var `if` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_If - } - public static var `import` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Import - } - public static var `in` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_In - } - public static var `internal` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Internal - } - public static var `is` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Is - } - public static var `let` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Let - } - public static var `nil` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Nil - } - public static var `private` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Private - } - public static var `protocol` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Protocol - } - public static var `public` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Public - } - public static var `repeat` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Repeat - } - public static var `rethrows` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Rethrows - } - public static var `return` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Return - } - public static var `self` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Self - } - public static var `static` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Static - } - public static var `struct` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Struct - } - public static var `subscript` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Subscript - } - public static var `super` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Super - } - public static var `switch` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Switch - } - public static var `throw` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Throw - } - public static var `throws` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Throws - } - public static var `true` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_True - } - public static var `try` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Try - } - public static var `var` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Var - } - public static var `where` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_Where - } - public static var `while` : test_component.Keywords { - __x_ABI_Ctest__component_CKeywords_While + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let `as` = Self(rawValue: 0) + + public static let `break` = Self(rawValue: 1) + + public static let `case` = Self(rawValue: 2) + + public static let `catch` = Self(rawValue: 3) + + public static let `class` = Self(rawValue: 4) + + public static let `continue` = Self(rawValue: 5) + + public static let `default` = Self(rawValue: 6) + + public static let `defer` = Self(rawValue: 7) + + public static let `do` = Self(rawValue: 8) + + public static let `else` = Self(rawValue: 9) + + public static let `enum` = Self(rawValue: 10) + + public static let `extension` = Self(rawValue: 11) + + public static let `fallthrough` = Self(rawValue: 12) + + public static let `false` = Self(rawValue: 13) + + public static let `for` = Self(rawValue: 14) + + public static let `func` = Self(rawValue: 15) + + public static let `if` = Self(rawValue: 16) + + public static let `import` = Self(rawValue: 17) + + public static let `in` = Self(rawValue: 18) + + public static let `internal` = Self(rawValue: 19) + + public static let `is` = Self(rawValue: 20) + + public static let `let` = Self(rawValue: 21) + + public static let `nil` = Self(rawValue: 22) + + public static let `private` = Self(rawValue: 23) + + public static let `protocol` = Self(rawValue: 24) + + public static let `public` = Self(rawValue: 25) + + public static let `repeat` = Self(rawValue: 26) + + public static let `rethrows` = Self(rawValue: 27) + + public static let `return` = Self(rawValue: 28) + + public static let `self` = Self(rawValue: 29) + + public static let `static` = Self(rawValue: 30) + + public static let `struct` = Self(rawValue: 31) + + public static let `subscript` = Self(rawValue: 32) + + public static let `super` = Self(rawValue: 33) + + public static let `switch` = Self(rawValue: 34) + + public static let `throw` = Self(rawValue: 35) + + public static let `throws` = Self(rawValue: 36) + + public static let `true` = Self(rawValue: 37) + + public static let `try` = Self(rawValue: 38) + + public static let `var` = Self(rawValue: 39) + + public static let `where` = Self(rawValue: 40) + + public static let `while` = Self(rawValue: 41) + } -extension test_component.Keywords: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct Signed : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.Signed { - public static var first : test_component.Signed { - __x_ABI_Ctest__component_CSigned_First - } - public static var second : test_component.Signed { - __x_ABI_Ctest__component_CSigned_Second - } - public static var third : test_component.Signed { - __x_ABI_Ctest__component_CSigned_Third + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let first = Self(rawValue: -1) + + public static let second = Self(rawValue: 0) + + public static let third = Self(rawValue: 1) + } -extension test_component.Signed: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct SwiftifiableNames : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.SwiftifiableNames { - public static var camelCase : test_component.SwiftifiableNames { - __x_ABI_Ctest__component_CSwiftifiableNames_camelCase - } - public static var pascalCase : test_component.SwiftifiableNames { - __x_ABI_Ctest__component_CSwiftifiableNames_PascalCase - } - public static var esingleLetterPrefixed : test_component.SwiftifiableNames { - __x_ABI_Ctest__component_CSwiftifiableNames_ESingleLetterPrefixed - } - public static var leadingCaps : test_component.SwiftifiableNames { - __x_ABI_Ctest__component_CSwiftifiableNames_LEADINGCaps - } - public static var r8g8b8a8Typeless : test_component.SwiftifiableNames { - __x_ABI_Ctest__component_CSwiftifiableNames_R8G8B8A8Typeless - } - public static var uuid : test_component.SwiftifiableNames { - __x_ABI_Ctest__component_CSwiftifiableNames_UUID + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } + + public static let camelCase = Self(rawValue: 0) + + public static let pascalCase = Self(rawValue: 1) + + public static let esingleLetterPrefixed = Self(rawValue: 2) + + public static let leadingCaps = Self(rawValue: 3) + + public static let r8g8b8a8Typeless = Self(rawValue: 4) + + public static let uuid = Self(rawValue: 5) + } -extension test_component.SwiftifiableNames: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} +public struct Unsigned : RawRepresentable, Hashable, Codable, Sendable { + public var rawValue: Swift.Int32 -extension test_component.Unsigned { - public static var first : test_component.Unsigned { - __x_ABI_Ctest__component_CUnsigned_First + public init(rawValue: Swift.Int32 = 0) { + self.rawValue = rawValue } - public static var second : test_component.Unsigned { - __x_ABI_Ctest__component_CUnsigned_Second - } - public static var third : test_component.Unsigned { - __x_ABI_Ctest__component_CUnsigned_Third - } -} -extension test_component.Unsigned: @retroactive Hashable, @retroactive Codable, @retroactive @unchecked Sendable {} + public static let first = Self(rawValue: 0) + + public static let second = Self(rawValue: 1) + + public static let third = Self(rawValue: 2) + +}