/// /// JRendition.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 "Rendition.hpp" #include namespace margelo::nitro::omni { using namespace facebook; /** * The C++ JNI bridge between the C++ struct "Rendition" and the the Kotlin data class "Rendition". */ struct JRendition final: public jni::JavaClass { public: static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/Rendition;"; public: /** * Convert this Java/Kotlin-based struct to the C++ struct Rendition by copying all values to C++. */ [[maybe_unused]] [[nodiscard]] Rendition toCpp() const { static const auto clazz = javaClassStatic(); static const auto fieldId = clazz->getField("id"); jni::local_ref id = this->getFieldValue(fieldId); static const auto fieldWidth = clazz->getField("width"); double width = this->getFieldValue(fieldWidth); static const auto fieldHeight = clazz->getField("height"); double height = this->getFieldValue(fieldHeight); static const auto fieldBitrate = clazz->getField("bitrate"); double bitrate = this->getFieldValue(fieldBitrate); static const auto fieldSelected = clazz->getField("selected"); jboolean selected = this->getFieldValue(fieldSelected); return Rendition( id->toStdString(), width, height, bitrate, static_cast(selected) ); } 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 Rendition& value) { using JSignature = JRendition(jni::alias_ref, double, double, double, jboolean); static const auto clazz = javaClassStatic(); static const auto create = clazz->getStaticMethod("fromCpp"); return create( clazz, jni::make_jstring(value.id), value.width, value.height, value.bitrate, value.selected ); } }; } // namespace margelo::nitro::omni