/// /// JNativeUnderlineStyle.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 "NativeUnderlineStyle.hpp" namespace margelo::nitro::codepad { using namespace facebook; /** * The C++ JNI bridge between the C++ enum "NativeUnderlineStyle" and the Kotlin enum "NativeUnderlineStyle". */ struct JNativeUnderlineStyle final: public jni::JavaClass { public: static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/codepad/NativeUnderlineStyle;"; public: /** * Convert this Java/Kotlin-based enum to the C++ enum NativeUnderlineStyle. */ [[maybe_unused]] [[nodiscard]] NativeUnderlineStyle toCpp() const { static const auto clazz = javaClassStatic(); static const auto fieldOrdinal = clazz->getField("value"); int ordinal = this->getFieldValue(fieldOrdinal); return static_cast(ordinal); } public: /** * Create a Java/Kotlin-based enum with the given C++ enum's value. */ [[maybe_unused]] static jni::alias_ref fromCpp(NativeUnderlineStyle value) { static const auto clazz = javaClassStatic(); switch (value) { case NativeUnderlineStyle::SOLID: static const auto fieldSOLID = clazz->getStaticField("SOLID"); return clazz->getStaticFieldValue(fieldSOLID); case NativeUnderlineStyle::WAVY: static const auto fieldWAVY = clazz->getStaticField("WAVY"); return clazz->getStaticFieldValue(fieldWAVY); default: std::string stringValue = std::to_string(static_cast(value)); throw std::invalid_argument("Invalid enum value (" + stringValue + "!"); } } }; } // namespace margelo::nitro::codepad