-
Notifications
You must be signed in to change notification settings - Fork 26
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
Showing
5 changed files
with
171 additions
and
126 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
61 changes: 61 additions & 0 deletions
61
...generated/ios/swift/Func_std__shared_ptr_Promise_std__shared_ptr_Promise_double____.swift
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,61 @@ | ||
/// | ||
/// Func_std__shared_ptr_Promise_std__shared_ptr_Promise_double____.swift | ||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. | ||
/// https://github.com/mrousavy/nitro | ||
/// Copyright © 2024 Marc Rousavy @ Margelo | ||
/// | ||
|
||
import NitroModules | ||
|
||
/** | ||
* Wraps a Swift `(() -> Promise<Promise<Double>>)` as a class. | ||
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`. | ||
*/ | ||
public final class Func_std__shared_ptr_Promise_std__shared_ptr_Promise_double____ { | ||
public typealias bridge = margelo.nitro.image.bridge.swift | ||
|
||
private let closure: (() -> Promise<Promise<Double>>) | ||
|
||
public init(_ closure: @escaping (() -> Promise<Promise<Double>>)) { | ||
self.closure = closure | ||
} | ||
|
||
@inline(__always) | ||
public func call() -> bridge.std__shared_ptr_Promise_std__shared_ptr_Promise_double____ { | ||
let __result: Promise<Promise<Double>> = self.closure() | ||
return { () -> bridge.std__shared_ptr_Promise_std__shared_ptr_Promise_double____ in | ||
let __promise = bridge.create_std__shared_ptr_Promise_std__shared_ptr_Promise_double____() | ||
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__shared_ptr_Promise_double____(__promise) | ||
__result | ||
.then({ __result in __promiseHolder.resolve({ () -> bridge.std__shared_ptr_Promise_double__ in | ||
let __promise = bridge.create_std__shared_ptr_Promise_double__() | ||
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_double__(__promise) | ||
__result | ||
.then({ __result in __promiseHolder.resolve(__result) }) | ||
.catch({ __error in __promiseHolder.reject(__error.toCpp()) }) | ||
return __promise | ||
}()) }) | ||
.catch({ __error in __promiseHolder.reject(__error.toCpp()) }) | ||
return __promise | ||
}() | ||
} | ||
|
||
/** | ||
* Casts this instance to a retained unsafe raw pointer. | ||
* This acquires one additional strong reference on the object! | ||
*/ | ||
@inline(__always) | ||
public func toUnsafe() -> UnsafeMutableRawPointer { | ||
return Unmanaged.passRetained(self).toOpaque() | ||
} | ||
|
||
/** | ||
* Casts an unsafe pointer to a `Func_std__shared_ptr_Promise_std__shared_ptr_Promise_double____`. | ||
* The pointer has to be a retained opaque `Unmanaged<Func_std__shared_ptr_Promise_std__shared_ptr_Promise_double____>`. | ||
* This removes one strong reference from the object! | ||
*/ | ||
@inline(__always) | ||
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_std__shared_ptr_Promise_std__shared_ptr_Promise_double____ { | ||
return Unmanaged<Func_std__shared_ptr_Promise_std__shared_ptr_Promise_double____>.fromOpaque(pointer).takeRetainedValue() | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
...nitro-image/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_Promise_double__.swift
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,66 @@ | ||
/// | ||
/// Func_void_std__shared_ptr_Promise_double__.swift | ||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. | ||
/// https://github.com/mrousavy/nitro | ||
/// Copyright © 2024 Marc Rousavy @ Margelo | ||
/// | ||
|
||
import NitroModules | ||
|
||
/** | ||
* Wraps a Swift `((_ value: Promise<Double>) -> Void)` as a class. | ||
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`. | ||
*/ | ||
public final class Func_void_std__shared_ptr_Promise_double__ { | ||
public typealias bridge = margelo.nitro.image.bridge.swift | ||
|
||
private let closure: ((_ value: Promise<Double>) -> Void) | ||
|
||
public init(_ closure: @escaping ((_ value: Promise<Double>) -> Void)) { | ||
self.closure = closure | ||
} | ||
|
||
@inline(__always) | ||
public func call(value: bridge.std__shared_ptr_Promise_double__) -> Void { | ||
self.closure({ () -> Promise<Double> in | ||
let __promise = Promise<Double>() | ||
let __resolver = { (__result: Double) in | ||
__promise.resolve(withResult: __result) | ||
} | ||
let __rejecter = { (__error: Error) in | ||
__promise.reject(withError: __error) | ||
} | ||
let __resolverCpp = { () -> bridge.Func_void_double in | ||
let __closureWrapper = Func_void_double(__resolver) | ||
return bridge.create_Func_void_double(__closureWrapper.toUnsafe()) | ||
}() | ||
let __rejecterCpp = { () -> bridge.Func_void_std__exception_ptr in | ||
let __closureWrapper = Func_void_std__exception_ptr(__rejecter) | ||
return bridge.create_Func_void_std__exception_ptr(__closureWrapper.toUnsafe()) | ||
}() | ||
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_double__(value) | ||
__promiseHolder.addOnResolvedListenerCopy(__resolverCpp) | ||
__promiseHolder.addOnRejectedListener(__rejecterCpp) | ||
return __promise | ||
}()) | ||
} | ||
|
||
/** | ||
* Casts this instance to a retained unsafe raw pointer. | ||
* This acquires one additional strong reference on the object! | ||
*/ | ||
@inline(__always) | ||
public func toUnsafe() -> UnsafeMutableRawPointer { | ||
return Unmanaged.passRetained(self).toOpaque() | ||
} | ||
|
||
/** | ||
* Casts an unsafe pointer to a `Func_void_std__shared_ptr_Promise_double__`. | ||
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__shared_ptr_Promise_double__>`. | ||
* This removes one strong reference from the object! | ||
*/ | ||
@inline(__always) | ||
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__shared_ptr_Promise_double__ { | ||
return Unmanaged<Func_void_std__shared_ptr_Promise_double__>.fromOpaque(pointer).takeRetainedValue() | ||
} | ||
} |
Oops, something went wrong.