mirror of
https://github.com/zoriya/react-native-omni.git
synced 2026-08-05 13:46:59 +00:00
60 lines
1.8 KiB
C++
Generated
60 lines
1.8 KiB
C++
Generated
///
|
|
/// JPlayerBackend.hpp
|
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
/// https://github.com/mrousavy/nitro
|
|
/// Copyright © Marc Rousavy @ Margelo
|
|
///
|
|
|
|
#pragma once
|
|
|
|
#include <fbjni/fbjni.h>
|
|
#include "PlayerBackend.hpp"
|
|
|
|
#include "AndroidBackend.hpp"
|
|
#include "JAndroidBackend.hpp"
|
|
#include <optional>
|
|
|
|
namespace margelo::nitro::omni {
|
|
|
|
using namespace facebook;
|
|
|
|
/**
|
|
* The C++ JNI bridge between the C++ struct "PlayerBackend" and the Kotlin data class "PlayerBackend".
|
|
*/
|
|
struct JPlayerBackend final: public jni::JavaClass<JPlayerBackend> {
|
|
public:
|
|
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/PlayerBackend;";
|
|
|
|
public:
|
|
/**
|
|
* Convert this Java/Kotlin-based struct to the C++ struct PlayerBackend by copying all values to C++.
|
|
*/
|
|
[[maybe_unused]]
|
|
[[nodiscard]]
|
|
PlayerBackend toCpp() const {
|
|
static const auto clazz = javaClassStatic();
|
|
static const auto fieldAndroid = clazz->getField<JAndroidBackend>("android");
|
|
jni::local_ref<JAndroidBackend> android = this->getFieldValue(fieldAndroid);
|
|
return PlayerBackend(
|
|
android != nullptr ? std::make_optional(android->toCpp()) : std::nullopt
|
|
);
|
|
}
|
|
|
|
public:
|
|
/**
|
|
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
*/
|
|
[[maybe_unused]]
|
|
static jni::local_ref<JPlayerBackend::javaobject> fromCpp(const PlayerBackend& value) {
|
|
using JSignature = JPlayerBackend(jni::alias_ref<JAndroidBackend>);
|
|
static const auto clazz = javaClassStatic();
|
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
return create(
|
|
clazz,
|
|
value.android.has_value() ? JAndroidBackend::fromCpp(value.android.value()) : nullptr
|
|
);
|
|
}
|
|
};
|
|
|
|
} // namespace margelo::nitro::omni
|