mirror of
https://github.com/zoriya/react-native-omni.git
synced 2026-08-05 21:58:54 +00:00
62 lines
2.0 KiB
C++
Generated
62 lines
2.0 KiB
C++
Generated
///
|
|
/// JBoolProperty.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 "BoolProperty.hpp"
|
|
|
|
namespace margelo::nitro::omni {
|
|
|
|
using namespace facebook;
|
|
|
|
/**
|
|
* The C++ JNI bridge between the C++ enum "BoolProperty" and the the Kotlin enum "BoolProperty".
|
|
*/
|
|
struct JBoolProperty final: public jni::JavaClass<JBoolProperty> {
|
|
public:
|
|
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/BoolProperty;";
|
|
|
|
public:
|
|
/**
|
|
* Convert this Java/Kotlin-based enum to the C++ enum BoolProperty.
|
|
*/
|
|
[[maybe_unused]]
|
|
[[nodiscard]]
|
|
BoolProperty toCpp() const {
|
|
static const auto clazz = javaClassStatic();
|
|
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
return static_cast<BoolProperty>(ordinal);
|
|
}
|
|
|
|
public:
|
|
/**
|
|
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
*/
|
|
[[maybe_unused]]
|
|
static jni::alias_ref<JBoolProperty> fromCpp(BoolProperty value) {
|
|
static const auto clazz = javaClassStatic();
|
|
switch (value) {
|
|
case BoolProperty::ISPLAYING:
|
|
static const auto fieldISPLAYING = clazz->getStaticField<JBoolProperty>("ISPLAYING");
|
|
return clazz->getStaticFieldValue(fieldISPLAYING);
|
|
case BoolProperty::MUTED:
|
|
static const auto fieldMUTED = clazz->getStaticField<JBoolProperty>("MUTED");
|
|
return clazz->getStaticFieldValue(fieldMUTED);
|
|
case BoolProperty::ISAUTOQUALITY:
|
|
static const auto fieldISAUTOQUALITY = clazz->getStaticField<JBoolProperty>("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
|