File tree Expand file tree Collapse file tree 7 files changed +68
-0
lines changed
Expand file tree Collapse file tree 7 files changed +68
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,15 @@ public typealias CInt = Int32
6969public typealias CLong = Int
7070public typealias CLongLong = Int64
7171#if COCOA || ISLAND
72+ //UnsafeMutablePointer
73+ //UnsafePointer
74+ public typealias UnsafeMutableBufferPointer < T> = UnsafeMutablePointer < T >
75+ public typealias UnsafeBufferPointer < T> = UnsafePointer < T >
76+ public typealias UnsafeMutableRawPointer < T> = UnsafeMutablePointer < T >
77+ public typealias UnsafeRawPointer < T> = UnsafePointer < T >
78+ public typealias UnsafeMutableRawBufferPointer < T> = UnsafeMutablePointer < T >
79+ public typealias UnsafeRawBufferPointer < T> = UnsafePointer < T >
80+
7281public typealias OpaquePointer = UnsafePointer < Void >
7382#endif
7483public typealias CShort = Int16
Original file line number Diff line number Diff line change 5353 <Reference Include =" gc" />
5454 <Reference Include =" Island" />
5555 <Reference Include =" rtl" />
56+ <Reference Include =" CoreFoundation" />
5657 </ItemGroup >
5758 <Import Project =" $(MSBuildExtensionsPath)\RemObjects Software\Elements\RemObjects.Elements.Island.Darwin.targets" />
5859 <Import Project =" Swift.Shared.projitems" Label =" Swift.Shared" />
Original file line number Diff line number Diff line change 5454 <Reference Include =" gc" />
5555 <Reference Include =" Island" />
5656 <Reference Include =" rtl" />
57+ <Reference Include =" CoreFoundation" />
5758 </ItemGroup >
5859 <Import Project =" $(MSBuildExtensionsPath)\RemObjects Software\Elements\RemObjects.Elements.Island.Darwin.targets" />
5960 <Import Project =" Swift.Shared.projitems" Label =" Swift.Shared" />
Original file line number Diff line number Diff line change 5353 <Reference Include =" gc" />
5454 <Reference Include =" Island" />
5555 <Reference Include =" rtl" />
56+ <Reference Include =" CoreFoundation" />
5657 </ItemGroup >
5758 <Import Project =" $(MSBuildExtensionsPath)\RemObjects Software\Elements\RemObjects.Elements.Island.Darwin.targets" />
5859 <Import Project =" Swift.Shared.projitems" Label =" Swift.Shared" />
Original file line number Diff line number Diff line change 5353 <Reference Include =" gc" />
5454 <Reference Include =" Island" />
5555 <Reference Include =" rtl" />
56+ <Reference Include =" CoreFoundation" />
5657 </ItemGroup >
5758 <Import Project =" $(MSBuildExtensionsPath)\RemObjects Software\Elements\RemObjects.Elements.Island.Darwin.targets" />
5859 <Import Project =" Swift.Shared.projitems" Label =" Swift.Shared" />
Original file line number Diff line number Diff line change 9494 <Compile Include =" $(MSBuildThisFileDirectory)Dictionary.Java.swift" />
9595 <Compile Include =" $(MSBuildThisFileDirectory)Operators.swift" />
9696 <Compile Include =" $(MSBuildThisFileDirectory)Errors.swift" />
97+ <Compile Include =" $(MSBuildThisFileDirectory)Unmanaged.swift" />
9798 </ItemGroup >
9899 <ItemGroup >
99100 <Folder Include =" Sequences" >
Original file line number Diff line number Diff line change 1+ #if DARWIN
2+ public struct Unmanaged < Instance> where Instance : AnyObject {
3+
4+ #if ISLAND
5+ func autorelease( ) -> Unmanaged < Instance > {
6+ CFAutorelease ( opaque)
7+ return self
8+ }
9+ func release( ) {
10+ CFRelease ( opaque)
11+ }
12+ func retain( ) -> Unmanaged < Instance > {
13+ CFRetain ( opaque)
14+ return self
15+ }
16+ #endif
17+
18+ func takeRetainedValue( ) -> Instance {
19+ return bridge < Instance > ( opaque, BridgeMode . Bridge)
20+ }
21+
22+ func takeUnretainedValue( ) -> Instance {
23+ return bridge < Instance > ( opaque, BridgeMode . Transfer)
24+ }
25+
26+ func toOpaque( ) -> OpaquePointer {
27+ return opaque
28+ }
29+
30+ static func fromOpaque( _ value: OpaquePointer ) -> Unmanaged < Instance > {
31+ Unmanaged < Instance > ( with: value)
32+ }
33+ static func passRetained( _ value: Instance ) -> Unmanaged < Instance > {
34+ Unmanaged < Instance > ( retained: value)
35+ }
36+ static func passUnretained( _ value: Instance ) -> Unmanaged < Instance > {
37+ Unmanaged < Instance > ( unretained: value)
38+ }
39+
40+ private let opaque : OpaquePointer
41+
42+ private init ( with value: OpaquePointer ) {
43+ opaque = value
44+ }
45+
46+ private init ( withRetained value: Instance ) {
47+ opaque = bridge < OpaquePointer > ( value, BridgeMode . Retained)
48+ }
49+
50+ private init ( withUnretained value: Instance ) {
51+ opaque = bridge < OpaquePointer > ( value, BridgeMode . Bridge)
52+ }
53+ }
54+ #endif
You can’t perform that action at this time.
0 commit comments