react-native-nitro-image-pipeline 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/NitroImagePipeline.podspec +39 -0
- package/README.md +125 -0
- package/android/CMakeLists.txt +34 -0
- package/android/build.gradle +158 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +9 -0
- package/android/src/main/java/com/margelo/nitro/nitroimagepipeline/HybridNitroImagePipeline.kt +119 -0
- package/android/src/main/java/com/margelo/nitro/nitroimagepipeline/NitroImagePipelinePackage.kt +19 -0
- package/android/src/main/java/com/margelo/nitro/nitroimagepipeline/transform/BlurTransformation.kt +84 -0
- package/ios/Bridge.h +8 -0
- package/ios/HybridNitroImagePipeline.swift +114 -0
- package/lib/commonjs/index.js +50 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/specs/nitro-image-toolkit.nitro.js +6 -0
- package/lib/commonjs/specs/nitro-image-toolkit.nitro.js.map +1 -0
- package/lib/module/index.js +45 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/specs/nitro-image-toolkit.nitro.js +4 -0
- package/lib/module/specs/nitro-image-toolkit.nitro.js.map +1 -0
- package/lib/typescript/src/index.d.ts +28 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/specs/nitro-image-toolkit.nitro.d.ts +20 -0
- package/lib/typescript/src/specs/nitro-image-toolkit.nitro.d.ts.map +1 -0
- package/nitro.json +24 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/NitroImagePipeline+autolinking.cmake +81 -0
- package/nitrogen/generated/android/NitroImagePipeline+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NitroImagePipelineOnLoad.cpp +54 -0
- package/nitrogen/generated/android/NitroImagePipelineOnLoad.hpp +34 -0
- package/nitrogen/generated/android/c++/JCacheOption.hpp +61 -0
- package/nitrogen/generated/android/c++/JHybridNitroImagePipelineSpec.cpp +140 -0
- package/nitrogen/generated/android/c++/JHybridNitroImagePipelineSpec.hpp +67 -0
- package/nitrogen/generated/android/c++/JOptions.hpp +67 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroimagepipeline/CacheOption.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroimagepipeline/HybridNitroImagePipelineSpec.kt +72 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroimagepipeline/NitroImagePipelineOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroimagepipeline/Options.kt +44 -0
- package/nitrogen/generated/ios/NitroImagePipeline+autolinking.rb +60 -0
- package/nitrogen/generated/ios/NitroImagePipeline-Swift-Cxx-Bridge.cpp +68 -0
- package/nitrogen/generated/ios/NitroImagePipeline-Swift-Cxx-Bridge.hpp +244 -0
- package/nitrogen/generated/ios/NitroImagePipeline-Swift-Cxx-Umbrella.hpp +58 -0
- package/nitrogen/generated/ios/NitroImagePipelineAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NitroImagePipelineAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridNitroImagePipelineSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroImagePipelineSpecSwift.hpp +124 -0
- package/nitrogen/generated/ios/swift/CacheOption.swift +44 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_margelo__nitro__image__HybridImageSpec_.swift +51 -0
- package/nitrogen/generated/ios/swift/HybridNitroImagePipelineSpec.swift +60 -0
- package/nitrogen/generated/ios/swift/HybridNitroImagePipelineSpec_cxx.swift +224 -0
- package/nitrogen/generated/ios/swift/Options.swift +71 -0
- package/nitrogen/generated/shared/c++/CacheOption.hpp +80 -0
- package/nitrogen/generated/shared/c++/HybridNitroImagePipelineSpec.cpp +25 -0
- package/nitrogen/generated/shared/c++/HybridNitroImagePipelineSpec.hpp +75 -0
- package/nitrogen/generated/shared/c++/Options.hpp +93 -0
- package/package.json +99 -0
- package/src/index.ts +66 -0
- package/src/specs/nitro-image-toolkit.nitro.ts +16 -0
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroImagePipeline-Swift-Cxx-Bridge.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `CacheOption` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::nitroimagepipeline { enum class CacheOption; }
|
|
13
|
+
// Forward declaration of `HybridImageSpec` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::image { class HybridImageSpec; }
|
|
15
|
+
// Forward declaration of `HybridNitroImagePipelineSpec` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::nitroimagepipeline { class HybridNitroImagePipelineSpec; }
|
|
17
|
+
// Forward declaration of `Options` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::nitroimagepipeline { struct Options; }
|
|
19
|
+
|
|
20
|
+
// Forward declarations of Swift defined types
|
|
21
|
+
// Forward declaration of `HybridImageSpec_cxx` to properly resolve imports.
|
|
22
|
+
namespace NitroImage { class HybridImageSpec_cxx; }
|
|
23
|
+
// Forward declaration of `HybridNitroImagePipelineSpec_cxx` to properly resolve imports.
|
|
24
|
+
namespace NitroImagePipeline { class HybridNitroImagePipelineSpec_cxx; }
|
|
25
|
+
|
|
26
|
+
// Include C++ defined types
|
|
27
|
+
#include "CacheOption.hpp"
|
|
28
|
+
#include "HybridNitroImagePipelineSpec.hpp"
|
|
29
|
+
#include "Options.hpp"
|
|
30
|
+
#include <NitroImage/HybridImageSpec.hpp>
|
|
31
|
+
#include <NitroModules/Promise.hpp>
|
|
32
|
+
#include <NitroModules/PromiseHolder.hpp>
|
|
33
|
+
#include <NitroModules/Result.hpp>
|
|
34
|
+
#include <exception>
|
|
35
|
+
#include <functional>
|
|
36
|
+
#include <memory>
|
|
37
|
+
#include <optional>
|
|
38
|
+
#include <string>
|
|
39
|
+
#include <vector>
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
43
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
44
|
+
*/
|
|
45
|
+
namespace margelo::nitro::nitroimagepipeline::bridge::swift {
|
|
46
|
+
|
|
47
|
+
// pragma MARK: std::shared_ptr<margelo::nitro::image::HybridImageSpec>
|
|
48
|
+
/**
|
|
49
|
+
* Specialized version of `std::shared_ptr<margelo::nitro::image::HybridImageSpec>`.
|
|
50
|
+
*/
|
|
51
|
+
using std__shared_ptr_margelo__nitro__image__HybridImageSpec_ = std::shared_ptr<margelo::nitro::image::HybridImageSpec>;
|
|
52
|
+
std::shared_ptr<margelo::nitro::image::HybridImageSpec> create_std__shared_ptr_margelo__nitro__image__HybridImageSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
53
|
+
void* NON_NULL get_std__shared_ptr_margelo__nitro__image__HybridImageSpec_(std__shared_ptr_margelo__nitro__image__HybridImageSpec_ cppType);
|
|
54
|
+
|
|
55
|
+
// pragma MARK: std::weak_ptr<margelo::nitro::image::HybridImageSpec>
|
|
56
|
+
using std__weak_ptr_margelo__nitro__image__HybridImageSpec_ = std::weak_ptr<margelo::nitro::image::HybridImageSpec>;
|
|
57
|
+
inline std__weak_ptr_margelo__nitro__image__HybridImageSpec_ weakify_std__shared_ptr_margelo__nitro__image__HybridImageSpec_(const std::shared_ptr<margelo::nitro::image::HybridImageSpec>& strong) noexcept { return strong; }
|
|
58
|
+
|
|
59
|
+
// pragma MARK: std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::image::HybridImageSpec>>>
|
|
60
|
+
/**
|
|
61
|
+
* Specialized version of `std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::image::HybridImageSpec>>>`.
|
|
62
|
+
*/
|
|
63
|
+
using std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__image__HybridImageSpec___ = std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::image::HybridImageSpec>>>;
|
|
64
|
+
inline std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::image::HybridImageSpec>>> create_std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__image__HybridImageSpec___() noexcept {
|
|
65
|
+
return Promise<std::shared_ptr<margelo::nitro::image::HybridImageSpec>>::create();
|
|
66
|
+
}
|
|
67
|
+
inline PromiseHolder<std::shared_ptr<margelo::nitro::image::HybridImageSpec>> wrap_std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__image__HybridImageSpec___(std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::image::HybridImageSpec>>> promise) noexcept {
|
|
68
|
+
return PromiseHolder<std::shared_ptr<margelo::nitro::image::HybridImageSpec>>(std::move(promise));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// pragma MARK: std::function<void(const std::shared_ptr<margelo::nitro::image::HybridImageSpec>& /* result */)>
|
|
72
|
+
/**
|
|
73
|
+
* Specialized version of `std::function<void(const std::shared_ptr<margelo::nitro::image::HybridImageSpec>&)>`.
|
|
74
|
+
*/
|
|
75
|
+
using Func_void_std__shared_ptr_margelo__nitro__image__HybridImageSpec_ = std::function<void(const std::shared_ptr<margelo::nitro::image::HybridImageSpec>& /* result */)>;
|
|
76
|
+
/**
|
|
77
|
+
* Wrapper class for a `std::function<void(const std::shared_ptr<margelo::nitro::image::HybridImageSpec>& / * result * /)>`, this can be used from Swift.
|
|
78
|
+
*/
|
|
79
|
+
class Func_void_std__shared_ptr_margelo__nitro__image__HybridImageSpec__Wrapper final {
|
|
80
|
+
public:
|
|
81
|
+
explicit Func_void_std__shared_ptr_margelo__nitro__image__HybridImageSpec__Wrapper(std::function<void(const std::shared_ptr<margelo::nitro::image::HybridImageSpec>& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::shared_ptr<margelo::nitro::image::HybridImageSpec>& /* result */)>>(std::move(func))) {}
|
|
82
|
+
inline void call(std::shared_ptr<margelo::nitro::image::HybridImageSpec> result) const noexcept {
|
|
83
|
+
_function->operator()(result);
|
|
84
|
+
}
|
|
85
|
+
private:
|
|
86
|
+
std::unique_ptr<std::function<void(const std::shared_ptr<margelo::nitro::image::HybridImageSpec>& /* result */)>> _function;
|
|
87
|
+
} SWIFT_NONCOPYABLE;
|
|
88
|
+
Func_void_std__shared_ptr_margelo__nitro__image__HybridImageSpec_ create_Func_void_std__shared_ptr_margelo__nitro__image__HybridImageSpec_(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
89
|
+
inline Func_void_std__shared_ptr_margelo__nitro__image__HybridImageSpec__Wrapper wrap_Func_void_std__shared_ptr_margelo__nitro__image__HybridImageSpec_(Func_void_std__shared_ptr_margelo__nitro__image__HybridImageSpec_ value) noexcept {
|
|
90
|
+
return Func_void_std__shared_ptr_margelo__nitro__image__HybridImageSpec__Wrapper(std::move(value));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
94
|
+
/**
|
|
95
|
+
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
|
96
|
+
*/
|
|
97
|
+
using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
|
|
98
|
+
/**
|
|
99
|
+
* Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
|
|
100
|
+
*/
|
|
101
|
+
class Func_void_std__exception_ptr_Wrapper final {
|
|
102
|
+
public:
|
|
103
|
+
explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
|
|
104
|
+
inline void call(std::exception_ptr error) const noexcept {
|
|
105
|
+
_function->operator()(error);
|
|
106
|
+
}
|
|
107
|
+
private:
|
|
108
|
+
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
|
|
109
|
+
} SWIFT_NONCOPYABLE;
|
|
110
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
111
|
+
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
|
|
112
|
+
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// pragma MARK: std::optional<double>
|
|
116
|
+
/**
|
|
117
|
+
* Specialized version of `std::optional<double>`.
|
|
118
|
+
*/
|
|
119
|
+
using std__optional_double_ = std::optional<double>;
|
|
120
|
+
inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
|
|
121
|
+
return std::optional<double>(value);
|
|
122
|
+
}
|
|
123
|
+
inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
124
|
+
return optional.has_value();
|
|
125
|
+
}
|
|
126
|
+
inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
127
|
+
return optional.value();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// pragma MARK: std::optional<CacheOption>
|
|
131
|
+
/**
|
|
132
|
+
* Specialized version of `std::optional<CacheOption>`.
|
|
133
|
+
*/
|
|
134
|
+
using std__optional_CacheOption_ = std::optional<CacheOption>;
|
|
135
|
+
inline std::optional<CacheOption> create_std__optional_CacheOption_(const CacheOption& value) noexcept {
|
|
136
|
+
return std::optional<CacheOption>(value);
|
|
137
|
+
}
|
|
138
|
+
inline bool has_value_std__optional_CacheOption_(const std::optional<CacheOption>& optional) noexcept {
|
|
139
|
+
return optional.has_value();
|
|
140
|
+
}
|
|
141
|
+
inline CacheOption get_std__optional_CacheOption_(const std::optional<CacheOption>& optional) noexcept {
|
|
142
|
+
return optional.value();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// pragma MARK: std::optional<Options>
|
|
146
|
+
/**
|
|
147
|
+
* Specialized version of `std::optional<Options>`.
|
|
148
|
+
*/
|
|
149
|
+
using std__optional_Options_ = std::optional<Options>;
|
|
150
|
+
inline std::optional<Options> create_std__optional_Options_(const Options& value) noexcept {
|
|
151
|
+
return std::optional<Options>(value);
|
|
152
|
+
}
|
|
153
|
+
inline bool has_value_std__optional_Options_(const std::optional<Options>& optional) noexcept {
|
|
154
|
+
return optional.has_value();
|
|
155
|
+
}
|
|
156
|
+
inline Options get_std__optional_Options_(const std::optional<Options>& optional) noexcept {
|
|
157
|
+
return optional.value();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// pragma MARK: std::shared_ptr<Promise<void>>
|
|
161
|
+
/**
|
|
162
|
+
* Specialized version of `std::shared_ptr<Promise<void>>`.
|
|
163
|
+
*/
|
|
164
|
+
using std__shared_ptr_Promise_void__ = std::shared_ptr<Promise<void>>;
|
|
165
|
+
inline std::shared_ptr<Promise<void>> create_std__shared_ptr_Promise_void__() noexcept {
|
|
166
|
+
return Promise<void>::create();
|
|
167
|
+
}
|
|
168
|
+
inline PromiseHolder<void> wrap_std__shared_ptr_Promise_void__(std::shared_ptr<Promise<void>> promise) noexcept {
|
|
169
|
+
return PromiseHolder<void>(std::move(promise));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// pragma MARK: std::function<void()>
|
|
173
|
+
/**
|
|
174
|
+
* Specialized version of `std::function<void()>`.
|
|
175
|
+
*/
|
|
176
|
+
using Func_void = std::function<void()>;
|
|
177
|
+
/**
|
|
178
|
+
* Wrapper class for a `std::function<void()>`, this can be used from Swift.
|
|
179
|
+
*/
|
|
180
|
+
class Func_void_Wrapper final {
|
|
181
|
+
public:
|
|
182
|
+
explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
|
|
183
|
+
inline void call() const noexcept {
|
|
184
|
+
_function->operator()();
|
|
185
|
+
}
|
|
186
|
+
private:
|
|
187
|
+
std::unique_ptr<std::function<void()>> _function;
|
|
188
|
+
} SWIFT_NONCOPYABLE;
|
|
189
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
190
|
+
inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
|
|
191
|
+
return Func_void_Wrapper(std::move(value));
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// pragma MARK: std::vector<std::string>
|
|
195
|
+
/**
|
|
196
|
+
* Specialized version of `std::vector<std::string>`.
|
|
197
|
+
*/
|
|
198
|
+
using std__vector_std__string_ = std::vector<std::string>;
|
|
199
|
+
inline std::vector<std::string> create_std__vector_std__string_(size_t size) noexcept {
|
|
200
|
+
std::vector<std::string> vector;
|
|
201
|
+
vector.reserve(size);
|
|
202
|
+
return vector;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// pragma MARK: std::shared_ptr<HybridNitroImagePipelineSpec>
|
|
206
|
+
/**
|
|
207
|
+
* Specialized version of `std::shared_ptr<HybridNitroImagePipelineSpec>`.
|
|
208
|
+
*/
|
|
209
|
+
using std__shared_ptr_HybridNitroImagePipelineSpec_ = std::shared_ptr<HybridNitroImagePipelineSpec>;
|
|
210
|
+
std::shared_ptr<HybridNitroImagePipelineSpec> create_std__shared_ptr_HybridNitroImagePipelineSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
211
|
+
void* NON_NULL get_std__shared_ptr_HybridNitroImagePipelineSpec_(std__shared_ptr_HybridNitroImagePipelineSpec_ cppType);
|
|
212
|
+
|
|
213
|
+
// pragma MARK: std::weak_ptr<HybridNitroImagePipelineSpec>
|
|
214
|
+
using std__weak_ptr_HybridNitroImagePipelineSpec_ = std::weak_ptr<HybridNitroImagePipelineSpec>;
|
|
215
|
+
inline std__weak_ptr_HybridNitroImagePipelineSpec_ weakify_std__shared_ptr_HybridNitroImagePipelineSpec_(const std::shared_ptr<HybridNitroImagePipelineSpec>& strong) noexcept { return strong; }
|
|
216
|
+
|
|
217
|
+
// pragma MARK: Result<std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::image::HybridImageSpec>>>>
|
|
218
|
+
using Result_std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__image__HybridImageSpec____ = Result<std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::image::HybridImageSpec>>>>;
|
|
219
|
+
inline Result_std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__image__HybridImageSpec____ create_Result_std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__image__HybridImageSpec____(const std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::image::HybridImageSpec>>>& value) noexcept {
|
|
220
|
+
return Result<std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::image::HybridImageSpec>>>>::withValue(value);
|
|
221
|
+
}
|
|
222
|
+
inline Result_std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__image__HybridImageSpec____ create_Result_std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__image__HybridImageSpec____(const std::exception_ptr& error) noexcept {
|
|
223
|
+
return Result<std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::image::HybridImageSpec>>>>::withError(error);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// pragma MARK: Result<std::shared_ptr<Promise<void>>>
|
|
227
|
+
using Result_std__shared_ptr_Promise_void___ = Result<std::shared_ptr<Promise<void>>>;
|
|
228
|
+
inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::shared_ptr<Promise<void>>& value) noexcept {
|
|
229
|
+
return Result<std::shared_ptr<Promise<void>>>::withValue(value);
|
|
230
|
+
}
|
|
231
|
+
inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::exception_ptr& error) noexcept {
|
|
232
|
+
return Result<std::shared_ptr<Promise<void>>>::withError(error);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// pragma MARK: Result<void>
|
|
236
|
+
using Result_void_ = Result<void>;
|
|
237
|
+
inline Result_void_ create_Result_void_() noexcept {
|
|
238
|
+
return Result<void>::withValue();
|
|
239
|
+
}
|
|
240
|
+
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
241
|
+
return Result<void>::withError(error);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
} // namespace margelo::nitro::nitroimagepipeline::bridge::swift
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroImagePipeline-Swift-Cxx-Umbrella.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `CacheOption` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::nitroimagepipeline { enum class CacheOption; }
|
|
13
|
+
// Forward declaration of `HybridImageSpec` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::image { class HybridImageSpec; }
|
|
15
|
+
// Forward declaration of `HybridNitroImagePipelineSpec` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::nitroimagepipeline { class HybridNitroImagePipelineSpec; }
|
|
17
|
+
// Forward declaration of `Options` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::nitroimagepipeline { struct Options; }
|
|
19
|
+
|
|
20
|
+
// Include C++ defined types
|
|
21
|
+
#include "CacheOption.hpp"
|
|
22
|
+
#include "HybridNitroImagePipelineSpec.hpp"
|
|
23
|
+
#include "Options.hpp"
|
|
24
|
+
#include <NitroImage/HybridImageSpec.hpp>
|
|
25
|
+
#include <NitroModules/Promise.hpp>
|
|
26
|
+
#include <NitroModules/Result.hpp>
|
|
27
|
+
#include <exception>
|
|
28
|
+
#include <memory>
|
|
29
|
+
#include <optional>
|
|
30
|
+
#include <string>
|
|
31
|
+
#include <vector>
|
|
32
|
+
|
|
33
|
+
// C++ helpers for Swift
|
|
34
|
+
#include "NitroImagePipeline-Swift-Cxx-Bridge.hpp"
|
|
35
|
+
|
|
36
|
+
// Common C++ types used in Swift
|
|
37
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
38
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
39
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
40
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
41
|
+
|
|
42
|
+
// Forward declarations of Swift defined types
|
|
43
|
+
// Forward declaration of `HybridImageSpec_cxx` to properly resolve imports.
|
|
44
|
+
namespace NitroImage { class HybridImageSpec_cxx; }
|
|
45
|
+
// Forward declaration of `HybridNitroImagePipelineSpec_cxx` to properly resolve imports.
|
|
46
|
+
namespace NitroImagePipeline { class HybridNitroImagePipelineSpec_cxx; }
|
|
47
|
+
|
|
48
|
+
// Include Swift defined types
|
|
49
|
+
#if __has_include("NitroImagePipeline-Swift.h")
|
|
50
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
51
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "NitroImagePipeline".
|
|
52
|
+
#include "NitroImagePipeline-Swift.h"
|
|
53
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
54
|
+
#elif __has_include(<NitroImagePipeline/NitroImagePipeline-Swift.h>)
|
|
55
|
+
#include <NitroImagePipeline/NitroImagePipeline-Swift.h>
|
|
56
|
+
#else
|
|
57
|
+
#error NitroImagePipeline's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "NitroImagePipeline", and try building the app first.
|
|
58
|
+
#endif
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroImagePipelineAutolinking.mm
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
+
#import "NitroImagePipeline-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridNitroImagePipelineSpecSwift.hpp"
|
|
14
|
+
|
|
15
|
+
@interface NitroImagePipelineAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation NitroImagePipelineAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::nitroimagepipeline;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"NitroImagePipeline",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
std::shared_ptr<HybridNitroImagePipelineSpec> hybridObject = NitroImagePipeline::NitroImagePipelineAutolinking::createNitroImagePipeline();
|
|
28
|
+
return hybridObject;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroImagePipelineAutolinking.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
// TODO: Use empty enums once Swift supports exporting them as namespaces
|
|
11
|
+
// See: https://github.com/swiftlang/swift/pull/83616
|
|
12
|
+
public final class NitroImagePipelineAutolinking {
|
|
13
|
+
public typealias bridge = margelo.nitro.nitroimagepipeline.bridge.swift
|
|
14
|
+
|
|
15
|
+
public static func createNitroImagePipeline() -> bridge.std__shared_ptr_HybridNitroImagePipelineSpec_ {
|
|
16
|
+
let hybridObject = HybridNitroImagePipeline()
|
|
17
|
+
return { () -> bridge.std__shared_ptr_HybridNitroImagePipelineSpec_ in
|
|
18
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
19
|
+
return __cxxWrapped.getCxxPart()
|
|
20
|
+
}()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public static func isNitroImagePipelineRecyclable() -> Bool {
|
|
24
|
+
return HybridNitroImagePipeline.self is any RecyclableView.Type
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroImagePipelineSpecSwift.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridNitroImagePipelineSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitroimagepipeline {
|
|
11
|
+
} // namespace margelo::nitro::nitroimagepipeline
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroImagePipelineSpecSwift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "HybridNitroImagePipelineSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridNitroImagePipelineSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace NitroImagePipeline { class HybridNitroImagePipelineSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `HybridImageSpec` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::image { class HybridImageSpec; }
|
|
17
|
+
// Forward declaration of `Options` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::nitroimagepipeline { struct Options; }
|
|
19
|
+
// Forward declaration of `CacheOption` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::nitroimagepipeline { enum class CacheOption; }
|
|
21
|
+
|
|
22
|
+
#include <memory>
|
|
23
|
+
#include <NitroImage/HybridImageSpec.hpp>
|
|
24
|
+
#include <NitroModules/Promise.hpp>
|
|
25
|
+
#include <string>
|
|
26
|
+
#include "Options.hpp"
|
|
27
|
+
#include <optional>
|
|
28
|
+
#include "CacheOption.hpp"
|
|
29
|
+
#include <vector>
|
|
30
|
+
|
|
31
|
+
#include "NitroImagePipeline-Swift-Cxx-Umbrella.hpp"
|
|
32
|
+
|
|
33
|
+
namespace margelo::nitro::nitroimagepipeline {
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The C++ part of HybridNitroImagePipelineSpec_cxx.swift.
|
|
37
|
+
*
|
|
38
|
+
* HybridNitroImagePipelineSpecSwift (C++) accesses HybridNitroImagePipelineSpec_cxx (Swift), and might
|
|
39
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
40
|
+
*
|
|
41
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
42
|
+
* the future, HybridNitroImagePipelineSpec_cxx can directly inherit from the C++ class HybridNitroImagePipelineSpec
|
|
43
|
+
* to simplify the whole structure and memory management.
|
|
44
|
+
*/
|
|
45
|
+
class HybridNitroImagePipelineSpecSwift: public virtual HybridNitroImagePipelineSpec {
|
|
46
|
+
public:
|
|
47
|
+
// Constructor from a Swift instance
|
|
48
|
+
explicit HybridNitroImagePipelineSpecSwift(const NitroImagePipeline::HybridNitroImagePipelineSpec_cxx& swiftPart):
|
|
49
|
+
HybridObject(HybridNitroImagePipelineSpec::TAG),
|
|
50
|
+
_swiftPart(swiftPart) { }
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
// Get the Swift part
|
|
54
|
+
inline NitroImagePipeline::HybridNitroImagePipelineSpec_cxx& getSwiftPart() noexcept {
|
|
55
|
+
return _swiftPart;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public:
|
|
59
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
60
|
+
return _swiftPart.getMemorySize();
|
|
61
|
+
}
|
|
62
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
63
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridNitroImagePipelineSpecSwift>(other)) {
|
|
64
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
void dispose() noexcept override {
|
|
69
|
+
_swiftPart.dispose();
|
|
70
|
+
}
|
|
71
|
+
std::string toString() override {
|
|
72
|
+
return _swiftPart.toString();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public:
|
|
76
|
+
// Properties
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
public:
|
|
80
|
+
// Methods
|
|
81
|
+
inline std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::image::HybridImageSpec>>> loadImage(const std::string& url, const std::optional<Options>& options) override {
|
|
82
|
+
auto __result = _swiftPart.loadImage(url, options);
|
|
83
|
+
if (__result.hasError()) [[unlikely]] {
|
|
84
|
+
std::rethrow_exception(__result.error());
|
|
85
|
+
}
|
|
86
|
+
auto __value = std::move(__result.value());
|
|
87
|
+
return __value;
|
|
88
|
+
}
|
|
89
|
+
inline std::shared_ptr<Promise<void>> preLoadImage(const std::string& url) override {
|
|
90
|
+
auto __result = _swiftPart.preLoadImage(url);
|
|
91
|
+
if (__result.hasError()) [[unlikely]] {
|
|
92
|
+
std::rethrow_exception(__result.error());
|
|
93
|
+
}
|
|
94
|
+
auto __value = std::move(__result.value());
|
|
95
|
+
return __value;
|
|
96
|
+
}
|
|
97
|
+
inline std::shared_ptr<Promise<void>> preLoadImages(const std::vector<std::string>& urls) override {
|
|
98
|
+
auto __result = _swiftPart.preLoadImages(urls);
|
|
99
|
+
if (__result.hasError()) [[unlikely]] {
|
|
100
|
+
std::rethrow_exception(__result.error());
|
|
101
|
+
}
|
|
102
|
+
auto __value = std::move(__result.value());
|
|
103
|
+
return __value;
|
|
104
|
+
}
|
|
105
|
+
inline std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::image::HybridImageSpec>>> gaussianBlur(const std::shared_ptr<margelo::nitro::image::HybridImageSpec>& image, double radius) override {
|
|
106
|
+
auto __result = _swiftPart.gaussianBlur(image, std::forward<decltype(radius)>(radius));
|
|
107
|
+
if (__result.hasError()) [[unlikely]] {
|
|
108
|
+
std::rethrow_exception(__result.error());
|
|
109
|
+
}
|
|
110
|
+
auto __value = std::move(__result.value());
|
|
111
|
+
return __value;
|
|
112
|
+
}
|
|
113
|
+
inline void clearCache() override {
|
|
114
|
+
auto __result = _swiftPart.clearCache();
|
|
115
|
+
if (__result.hasError()) [[unlikely]] {
|
|
116
|
+
std::rethrow_exception(__result.error());
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
private:
|
|
121
|
+
NitroImagePipeline::HybridNitroImagePipelineSpec_cxx _swiftPart;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
} // namespace margelo::nitro::nitroimagepipeline
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CacheOption.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the JS union `CacheOption`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias CacheOption = margelo.nitro.nitroimagepipeline.CacheOption
|
|
12
|
+
|
|
13
|
+
public extension CacheOption {
|
|
14
|
+
/**
|
|
15
|
+
* Get a CacheOption for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "memory":
|
|
21
|
+
self = .memory
|
|
22
|
+
case "disk":
|
|
23
|
+
self = .disk
|
|
24
|
+
case "none":
|
|
25
|
+
self = .none
|
|
26
|
+
default:
|
|
27
|
+
return nil
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get the String value this CacheOption represents.
|
|
33
|
+
*/
|
|
34
|
+
var stringValue: String {
|
|
35
|
+
switch self {
|
|
36
|
+
case .memory:
|
|
37
|
+
return "memory"
|
|
38
|
+
case .disk:
|
|
39
|
+
return "disk"
|
|
40
|
+
case .none:
|
|
41
|
+
return "none"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `() -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void {
|
|
15
|
+
public typealias bridge = margelo.nitro.nitroimagepipeline.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: () -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping () -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call() -> Void {
|
|
25
|
+
self.closure()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void {
|
|
44
|
+
return Unmanaged<Func_void>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__exception_ptr.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ error: Error) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_std__exception_ptr {
|
|
15
|
+
public typealias bridge = margelo.nitro.nitroimagepipeline.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ error: Error) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ error: Error) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(error: std.exception_ptr) -> Void {
|
|
25
|
+
self.closure(RuntimeError.from(cppError: error))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_std__exception_ptr`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
|
|
44
|
+
return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|