/// /// JNativeChangeEvent.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 "NativeChangeEvent.hpp" #include "JNativeChangeOrigin.hpp" #include "NativeChangeOrigin.hpp" #include namespace margelo::nitro::codepad { using namespace facebook; /** * The C++ JNI bridge between the C++ struct "NativeChangeEvent" and the Kotlin data class "NativeChangeEvent". */ struct JNativeChangeEvent final: public jni::JavaClass { public: static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/codepad/NativeChangeEvent;"; public: /** * Convert this Java/Kotlin-based struct to the C++ struct NativeChangeEvent by copying all values to C++. */ [[maybe_unused]] [[nodiscard]] NativeChangeEvent toCpp() const { static const auto clazz = javaClassStatic(); static const auto fieldStart = clazz->getField("start"); double start = this->getFieldValue(fieldStart); static const auto fieldEnd = clazz->getField("end"); double end = this->getFieldValue(fieldEnd); static const auto fieldText = clazz->getField("text"); jni::local_ref text = this->getFieldValue(fieldText); static const auto fieldOrigin = clazz->getField("origin"); jni::local_ref origin = this->getFieldValue(fieldOrigin); static const auto fieldRevision = clazz->getField("revision"); double revision = this->getFieldValue(fieldRevision); return NativeChangeEvent( start, end, text->toStdString(), origin->toCpp(), revision ); } 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 NativeChangeEvent& value) { using JSignature = JNativeChangeEvent(double, double, jni::alias_ref, jni::alias_ref, double); static const auto clazz = javaClassStatic(); static const auto create = clazz->getStaticMethod("fromCpp"); return create( clazz, value.start, value.end, jni::make_jstring(value.text), JNativeChangeOrigin::fromCpp(value.origin), value.revision ); } }; } // namespace margelo::nitro::codepad