mirror of
https://github.com/zoriya/react-native-video.git
synced 2026-06-19 08:32:37 +00:00
75 lines
3.3 KiB
C++
Generated
75 lines
3.3 KiB
C++
Generated
///
|
|
/// JCustomVideoMetadata.hpp
|
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
/// https://github.com/mrousavy/nitro
|
|
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
///
|
|
|
|
#pragma once
|
|
|
|
#include <fbjni/fbjni.h>
|
|
#include "CustomVideoMetadata.hpp"
|
|
|
|
#include <optional>
|
|
#include <string>
|
|
|
|
namespace margelo::nitro::video {
|
|
|
|
using namespace facebook;
|
|
|
|
/**
|
|
* The C++ JNI bridge between the C++ struct "CustomVideoMetadata" and the the Kotlin data class "CustomVideoMetadata".
|
|
*/
|
|
struct JCustomVideoMetadata final: public jni::JavaClass<JCustomVideoMetadata> {
|
|
public:
|
|
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/video/CustomVideoMetadata;";
|
|
|
|
public:
|
|
/**
|
|
* Convert this Java/Kotlin-based struct to the C++ struct CustomVideoMetadata by copying all values to C++.
|
|
*/
|
|
[[maybe_unused]]
|
|
[[nodiscard]]
|
|
CustomVideoMetadata toCpp() const {
|
|
static const auto clazz = javaClassStatic();
|
|
static const auto fieldTitle = clazz->getField<jni::JString>("title");
|
|
jni::local_ref<jni::JString> title = this->getFieldValue(fieldTitle);
|
|
static const auto fieldSubtitle = clazz->getField<jni::JString>("subtitle");
|
|
jni::local_ref<jni::JString> subtitle = this->getFieldValue(fieldSubtitle);
|
|
static const auto fieldDescription = clazz->getField<jni::JString>("description");
|
|
jni::local_ref<jni::JString> description = this->getFieldValue(fieldDescription);
|
|
static const auto fieldArtist = clazz->getField<jni::JString>("artist");
|
|
jni::local_ref<jni::JString> artist = this->getFieldValue(fieldArtist);
|
|
static const auto fieldImageUri = clazz->getField<jni::JString>("imageUri");
|
|
jni::local_ref<jni::JString> imageUri = this->getFieldValue(fieldImageUri);
|
|
return CustomVideoMetadata(
|
|
title != nullptr ? std::make_optional(title->toStdString()) : std::nullopt,
|
|
subtitle != nullptr ? std::make_optional(subtitle->toStdString()) : std::nullopt,
|
|
description != nullptr ? std::make_optional(description->toStdString()) : std::nullopt,
|
|
artist != nullptr ? std::make_optional(artist->toStdString()) : std::nullopt,
|
|
imageUri != nullptr ? std::make_optional(imageUri->toStdString()) : 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<JCustomVideoMetadata::javaobject> fromCpp(const CustomVideoMetadata& value) {
|
|
using JSignature = JCustomVideoMetadata(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>);
|
|
static const auto clazz = javaClassStatic();
|
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
return create(
|
|
clazz,
|
|
value.title.has_value() ? jni::make_jstring(value.title.value()) : nullptr,
|
|
value.subtitle.has_value() ? jni::make_jstring(value.subtitle.value()) : nullptr,
|
|
value.description.has_value() ? jni::make_jstring(value.description.value()) : nullptr,
|
|
value.artist.has_value() ? jni::make_jstring(value.artist.value()) : nullptr,
|
|
value.imageUri.has_value() ? jni::make_jstring(value.imageUri.value()) : nullptr
|
|
);
|
|
}
|
|
};
|
|
|
|
} // namespace margelo::nitro::video
|