-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e178fce
commit 0c93b3e
Showing
8 changed files
with
77 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import COM_ABI | ||
|
||
public typealias ISupportErrorInfo = any ISupportErrorInfoProtocol | ||
public protocol ISupportErrorInfoProtocol: IUnknownProtocol { | ||
func interfaceSupportsErrorInfo(_ riid: COMInterfaceID) throws | ||
} | ||
|
||
public enum ISupportErrorInfoBinding: COMTwoWayBinding { | ||
public typealias SwiftObject = ISupportErrorInfo | ||
public typealias ABIStruct = COM_ABI.SWRT_ISupportErrorInfo | ||
|
||
public static var interfaceID: COMInterfaceID { uuidof(ABIStruct.self) } | ||
public static var virtualTablePointer: UnsafeRawPointer { .init(withUnsafePointer(to: &virtualTable) { $0 }) } | ||
|
||
public static func _wrap(_ reference: consuming ABIReference) -> SwiftObject { | ||
Import(_wrapping: reference) | ||
} | ||
|
||
public static func toCOM(_ object: SwiftObject) throws -> ABIReference { | ||
try Import.toCOM(object) | ||
} | ||
|
||
private final class Import: COMImport<ISupportErrorInfoBinding>, ISupportErrorInfoProtocol { | ||
public func interfaceSupportsErrorInfo(_ riid: COMInterfaceID) throws { try _interop.interfaceSupportsErrorInfo(riid) } | ||
} | ||
|
||
private static var virtualTable: COM_ABI.SWRT_ISupportErrorInfo_VirtualTable = .init( | ||
QueryInterface: { IUnknownVirtualTable.QueryInterface($0, $1, $2) }, | ||
AddRef: { IUnknownVirtualTable.AddRef($0) }, | ||
Release: { IUnknownVirtualTable.Release($0) }, | ||
InterfaceSupportsErrorInfo: { this, riid in _implement(this) { | ||
guard let riid else { throw COMError.invalidArg } | ||
let riid_swift = GUIDBinding.fromABI(riid.pointee) | ||
try $0.interfaceSupportsErrorInfo(riid_swift) | ||
} }) | ||
} | ||
|
||
public func uuidof(_: COM_ABI.SWRT_ISupportErrorInfo.Type) -> COMInterfaceID { | ||
.init(0xDF0B3D60, 0x548F, 0x101B, 0x8E65, 0x08002B2BD119) | ||
} | ||
|
||
extension COMInterop where ABIStruct == COM_ABI.SWRT_ISupportErrorInfo { | ||
public func interfaceSupportsErrorInfo(_ riid: COMInterfaceID) throws { | ||
var riid_abi = GUIDBinding.toABI(riid) | ||
try COMError.fromABI(this.pointee.VirtualTable.pointee.InterfaceSupportsErrorInfo(this, &riid_abi)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/// An implementation of ISupportErrorInfo which reports that all interfaces support error info. | ||
public final class SupportErrorInfoForAllInterfaces: COMTearOffBase<ISupportErrorInfoBinding>, ISupportErrorInfoProtocol { | ||
public func interfaceSupportsErrorInfo(_ riid: COMInterfaceID) throws { | ||
// Never throw. By virtue of projection, all interfaces report their errors through IErrorInfo. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters