Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support optional<future> #172

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions support-lib/composer/djinni_composer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ struct Optional {
static ComposerType fromCpp(const OptionalType<typename T::CppType>& c) {
return c ? T::Boxed::fromCpp(*c) : Composer::Value::undefined();
}
static ComposerType fromCpp(OptionalType<typename T::CppType>&& c) {
return c ? T::Boxed::fromCpp(std::move(*c)) : Composer::Value::undefined();
}
template<typename C = T>
static ComposerType fromCpp(const typename C::CppOptType& cppOpt) {
return T::Boxed::fromCppOpt(cppOpt);
Expand Down
4 changes: 4 additions & 0 deletions support-lib/jni/Marshal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ namespace djinni
{
return c ? T::Boxed::fromCpp(jniEnv, *c) : LocalRef<JniType>{};
}
static LocalRef<JniType> fromCpp(JNIEnv* jniEnv, OptionalType<typename T::CppType> &&c)
{
return c ? T::Boxed::fromCpp(jniEnv, std::move(*c)) : LocalRef<JniType>{};
}

// fromCpp used for nullable shared_ptr
template <typename C = T>
Expand Down
3 changes: 3 additions & 0 deletions support-lib/objc/DJIMarshal+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ class Optional {
static ObjcType fromCpp(const OptionalType<typename T::CppType>& opt) {
return opt ? T::Boxed::fromCpp(*opt) : nil;
}
static ObjcType fromCpp(OptionalType<typename T::CppType>&& opt) {
return opt ? T::Boxed::fromCpp(std::move(*opt)) : nil;
}

// fromCpp used for nullable shared_ptr
template <typename C = T>
Expand Down
3 changes: 3 additions & 0 deletions support-lib/wasm/djinni_wasm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ struct Optional
static JsType fromCpp(const OptionalType<typename T::CppType>& c) {
return c ? T::Boxed::fromCpp(*c) : em::val::undefined();
}
static JsType fromCpp(OptionalType<typename T::CppType>&& c) {
return c ? T::Boxed::fromCpp(std::move(*c)) : em::val::undefined();
}
template <typename C = T>
static JsType fromCpp(const typename C::CppOptType& cppOpt) {
return T::Boxed::fromCppOpt(cppOpt);
Expand Down
Loading