Skip to content

Commit

Permalink
fixup typos
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenbrix committed Dec 23, 2024
1 parent c1a4ea0 commit 093ef7d
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 110 deletions.
5 changes: 2 additions & 3 deletions swiftwinrt/Resources/Support/Aggregation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ public protocol ComposableImpl<Class> : AbiInterfaceBridge where SwiftABI: IInsp
}

@_spi(WinRTInternal)
public protocol ComposableBridge<Class>: AbiBridge {
associatedtype Class: WinRTClass
associatedtype Composable: ComposableImpl<Class>
public protocol ComposableBridge<SwiftProjection>: AbiBridge where SwiftProjection: WinRTClass {
associatedtype Composable: ComposableImpl<SwiftProjection>
}

// At a high level, aggregation simply requires the WinRT object to have a pointer back to the Swift world, so that it can call
Expand Down
6 changes: 2 additions & 4 deletions swiftwinrt/code_writers.h
Original file line number Diff line number Diff line change
Expand Up @@ -2040,11 +2040,10 @@ public init<Composable: ComposableImpl>(
if (auto default_interface = type.default_interface)
{
const bool composable = type.is_composable();
w.write("@_spi(WinRTInternal)\n");
w.write("public enum %: % {\n", bind_bridge_name(type), composable ? "ComposableBridge" : "AbiBridge");
{
auto indent = w.push_indent();
w.write("public typealias Swift = %\n", type.swift_type_name());
w.write("public typealias SwiftProjection = %\n", type.swift_type_name());
w.write("public typealias CABI = %\n", bind_type_mangled(default_interface));
// We unwrap composable types to try and get to any derived type.
// If not composable, then create a new instance
Expand Down Expand Up @@ -2370,8 +2369,7 @@ public init<Composable: ComposableImpl>(

bool use_iinspectable_vtable = type_name(overrides) == type_name(*default_interface);

auto format = R"(^@_spi(WinRTInternal)
public enum % : ComposableImpl {
auto format = R"(public enum % : ComposableImpl {
public typealias CABI = %
public typealias SwiftABI = %
public typealias Class = %
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,39 +425,35 @@ public enum __IMPL_Windows_Foundation {
return handler
}
}
@_spi(WinRTInternal)
public enum DeferralBridge: AbiBridge {
public typealias Swift = Deferral
public typealias SwiftProjection = Deferral
public typealias CABI = __x_ABI_CWindows_CFoundation_CIDeferral
public static func from(abi: ComPtr<__x_ABI_CWindows_CFoundation_CIDeferral>?) -> Deferral? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum MemoryBufferBridge: AbiBridge {
public typealias Swift = MemoryBuffer
public typealias SwiftProjection = MemoryBuffer
public typealias CABI = __x_ABI_CWindows_CFoundation_CIMemoryBuffer
public static func from(abi: ComPtr<__x_ABI_CWindows_CFoundation_CIMemoryBuffer>?) -> MemoryBuffer? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum UriBridge: AbiBridge {
public typealias Swift = Uri
public typealias SwiftProjection = Uri
public typealias CABI = __x_ABI_CWindows_CFoundation_CIUriRuntimeClass
public static func from(abi: ComPtr<__x_ABI_CWindows_CFoundation_CIUriRuntimeClass>?) -> Uri? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum WwwFormUrlDecoderBridge: AbiBridge {
public typealias Swift = WwwFormUrlDecoder
public typealias SwiftProjection = WwwFormUrlDecoder
public typealias CABI = __x_ABI_CWindows_CFoundation_CIWwwFormUrlDecoderRuntimeClass
public static func from(abi: ComPtr<__x_ABI_CWindows_CFoundation_CIWwwFormUrlDecoderRuntimeClass>?) -> WwwFormUrlDecoder? {
guard let abi = abi else { return nil }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,29 +124,26 @@ public enum __IMPL_Windows_Foundation_Collections {

}

@_spi(WinRTInternal)
public enum PropertySetBridge: AbiBridge {
public typealias Swift = PropertySet
public typealias SwiftProjection = PropertySet
public typealias CABI = __x_ABI_CWindows_CFoundation_CCollections_CIPropertySet
public static func from(abi: ComPtr<__x_ABI_CWindows_CFoundation_CCollections_CIPropertySet>?) -> PropertySet? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum StringMapBridge: AbiBridge {
public typealias Swift = StringMap
public typealias SwiftProjection = StringMap
public typealias CABI = __x_ABI_C__FIMap_2_HSTRING_HSTRING
public static func from(abi: ComPtr<__x_ABI_C__FIMap_2_HSTRING_HSTRING>?) -> StringMap? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum ValueSetBridge: AbiBridge {
public typealias Swift = ValueSet
public typealias SwiftProjection = ValueSet
public typealias CABI = __x_ABI_CWindows_CFoundation_CCollections_CIPropertySet
public static func from(abi: ComPtr<__x_ABI_CWindows_CFoundation_CCollections_CIPropertySet>?) -> ValueSet? {
guard let abi = abi else { return nil }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -781,79 +781,71 @@ public enum __IMPL_Windows_Storage {
return handler
}
}
@_spi(WinRTInternal)
public enum StorageFileBridge: AbiBridge {
public typealias Swift = StorageFile
public typealias SwiftProjection = StorageFile
public typealias CABI = __x_ABI_CWindows_CStorage_CIStorageFile
public static func from(abi: ComPtr<__x_ABI_CWindows_CStorage_CIStorageFile>?) -> StorageFile? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum StorageFolderBridge: AbiBridge {
public typealias Swift = StorageFolder
public typealias SwiftProjection = StorageFolder
public typealias CABI = __x_ABI_CWindows_CStorage_CIStorageFolder
public static func from(abi: ComPtr<__x_ABI_CWindows_CStorage_CIStorageFolder>?) -> StorageFolder? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum StorageLibraryChangeBridge: AbiBridge {
public typealias Swift = StorageLibraryChange
public typealias SwiftProjection = StorageLibraryChange
public typealias CABI = __x_ABI_CWindows_CStorage_CIStorageLibraryChange
public static func from(abi: ComPtr<__x_ABI_CWindows_CStorage_CIStorageLibraryChange>?) -> StorageLibraryChange? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum StorageLibraryChangeReaderBridge: AbiBridge {
public typealias Swift = StorageLibraryChangeReader
public typealias SwiftProjection = StorageLibraryChangeReader
public typealias CABI = __x_ABI_CWindows_CStorage_CIStorageLibraryChangeReader
public static func from(abi: ComPtr<__x_ABI_CWindows_CStorage_CIStorageLibraryChangeReader>?) -> StorageLibraryChangeReader? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum StorageLibraryChangeTrackerBridge: AbiBridge {
public typealias Swift = StorageLibraryChangeTracker
public typealias SwiftProjection = StorageLibraryChangeTracker
public typealias CABI = __x_ABI_CWindows_CStorage_CIStorageLibraryChangeTracker
public static func from(abi: ComPtr<__x_ABI_CWindows_CStorage_CIStorageLibraryChangeTracker>?) -> StorageLibraryChangeTracker? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum StorageProviderBridge: AbiBridge {
public typealias Swift = StorageProvider
public typealias SwiftProjection = StorageProvider
public typealias CABI = __x_ABI_CWindows_CStorage_CIStorageProvider
public static func from(abi: ComPtr<__x_ABI_CWindows_CStorage_CIStorageProvider>?) -> StorageProvider? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum StorageStreamTransactionBridge: AbiBridge {
public typealias Swift = StorageStreamTransaction
public typealias SwiftProjection = StorageStreamTransaction
public typealias CABI = __x_ABI_CWindows_CStorage_CIStorageStreamTransaction
public static func from(abi: ComPtr<__x_ABI_CWindows_CStorage_CIStorageStreamTransaction>?) -> StorageStreamTransaction? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum StreamedFileDataRequestBridge: AbiBridge {
public typealias Swift = StreamedFileDataRequest
public typealias SwiftProjection = StreamedFileDataRequest
public typealias CABI = __x_ABI_CWindows_CStorage_CStreams_CIOutputStream
public static func from(abi: ComPtr<__x_ABI_CWindows_CStorage_CStreams_CIOutputStream>?) -> StreamedFileDataRequest? {
guard let abi = abi else { return nil }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,69 +45,62 @@ public enum __IMPL_Windows_Storage_FileProperties {

}

@_spi(WinRTInternal)
public enum BasicPropertiesBridge: AbiBridge {
public typealias Swift = BasicProperties
public typealias SwiftProjection = BasicProperties
public typealias CABI = __x_ABI_CWindows_CStorage_CFileProperties_CIBasicProperties
public static func from(abi: ComPtr<__x_ABI_CWindows_CStorage_CFileProperties_CIBasicProperties>?) -> BasicProperties? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum DocumentPropertiesBridge: AbiBridge {
public typealias Swift = DocumentProperties
public typealias SwiftProjection = DocumentProperties
public typealias CABI = __x_ABI_CWindows_CStorage_CFileProperties_CIDocumentProperties
public static func from(abi: ComPtr<__x_ABI_CWindows_CStorage_CFileProperties_CIDocumentProperties>?) -> DocumentProperties? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum ImagePropertiesBridge: AbiBridge {
public typealias Swift = ImageProperties
public typealias SwiftProjection = ImageProperties
public typealias CABI = __x_ABI_CWindows_CStorage_CFileProperties_CIImageProperties
public static func from(abi: ComPtr<__x_ABI_CWindows_CStorage_CFileProperties_CIImageProperties>?) -> ImageProperties? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum MusicPropertiesBridge: AbiBridge {
public typealias Swift = MusicProperties
public typealias SwiftProjection = MusicProperties
public typealias CABI = __x_ABI_CWindows_CStorage_CFileProperties_CIMusicProperties
public static func from(abi: ComPtr<__x_ABI_CWindows_CStorage_CFileProperties_CIMusicProperties>?) -> MusicProperties? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum StorageItemContentPropertiesBridge: AbiBridge {
public typealias Swift = StorageItemContentProperties
public typealias SwiftProjection = StorageItemContentProperties
public typealias CABI = __x_ABI_CWindows_CStorage_CFileProperties_CIStorageItemContentProperties
public static func from(abi: ComPtr<__x_ABI_CWindows_CStorage_CFileProperties_CIStorageItemContentProperties>?) -> StorageItemContentProperties? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum StorageItemThumbnailBridge: AbiBridge {
public typealias Swift = StorageItemThumbnail
public typealias SwiftProjection = StorageItemThumbnail
public typealias CABI = __x_ABI_CWindows_CStorage_CStreams_CIRandomAccessStreamWithContentType
public static func from(abi: ComPtr<__x_ABI_CWindows_CStorage_CStreams_CIRandomAccessStreamWithContentType>?) -> StorageItemThumbnail? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum VideoPropertiesBridge: AbiBridge {
public typealias Swift = VideoProperties
public typealias SwiftProjection = VideoProperties
public typealias CABI = __x_ABI_CWindows_CStorage_CFileProperties_CIVideoProperties
public static func from(abi: ComPtr<__x_ABI_CWindows_CStorage_CFileProperties_CIVideoProperties>?) -> VideoProperties? {
guard let abi = abi else { return nil }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,39 +191,35 @@ public enum __IMPL_Windows_Storage_Search {

}

@_spi(WinRTInternal)
public enum QueryOptionsBridge: AbiBridge {
public typealias Swift = QueryOptions
public typealias SwiftProjection = QueryOptions
public typealias CABI = __x_ABI_CWindows_CStorage_CSearch_CIQueryOptions
public static func from(abi: ComPtr<__x_ABI_CWindows_CStorage_CSearch_CIQueryOptions>?) -> QueryOptions? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum StorageFileQueryResultBridge: AbiBridge {
public typealias Swift = StorageFileQueryResult
public typealias SwiftProjection = StorageFileQueryResult
public typealias CABI = __x_ABI_CWindows_CStorage_CSearch_CIStorageFileQueryResult
public static func from(abi: ComPtr<__x_ABI_CWindows_CStorage_CSearch_CIStorageFileQueryResult>?) -> StorageFileQueryResult? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum StorageFolderQueryResultBridge: AbiBridge {
public typealias Swift = StorageFolderQueryResult
public typealias SwiftProjection = StorageFolderQueryResult
public typealias CABI = __x_ABI_CWindows_CStorage_CSearch_CIStorageFolderQueryResult
public static func from(abi: ComPtr<__x_ABI_CWindows_CStorage_CSearch_CIStorageFolderQueryResult>?) -> StorageFolderQueryResult? {
guard let abi = abi else { return nil }
return .init(fromAbi: test_component.IInspectable(abi))
}
}

@_spi(WinRTInternal)
public enum StorageItemQueryResultBridge: AbiBridge {
public typealias Swift = StorageItemQueryResult
public typealias SwiftProjection = StorageItemQueryResult
public typealias CABI = __x_ABI_CWindows_CStorage_CSearch_CIStorageItemQueryResult
public static func from(abi: ComPtr<__x_ABI_CWindows_CStorage_CSearch_CIStorageItemQueryResult>?) -> StorageItemQueryResult? {
guard let abi = abi else { return nil }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,8 @@ public enum __IMPL_Windows_Storage_Streams {

}

@_spi(WinRTInternal)
public enum BufferBridge: AbiBridge {
public typealias Swift = Buffer
public typealias SwiftProjection = Buffer
public typealias CABI = __x_ABI_CWindows_CStorage_CStreams_CIBuffer
public static func from(abi: ComPtr<__x_ABI_CWindows_CStorage_CStreams_CIBuffer>?) -> Buffer? {
guard let abi = abi else { return nil }
Expand Down
Loading

0 comments on commit 093ef7d

Please sign in to comment.