mirror of
https://github.com/zoriya/react-native-omni.git
synced 2026-08-05 13:46:59 +00:00
81 lines
2.9 KiB
C++
Generated
81 lines
2.9 KiB
C++
Generated
///
|
|
/// 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 <fbjni/fbjni.h>
|
|
#include "VideoSrc.hpp"
|
|
|
|
#include <optional>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
|
|
namespace margelo::nitro::omni {
|
|
|
|
using namespace facebook;
|
|
|
|
/**
|
|
* The C++ JNI bridge between the C++ struct "VideoSrc" and the Kotlin data class "VideoSrc".
|
|
*/
|
|
struct JVideoSrc final: public jni::JavaClass<JVideoSrc> {
|
|
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<jni::JString>("uri");
|
|
jni::local_ref<jni::JString> uri = this->getFieldValue(fieldUri);
|
|
static const auto fieldMimeType = clazz->getField<jni::JString>("mimeType");
|
|
jni::local_ref<jni::JString> mimeType = this->getFieldValue(fieldMimeType);
|
|
static const auto fieldHeaders = clazz->getField<jni::JMap<jni::JString, jni::JString>>("headers");
|
|
jni::local_ref<jni::JMap<jni::JString, jni::JString>> headers = this->getFieldValue(fieldHeaders);
|
|
return VideoSrc(
|
|
uri->toStdString(),
|
|
mimeType != nullptr ? std::make_optional(mimeType->toStdString()) : std::nullopt,
|
|
[&]() {
|
|
std::unordered_map<std::string, std::string> __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<JVideoSrc::javaobject> fromCpp(const VideoSrc& value) {
|
|
using JSignature = JVideoSrc(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JMap<jni::JString, jni::JString>>);
|
|
static const auto clazz = javaClassStatic();
|
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
return create(
|
|
clazz,
|
|
jni::make_jstring(value.uri),
|
|
value.mimeType.has_value() ? jni::make_jstring(value.mimeType.value()) : nullptr,
|
|
[&]() -> jni::local_ref<jni::JMap<jni::JString, jni::JString>> {
|
|
auto __map = jni::JHashMap<jni::JString, jni::JString>::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
|