/// /// 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 #include "PlayerBackend.hpp" #include "AndroidBackend.hpp" #include "JAndroidBackend.hpp" #include 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 { 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("android"); jni::local_ref 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 fromCpp(const PlayerBackend& value) { using JSignature = JPlayerBackend(jni::alias_ref); static const auto clazz = javaClassStatic(); static const auto create = clazz->getStaticMethod("fromCpp"); return create( clazz, value.android.has_value() ? JAndroidBackend::fromCpp(value.android.value()) : nullptr ); } }; } // namespace margelo::nitro::omni