mirror of
https://github.com/zoriya/react-native-omni.git
synced 2026-08-05 13:46:59 +00:00
71 lines
2.7 KiB
C++
Generated
71 lines
2.7 KiB
C++
Generated
///
|
|
/// JNumberProperty.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 "NumberProperty.hpp"
|
|
|
|
namespace margelo::nitro::omni {
|
|
|
|
using namespace facebook;
|
|
|
|
/**
|
|
* The C++ JNI bridge between the C++ enum "NumberProperty" and the the Kotlin enum "NumberProperty".
|
|
*/
|
|
struct JNumberProperty final: public jni::JavaClass<JNumberProperty> {
|
|
public:
|
|
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/NumberProperty;";
|
|
|
|
public:
|
|
/**
|
|
* Convert this Java/Kotlin-based enum to the C++ enum NumberProperty.
|
|
*/
|
|
[[maybe_unused]]
|
|
[[nodiscard]]
|
|
NumberProperty toCpp() const {
|
|
static const auto clazz = javaClassStatic();
|
|
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
return static_cast<NumberProperty>(ordinal);
|
|
}
|
|
|
|
public:
|
|
/**
|
|
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
*/
|
|
[[maybe_unused]]
|
|
static jni::alias_ref<JNumberProperty> fromCpp(NumberProperty value) {
|
|
static const auto clazz = javaClassStatic();
|
|
switch (value) {
|
|
case NumberProperty::CURRENTTIME:
|
|
static const auto fieldCURRENTTIME = clazz->getStaticField<JNumberProperty>("CURRENTTIME");
|
|
return clazz->getStaticFieldValue(fieldCURRENTTIME);
|
|
case NumberProperty::BUFFERED:
|
|
static const auto fieldBUFFERED = clazz->getStaticField<JNumberProperty>("BUFFERED");
|
|
return clazz->getStaticFieldValue(fieldBUFFERED);
|
|
case NumberProperty::DURATION:
|
|
static const auto fieldDURATION = clazz->getStaticField<JNumberProperty>("DURATION");
|
|
return clazz->getStaticFieldValue(fieldDURATION);
|
|
case NumberProperty::PLAYBACKRATE:
|
|
static const auto fieldPLAYBACKRATE = clazz->getStaticField<JNumberProperty>("PLAYBACKRATE");
|
|
return clazz->getStaticFieldValue(fieldPLAYBACKRATE);
|
|
case NumberProperty::VOLUME:
|
|
static const auto fieldVOLUME = clazz->getStaticField<JNumberProperty>("VOLUME");
|
|
return clazz->getStaticFieldValue(fieldVOLUME);
|
|
case NumberProperty::ISAUTOQUALITY:
|
|
static const auto fieldISAUTOQUALITY = clazz->getStaticField<JNumberProperty>("ISAUTOQUALITY");
|
|
return clazz->getStaticFieldValue(fieldISAUTOQUALITY);
|
|
default:
|
|
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
}
|
|
}
|
|
};
|
|
|
|
} // namespace margelo::nitro::omni
|