mirror of
https://github.com/zoriya/react-native-video.git
synced 2026-06-10 13:50:51 +00:00
78 lines
2.5 KiB
C++
Generated
78 lines
2.5 KiB
C++
Generated
///
|
|
/// JTimedMetadata.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 "TimedMetadata.hpp"
|
|
|
|
#include "JTimedMetadataObject.hpp"
|
|
#include "TimedMetadataObject.hpp"
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace margelo::nitro::video {
|
|
|
|
using namespace facebook;
|
|
|
|
/**
|
|
* The C++ JNI bridge between the C++ struct "TimedMetadata" and the the Kotlin data class "TimedMetadata".
|
|
*/
|
|
struct JTimedMetadata final: public jni::JavaClass<JTimedMetadata> {
|
|
public:
|
|
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/video/TimedMetadata;";
|
|
|
|
public:
|
|
/**
|
|
* Convert this Java/Kotlin-based struct to the C++ struct TimedMetadata by copying all values to C++.
|
|
*/
|
|
[[maybe_unused]]
|
|
[[nodiscard]]
|
|
TimedMetadata toCpp() const {
|
|
static const auto clazz = javaClassStatic();
|
|
static const auto fieldMetadata = clazz->getField<jni::JArrayClass<JTimedMetadataObject>>("metadata");
|
|
jni::local_ref<jni::JArrayClass<JTimedMetadataObject>> metadata = this->getFieldValue(fieldMetadata);
|
|
return TimedMetadata(
|
|
[&]() {
|
|
size_t __size = metadata->size();
|
|
std::vector<TimedMetadataObject> __vector;
|
|
__vector.reserve(__size);
|
|
for (size_t __i = 0; __i < __size; __i++) {
|
|
auto __element = metadata->getElement(__i);
|
|
__vector.push_back(__element->toCpp());
|
|
}
|
|
return __vector;
|
|
}()
|
|
);
|
|
}
|
|
|
|
public:
|
|
/**
|
|
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
*/
|
|
[[maybe_unused]]
|
|
static jni::local_ref<JTimedMetadata::javaobject> fromCpp(const TimedMetadata& value) {
|
|
using JSignature = JTimedMetadata(jni::alias_ref<jni::JArrayClass<JTimedMetadataObject>>);
|
|
static const auto clazz = javaClassStatic();
|
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
return create(
|
|
clazz,
|
|
[&]() {
|
|
size_t __size = value.metadata.size();
|
|
jni::local_ref<jni::JArrayClass<JTimedMetadataObject>> __array = jni::JArrayClass<JTimedMetadataObject>::newArray(__size);
|
|
for (size_t __i = 0; __i < __size; __i++) {
|
|
const auto& __element = value.metadata[__i];
|
|
__array->setElement(__i, *JTimedMetadataObject::fromCpp(__element));
|
|
}
|
|
return __array;
|
|
}()
|
|
);
|
|
}
|
|
};
|
|
|
|
} // namespace margelo::nitro::video
|