/// /// JVideoSrc.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 "VideoSrc.hpp" #include #include #include namespace margelo::nitro::omni { using namespace facebook; /** * The C++ JNI bridge between the C++ struct "VideoSrc" and the the Kotlin data class "VideoSrc". */ struct JVideoSrc final: public jni::JavaClass { public: static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/VideoSrc;"; public: /** * Convert this Java/Kotlin-based struct to the C++ struct VideoSrc by copying all values to C++. */ [[maybe_unused]] [[nodiscard]] VideoSrc toCpp() const { static const auto clazz = javaClassStatic(); static const auto fieldUri = clazz->getField("uri"); jni::local_ref uri = this->getFieldValue(fieldUri); static const auto fieldMimeType = clazz->getField("mimeType"); jni::local_ref mimeType = this->getFieldValue(fieldMimeType); static const auto fieldHeaders = clazz->getField>("headers"); jni::local_ref> headers = this->getFieldValue(fieldHeaders); return VideoSrc( uri->toStdString(), mimeType != nullptr ? std::make_optional(mimeType->toStdString()) : std::nullopt, [&]() { std::unordered_map __map; __map.reserve(headers->size()); for (const auto& __entry : *headers) { __map.emplace(__entry.first->toStdString(), __entry.second->toStdString()); } return __map; }() ); } 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 VideoSrc& value) { using JSignature = JVideoSrc(jni::alias_ref, jni::alias_ref, jni::alias_ref>); static const auto clazz = javaClassStatic(); static const auto create = clazz->getStaticMethod("fromCpp"); return create( clazz, jni::make_jstring(value.uri), value.mimeType.has_value() ? jni::make_jstring(value.mimeType.value()) : nullptr, [&]() -> jni::local_ref> { auto __map = jni::JHashMap::create(value.headers.size()); for (const auto& __entry : value.headers) { __map->put(jni::make_jstring(__entry.first), jni::make_jstring(__entry.second)); } return __map; }() ); } }; } // namespace margelo::nitro::omni