mirror of
https://github.com/zoriya/react-native-omni.git
synced 2026-08-16 02:44:51 +00:00
Create types for player & view
This commit is contained in:
+64
@@ -0,0 +1,64 @@
|
||||
///
|
||||
/// JMixAudioMode.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 "MixAudioMode.hpp"
|
||||
|
||||
namespace margelo::nitro::omni {
|
||||
|
||||
using namespace facebook;
|
||||
|
||||
/**
|
||||
* The C++ JNI bridge between the C++ enum "MixAudioMode" and the the Kotlin enum "MixAudioMode".
|
||||
*/
|
||||
struct JMixAudioMode final: public jni::JavaClass<JMixAudioMode> {
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/MixAudioMode;";
|
||||
|
||||
public:
|
||||
/**
|
||||
* Convert this Java/Kotlin-based enum to the C++ enum MixAudioMode.
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
[[nodiscard]]
|
||||
MixAudioMode toCpp() const {
|
||||
static const auto clazz = javaClassStatic();
|
||||
static const auto fieldOrdinal = clazz->getField<int>("value");
|
||||
int ordinal = this->getFieldValue(fieldOrdinal);
|
||||
return static_cast<MixAudioMode>(ordinal);
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
static jni::alias_ref<JMixAudioMode> fromCpp(MixAudioMode value) {
|
||||
static const auto clazz = javaClassStatic();
|
||||
switch (value) {
|
||||
case MixAudioMode::MIXWITHOTHERS:
|
||||
static const auto fieldMIXWITHOTHERS = clazz->getStaticField<JMixAudioMode>("MIXWITHOTHERS");
|
||||
return clazz->getStaticFieldValue(fieldMIXWITHOTHERS);
|
||||
case MixAudioMode::DONOTMIX:
|
||||
static const auto fieldDONOTMIX = clazz->getStaticField<JMixAudioMode>("DONOTMIX");
|
||||
return clazz->getStaticFieldValue(fieldDONOTMIX);
|
||||
case MixAudioMode::DUCKOTHERS:
|
||||
static const auto fieldDUCKOTHERS = clazz->getStaticField<JMixAudioMode>("DUCKOTHERS");
|
||||
return clazz->getStaticFieldValue(fieldDUCKOTHERS);
|
||||
case MixAudioMode::AUTO:
|
||||
static const auto fieldAUTO = clazz->getStaticField<JMixAudioMode>("AUTO");
|
||||
return clazz->getStaticFieldValue(fieldAUTO);
|
||||
default:
|
||||
std::string stringValue = std::to_string(static_cast<int>(value));
|
||||
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::omni
|
||||
Reference in New Issue
Block a user