@onekeyfe/react-native-cloud-kit-module 1.1.6
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/CloudKitModule.podspec +29 -0
- package/LICENSE +20 -0
- package/README.md +39 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +128 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/cloudkitmodule/CloudKitModule.kt +51 -0
- package/android/src/main/java/com/margelo/nitro/cloudkitmodule/CloudKitModulePackage.kt +22 -0
- package/ios/CloudKitModule.swift +186 -0
- package/ios/CloudKitModuleCore.swift +195 -0
- package/lib/module/CloudKitModule.nitro.js +4 -0
- package/lib/module/CloudKitModule.nitro.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/CloudKitModule.nitro.d.ts +55 -0
- package/lib/typescript/src/CloudKitModule.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +17 -0
- package/nitrogen/generated/android/c++/JAccountInfoResult.hpp +62 -0
- package/nitrogen/generated/android/c++/JDeleteRecordParams.hpp +57 -0
- package/nitrogen/generated/android/c++/JFetchRecordParams.hpp +57 -0
- package/nitrogen/generated/android/c++/JHybridCloudKitModuleSpec.cpp +192 -0
- package/nitrogen/generated/android/c++/JHybridCloudKitModuleSpec.hpp +70 -0
- package/nitrogen/generated/android/c++/JQueryRecordsParams.hpp +53 -0
- package/nitrogen/generated/android/c++/JQueryRecordsResult.hpp +73 -0
- package/nitrogen/generated/android/c++/JRecordExistsParams.hpp +57 -0
- package/nitrogen/generated/android/c++/JRecordResult.hpp +73 -0
- package/nitrogen/generated/android/c++/JSaveRecordParams.hpp +65 -0
- package/nitrogen/generated/android/c++/JSaveRecordResult.hpp +57 -0
- package/nitrogen/generated/android/cloudkitmodule+autolinking.cmake +81 -0
- package/nitrogen/generated/android/cloudkitmodule+autolinking.gradle +27 -0
- package/nitrogen/generated/android/cloudkitmoduleOnLoad.cpp +44 -0
- package/nitrogen/generated/android/cloudkitmoduleOnLoad.hpp +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/AccountInfoResult.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/DeleteRecordParams.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/FetchRecordParams.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/HybridCloudKitModuleSpec.kt +76 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/QueryRecordsParams.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/QueryRecordsResult.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/RecordExistsParams.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/RecordResult.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/SaveRecordParams.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/SaveRecordResult.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/cloudkitmoduleOnLoad.kt +35 -0
- package/nitrogen/generated/ios/CloudKitModule+autolinking.rb +60 -0
- package/nitrogen/generated/ios/CloudKitModule-Swift-Cxx-Bridge.cpp +80 -0
- package/nitrogen/generated/ios/CloudKitModule-Swift-Cxx-Bridge.hpp +340 -0
- package/nitrogen/generated/ios/CloudKitModule-Swift-Cxx-Umbrella.hpp +74 -0
- package/nitrogen/generated/ios/CloudKitModuleAutolinking.mm +33 -0
- package/nitrogen/generated/ios/CloudKitModuleAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridCloudKitModuleSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCloudKitModuleSpecSwift.hpp +150 -0
- package/nitrogen/generated/ios/swift/AccountInfoResult.swift +76 -0
- package/nitrogen/generated/ios/swift/DeleteRecordParams.swift +46 -0
- package/nitrogen/generated/ios/swift/FetchRecordParams.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_AccountInfoResult.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_QueryRecordsResult.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_SaveRecordResult.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_RecordResult_.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridCloudKitModuleSpec.swift +55 -0
- package/nitrogen/generated/ios/swift/HybridCloudKitModuleSpec_cxx.swift +250 -0
- package/nitrogen/generated/ios/swift/QueryRecordsParams.swift +35 -0
- package/nitrogen/generated/ios/swift/QueryRecordsResult.swift +43 -0
- package/nitrogen/generated/ios/swift/RecordExistsParams.swift +46 -0
- package/nitrogen/generated/ios/swift/RecordResult.swift +90 -0
- package/nitrogen/generated/ios/swift/SaveRecordParams.swift +68 -0
- package/nitrogen/generated/ios/swift/SaveRecordResult.swift +46 -0
- package/nitrogen/generated/shared/c++/AccountInfoResult.hpp +76 -0
- package/nitrogen/generated/shared/c++/DeleteRecordParams.hpp +71 -0
- package/nitrogen/generated/shared/c++/FetchRecordParams.hpp +71 -0
- package/nitrogen/generated/shared/c++/HybridCloudKitModuleSpec.cpp +27 -0
- package/nitrogen/generated/shared/c++/HybridCloudKitModuleSpec.hpp +95 -0
- package/nitrogen/generated/shared/c++/QueryRecordsParams.hpp +67 -0
- package/nitrogen/generated/shared/c++/QueryRecordsResult.hpp +69 -0
- package/nitrogen/generated/shared/c++/RecordExistsParams.hpp +71 -0
- package/nitrogen/generated/shared/c++/RecordResult.hpp +87 -0
- package/nitrogen/generated/shared/c++/SaveRecordParams.hpp +79 -0
- package/nitrogen/generated/shared/c++/SaveRecordResult.hpp +71 -0
- package/package.json +174 -0
- package/src/CloudKitModule.nitro.ts +64 -0
- package/src/index.tsx +8 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CloudKitModule-Swift-Cxx-Bridge.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `AccountInfoResult` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::cloudkitmodule { struct AccountInfoResult; }
|
|
13
|
+
// Forward declaration of `HybridCloudKitModuleSpec` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::cloudkitmodule { class HybridCloudKitModuleSpec; }
|
|
15
|
+
// Forward declaration of `QueryRecordsResult` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::cloudkitmodule { struct QueryRecordsResult; }
|
|
17
|
+
// Forward declaration of `RecordResult` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::cloudkitmodule { struct RecordResult; }
|
|
19
|
+
// Forward declaration of `SaveRecordResult` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::cloudkitmodule { struct SaveRecordResult; }
|
|
21
|
+
|
|
22
|
+
// Forward declarations of Swift defined types
|
|
23
|
+
// Forward declaration of `HybridCloudKitModuleSpec_cxx` to properly resolve imports.
|
|
24
|
+
namespace CloudKitModule { class HybridCloudKitModuleSpec_cxx; }
|
|
25
|
+
|
|
26
|
+
// Include C++ defined types
|
|
27
|
+
#include "AccountInfoResult.hpp"
|
|
28
|
+
#include "HybridCloudKitModuleSpec.hpp"
|
|
29
|
+
#include "QueryRecordsResult.hpp"
|
|
30
|
+
#include "RecordResult.hpp"
|
|
31
|
+
#include "SaveRecordResult.hpp"
|
|
32
|
+
#include <NitroModules/FastVectorCopy.hpp>
|
|
33
|
+
#include <NitroModules/Promise.hpp>
|
|
34
|
+
#include <NitroModules/PromiseHolder.hpp>
|
|
35
|
+
#include <NitroModules/Result.hpp>
|
|
36
|
+
#include <exception>
|
|
37
|
+
#include <functional>
|
|
38
|
+
#include <memory>
|
|
39
|
+
#include <optional>
|
|
40
|
+
#include <string>
|
|
41
|
+
#include <vector>
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
45
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
46
|
+
*/
|
|
47
|
+
namespace margelo::nitro::cloudkitmodule::bridge::swift {
|
|
48
|
+
|
|
49
|
+
// pragma MARK: std::shared_ptr<Promise<bool>>
|
|
50
|
+
/**
|
|
51
|
+
* Specialized version of `std::shared_ptr<Promise<bool>>`.
|
|
52
|
+
*/
|
|
53
|
+
using std__shared_ptr_Promise_bool__ = std::shared_ptr<Promise<bool>>;
|
|
54
|
+
inline std::shared_ptr<Promise<bool>> create_std__shared_ptr_Promise_bool__() noexcept {
|
|
55
|
+
return Promise<bool>::create();
|
|
56
|
+
}
|
|
57
|
+
inline PromiseHolder<bool> wrap_std__shared_ptr_Promise_bool__(std::shared_ptr<Promise<bool>> promise) noexcept {
|
|
58
|
+
return PromiseHolder<bool>(std::move(promise));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// pragma MARK: std::function<void(bool /* result */)>
|
|
62
|
+
/**
|
|
63
|
+
* Specialized version of `std::function<void(bool)>`.
|
|
64
|
+
*/
|
|
65
|
+
using Func_void_bool = std::function<void(bool /* result */)>;
|
|
66
|
+
/**
|
|
67
|
+
* Wrapper class for a `std::function<void(bool / * result * /)>`, this can be used from Swift.
|
|
68
|
+
*/
|
|
69
|
+
class Func_void_bool_Wrapper final {
|
|
70
|
+
public:
|
|
71
|
+
explicit Func_void_bool_Wrapper(std::function<void(bool /* result */)>&& func): _function(std::make_unique<std::function<void(bool /* result */)>>(std::move(func))) {}
|
|
72
|
+
inline void call(bool result) const noexcept {
|
|
73
|
+
_function->operator()(result);
|
|
74
|
+
}
|
|
75
|
+
private:
|
|
76
|
+
std::unique_ptr<std::function<void(bool /* result */)>> _function;
|
|
77
|
+
} SWIFT_NONCOPYABLE;
|
|
78
|
+
Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
79
|
+
inline Func_void_bool_Wrapper wrap_Func_void_bool(Func_void_bool value) noexcept {
|
|
80
|
+
return Func_void_bool_Wrapper(std::move(value));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
84
|
+
/**
|
|
85
|
+
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
|
86
|
+
*/
|
|
87
|
+
using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
|
|
88
|
+
/**
|
|
89
|
+
* Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
|
|
90
|
+
*/
|
|
91
|
+
class Func_void_std__exception_ptr_Wrapper final {
|
|
92
|
+
public:
|
|
93
|
+
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))) {}
|
|
94
|
+
inline void call(std::exception_ptr error) const noexcept {
|
|
95
|
+
_function->operator()(error);
|
|
96
|
+
}
|
|
97
|
+
private:
|
|
98
|
+
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
|
|
99
|
+
} SWIFT_NONCOPYABLE;
|
|
100
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
101
|
+
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
|
|
102
|
+
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// pragma MARK: std::optional<std::string>
|
|
106
|
+
/**
|
|
107
|
+
* Specialized version of `std::optional<std::string>`.
|
|
108
|
+
*/
|
|
109
|
+
using std__optional_std__string_ = std::optional<std::string>;
|
|
110
|
+
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
|
|
111
|
+
return std::optional<std::string>(value);
|
|
112
|
+
}
|
|
113
|
+
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
114
|
+
return optional.has_value();
|
|
115
|
+
}
|
|
116
|
+
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
117
|
+
return *optional;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// pragma MARK: std::shared_ptr<Promise<AccountInfoResult>>
|
|
121
|
+
/**
|
|
122
|
+
* Specialized version of `std::shared_ptr<Promise<AccountInfoResult>>`.
|
|
123
|
+
*/
|
|
124
|
+
using std__shared_ptr_Promise_AccountInfoResult__ = std::shared_ptr<Promise<AccountInfoResult>>;
|
|
125
|
+
inline std::shared_ptr<Promise<AccountInfoResult>> create_std__shared_ptr_Promise_AccountInfoResult__() noexcept {
|
|
126
|
+
return Promise<AccountInfoResult>::create();
|
|
127
|
+
}
|
|
128
|
+
inline PromiseHolder<AccountInfoResult> wrap_std__shared_ptr_Promise_AccountInfoResult__(std::shared_ptr<Promise<AccountInfoResult>> promise) noexcept {
|
|
129
|
+
return PromiseHolder<AccountInfoResult>(std::move(promise));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// pragma MARK: std::function<void(const AccountInfoResult& /* result */)>
|
|
133
|
+
/**
|
|
134
|
+
* Specialized version of `std::function<void(const AccountInfoResult&)>`.
|
|
135
|
+
*/
|
|
136
|
+
using Func_void_AccountInfoResult = std::function<void(const AccountInfoResult& /* result */)>;
|
|
137
|
+
/**
|
|
138
|
+
* Wrapper class for a `std::function<void(const AccountInfoResult& / * result * /)>`, this can be used from Swift.
|
|
139
|
+
*/
|
|
140
|
+
class Func_void_AccountInfoResult_Wrapper final {
|
|
141
|
+
public:
|
|
142
|
+
explicit Func_void_AccountInfoResult_Wrapper(std::function<void(const AccountInfoResult& /* result */)>&& func): _function(std::make_unique<std::function<void(const AccountInfoResult& /* result */)>>(std::move(func))) {}
|
|
143
|
+
inline void call(AccountInfoResult result) const noexcept {
|
|
144
|
+
_function->operator()(result);
|
|
145
|
+
}
|
|
146
|
+
private:
|
|
147
|
+
std::unique_ptr<std::function<void(const AccountInfoResult& /* result */)>> _function;
|
|
148
|
+
} SWIFT_NONCOPYABLE;
|
|
149
|
+
Func_void_AccountInfoResult create_Func_void_AccountInfoResult(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
150
|
+
inline Func_void_AccountInfoResult_Wrapper wrap_Func_void_AccountInfoResult(Func_void_AccountInfoResult value) noexcept {
|
|
151
|
+
return Func_void_AccountInfoResult_Wrapper(std::move(value));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// pragma MARK: std::shared_ptr<Promise<SaveRecordResult>>
|
|
155
|
+
/**
|
|
156
|
+
* Specialized version of `std::shared_ptr<Promise<SaveRecordResult>>`.
|
|
157
|
+
*/
|
|
158
|
+
using std__shared_ptr_Promise_SaveRecordResult__ = std::shared_ptr<Promise<SaveRecordResult>>;
|
|
159
|
+
inline std::shared_ptr<Promise<SaveRecordResult>> create_std__shared_ptr_Promise_SaveRecordResult__() noexcept {
|
|
160
|
+
return Promise<SaveRecordResult>::create();
|
|
161
|
+
}
|
|
162
|
+
inline PromiseHolder<SaveRecordResult> wrap_std__shared_ptr_Promise_SaveRecordResult__(std::shared_ptr<Promise<SaveRecordResult>> promise) noexcept {
|
|
163
|
+
return PromiseHolder<SaveRecordResult>(std::move(promise));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// pragma MARK: std::function<void(const SaveRecordResult& /* result */)>
|
|
167
|
+
/**
|
|
168
|
+
* Specialized version of `std::function<void(const SaveRecordResult&)>`.
|
|
169
|
+
*/
|
|
170
|
+
using Func_void_SaveRecordResult = std::function<void(const SaveRecordResult& /* result */)>;
|
|
171
|
+
/**
|
|
172
|
+
* Wrapper class for a `std::function<void(const SaveRecordResult& / * result * /)>`, this can be used from Swift.
|
|
173
|
+
*/
|
|
174
|
+
class Func_void_SaveRecordResult_Wrapper final {
|
|
175
|
+
public:
|
|
176
|
+
explicit Func_void_SaveRecordResult_Wrapper(std::function<void(const SaveRecordResult& /* result */)>&& func): _function(std::make_unique<std::function<void(const SaveRecordResult& /* result */)>>(std::move(func))) {}
|
|
177
|
+
inline void call(SaveRecordResult result) const noexcept {
|
|
178
|
+
_function->operator()(result);
|
|
179
|
+
}
|
|
180
|
+
private:
|
|
181
|
+
std::unique_ptr<std::function<void(const SaveRecordResult& /* result */)>> _function;
|
|
182
|
+
} SWIFT_NONCOPYABLE;
|
|
183
|
+
Func_void_SaveRecordResult create_Func_void_SaveRecordResult(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
184
|
+
inline Func_void_SaveRecordResult_Wrapper wrap_Func_void_SaveRecordResult(Func_void_SaveRecordResult value) noexcept {
|
|
185
|
+
return Func_void_SaveRecordResult_Wrapper(std::move(value));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// pragma MARK: std::optional<RecordResult>
|
|
189
|
+
/**
|
|
190
|
+
* Specialized version of `std::optional<RecordResult>`.
|
|
191
|
+
*/
|
|
192
|
+
using std__optional_RecordResult_ = std::optional<RecordResult>;
|
|
193
|
+
inline std::optional<RecordResult> create_std__optional_RecordResult_(const RecordResult& value) noexcept {
|
|
194
|
+
return std::optional<RecordResult>(value);
|
|
195
|
+
}
|
|
196
|
+
inline bool has_value_std__optional_RecordResult_(const std::optional<RecordResult>& optional) noexcept {
|
|
197
|
+
return optional.has_value();
|
|
198
|
+
}
|
|
199
|
+
inline RecordResult get_std__optional_RecordResult_(const std::optional<RecordResult>& optional) noexcept {
|
|
200
|
+
return *optional;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// pragma MARK: std::shared_ptr<Promise<std::optional<RecordResult>>>
|
|
204
|
+
/**
|
|
205
|
+
* Specialized version of `std::shared_ptr<Promise<std::optional<RecordResult>>>`.
|
|
206
|
+
*/
|
|
207
|
+
using std__shared_ptr_Promise_std__optional_RecordResult___ = std::shared_ptr<Promise<std::optional<RecordResult>>>;
|
|
208
|
+
inline std::shared_ptr<Promise<std::optional<RecordResult>>> create_std__shared_ptr_Promise_std__optional_RecordResult___() noexcept {
|
|
209
|
+
return Promise<std::optional<RecordResult>>::create();
|
|
210
|
+
}
|
|
211
|
+
inline PromiseHolder<std::optional<RecordResult>> wrap_std__shared_ptr_Promise_std__optional_RecordResult___(std::shared_ptr<Promise<std::optional<RecordResult>>> promise) noexcept {
|
|
212
|
+
return PromiseHolder<std::optional<RecordResult>>(std::move(promise));
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// pragma MARK: std::function<void(const std::optional<RecordResult>& /* result */)>
|
|
216
|
+
/**
|
|
217
|
+
* Specialized version of `std::function<void(const std::optional<RecordResult>&)>`.
|
|
218
|
+
*/
|
|
219
|
+
using Func_void_std__optional_RecordResult_ = std::function<void(const std::optional<RecordResult>& /* result */)>;
|
|
220
|
+
/**
|
|
221
|
+
* Wrapper class for a `std::function<void(const std::optional<RecordResult>& / * result * /)>`, this can be used from Swift.
|
|
222
|
+
*/
|
|
223
|
+
class Func_void_std__optional_RecordResult__Wrapper final {
|
|
224
|
+
public:
|
|
225
|
+
explicit Func_void_std__optional_RecordResult__Wrapper(std::function<void(const std::optional<RecordResult>& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::optional<RecordResult>& /* result */)>>(std::move(func))) {}
|
|
226
|
+
inline void call(std::optional<RecordResult> result) const noexcept {
|
|
227
|
+
_function->operator()(result);
|
|
228
|
+
}
|
|
229
|
+
private:
|
|
230
|
+
std::unique_ptr<std::function<void(const std::optional<RecordResult>& /* result */)>> _function;
|
|
231
|
+
} SWIFT_NONCOPYABLE;
|
|
232
|
+
Func_void_std__optional_RecordResult_ create_Func_void_std__optional_RecordResult_(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
233
|
+
inline Func_void_std__optional_RecordResult__Wrapper wrap_Func_void_std__optional_RecordResult_(Func_void_std__optional_RecordResult_ value) noexcept {
|
|
234
|
+
return Func_void_std__optional_RecordResult__Wrapper(std::move(value));
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// pragma MARK: std::vector<RecordResult>
|
|
238
|
+
/**
|
|
239
|
+
* Specialized version of `std::vector<RecordResult>`.
|
|
240
|
+
*/
|
|
241
|
+
using std__vector_RecordResult_ = std::vector<RecordResult>;
|
|
242
|
+
inline std::vector<RecordResult> copy_std__vector_RecordResult_(const RecordResult* CONTIGUOUS_MEMORY NON_NULL data, size_t size) noexcept {
|
|
243
|
+
return margelo::nitro::FastVectorCopy<RecordResult>(data, size);
|
|
244
|
+
}
|
|
245
|
+
inline const RecordResult* CONTIGUOUS_MEMORY NON_NULL get_data_std__vector_RecordResult_(const std::vector<RecordResult>& vector) noexcept {
|
|
246
|
+
return vector.data();
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// pragma MARK: std::shared_ptr<Promise<QueryRecordsResult>>
|
|
250
|
+
/**
|
|
251
|
+
* Specialized version of `std::shared_ptr<Promise<QueryRecordsResult>>`.
|
|
252
|
+
*/
|
|
253
|
+
using std__shared_ptr_Promise_QueryRecordsResult__ = std::shared_ptr<Promise<QueryRecordsResult>>;
|
|
254
|
+
inline std::shared_ptr<Promise<QueryRecordsResult>> create_std__shared_ptr_Promise_QueryRecordsResult__() noexcept {
|
|
255
|
+
return Promise<QueryRecordsResult>::create();
|
|
256
|
+
}
|
|
257
|
+
inline PromiseHolder<QueryRecordsResult> wrap_std__shared_ptr_Promise_QueryRecordsResult__(std::shared_ptr<Promise<QueryRecordsResult>> promise) noexcept {
|
|
258
|
+
return PromiseHolder<QueryRecordsResult>(std::move(promise));
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// pragma MARK: std::function<void(const QueryRecordsResult& /* result */)>
|
|
262
|
+
/**
|
|
263
|
+
* Specialized version of `std::function<void(const QueryRecordsResult&)>`.
|
|
264
|
+
*/
|
|
265
|
+
using Func_void_QueryRecordsResult = std::function<void(const QueryRecordsResult& /* result */)>;
|
|
266
|
+
/**
|
|
267
|
+
* Wrapper class for a `std::function<void(const QueryRecordsResult& / * result * /)>`, this can be used from Swift.
|
|
268
|
+
*/
|
|
269
|
+
class Func_void_QueryRecordsResult_Wrapper final {
|
|
270
|
+
public:
|
|
271
|
+
explicit Func_void_QueryRecordsResult_Wrapper(std::function<void(const QueryRecordsResult& /* result */)>&& func): _function(std::make_unique<std::function<void(const QueryRecordsResult& /* result */)>>(std::move(func))) {}
|
|
272
|
+
inline void call(QueryRecordsResult result) const noexcept {
|
|
273
|
+
_function->operator()(result);
|
|
274
|
+
}
|
|
275
|
+
private:
|
|
276
|
+
std::unique_ptr<std::function<void(const QueryRecordsResult& /* result */)>> _function;
|
|
277
|
+
} SWIFT_NONCOPYABLE;
|
|
278
|
+
Func_void_QueryRecordsResult create_Func_void_QueryRecordsResult(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
279
|
+
inline Func_void_QueryRecordsResult_Wrapper wrap_Func_void_QueryRecordsResult(Func_void_QueryRecordsResult value) noexcept {
|
|
280
|
+
return Func_void_QueryRecordsResult_Wrapper(std::move(value));
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// pragma MARK: std::shared_ptr<HybridCloudKitModuleSpec>
|
|
284
|
+
/**
|
|
285
|
+
* Specialized version of `std::shared_ptr<HybridCloudKitModuleSpec>`.
|
|
286
|
+
*/
|
|
287
|
+
using std__shared_ptr_HybridCloudKitModuleSpec_ = std::shared_ptr<HybridCloudKitModuleSpec>;
|
|
288
|
+
std::shared_ptr<HybridCloudKitModuleSpec> create_std__shared_ptr_HybridCloudKitModuleSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
289
|
+
void* NON_NULL get_std__shared_ptr_HybridCloudKitModuleSpec_(std__shared_ptr_HybridCloudKitModuleSpec_ cppType) noexcept;
|
|
290
|
+
|
|
291
|
+
// pragma MARK: std::weak_ptr<HybridCloudKitModuleSpec>
|
|
292
|
+
using std__weak_ptr_HybridCloudKitModuleSpec_ = std::weak_ptr<HybridCloudKitModuleSpec>;
|
|
293
|
+
inline std__weak_ptr_HybridCloudKitModuleSpec_ weakify_std__shared_ptr_HybridCloudKitModuleSpec_(const std::shared_ptr<HybridCloudKitModuleSpec>& strong) noexcept { return strong; }
|
|
294
|
+
|
|
295
|
+
// pragma MARK: Result<std::shared_ptr<Promise<bool>>>
|
|
296
|
+
using Result_std__shared_ptr_Promise_bool___ = Result<std::shared_ptr<Promise<bool>>>;
|
|
297
|
+
inline Result_std__shared_ptr_Promise_bool___ create_Result_std__shared_ptr_Promise_bool___(const std::shared_ptr<Promise<bool>>& value) noexcept {
|
|
298
|
+
return Result<std::shared_ptr<Promise<bool>>>::withValue(value);
|
|
299
|
+
}
|
|
300
|
+
inline Result_std__shared_ptr_Promise_bool___ create_Result_std__shared_ptr_Promise_bool___(const std::exception_ptr& error) noexcept {
|
|
301
|
+
return Result<std::shared_ptr<Promise<bool>>>::withError(error);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// pragma MARK: Result<std::shared_ptr<Promise<AccountInfoResult>>>
|
|
305
|
+
using Result_std__shared_ptr_Promise_AccountInfoResult___ = Result<std::shared_ptr<Promise<AccountInfoResult>>>;
|
|
306
|
+
inline Result_std__shared_ptr_Promise_AccountInfoResult___ create_Result_std__shared_ptr_Promise_AccountInfoResult___(const std::shared_ptr<Promise<AccountInfoResult>>& value) noexcept {
|
|
307
|
+
return Result<std::shared_ptr<Promise<AccountInfoResult>>>::withValue(value);
|
|
308
|
+
}
|
|
309
|
+
inline Result_std__shared_ptr_Promise_AccountInfoResult___ create_Result_std__shared_ptr_Promise_AccountInfoResult___(const std::exception_ptr& error) noexcept {
|
|
310
|
+
return Result<std::shared_ptr<Promise<AccountInfoResult>>>::withError(error);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// pragma MARK: Result<std::shared_ptr<Promise<SaveRecordResult>>>
|
|
314
|
+
using Result_std__shared_ptr_Promise_SaveRecordResult___ = Result<std::shared_ptr<Promise<SaveRecordResult>>>;
|
|
315
|
+
inline Result_std__shared_ptr_Promise_SaveRecordResult___ create_Result_std__shared_ptr_Promise_SaveRecordResult___(const std::shared_ptr<Promise<SaveRecordResult>>& value) noexcept {
|
|
316
|
+
return Result<std::shared_ptr<Promise<SaveRecordResult>>>::withValue(value);
|
|
317
|
+
}
|
|
318
|
+
inline Result_std__shared_ptr_Promise_SaveRecordResult___ create_Result_std__shared_ptr_Promise_SaveRecordResult___(const std::exception_ptr& error) noexcept {
|
|
319
|
+
return Result<std::shared_ptr<Promise<SaveRecordResult>>>::withError(error);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// pragma MARK: Result<std::shared_ptr<Promise<std::optional<RecordResult>>>>
|
|
323
|
+
using Result_std__shared_ptr_Promise_std__optional_RecordResult____ = Result<std::shared_ptr<Promise<std::optional<RecordResult>>>>;
|
|
324
|
+
inline Result_std__shared_ptr_Promise_std__optional_RecordResult____ create_Result_std__shared_ptr_Promise_std__optional_RecordResult____(const std::shared_ptr<Promise<std::optional<RecordResult>>>& value) noexcept {
|
|
325
|
+
return Result<std::shared_ptr<Promise<std::optional<RecordResult>>>>::withValue(value);
|
|
326
|
+
}
|
|
327
|
+
inline Result_std__shared_ptr_Promise_std__optional_RecordResult____ create_Result_std__shared_ptr_Promise_std__optional_RecordResult____(const std::exception_ptr& error) noexcept {
|
|
328
|
+
return Result<std::shared_ptr<Promise<std::optional<RecordResult>>>>::withError(error);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// pragma MARK: Result<std::shared_ptr<Promise<QueryRecordsResult>>>
|
|
332
|
+
using Result_std__shared_ptr_Promise_QueryRecordsResult___ = Result<std::shared_ptr<Promise<QueryRecordsResult>>>;
|
|
333
|
+
inline Result_std__shared_ptr_Promise_QueryRecordsResult___ create_Result_std__shared_ptr_Promise_QueryRecordsResult___(const std::shared_ptr<Promise<QueryRecordsResult>>& value) noexcept {
|
|
334
|
+
return Result<std::shared_ptr<Promise<QueryRecordsResult>>>::withValue(value);
|
|
335
|
+
}
|
|
336
|
+
inline Result_std__shared_ptr_Promise_QueryRecordsResult___ create_Result_std__shared_ptr_Promise_QueryRecordsResult___(const std::exception_ptr& error) noexcept {
|
|
337
|
+
return Result<std::shared_ptr<Promise<QueryRecordsResult>>>::withError(error);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
} // namespace margelo::nitro::cloudkitmodule::bridge::swift
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CloudKitModule-Swift-Cxx-Umbrella.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `AccountInfoResult` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::cloudkitmodule { struct AccountInfoResult; }
|
|
13
|
+
// Forward declaration of `DeleteRecordParams` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::cloudkitmodule { struct DeleteRecordParams; }
|
|
15
|
+
// Forward declaration of `FetchRecordParams` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::cloudkitmodule { struct FetchRecordParams; }
|
|
17
|
+
// Forward declaration of `HybridCloudKitModuleSpec` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::cloudkitmodule { class HybridCloudKitModuleSpec; }
|
|
19
|
+
// Forward declaration of `QueryRecordsParams` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::cloudkitmodule { struct QueryRecordsParams; }
|
|
21
|
+
// Forward declaration of `QueryRecordsResult` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::cloudkitmodule { struct QueryRecordsResult; }
|
|
23
|
+
// Forward declaration of `RecordExistsParams` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::cloudkitmodule { struct RecordExistsParams; }
|
|
25
|
+
// Forward declaration of `RecordResult` to properly resolve imports.
|
|
26
|
+
namespace margelo::nitro::cloudkitmodule { struct RecordResult; }
|
|
27
|
+
// Forward declaration of `SaveRecordParams` to properly resolve imports.
|
|
28
|
+
namespace margelo::nitro::cloudkitmodule { struct SaveRecordParams; }
|
|
29
|
+
// Forward declaration of `SaveRecordResult` to properly resolve imports.
|
|
30
|
+
namespace margelo::nitro::cloudkitmodule { struct SaveRecordResult; }
|
|
31
|
+
|
|
32
|
+
// Include C++ defined types
|
|
33
|
+
#include "AccountInfoResult.hpp"
|
|
34
|
+
#include "DeleteRecordParams.hpp"
|
|
35
|
+
#include "FetchRecordParams.hpp"
|
|
36
|
+
#include "HybridCloudKitModuleSpec.hpp"
|
|
37
|
+
#include "QueryRecordsParams.hpp"
|
|
38
|
+
#include "QueryRecordsResult.hpp"
|
|
39
|
+
#include "RecordExistsParams.hpp"
|
|
40
|
+
#include "RecordResult.hpp"
|
|
41
|
+
#include "SaveRecordParams.hpp"
|
|
42
|
+
#include "SaveRecordResult.hpp"
|
|
43
|
+
#include <NitroModules/Promise.hpp>
|
|
44
|
+
#include <NitroModules/Result.hpp>
|
|
45
|
+
#include <exception>
|
|
46
|
+
#include <memory>
|
|
47
|
+
#include <optional>
|
|
48
|
+
#include <string>
|
|
49
|
+
#include <vector>
|
|
50
|
+
|
|
51
|
+
// C++ helpers for Swift
|
|
52
|
+
#include "CloudKitModule-Swift-Cxx-Bridge.hpp"
|
|
53
|
+
|
|
54
|
+
// Common C++ types used in Swift
|
|
55
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
56
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
57
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
58
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
59
|
+
|
|
60
|
+
// Forward declarations of Swift defined types
|
|
61
|
+
// Forward declaration of `HybridCloudKitModuleSpec_cxx` to properly resolve imports.
|
|
62
|
+
namespace CloudKitModule { class HybridCloudKitModuleSpec_cxx; }
|
|
63
|
+
|
|
64
|
+
// Include Swift defined types
|
|
65
|
+
#if __has_include("CloudKitModule-Swift.h")
|
|
66
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
67
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "CloudKitModule".
|
|
68
|
+
#include "CloudKitModule-Swift.h"
|
|
69
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
70
|
+
#elif __has_include(<CloudKitModule/CloudKitModule-Swift.h>)
|
|
71
|
+
#include <CloudKitModule/CloudKitModule-Swift.h>
|
|
72
|
+
#else
|
|
73
|
+
#error CloudKitModule's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "CloudKitModule", and try building the app first.
|
|
74
|
+
#endif
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CloudKitModuleAutolinking.mm
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
+
#import "CloudKitModule-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridCloudKitModuleSpecSwift.hpp"
|
|
14
|
+
|
|
15
|
+
@interface CloudKitModuleAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation CloudKitModuleAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::cloudkitmodule;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"CloudKitModule",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
std::shared_ptr<HybridCloudKitModuleSpec> hybridObject = CloudKitModule::CloudKitModuleAutolinking::createCloudKitModule();
|
|
28
|
+
return hybridObject;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CloudKitModuleAutolinking.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
public final class CloudKitModuleAutolinking {
|
|
9
|
+
public typealias bridge = margelo.nitro.cloudkitmodule.bridge.swift
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of a Swift class that implements `HybridCloudKitModuleSpec`,
|
|
13
|
+
* and wraps it in a Swift class that can directly interop with C++ (`HybridCloudKitModuleSpec_cxx`)
|
|
14
|
+
*
|
|
15
|
+
* This is generated by Nitrogen and will initialize the class specified
|
|
16
|
+
* in the `"autolinking"` property of `nitro.json` (in this case, `CloudKitModule`).
|
|
17
|
+
*/
|
|
18
|
+
public static func createCloudKitModule() -> bridge.std__shared_ptr_HybridCloudKitModuleSpec_ {
|
|
19
|
+
let hybridObject = CloudKitModule()
|
|
20
|
+
return { () -> bridge.std__shared_ptr_HybridCloudKitModuleSpec_ in
|
|
21
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
22
|
+
return __cxxWrapped.getCxxPart()
|
|
23
|
+
}()
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridCloudKitModuleSpecSwift.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridCloudKitModuleSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::cloudkitmodule {
|
|
11
|
+
} // namespace margelo::nitro::cloudkitmodule
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridCloudKitModuleSpecSwift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "HybridCloudKitModuleSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridCloudKitModuleSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace CloudKitModule { class HybridCloudKitModuleSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `AccountInfoResult` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::cloudkitmodule { struct AccountInfoResult; }
|
|
17
|
+
// Forward declaration of `SaveRecordResult` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::cloudkitmodule { struct SaveRecordResult; }
|
|
19
|
+
// Forward declaration of `SaveRecordParams` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::cloudkitmodule { struct SaveRecordParams; }
|
|
21
|
+
// Forward declaration of `RecordResult` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::cloudkitmodule { struct RecordResult; }
|
|
23
|
+
// Forward declaration of `FetchRecordParams` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::cloudkitmodule { struct FetchRecordParams; }
|
|
25
|
+
// Forward declaration of `DeleteRecordParams` to properly resolve imports.
|
|
26
|
+
namespace margelo::nitro::cloudkitmodule { struct DeleteRecordParams; }
|
|
27
|
+
// Forward declaration of `RecordExistsParams` to properly resolve imports.
|
|
28
|
+
namespace margelo::nitro::cloudkitmodule { struct RecordExistsParams; }
|
|
29
|
+
// Forward declaration of `QueryRecordsResult` to properly resolve imports.
|
|
30
|
+
namespace margelo::nitro::cloudkitmodule { struct QueryRecordsResult; }
|
|
31
|
+
// Forward declaration of `QueryRecordsParams` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::cloudkitmodule { struct QueryRecordsParams; }
|
|
33
|
+
|
|
34
|
+
#include <NitroModules/Promise.hpp>
|
|
35
|
+
#include "AccountInfoResult.hpp"
|
|
36
|
+
#include <string>
|
|
37
|
+
#include <optional>
|
|
38
|
+
#include "SaveRecordResult.hpp"
|
|
39
|
+
#include "SaveRecordParams.hpp"
|
|
40
|
+
#include "RecordResult.hpp"
|
|
41
|
+
#include "FetchRecordParams.hpp"
|
|
42
|
+
#include "DeleteRecordParams.hpp"
|
|
43
|
+
#include "RecordExistsParams.hpp"
|
|
44
|
+
#include "QueryRecordsResult.hpp"
|
|
45
|
+
#include <vector>
|
|
46
|
+
#include "QueryRecordsParams.hpp"
|
|
47
|
+
|
|
48
|
+
#include "CloudKitModule-Swift-Cxx-Umbrella.hpp"
|
|
49
|
+
|
|
50
|
+
namespace margelo::nitro::cloudkitmodule {
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The C++ part of HybridCloudKitModuleSpec_cxx.swift.
|
|
54
|
+
*
|
|
55
|
+
* HybridCloudKitModuleSpecSwift (C++) accesses HybridCloudKitModuleSpec_cxx (Swift), and might
|
|
56
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
57
|
+
*
|
|
58
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
59
|
+
* the future, HybridCloudKitModuleSpec_cxx can directly inherit from the C++ class HybridCloudKitModuleSpec
|
|
60
|
+
* to simplify the whole structure and memory management.
|
|
61
|
+
*/
|
|
62
|
+
class HybridCloudKitModuleSpecSwift: public virtual HybridCloudKitModuleSpec {
|
|
63
|
+
public:
|
|
64
|
+
// Constructor from a Swift instance
|
|
65
|
+
explicit HybridCloudKitModuleSpecSwift(const CloudKitModule::HybridCloudKitModuleSpec_cxx& swiftPart):
|
|
66
|
+
HybridObject(HybridCloudKitModuleSpec::TAG),
|
|
67
|
+
_swiftPart(swiftPart) { }
|
|
68
|
+
|
|
69
|
+
public:
|
|
70
|
+
// Get the Swift part
|
|
71
|
+
inline CloudKitModule::HybridCloudKitModuleSpec_cxx& getSwiftPart() noexcept {
|
|
72
|
+
return _swiftPart;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public:
|
|
76
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
77
|
+
return _swiftPart.getMemorySize();
|
|
78
|
+
}
|
|
79
|
+
void dispose() noexcept override {
|
|
80
|
+
_swiftPart.dispose();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public:
|
|
84
|
+
// Properties
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
public:
|
|
88
|
+
// Methods
|
|
89
|
+
inline std::shared_ptr<Promise<bool>> isAvailable() override {
|
|
90
|
+
auto __result = _swiftPart.isAvailable();
|
|
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<AccountInfoResult>> getAccountInfo() override {
|
|
98
|
+
auto __result = _swiftPart.getAccountInfo();
|
|
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<SaveRecordResult>> saveRecord(const SaveRecordParams& params) override {
|
|
106
|
+
auto __result = _swiftPart.saveRecord(std::forward<decltype(params)>(params));
|
|
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 std::shared_ptr<Promise<std::optional<RecordResult>>> fetchRecord(const FetchRecordParams& params) override {
|
|
114
|
+
auto __result = _swiftPart.fetchRecord(std::forward<decltype(params)>(params));
|
|
115
|
+
if (__result.hasError()) [[unlikely]] {
|
|
116
|
+
std::rethrow_exception(__result.error());
|
|
117
|
+
}
|
|
118
|
+
auto __value = std::move(__result.value());
|
|
119
|
+
return __value;
|
|
120
|
+
}
|
|
121
|
+
inline std::shared_ptr<Promise<bool>> deleteRecord(const DeleteRecordParams& params) override {
|
|
122
|
+
auto __result = _swiftPart.deleteRecord(std::forward<decltype(params)>(params));
|
|
123
|
+
if (__result.hasError()) [[unlikely]] {
|
|
124
|
+
std::rethrow_exception(__result.error());
|
|
125
|
+
}
|
|
126
|
+
auto __value = std::move(__result.value());
|
|
127
|
+
return __value;
|
|
128
|
+
}
|
|
129
|
+
inline std::shared_ptr<Promise<bool>> recordExists(const RecordExistsParams& params) override {
|
|
130
|
+
auto __result = _swiftPart.recordExists(std::forward<decltype(params)>(params));
|
|
131
|
+
if (__result.hasError()) [[unlikely]] {
|
|
132
|
+
std::rethrow_exception(__result.error());
|
|
133
|
+
}
|
|
134
|
+
auto __value = std::move(__result.value());
|
|
135
|
+
return __value;
|
|
136
|
+
}
|
|
137
|
+
inline std::shared_ptr<Promise<QueryRecordsResult>> queryRecords(const QueryRecordsParams& params) override {
|
|
138
|
+
auto __result = _swiftPart.queryRecords(std::forward<decltype(params)>(params));
|
|
139
|
+
if (__result.hasError()) [[unlikely]] {
|
|
140
|
+
std::rethrow_exception(__result.error());
|
|
141
|
+
}
|
|
142
|
+
auto __value = std::move(__result.value());
|
|
143
|
+
return __value;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
private:
|
|
147
|
+
CloudKitModule::HybridCloudKitModuleSpec_cxx _swiftPart;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
} // namespace margelo::nitro::cloudkitmodule
|