diff --git a/swiftwinrt/Resources/Support/Array+FromAbi.swift b/swiftwinrt/Resources/Support/Array+FromAbi.swift index 240d72e3..4515aec0 100644 --- a/swiftwinrt/Resources/Support/Array+FromAbi.swift +++ b/swiftwinrt/Resources/Support/Array+FromAbi.swift @@ -35,13 +35,6 @@ extension Array { } } -@_spi(WinRTInternal) -extension Array { - public static func from(abiBridge: Bridge.Type, start: UnsafeMutablePointer?>?, count: UInt32) -> [Element] where Element == Bridge.SwiftProjection? { - UnsafeBufferPointer(start: start, count: Int(count)).map { InterfaceWrapperBase.unwrapFrom(abi: ComPtr($0)) } - } -} - @_spi(WinRTInternal) extension Array { public static func from(abiBridge: Bridge.Type, abi: WinRTArrayAbi?>) -> [Element] where Element == Bridge.SwiftProjection?, Bridge.SwiftProjection: WinRTClass { diff --git a/swiftwinrt/Resources/Support/Array+ToAbi.swift b/swiftwinrt/Resources/Support/Array+ToAbi.swift index fc81bd8c..b6a78338 100644 --- a/swiftwinrt/Resources/Support/Array+ToAbi.swift +++ b/swiftwinrt/Resources/Support/Array+ToAbi.swift @@ -3,55 +3,121 @@ import Foundation @_spi(WinRTInternal) extension Array where Element: ToAbi { - public func toABI(_ withAbi: (_ length: UInt32, _ bytes: UnsafeMutablePointer?) throws -> Void) throws { + public func toABI(_ withAbi: (WinRTArrayAbi) throws -> Void) throws { let abiArray: [Element.ABI] = try map { try $0.toABI() } try abiArray.withUnsafeBytes { (bytes: UnsafeRawBufferPointer) in let bytesPtr = bytes.baseAddress?.assumingMemoryBound(to: Element.ABI.self) - try withAbi(UInt32(count), .init(mutating: bytesPtr)) + try withAbi((count: UInt32(count), start: .init(mutating: bytesPtr))) + } + } + + public func fill(abi: UnsafeMutablePointer?>?) throws { + guard let abi else { return } + abi.pointee = CoTaskMemAlloc(UInt64(MemoryLayout.size * count)).assumingMemoryBound(to: Element.ABI.self) + do { + try fill(abi: abi.pointee) + } catch { + CoTaskMemFree(abi.pointee) + throw error + } + } + + public func fill(abi: UnsafeMutablePointer?) throws { + guard let abi else { return } + for (index, element) in enumerated() { + abi[index] = try element.toABI() } } } @_spi(WinRTInternal) extension Array where Element: Numeric { - public func toABI(_ withAbi: (_ length: UInt32, _ bytes: UnsafeMutablePointer?) throws -> Void) throws { + public func toABI(_ withAbi: (WinRTArrayAbi) throws -> Void) throws { try withUnsafeBytes { (bytes: UnsafeRawBufferPointer) in let bytesPtr = bytes.baseAddress?.assumingMemoryBound(to: Element.self) - try withAbi(UInt32(count), .init(mutating: bytesPtr)) + try withAbi((count: UInt32(count), start: .init(mutating: bytesPtr))) } } + + public func fill(abi: UnsafeMutablePointer?) { + guard let abi else { return } + _ = UnsafeMutableBufferPointer(start: abi, count: count).update(from: self) + } + + public func fill(abi: UnsafeMutablePointer?>?) { + guard let abi else { return } + abi.pointee = CoTaskMemAlloc(UInt64(MemoryLayout.size * count)).assumingMemoryBound(to: Element.self) + fill(abi: abi.pointee) + } } @_spi(WinRTInternal) extension Array where Element: RawRepresentable, Element.RawValue: Numeric { - public func toABI(_ withAbi: (_ length: UInt32, _ bytes: UnsafeMutablePointer?) throws -> Void) throws { + public func toABI(_ withAbi: (WinRTArrayAbi) throws -> Void) throws { try withUnsafeBytes { (bytes: UnsafeRawBufferPointer) in let bytesPtr = bytes.baseAddress?.assumingMemoryBound(to: Element.self) - try withAbi(UInt32(count), .init(mutating: bytesPtr)) + try withAbi((count: UInt32(count), start: .init(mutating: bytesPtr))) } } + + public func fill(abi: UnsafeMutablePointer?) { + guard let abi else { return } + _ = UnsafeMutableBufferPointer(start: abi, count: count).update(from: self) + } + + public func fill(abi: UnsafeMutablePointer?>?) { + guard let abi else { return } + abi.pointee = CoTaskMemAlloc(UInt64(MemoryLayout.size * count)).assumingMemoryBound(to: Element.self) + fill(abi: abi.pointee) + } } @_spi(WinRTInternal) extension Array { - public func toABI(abiBridge: Bridge.Type, _ withAbi: (_ length: UInt32, _ bytes: UnsafeMutablePointer?>?) throws -> Void) throws where Element == Bridge.SwiftProjection? { + public func toABI(abiBridge: Bridge.Type, _ withAbi: (WinRTArrayAbi?>) throws -> Void) throws where Element == Bridge.SwiftProjection? { let abiWrapperArray: [InterfaceWrapperBase?] = map { .init($0) } let abiArray = try abiWrapperArray.map { try $0?.toABI{ $0 } } try abiArray.withUnsafeBytes { (bytes: UnsafeRawBufferPointer) in let bytesPtr = bytes.baseAddress?.assumingMemoryBound(to: UnsafeMutablePointer?.self) - try withAbi(UInt32(count), .init(mutating: bytesPtr)) + try withAbi((count: UInt32(count), start: .init(mutating: bytesPtr))) + } + } + + public func fill(abi: UnsafeMutablePointer?>?, abiBridge: Bridge.Type) where Element == Bridge.SwiftProjection? { + guard let abi else { return } + for (index, element) in enumerated() { + let wrapper = InterfaceWrapperBase(element) + wrapper?.copyTo(&abi[index]) } } + + public func fill(abi: UnsafeMutablePointer?>?>?, abiBridge: Bridge.Type) where Element == Bridge.SwiftProjection? { + guard let abi else { return } + abi.pointee = CoTaskMemAlloc(UInt64(MemoryLayout>.size * count)).assumingMemoryBound(to: UnsafeMutablePointer?.self) + fill(abi: abi.pointee, abiBridge: abiBridge) + } } @_spi(WinRTInternal) extension Array { - public func toABI(abiBridge: Bridge.Type, _ withAbi: (_ length: UInt32, _ bytes: UnsafeMutablePointer?>?) throws -> Void) throws where Element == Bridge.SwiftProjection?, Bridge.SwiftProjection: WinRTClass { + public func toABI(abiBridge: Bridge.Type, _ withAbi: (WinRTArrayAbi?>) throws -> Void) throws where Element == Bridge.SwiftProjection?, Bridge.SwiftProjection: WinRTClass { let abiArray: [UnsafeMutablePointer?] = map { RawPointer($0) } try abiArray.withUnsafeBytes { (bytes: UnsafeRawBufferPointer) in let bytesPtr = bytes.baseAddress?.assumingMemoryBound(to: UnsafeMutablePointer?.self) - try withAbi(UInt32(count), .init(mutating: bytesPtr)) + try withAbi((count: UInt32(count), start: .init(mutating: bytesPtr))) + } + } + + public func fill(abi: UnsafeMutablePointer?>?, abiBridge: Bridge.Type) where Element == Bridge.SwiftProjection?, Bridge.SwiftProjection: WinRTClass { + guard let abi else { return } + for (index, element) in enumerated() { + abi[index] = RawPointer(element) } } -} + public func fill(abi: UnsafeMutablePointer?>?>?, abiBridge: Bridge.Type) where Element == Bridge.SwiftProjection?, Bridge.SwiftProjection: WinRTClass { + guard let abi else { return } + abi.pointee = CoTaskMemAlloc(UInt64(MemoryLayout>.size * count)).assumingMemoryBound(to: UnsafeMutablePointer?.self) + fill(abi: abi.pointee, abiBridge: abiBridge) + } +} \ No newline at end of file diff --git a/swiftwinrt/Resources/Support/Array+toVector.swift b/swiftwinrt/Resources/Support/Array+toVector.swift index 1224807a..6ff99779 100644 --- a/swiftwinrt/Resources/Support/Array+toVector.swift +++ b/swiftwinrt/Resources/Support/Array+toVector.swift @@ -31,6 +31,14 @@ internal class ArrayVector : IVector { func replaceAll(_ items: [T]) { storage = items } + + func getMany(_ startIndex: UInt32, _ items: inout [T]) -> UInt32 { + let count = Swift.min(UInt32(storage.count) - startIndex, UInt32(items.count)) + for i in 0.. : IVectorView { func indexOf(_ item: T, _ index: inout UInt32) -> Bool { return false } func first() -> AnyIIterator? { ArrayIterator(storage) } + + func getMany(_ startIndex: UInt32, _ items: inout [T]) -> UInt32 { + let count = Swift.min(UInt32(storage.count) - startIndex, UInt32(items.count)) + for i in 0..: IIterator { var hasCurrent: Bool { index < storage.count } func queryInterface(_ iid: IID) -> IUnknownRef? { nil } + + func getMany(_ items: inout [T]) -> UInt32 { + let count = Swift.min(storage.count - index, items.count) + for i in 0..type))) + if (function.return_type.value().is_array()) + { + w.write("&%.count, &%.start", param_name, param_name); + } + else if (needs_wrapper(get_category(function.return_type->type))) { w.write("&%Abi", param_name); } @@ -356,7 +382,14 @@ namespace swiftwinrt static std::optional write_init_return_val_abi(writer& w, function_return_type const& signature) { auto category = get_category(signature.type); - if (needs_wrapper(category)) + if (signature.is_array()) + { + w.write("var %: WinRTArrayAbi<%> = (0, nil)\n", + signature.name, + bind(*signature.type, write_type_params::c_abi)); + return std::optional(); + } + else if (needs_wrapper(category)) { w.write("let (%) = try ComPtrs.initialize { %Abi in\n", signature.name, signature.name); return writer::indent_guard(w, 1); @@ -381,7 +414,14 @@ namespace swiftwinrt } w.write(" -> "); - write_type(w, *function.return_type->type, type_params); + if (function.return_type->is_array() && type_params.layer == projection_layer::swift) + { + w.write("[%]", bind(*function.return_type->type, write_type_params::swift)); + } + else + { + write_type(w, *function.return_type->type, type_params); + } } static std::vector get_projected_params(attributed_type const& factory, function_def const& func); @@ -723,9 +763,33 @@ typealias % = InterfaceWrapperBase<%> for (auto& param : signature.params) { std::string param_name = "$" + std::to_string(param_number); - - - if (param.in()) + if (param.is_array()) + { + auto array_param_name = "$" + std::to_string(param_number + 1); + auto count_param_name = param_name; + if (param.in()) + { + w.write("let %: [%] = %\n", + get_swift_name(param), + bind(*param.type, write_type_params::swift), + bind(*param.type, w.write_temp("(count: %, start: %)", count_param_name, array_param_name))); + } + else if (param.signature.ByRef()) + { + w.write("var % = [%]()\n", + get_swift_name(param), + bind(*param.type, write_type_params::swift)); + } + else + { + w.write("var %: [%] = %\n", + get_swift_name(param), + bind(*param.type, write_type_params::swift), + bind(*param.type, w.write_temp("(count: %, start: %)", count_param_name, array_param_name))); + } + ++param_number; + } + else if (param.in()) { assert(!param.out()); @@ -735,29 +799,6 @@ typealias % = InterfaceWrapperBase<%> get_swift_name(param), bind(param.type, param_name, false)); } - else if (param.is_array()) - { - auto array_param_name = "$" + std::to_string(param_number + 1); - auto count_param_name = param_name; - if (is_reference_type(param.type)) - { - w.write("let %: [%] = .from(abiBridge: %.self, abi: (count: %, start: %))\n", - get_swift_name(param), - bind(*param.type, write_type_params::swift), - bind_bridge_fullname(*param.type), - count_param_name, - array_param_name); - } - else - { - w.write("let %: [%] = .from(abi: (count: %, start: %))\n", - get_swift_name(param), - bind(*param.type, write_type_params::swift), - count_param_name, - array_param_name); - } - ++param_number; - } else { w.write("let %: % = %\n", @@ -775,6 +816,7 @@ typealias % = InterfaceWrapperBase<%> bind(*param.type, write_type_params::swift), bind(*param.type, projection_layer::swift)); } + ++param_number; } } @@ -786,9 +828,18 @@ typealias % = InterfaceWrapperBase<%> return; } - auto return_type = signature.return_type.value().type; - auto return_param_name = put_in_backticks_if_needed(std::string(signature.return_type.value().name)); - w.write("return %", bind(return_type, return_param_name, true)); + auto return_type = signature.return_type.value(); + auto return_param_name = put_in_backticks_if_needed(std::string(return_type.name)); + if (return_type.is_array()) + { + w.write("defer { CoTaskMemFree(%.start) }\n", return_param_name); + w.write("return %\n", bind(*return_type.type, return_param_name)); + } + else + { + w.write("return %", bind(return_type.type, return_param_name, true)); + } + } static void write_consume_args(writer& w, function_def const& function) @@ -898,37 +949,48 @@ bind_bridge_fullname(type)); fileprivate init(_ abi: ComPtr<__x_ABI_CWindows_CFoundation_CIPropertyValue>) { fatalError("not implemented") } public init(value: Any) { _value = value - if _value is Int32 { - propertyType = .int32 - } else if _value is UInt8 { - propertyType = .uint8 - } else if _value is Int16 { - propertyType = .int16 - } else if _value is UInt32 { - propertyType = .uint32 - } else if _value is Int64 { - propertyType = .int64 - } else if _value is UInt64 { - propertyType = .uint64 - } else if _value is Float { - propertyType = .single - } else if _value is Double { - propertyType = .double - } else if _value is Character { - propertyType = .char16 - } else if _value is Bool { - propertyType = .boolean - } else if _value is DateTime { - propertyType = .dateTime - } else if _value is TimeSpan { - propertyType = .timeSpan - } else if _value is IWinRTObject { - propertyType = .inspectable - } else if _value is IInspectable { - propertyType = .inspectable - } else { - propertyType = .otherType - } + propertyType = switch value { + case is UInt8: .uint8 + case is Int16: .int16 + case is UInt16: .uint16 + case is Int32: .int32 + case is UInt32: .uint32 + case is Int64: .int64 + case is UInt64: .uint64 + case is Float: .single + case is Double: .double + case is Character: .char16 + case is Bool: .boolean + case is String: .string + case is DateTime: .dateTime + case is TimeSpan: .timeSpan + case is Foundation.UUID: .guid + case is Point: .point + case is Size: .size + case is Rect: .rect + case is IWinRTObject: .inspectable + case is IInspectable: .inspectable + case is [UInt8]: .uint8Array + case is [Int16]: .int16Array + case is [UInt16]: .uint16Array + case is [Int32]: .int32Array + case is [UInt32]: .uint32Array + case is [Int64]: .int64Array + case is [UInt64]: .uint64Array + case is [Float]: .singleArray + case is [Double]: .doubleArray + case is [Character]: .char16Array + case is [Bool]: .booleanArray + case is [String]: .stringArray + case is [DateTime]: .dateTimeArray + case is [TimeSpan]: .timeSpanArray + case is [Foundation.UUID]: .guidArray + case is [Point]: .pointArray + case is [Size]: .sizeArray + case is [Rect]: .rectArray + case is [Any?]: .inspectableArray + default: .otherType + } } public var type: PropertyType { propertyType } @@ -959,6 +1021,25 @@ bind_bridge_fullname(type)); public func getPoint() -> Point { _value as! Point } public func getSize() -> Size { _value as! Size } public func getRect() -> Rect { _value as! Rect } + public func getUInt8Array(_ value: inout [UInt8]) { value = _value as! [UInt8] } + public func getInt16Array(_ value: inout [Int16]) { value = _value as! [Int16] } + public func getUInt16Array(_ value: inout [UInt16]) { value = _value as! [UInt16] } + public func getInt32Array(_ value: inout [Int32]) { value = _value as! [Int32] } + public func getUInt32Array(_ value: inout [UInt32]) { value = _value as! [UInt32] } + public func getInt64Array(_ value: inout [Int64]) { value = _value as! [Int64] } + public func getUInt64Array(_ value: inout [UInt64]) { value = _value as! [UInt64] } + public func getSingleArray(_ value: inout [Float]) { value = _value as! [Float] } + public func getDoubleArray(_ value: inout [Double]) { value = _value as! [Double] } + public func getChar16Array(_ value: inout [Character]) { value = _value as! [Character] } + public func getBooleanArray(_ value: inout [Bool]) { value = _value as! [Bool] } + public func getStringArray(_ value: inout [String]) { value = _value as! [String] } + public func getGuidArray(_ value: inout [Foundation.UUID]) { value = _value as! [Foundation.UUID] } + public func getDateTimeArray(_ value: inout [DateTime]) { value = _value as! [DateTime] } + public func getTimeSpanArray(_ value: inout [TimeSpan]) { value = _value as! [TimeSpan] } + public func getPointArray(_ value: inout [Point]) { value = _value as! [Point] } + public func getSizeArray(_ value: inout [Size]) { value = _value as! [Size] } + public func getRectArray(_ value: inout [Rect]) { value = _value as! [Rect] } + public func getInspectableArray(_ value: inout [Any?]) { value = _value as! [Any?] } % } @@ -1358,11 +1439,15 @@ vtable); { if (!can_write(w, prop)) continue; auto full_type_name = w.push_full_type_names(true); - const auto& return_type = *prop.getter->return_type->type; + auto propertyType = w.write_temp("%", bind(*prop.getter->return_type->type, swift_write_type_params_for(type))); + if (prop.is_array()) + { + propertyType = w.write_temp("[%]", propertyType); + } write_documentation_comment(w, type, prop.def.Name()); w.write("var %: % { get% }\n", get_swift_name(prop), - bind(return_type, swift_write_type_params_for(type)), + propertyType, prop.setter ? " set" : ""); } @@ -1500,7 +1585,14 @@ vtable); for (auto& param : params) { s(); - write_type(w, *param.type, write_type_params::swift); + if (param.is_array()) + { + w.write("[%]", bind(*param.type, write_type_params::swift)); + } + else + { + write_type(w, *param.type, write_type_params::swift); + } } } @@ -1662,23 +1754,45 @@ vtable); auto param_name = get_swift_name(param); auto local_param_name = local_swift_param_name(param_name); - if (param.in()) + if (param.is_array()) { - if (param.is_array()) + if (param.signature.ByRef()) { + w.write("var %: WinRTArrayAbi<%> = (0, nil)\n", + local_param_name, + bind(*param.type, write_type_params::c_abi)); + + guard.insert_front("% = %\n", param_name, bind(*param.type, local_param_name)); + guard.insert_front("defer { CoTaskMemFree(%.start) }\n", local_param_name); + } + else + { + // Array is passed by reference, so we need to convert the input to a buffer and then pass that buffer to C, then convert the buffer back to an array if (is_reference_type(param.type)) { - w.write("try %.toABI(abiBridge: %.self) { (count, %) in\n", param_name, bind_bridge_name(*param.type), local_param_name); + w.write("try %.toABI(abiBridge: %.self) { % in\n", param_name, bind_bridge_name(*param.type), local_param_name); } else { - w.write("try %.toABI { (count, %) in\n", param_name, local_param_name); + w.write("try %.toABI { % in\n", param_name, local_param_name); + } + + // Enums and fundamental (integer) types can just be copied directly into the ABI. So we can + // avoid an extra copy by simply passing the array buffer to C directly + if (!param.in() && category != param_category::enum_type && category != param_category::fundamental_type) + { + // While perhaps not the most effient to just create a new array from the elements (rather than filling an existing buffer), it is the simplest for now. + // These APIs are few and far between and rarely used. If needed, we can optimize later. + guard.insert_front("% = %\n", param_name, bind(*param.type, local_param_name)); } - guard.push_indent(); guard.push("}\n"); + guard.push_indent(); } - else if (category == param_category::string_type) + } + else if (param.in()) + { + if (category == param_category::string_type) { w.write("let % = try! HString(%)\n", local_param_name, @@ -1761,8 +1875,8 @@ vtable); w.write("let (%) = try ComPtrs.initialize { (%) in\n", bind(com_ptr_initialize, "%"), bind(com_ptr_initialize, "%Abi")); - guard.push_indent(); guard.push("}\n"); + guard.push_indent(); for (const auto& param : com_ptr_initialize) { @@ -2247,10 +2361,15 @@ public init( if (prop.getter) { + auto propertyType = w.write_temp("%", bind(*prop.getter->return_type->type, swift_write_type_params_for(*iface.type))); + if (prop.is_array()) + { + propertyType = w.write_temp("[%]", propertyType); + } w.write("%var % : % {\n", modifier_for(type_definition, iface), get_swift_name(prop), - bind(*prop.getter->return_type->type, swift_write_type_params_for(*iface.type))); + propertyType); w.write(" get { try! %.%() }\n", impl, @@ -2794,7 +2913,28 @@ override % func _getABI() -> UnsafeMutablePointer? { TypeDef signature_type{}; auto category = get_category(type, &signature_type); - if (category == param_category::struct_type && !is_struct_blittable(signature_type)) + if (return_type.is_array()) + { + if (is_reference_type(type)) + { + w.write("%.fill(abi: %, abiBridge: %.self)\n", + param_name, return_param_name, bind_bridge_fullname(*type)); + } + else if (category == param_category::enum_type || category == param_category::fundamental_type) + { + w.write("%.fill(abi: %)\n", + param_name, return_param_name); + } + else + { + w.write(R"(do { + try %.fill(abi: %) +} catch { return failWith(error: error) } +)", param_name, return_param_name); + } + return; + } + else if (category == param_category::struct_type && !is_struct_blittable(signature_type)) { w.write("let _% = %._ABI_%(from: %)\n\t", param_name, @@ -2832,18 +2972,32 @@ override % func _getABI() -> UnsafeMutablePointer? { int param_number = 1; for (auto& param : signature.params) { + auto param_name = get_swift_name(param); + if (param.is_array()) + { + if (param.signature.ByRef()) + { + w.write("$%?.initialize(to: UInt32(%.count))\n", param_number, param_name); + } + param_number++; + } if (param.out()) { auto return_param_name = "$" + std::to_string(param_number); - auto param_name = get_swift_name(param); do_write_abi_val_assignment(w, param, return_param_name); } + param_number++; } if (signature.return_type) { - auto return_param_name = "$" + std::to_string(signature.params.size() + 1); + if (signature.return_type.value().is_array()) + { + w.write("$%?.initialize(to: UInt32(%.count))\n", param_number, signature.return_type.value().name); + param_number++; + } + auto return_param_name = "$" + std::to_string(param_number); do_write_abi_val_assignment(w, signature.return_type.value(), return_param_name); } } @@ -2947,7 +3101,7 @@ override % func _getABI() -> UnsafeMutablePointer? { w.write("return S_OK\n"); } if (needs_try_catch) { - w.write("} catch { return failWith(error: error) } \n"); + w.write("} catch { return failWith(error: error) }\n"); w.m_indent -= 1; } w.write("}"); diff --git a/swiftwinrt/code_writers/can_write.h b/swiftwinrt/code_writers/can_write.h index 8013450e..b35a7cd9 100644 --- a/swiftwinrt/code_writers/can_write.h +++ b/swiftwinrt/code_writers/can_write.h @@ -2,6 +2,9 @@ #include "types.h" namespace swiftwinrt { + // can_write* functions are used to determine if a type/function can be written to the output file. + // The projection can be fully written, but we still respect type filters, so we may choose + // not to write certain APIs based on the filter. static bool can_write(writer& w, typedef_base const& type); static bool can_write(writer& w, const metadata_type* type) { @@ -24,25 +27,8 @@ namespace swiftwinrt // Don't support writing specials (events/properties) unless told to do so (i.e. for vtable) if (method.SpecialName() && !allow_special) return false; - auto method_name = get_swift_name(method); - for (auto& param : function.params) { - auto param_name = get_swift_name(param); - - // TODO: WIN-32 swiftwinrt: support array types - if (param.out() && (param.signature.Type().is_szarray() || - param.signature.Type().is_array()) ) - { - return false; - } - - // TODO: support reference parameters - if (param.signature.ByRef() && is_guid(get_category(param.type))) - { - return false; - } - if (!can_write(w, param.type)) { return false; @@ -52,11 +38,6 @@ namespace swiftwinrt if (function.return_type) { auto returnType = function.return_type.value(); - if (returnType.signature.Type().is_array() || - returnType.signature.Type().is_szarray()) - { - return false; - } if (!can_write(w, function.return_type.value().type)) { return false; @@ -80,45 +61,8 @@ namespace swiftwinrt return true; } - static bool can_write_default(const std::vector& required_interfaces) - { - for (auto&& iface : required_interfaces) - { - // when getting the interfaces we populate them with the type name - // if we can't write the type name then we can't write the type and - // so we'll return false - if (iface.second.is_default) - { - if (iface.first.empty()) return false; - } - } - - return true; - } - static bool can_write(writer& w, typedef_base const& type) { - auto typeName = get_full_type_name(type); - if (!w.filter.includes(type.type())) return false; - - auto category = get_category(type.type()); - if (category == category::enum_type) return true; - - if (auto iface = dynamic_cast(&type)) - { - if (!can_write_default(iface->required_interfaces)) - { - return false; - } - } - else if (auto classType = dynamic_cast(&type)) - { - if (!can_write_default(classType->required_interfaces)) - { - return false; - } - } - - return true; + return w.filter.includes(type.type()); } } \ No newline at end of file diff --git a/swiftwinrt/code_writers/common_writers.h b/swiftwinrt/code_writers/common_writers.h index 8a45efd0..f2ca3de8 100644 --- a/swiftwinrt/code_writers/common_writers.h +++ b/swiftwinrt/code_writers/common_writers.h @@ -265,17 +265,27 @@ namespace swiftwinrt w.write("/// [Open Microsoft documentation](%)\n", doc_url); } + static void write_convert_array_from_abi(writer& w, metadata_type const& type, std::string_view const& array_param_name) + { + if (is_reference_type(&type)) + { + w.write(".from(abiBridge: %.self, abi: %)", + bind_bridge_fullname(type), + array_param_name); + } + else + { + w.write(".from(abi: %)", + array_param_name); + } + } + static void write_consume_type(writer& w, metadata_type const* type, std::string_view const& name, bool isOut) { TypeDef signature_type{}; auto category = get_category(type, &signature_type); - if (category == param_category::array_type) - { - // TODO: WIN-32 swiftwinrt: add support for array types - XLANG_ASSERT("**TODO: implement array type in write_consume_return_type"); - } - else if (needs_wrapper(category)) + if (needs_wrapper(category)) { auto ptrVal = isOut ? std::string(name) : w.write_temp("ComPtr(%)", name); if (is_class(type)) diff --git a/swiftwinrt/code_writers/type_writers.cpp b/swiftwinrt/code_writers/type_writers.cpp index 059f535a..d05f3fa1 100644 --- a/swiftwinrt/code_writers/type_writers.cpp +++ b/swiftwinrt/code_writers/type_writers.cpp @@ -276,35 +276,51 @@ void swiftwinrt::write_type(writer& w, metadata_type const& type, write_type_par } } -void swiftwinrt::write_default_init_assignment(writer& w, metadata_type const& sig, projection_layer layer) +void swiftwinrt::write_default_value(writer& w, metadata_type const& sig, projection_layer layer) { auto category = get_category(&sig); if (category == param_category::object_type || category == param_category::generic_type) { - // Projected to Optional and default-initialized to nil + w.write("nil"); } else if (category == param_category::string_type) { // abi representation is HRESULT? which defaults to nil // swift representation is String, which must be initialized to "" - if (layer == projection_layer::swift) w.write(" = \"\""); + if (layer == projection_layer::swift) w.write("\"\""); } else if (category == param_category::struct_type || is_guid(category)) { - w.write(" = .init()"); + w.write(".init()"); } else if (category == param_category::enum_type) { - w.write(" = .init(0)"); + w.write(".init(0)"); } else if (is_boolean(&sig)) { - w.write(" = %", layer == projection_layer::c_abi ? "0" : "false"); + w.write("%", layer == projection_layer::c_abi ? "0" : "false"); + } + else + { + w.write("%", is_floating_point(&sig) ? "0.0" : "0"); + } +} + +void swiftwinrt::write_default_init_assignment(writer& w, metadata_type const& sig, projection_layer layer) +{ + auto category = get_category(&sig); + + if (category == param_category::object_type || + category == param_category::generic_type || + (category == param_category::string_type && layer == projection_layer::c_abi)) + { + // Projected to Optional and default-initialized to nil } else { - w.write(" = %", is_floating_point(&sig) ? "0.0" : "0"); + w.write(" = %", bind(sig, layer)); } } diff --git a/swiftwinrt/code_writers/type_writers.h b/swiftwinrt/code_writers/type_writers.h index a6485935..064420fd 100644 --- a/swiftwinrt/code_writers/type_writers.h +++ b/swiftwinrt/code_writers/type_writers.h @@ -46,6 +46,7 @@ namespace swiftwinrt // Writes the existential version of an interface, such as AnyIClosable for "any IClosable" void write_swift_interface_existential_identifier(writer& w, metadata_type const& iface); + void write_default_value(writer& w, metadata_type const& sig, projection_layer layer); void write_default_init_assignment(writer& w, metadata_type const& sig, projection_layer layer); write_type_params swift_write_type_params_for(metadata_type const& type); diff --git a/swiftwinrt/helpers.h b/swiftwinrt/helpers.h index d9cfec78..d6520d0d 100644 --- a/swiftwinrt/helpers.h +++ b/swiftwinrt/helpers.h @@ -675,6 +675,11 @@ namespace swiftwinrt return local_swift_param_name(std::string(param_name)); } + inline std::string local_swift_param_name(function_param const& param) + { + return local_swift_param_name(param.def.Name()); + } + inline std::string get_swift_name(function_param const& param) { return get_swift_name(param.def); diff --git a/swiftwinrt/text_writer.h b/swiftwinrt/text_writer.h index 9dcba16e..92e080cd 100644 --- a/swiftwinrt/text_writer.h +++ b/swiftwinrt/text_writer.h @@ -456,8 +456,18 @@ namespace swiftwinrt m_lines.push_back(temp_writer.write_temp(value, args...)); } + template + void insert_front(std::string_view const& value, Args const&... args) + { + T temp_writer; + temp_writer.swift_module = m_swift_module; + auto format = std::string("%").append(value.data()); + m_lines.insert(m_lines.begin(), temp_writer.write_temp(format, indent { m_offset }, args...)); + } + void push_indent(indent indent = { 1 }) { + m_offset += indent.additional_indentation; m_guard.emplace(m_writer.push_indent(indent)); } diff --git a/swiftwinrt/types.h b/swiftwinrt/types.h index d34b73b6..6ac528d1 100644 --- a/swiftwinrt/types.h +++ b/swiftwinrt/types.h @@ -621,6 +621,7 @@ namespace swiftwinrt metadata_type const* type; std::optional getter; std::optional setter; + bool is_array() const { return def.Type().Type().is_szarray() || def.Type().Type().is_array(); } }; struct event_def @@ -1056,7 +1057,7 @@ namespace swiftwinrt { return elem->type() == ElementType::Object; } - return false; + return false; } inline bool is_element_type(metadata_type const* type, ElementType elementType) @@ -1082,7 +1083,7 @@ namespace swiftwinrt } return false; } - + inline bool is_string(metadata_type const* signature) { return is_element_type(signature, ElementType::String); diff --git a/tests/test_app/ArrayTests.swift b/tests/test_app/ArrayTests.swift index 0620f526..0c3916d1 100644 --- a/tests/test_app/ArrayTests.swift +++ b/tests/test_app/ArrayTests.swift @@ -13,7 +13,34 @@ class StringableInt: IStringable { } } -class ArrayTests : XCTestCase { +class ArrayScenarios: IArrayScenarios { + var array: [Int32] = [] + func inArray(_ value: [Int32]) throws { + array = value + } + + func outArray(_ value: inout [Int32]) throws { + value = array + } + + func refArray(_ value: inout [Int32]) throws { + for i in 0.. [Int32] { + array + } + + func doubleIn(_ value1: [Int32], _ value2: [Int32]) throws {} + func inAndOut(_ value: [Int32], _ results: inout [Int32]) throws {} + func inAndRef(_ value: [Int32], _ results: inout [Int32]) throws {} + func inAndReturn(_ value: [Int32]) throws -> [Int32] { value } + func inAndRefNonBlittable(_ value: [Int32], _ results: inout [Bool]) throws {} + var arrayProperty: [Int32] = [] +} + +class ArrayInputTests : XCTestCase { public func testInputIntArray() throws { let input: [Int32] = [1, 2, 3, 4, 5] let result = try ArrayMethods.inInt32Array(input) @@ -55,16 +82,237 @@ class ArrayTests : XCTestCase { let result = try ArrayMethods.inEnumArray(input) XCTAssertEqual("FirstSecondThird", result) } + + public func testThroughSwiftImplementation() throws { + let arrayScenario = ArrayScenarios() + try ArrayMethods.testInArrayThroughSwiftImplementation(arrayScenario, [1, 2, 3]) + XCTAssertEqual([1, 2, 3], arrayScenario.array) + } } -var arrayTests: [XCTestCaseEntry] = [ +public class ArrayOutputTests: XCTestCase { + public func testOutIntArray() throws { + var intArray = [Int32]() + try ArrayMethods.outInt32Array(&intArray) + XCTAssertEqual([1, 2, 3], intArray) + } + + public func testOutStringArray() throws { + var stringArray = [String]() + try ArrayMethods.outStringArray(&stringArray) + XCTAssertEqual(["1", "2", "3"], stringArray) + } + + public func testOutObjectArray() throws { + var objectArray = [Any?]() + try ArrayMethods.outObjectArray(&objectArray) + let mapped = try objectArray.compactMap { try XCTUnwrap($0 as? IStringable).toString() } + XCTAssertEqual(["1", "2", "3"], mapped) + } + + public func testOutStringableArray() throws { + var stringableArray = [AnyIStringable?]() + try ArrayMethods.outStringableArray(&stringableArray) + let mapped = try stringableArray.compactMap { try $0?.toString() } + XCTAssertEqual(["1", "2", "3"], mapped) + } + + public func testOutStructArray() throws { + var structArray = [BlittableStruct]() + try ArrayMethods.outStructArray(&structArray) + XCTAssertEqual([ + BlittableStruct(first: 1, second: 2), + BlittableStruct(first: 3, second: 4), + BlittableStruct(first: 5, second: 6) + ], structArray) + } + + public func testOutNonBlittableStructArray() throws { + var structArray = [NonBlittableStruct]() + try ArrayMethods.outNonBlittableStructArray(&structArray) + XCTAssertEqual([ + NonBlittableStruct(first: "1", second: "2", third: 3, fourth: "4"), + NonBlittableStruct(first: "5", second: "6", third: 7, fourth: "8"), + NonBlittableStruct(first: "9", second: "10", third: 11, fourth: "12") + ], structArray) + } + + public func testOutEnumArry() throws { + var enumArray = [Signed]() + try ArrayMethods.outEnumArray(&enumArray) + XCTAssertEqual([.first, .second], enumArray) + } + + public func testThroughSwiftImplementation() throws { + let arrayScenario = ArrayScenarios() + arrayScenario.array = [1, 3, 1, 10] + try ArrayMethods.testOutArrayThroughSwiftImplementation(arrayScenario) { array in + XCTAssertEqual([1, 3, 1, 10], array) + } + } +} + +public class ArrayByReferenceTests: XCTestCase { + public func testInIntArrayByReference() throws { + var input = [Int32](repeating: 8675309, count: 5) + try ArrayMethods.refInt32Array(&input) + XCTAssertEqual([1, 2, 3, 4, 8675309], input) + } + + public func testInStringArrayByReference() throws { + var input = [String](repeating: "SWIFTRULES", count: 5) + try ArrayMethods.refStringArray(&input) + XCTAssertEqual(["1", "2", "3", "4", ""], input) + } + + public func testInObjectArrayByReference() throws { + var input = [Any?](repeating: StringableInt(value: 42), count: 5) + try ArrayMethods.refObjectArray(&input) + let mapped = try input.map { try ($0 as? IStringable)?.toString() } + XCTAssertEqual(["1", "2", "3", "4", nil], mapped) + } + + public func testInStringableArrayByReference() throws { + var input = [AnyIStringable?](repeating: StringableInt(value: 42), count: 5) + try ArrayMethods.refStringableArray(&input) + let mapped = try input.map { try $0?.toString() } + XCTAssertEqual(["1", "2", "3", "4", nil], mapped) + } + + public func testInStructArrayByReference() throws { + var input = [BlittableStruct](repeating: BlittableStruct(first: 10, second: 10), count: 3) + try ArrayMethods.refStructArray(&input) + XCTAssertEqual([ + BlittableStruct(first: 1, second: 2), + BlittableStruct(first: 3, second: 4), + BlittableStruct(first: 10, second: 10)], input) + + } + + public func testInNonBlittableStructArrayByReference() throws { + var input = [NonBlittableStruct](repeating: NonBlittableStruct(first: "H", second: "E", third: 1, fourth: "P"), count: 3) + try ArrayMethods.refNonBlittableStructArray(&input) + XCTAssertEqual([ + NonBlittableStruct(first: "1", second: "2", third: 3, fourth: "4"), + NonBlittableStruct(first: "5", second: "6", third: 7, fourth: "8"), + NonBlittableStruct(first: "", second: "", third: 0, fourth: "")], input) + } + + public func testInEnumArrayByReference() throws { + var input = [Signed](repeating: .third, count: 3) + try ArrayMethods.refEnumArray(&input) + XCTAssertEqual([Signed.first, Signed.second, Signed.third], input) + } + + public func testThroughSwiftImplementation() throws { + let arrayScenario = ArrayScenarios() + var testArray: [Int32] = [5, 4, 3, 2, 1] + try ArrayMethods.testRefArrayThroughSwiftImplementation(arrayScenario, &testArray) { array in + XCTAssertEqual([0, 1, 2, 3, 1], array) + } + XCTAssertEqual([0, 1, 2, 3, 1], testArray) + } +} + +public class ReturnArrayInputTests: XCTestCase { + public func testReturnIntArray() throws { + let result = try ArrayMethods.returnInt32Array() + XCTAssertEqual([1, 2, 3], result) + } + public func testReturnStringArray() throws { + let result = try ArrayMethods.returnStringArray() + XCTAssertEqual(["1", "2", "3"], result) + } + public func testReturnObjectArray() throws { + let result = try ArrayMethods.returnObjectArray() + let mapped = try result.compactMap { try XCTUnwrap($0 as? IStringable).toString() } + XCTAssertEqual(["1", "2", "3"], mapped) + } + public func testReturnStringableArray() throws { + let result = try ArrayMethods.returnStringableArray() + let mapped = try result.compactMap { try $0?.toString() } + XCTAssertEqual(["1", "2", "3"], mapped) + } + public func testReturnStructArray() throws { + let result = try ArrayMethods.returnStructArray() + XCTAssertEqual([ + BlittableStruct(first: 1, second: 2), + BlittableStruct(first: 3, second: 4), + BlittableStruct(first: 5, second: 6) + ], result) + } + public func testReturnNonBlittableStructArray() throws { + let result = try ArrayMethods.returnNonBlittableStructArray() + XCTAssertEqual([ + NonBlittableStruct(first: "1", second: "2", third: 3, fourth: "4"), + NonBlittableStruct(first: "5", second: "6", third: 7, fourth: "8"), + NonBlittableStruct(first: "9", second: "10", third: 11, fourth: "12") + ], result) + } + public func testReturnEnumArray() throws { + let result = try ArrayMethods.returnEnumArray() + XCTAssertEqual([Signed.first, Signed.second], result) + } + + public func testThroughSwiftImplementation() throws { + let arrayScenario = ArrayScenarios() + arrayScenario.array = [1, 3, 1, 10] + + try ArrayMethods.testReturnArrayThroughSwiftImplementation(arrayScenario) { array in + XCTAssertEqual([1, 3, 1, 10], array) + } + } +} + +private let inputArrayTests: [XCTestCaseEntry] = [ + testCase([ + ("testInputIntArray", ArrayInputTests.testInputIntArray), + ("testInStringArray", ArrayInputTests.testInStringArray), + ("testInObjectArray", ArrayInputTests.testInObjectArray), + ("testInStringableArray", ArrayInputTests.testInStringableArray), + ("testInStructArray", ArrayInputTests.testInStructArray), + ("testInNonBlittableStructArray", ArrayInputTests.testInNonBlittableStructArray), + ("testInEnumArray", ArrayInputTests.testInEnumArray), + ("testThroughSwiftImplementation", ArrayInputTests.testThroughSwiftImplementation) + ]) +] +private let outputArrayTests: [XCTestCaseEntry] = [ testCase([ - ("testInputIntArray", ArrayTests.testInputIntArray), - ("testInStringArray", ArrayTests.testInStringArray), - ("testInObjectArray", ArrayTests.testInObjectArray), - ("testInStringableArray", ArrayTests.testInStringableArray), - ("testInStructArray", ArrayTests.testInStructArray), - ("testInNonBlittableStructArray", ArrayTests.testInNonBlittableStructArray), - ("testInEnumArray", ArrayTests.testInEnumArray) + ("testOutIntArray", ArrayOutputTests.testOutIntArray), + ("testOutStringArray", ArrayOutputTests.testOutStringArray), + ("testOutObjectArray", ArrayOutputTests.testOutObjectArray), + ("testOutStringableArray", ArrayOutputTests.testOutStringableArray), + ("testOutStructArray", ArrayOutputTests.testOutStructArray), + ("testOutNonBlittableStructArray", ArrayOutputTests.testOutNonBlittableStructArray), + ("testOutEnumArry", ArrayOutputTests.testOutEnumArry), + ("testThroughSwiftImplementation", ArrayOutputTests.testThroughSwiftImplementation) ]) ] + +private let referenceArrayTests: [XCTestCaseEntry] = [ + testCase([ + ("testInIntArrayByReference", ArrayByReferenceTests.testInIntArrayByReference), + ("testInStringArrayByReference", ArrayByReferenceTests.testInStringArrayByReference), + ("testInObjectArrayByReference", ArrayByReferenceTests.testInObjectArrayByReference), + ("testInStringableArrayByReference", ArrayByReferenceTests.testInStringableArrayByReference), + ("testInStructArrayByReference", ArrayByReferenceTests.testInStructArrayByReference), + ("testInNonBlittableStructArrayByReference", ArrayByReferenceTests.testInNonBlittableStructArrayByReference), + ("testInEnumArrayByReference", ArrayByReferenceTests.testInEnumArrayByReference), + ("testThroughSwiftImplementation", ArrayByReferenceTests.testThroughSwiftImplementation) + ]) +] + +private let returnArrayTests: [XCTestCaseEntry] = [ + testCase([ + ("testReturnIntArray", ReturnArrayInputTests.testReturnIntArray), + ("testReturnStringArray", ReturnArrayInputTests.testReturnStringArray), + ("testReturnObjectArray", ReturnArrayInputTests.testReturnObjectArray), + ("testReturnStringableArray", ReturnArrayInputTests.testReturnStringableArray), + ("testReturnStructArray", ReturnArrayInputTests.testReturnStructArray), + ("testReturnNonBlittableStructArray", ReturnArrayInputTests.testReturnNonBlittableStructArray), + ("testReturnEnumArray", ReturnArrayInputTests.testReturnEnumArray), + ("testThroughSwiftImplementation", ReturnArrayInputTests.testThroughSwiftImplementation) + ]) +] + +let arrayTests = inputArrayTests + outputArrayTests + referenceArrayTests + returnArrayTests \ No newline at end of file diff --git a/tests/test_app/main.swift b/tests/test_app/main.swift index dc811264..db112dcf 100644 --- a/tests/test_app/main.swift +++ b/tests/test_app/main.swift @@ -460,7 +460,11 @@ var tests: [XCTestCaseEntry] = [ ("testUnicode", SwiftWinRTTests.testUnicode), ("testErrorInfo", SwiftWinRTTests.testErrorInfo), ]) -] + valueBoxingTests + eventTests + collectionTests + aggregationTests + asyncTests + memoryManagementTests + bufferTests + weakReferenceTests + arrayTests +] + valueBoxingTests + eventTests + collectionTests + aggregationTests + asyncTests + memoryManagementTests + bufferTests + weakReferenceTests + +// Have to start adding tests in different lines, otherwise we get the following error: +// error: the compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions +tests += arrayTests RoInitialize(RO_INIT_MULTITHREADED) XCTMain(tests) diff --git a/tests/test_component/Sources/CWinRT/include/Ctest_component.h b/tests/test_component/Sources/CWinRT/include/Ctest_component.h index 34e0cf42..0d188066 100644 --- a/tests/test_component/Sources/CWinRT/include/Ctest_component.h +++ b/tests/test_component/Sources/CWinRT/include/Ctest_component.h @@ -17,6 +17,7 @@ #undef FindText #undef GetClassName #undef GetObject +#undef GetGlyphIndices #define ENABLE_WINRT_EXPERIMENTAL_TYPES diff --git a/tests/test_component/Sources/CWinRT/include/test_component.h b/tests/test_component/Sources/CWinRT/include/test_component.h index 39c6dbc6..479e00f5 100644 --- a/tests/test_component/Sources/CWinRT/include/test_component.h +++ b/tests/test_component/Sources/CWinRT/include/test_component.h @@ -12,7 +12,13 @@ #include "Windows.Foundation.Collections.h" /* Forward Declarations */ -#ifndef ____x_ABI_Ctest__component_CIObjectHandler_FWD_DEFINED__ +#ifndef ____x_ABI_Ctest__component_CIArrayMethodCallback_FWD_DEFINED__ +#define ____x_ABI_Ctest__component_CIArrayMethodCallback_FWD_DEFINED__ +typedef interface __x_ABI_Ctest__component_CIArrayMethodCallback __x_ABI_Ctest__component_CIArrayMethodCallback; + +#endif // ____x_ABI_Ctest__component_CIArrayMethodCallback_FWD_DEFINED__ + + #ifndef ____x_ABI_Ctest__component_CIObjectHandler_FWD_DEFINED__ #define ____x_ABI_Ctest__component_CIObjectHandler_FWD_DEFINED__ typedef interface __x_ABI_Ctest__component_CIObjectHandler __x_ABI_Ctest__component_CIObjectHandler; @@ -30,6 +36,12 @@ typedef interface __x_ABI_Ctest__component_CIVoidToVoidDelegate __x_ABI_Ctest__c #endif // ____x_ABI_Ctest__component_CIArrayMethodsStatics_FWD_DEFINED__ +#ifndef ____x_ABI_Ctest__component_CIArrayScenarios_FWD_DEFINED__ +#define ____x_ABI_Ctest__component_CIArrayScenarios_FWD_DEFINED__ + typedef interface __x_ABI_Ctest__component_CIArrayScenarios __x_ABI_Ctest__component_CIArrayScenarios; + +#endif // ____x_ABI_Ctest__component_CIArrayScenarios_FWD_DEFINED__ + #ifndef ____x_ABI_Ctest__component_CIAsyncMethodsStatics_FWD_DEFINED__ #define ____x_ABI_Ctest__component_CIAsyncMethodsStatics_FWD_DEFINED__ typedef interface __x_ABI_Ctest__component_CIAsyncMethodsStatics __x_ABI_Ctest__component_CIAsyncMethodsStatics; @@ -2559,6 +2571,33 @@ struct __x_ABI_Ctest__component_CStructWithIReference __x_ABI_C__FIReference_1_int* Value2; }; +#if !defined(____x_ABI_Ctest__component_CIArrayMethodCallback_INTERFACE_DEFINED__) + #define ____x_ABI_Ctest__component_CIArrayMethodCallback_INTERFACE_DEFINED__ + typedef struct __x_ABI_Ctest__component_CIArrayMethodCallbackVtbl + { + BEGIN_INTERFACE + + HRESULT (STDMETHODCALLTYPE* QueryInterface)(__x_ABI_Ctest__component_CIArrayMethodCallback* This, + REFIID riid, + void** ppvObject); + ULONG (STDMETHODCALLTYPE* AddRef)(__x_ABI_Ctest__component_CIArrayMethodCallback* This); + ULONG (STDMETHODCALLTYPE* Release)(__x_ABI_Ctest__component_CIArrayMethodCallback* This); + HRESULT (STDMETHODCALLTYPE* Invoke)(__x_ABI_Ctest__component_CIArrayMethodCallback* This, + UINT32 valueLength, + INT32* value); + + END_INTERFACE + } __x_ABI_Ctest__component_CIArrayMethodCallbackVtbl; + + interface __x_ABI_Ctest__component_CIArrayMethodCallback + { + CONST_VTBL struct __x_ABI_Ctest__component_CIArrayMethodCallbackVtbl* lpVtbl; + }; + + + EXTERN_C const IID IID___x_ABI_Ctest__component_CIArrayMethodCallback; + #endif /* !defined(____x_ABI_Ctest__component_CIArrayMethodCallback_INTERFACE_DEFINED__) */ + #if !defined(____x_ABI_Ctest__component_CIObjectHandler_INTERFACE_DEFINED__) #define ____x_ABI_Ctest__component_CIObjectHandler_INTERFACE_DEFINED__ typedef struct __x_ABI_Ctest__component_CIObjectHandlerVtbl @@ -2656,6 +2695,84 @@ struct __x_ABI_Ctest__component_CStructWithIReference UINT32 valueLength, enum __x_ABI_Ctest__component_CSigned* value, HSTRING* result); + HRESULT (STDMETHODCALLTYPE* OutInt32Array)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32* valueLength, + INT32** value); + HRESULT (STDMETHODCALLTYPE* OutStringArray)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32* valueLength, + HSTRING** value); + HRESULT (STDMETHODCALLTYPE* OutObjectArray)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32* valueLength, + IInspectable*** value); + HRESULT (STDMETHODCALLTYPE* OutStringableArray)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32* valueLength, + __x_ABI_CWindows_CFoundation_CIStringable*** value); + HRESULT (STDMETHODCALLTYPE* OutStructArray)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32* valueLength, + struct __x_ABI_Ctest__component_CBlittableStruct** value); + HRESULT (STDMETHODCALLTYPE* OutNonBlittableStructArray)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32* valueLength, + struct __x_ABI_Ctest__component_CNonBlittableStruct** value); + HRESULT (STDMETHODCALLTYPE* OutEnumArray)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32* valueLength, + enum __x_ABI_Ctest__component_CSigned** value); + HRESULT (STDMETHODCALLTYPE* RefInt32Array)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32 valueLength, + INT32* value); + HRESULT (STDMETHODCALLTYPE* RefStringArray)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32 valueLength, + HSTRING* value); + HRESULT (STDMETHODCALLTYPE* RefObjectArray)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32 valueLength, + IInspectable** value); + HRESULT (STDMETHODCALLTYPE* RefStringableArray)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32 valueLength, + __x_ABI_CWindows_CFoundation_CIStringable** value); + HRESULT (STDMETHODCALLTYPE* RefStructArray)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32 valueLength, + struct __x_ABI_Ctest__component_CBlittableStruct* value); + HRESULT (STDMETHODCALLTYPE* RefNonBlittableStructArray)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32 valueLength, + struct __x_ABI_Ctest__component_CNonBlittableStruct* value); + HRESULT (STDMETHODCALLTYPE* RefEnumArray)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32 valueLength, + enum __x_ABI_Ctest__component_CSigned* value); + HRESULT (STDMETHODCALLTYPE* ReturnInt32Array)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32* resultLength, + INT32** result); + HRESULT (STDMETHODCALLTYPE* ReturnStringArray)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32* resultLength, + HSTRING** result); + HRESULT (STDMETHODCALLTYPE* ReturnObjectArray)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32* resultLength, + IInspectable*** result); + HRESULT (STDMETHODCALLTYPE* ReturnStringableArray)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32* resultLength, + __x_ABI_CWindows_CFoundation_CIStringable*** result); + HRESULT (STDMETHODCALLTYPE* ReturnStructArray)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32* resultLength, + struct __x_ABI_Ctest__component_CBlittableStruct** result); + HRESULT (STDMETHODCALLTYPE* ReturnNonBlittableStructArray)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32* resultLength, + struct __x_ABI_Ctest__component_CNonBlittableStruct** result); + HRESULT (STDMETHODCALLTYPE* ReturnEnumArray)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + UINT32* resultLength, + enum __x_ABI_Ctest__component_CSigned** result); + HRESULT (STDMETHODCALLTYPE* TestInArrayThroughSwiftImplementation)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + __x_ABI_Ctest__component_CIArrayScenarios* scenario, + UINT32 valueLength, + INT32* value); + HRESULT (STDMETHODCALLTYPE* TestOutArrayThroughSwiftImplementation)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + __x_ABI_Ctest__component_CIArrayScenarios* scenario, + __x_ABI_Ctest__component_CIArrayMethodCallback* callback); + HRESULT (STDMETHODCALLTYPE* TestRefArrayThroughSwiftImplementation)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + __x_ABI_Ctest__component_CIArrayScenarios* scenario, + UINT32 valueLength, + INT32* value, + __x_ABI_Ctest__component_CIArrayMethodCallback* callback); + HRESULT (STDMETHODCALLTYPE* TestReturnArrayThroughSwiftImplementation)(__x_ABI_Ctest__component_CIArrayMethodsStatics* This, + __x_ABI_Ctest__component_CIArrayScenarios* scenario, + __x_ABI_Ctest__component_CIArrayMethodCallback* callback); END_INTERFACE } __x_ABI_Ctest__component_CIArrayMethodsStaticsVtbl; @@ -2669,6 +2786,80 @@ struct __x_ABI_Ctest__component_CStructWithIReference EXTERN_C const IID IID___x_ABI_Ctest__component_CIArrayMethodsStatics; #endif /* !defined(____x_ABI_Ctest__component_CIArrayMethodsStatics_INTERFACE_DEFINED__) */ +#if !defined(____x_ABI_Ctest__component_CIArrayScenarios_INTERFACE_DEFINED__) + #define ____x_ABI_Ctest__component_CIArrayScenarios_INTERFACE_DEFINED__ + typedef struct __x_ABI_Ctest__component_CIArrayScenariosVtbl + { + BEGIN_INTERFACE + + HRESULT (STDMETHODCALLTYPE* QueryInterface)(__x_ABI_Ctest__component_CIArrayScenarios* This, + REFIID riid, + void** ppvObject); + ULONG (STDMETHODCALLTYPE* AddRef)(__x_ABI_Ctest__component_CIArrayScenarios* This); + ULONG (STDMETHODCALLTYPE* Release)(__x_ABI_Ctest__component_CIArrayScenarios* This); + HRESULT (STDMETHODCALLTYPE* GetIids)(__x_ABI_Ctest__component_CIArrayScenarios* This, + ULONG* iidCount, + IID** iids); + HRESULT (STDMETHODCALLTYPE* GetRuntimeClassName)(__x_ABI_Ctest__component_CIArrayScenarios* This, + HSTRING* className); + HRESULT (STDMETHODCALLTYPE* GetTrustLevel)(__x_ABI_Ctest__component_CIArrayScenarios* This, + TrustLevel* trustLevel); + HRESULT (STDMETHODCALLTYPE* InArray)(__x_ABI_Ctest__component_CIArrayScenarios* This, + UINT32 valueLength, + INT32* value); + HRESULT (STDMETHODCALLTYPE* OutArray)(__x_ABI_Ctest__component_CIArrayScenarios* This, + UINT32* valueLength, + INT32** value); + HRESULT (STDMETHODCALLTYPE* RefArray)(__x_ABI_Ctest__component_CIArrayScenarios* This, + UINT32 valueLength, + INT32* value); + HRESULT (STDMETHODCALLTYPE* ReturnArray)(__x_ABI_Ctest__component_CIArrayScenarios* This, + UINT32* resultLength, + INT32** result); + HRESULT (STDMETHODCALLTYPE* get_ArrayProperty)(__x_ABI_Ctest__component_CIArrayScenarios* This, + UINT32* valueLength, + INT32** value); + HRESULT (STDMETHODCALLTYPE* put_ArrayProperty)(__x_ABI_Ctest__component_CIArrayScenarios* This, + UINT32 valueLength, + INT32* value); + HRESULT (STDMETHODCALLTYPE* DoubleIn)(__x_ABI_Ctest__component_CIArrayScenarios* This, + UINT32 value1Length, + INT32* value1, + UINT32 value2Length, + INT32* value2); + HRESULT (STDMETHODCALLTYPE* InAndOut)(__x_ABI_Ctest__component_CIArrayScenarios* This, + UINT32 valueLength, + INT32* value, + UINT32* resultsLength, + INT32** results); + HRESULT (STDMETHODCALLTYPE* InAndRef)(__x_ABI_Ctest__component_CIArrayScenarios* This, + UINT32 valueLength, + INT32* value, + UINT32 resultsLength, + INT32* results); + HRESULT (STDMETHODCALLTYPE* InAndRefNonBlittable)(__x_ABI_Ctest__component_CIArrayScenarios* This, + UINT32 valueLength, + INT32* value, + UINT32 resultsLength, + boolean* results); + HRESULT (STDMETHODCALLTYPE* InAndReturn)(__x_ABI_Ctest__component_CIArrayScenarios* This, + UINT32 valueLength, + INT32* value, + UINT32* resultLength, + INT32** result); + + END_INTERFACE + } __x_ABI_Ctest__component_CIArrayScenariosVtbl; + + interface __x_ABI_Ctest__component_CIArrayScenarios + { + CONST_VTBL struct __x_ABI_Ctest__component_CIArrayScenariosVtbl* lpVtbl; + }; + + + EXTERN_C const IID IID___x_ABI_Ctest__component_CIArrayScenarios; +#endif /* !defined(____x_ABI_Ctest__component_CIArrayScenarios_INTERFACE_DEFINED__) */ + #if !defined(____x_ABI_Ctest__component_CIAsyncMethodsStatics_INTERFACE_DEFINED__) #define ____x_ABI_Ctest__component_CIAsyncMethodsStatics_INTERFACE_DEFINED__ typedef struct __x_ABI_Ctest__component_CIAsyncMethodsStaticsVtbl 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 d14902cb..4f0bb34f 100644 --- a/tests/test_component/Sources/test_component/Windows.Foundation+ABI.swift +++ b/tests/test_component/Sources/test_component/Windows.Foundation+ABI.swift @@ -190,7 +190,7 @@ public enum __ABI_Windows_Foundation { guard let __unwrapped__instance = IAsyncActionWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } try __unwrapped__instance.getResults() return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -290,7 +290,7 @@ public enum __ABI_Windows_Foundation { guard let __unwrapped__instance = IAsyncInfoWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } try __unwrapped__instance.cancel() return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, Close: { @@ -298,7 +298,7 @@ public enum __ABI_Windows_Foundation { guard let __unwrapped__instance = IAsyncInfoWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } try __unwrapped__instance.close() return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -347,7 +347,7 @@ public enum __ABI_Windows_Foundation { guard let __unwrapped__instance = IClosableWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } try __unwrapped__instance.close() return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -429,7 +429,7 @@ public enum __ABI_Windows_Foundation { let referenceWrapper = __ABI_Windows_Foundation.IMemoryBufferReferenceWrapper(reference) referenceWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -694,6 +694,177 @@ public enum __ABI_Windows_Foundation { return .from(abi: value) } + open func GetUInt8Array(_ value: inout [UInt8]) throws { + var _value: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIPropertyValue.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetUInt8Array(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + open func GetInt16Array(_ value: inout [Int16]) throws { + var _value: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIPropertyValue.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetInt16Array(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + open func GetUInt16Array(_ value: inout [UInt16]) throws { + var _value: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIPropertyValue.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetUInt16Array(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + open func GetInt32Array(_ value: inout [Int32]) throws { + var _value: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIPropertyValue.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetInt32Array(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + open func GetUInt32Array(_ value: inout [UInt32]) throws { + var _value: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIPropertyValue.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetUInt32Array(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + open func GetInt64Array(_ value: inout [Int64]) throws { + var _value: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIPropertyValue.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetInt64Array(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + open func GetUInt64Array(_ value: inout [UInt64]) throws { + var _value: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIPropertyValue.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetUInt64Array(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + open func GetSingleArray(_ value: inout [Float]) throws { + var _value: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIPropertyValue.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetSingleArray(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + open func GetDoubleArray(_ value: inout [Double]) throws { + var _value: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIPropertyValue.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetDoubleArray(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + open func GetChar16Array(_ value: inout [Character]) throws { + var _value: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIPropertyValue.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetChar16Array(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + open func GetBooleanArray(_ value: inout [Bool]) throws { + var _value: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIPropertyValue.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetBooleanArray(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + open func GetStringArray(_ value: inout [String]) throws { + var _value: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIPropertyValue.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetStringArray(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + open func GetInspectableArray(_ value: inout [Any?]) throws { + var _value: WinRTArrayAbi?> = (0, nil) + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIPropertyValue.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetInspectableArray(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abiBridge: __IMPL_.AnyBridge.self, abi: _value) + } + + open func GetGuidArray(_ value: inout [Foundation.UUID]) throws { + var _value: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIPropertyValue.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetGuidArray(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + open func GetDateTimeArray(_ value: inout [test_component.DateTime]) throws { + var _value: WinRTArrayAbi<__x_ABI_CWindows_CFoundation_CDateTime> = (0, nil) + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIPropertyValue.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetDateTimeArray(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + open func GetTimeSpanArray(_ value: inout [test_component.TimeSpan]) throws { + var _value: WinRTArrayAbi<__x_ABI_CWindows_CFoundation_CTimeSpan> = (0, nil) + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIPropertyValue.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetTimeSpanArray(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + open func GetPointArray(_ value: inout [test_component.Point]) throws { + var _value: WinRTArrayAbi<__x_ABI_CWindows_CFoundation_CPoint> = (0, nil) + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIPropertyValue.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetPointArray(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + open func GetSizeArray(_ value: inout [test_component.Size]) throws { + var _value: WinRTArrayAbi<__x_ABI_CWindows_CFoundation_CSize> = (0, nil) + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIPropertyValue.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetSizeArray(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + open func GetRectArray(_ value: inout [test_component.Rect]) throws { + var _value: WinRTArrayAbi<__x_ABI_CWindows_CFoundation_CRect> = (0, nil) + _ = try perform(as: __x_ABI_CWindows_CFoundation_CIPropertyValue.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetRectArray(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + } internal static var IPropertyValueVTable: __x_ABI_CWindows_CFoundation_CIPropertyValueVtbl = .init( @@ -744,7 +915,7 @@ public enum __ABI_Windows_Foundation { let value = try __unwrapped__instance.getUInt8() $1?.initialize(to: value) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetInt16: { @@ -753,7 +924,7 @@ public enum __ABI_Windows_Foundation { let value = try __unwrapped__instance.getInt16() $1?.initialize(to: value) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetUInt16: { @@ -762,7 +933,7 @@ public enum __ABI_Windows_Foundation { let value = try __unwrapped__instance.getUInt16() $1?.initialize(to: value) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetInt32: { @@ -771,7 +942,7 @@ public enum __ABI_Windows_Foundation { let value = try __unwrapped__instance.getInt32() $1?.initialize(to: value) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetUInt32: { @@ -780,7 +951,7 @@ public enum __ABI_Windows_Foundation { let value = try __unwrapped__instance.getUInt32() $1?.initialize(to: value) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetInt64: { @@ -789,7 +960,7 @@ public enum __ABI_Windows_Foundation { let value = try __unwrapped__instance.getInt64() $1?.initialize(to: value) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetUInt64: { @@ -798,7 +969,7 @@ public enum __ABI_Windows_Foundation { let value = try __unwrapped__instance.getUInt64() $1?.initialize(to: value) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetSingle: { @@ -807,7 +978,7 @@ public enum __ABI_Windows_Foundation { let value = try __unwrapped__instance.getSingle() $1?.initialize(to: value) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetDouble: { @@ -816,7 +987,7 @@ public enum __ABI_Windows_Foundation { let value = try __unwrapped__instance.getDouble() $1?.initialize(to: value) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetChar16: { @@ -825,7 +996,7 @@ public enum __ABI_Windows_Foundation { let value = try __unwrapped__instance.getChar16() $1?.initialize(to: .init(from: value)) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetBoolean: { @@ -834,7 +1005,7 @@ public enum __ABI_Windows_Foundation { let value = try __unwrapped__instance.getBoolean() $1?.initialize(to: .init(from: value)) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetString: { @@ -843,7 +1014,7 @@ public enum __ABI_Windows_Foundation { let value = try __unwrapped__instance.getString() $1?.initialize(to: try! HString(value).detach()) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetGuid: { @@ -852,7 +1023,7 @@ public enum __ABI_Windows_Foundation { let value = try __unwrapped__instance.getGuid() $1?.initialize(to: .init(from: value)) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetDateTime: { @@ -861,7 +1032,7 @@ public enum __ABI_Windows_Foundation { let value = try __unwrapped__instance.getDateTime() $1?.initialize(to: .from(swift: value)) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetTimeSpan: { @@ -870,7 +1041,7 @@ public enum __ABI_Windows_Foundation { let value = try __unwrapped__instance.getTimeSpan() $1?.initialize(to: .from(swift: value)) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetPoint: { @@ -879,7 +1050,7 @@ public enum __ABI_Windows_Foundation { let value = try __unwrapped__instance.getPoint() $1?.initialize(to: .from(swift: value)) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetSize: { @@ -888,7 +1059,7 @@ public enum __ABI_Windows_Foundation { let value = try __unwrapped__instance.getSize() $1?.initialize(to: .from(swift: value)) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetRect: { @@ -897,46 +1068,235 @@ public enum __ABI_Windows_Foundation { let value = try __unwrapped__instance.getRect() $1?.initialize(to: .from(swift: value)) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, - GetUInt8Array: { _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetUInt8Array: { + do { + guard let __unwrapped__instance = IPropertyValueWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value = [UInt8]() + try __unwrapped__instance.getUInt8Array(&value) + $1?.initialize(to: UInt32(value.count)) + value.fill(abi: $2) + return S_OK + } catch { return failWith(error: error) } + }, - GetInt16Array: { _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetInt16Array: { + do { + guard let __unwrapped__instance = IPropertyValueWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value = [Int16]() + try __unwrapped__instance.getInt16Array(&value) + $1?.initialize(to: UInt32(value.count)) + value.fill(abi: $2) + return S_OK + } catch { return failWith(error: error) } + }, - GetUInt16Array: { _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetUInt16Array: { + do { + guard let __unwrapped__instance = IPropertyValueWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value = [UInt16]() + try __unwrapped__instance.getUInt16Array(&value) + $1?.initialize(to: UInt32(value.count)) + value.fill(abi: $2) + return S_OK + } catch { return failWith(error: error) } + }, - GetInt32Array: { _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetInt32Array: { + do { + guard let __unwrapped__instance = IPropertyValueWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value = [Int32]() + try __unwrapped__instance.getInt32Array(&value) + $1?.initialize(to: UInt32(value.count)) + value.fill(abi: $2) + return S_OK + } catch { return failWith(error: error) } + }, - GetUInt32Array: { _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetUInt32Array: { + do { + guard let __unwrapped__instance = IPropertyValueWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value = [UInt32]() + try __unwrapped__instance.getUInt32Array(&value) + $1?.initialize(to: UInt32(value.count)) + value.fill(abi: $2) + return S_OK + } catch { return failWith(error: error) } + }, - GetInt64Array: { _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetInt64Array: { + do { + guard let __unwrapped__instance = IPropertyValueWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value = [Int64]() + try __unwrapped__instance.getInt64Array(&value) + $1?.initialize(to: UInt32(value.count)) + value.fill(abi: $2) + return S_OK + } catch { return failWith(error: error) } + }, - GetUInt64Array: { _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetUInt64Array: { + do { + guard let __unwrapped__instance = IPropertyValueWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value = [UInt64]() + try __unwrapped__instance.getUInt64Array(&value) + $1?.initialize(to: UInt32(value.count)) + value.fill(abi: $2) + return S_OK + } catch { return failWith(error: error) } + }, - GetSingleArray: { _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetSingleArray: { + do { + guard let __unwrapped__instance = IPropertyValueWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value = [Float]() + try __unwrapped__instance.getSingleArray(&value) + $1?.initialize(to: UInt32(value.count)) + value.fill(abi: $2) + return S_OK + } catch { return failWith(error: error) } + }, - GetDoubleArray: { _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetDoubleArray: { + do { + guard let __unwrapped__instance = IPropertyValueWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value = [Double]() + try __unwrapped__instance.getDoubleArray(&value) + $1?.initialize(to: UInt32(value.count)) + value.fill(abi: $2) + return S_OK + } catch { return failWith(error: error) } + }, - GetChar16Array: { _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetChar16Array: { + do { + guard let __unwrapped__instance = IPropertyValueWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value = [Character]() + try __unwrapped__instance.getChar16Array(&value) + $1?.initialize(to: UInt32(value.count)) + do { + try value.fill(abi: $2) + } catch { return failWith(error: error) } + return S_OK + } catch { return failWith(error: error) } + }, - GetBooleanArray: { _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetBooleanArray: { + do { + guard let __unwrapped__instance = IPropertyValueWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value = [Bool]() + try __unwrapped__instance.getBooleanArray(&value) + $1?.initialize(to: UInt32(value.count)) + do { + try value.fill(abi: $2) + } catch { return failWith(error: error) } + return S_OK + } catch { return failWith(error: error) } + }, - GetStringArray: { _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetStringArray: { + do { + guard let __unwrapped__instance = IPropertyValueWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value = [String]() + try __unwrapped__instance.getStringArray(&value) + $1?.initialize(to: UInt32(value.count)) + do { + try value.fill(abi: $2) + } catch { return failWith(error: error) } + return S_OK + } catch { return failWith(error: error) } + }, - GetInspectableArray: { _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetInspectableArray: { + do { + guard let __unwrapped__instance = IPropertyValueWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value = [Any?]() + try __unwrapped__instance.getInspectableArray(&value) + $1?.initialize(to: UInt32(value.count)) + value.fill(abi: $2, abiBridge: __IMPL_.AnyBridge.self) + return S_OK + } catch { return failWith(error: error) } + }, - GetGuidArray: { _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetGuidArray: { + do { + guard let __unwrapped__instance = IPropertyValueWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value = [Foundation.UUID]() + try __unwrapped__instance.getGuidArray(&value) + $1?.initialize(to: UInt32(value.count)) + do { + try value.fill(abi: $2) + } catch { return failWith(error: error) } + return S_OK + } catch { return failWith(error: error) } + }, - GetDateTimeArray: { _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetDateTimeArray: { + do { + guard let __unwrapped__instance = IPropertyValueWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value = [test_component.DateTime]() + try __unwrapped__instance.getDateTimeArray(&value) + $1?.initialize(to: UInt32(value.count)) + do { + try value.fill(abi: $2) + } catch { return failWith(error: error) } + return S_OK + } catch { return failWith(error: error) } + }, - GetTimeSpanArray: { _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetTimeSpanArray: { + do { + guard let __unwrapped__instance = IPropertyValueWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value = [test_component.TimeSpan]() + try __unwrapped__instance.getTimeSpanArray(&value) + $1?.initialize(to: UInt32(value.count)) + do { + try value.fill(abi: $2) + } catch { return failWith(error: error) } + return S_OK + } catch { return failWith(error: error) } + }, - GetPointArray: { _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetPointArray: { + do { + guard let __unwrapped__instance = IPropertyValueWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value = [test_component.Point]() + try __unwrapped__instance.getPointArray(&value) + $1?.initialize(to: UInt32(value.count)) + do { + try value.fill(abi: $2) + } catch { return failWith(error: error) } + return S_OK + } catch { return failWith(error: error) } + }, - GetSizeArray: { _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetSizeArray: { + do { + guard let __unwrapped__instance = IPropertyValueWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value = [test_component.Size]() + try __unwrapped__instance.getSizeArray(&value) + $1?.initialize(to: UInt32(value.count)) + do { + try value.fill(abi: $2) + } catch { return failWith(error: error) } + return S_OK + } catch { return failWith(error: error) } + }, - GetRectArray: { _, _, _ in return failWith(hr: E_NOTIMPL) } + GetRectArray: { + do { + guard let __unwrapped__instance = IPropertyValueWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value = [test_component.Rect]() + try __unwrapped__instance.getRectArray(&value) + $1?.initialize(to: UInt32(value.count)) + do { + try value.fill(abi: $2) + } catch { return failWith(error: error) } + return S_OK + } catch { return failWith(error: error) } + } ) public typealias IPropertyValueWrapper = InterfaceWrapperBase<__IMPL_Windows_Foundation.IPropertyValueBridge> @@ -987,7 +1347,7 @@ public enum __ABI_Windows_Foundation { let value = try __unwrapped__instance.toString() $1?.initialize(to: try! HString(value).detach()) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -1354,7 +1714,7 @@ extension __ABI_Windows_Foundation { let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) } @@ -1389,7 +1749,7 @@ extension __ABI_Windows_Foundation { guard let __unwrapped__instance = DeferralCompletedHandlerWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } try __unwrapped__instance() return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) } diff --git a/tests/test_component/Sources/test_component/Windows.Foundation+Impl.swift b/tests/test_component/Sources/test_component/Windows.Foundation+Impl.swift index e7a9d339..15328526 100644 --- a/tests/test_component/Sources/test_component/Windows.Foundation+Impl.swift +++ b/tests/test_component/Sources/test_component/Windows.Foundation+Impl.swift @@ -262,37 +262,48 @@ public enum __IMPL_Windows_Foundation { fileprivate init(_ abi: ComPtr<__x_ABI_CWindows_CFoundation_CIPropertyValue>) { fatalError("not implemented") } public init(value: Any) { _value = value - if _value is Int32 { - propertyType = .int32 - } else if _value is UInt8 { - propertyType = .uint8 - } else if _value is Int16 { - propertyType = .int16 - } else if _value is UInt32 { - propertyType = .uint32 - } else if _value is Int64 { - propertyType = .int64 - } else if _value is UInt64 { - propertyType = .uint64 - } else if _value is Float { - propertyType = .single - } else if _value is Double { - propertyType = .double - } else if _value is Character { - propertyType = .char16 - } else if _value is Bool { - propertyType = .boolean - } else if _value is DateTime { - propertyType = .dateTime - } else if _value is TimeSpan { - propertyType = .timeSpan - } else if _value is IWinRTObject { - propertyType = .inspectable - } else if _value is IInspectable { - propertyType = .inspectable - } else { - propertyType = .otherType - } + propertyType = switch value { + case is UInt8: .uint8 + case is Int16: .int16 + case is UInt16: .uint16 + case is Int32: .int32 + case is UInt32: .uint32 + case is Int64: .int64 + case is UInt64: .uint64 + case is Float: .single + case is Double: .double + case is Character: .char16 + case is Bool: .boolean + case is String: .string + case is DateTime: .dateTime + case is TimeSpan: .timeSpan + case is Foundation.UUID: .guid + case is Point: .point + case is Size: .size + case is Rect: .rect + case is IWinRTObject: .inspectable + case is IInspectable: .inspectable + case is [UInt8]: .uint8Array + case is [Int16]: .int16Array + case is [UInt16]: .uint16Array + case is [Int32]: .int32Array + case is [UInt32]: .uint32Array + case is [Int64]: .int64Array + case is [UInt64]: .uint64Array + case is [Float]: .singleArray + case is [Double]: .doubleArray + case is [Character]: .char16Array + case is [Bool]: .booleanArray + case is [String]: .stringArray + case is [DateTime]: .dateTimeArray + case is [TimeSpan]: .timeSpanArray + case is [Foundation.UUID]: .guidArray + case is [Point]: .pointArray + case is [Size]: .sizeArray + case is [Rect]: .rectArray + case is [Any?]: .inspectableArray + default: .otherType + } } public var type: PropertyType { propertyType } @@ -323,6 +334,25 @@ public enum __IMPL_Windows_Foundation { public func getPoint() -> Point { _value as! Point } public func getSize() -> Size { _value as! Size } public func getRect() -> Rect { _value as! Rect } + public func getUInt8Array(_ value: inout [UInt8]) { value = _value as! [UInt8] } + public func getInt16Array(_ value: inout [Int16]) { value = _value as! [Int16] } + public func getUInt16Array(_ value: inout [UInt16]) { value = _value as! [UInt16] } + public func getInt32Array(_ value: inout [Int32]) { value = _value as! [Int32] } + public func getUInt32Array(_ value: inout [UInt32]) { value = _value as! [UInt32] } + public func getInt64Array(_ value: inout [Int64]) { value = _value as! [Int64] } + public func getUInt64Array(_ value: inout [UInt64]) { value = _value as! [UInt64] } + public func getSingleArray(_ value: inout [Float]) { value = _value as! [Float] } + public func getDoubleArray(_ value: inout [Double]) { value = _value as! [Double] } + public func getChar16Array(_ value: inout [Character]) { value = _value as! [Character] } + public func getBooleanArray(_ value: inout [Bool]) { value = _value as! [Bool] } + public func getStringArray(_ value: inout [String]) { value = _value as! [String] } + public func getGuidArray(_ value: inout [Foundation.UUID]) { value = _value as! [Foundation.UUID] } + public func getDateTimeArray(_ value: inout [DateTime]) { value = _value as! [DateTime] } + public func getTimeSpanArray(_ value: inout [TimeSpan]) { value = _value as! [TimeSpan] } + public func getPointArray(_ value: inout [Point]) { value = _value as! [Point] } + public func getSizeArray(_ value: inout [Size]) { value = _value as! [Size] } + public func getRectArray(_ value: inout [Rect]) { value = _value as! [Rect] } + public func getInspectableArray(_ value: inout [Any?]) { value = _value as! [Any?] } public func queryInterface(_ iid: test_component.IID) -> IUnknownRef? { guard iid == __ABI_Windows_Foundation.IPropertyValueWrapper.IID else { return nil } 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 bf53d797..8fe06c98 100644 --- a/tests/test_component/Sources/test_component/Windows.Foundation.Collections.swift +++ b/tests/test_component/Sources/test_component/Windows.Foundation.Collections.swift @@ -298,6 +298,8 @@ public protocol IIterator : WinRTInterface { associatedtype T /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.movenext) func moveNext() -> Bool + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.getmany) + func getMany(_ items: inout [T]) -> UInt32 /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.current) var current: T { get } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.hascurrent) @@ -438,6 +440,8 @@ public protocol IVectorView : IIterable, Collection where Element == T, Index func getAt(_ index: UInt32) -> T /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.indexof) func indexOf(_ value: T, _ index: inout UInt32) -> Bool + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.getmany) + func getMany(_ startIndex: UInt32, _ items: inout [T]) -> UInt32 /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.size) var size: UInt32 { get } } @@ -465,6 +469,8 @@ public protocol IVector : IIterable, Collection where Element == T, Index == func removeAtEnd() /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivector-1.clear) func clear() + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivector-1.getmany) + func getMany(_ startIndex: UInt32, _ items: inout [T]) -> UInt32 /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivector-1.replaceall) func replaceAll(_ items: [T]) /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivector-1.size) diff --git a/tests/test_component/Sources/test_component/Windows.Foundation.swift b/tests/test_component/Sources/test_component/Windows.Foundation.swift index 489d3948..87310761 100644 --- a/tests/test_component/Sources/test_component/Windows.Foundation.swift +++ b/tests/test_component/Sources/test_component/Windows.Foundation.swift @@ -309,6 +309,11 @@ public final class WwwFormUrlDecoder : WinRTClass, IIterable, IVectorView { try! _IVectorView.IndexOf(value, &index) } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.wwwformurldecoder.getmany) + public func getMany(_ startIndex: UInt32, _ items: inout [AnyIWwwFormUrlDecoderEntry?]) -> UInt32 { + try! _IVectorView.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.wwwformurldecoder.size) public var size : UInt32 { get { try! _IVectorView.get_Size() } @@ -620,6 +625,44 @@ public protocol IPropertyValue : WinRTInterface { func getSize() throws -> test_component.Size /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getrect) func getRect() throws -> test_component.Rect + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getuint8array) + func getUInt8Array(_ value: inout [UInt8]) throws + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getint16array) + func getInt16Array(_ value: inout [Int16]) throws + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getuint16array) + func getUInt16Array(_ value: inout [UInt16]) throws + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getint32array) + func getInt32Array(_ value: inout [Int32]) throws + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getuint32array) + func getUInt32Array(_ value: inout [UInt32]) throws + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getint64array) + func getInt64Array(_ value: inout [Int64]) throws + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getuint64array) + func getUInt64Array(_ value: inout [UInt64]) throws + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getsinglearray) + func getSingleArray(_ value: inout [Float]) throws + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getdoublearray) + func getDoubleArray(_ value: inout [Double]) throws + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getchar16array) + func getChar16Array(_ value: inout [Character]) throws + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getbooleanarray) + func getBooleanArray(_ value: inout [Bool]) throws + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getstringarray) + func getStringArray(_ value: inout [String]) throws + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getinspectablearray) + func getInspectableArray(_ value: inout [Any?]) throws + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getguidarray) + func getGuidArray(_ value: inout [Foundation.UUID]) throws + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getdatetimearray) + func getDateTimeArray(_ value: inout [test_component.DateTime]) throws + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.gettimespanarray) + func getTimeSpanArray(_ value: inout [test_component.TimeSpan]) throws + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getpointarray) + func getPointArray(_ value: inout [test_component.Point]) throws + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getsizearray) + func getSizeArray(_ value: inout [test_component.Size]) throws + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.getrectarray) + func getRectArray(_ value: inout [test_component.Rect]) throws /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.isnumericscalar) var isNumericScalar: Bool { get } /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.ipropertyvalue.type) 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 2b81987c..6b49f6a5 100644 --- a/tests/test_component/Sources/test_component/Windows.Storage+ABI.swift +++ b/tests/test_component/Sources/test_component/Windows.Storage+ABI.swift @@ -253,9 +253,9 @@ public enum __ABI_Windows_Storage { public func WriteBytesAsync(_ absolutePath: String, _ buffer: [UInt8]) throws -> test_component.AnyIAsyncAction? { let (operation) = try ComPtrs.initialize { operationAbi in let _absolutePath = try! HString(absolutePath) - try buffer.toABI { (count, _buffer) in + try buffer.toABI { _buffer in _ = try perform(as: __x_ABI_CWindows_CStorage_CIPathIOStatics.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.WriteBytesAsync(pThis, _absolutePath.get(), count, _buffer, &operationAbi)) + try CHECKED(pThis.pointee.lpVtbl.pointee.WriteBytesAsync(pThis, _absolutePath.get(), _buffer.count, _buffer.start, &operationAbi)) } } } @@ -448,7 +448,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams__CIRandomAccessStreamWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, OpenTransactedWriteAsync: { @@ -458,7 +458,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageStreamTransactionWrapper(operation) operationWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, CopyOverloadDefaultNameAndOptions: { @@ -469,7 +469,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFileWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, CopyOverloadDefaultOptions: { @@ -481,7 +481,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFileWrapper(operation) operationWrapper?.copyTo($3) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, CopyOverload: { @@ -494,7 +494,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFileWrapper(operation) operationWrapper?.copyTo($4) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, CopyAndReplaceAsync: { @@ -505,7 +505,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = __ABI_Windows_Foundation.IAsyncActionWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, MoveOverloadDefaultNameAndOptions: { @@ -516,7 +516,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = __ABI_Windows_Foundation.IAsyncActionWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, MoveOverloadDefaultOptions: { @@ -528,7 +528,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = __ABI_Windows_Foundation.IAsyncActionWrapper(operation) operationWrapper?.copyTo($3) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, MoveOverload: { @@ -541,7 +541,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = __ABI_Windows_Foundation.IAsyncActionWrapper(operation) operationWrapper?.copyTo($4) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, MoveAndReplaceAsync: { @@ -552,7 +552,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = __ABI_Windows_Foundation.IAsyncActionWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -617,7 +617,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams__CIRandomAccessStreamWrapper(operation) operationWrapper?.copyTo($3) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, OpenTransactedWriteWithOptionsAsync: { @@ -628,7 +628,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageStreamTransactionWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -900,7 +900,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFileWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, CreateFileAsync: { @@ -912,7 +912,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFileWrapper(operation) operationWrapper?.copyTo($3) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, CreateFolderAsyncOverloadDefaultOptions: { @@ -923,7 +923,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, CreateFolderAsync: { @@ -935,7 +935,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper(operation) operationWrapper?.copyTo($3) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetFileAsync: { @@ -946,7 +946,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFileWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetFolderAsync: { @@ -957,7 +957,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetItemAsync: { @@ -968,7 +968,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CIStorageItemWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetFilesAsyncOverloadDefaultOptionsStartAndCount: { @@ -978,7 +978,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFileWrapper(operation) operationWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetFoldersAsyncOverloadDefaultOptionsStartAndCount: { @@ -988,7 +988,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper(operation) operationWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetItemsAsyncOverloadDefaultStartAndCount: { @@ -998,7 +998,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CIStorageItemWrapper(operation) operationWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -1054,7 +1054,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CIStorageItemWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -1216,7 +1216,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = __ABI_Windows_Foundation.IAsyncActionWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, RenameAsync: { @@ -1228,7 +1228,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = __ABI_Windows_Foundation.IAsyncActionWrapper(operation) operationWrapper?.copyTo($3) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, DeleteAsyncOverloadDefaultOptions: { @@ -1238,7 +1238,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = __ABI_Windows_Foundation.IAsyncActionWrapper(operation) operationWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, DeleteAsync: { @@ -1249,7 +1249,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = __ABI_Windows_Foundation.IAsyncActionWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetBasicPropertiesAsync: { @@ -1259,7 +1259,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CBasicPropertiesWrapper(operation) operationWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, get_Name: { @@ -1297,7 +1297,7 @@ public enum __ABI_Windows_Storage { let value = try __unwrapped__instance.isOfType(type) $2?.initialize(to: .init(from: value)) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -1362,7 +1362,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper(operation) operationWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, IsEqual: { @@ -1372,7 +1372,7 @@ public enum __ABI_Windows_Storage { let value = try __unwrapped__instance.isEqual(item) $2?.initialize(to: .init(from: value)) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -1478,7 +1478,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetThumbnailAsyncOverloadDefaultOptions: { @@ -1490,7 +1490,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper(operation) operationWrapper?.copyTo($3) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetThumbnailAsync: { @@ -1503,7 +1503,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper(operation) operationWrapper?.copyTo($4) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, get_DisplayName: { @@ -1605,7 +1605,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetScaledImageAsThumbnailAsyncOverloadDefaultOptions: { @@ -1617,7 +1617,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper(operation) operationWrapper?.copyTo($3) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetScaledImageAsThumbnailAsync: { @@ -1630,7 +1630,7 @@ public enum __ABI_Windows_Storage { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper(operation) operationWrapper?.copyTo($4) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -1886,7 +1886,7 @@ public enum __ABI_Windows_Storage { let failureMode: test_component.StreamedFileFailureMode = $1 try __unwrapped__instance.failAndClose(failureMode) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -1917,7 +1917,7 @@ extension __ABI_Windows_Storage { let stream: test_component.StreamedFileDataRequest? = __IMPL_Windows_Storage.StreamedFileDataRequestBridge.from(abi: ComPtr($1)) try __unwrapped__instance(stream) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) } 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 a6d061fe..d1f408e4 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 @@ -568,7 +568,7 @@ public enum __ABI_Windows_Storage_FileProperties { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIMap_2_HSTRING_IInspectableWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, SavePropertiesAsync: { @@ -579,7 +579,7 @@ public enum __ABI_Windows_Storage_FileProperties { let operationWrapper = __ABI_Windows_Foundation.IAsyncActionWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, SavePropertiesAsyncOverloadDefault: { @@ -589,7 +589,7 @@ public enum __ABI_Windows_Storage_FileProperties { let operationWrapper = __ABI_Windows_Foundation.IAsyncActionWrapper(operation) operationWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) 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 68b923e2..93404267 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 @@ -448,7 +448,7 @@ public enum __ABI_Windows_Storage_Search { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CSearch__CIndexedStateWrapper(operation) operationWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, CreateFileQueryOverloadDefault: { @@ -457,7 +457,7 @@ public enum __ABI_Windows_Storage_Search { let value = try __unwrapped__instance.createFileQuery() value?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, CreateFileQuery: { @@ -467,7 +467,7 @@ public enum __ABI_Windows_Storage_Search { let value = try __unwrapped__instance.createFileQuery(query) value?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, CreateFileQueryWithOptions: { @@ -477,7 +477,7 @@ public enum __ABI_Windows_Storage_Search { let value = try __unwrapped__instance.createFileQueryWithOptions(queryOptions) value?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, CreateFolderQueryOverloadDefault: { @@ -486,7 +486,7 @@ public enum __ABI_Windows_Storage_Search { let value = try __unwrapped__instance.createFolderQuery() value?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, CreateFolderQuery: { @@ -496,7 +496,7 @@ public enum __ABI_Windows_Storage_Search { let value = try __unwrapped__instance.createFolderQuery(query) value?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, CreateFolderQueryWithOptions: { @@ -506,7 +506,7 @@ public enum __ABI_Windows_Storage_Search { let value = try __unwrapped__instance.createFolderQueryWithOptions(queryOptions) value?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, CreateItemQuery: { @@ -515,7 +515,7 @@ public enum __ABI_Windows_Storage_Search { let value = try __unwrapped__instance.createItemQuery() value?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, CreateItemQueryWithOptions: { @@ -525,7 +525,7 @@ public enum __ABI_Windows_Storage_Search { let value = try __unwrapped__instance.createItemQueryWithOptions(queryOptions) value?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetFilesAsync: { @@ -538,7 +538,7 @@ public enum __ABI_Windows_Storage_Search { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFileWrapper(operation) operationWrapper?.copyTo($4) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetFilesAsyncOverloadDefaultStartAndCount: { @@ -549,7 +549,7 @@ public enum __ABI_Windows_Storage_Search { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFileWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetFoldersAsync: { @@ -562,7 +562,7 @@ public enum __ABI_Windows_Storage_Search { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper(operation) operationWrapper?.copyTo($4) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetFoldersAsyncOverloadDefaultStartAndCount: { @@ -573,7 +573,7 @@ public enum __ABI_Windows_Storage_Search { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetItemsAsync: { @@ -585,7 +585,7 @@ public enum __ABI_Windows_Storage_Search { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CIStorageItemWrapper(operation) operationWrapper?.copyTo($3) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, AreQueryOptionsSupported: { @@ -595,7 +595,7 @@ public enum __ABI_Windows_Storage_Search { let value = try __unwrapped__instance.areQueryOptionsSupported(queryOptions) $2?.initialize(to: .init(from: value)) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, IsCommonFolderQuerySupported: { @@ -605,7 +605,7 @@ public enum __ABI_Windows_Storage_Search { let value = try __unwrapped__instance.isCommonFolderQuerySupported(query) $2?.initialize(to: .init(from: value)) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, IsCommonFileQuerySupported: { @@ -615,7 +615,7 @@ public enum __ABI_Windows_Storage_Search { let value = try __unwrapped__instance.isCommonFileQuerySupported(query) $2?.initialize(to: .init(from: value)) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -782,7 +782,7 @@ public enum __ABI_Windows_Storage_Search { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1_UINT32Wrapper(operation) operationWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, get_Folder: { @@ -830,7 +830,7 @@ public enum __ABI_Windows_Storage_Search { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1_UINT32Wrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetCurrentQueryOptions: { @@ -839,7 +839,7 @@ public enum __ABI_Windows_Storage_Search { let value = try __unwrapped__instance.getCurrentQueryOptions() value?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, ApplyNewQueryOptions: { @@ -848,7 +848,7 @@ public enum __ABI_Windows_Storage_Search { let newQueryOptions: test_component.QueryOptions? = __IMPL_Windows_Storage_Search.QueryOptionsBridge.from(abi: ComPtr($1)) try __unwrapped__instance.applyNewQueryOptions(newQueryOptions) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) 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 3ae2ae90..afd9dcdf 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 @@ -270,7 +270,7 @@ public enum __ABI_Windows_Storage_Streams { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperationWithProgress_2___x_ABI_CWindows__CStorage__CStreams__CIBuffer_UINT32Wrapper(operation) operationWrapper?.copyTo($4) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -324,7 +324,7 @@ public enum __ABI_Windows_Storage_Streams { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams__CIInputStreamWrapper(operation) operationWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -391,7 +391,7 @@ public enum __ABI_Windows_Storage_Streams { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperationWithProgress_2_UINT32_UINT32Wrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, FlushAsync: { @@ -401,7 +401,7 @@ public enum __ABI_Windows_Storage_Streams { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1_booleanWrapper(operation) operationWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -535,7 +535,7 @@ public enum __ABI_Windows_Storage_Streams { let streamWrapper = __ABI_Windows_Storage_Streams.IInputStreamWrapper(stream) streamWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, GetOutputStreamAt: { @@ -546,7 +546,7 @@ public enum __ABI_Windows_Storage_Streams { let streamWrapper = __ABI_Windows_Storage_Streams.IOutputStreamWrapper(stream) streamWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, get_Position: { @@ -562,7 +562,7 @@ public enum __ABI_Windows_Storage_Streams { let position: UInt64 = $1 try __unwrapped__instance.seek(position) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, CloneStream: { @@ -572,7 +572,7 @@ public enum __ABI_Windows_Storage_Streams { let streamWrapper = __ABI_Windows_Storage_Streams.IRandomAccessStreamWrapper(stream) streamWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, get_CanRead: { @@ -640,7 +640,7 @@ public enum __ABI_Windows_Storage_Streams { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams__CIRandomAccessStreamWithContentTypeWrapper(operation) operationWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) 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 74bc93e5..82f11b0c 100644 --- a/tests/test_component/Sources/test_component/test_component+ABI.swift +++ b/tests/test_component/Sources/test_component/test_component+ABI.swift @@ -4,7 +4,11 @@ import Foundation import Ctest_component private var IID___x_ABI_Ctest__component_CIArrayMethodsStatics: test_component.IID { - .init(Data1: 0xB1C5101B, Data2: 0x507A, Data3: 0x5A3E, Data4: ( 0x9D,0x71,0x11,0x4D,0x55,0xFF,0x29,0xB4 ))// B1C5101B-507A-5A3E-9D71-114D55FF29B4 + .init(Data1: 0x8999FD6A, Data2: 0xD1C5, Data3: 0x53CE, Data4: ( 0xB8,0x0F,0x7C,0x45,0x85,0xD0,0x75,0x6C ))// 8999FD6A-D1C5-53CE-B80F-7C4585D0756C +} + +private var IID___x_ABI_Ctest__component_CIArrayScenarios: test_component.IID { + .init(Data1: 0x56558D36, Data2: 0xC35F, Data3: 0x5624, Data4: ( 0xB3,0xB1,0xF3,0xF3,0x65,0x26,0x57,0xA3 ))// 56558D36-C35F-5624-B3B1-F3F3652657A3 } private var IID___x_ABI_Ctest__component_CIAsyncMethodsStatics: test_component.IID { @@ -219,6 +223,10 @@ private var IID___x_ABI_Ctest__component_CWithKeyword: test_component.IID { .init(Data1: 0x18D4C535, Data2: 0x1785, Data3: 0x52CA, Data4: ( 0x88,0x51,0x8C,0xF3,0xD5,0x15,0x70,0x8A ))// 18D4C535-1785-52CA-8851-8CF3D515708A } +private var IID___x_ABI_Ctest__component_CIArrayMethodCallback: test_component.IID { + .init(Data1: 0x224AFD3B, Data2: 0x6459, Data3: 0x5621, Data4: ( 0xBF,0x69,0xF5,0x02,0x8C,0xF2,0xB3,0x17 ))// 224AFD3B-6459-5621-BF69-F5028CF2B317 +} + private var IID___x_ABI_Ctest__component_CIObjectHandler: test_component.IID { .init(Data1: 0x5DD35752, Data2: 0x9800, Data3: 0x5961, Data4: ( 0x80,0xDE,0xFC,0x5E,0x20,0x9E,0x6E,0x2D ))// 5DD35752-9800-5961-80DE-FC5E209E6E2D } @@ -234,9 +242,9 @@ public enum __ABI_test_component { public func InInt32Array(_ value: [Int32]) throws -> String { var result: HSTRING? - try value.toABI { (count, _value) in + try value.toABI { _value in _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.InInt32Array(pThis, count, _value, &result)) + try CHECKED(pThis.pointee.lpVtbl.pointee.InInt32Array(pThis, _value.count, _value.start, &result)) } } return .init(from: result) @@ -244,9 +252,9 @@ public enum __ABI_test_component { public func InStringArray(_ value: [String]) throws -> String { var result: HSTRING? - try value.toABI { (count, _value) in + try value.toABI { _value in _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.InStringArray(pThis, count, _value, &result)) + try CHECKED(pThis.pointee.lpVtbl.pointee.InStringArray(pThis, _value.count, _value.start, &result)) } } return .init(from: result) @@ -254,9 +262,9 @@ public enum __ABI_test_component { public func InObjectArray(_ value: [Any?]) throws -> String { var result: HSTRING? - try value.toABI(abiBridge: __IMPL_.AnyBridge.self) { (count, _value) in + try value.toABI(abiBridge: __IMPL_.AnyBridge.self) { _value in _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.InObjectArray(pThis, count, _value, &result)) + try CHECKED(pThis.pointee.lpVtbl.pointee.InObjectArray(pThis, _value.count, _value.start, &result)) } } return .init(from: result) @@ -264,9 +272,9 @@ public enum __ABI_test_component { public func InStringableArray(_ value: [test_component.AnyIStringable?]) throws -> String { var result: HSTRING? - try value.toABI(abiBridge: __IMPL_Windows_Foundation.IStringableBridge.self) { (count, _value) in + try value.toABI(abiBridge: __IMPL_Windows_Foundation.IStringableBridge.self) { _value in _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.InStringableArray(pThis, count, _value, &result)) + try CHECKED(pThis.pointee.lpVtbl.pointee.InStringableArray(pThis, _value.count, _value.start, &result)) } } return .init(from: result) @@ -274,9 +282,9 @@ public enum __ABI_test_component { public func InStructArray(_ value: [test_component.BlittableStruct]) throws -> String { var result: HSTRING? - try value.toABI { (count, _value) in + try value.toABI { _value in _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.InStructArray(pThis, count, _value, &result)) + try CHECKED(pThis.pointee.lpVtbl.pointee.InStructArray(pThis, _value.count, _value.start, &result)) } } return .init(from: result) @@ -284,9 +292,9 @@ public enum __ABI_test_component { public func InNonBlittableStructArray(_ value: [test_component.NonBlittableStruct]) throws -> String { var result: HSTRING? - try value.toABI { (count, _value) in + try value.toABI { _value in _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.InNonBlittableStructArray(pThis, count, _value, &result)) + try CHECKED(pThis.pointee.lpVtbl.pointee.InNonBlittableStructArray(pThis, _value.count, _value.start, &result)) } } return .init(from: result) @@ -294,16 +302,506 @@ public enum __ABI_test_component { public func InEnumArray(_ value: [test_component.Signed]) throws -> String { var result: HSTRING? - try value.toABI { (count, _value) in + try value.toABI { _value in _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.InEnumArray(pThis, count, _value, &result)) + try CHECKED(pThis.pointee.lpVtbl.pointee.InEnumArray(pThis, _value.count, _value.start, &result)) } } return .init(from: result) } + public func OutInt32Array(_ value: inout [Int32]) throws { + var _value: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.OutInt32Array(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + public func OutStringArray(_ value: inout [String]) throws { + var _value: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.OutStringArray(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + public func OutObjectArray(_ value: inout [Any?]) throws { + var _value: WinRTArrayAbi?> = (0, nil) + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.OutObjectArray(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abiBridge: __IMPL_.AnyBridge.self, abi: _value) + } + + public func OutStringableArray(_ value: inout [test_component.AnyIStringable?]) throws { + var _value: WinRTArrayAbi?> = (0, nil) + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.OutStringableArray(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abiBridge: __IMPL_Windows_Foundation.IStringableBridge.self, abi: _value) + } + + public func OutStructArray(_ value: inout [test_component.BlittableStruct]) throws { + var _value: WinRTArrayAbi<__x_ABI_Ctest__component_CBlittableStruct> = (0, nil) + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.OutStructArray(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + public func OutNonBlittableStructArray(_ value: inout [test_component.NonBlittableStruct]) throws { + var _value: WinRTArrayAbi<__x_ABI_Ctest__component_CNonBlittableStruct> = (0, nil) + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.OutNonBlittableStructArray(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + public func OutEnumArray(_ value: inout [test_component.Signed]) throws { + var _value: WinRTArrayAbi<__x_ABI_Ctest__component_CSigned> = (0, nil) + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.OutEnumArray(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + public func RefInt32Array(_ value: inout [Int32]) throws { + try value.toABI { _value in + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.RefInt32Array(pThis, _value.count, _value.start)) + } + } + } + + public func RefStringArray(_ value: inout [String]) throws { + try value.toABI { _value in + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.RefStringArray(pThis, _value.count, _value.start)) + } + value = .from(abi: _value) + } + } + + public func RefObjectArray(_ value: inout [Any?]) throws { + try value.toABI(abiBridge: __IMPL_.AnyBridge.self) { _value in + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.RefObjectArray(pThis, _value.count, _value.start)) + } + value = .from(abiBridge: __IMPL_.AnyBridge.self, abi: _value) + } + } + + public func RefStringableArray(_ value: inout [test_component.AnyIStringable?]) throws { + try value.toABI(abiBridge: __IMPL_Windows_Foundation.IStringableBridge.self) { _value in + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.RefStringableArray(pThis, _value.count, _value.start)) + } + value = .from(abiBridge: __IMPL_Windows_Foundation.IStringableBridge.self, abi: _value) + } + } + + public func RefStructArray(_ value: inout [test_component.BlittableStruct]) throws { + try value.toABI { _value in + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.RefStructArray(pThis, _value.count, _value.start)) + } + value = .from(abi: _value) + } + } + + public func RefNonBlittableStructArray(_ value: inout [test_component.NonBlittableStruct]) throws { + try value.toABI { _value in + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.RefNonBlittableStructArray(pThis, _value.count, _value.start)) + } + value = .from(abi: _value) + } + } + + public func RefEnumArray(_ value: inout [test_component.Signed]) throws { + try value.toABI { _value in + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.RefEnumArray(pThis, _value.count, _value.start)) + } + } + } + + public func ReturnInt32Array() throws -> [Int32] { + var result: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.ReturnInt32Array(pThis, &result.count, &result.start)) + } + defer { CoTaskMemFree(result.start) } + return .from(abi: result) + + } + + public func ReturnStringArray() throws -> [String] { + var result: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.ReturnStringArray(pThis, &result.count, &result.start)) + } + defer { CoTaskMemFree(result.start) } + return .from(abi: result) + + } + + public func ReturnObjectArray() throws -> [Any?] { + var result: WinRTArrayAbi?> = (0, nil) + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.ReturnObjectArray(pThis, &result.count, &result.start)) + } + defer { CoTaskMemFree(result.start) } + return .from(abiBridge: __IMPL_.AnyBridge.self, abi: result) + + } + + public func ReturnStringableArray() throws -> [test_component.AnyIStringable?] { + var result: WinRTArrayAbi?> = (0, nil) + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.ReturnStringableArray(pThis, &result.count, &result.start)) + } + defer { CoTaskMemFree(result.start) } + return .from(abiBridge: __IMPL_Windows_Foundation.IStringableBridge.self, abi: result) + + } + + public func ReturnStructArray() throws -> [test_component.BlittableStruct] { + var result: WinRTArrayAbi<__x_ABI_Ctest__component_CBlittableStruct> = (0, nil) + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.ReturnStructArray(pThis, &result.count, &result.start)) + } + defer { CoTaskMemFree(result.start) } + return .from(abi: result) + + } + + public func ReturnNonBlittableStructArray() throws -> [test_component.NonBlittableStruct] { + var result: WinRTArrayAbi<__x_ABI_Ctest__component_CNonBlittableStruct> = (0, nil) + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.ReturnNonBlittableStructArray(pThis, &result.count, &result.start)) + } + defer { CoTaskMemFree(result.start) } + return .from(abi: result) + + } + + public func ReturnEnumArray() throws -> [test_component.Signed] { + var result: WinRTArrayAbi<__x_ABI_Ctest__component_CSigned> = (0, nil) + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.ReturnEnumArray(pThis, &result.count, &result.start)) + } + defer { CoTaskMemFree(result.start) } + return .from(abi: result) + + } + + public func TestInArrayThroughSwiftImplementation(_ scenario: test_component.AnyIArrayScenarios?, _ value: [Int32]) throws { + let scenarioWrapper = __ABI_test_component.IArrayScenariosWrapper(scenario) + let _scenario = try! scenarioWrapper?.toABI { $0 } + try value.toABI { _value in + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.TestInArrayThroughSwiftImplementation(pThis, _scenario, _value.count, _value.start)) + } + } + } + + public func TestOutArrayThroughSwiftImplementation(_ scenario: test_component.AnyIArrayScenarios?, _ callback: test_component.ArrayMethodCallback?) throws { + let scenarioWrapper = __ABI_test_component.IArrayScenariosWrapper(scenario) + let _scenario = try! scenarioWrapper?.toABI { $0 } + let callbackWrapper = __ABI_test_component.ArrayMethodCallbackWrapper(callback) + let _callback = try! callbackWrapper?.toABI { $0 } + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.TestOutArrayThroughSwiftImplementation(pThis, _scenario, _callback)) + } + } + + public func TestRefArrayThroughSwiftImplementation(_ scenario: test_component.AnyIArrayScenarios?, _ value: inout [Int32], _ callback: test_component.ArrayMethodCallback?) throws { + let scenarioWrapper = __ABI_test_component.IArrayScenariosWrapper(scenario) + let _scenario = try! scenarioWrapper?.toABI { $0 } + try value.toABI { _value in + let callbackWrapper = __ABI_test_component.ArrayMethodCallbackWrapper(callback) + let _callback = try! callbackWrapper?.toABI { $0 } + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.TestRefArrayThroughSwiftImplementation(pThis, _scenario, _value.count, _value.start, _callback)) + } + } + } + + public func TestReturnArrayThroughSwiftImplementation(_ scenario: test_component.AnyIArrayScenarios?, _ callback: test_component.ArrayMethodCallback?) throws { + let scenarioWrapper = __ABI_test_component.IArrayScenariosWrapper(scenario) + let _scenario = try! scenarioWrapper?.toABI { $0 } + let callbackWrapper = __ABI_test_component.ArrayMethodCallbackWrapper(callback) + let _callback = try! callbackWrapper?.toABI { $0 } + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodsStatics.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.TestReturnArrayThroughSwiftImplementation(pThis, _scenario, _callback)) + } + } + + } + + public class IArrayScenarios: test_component.IInspectable { + override public class var IID: test_component.IID { IID___x_ABI_Ctest__component_CIArrayScenarios } + + open func InArray(_ value: [Int32]) throws { + try value.toABI { _value in + _ = try perform(as: __x_ABI_Ctest__component_CIArrayScenarios.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.InArray(pThis, _value.count, _value.start)) + } + } + } + + open func OutArray(_ value: inout [Int32]) throws { + var _value: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_Ctest__component_CIArrayScenarios.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.OutArray(pThis, &_value.count, &_value.start)) + } + defer { CoTaskMemFree(_value.start) } + value = .from(abi: _value) + } + + open func RefArray(_ value: inout [Int32]) throws { + try value.toABI { _value in + _ = try perform(as: __x_ABI_Ctest__component_CIArrayScenarios.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.RefArray(pThis, _value.count, _value.start)) + } + } + } + + open func ReturnArray() throws -> [Int32] { + var result: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_Ctest__component_CIArrayScenarios.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.ReturnArray(pThis, &result.count, &result.start)) + } + defer { CoTaskMemFree(result.start) } + return .from(abi: result) + + } + + open func get_ArrayProperty() throws -> [Int32] { + var value: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_Ctest__component_CIArrayScenarios.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.get_ArrayProperty(pThis, &value.count, &value.start)) + } + defer { CoTaskMemFree(value.start) } + return .from(abi: value) + + } + + open func put_ArrayProperty(_ value: [Int32]) throws { + try value.toABI { _value in + _ = try perform(as: __x_ABI_Ctest__component_CIArrayScenarios.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.put_ArrayProperty(pThis, _value.count, _value.start)) + } + } + } + + open func DoubleIn(_ value1: [Int32], _ value2: [Int32]) throws { + try value1.toABI { _value1 in + try value2.toABI { _value2 in + _ = try perform(as: __x_ABI_Ctest__component_CIArrayScenarios.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.DoubleIn(pThis, _value1.count, _value1.start, _value2.count, _value2.start)) + } + } + } + } + + open func InAndOut(_ value: [Int32], _ results: inout [Int32]) throws { + try value.toABI { _value in + var _results: WinRTArrayAbi = (0, nil) + _ = try perform(as: __x_ABI_Ctest__component_CIArrayScenarios.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.InAndOut(pThis, _value.count, _value.start, &_results.count, &_results.start)) + } + defer { CoTaskMemFree(_results.start) } + results = .from(abi: _results) + } + } + + open func InAndRef(_ value: [Int32], _ results: inout [Int32]) throws { + try value.toABI { _value in + try results.toABI { _results in + _ = try perform(as: __x_ABI_Ctest__component_CIArrayScenarios.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.InAndRef(pThis, _value.count, _value.start, _results.count, _results.start)) + } + } + } + } + + open func InAndRefNonBlittable(_ value: [Int32], _ results: inout [Bool]) throws { + try value.toABI { _value in + try results.toABI { _results in + _ = try perform(as: __x_ABI_Ctest__component_CIArrayScenarios.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.InAndRefNonBlittable(pThis, _value.count, _value.start, _results.count, _results.start)) + } + results = .from(abi: _results) + } + } + } + + open func InAndReturn(_ value: [Int32]) throws -> [Int32] { + var result: WinRTArrayAbi = (0, nil) + try value.toABI { _value in + _ = try perform(as: __x_ABI_Ctest__component_CIArrayScenarios.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.InAndReturn(pThis, _value.count, _value.start, &result.count, &result.start)) + } + } + defer { CoTaskMemFree(result.start) } + return .from(abi: result) + + } + } + internal static var IArrayScenariosVTable: __x_ABI_Ctest__component_CIArrayScenariosVtbl = .init( + QueryInterface: { IArrayScenariosWrapper.queryInterface($0, $1, $2) }, + AddRef: { IArrayScenariosWrapper.addRef($0) }, + Release: { IArrayScenariosWrapper.release($0) }, + GetIids: { + let size = MemoryLayout.size + let iids = CoTaskMemAlloc(UInt64(size) * 3).assumingMemoryBound(to: test_component.IID.self) + iids[0] = IUnknown.IID + iids[1] = IInspectable.IID + iids[2] = __ABI_test_component.IArrayScenariosWrapper.IID + $1!.pointee = 3 + $2!.pointee = iids + return S_OK + }, + + GetRuntimeClassName: { + _ = $0 + let hstring = try! HString("test_component.IArrayScenarios").detach() + $1!.pointee = hstring + return S_OK + }, + + GetTrustLevel: { + _ = $0 + $1!.pointee = TrustLevel(rawValue: 0) + return S_OK + }, + + InArray: { + do { + guard let __unwrapped__instance = IArrayScenariosWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let value: [Int32] = .from(abi: (count: $1, start: $2)) + try __unwrapped__instance.inArray(value) + return S_OK + } catch { return failWith(error: error) } + }, + + OutArray: { + do { + guard let __unwrapped__instance = IArrayScenariosWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value = [Int32]() + try __unwrapped__instance.outArray(&value) + $1?.initialize(to: UInt32(value.count)) + value.fill(abi: $2) + return S_OK + } catch { return failWith(error: error) } + }, + + RefArray: { + do { + guard let __unwrapped__instance = IArrayScenariosWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var value: [Int32] = .from(abi: (count: $1, start: $2)) + try __unwrapped__instance.refArray(&value) + value.fill(abi: $2) + return S_OK + } catch { return failWith(error: error) } + }, + + ReturnArray: { + do { + guard let __unwrapped__instance = IArrayScenariosWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let result = try __unwrapped__instance.returnArray() + $1?.initialize(to: UInt32(result.count)) + result.fill(abi: $2) + return S_OK + } catch { return failWith(error: error) } + }, + + get_ArrayProperty: { + guard let __unwrapped__instance = IArrayScenariosWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let value = __unwrapped__instance.arrayProperty + $1?.initialize(to: UInt32(value.count)) + value.fill(abi: $2) + return S_OK + }, + + put_ArrayProperty: { + guard let __unwrapped__instance = IArrayScenariosWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let value: [Int32] = .from(abi: (count: $1, start: $2)) + __unwrapped__instance.arrayProperty = value + return S_OK + }, + + DoubleIn: { + do { + guard let __unwrapped__instance = IArrayScenariosWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let value1: [Int32] = .from(abi: (count: $1, start: $2)) + let value2: [Int32] = .from(abi: (count: $3, start: $4)) + try __unwrapped__instance.doubleIn(value1, value2) + return S_OK + } catch { return failWith(error: error) } + }, + + InAndOut: { + do { + guard let __unwrapped__instance = IArrayScenariosWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let value: [Int32] = .from(abi: (count: $1, start: $2)) + var results = [Int32]() + try __unwrapped__instance.inAndOut(value, &results) + $3?.initialize(to: UInt32(results.count)) + results.fill(abi: $4) + return S_OK + } catch { return failWith(error: error) } + }, + + InAndRef: { + do { + guard let __unwrapped__instance = IArrayScenariosWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let value: [Int32] = .from(abi: (count: $1, start: $2)) + var results: [Int32] = .from(abi: (count: $3, start: $4)) + try __unwrapped__instance.inAndRef(value, &results) + results.fill(abi: $4) + return S_OK + } catch { return failWith(error: error) } + }, + + InAndRefNonBlittable: { + do { + guard let __unwrapped__instance = IArrayScenariosWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let value: [Int32] = .from(abi: (count: $1, start: $2)) + var results: [Bool] = .from(abi: (count: $3, start: $4)) + try __unwrapped__instance.inAndRefNonBlittable(value, &results) + do { + try results.fill(abi: $4) + } catch { return failWith(error: error) } + return S_OK + } catch { return failWith(error: error) } + }, + + InAndReturn: { + do { + guard let __unwrapped__instance = IArrayScenariosWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let value: [Int32] = .from(abi: (count: $1, start: $2)) + let result = try __unwrapped__instance.inAndReturn(value) + $3?.initialize(to: UInt32(result.count)) + result.fill(abi: $4) + return S_OK + } catch { return failWith(error: error) } + } + ) + + public typealias IArrayScenariosWrapper = InterfaceWrapperBase<__IMPL_test_component.IArrayScenariosBridge> public class IAsyncMethodsStatics: test_component.IInspectable { override public class var IID: test_component.IID { IID___x_ABI_Ctest__component_CIAsyncMethodsStatics } @@ -386,7 +884,7 @@ public enum __ABI_test_component { let operationWrapper = test_component.__x_ABI_C__FIAsyncOperationWithProgress_2_int_doubleWrapper(operation) operationWrapper?.copyTo($2) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -442,7 +940,7 @@ public enum __ABI_test_component { let result: Int32 = $1 try __unwrapped__instance.complete(result) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, CompleteWithError: { @@ -451,7 +949,7 @@ public enum __ABI_test_component { let errorCode: HRESULT = $1 try __unwrapped__instance.completeWithError(errorCode) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -611,7 +1109,7 @@ public enum __ABI_test_component { guard let __unwrapped__instance = IBasicWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } try __unwrapped__instance.method() return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -1485,7 +1983,7 @@ public enum __ABI_test_component { let result = try __unwrapped__instance.inInt32(value) $2?.initialize(to: try! HString(result).detach()) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, InString: { @@ -1495,7 +1993,7 @@ public enum __ABI_test_component { let result = try __unwrapped__instance.inString(value) $2?.initialize(to: try! HString(result).detach()) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, InObject: { @@ -1505,7 +2003,7 @@ public enum __ABI_test_component { let result = try __unwrapped__instance.inObject(value) $2?.initialize(to: try! HString(result).detach()) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, InEnum: { @@ -1515,7 +2013,7 @@ public enum __ABI_test_component { let result = try __unwrapped__instance.inEnum(value) $2?.initialize(to: try! HString(result).detach()) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, OutInt32: { @@ -1525,7 +2023,7 @@ public enum __ABI_test_component { try __unwrapped__instance.outInt32(&value) $1?.initialize(to: value) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, OutString: { @@ -1535,7 +2033,7 @@ public enum __ABI_test_component { try __unwrapped__instance.outString(&value) $1?.initialize(to: try! HString(value).detach()) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, OutObject: { @@ -1546,7 +2044,7 @@ public enum __ABI_test_component { let valueWrapper = __ABI_.AnyWrapper(value) valueWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, OutBlittableStruct: { @@ -1556,7 +2054,7 @@ public enum __ABI_test_component { try __unwrapped__instance.outBlittableStruct(&value) $1?.initialize(to: .from(swift: value)) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, OutNonBlittableStruct: { @@ -1567,7 +2065,7 @@ public enum __ABI_test_component { let _value = __ABI_test_component._ABI_NonBlittableStruct(from: value) $1?.initialize(to: _value.detach()) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, OutEnum: { @@ -1577,7 +2075,7 @@ public enum __ABI_test_component { try __unwrapped__instance.outEnum(&value) $1?.initialize(to: value) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, ReturnObject: { @@ -1587,7 +2085,7 @@ public enum __ABI_test_component { let resultWrapper = __ABI_.AnyWrapper(result) resultWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, ReturnEnum: { @@ -1596,7 +2094,7 @@ public enum __ABI_test_component { let result = try __unwrapped__instance.returnEnum() $1?.initialize(to: result) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, get_EnumProperty: { @@ -1649,7 +2147,7 @@ public enum __ABI_test_component { let data: String = .init(from: $1) try __unwrapped__instance.fireEvent(data) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -1701,7 +2199,7 @@ public enum __ABI_test_component { let basics: test_component.AnyIObservableVector? = test_component.__x_ABI_C__FIObservableVector_1___x_ABI_Ctest__zcomponent__CIBasicWrapper.unwrapFrom(abi: ComPtr($1)) try __unwrapped__instance.takeObservable(basics) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -1848,7 +2346,7 @@ public enum __ABI_test_component { guard let __unwrapped__instance = IReferenceTargetWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } try __unwrapped__instance.method() return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -2098,7 +2596,7 @@ public enum __ABI_test_component { guard let __unwrapped__instance = ISimpleDelegateWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } try __unwrapped__instance.doThis() return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, DoThat: { @@ -2107,7 +2605,7 @@ public enum __ABI_test_component { let val: Int32 = $1 try __unwrapped__instance.doThat(val) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -2526,7 +3024,7 @@ public enum __ABI_test_component { let resultWrapper = test_component.__x_ABI_C__FIVector_1_GUIDWrapper(result) resultWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -2614,7 +3112,7 @@ public enum __ABI_test_component { let `extension`: String = .init(from: $1) try __unwrapped__instance.`enum`(`extension`) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } }, get_Struct: { @@ -2651,7 +3149,7 @@ public enum __ABI_test_component { guard let __unwrapped__instance = WithKeywordWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } try __unwrapped__instance.`subscript`() return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) @@ -2754,7 +3252,7 @@ public enum __ABI_test_component { guard let __unwrapped__instance = IBaseOverridesWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } try __unwrapped__instance.onDoTheThing() return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) internal typealias IUnsealedDerivedOverridesWrapper = UnsealedWinRTClassWrapper<__IMPL_test_component.UnsealedDerivedBridge.IUnsealedDerivedOverrides> @@ -2792,7 +3290,7 @@ public enum __ABI_test_component { guard let __unwrapped__instance = IUnsealedDerivedOverridesWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } try __unwrapped__instance.onBeforeDoTheThing() return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) internal typealias IUnsealedDerivedOverloads2Wrapper = UnsealedWinRTClassWrapper<__IMPL_test_component.UnsealedDerivedBridge.IUnsealedDerivedOverloads2> @@ -2831,7 +3329,7 @@ public enum __ABI_test_component { guard let __unwrapped__instance = IUnsealedDerivedOverloads2Wrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } try __unwrapped__instance.onAfterDoTheThing() return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) } @@ -2868,6 +3366,44 @@ extension ComposableImpl where CABI == __x_ABI_Ctest__component_CIUnsealedDerive return .init(lpVtbl: vtblPtr) } } +// MARK - ArrayMethodCallback +extension __ABI_test_component { + public class ArrayMethodCallback: test_component.IUnknown { + override public class var IID: test_component.IID { IID___x_ABI_Ctest__component_CIArrayMethodCallback } + + open func Invoke(_ value: [Int32]) throws { + try value.toABI { _value in + _ = try perform(as: __x_ABI_Ctest__component_CIArrayMethodCallback.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.Invoke(pThis, _value.count, _value.start)) + } + } + } + + } + + + typealias ArrayMethodCallbackWrapper = InterfaceWrapperBase<__IMPL_test_component.ArrayMethodCallbackBridge> + internal static var ArrayMethodCallbackVTable: __x_ABI_Ctest__component_CIArrayMethodCallbackVtbl = .init( + QueryInterface: { ArrayMethodCallbackWrapper.queryInterface($0, $1, $2) }, + AddRef: { ArrayMethodCallbackWrapper.addRef($0) }, + Release: { ArrayMethodCallbackWrapper.release($0) }, + Invoke: { + do { + guard let __unwrapped__instance = ArrayMethodCallbackWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let value: [Int32] = .from(abi: (count: $1, start: $2)) + try __unwrapped__instance(value) + return S_OK + } catch { return failWith(error: error) } + } + ) +} +public extension WinRTDelegateBridge where CABI == __x_ABI_Ctest__component_CIArrayMethodCallback { + static func makeAbi() -> CABI { + let vtblPtr = withUnsafeMutablePointer(to: &__ABI_test_component.ArrayMethodCallbackVTable) { $0 } + return .init(lpVtbl:vtblPtr) + } +} + // MARK - ObjectHandler extension __ABI_test_component { public class ObjectHandler: test_component.IUnknown { @@ -2895,7 +3431,7 @@ extension __ABI_test_component { let item: Any? = __ABI_.AnyWrapper.unwrapFrom(abi: ComPtr($1)) try __unwrapped__instance(item) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) } @@ -2930,7 +3466,7 @@ extension __ABI_test_component { guard let __unwrapped__instance = VoidToVoidDelegateWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } try __unwrapped__instance() return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) } 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 0a1fd3ed..110ef850 100644 --- a/tests/test_component/Sources/test_component/test_component+Generics.swift +++ b/tests/test_component/Sources/test_component/test_component+Generics.swift @@ -25,7 +25,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1_booleanVTable: __x_AB let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1_booleanWrapper = InterfaceWrapperBase @@ -78,7 +78,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1_intVTable: __x_ABI_C_ let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1_intWrapper = InterfaceWrapperBase @@ -131,7 +131,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1_HSTRINGVTable: __x_AB let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1_HSTRINGWrapper = InterfaceWrapperBase @@ -184,7 +184,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1_UINT32VTable: __x_ABI let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1_UINT32Wrapper = InterfaceWrapperBase @@ -237,7 +237,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIMap_2_HS let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIMap_2_HSTRING_IInspectableWrapper = InterfaceWrapperBase @@ -290,7 +290,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVectorVi let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CIStorageItemWrapper = InterfaceWrapperBase @@ -343,7 +343,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVectorVi let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFileWrapper = InterfaceWrapperBase @@ -396,7 +396,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVectorVi let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper = InterfaceWrapperBase @@ -449,7 +449,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVectorVi let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageLibraryChangeWrapper = InterfaceWrapperBase @@ -502,7 +502,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVector_1 let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_C__FIVector_1_HSTRINGWrapper = InterfaceWrapperBase @@ -555,7 +555,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CFileProperties__CBasicPropertiesWrapper = InterfaceWrapperBase @@ -608,7 +608,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CFileProperties__CDocumentPropertiesWrapper = InterfaceWrapperBase @@ -661,7 +661,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CFileProperties__CImagePropertiesWrapper = InterfaceWrapperBase @@ -714,7 +714,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CFileProperties__CMusicPropertiesWrapper = InterfaceWrapperBase @@ -767,7 +767,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper = InterfaceWrapperBase @@ -820,7 +820,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CFileProperties__CVideoPropertiesWrapper = InterfaceWrapperBase @@ -873,7 +873,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CIStorageItemWrapper = InterfaceWrapperBase @@ -926,7 +926,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CSearch__CIndexedStateWrapper = InterfaceWrapperBase @@ -979,7 +979,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStorageFileWrapper = InterfaceWrapperBase @@ -1032,7 +1032,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper = InterfaceWrapperBase @@ -1085,7 +1085,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStorageStreamTransactionWrapper = InterfaceWrapperBase @@ -1138,7 +1138,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStreams__CIBufferWrapper = InterfaceWrapperBase @@ -1191,7 +1191,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStreams__CIInputStreamWrapper = InterfaceWrapperBase @@ -1244,7 +1244,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStreams__CIRandomAccessStreamWrapper = InterfaceWrapperBase @@ -1297,7 +1297,7 @@ internal var __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CSt let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationCompletedHandler_1___x_ABI_CWindows__CStorage__CStreams__CIRandomAccessStreamWithContentTypeWrapper = InterfaceWrapperBase @@ -1350,7 +1350,7 @@ internal var __x_ABI_C__FIAsyncOperationProgressHandler_2_int_doubleVTable: __x_ let progressInfo: Double = $2 try __unwrapped__instance(asyncInfo, progressInfo) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationProgressHandler_2_int_doubleWrapper = InterfaceWrapperBase @@ -1403,7 +1403,7 @@ internal var __x_ABI_C__FIAsyncOperationProgressHandler_2_UINT32_UINT32VTable: _ let progressInfo: UInt32 = $2 try __unwrapped__instance(asyncInfo, progressInfo) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationProgressHandler_2_UINT32_UINT32Wrapper = InterfaceWrapperBase @@ -1456,7 +1456,7 @@ internal var __x_ABI_C__FIAsyncOperationProgressHandler_2___x_ABI_CWindows__CSto let progressInfo: UInt32 = $2 try __unwrapped__instance(asyncInfo, progressInfo) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationProgressHandler_2___x_ABI_CWindows__CStorage__CStreams__CIBuffer_UINT32Wrapper = InterfaceWrapperBase @@ -1509,7 +1509,7 @@ internal var __x_ABI_C__FIAsyncOperationWithProgressCompletedHandler_2_int_doubl let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationWithProgressCompletedHandler_2_int_doubleWrapper = InterfaceWrapperBase @@ -1562,7 +1562,7 @@ internal var __x_ABI_C__FIAsyncOperationWithProgressCompletedHandler_2_UINT32_UI let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationWithProgressCompletedHandler_2_UINT32_UINT32Wrapper = InterfaceWrapperBase @@ -1615,7 +1615,7 @@ internal var __x_ABI_C__FIAsyncOperationWithProgressCompletedHandler_2___x_ABI_C let asyncStatus: test_component.AsyncStatus = $2 try __unwrapped__instance(asyncInfo, asyncStatus) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationWithProgressCompletedHandler_2___x_ABI_CWindows__CStorage__CStreams__CIBuffer_UINT32Wrapper = InterfaceWrapperBase @@ -3092,7 +3092,14 @@ internal var __x_ABI_C__FIIterator_1_IInspectableVTable: __x_ABI_C__FIIterator_1 return S_OK }, - GetMany: { _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIIterator_1_IInspectableWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var items: [Any?] = .from(abiBridge: __IMPL_.AnyBridge.self, abi: (count: $1, start: $2)) + let result = __unwrapped__instance.getMany(&items) + items.fill(abi: $2, abiBridge: __IMPL_.AnyBridge.self) + $3?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIIterator_1_IInspectableWrapper = InterfaceWrapperBase public class IIteratorAny: test_component.IInspectable { @@ -3123,6 +3130,17 @@ public class IIteratorAny: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ items: inout [Any?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: __IMPL_.AnyBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIIterator_1_IInspectable.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, _items.count, _items.start, &result)) + } + items = .from(abiBridge: __IMPL_.AnyBridge.self, abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIIterator_1_IInspectableBridge : AbiInterfaceBridge { @@ -3154,6 +3172,11 @@ fileprivate class __x_ABI_C__FIIterator_1_IInspectableImpl : IIterator, AbiInter try! _default.MoveNext() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.getmany) + fileprivate func getMany(_ items: inout [Any?]) -> UInt32 { + try! _default.GetMany(&items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.current) fileprivate var current : Any? { get { try! _default.get_Current() } @@ -3220,7 +3243,16 @@ internal var __x_ABI_C__FIIterator_1_GUIDVTable: __x_ABI_C__FIIterator_1_GUIDVtb return S_OK }, - GetMany: { _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIIterator_1_GUIDWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var items: [Foundation.UUID] = .from(abi: (count: $1, start: $2)) + let result = __unwrapped__instance.getMany(&items) + do { + try items.fill(abi: $2) + } catch { return failWith(error: error) } + $3?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIIterator_1_GUIDWrapper = InterfaceWrapperBase public class IIteratorUUID: test_component.IInspectable { @@ -3250,6 +3282,17 @@ public class IIteratorUUID: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ items: inout [Foundation.UUID]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI { _items in + _ = try perform(as: __x_ABI_C__FIIterator_1_GUID.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, _items.count, _items.start, &result)) + } + items = .from(abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIIterator_1_GUIDBridge : AbiInterfaceBridge { @@ -3281,6 +3324,11 @@ fileprivate class __x_ABI_C__FIIterator_1_GUIDImpl : IIterator, AbiInterfaceImpl try! _default.MoveNext() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.getmany) + fileprivate func getMany(_ items: inout [Foundation.UUID]) -> UInt32 { + try! _default.GetMany(&items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.current) fileprivate var current : Foundation.UUID { get { try! _default.get_Current() } @@ -3347,7 +3395,16 @@ internal var __x_ABI_C__FIIterator_1_HSTRINGVTable: __x_ABI_C__FIIterator_1_HSTR return S_OK }, - GetMany: { _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIIterator_1_HSTRINGWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var items: [String] = .from(abi: (count: $1, start: $2)) + let result = __unwrapped__instance.getMany(&items) + do { + try items.fill(abi: $2) + } catch { return failWith(error: error) } + $3?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIIterator_1_HSTRINGWrapper = InterfaceWrapperBase public class IIteratorString: test_component.IInspectable { @@ -3377,6 +3434,17 @@ public class IIteratorString: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ items: inout [String]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI { _items in + _ = try perform(as: __x_ABI_C__FIIterator_1_HSTRING.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, _items.count, _items.start, &result)) + } + items = .from(abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIIterator_1_HSTRINGBridge : AbiInterfaceBridge { @@ -3408,6 +3476,11 @@ fileprivate class __x_ABI_C__FIIterator_1_HSTRINGImpl : IIterator, AbiInterfaceI try! _default.MoveNext() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.getmany) + fileprivate func getMany(_ items: inout [String]) -> UInt32 { + try! _default.GetMany(&items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.current) fileprivate var current : String { get { try! _default.get_Current() } @@ -3474,7 +3547,16 @@ internal var __x_ABI_C__FIIterator_1___x_ABI_CWindows__CData__CText__CTextSegmen return S_OK }, - GetMany: { _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIIterator_1___x_ABI_CWindows__CData__CText__CTextSegmentWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var items: [test_component.TextSegment] = .from(abi: (count: $1, start: $2)) + let result = __unwrapped__instance.getMany(&items) + do { + try items.fill(abi: $2) + } catch { return failWith(error: error) } + $3?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIIterator_1___x_ABI_CWindows__CData__CText__CTextSegmentWrapper = InterfaceWrapperBase public class IIteratorTextSegment: test_component.IInspectable { @@ -3504,6 +3586,17 @@ public class IIteratorTextSegment: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ items: inout [test_component.TextSegment]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI { _items in + _ = try perform(as: __x_ABI_C__FIIterator_1___x_ABI_CWindows__CData__CText__CTextSegment.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, _items.count, _items.start, &result)) + } + items = .from(abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIIterator_1___x_ABI_CWindows__CData__CText__CTextSegmentBridge : AbiInterfaceBridge { @@ -3535,6 +3628,11 @@ fileprivate class __x_ABI_C__FIIterator_1___x_ABI_CWindows__CData__CText__CTextS try! _default.MoveNext() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.getmany) + fileprivate func getMany(_ items: inout [test_component.TextSegment]) -> UInt32 { + try! _default.GetMany(&items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.current) fileprivate var current : test_component.TextSegment { get { try! _default.get_Current() } @@ -3602,7 +3700,14 @@ internal var __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING_IInspec return S_OK }, - GetMany: { _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING_IInspectableWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var items: [test_component.AnyIKeyValuePair?] = .from(abiBridge: test_component.__x_ABI_C__FIKeyValuePair_2_HSTRING_IInspectableBridge.self, abi: (count: $1, start: $2)) + let result = __unwrapped__instance.getMany(&items) + items.fill(abi: $2, abiBridge: test_component.__x_ABI_C__FIKeyValuePair_2_HSTRING_IInspectableBridge.self) + $3?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING_IInspectableWrapper = InterfaceWrapperBase public class IIteratorIKeyValuePairString_Any: test_component.IInspectable { @@ -3633,6 +3738,17 @@ public class IIteratorIKeyValuePairString_Any: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ items: inout [test_component.AnyIKeyValuePair?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: test_component.__x_ABI_C__FIKeyValuePair_2_HSTRING_IInspectableBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING_IInspectable.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, _items.count, _items.start, &result)) + } + items = .from(abiBridge: test_component.__x_ABI_C__FIKeyValuePair_2_HSTRING_IInspectableBridge.self, abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING_IInspectableBridge : AbiInterfaceBridge { @@ -3664,6 +3780,11 @@ fileprivate class __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING_II try! _default.MoveNext() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.getmany) + fileprivate func getMany(_ items: inout [AnyIKeyValuePair?]) -> UInt32 { + try! _default.GetMany(&items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.current) fileprivate var current : AnyIKeyValuePair? { get { try! _default.get_Current() } @@ -3731,7 +3852,14 @@ internal var __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING_HSTRING return S_OK }, - GetMany: { _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING_HSTRINGWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var items: [test_component.AnyIKeyValuePair?] = .from(abiBridge: test_component.__x_ABI_C__FIKeyValuePair_2_HSTRING_HSTRINGBridge.self, abi: (count: $1, start: $2)) + let result = __unwrapped__instance.getMany(&items) + items.fill(abi: $2, abiBridge: test_component.__x_ABI_C__FIKeyValuePair_2_HSTRING_HSTRINGBridge.self) + $3?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING_HSTRINGWrapper = InterfaceWrapperBase public class IIteratorIKeyValuePairString_String: test_component.IInspectable { @@ -3762,6 +3890,17 @@ public class IIteratorIKeyValuePairString_String: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ items: inout [test_component.AnyIKeyValuePair?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: test_component.__x_ABI_C__FIKeyValuePair_2_HSTRING_HSTRINGBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING_HSTRING.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, _items.count, _items.start, &result)) + } + items = .from(abiBridge: test_component.__x_ABI_C__FIKeyValuePair_2_HSTRING_HSTRINGBridge.self, abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING_HSTRINGBridge : AbiInterfaceBridge { @@ -3793,6 +3932,11 @@ fileprivate class __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING_HS try! _default.MoveNext() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.getmany) + fileprivate func getMany(_ items: inout [AnyIKeyValuePair?]) -> UInt32 { + try! _default.GetMany(&items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.current) fileprivate var current : AnyIKeyValuePair? { get { try! _default.get_Current() } @@ -3860,7 +4004,14 @@ internal var __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING___x_ABI return S_OK }, - GetMany: { _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CData__CText__CTextSegmentWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var items: [test_component.AnyIKeyValuePair?>?] = .from(abiBridge: test_component.__x_ABI_C__FIKeyValuePair_2_HSTRING___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CData__CText__CTextSegmentBridge.self, abi: (count: $1, start: $2)) + let result = __unwrapped__instance.getMany(&items) + items.fill(abi: $2, abiBridge: test_component.__x_ABI_C__FIKeyValuePair_2_HSTRING___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CData__CText__CTextSegmentBridge.self) + $3?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CData__CText__CTextSegmentWrapper = InterfaceWrapperBase public class IIteratorIKeyValuePairString_IVectorViewTextSegment: test_component.IInspectable { @@ -3891,6 +4042,17 @@ public class IIteratorIKeyValuePairString_IVectorViewTextSegment: test_component return .init(from: result) } + open func GetMany(_ items: inout [test_component.AnyIKeyValuePair?>?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: test_component.__x_ABI_C__FIKeyValuePair_2_HSTRING___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CData__CText__CTextSegmentBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CData__CText__CTextSegment.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, _items.count, _items.start, &result)) + } + items = .from(abiBridge: test_component.__x_ABI_C__FIKeyValuePair_2_HSTRING___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CData__CText__CTextSegmentBridge.self, abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CData__CText__CTextSegmentBridge : AbiInterfaceBridge { @@ -3922,6 +4084,11 @@ fileprivate class __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING___ try! _default.MoveNext() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.getmany) + fileprivate func getMany(_ items: inout [AnyIKeyValuePair?>?]) -> UInt32 { + try! _default.GetMany(&items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.current) fileprivate var current : AnyIKeyValuePair?>? { get { try! _default.get_Current() } @@ -3989,7 +4156,14 @@ internal var __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING___x_ABI return S_OK }, - GetMany: { _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING___x_ABI_Ctest__zcomponent__CBaseWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var items: [test_component.AnyIKeyValuePair?] = .from(abiBridge: test_component.__x_ABI_C__FIKeyValuePair_2_HSTRING___x_ABI_Ctest__zcomponent__CBaseBridge.self, abi: (count: $1, start: $2)) + let result = __unwrapped__instance.getMany(&items) + items.fill(abi: $2, abiBridge: test_component.__x_ABI_C__FIKeyValuePair_2_HSTRING___x_ABI_Ctest__zcomponent__CBaseBridge.self) + $3?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING___x_ABI_Ctest__zcomponent__CBaseWrapper = InterfaceWrapperBase public class IIteratorIKeyValuePairString_Base: test_component.IInspectable { @@ -4020,6 +4194,17 @@ public class IIteratorIKeyValuePairString_Base: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ items: inout [test_component.AnyIKeyValuePair?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: test_component.__x_ABI_C__FIKeyValuePair_2_HSTRING___x_ABI_Ctest__zcomponent__CBaseBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING___x_ABI_Ctest__zcomponent__CBase.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, _items.count, _items.start, &result)) + } + items = .from(abiBridge: test_component.__x_ABI_C__FIKeyValuePair_2_HSTRING___x_ABI_Ctest__zcomponent__CBaseBridge.self, abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING___x_ABI_Ctest__zcomponent__CBaseBridge : AbiInterfaceBridge { @@ -4051,6 +4236,11 @@ fileprivate class __x_ABI_C__FIIterator_1___x_ABI_C__FIKeyValuePair_2_HSTRING___ try! _default.MoveNext() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.getmany) + fileprivate func getMany(_ items: inout [AnyIKeyValuePair?]) -> UInt32 { + try! _default.GetMany(&items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.current) fileprivate var current : AnyIKeyValuePair? { get { try! _default.get_Current() } @@ -4118,7 +4308,14 @@ internal var __x_ABI_C__FIIterator_1___x_ABI_CWindows__CFoundation__CIWwwFormUrl return S_OK }, - GetMany: { _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIIterator_1___x_ABI_CWindows__CFoundation__CIWwwFormUrlDecoderEntryWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var items: [test_component.AnyIWwwFormUrlDecoderEntry?] = .from(abiBridge: __IMPL_Windows_Foundation.IWwwFormUrlDecoderEntryBridge.self, abi: (count: $1, start: $2)) + let result = __unwrapped__instance.getMany(&items) + items.fill(abi: $2, abiBridge: __IMPL_Windows_Foundation.IWwwFormUrlDecoderEntryBridge.self) + $3?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIIterator_1___x_ABI_CWindows__CFoundation__CIWwwFormUrlDecoderEntryWrapper = InterfaceWrapperBase public class IIteratorIWwwFormUrlDecoderEntry: test_component.IInspectable { @@ -4149,6 +4346,17 @@ public class IIteratorIWwwFormUrlDecoderEntry: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ items: inout [test_component.AnyIWwwFormUrlDecoderEntry?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: __IMPL_Windows_Foundation.IWwwFormUrlDecoderEntryBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIIterator_1___x_ABI_CWindows__CFoundation__CIWwwFormUrlDecoderEntry.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, _items.count, _items.start, &result)) + } + items = .from(abiBridge: __IMPL_Windows_Foundation.IWwwFormUrlDecoderEntryBridge.self, abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIIterator_1___x_ABI_CWindows__CFoundation__CIWwwFormUrlDecoderEntryBridge : AbiInterfaceBridge { @@ -4180,6 +4388,11 @@ fileprivate class __x_ABI_C__FIIterator_1___x_ABI_CWindows__CFoundation__CIWwwFo try! _default.MoveNext() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.getmany) + fileprivate func getMany(_ items: inout [test_component.AnyIWwwFormUrlDecoderEntry?]) -> UInt32 { + try! _default.GetMany(&items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.current) fileprivate var current : test_component.AnyIWwwFormUrlDecoderEntry? { get { try! _default.get_Current() } @@ -4247,7 +4460,14 @@ internal var __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CIStorageItemVT return S_OK }, - GetMany: { _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CIStorageItemWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var items: [test_component.AnyIStorageItem?] = .from(abiBridge: __IMPL_Windows_Storage.IStorageItemBridge.self, abi: (count: $1, start: $2)) + let result = __unwrapped__instance.getMany(&items) + items.fill(abi: $2, abiBridge: __IMPL_Windows_Storage.IStorageItemBridge.self) + $3?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CIStorageItemWrapper = InterfaceWrapperBase public class IIteratorIStorageItem: test_component.IInspectable { @@ -4278,6 +4498,17 @@ public class IIteratorIStorageItem: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ items: inout [test_component.AnyIStorageItem?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: __IMPL_Windows_Storage.IStorageItemBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CIStorageItem.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, _items.count, _items.start, &result)) + } + items = .from(abiBridge: __IMPL_Windows_Storage.IStorageItemBridge.self, abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CIStorageItemBridge : AbiInterfaceBridge { @@ -4309,6 +4540,11 @@ fileprivate class __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CIStorageI try! _default.MoveNext() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.getmany) + fileprivate func getMany(_ items: inout [test_component.AnyIStorageItem?]) -> UInt32 { + try! _default.GetMany(&items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.current) fileprivate var current : test_component.AnyIStorageItem? { get { try! _default.get_Current() } @@ -4376,7 +4612,16 @@ internal var __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CSearch__CSortE return S_OK }, - GetMany: { _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CSearch__CSortEntryWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var items: [test_component.SortEntry] = .from(abi: (count: $1, start: $2)) + let result = __unwrapped__instance.getMany(&items) + do { + try items.fill(abi: $2) + } catch { return failWith(error: error) } + $3?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CSearch__CSortEntryWrapper = InterfaceWrapperBase public class IIteratorSortEntry: test_component.IInspectable { @@ -4406,6 +4651,17 @@ public class IIteratorSortEntry: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ items: inout [test_component.SortEntry]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI { _items in + _ = try perform(as: __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CSearch__CSortEntry.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, _items.count, _items.start, &result)) + } + items = .from(abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CSearch__CSortEntryBridge : AbiInterfaceBridge { @@ -4437,6 +4693,11 @@ fileprivate class __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CSearch__C try! _default.MoveNext() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.getmany) + fileprivate func getMany(_ items: inout [test_component.SortEntry]) -> UInt32 { + try! _default.GetMany(&items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.current) fileprivate var current : test_component.SortEntry { get { try! _default.get_Current() } @@ -4503,7 +4764,14 @@ internal var __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CStorageFileVTa return S_OK }, - GetMany: { _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CStorageFileWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var items: [test_component.StorageFile?] = .from(abiBridge: __IMPL_Windows_Storage.StorageFileBridge.self, abi: (count: $1, start: $2)) + let result = __unwrapped__instance.getMany(&items) + items.fill(abi: $2, abiBridge: __IMPL_Windows_Storage.StorageFileBridge.self) + $3?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CStorageFileWrapper = InterfaceWrapperBase public class IIteratorStorageFile: test_component.IInspectable { @@ -4534,6 +4802,17 @@ public class IIteratorStorageFile: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ items: inout [test_component.StorageFile?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: __IMPL_Windows_Storage.StorageFileBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CStorageFile.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, _items.count, _items.start, &result)) + } + items = .from(abiBridge: __IMPL_Windows_Storage.StorageFileBridge.self, abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CStorageFileBridge : AbiInterfaceBridge { @@ -4565,6 +4844,11 @@ fileprivate class __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CStorageFi try! _default.MoveNext() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.getmany) + fileprivate func getMany(_ items: inout [test_component.StorageFile?]) -> UInt32 { + try! _default.GetMany(&items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.current) fileprivate var current : test_component.StorageFile? { get { try! _default.get_Current() } @@ -4631,7 +4915,14 @@ internal var __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CStorageFolderV return S_OK }, - GetMany: { _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var items: [test_component.StorageFolder?] = .from(abiBridge: __IMPL_Windows_Storage.StorageFolderBridge.self, abi: (count: $1, start: $2)) + let result = __unwrapped__instance.getMany(&items) + items.fill(abi: $2, abiBridge: __IMPL_Windows_Storage.StorageFolderBridge.self) + $3?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper = InterfaceWrapperBase public class IIteratorStorageFolder: test_component.IInspectable { @@ -4662,6 +4953,17 @@ public class IIteratorStorageFolder: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ items: inout [test_component.StorageFolder?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: __IMPL_Windows_Storage.StorageFolderBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CStorageFolder.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, _items.count, _items.start, &result)) + } + items = .from(abiBridge: __IMPL_Windows_Storage.StorageFolderBridge.self, abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CStorageFolderBridge : AbiInterfaceBridge { @@ -4693,6 +4995,11 @@ fileprivate class __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CStorageFo try! _default.MoveNext() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.getmany) + fileprivate func getMany(_ items: inout [test_component.StorageFolder?]) -> UInt32 { + try! _default.GetMany(&items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.current) fileprivate var current : test_component.StorageFolder? { get { try! _default.get_Current() } @@ -4759,7 +5066,14 @@ internal var __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CStorageLibrary return S_OK }, - GetMany: { _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CStorageLibraryChangeWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var items: [test_component.StorageLibraryChange?] = .from(abiBridge: __IMPL_Windows_Storage.StorageLibraryChangeBridge.self, abi: (count: $1, start: $2)) + let result = __unwrapped__instance.getMany(&items) + items.fill(abi: $2, abiBridge: __IMPL_Windows_Storage.StorageLibraryChangeBridge.self) + $3?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CStorageLibraryChangeWrapper = InterfaceWrapperBase public class IIteratorStorageLibraryChange: test_component.IInspectable { @@ -4790,6 +5104,17 @@ public class IIteratorStorageLibraryChange: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ items: inout [test_component.StorageLibraryChange?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: __IMPL_Windows_Storage.StorageLibraryChangeBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CStorageLibraryChange.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, _items.count, _items.start, &result)) + } + items = .from(abiBridge: __IMPL_Windows_Storage.StorageLibraryChangeBridge.self, abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CStorageLibraryChangeBridge : AbiInterfaceBridge { @@ -4821,6 +5146,11 @@ fileprivate class __x_ABI_C__FIIterator_1___x_ABI_CWindows__CStorage__CStorageLi try! _default.MoveNext() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.getmany) + fileprivate func getMany(_ items: inout [test_component.StorageLibraryChange?]) -> UInt32 { + try! _default.GetMany(&items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.current) fileprivate var current : test_component.StorageLibraryChange? { get { try! _default.get_Current() } @@ -4887,7 +5217,14 @@ internal var __x_ABI_C__FIIterator_1___x_ABI_Ctest__zcomponent__CBaseVTable: __x return S_OK }, - GetMany: { _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIIterator_1___x_ABI_Ctest__zcomponent__CBaseWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var items: [test_component.Base?] = .from(abiBridge: __IMPL_test_component.BaseBridge.self, abi: (count: $1, start: $2)) + let result = __unwrapped__instance.getMany(&items) + items.fill(abi: $2, abiBridge: __IMPL_test_component.BaseBridge.self) + $3?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIIterator_1___x_ABI_Ctest__zcomponent__CBaseWrapper = InterfaceWrapperBase public class IIteratorBase: test_component.IInspectable { @@ -4918,6 +5255,17 @@ public class IIteratorBase: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ items: inout [test_component.Base?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: __IMPL_test_component.BaseBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIIterator_1___x_ABI_Ctest__zcomponent__CBase.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, _items.count, _items.start, &result)) + } + items = .from(abiBridge: __IMPL_test_component.BaseBridge.self, abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIIterator_1___x_ABI_Ctest__zcomponent__CBaseBridge : AbiInterfaceBridge { @@ -4949,6 +5297,11 @@ fileprivate class __x_ABI_C__FIIterator_1___x_ABI_Ctest__zcomponent__CBaseImpl : try! _default.MoveNext() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.getmany) + fileprivate func getMany(_ items: inout [Base?]) -> UInt32 { + try! _default.GetMany(&items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.current) fileprivate var current : Base? { get { try! _default.get_Current() } @@ -5016,7 +5369,14 @@ internal var __x_ABI_C__FIIterator_1___x_ABI_Ctest__zcomponent__CIBasicVTable: _ return S_OK }, - GetMany: { _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIIterator_1___x_ABI_Ctest__zcomponent__CIBasicWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + var items: [test_component.AnyIBasic?] = .from(abiBridge: __IMPL_test_component.IBasicBridge.self, abi: (count: $1, start: $2)) + let result = __unwrapped__instance.getMany(&items) + items.fill(abi: $2, abiBridge: __IMPL_test_component.IBasicBridge.self) + $3?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIIterator_1___x_ABI_Ctest__zcomponent__CIBasicWrapper = InterfaceWrapperBase public class IIteratorIBasic: test_component.IInspectable { @@ -5047,6 +5407,17 @@ public class IIteratorIBasic: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ items: inout [test_component.AnyIBasic?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: __IMPL_test_component.IBasicBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIIterator_1___x_ABI_Ctest__zcomponent__CIBasic.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, _items.count, _items.start, &result)) + } + items = .from(abiBridge: __IMPL_test_component.IBasicBridge.self, abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIIterator_1___x_ABI_Ctest__zcomponent__CIBasicBridge : AbiInterfaceBridge { @@ -5078,6 +5449,11 @@ fileprivate class __x_ABI_C__FIIterator_1___x_ABI_Ctest__zcomponent__CIBasicImpl try! _default.MoveNext() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.getmany) + fileprivate func getMany(_ items: inout [AnyIBasic?]) -> UInt32 { + try! _default.GetMany(&items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iiterator-1.current) fileprivate var current : AnyIBasic? { get { try! _default.get_Current() } @@ -7670,6 +8046,11 @@ fileprivate class __x_ABI_C__FIObservableVector_1___x_ABI_Ctest__zcomponent__CBa try! _IVector.Clear() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iobservablevector-1.getmany) + fileprivate func getMany(_ startIndex: UInt32, _ items: inout [Base?]) -> UInt32 { + try! _IVector.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iobservablevector-1.replaceall) fileprivate func replaceAll(_ items: [Base?]) { try! _IVector.ReplaceAll(items) @@ -7873,6 +8254,11 @@ fileprivate class __x_ABI_C__FIObservableVector_1___x_ABI_Ctest__zcomponent__CIB try! _IVector.Clear() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iobservablevector-1.getmany) + fileprivate func getMany(_ startIndex: UInt32, _ items: inout [AnyIBasic?]) -> UInt32 { + try! _IVector.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.iobservablevector-1.replaceall) fileprivate func replaceAll(_ items: [AnyIBasic?]) { try! _IVector.ReplaceAll(items) @@ -7951,7 +8337,15 @@ internal var __x_ABI_C__FIVectorView_1_IInspectableVTable: __x_ABI_C__FIVectorVi return S_OK }, - GetMany: { _, _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIVectorView_1_IInspectableWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let startIndex: UInt32 = $1 + var items: [Any?] = .from(abiBridge: __IMPL_.AnyBridge.self, abi: (count: $2, start: $3)) + let result = __unwrapped__instance.getMany(startIndex, &items) + items.fill(abi: $3, abiBridge: __IMPL_.AnyBridge.self) + $4?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIVectorView_1_IInspectableWrapper = InterfaceWrapperBase public class IVectorViewAny: test_component.IInspectable { @@ -7984,6 +8378,17 @@ public class IVectorViewAny: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ startIndex: UInt32, _ items: inout [Any?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: __IMPL_.AnyBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIVectorView_1_IInspectable.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, startIndex, _items.count, _items.start, &result)) + } + items = .from(abiBridge: __IMPL_.AnyBridge.self, abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIVectorView_1_IInspectableBridge : AbiInterfaceBridge { @@ -8041,6 +8446,11 @@ fileprivate class __x_ABI_C__FIVectorView_1_IInspectableImpl : IVectorView, AbiI try! _default.IndexOf(value, &index) } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.getmany) + fileprivate func getMany(_ startIndex: UInt32, _ items: inout [Any?]) -> UInt32 { + try! _default.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.size) fileprivate var size : UInt32 { get { try! _default.get_Size() } @@ -8113,7 +8523,17 @@ internal var __x_ABI_C__FIVectorView_1_GUIDVTable: __x_ABI_C__FIVectorView_1_GUI return S_OK }, - GetMany: { _, _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIVectorView_1_GUIDWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let startIndex: UInt32 = $1 + var items: [Foundation.UUID] = .from(abi: (count: $2, start: $3)) + let result = __unwrapped__instance.getMany(startIndex, &items) + do { + try items.fill(abi: $3) + } catch { return failWith(error: error) } + $4?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIVectorView_1_GUIDWrapper = InterfaceWrapperBase public class IVectorViewUUID: test_component.IInspectable { @@ -8143,6 +8563,17 @@ public class IVectorViewUUID: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ startIndex: UInt32, _ items: inout [Foundation.UUID]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI { _items in + _ = try perform(as: __x_ABI_C__FIVectorView_1_GUID.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, startIndex, _items.count, _items.start, &result)) + } + items = .from(abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIVectorView_1_GUIDBridge : AbiInterfaceBridge { @@ -8200,6 +8631,11 @@ fileprivate class __x_ABI_C__FIVectorView_1_GUIDImpl : IVectorView, AbiInterface try! _default.IndexOf(value, &index) } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.getmany) + fileprivate func getMany(_ startIndex: UInt32, _ items: inout [Foundation.UUID]) -> UInt32 { + try! _default.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.size) fileprivate var size : UInt32 { get { try! _default.get_Size() } @@ -8272,7 +8708,17 @@ internal var __x_ABI_C__FIVectorView_1_HSTRINGVTable: __x_ABI_C__FIVectorView_1_ return S_OK }, - GetMany: { _, _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIVectorView_1_HSTRINGWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let startIndex: UInt32 = $1 + var items: [String] = .from(abi: (count: $2, start: $3)) + let result = __unwrapped__instance.getMany(startIndex, &items) + do { + try items.fill(abi: $3) + } catch { return failWith(error: error) } + $4?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIVectorView_1_HSTRINGWrapper = InterfaceWrapperBase public class IVectorViewString: test_component.IInspectable { @@ -8303,6 +8749,17 @@ public class IVectorViewString: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ startIndex: UInt32, _ items: inout [String]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI { _items in + _ = try perform(as: __x_ABI_C__FIVectorView_1_HSTRING.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, startIndex, _items.count, _items.start, &result)) + } + items = .from(abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIVectorView_1_HSTRINGBridge : AbiInterfaceBridge { @@ -8360,6 +8817,11 @@ fileprivate class __x_ABI_C__FIVectorView_1_HSTRINGImpl : IVectorView, AbiInterf try! _default.IndexOf(value, &index) } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.getmany) + fileprivate func getMany(_ startIndex: UInt32, _ items: inout [String]) -> UInt32 { + try! _default.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.size) fileprivate var size : UInt32 { get { try! _default.get_Size() } @@ -8432,7 +8894,17 @@ internal var __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CData__CText__CTextSegm return S_OK }, - GetMany: { _, _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CData__CText__CTextSegmentWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let startIndex: UInt32 = $1 + var items: [test_component.TextSegment] = .from(abi: (count: $2, start: $3)) + let result = __unwrapped__instance.getMany(startIndex, &items) + do { + try items.fill(abi: $3) + } catch { return failWith(error: error) } + $4?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CData__CText__CTextSegmentWrapper = InterfaceWrapperBase public class IVectorViewTextSegment: test_component.IInspectable { @@ -8462,6 +8934,17 @@ public class IVectorViewTextSegment: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ startIndex: UInt32, _ items: inout [test_component.TextSegment]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI { _items in + _ = try perform(as: __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CData__CText__CTextSegment.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, startIndex, _items.count, _items.start, &result)) + } + items = .from(abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CData__CText__CTextSegmentBridge : AbiInterfaceBridge { @@ -8519,6 +9002,11 @@ fileprivate class __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CData__CText__CTex try! _default.IndexOf(value, &index) } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.getmany) + fileprivate func getMany(_ startIndex: UInt32, _ items: inout [test_component.TextSegment]) -> UInt32 { + try! _default.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.size) fileprivate var size : UInt32 { get { try! _default.get_Size() } @@ -8592,7 +9080,15 @@ internal var __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CFoundation__CIWwwFormU return S_OK }, - GetMany: { _, _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CFoundation__CIWwwFormUrlDecoderEntryWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let startIndex: UInt32 = $1 + var items: [test_component.AnyIWwwFormUrlDecoderEntry?] = .from(abiBridge: __IMPL_Windows_Foundation.IWwwFormUrlDecoderEntryBridge.self, abi: (count: $2, start: $3)) + let result = __unwrapped__instance.getMany(startIndex, &items) + items.fill(abi: $3, abiBridge: __IMPL_Windows_Foundation.IWwwFormUrlDecoderEntryBridge.self) + $4?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CFoundation__CIWwwFormUrlDecoderEntryWrapper = InterfaceWrapperBase public class IVectorViewIWwwFormUrlDecoderEntry: test_component.IInspectable { @@ -8625,6 +9121,17 @@ public class IVectorViewIWwwFormUrlDecoderEntry: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ startIndex: UInt32, _ items: inout [test_component.AnyIWwwFormUrlDecoderEntry?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: __IMPL_Windows_Foundation.IWwwFormUrlDecoderEntryBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CFoundation__CIWwwFormUrlDecoderEntry.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, startIndex, _items.count, _items.start, &result)) + } + items = .from(abiBridge: __IMPL_Windows_Foundation.IWwwFormUrlDecoderEntryBridge.self, abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CFoundation__CIWwwFormUrlDecoderEntryBridge : AbiInterfaceBridge { @@ -8682,6 +9189,11 @@ fileprivate class __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CFoundation__CIWww try! _default.IndexOf(value, &index) } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.getmany) + fileprivate func getMany(_ startIndex: UInt32, _ items: inout [test_component.AnyIWwwFormUrlDecoderEntry?]) -> UInt32 { + try! _default.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.size) fileprivate var size : UInt32 { get { try! _default.get_Size() } @@ -8755,7 +9267,15 @@ internal var __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CIStorageItem return S_OK }, - GetMany: { _, _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CIStorageItemWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let startIndex: UInt32 = $1 + var items: [test_component.AnyIStorageItem?] = .from(abiBridge: __IMPL_Windows_Storage.IStorageItemBridge.self, abi: (count: $2, start: $3)) + let result = __unwrapped__instance.getMany(startIndex, &items) + items.fill(abi: $3, abiBridge: __IMPL_Windows_Storage.IStorageItemBridge.self) + $4?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CIStorageItemWrapper = InterfaceWrapperBase public class IVectorViewIStorageItem: test_component.IInspectable { @@ -8788,6 +9308,17 @@ public class IVectorViewIStorageItem: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ startIndex: UInt32, _ items: inout [test_component.AnyIStorageItem?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: __IMPL_Windows_Storage.IStorageItemBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CIStorageItem.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, startIndex, _items.count, _items.start, &result)) + } + items = .from(abiBridge: __IMPL_Windows_Storage.IStorageItemBridge.self, abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CIStorageItemBridge : AbiInterfaceBridge { @@ -8845,6 +9376,11 @@ fileprivate class __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CIStorag try! _default.IndexOf(value, &index) } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.getmany) + fileprivate func getMany(_ startIndex: UInt32, _ items: inout [test_component.AnyIStorageItem?]) -> UInt32 { + try! _default.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.size) fileprivate var size : UInt32 { get { try! _default.get_Size() } @@ -8918,7 +9454,17 @@ internal var __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CSearch__CSor return S_OK }, - GetMany: { _, _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CSearch__CSortEntryWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let startIndex: UInt32 = $1 + var items: [test_component.SortEntry] = .from(abi: (count: $2, start: $3)) + let result = __unwrapped__instance.getMany(startIndex, &items) + do { + try items.fill(abi: $3) + } catch { return failWith(error: error) } + $4?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CSearch__CSortEntryWrapper = InterfaceWrapperBase public class IVectorViewSortEntry: test_component.IInspectable { @@ -8949,6 +9495,17 @@ public class IVectorViewSortEntry: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ startIndex: UInt32, _ items: inout [test_component.SortEntry]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI { _items in + _ = try perform(as: __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CSearch__CSortEntry.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, startIndex, _items.count, _items.start, &result)) + } + items = .from(abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CSearch__CSortEntryBridge : AbiInterfaceBridge { @@ -9006,6 +9563,11 @@ fileprivate class __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CSearch_ try! _default.IndexOf(value, &index) } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.getmany) + fileprivate func getMany(_ startIndex: UInt32, _ items: inout [test_component.SortEntry]) -> UInt32 { + try! _default.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.size) fileprivate var size : UInt32 { get { try! _default.get_Size() } @@ -9078,7 +9640,15 @@ internal var __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFileV return S_OK }, - GetMany: { _, _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFileWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let startIndex: UInt32 = $1 + var items: [test_component.StorageFile?] = .from(abiBridge: __IMPL_Windows_Storage.StorageFileBridge.self, abi: (count: $2, start: $3)) + let result = __unwrapped__instance.getMany(startIndex, &items) + items.fill(abi: $3, abiBridge: __IMPL_Windows_Storage.StorageFileBridge.self) + $4?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFileWrapper = InterfaceWrapperBase public class IVectorViewStorageFile: test_component.IInspectable { @@ -9109,6 +9679,17 @@ public class IVectorViewStorageFile: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ startIndex: UInt32, _ items: inout [test_component.StorageFile?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: __IMPL_Windows_Storage.StorageFileBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFile.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, startIndex, _items.count, _items.start, &result)) + } + items = .from(abiBridge: __IMPL_Windows_Storage.StorageFileBridge.self, abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFileBridge : AbiInterfaceBridge { @@ -9166,6 +9747,11 @@ fileprivate class __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorage try! _default.IndexOf(value, &index) } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.getmany) + fileprivate func getMany(_ startIndex: UInt32, _ items: inout [test_component.StorageFile?]) -> UInt32 { + try! _default.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.size) fileprivate var size : UInt32 { get { try! _default.get_Size() } @@ -9238,7 +9824,15 @@ internal var __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFolde return S_OK }, - GetMany: { _, _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let startIndex: UInt32 = $1 + var items: [test_component.StorageFolder?] = .from(abiBridge: __IMPL_Windows_Storage.StorageFolderBridge.self, abi: (count: $2, start: $3)) + let result = __unwrapped__instance.getMany(startIndex, &items) + items.fill(abi: $3, abiBridge: __IMPL_Windows_Storage.StorageFolderBridge.self) + $4?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper = InterfaceWrapperBase public class IVectorViewStorageFolder: test_component.IInspectable { @@ -9269,6 +9863,17 @@ public class IVectorViewStorageFolder: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ startIndex: UInt32, _ items: inout [test_component.StorageFolder?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: __IMPL_Windows_Storage.StorageFolderBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFolder.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, startIndex, _items.count, _items.start, &result)) + } + items = .from(abiBridge: __IMPL_Windows_Storage.StorageFolderBridge.self, abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFolderBridge : AbiInterfaceBridge { @@ -9326,6 +9931,11 @@ fileprivate class __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorage try! _default.IndexOf(value, &index) } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.getmany) + fileprivate func getMany(_ startIndex: UInt32, _ items: inout [test_component.StorageFolder?]) -> UInt32 { + try! _default.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.size) fileprivate var size : UInt32 { get { try! _default.get_Size() } @@ -9398,7 +10008,15 @@ internal var __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageLibra return S_OK }, - GetMany: { _, _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageLibraryChangeWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let startIndex: UInt32 = $1 + var items: [test_component.StorageLibraryChange?] = .from(abiBridge: __IMPL_Windows_Storage.StorageLibraryChangeBridge.self, abi: (count: $2, start: $3)) + let result = __unwrapped__instance.getMany(startIndex, &items) + items.fill(abi: $3, abiBridge: __IMPL_Windows_Storage.StorageLibraryChangeBridge.self) + $4?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageLibraryChangeWrapper = InterfaceWrapperBase public class IVectorViewStorageLibraryChange: test_component.IInspectable { @@ -9429,6 +10047,17 @@ public class IVectorViewStorageLibraryChange: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ startIndex: UInt32, _ items: inout [test_component.StorageLibraryChange?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: __IMPL_Windows_Storage.StorageLibraryChangeBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageLibraryChange.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, startIndex, _items.count, _items.start, &result)) + } + items = .from(abiBridge: __IMPL_Windows_Storage.StorageLibraryChangeBridge.self, abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageLibraryChangeBridge : AbiInterfaceBridge { @@ -9486,6 +10115,11 @@ fileprivate class __x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorage try! _default.IndexOf(value, &index) } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.getmany) + fileprivate func getMany(_ startIndex: UInt32, _ items: inout [test_component.StorageLibraryChange?]) -> UInt32 { + try! _default.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.size) fileprivate var size : UInt32 { get { try! _default.get_Size() } @@ -9558,7 +10192,15 @@ internal var __x_ABI_C__FIVectorView_1___x_ABI_Ctest__zcomponent__CBaseVTable: _ return S_OK }, - GetMany: { _, _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIVectorView_1___x_ABI_Ctest__zcomponent__CBaseWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let startIndex: UInt32 = $1 + var items: [test_component.Base?] = .from(abiBridge: __IMPL_test_component.BaseBridge.self, abi: (count: $2, start: $3)) + let result = __unwrapped__instance.getMany(startIndex, &items) + items.fill(abi: $3, abiBridge: __IMPL_test_component.BaseBridge.self) + $4?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIVectorView_1___x_ABI_Ctest__zcomponent__CBaseWrapper = InterfaceWrapperBase public class IVectorViewBase: test_component.IInspectable { @@ -9589,6 +10231,17 @@ public class IVectorViewBase: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ startIndex: UInt32, _ items: inout [test_component.Base?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: __IMPL_test_component.BaseBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIVectorView_1___x_ABI_Ctest__zcomponent__CBase.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, startIndex, _items.count, _items.start, &result)) + } + items = .from(abiBridge: __IMPL_test_component.BaseBridge.self, abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIVectorView_1___x_ABI_Ctest__zcomponent__CBaseBridge : AbiInterfaceBridge { @@ -9646,6 +10299,11 @@ fileprivate class __x_ABI_C__FIVectorView_1___x_ABI_Ctest__zcomponent__CBaseImpl try! _default.IndexOf(value, &index) } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.getmany) + fileprivate func getMany(_ startIndex: UInt32, _ items: inout [Base?]) -> UInt32 { + try! _default.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.size) fileprivate var size : UInt32 { get { try! _default.get_Size() } @@ -9719,7 +10377,15 @@ internal var __x_ABI_C__FIVectorView_1___x_ABI_Ctest__zcomponent__CIBasicVTable: return S_OK }, - GetMany: { _, _, _, _, _ in return failWith(hr: E_NOTIMPL) } + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIVectorView_1___x_ABI_Ctest__zcomponent__CIBasicWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let startIndex: UInt32 = $1 + var items: [test_component.AnyIBasic?] = .from(abiBridge: __IMPL_test_component.IBasicBridge.self, abi: (count: $2, start: $3)) + let result = __unwrapped__instance.getMany(startIndex, &items) + items.fill(abi: $3, abiBridge: __IMPL_test_component.IBasicBridge.self) + $4?.initialize(to: result) + return S_OK + } ) typealias __x_ABI_C__FIVectorView_1___x_ABI_Ctest__zcomponent__CIBasicWrapper = InterfaceWrapperBase public class IVectorViewIBasic: test_component.IInspectable { @@ -9752,6 +10418,17 @@ public class IVectorViewIBasic: test_component.IInspectable { return .init(from: result) } + open func GetMany(_ startIndex: UInt32, _ items: inout [test_component.AnyIBasic?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: __IMPL_test_component.IBasicBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIVectorView_1___x_ABI_Ctest__zcomponent__CIBasic.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, startIndex, _items.count, _items.start, &result)) + } + items = .from(abiBridge: __IMPL_test_component.IBasicBridge.self, abi: _items) + } + return result + } + } internal enum __x_ABI_C__FIVectorView_1___x_ABI_Ctest__zcomponent__CIBasicBridge : AbiInterfaceBridge { @@ -9809,6 +10486,11 @@ fileprivate class __x_ABI_C__FIVectorView_1___x_ABI_Ctest__zcomponent__CIBasicIm try! _default.IndexOf(value, &index) } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.getmany) + fileprivate func getMany(_ startIndex: UInt32, _ items: inout [AnyIBasic?]) -> UInt32 { + try! _default.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivectorview-1.size) fileprivate var size : UInt32 { get { try! _default.get_Size() } @@ -9932,7 +10614,15 @@ internal var __x_ABI_C__FIVector_1_IInspectableVTable: __x_ABI_C__FIVector_1_IIn return S_OK }, - GetMany: { _, _, _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIVector_1_IInspectableWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let startIndex: UInt32 = $1 + var items: [Any?] = .from(abiBridge: __IMPL_.AnyBridge.self, abi: (count: $2, start: $3)) + let result = __unwrapped__instance.getMany(startIndex, &items) + items.fill(abi: $3, abiBridge: __IMPL_.AnyBridge.self) + $4?.initialize(to: result) + return S_OK + }, ReplaceAll: { guard let __unwrapped__instance = __x_ABI_C__FIVector_1_IInspectableWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } @@ -10023,10 +10713,21 @@ public class IVectorAny: test_component.IInspectable { } } + open func GetMany(_ startIndex: UInt32, _ items: inout [Any?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: __IMPL_.AnyBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIVector_1_IInspectable.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, startIndex, _items.count, _items.start, &result)) + } + items = .from(abiBridge: __IMPL_.AnyBridge.self, abi: _items) + } + return result + } + open func ReplaceAll(_ items: [Any?]) throws { - try items.toABI(abiBridge: __IMPL_.AnyBridge.self) { (count, _items) in + try items.toABI(abiBridge: __IMPL_.AnyBridge.self) { _items in _ = try perform(as: __x_ABI_C__FIVector_1_IInspectable.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.ReplaceAll(pThis, count, _items)) + try CHECKED(pThis.pointee.lpVtbl.pointee.ReplaceAll(pThis, _items.count, _items.start)) } } } @@ -10132,6 +10833,11 @@ fileprivate class __x_ABI_C__FIVector_1_IInspectableImpl : IVector, AbiInterface try! _default.Clear() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivector-1.getmany) + fileprivate func getMany(_ startIndex: UInt32, _ items: inout [Any?]) -> UInt32 { + try! _default.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivector-1.replaceall) fileprivate func replaceAll(_ items: [Any?]) { try! _default.ReplaceAll(items) @@ -10259,7 +10965,17 @@ internal var __x_ABI_C__FIVector_1_GUIDVTable: __x_ABI_C__FIVector_1_GUIDVtbl = return S_OK }, - GetMany: { _, _, _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIVector_1_GUIDWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let startIndex: UInt32 = $1 + var items: [Foundation.UUID] = .from(abi: (count: $2, start: $3)) + let result = __unwrapped__instance.getMany(startIndex, &items) + do { + try items.fill(abi: $3) + } catch { return failWith(error: error) } + $4?.initialize(to: result) + return S_OK + }, ReplaceAll: { guard let __unwrapped__instance = __x_ABI_C__FIVector_1_GUIDWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } @@ -10341,10 +11057,21 @@ public class IVectorUUID: test_component.IInspectable { } } + open func GetMany(_ startIndex: UInt32, _ items: inout [Foundation.UUID]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI { _items in + _ = try perform(as: __x_ABI_C__FIVector_1_GUID.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, startIndex, _items.count, _items.start, &result)) + } + items = .from(abi: _items) + } + return result + } + open func ReplaceAll(_ items: [Foundation.UUID]) throws { - try items.toABI { (count, _items) in + try items.toABI { _items in _ = try perform(as: __x_ABI_C__FIVector_1_GUID.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.ReplaceAll(pThis, count, _items)) + try CHECKED(pThis.pointee.lpVtbl.pointee.ReplaceAll(pThis, _items.count, _items.start)) } } } @@ -10450,6 +11177,11 @@ fileprivate class __x_ABI_C__FIVector_1_GUIDImpl : IVector, AbiInterfaceImpl { try! _default.Clear() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivector-1.getmany) + fileprivate func getMany(_ startIndex: UInt32, _ items: inout [Foundation.UUID]) -> UInt32 { + try! _default.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivector-1.replaceall) fileprivate func replaceAll(_ items: [Foundation.UUID]) { try! _default.ReplaceAll(items) @@ -10577,7 +11309,17 @@ internal var __x_ABI_C__FIVector_1_HSTRINGVTable: __x_ABI_C__FIVector_1_HSTRINGV return S_OK }, - GetMany: { _, _, _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIVector_1_HSTRINGWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let startIndex: UInt32 = $1 + var items: [String] = .from(abi: (count: $2, start: $3)) + let result = __unwrapped__instance.getMany(startIndex, &items) + do { + try items.fill(abi: $3) + } catch { return failWith(error: error) } + $4?.initialize(to: result) + return S_OK + }, ReplaceAll: { guard let __unwrapped__instance = __x_ABI_C__FIVector_1_HSTRINGWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } @@ -10663,10 +11405,21 @@ public class IVectorString: test_component.IInspectable { } } + open func GetMany(_ startIndex: UInt32, _ items: inout [String]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI { _items in + _ = try perform(as: __x_ABI_C__FIVector_1_HSTRING.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, startIndex, _items.count, _items.start, &result)) + } + items = .from(abi: _items) + } + return result + } + open func ReplaceAll(_ items: [String]) throws { - try items.toABI { (count, _items) in + try items.toABI { _items in _ = try perform(as: __x_ABI_C__FIVector_1_HSTRING.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.ReplaceAll(pThis, count, _items)) + try CHECKED(pThis.pointee.lpVtbl.pointee.ReplaceAll(pThis, _items.count, _items.start)) } } } @@ -10772,6 +11525,11 @@ fileprivate class __x_ABI_C__FIVector_1_HSTRINGImpl : IVector, AbiInterfaceImpl try! _default.Clear() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivector-1.getmany) + fileprivate func getMany(_ startIndex: UInt32, _ items: inout [String]) -> UInt32 { + try! _default.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivector-1.replaceall) fileprivate func replaceAll(_ items: [String]) { try! _default.ReplaceAll(items) @@ -10900,7 +11658,17 @@ internal var __x_ABI_C__FIVector_1___x_ABI_CWindows__CStorage__CSearch__CSortEnt return S_OK }, - GetMany: { _, _, _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIVector_1___x_ABI_CWindows__CStorage__CSearch__CSortEntryWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let startIndex: UInt32 = $1 + var items: [test_component.SortEntry] = .from(abi: (count: $2, start: $3)) + let result = __unwrapped__instance.getMany(startIndex, &items) + do { + try items.fill(abi: $3) + } catch { return failWith(error: error) } + $4?.initialize(to: result) + return S_OK + }, ReplaceAll: { guard let __unwrapped__instance = __x_ABI_C__FIVector_1___x_ABI_CWindows__CStorage__CSearch__CSortEntryWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } @@ -10986,10 +11754,21 @@ public class IVectorSortEntry: test_component.IInspectable { } } + open func GetMany(_ startIndex: UInt32, _ items: inout [test_component.SortEntry]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI { _items in + _ = try perform(as: __x_ABI_C__FIVector_1___x_ABI_CWindows__CStorage__CSearch__CSortEntry.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, startIndex, _items.count, _items.start, &result)) + } + items = .from(abi: _items) + } + return result + } + open func ReplaceAll(_ items: [test_component.SortEntry]) throws { - try items.toABI { (count, _items) in + try items.toABI { _items in _ = try perform(as: __x_ABI_C__FIVector_1___x_ABI_CWindows__CStorage__CSearch__CSortEntry.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.ReplaceAll(pThis, count, _items)) + try CHECKED(pThis.pointee.lpVtbl.pointee.ReplaceAll(pThis, _items.count, _items.start)) } } } @@ -11095,6 +11874,11 @@ fileprivate class __x_ABI_C__FIVector_1___x_ABI_CWindows__CStorage__CSearch__CSo try! _default.Clear() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivector-1.getmany) + fileprivate func getMany(_ startIndex: UInt32, _ items: inout [test_component.SortEntry]) -> UInt32 { + try! _default.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivector-1.replaceall) fileprivate func replaceAll(_ items: [test_component.SortEntry]) { try! _default.ReplaceAll(items) @@ -11222,7 +12006,15 @@ internal var __x_ABI_C__FIVector_1___x_ABI_Ctest__zcomponent__CBaseVTable: __x_A return S_OK }, - GetMany: { _, _, _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIVector_1___x_ABI_Ctest__zcomponent__CBaseWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let startIndex: UInt32 = $1 + var items: [test_component.Base?] = .from(abiBridge: __IMPL_test_component.BaseBridge.self, abi: (count: $2, start: $3)) + let result = __unwrapped__instance.getMany(startIndex, &items) + items.fill(abi: $3, abiBridge: __IMPL_test_component.BaseBridge.self) + $4?.initialize(to: result) + return S_OK + }, ReplaceAll: { guard let __unwrapped__instance = __x_ABI_C__FIVector_1___x_ABI_Ctest__zcomponent__CBaseWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } @@ -11305,10 +12097,21 @@ public class IVectorBase: test_component.IInspectable { } } + open func GetMany(_ startIndex: UInt32, _ items: inout [test_component.Base?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: __IMPL_test_component.BaseBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIVector_1___x_ABI_Ctest__zcomponent__CBase.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, startIndex, _items.count, _items.start, &result)) + } + items = .from(abiBridge: __IMPL_test_component.BaseBridge.self, abi: _items) + } + return result + } + open func ReplaceAll(_ items: [test_component.Base?]) throws { - try items.toABI(abiBridge: __IMPL_test_component.BaseBridge.self) { (count, _items) in + try items.toABI(abiBridge: __IMPL_test_component.BaseBridge.self) { _items in _ = try perform(as: __x_ABI_C__FIVector_1___x_ABI_Ctest__zcomponent__CBase.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.ReplaceAll(pThis, count, _items)) + try CHECKED(pThis.pointee.lpVtbl.pointee.ReplaceAll(pThis, _items.count, _items.start)) } } } @@ -11414,6 +12217,11 @@ fileprivate class __x_ABI_C__FIVector_1___x_ABI_Ctest__zcomponent__CBaseImpl : I try! _default.Clear() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivector-1.getmany) + fileprivate func getMany(_ startIndex: UInt32, _ items: inout [Base?]) -> UInt32 { + try! _default.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivector-1.replaceall) fileprivate func replaceAll(_ items: [Base?]) { try! _default.ReplaceAll(items) @@ -11542,7 +12350,15 @@ internal var __x_ABI_C__FIVector_1___x_ABI_Ctest__zcomponent__CIBasicVTable: __x return S_OK }, - GetMany: { _, _, _, _, _ in return failWith(hr: E_NOTIMPL) }, + GetMany: { + guard let __unwrapped__instance = __x_ABI_C__FIVector_1___x_ABI_Ctest__zcomponent__CIBasicWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } + let startIndex: UInt32 = $1 + var items: [test_component.AnyIBasic?] = .from(abiBridge: __IMPL_test_component.IBasicBridge.self, abi: (count: $2, start: $3)) + let result = __unwrapped__instance.getMany(startIndex, &items) + items.fill(abi: $3, abiBridge: __IMPL_test_component.IBasicBridge.self) + $4?.initialize(to: result) + return S_OK + }, ReplaceAll: { guard let __unwrapped__instance = __x_ABI_C__FIVector_1___x_ABI_Ctest__zcomponent__CIBasicWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } @@ -11633,10 +12449,21 @@ public class IVectorIBasic: test_component.IInspectable { } } + open func GetMany(_ startIndex: UInt32, _ items: inout [test_component.AnyIBasic?]) throws -> UInt32 { + var result: UINT32 = 0 + try items.toABI(abiBridge: __IMPL_test_component.IBasicBridge.self) { _items in + _ = try perform(as: __x_ABI_C__FIVector_1___x_ABI_Ctest__zcomponent__CIBasic.self) { pThis in + try CHECKED(pThis.pointee.lpVtbl.pointee.GetMany(pThis, startIndex, _items.count, _items.start, &result)) + } + items = .from(abiBridge: __IMPL_test_component.IBasicBridge.self, abi: _items) + } + return result + } + open func ReplaceAll(_ items: [test_component.AnyIBasic?]) throws { - try items.toABI(abiBridge: __IMPL_test_component.IBasicBridge.self) { (count, _items) in + try items.toABI(abiBridge: __IMPL_test_component.IBasicBridge.self) { _items in _ = try perform(as: __x_ABI_C__FIVector_1___x_ABI_Ctest__zcomponent__CIBasic.self) { pThis in - try CHECKED(pThis.pointee.lpVtbl.pointee.ReplaceAll(pThis, count, _items)) + try CHECKED(pThis.pointee.lpVtbl.pointee.ReplaceAll(pThis, _items.count, _items.start)) } } } @@ -11742,6 +12569,11 @@ fileprivate class __x_ABI_C__FIVector_1___x_ABI_Ctest__zcomponent__CIBasicImpl : try! _default.Clear() } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivector-1.getmany) + fileprivate func getMany(_ startIndex: UInt32, _ items: inout [AnyIBasic?]) -> UInt32 { + try! _default.GetMany(startIndex, &items) + } + /// [Open Microsoft documentation](https://learn.microsoft.com/uwp/api/windows.foundation.collections.ivector-1.replaceall) fileprivate func replaceAll(_ items: [AnyIBasic?]) { try! _default.ReplaceAll(items) @@ -11783,7 +12615,7 @@ internal var __x_ABI_C__FMapChangedEventHandler_2_HSTRING_IInspectableVTable: __ let event: test_component.AnyIMapChangedEventArgs? = test_component.__x_ABI_C__FIMapChangedEventArgs_1_HSTRINGWrapper.unwrapFrom(abi: ComPtr($2)) try __unwrapped__instance(sender, event) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FMapChangedEventHandler_2_HSTRING_IInspectableWrapper = InterfaceWrapperBase @@ -11838,7 +12670,7 @@ internal var __x_ABI_C__FMapChangedEventHandler_2_HSTRING_HSTRINGVTable: __x_ABI let event: test_component.AnyIMapChangedEventArgs? = test_component.__x_ABI_C__FIMapChangedEventArgs_1_HSTRINGWrapper.unwrapFrom(abi: ComPtr($2)) try __unwrapped__instance(sender, event) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FMapChangedEventHandler_2_HSTRING_HSTRINGWrapper = InterfaceWrapperBase @@ -11893,7 +12725,7 @@ internal var __x_ABI_C__FVectorChangedEventHandler_1___x_ABI_Ctest__zcomponent__ let event: test_component.AnyIVectorChangedEventArgs? = __ABI_Windows_Foundation_Collections.IVectorChangedEventArgsWrapper.unwrapFrom(abi: ComPtr($2)) try __unwrapped__instance(sender, event) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FVectorChangedEventHandler_1___x_ABI_Ctest__zcomponent__CBaseWrapper = InterfaceWrapperBase @@ -11948,7 +12780,7 @@ internal var __x_ABI_C__FVectorChangedEventHandler_1___x_ABI_Ctest__zcomponent__ let event: test_component.AnyIVectorChangedEventArgs? = __ABI_Windows_Foundation_Collections.IVectorChangedEventArgsWrapper.unwrapFrom(abi: ComPtr($2)) try __unwrapped__instance(sender, event) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FVectorChangedEventHandler_1___x_ABI_Ctest__zcomponent__CIBasicWrapper = InterfaceWrapperBase @@ -12003,7 +12835,7 @@ internal var __x_ABI_C__FIEventHandler_1_IInspectableVTable: __x_ABI_C__FIEventH let args: Any? = __ABI_.AnyWrapper.unwrapFrom(abi: ComPtr($2)) try __unwrapped__instance(sender, args) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIEventHandler_1_IInspectableWrapper = InterfaceWrapperBase @@ -12105,7 +12937,7 @@ internal var __x_ABI_C__FIAsyncOperationWithProgress_2_int_doubleVTable: __x_ABI let result = try __unwrapped__instance.getResults() $1?.initialize(to: result) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationWithProgress_2_int_doubleWrapper = InterfaceWrapperBase @@ -12296,7 +13128,7 @@ internal var __x_ABI_C__FIAsyncOperationWithProgress_2_UINT32_UINT32VTable: __x_ let result = try __unwrapped__instance.getResults() $1?.initialize(to: result) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationWithProgress_2_UINT32_UINT32Wrapper = InterfaceWrapperBase @@ -12488,7 +13320,7 @@ internal var __x_ABI_C__FIAsyncOperationWithProgress_2___x_ABI_CWindows__CStorag let resultWrapper = __ABI_Windows_Storage_Streams.IBufferWrapper(result) resultWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperationWithProgress_2___x_ABI_CWindows__CStorage__CStreams__CIBuffer_UINT32Wrapper = InterfaceWrapperBase @@ -12665,7 +13497,7 @@ internal var __x_ABI_C__FIAsyncOperation_1_booleanVTable: __x_ABI_C__FIAsyncOper let result = try __unwrapped__instance.getResults() $1?.initialize(to: .init(from: result)) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1_booleanWrapper = InterfaceWrapperBase @@ -12817,7 +13649,7 @@ internal var __x_ABI_C__FIAsyncOperation_1_intVTable: __x_ABI_C__FIAsyncOperatio let result = try __unwrapped__instance.getResults() $1?.initialize(to: result) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1_intWrapper = InterfaceWrapperBase @@ -12969,7 +13801,7 @@ internal var __x_ABI_C__FIAsyncOperation_1_HSTRINGVTable: __x_ABI_C__FIAsyncOper let result = try __unwrapped__instance.getResults() $1?.initialize(to: try! HString(result).detach()) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1_HSTRINGWrapper = InterfaceWrapperBase @@ -13121,7 +13953,7 @@ internal var __x_ABI_C__FIAsyncOperation_1_UINT32VTable: __x_ABI_C__FIAsyncOpera let result = try __unwrapped__instance.getResults() $1?.initialize(to: result) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1_UINT32Wrapper = InterfaceWrapperBase @@ -13274,7 +14106,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIMap_2_HSTRING_IInspectab let resultWrapper = test_component.__x_ABI_C__FIMap_2_HSTRING_IInspectableWrapper(result) resultWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIMap_2_HSTRING_IInspectableWrapper = InterfaceWrapperBase @@ -13428,7 +14260,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWi let resultWrapper = test_component.__x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CIStorageItemWrapper(result) resultWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CIStorageItemWrapper = InterfaceWrapperBase @@ -13582,7 +14414,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWi let resultWrapper = test_component.__x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFileWrapper(result) resultWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFileWrapper = InterfaceWrapperBase @@ -13736,7 +14568,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWi let resultWrapper = test_component.__x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper(result) resultWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper = InterfaceWrapperBase @@ -13890,7 +14722,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWi let resultWrapper = test_component.__x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageLibraryChangeWrapper(result) resultWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVectorView_1___x_ABI_CWindows__CStorage__CStorageLibraryChangeWrapper = InterfaceWrapperBase @@ -14044,7 +14876,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVector_1_HSTRINGVTable: let resultWrapper = test_component.__x_ABI_C__FIVector_1_HSTRINGWrapper(result) resultWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_C__FIVector_1_HSTRINGWrapper = InterfaceWrapperBase @@ -14197,7 +15029,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProp let result = try __unwrapped__instance.getResults() result?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CBasicPropertiesWrapper = InterfaceWrapperBase @@ -14350,7 +15182,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProp let result = try __unwrapped__instance.getResults() result?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CDocumentPropertiesWrapper = InterfaceWrapperBase @@ -14503,7 +15335,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProp let result = try __unwrapped__instance.getResults() result?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CImagePropertiesWrapper = InterfaceWrapperBase @@ -14656,7 +15488,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProp let result = try __unwrapped__instance.getResults() result?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CMusicPropertiesWrapper = InterfaceWrapperBase @@ -14809,7 +15641,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProp let result = try __unwrapped__instance.getResults() result?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CStorageItemThumbnailWrapper = InterfaceWrapperBase @@ -14962,7 +15794,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProp let result = try __unwrapped__instance.getResults() result?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CFileProperties__CVideoPropertiesWrapper = InterfaceWrapperBase @@ -15116,7 +15948,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CIStorage let resultWrapper = __ABI_Windows_Storage.IStorageItemWrapper(result) resultWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CIStorageItemWrapper = InterfaceWrapperBase @@ -15269,7 +16101,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CSearch__ let result = try __unwrapped__instance.getResults() $1?.initialize(to: result) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CSearch__CIndexedStateWrapper = InterfaceWrapperBase @@ -15421,7 +16253,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageF let result = try __unwrapped__instance.getResults() result?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFileWrapper = InterfaceWrapperBase @@ -15574,7 +16406,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageF let result = try __unwrapped__instance.getResults() result?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageFolderWrapper = InterfaceWrapperBase @@ -15727,7 +16559,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageS let result = try __unwrapped__instance.getResults() result?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStorageStreamTransactionWrapper = InterfaceWrapperBase @@ -15881,7 +16713,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams_ let resultWrapper = __ABI_Windows_Storage_Streams.IBufferWrapper(result) resultWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams__CIBufferWrapper = InterfaceWrapperBase @@ -16035,7 +16867,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams_ let resultWrapper = __ABI_Windows_Storage_Streams.IInputStreamWrapper(result) resultWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams__CIInputStreamWrapper = InterfaceWrapperBase @@ -16189,7 +17021,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams_ let resultWrapper = __ABI_Windows_Storage_Streams.IRandomAccessStreamWrapper(result) resultWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams__CIRandomAccessStreamWrapper = InterfaceWrapperBase @@ -16343,7 +17175,7 @@ internal var __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams_ let resultWrapper = __ABI_Windows_Storage_Streams.IRandomAccessStreamWithContentTypeWrapper(result) resultWrapper?.copyTo($1) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FIAsyncOperation_1___x_ABI_CWindows__CStorage__CStreams__CIRandomAccessStreamWithContentTypeWrapper = InterfaceWrapperBase @@ -16696,7 +17528,7 @@ internal var __x_ABI_C__FITypedEventHandler_2___x_ABI_CWindows__CFoundation__CIM let args: Any? = __ABI_.AnyWrapper.unwrapFrom(abi: ComPtr($2)) try __unwrapped__instance(sender, args) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FITypedEventHandler_2___x_ABI_CWindows__CFoundation__CIMemoryBufferReference_IInspectableWrapper = InterfaceWrapperBase @@ -16751,7 +17583,7 @@ internal var __x_ABI_C__FITypedEventHandler_2___x_ABI_CWindows__CStorage__CSearc let args: Any? = __ABI_.AnyWrapper.unwrapFrom(abi: ComPtr($2)) try __unwrapped__instance(sender, args) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FITypedEventHandler_2___x_ABI_CWindows__CStorage__CSearch__CIStorageQueryResultBase_IInspectableWrapper = InterfaceWrapperBase @@ -16806,7 +17638,7 @@ internal var __x_ABI_C__FITypedEventHandler_2___x_ABI_Ctest__zcomponent__CClass_ let args: test_component.DeferrableEventArgs? = __IMPL_test_component.DeferrableEventArgsBridge.from(abi: ComPtr($2)) try __unwrapped__instance(sender, args) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FITypedEventHandler_2___x_ABI_Ctest__zcomponent__CClass___x_ABI_Ctest__zcomponent__CDeferrableEventArgsWrapper = InterfaceWrapperBase @@ -16857,7 +17689,7 @@ internal var __x_ABI_C__FITypedEventHandler_2___x_ABI_Ctest__zcomponent__CSimple let args: test_component.SimpleEventArgs = .from(abi: $2) try __unwrapped__instance(sender, args) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) typealias __x_ABI_C__FITypedEventHandler_2___x_ABI_Ctest__zcomponent__CSimple___x_ABI_Ctest__zcomponent__CSimpleEventArgsWrapper = InterfaceWrapperBase diff --git a/tests/test_component/Sources/test_component/test_component+Impl.swift b/tests/test_component/Sources/test_component/test_component+Impl.swift index 0b7ee9b4..6b702100 100644 --- a/tests/test_component/Sources/test_component/test_component+Impl.swift +++ b/tests/test_component/Sources/test_component/test_component+Impl.swift @@ -5,6 +5,72 @@ import Ctest_component @_spi(WinRTInternal) public enum __IMPL_test_component { + public enum IArrayScenariosBridge : AbiInterfaceBridge { + public typealias CABI = __x_ABI_Ctest__component_CIArrayScenarios + public typealias SwiftABI = __ABI_test_component.IArrayScenarios + public typealias SwiftProjection = AnyIArrayScenarios + public static func from(abi: ComPtr?) -> SwiftProjection? { + guard let abi = abi else { return nil } + return IArrayScenariosImpl(abi) + } + + public static func makeAbi() -> CABI { + let vtblPtr = withUnsafeMutablePointer(to: &__ABI_test_component.IArrayScenariosVTable) { $0 } + return .init(lpVtbl: vtblPtr) + } + } + + fileprivate class IArrayScenariosImpl: IArrayScenarios, WinRTAbiImpl { + fileprivate typealias Bridge = IArrayScenariosBridge + fileprivate let _default: Bridge.SwiftABI + fileprivate var thisPtr: test_component.IInspectable { _default } + fileprivate init(_ fromAbi: ComPtr) { + _default = Bridge.SwiftABI(fromAbi) + } + + fileprivate func inArray(_ value: [Int32]) throws { + try _default.InArray(value) + } + + fileprivate func outArray(_ value: inout [Int32]) throws { + try _default.OutArray(&value) + } + + fileprivate func refArray(_ value: inout [Int32]) throws { + try _default.RefArray(&value) + } + + fileprivate func returnArray() throws -> [Int32] { + try _default.ReturnArray() + } + + fileprivate func doubleIn(_ value1: [Int32], _ value2: [Int32]) throws { + try _default.DoubleIn(value1, value2) + } + + fileprivate func inAndOut(_ value: [Int32], _ results: inout [Int32]) throws { + try _default.InAndOut(value, &results) + } + + fileprivate func inAndRef(_ value: [Int32], _ results: inout [Int32]) throws { + try _default.InAndRef(value, &results) + } + + fileprivate func inAndRefNonBlittable(_ value: [Int32], _ results: inout [Bool]) throws { + try _default.InAndRefNonBlittable(value, &results) + } + + fileprivate func inAndReturn(_ value: [Int32]) throws -> [Int32] { + try _default.InAndReturn(value) + } + + fileprivate var arrayProperty : [Int32] { + get { try! _default.get_ArrayProperty() } + set { try! _default.put_ArrayProperty(newValue) } + } + + } + public enum IAsyncMethodsWithProgressBridge : AbiInterfaceBridge { public typealias CABI = __x_ABI_Ctest__component_CIAsyncMethodsWithProgress public typealias SwiftABI = __ABI_test_component.IAsyncMethodsWithProgress @@ -402,6 +468,20 @@ public enum __IMPL_test_component { } + public class ArrayMethodCallbackBridge : WinRTDelegateBridge { + public typealias Handler = ArrayMethodCallback + public typealias CABI = __x_ABI_Ctest__component_CIArrayMethodCallback + public typealias SwiftABI = __ABI_test_component.ArrayMethodCallback + + public static func from(abi: ComPtr?) -> Handler? { + guard let abi = abi else { return nil } + let _default = SwiftABI(abi) + let handler: Handler = { (value) in + try _default.Invoke(value) + } + return handler + } + } public class ObjectHandlerBridge : WinRTDelegateBridge { public typealias Handler = ObjectHandler public typealias CABI = __x_ABI_Ctest__component_CIObjectHandler diff --git a/tests/test_component/Sources/test_component/test_component+MakeFromAbi.swift b/tests/test_component/Sources/test_component/test_component+MakeFromAbi.swift index fc034f19..45e73dd7 100644 --- a/tests/test_component/Sources/test_component/test_component+MakeFromAbi.swift +++ b/tests/test_component/Sources/test_component/test_component+MakeFromAbi.swift @@ -158,6 +158,11 @@ fileprivate func makeIRandomAccessStreamWithContentTypeFrom(abi: test_component. return __IMPL_Windows_Storage_Streams.IRandomAccessStreamWithContentTypeBridge.from(abi: RawPointer(swiftAbi))! } +fileprivate func makeIArrayScenariosFrom(abi: test_component.IInspectable) -> Any { + let swiftAbi: __ABI_test_component.IArrayScenarios = try! abi.QueryInterface() + return __IMPL_test_component.IArrayScenariosBridge.from(abi: RawPointer(swiftAbi))! +} + fileprivate func makeIAsyncMethodsWithProgressFrom(abi: test_component.IInspectable) -> Any { let swiftAbi: __ABI_test_component.IAsyncMethodsWithProgress = try! abi.QueryInterface() return __IMPL_test_component.IAsyncMethodsWithProgressBridge.from(abi: RawPointer(swiftAbi))! @@ -431,6 +436,7 @@ public class __MakeFromAbi: MakeFromAbi { case "IRandomAccessStream": return makeIRandomAccessStreamFrom(abi: abi) case "IRandomAccessStreamReference": return makeIRandomAccessStreamReferenceFrom(abi: abi) case "IRandomAccessStreamWithContentType": return makeIRandomAccessStreamWithContentTypeFrom(abi: abi) + case "IArrayScenarios": return makeIArrayScenariosFrom(abi: abi) case "IAsyncMethodsWithProgress": return makeIAsyncMethodsWithProgressFrom(abi: abi) case "IAsyncOperationInt": return makeIAsyncOperationIntFrom(abi: abi) case "IBasic": return makeIBasicFrom(abi: abi) diff --git a/tests/test_component/Sources/test_component/test_component.Delegates+ABI.swift b/tests/test_component/Sources/test_component/test_component.Delegates+ABI.swift index e1f7e6e8..15689ea7 100644 --- a/tests/test_component/Sources/test_component/test_component.Delegates+ABI.swift +++ b/tests/test_component/Sources/test_component/test_component.Delegates+ABI.swift @@ -48,7 +48,7 @@ extension __ABI_test_component_Delegates { let value: String = .init(from: $1) try __unwrapped__instance(value) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) } @@ -86,7 +86,7 @@ extension __ABI_test_component_Delegates { let value: Any? = __ABI_.AnyWrapper.unwrapFrom(abi: ComPtr($1)) try __unwrapped__instance(value) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) } @@ -124,7 +124,7 @@ extension __ABI_test_component_Delegates { let result = try __unwrapped__instance() $1?.initialize(to: result) return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) } @@ -159,7 +159,7 @@ extension __ABI_test_component_Delegates { guard let __unwrapped__instance = SignalDelegateWrapper.tryUnwrapFrom(raw: $0) else { return E_INVALIDARG } try __unwrapped__instance() return S_OK - } catch { return failWith(error: error) } + } catch { return failWith(error: error) } } ) } diff --git a/tests/test_component/Sources/test_component/test_component.swift b/tests/test_component/Sources/test_component/test_component.swift index 9f5e4c34..e8c4ae6c 100644 --- a/tests/test_component/Sources/test_component/test_component.swift +++ b/tests/test_component/Sources/test_component/test_component.swift @@ -38,6 +38,106 @@ public final class ArrayMethods { return try _IArrayMethodsStatics.InEnumArray(value) } + public static func outInt32Array(_ value: inout [Int32]) throws { + try _IArrayMethodsStatics.OutInt32Array(&value) + } + + public static func outStringArray(_ value: inout [String]) throws { + try _IArrayMethodsStatics.OutStringArray(&value) + } + + public static func outObjectArray(_ value: inout [Any?]) throws { + try _IArrayMethodsStatics.OutObjectArray(&value) + } + + public static func outStringableArray(_ value: inout [test_component.AnyIStringable?]) throws { + try _IArrayMethodsStatics.OutStringableArray(&value) + } + + public static func outStructArray(_ value: inout [BlittableStruct]) throws { + try _IArrayMethodsStatics.OutStructArray(&value) + } + + public static func outNonBlittableStructArray(_ value: inout [NonBlittableStruct]) throws { + try _IArrayMethodsStatics.OutNonBlittableStructArray(&value) + } + + public static func outEnumArray(_ value: inout [Signed]) throws { + try _IArrayMethodsStatics.OutEnumArray(&value) + } + + public static func refInt32Array(_ value: inout [Int32]) throws { + try _IArrayMethodsStatics.RefInt32Array(&value) + } + + public static func refStringArray(_ value: inout [String]) throws { + try _IArrayMethodsStatics.RefStringArray(&value) + } + + public static func refObjectArray(_ value: inout [Any?]) throws { + try _IArrayMethodsStatics.RefObjectArray(&value) + } + + public static func refStringableArray(_ value: inout [test_component.AnyIStringable?]) throws { + try _IArrayMethodsStatics.RefStringableArray(&value) + } + + public static func refStructArray(_ value: inout [BlittableStruct]) throws { + try _IArrayMethodsStatics.RefStructArray(&value) + } + + public static func refNonBlittableStructArray(_ value: inout [NonBlittableStruct]) throws { + try _IArrayMethodsStatics.RefNonBlittableStructArray(&value) + } + + public static func refEnumArray(_ value: inout [Signed]) throws { + try _IArrayMethodsStatics.RefEnumArray(&value) + } + + public static func returnInt32Array() throws -> [Int32] { + return try _IArrayMethodsStatics.ReturnInt32Array() + } + + public static func returnStringArray() throws -> [String] { + return try _IArrayMethodsStatics.ReturnStringArray() + } + + public static func returnObjectArray() throws -> [Any?] { + return try _IArrayMethodsStatics.ReturnObjectArray() + } + + public static func returnStringableArray() throws -> [test_component.AnyIStringable?] { + return try _IArrayMethodsStatics.ReturnStringableArray() + } + + public static func returnStructArray() throws -> [BlittableStruct] { + return try _IArrayMethodsStatics.ReturnStructArray() + } + + public static func returnNonBlittableStructArray() throws -> [NonBlittableStruct] { + return try _IArrayMethodsStatics.ReturnNonBlittableStructArray() + } + + public static func returnEnumArray() throws -> [Signed] { + return try _IArrayMethodsStatics.ReturnEnumArray() + } + + public static func testInArrayThroughSwiftImplementation(_ scenario: AnyIArrayScenarios!, _ value: [Int32]) throws { + try _IArrayMethodsStatics.TestInArrayThroughSwiftImplementation(scenario, value) + } + + public static func testOutArrayThroughSwiftImplementation(_ scenario: AnyIArrayScenarios!, _ callback: ArrayMethodCallback!) throws { + try _IArrayMethodsStatics.TestOutArrayThroughSwiftImplementation(scenario, callback) + } + + public static func testRefArrayThroughSwiftImplementation(_ scenario: AnyIArrayScenarios!, _ value: inout [Int32], _ callback: ArrayMethodCallback!) throws { + try _IArrayMethodsStatics.TestRefArrayThroughSwiftImplementation(scenario, &value, callback) + } + + public static func testReturnArrayThroughSwiftImplementation(_ scenario: AnyIArrayScenarios!, _ callback: ArrayMethodCallback!) throws { + try _IArrayMethodsStatics.TestReturnArrayThroughSwiftImplementation(scenario, callback) + } + } public final class AsyncMethods { @@ -290,6 +390,10 @@ open class BaseCollection : WinRTClass, IVector, IIterable { try! _default.Clear() } + public func getMany(_ startIndex: UInt32, _ items: inout [Base?]) -> UInt32 { + try! _default.GetMany(startIndex, &items) + } + public func replaceAll(_ items: [Base?]) { try! _default.ReplaceAll(items) } @@ -519,6 +623,10 @@ public final class BaseObservableCollection : WinRTClass, IObservableVector, IVe try! _IVector.Clear() } + public func getMany(_ startIndex: UInt32, _ items: inout [Base?]) -> UInt32 { + try! _IVector.GetMany(startIndex, &items) + } + public func replaceAll(_ items: [Base?]) { try! _IVector.ReplaceAll(items) } @@ -1486,6 +1594,7 @@ public final class WeakReferencer : WinRTClass { } } +public typealias ArrayMethodCallback = ([Int32]) throws -> () public typealias ObjectHandler = (Any?) throws -> () public typealias VoidToVoidDelegate = () throws -> () public struct BlittableStruct: Hashable, Codable, Sendable { @@ -1552,6 +1661,31 @@ public struct StructWithIReference: Hashable, Codable, Sendable { } } +public protocol IArrayScenarios : WinRTInterface { + func inArray(_ value: [Int32]) throws + func outArray(_ value: inout [Int32]) throws + func refArray(_ value: inout [Int32]) throws + func returnArray() throws -> [Int32] + func doubleIn(_ value1: [Int32], _ value2: [Int32]) throws + func inAndOut(_ value: [Int32], _ results: inout [Int32]) throws + func inAndRef(_ value: [Int32], _ results: inout [Int32]) throws + func inAndRefNonBlittable(_ value: [Int32], _ results: inout [Bool]) throws + func inAndReturn(_ value: [Int32]) throws -> [Int32] + var arrayProperty: [Int32] { get set } +} + +extension IArrayScenarios { + public func queryInterface(_ iid: test_component.IID) -> IUnknownRef? { + switch iid { + case __ABI_test_component.IArrayScenariosWrapper.IID: + let wrapper = __ABI_test_component.IArrayScenariosWrapper(self) + return wrapper!.queryInterface(iid) + default: return nil + } + } +} +public typealias AnyIArrayScenarios = any IArrayScenarios + public protocol IAsyncMethodsWithProgress : WinRTInterface { func operationWithProgress(_ value: test_component.DateTime) throws -> test_component.AnyIAsyncOperationWithProgress! } diff --git a/tests/test_component/cpp/ArrayMethods.cpp b/tests/test_component/cpp/ArrayMethods.cpp index 7279b7ac..7278d618 100644 --- a/tests/test_component/cpp/ArrayMethods.cpp +++ b/tests/test_component/cpp/ArrayMethods.cpp @@ -6,6 +6,23 @@ namespace winrt::test_component::implementation { using namespace Windows::Foundation; + struct Value : implements + { + Value(int32_t value) : + m_value(value) + { + } + + hstring ToString() + { + return hstring{ std::to_wstring(m_value) }; + } + + private: + + int32_t m_value{}; + }; + hstring ArrayMethods::InInt32Array(array_view value) { simulate_rpc_behavior(value); @@ -110,4 +127,200 @@ namespace winrt::test_component::implementation throw hresult_invalid_argument(); } + + void ArrayMethods::OutInt32Array(com_array& value) + { + value = { 1,2,3 }; + } + + void ArrayMethods::OutStringArray(com_array& value) + { + value = { L"1", L"2", L"3" }; + } + + void ArrayMethods::OutObjectArray(com_array& value) + { + value = { make(1), make(2), make(3) }; + } + + void ArrayMethods::OutStringableArray(com_array& value) + { + value = { make(1), make(2), make(3) }; + } + + void ArrayMethods::OutStructArray(com_array& value) + { + value = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; + } + + void ArrayMethods::OutNonBlittableStructArray(com_array& value) + { + value = { { L"1", L"2", 3, L"4" }, { L"5", L"6", 7, L"8" }, { L"9", L"10", 11, L"12" } }; + } + + void ArrayMethods::OutEnumArray(com_array& value) + { + value = { Signed::First, Signed::Second }; + } + + void ArrayMethods::RefInt32Array(array_view value) + { + simulate_rpc_behavior(value); + + if (value.size()) + { + int32_t counter{}; + + std::generate(value.begin(), value.end() - 1, [&] + { + return ++counter; + }); + } + } + + void ArrayMethods::RefStringArray(array_view value) + { + simulate_rpc_behavior(value); + + if (value.size()) + { + int32_t counter{}; + + std::generate(value.begin(), value.end() - 1, [&] + { + return hstring{ std::to_wstring(++counter) }; + }); + } + } + + void ArrayMethods::RefObjectArray(array_view value) + { + simulate_rpc_behavior(value); + + if (value.size()) + { + int32_t counter{}; + + std::generate(value.begin(), value.end() - 1, [&] + { + return make(++counter); + }); + } + } + + void ArrayMethods::RefStringableArray(array_view value) + { + simulate_rpc_behavior(value); + + if (value.size()) + { + int32_t counter{}; + + std::generate(value.begin(), value.end() - 1, [&] + { + return make(++counter); + }); + } + } + + void ArrayMethods::RefStructArray(array_view value) + { + simulate_rpc_behavior(value); + + if (value.size()) + { + int32_t counter{}; + + std::generate(value.begin(), value.end() - 1, [&] + { + return BlittableStruct{ ++counter, ++counter }; + }); + } + } + + void ArrayMethods::RefNonBlittableStructArray(array_view value) + { + simulate_rpc_behavior(value); + + if (value.size()) + { + int32_t counter{}; + + std::generate(value.begin(), value.end() - 1, [&] + { + return NonBlittableStruct{ hstring(std::to_wstring(++counter)), hstring(std::to_wstring(++counter)), ++counter, hstring(std::to_wstring(++counter)) }; + }); + } + } + + void ArrayMethods::RefEnumArray(array_view value) + { + simulate_rpc_behavior(value); + + if (value.size()) + { + Signed counter{ Signed::First }; + + std::generate(value.begin(), value.end() - 1, [&] + { + auto result = counter; + counter = static_cast(static_cast(counter) + 1); + return result; + }); + } + } + + com_array ArrayMethods::ReturnInt32Array() + { + return { 1,2,3 }; + } + + com_array ArrayMethods::ReturnStringArray() + { + return { L"1", L"2", L"3" }; + } + + com_array ArrayMethods::ReturnObjectArray() + { + return { make(1), make(2), make(3) }; + } + + com_array ArrayMethods::ReturnStringableArray() + { + return { make(1), make(2), make(3) }; + } + + com_array ArrayMethods::ReturnStructArray() + { + return { { 1, 2 }, { 3, 4 }, { 5, 6 } }; + } + com_array ArrayMethods::ReturnNonBlittableStructArray() + { + return { { L"1", L"2", 3, L"4" }, { L"5", L"6", 7, L"8" }, { L"9", L"10", 11, L"12" } }; + } + + com_array ArrayMethods::ReturnEnumArray() + { + return { Signed::First, Signed::Second }; + } + + void ArrayMethods::TestInArrayThroughSwiftImplementation(winrt::test_component::IArrayScenarios const& scenario, array_view value) + { + scenario.InArray(value); + } + void ArrayMethods::TestOutArrayThroughSwiftImplementation(winrt::test_component::IArrayScenarios const& scenario, winrt::test_component::ArrayMethodCallback const& callback) + { + com_array value; + scenario.OutArray(value); + callback(value); + } + void ArrayMethods::TestRefArrayThroughSwiftImplementation(winrt::test_component::IArrayScenarios const& scenario, array_view value, winrt::test_component::ArrayMethodCallback const& callback) + { + scenario.RefArray(value); + callback(value); + } + void ArrayMethods::TestReturnArrayThroughSwiftImplementation(winrt::test_component::IArrayScenarios const& scenario, winrt::test_component::ArrayMethodCallback const& callback) + { + callback(scenario.ReturnArray()); + } } diff --git a/tests/test_component/cpp/ArrayMethods.h b/tests/test_component/cpp/ArrayMethods.h index 3d59d579..36a7cd44 100644 --- a/tests/test_component/cpp/ArrayMethods.h +++ b/tests/test_component/cpp/ArrayMethods.h @@ -15,6 +15,35 @@ namespace winrt::test_component::implementation static hstring InNonBlittableStructArray(array_view value); static hstring InEnumArray(array_view value); + static void OutInt32Array(com_array& value); + static void OutStringArray(com_array& value); + static void OutObjectArray(com_array& value); + static void OutStringableArray(com_array& value); + static void OutStructArray(com_array& value); + static void OutNonBlittableStructArray(com_array& value); + static void OutEnumArray(com_array& value); + + static void RefInt32Array(array_view value); + static void RefStringArray(array_view value); + static void RefObjectArray(array_view value); + static void RefStringableArray(array_view value); + static void RefStructArray(array_view value); + static void RefNonBlittableStructArray(array_view value); + static void RefEnumArray(array_view value); + + static com_array ReturnInt32Array(); + static com_array ReturnStringArray(); + static com_array ReturnObjectArray(); + static com_array ReturnStringableArray(); + static com_array ReturnStructArray(); + static com_array ReturnNonBlittableStructArray(); + static com_array ReturnEnumArray(); + + static void TestInArrayThroughSwiftImplementation(winrt::test_component::IArrayScenarios const& scenario, array_view value); + static void TestOutArrayThroughSwiftImplementation(winrt::test_component::IArrayScenarios const& scenario, winrt::test_component::ArrayMethodCallback const& callback); + static void TestRefArrayThroughSwiftImplementation(winrt::test_component::IArrayScenarios const& scenario, array_view value, winrt::test_component::ArrayMethodCallback const& callback); + static void TestReturnArrayThroughSwiftImplementation(winrt::test_component::IArrayScenarios const& scenario, winrt::test_component::ArrayMethodCallback const& callback); + private: static hstring InEnum(winrt::test_component::Signed const& value); diff --git a/tests/test_component/cpp/ArrayTester.idl b/tests/test_component/cpp/ArrayTester.idl index 92b3a35b..a911d96d 100644 --- a/tests/test_component/cpp/ArrayTester.idl +++ b/tests/test_component/cpp/ArrayTester.idl @@ -2,6 +2,8 @@ import "Windows.Foundation.idl"; namespace test_component { + delegate void ArrayMethodCallback(Int32[] value); + runtimeclass ArrayMethods { static String InInt32Array(Int32[] value); @@ -11,5 +13,49 @@ namespace test_component static String InStructArray(BlittableStruct[] value); static String InNonBlittableStructArray(NonBlittableStruct[] value); static String InEnumArray(Signed[] value); + + static void OutInt32Array(out Int32[] value); + static void OutStringArray(out String[] value); + static void OutObjectArray(out Object[] value); + static void OutStringableArray(out Windows.Foundation.IStringable[] value); + static void OutStructArray(out BlittableStruct[] value); + static void OutNonBlittableStructArray(out NonBlittableStruct[] value); + static void OutEnumArray(out Signed[] value); + + static void RefInt32Array(ref Int32[] value); + static void RefStringArray(ref String[] value); + static void RefObjectArray(ref Object[] value); + static void RefStringableArray(ref Windows.Foundation.IStringable[] value); + static void RefStructArray(ref BlittableStruct[] value); + static void RefNonBlittableStructArray(ref NonBlittableStruct[] value); + static void RefEnumArray(ref Signed[] value); + + static Int32[] ReturnInt32Array(); + static String[] ReturnStringArray(); + static Object[] ReturnObjectArray(); + static Windows.Foundation.IStringable[] ReturnStringableArray(); + static BlittableStruct[] ReturnStructArray(); + static NonBlittableStruct[] ReturnNonBlittableStructArray(); + static Signed[] ReturnEnumArray(); + + static void TestInArrayThroughSwiftImplementation(IArrayScenarios scenario, Int32[] value); + static void TestOutArrayThroughSwiftImplementation(IArrayScenarios scenario, ArrayMethodCallback callback); + static void TestRefArrayThroughSwiftImplementation(IArrayScenarios scenario, ref Int32[] value, ArrayMethodCallback callback); + static void TestReturnArrayThroughSwiftImplementation(IArrayScenarios scenario, ArrayMethodCallback callback); + } + + interface IArrayScenarios + { + void InArray(Int32[] value); + void OutArray(out Int32[] value); + void RefArray(ref Int32[] value); + Int32[] ReturnArray(); + + Int32[] ArrayProperty { get; set; }; + void DoubleIn(Int32[] value1, Int32[] value2); + void InAndOut(Int32[] value, out Int32[] results); + void InAndRef(Int32[] value, ref Int32[] results); + void InAndRefNonBlittable(Int32[] value, ref Boolean[] results); + Int32[] InAndReturn(Int32[] value); } } \ No newline at end of file diff --git a/tests/test_component/cpp/Class.cpp b/tests/test_component/cpp/Class.cpp index 6d4d68d3..51acdbad 100644 --- a/tests/test_component/cpp/Class.cpp +++ b/tests/test_component/cpp/Class.cpp @@ -287,133 +287,6 @@ namespace winrt::test_component::implementation return Signed::First; } - void Class::OutInt32Array(com_array& value) - { - value = { 1,2,3 }; - } - - void Class::OutStringArray(com_array& value) - { - value = { L"1", L"2", L"3" }; - } - - void Class::OutObjectArray(com_array& value) - { - value = { make(1), make(2), make(3) }; - } - - void Class::OutStringableArray(com_array& value) - { - value = { make(1), make(2), make(3) }; - } - - void Class::OutEnumArray(com_array& value) - { - value = { Signed::First, Signed::Second }; - } - - void Class::RefInt32Array(array_view value) - { - simulate_rpc_behavior(value); - - if (value.size()) - { - int32_t counter{}; - - std::generate(value.begin(), value.end() - 1, [&] - { - return ++counter; - }); - } - } - - void Class::RefStringArray(array_view value) - { - simulate_rpc_behavior(value); - - if (value.size()) - { - int32_t counter{}; - - std::generate(value.begin(), value.end() - 1, [&] - { - return hstring{ std::to_wstring(++counter) }; - }); - } - } - - void Class::RefObjectArray(array_view value) - { - simulate_rpc_behavior(value); - - if (value.size()) - { - int32_t counter{}; - - std::generate(value.begin(), value.end() - 1, [&] - { - return make(++counter); - }); - } - } - - void Class::RefStringableArray(array_view value) - { - simulate_rpc_behavior(value); - - if (value.size()) - { - int32_t counter{}; - - std::generate(value.begin(), value.end() - 1, [&] - { - return make(++counter); - }); - } - } - - void Class::RefEnumArray(array_view value) - { - simulate_rpc_behavior(value); - - if (value.size()) - { - Signed counter{ Signed::First }; - - std::generate(value.begin(), value.end() - 1, [&] - { - auto result = counter; - counter = static_cast(static_cast(counter) + 1); - return result; - }); - } - } - - com_array Class::ReturnInt32Array() - { - return { 1,2,3 }; - } - - com_array Class::ReturnStringArray() - { - return { L"1", L"2", L"3" }; - } - - com_array Class::ReturnObjectArray() - { - return { make(1), make(2), make(3) }; - } - - com_array Class::ReturnStringableArray() - { - return { make(1), make(2), make(3) }; - } - - com_array Class::ReturnEnumArray() - { - return { Signed::First, Signed::Second }; - } - void Class::NoexceptVoid() noexcept { } diff --git a/tests/test_component/cpp/Class.h b/tests/test_component/cpp/Class.h index c30a9e98..67fc72d3 100644 --- a/tests/test_component/cpp/Class.h +++ b/tests/test_component/cpp/Class.h @@ -103,24 +103,6 @@ namespace winrt::test_component::implementation Signed ReturnEnum(); Windows::Foundation::IReference ReturnReferenceEnum() { return Windows::Foundation::IReference(ReturnEnum()); } - void OutInt32Array(com_array& value); - void OutStringArray(com_array& value); - void OutObjectArray(com_array& value); - void OutStringableArray(com_array& value); - void OutEnumArray(com_array& value); - - void RefInt32Array(array_view value); - void RefStringArray(array_view value); - void RefObjectArray(array_view value); - void RefStringableArray(array_view value); - void RefEnumArray(array_view value); - - com_array ReturnInt32Array(); - com_array ReturnStringArray(); - com_array ReturnObjectArray(); - com_array ReturnStringableArray(); - com_array ReturnEnumArray(); - Fruit EnumProperty() const; void EnumProperty(Fruit const& value); diff --git a/tests/test_component/cpp/test_component.idl b/tests/test_component/cpp/test_component.idl index 9543bcfa..622870c6 100644 --- a/tests/test_component/cpp/test_component.idl +++ b/tests/test_component/cpp/test_component.idl @@ -217,27 +217,6 @@ namespace test_component Windows.Foundation.IReference ReturnReferenceEnum(); Fruit EnumProperty; - // void OutInt32Array(out Int32[] value); - // void OutStringArray(out String[] value); - // void OutObjectArray(out Object[] value); - // void OutStringableArray(out Windows.Foundation.IStringable[] value); - // void OutStructArray(out Struct[] value); - // void OutEnumArray(out Signed[] value); - - // void RefInt32Array(ref Int32[] value); - // void RefStringArray(ref String[] value); - // void RefObjectArray(ref Object[] value); - // void RefStringableArray(ref Windows.Foundation.IStringable[] value); - // void RefStructArray(ref Struct[] value); - // void RefEnumArray(ref Signed[] value); - - // Int32[] ReturnInt32Array(); - // String[] ReturnStringArray(); - // Object[] ReturnObjectArray(); - // Windows.Foundation.IStringable[] ReturnStringableArray(); - // Struct[] ReturnStructArray(); - // Signed[] ReturnEnumArray(); - [noexcept2] void NoexceptVoid(); [noexcept2] Int32 NoexceptInt32(); [noexcept2] String NoexceptString();