Files
react-native-omni/nitrogen/generated/android/c++/JPlayerStatus.hpp
T
2026-04-19 21:05:55 +02:00

65 lines
2.2 KiB
C++
Generated

///
/// JPlayerStatus.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 "PlayerStatus.hpp"
namespace margelo::nitro::omni {
using namespace facebook;
/**
* The C++ JNI bridge between the C++ enum "PlayerStatus" and the the Kotlin enum "PlayerStatus".
*/
struct JPlayerStatus final: public jni::JavaClass<JPlayerStatus> {
public:
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/PlayerStatus;";
public:
/**
* Convert this Java/Kotlin-based enum to the C++ enum PlayerStatus.
*/
[[maybe_unused]]
[[nodiscard]]
PlayerStatus toCpp() const {
static const auto clazz = javaClassStatic();
static const auto fieldOrdinal = clazz->getField<int>("value");
int ordinal = this->getFieldValue(fieldOrdinal);
return static_cast<PlayerStatus>(ordinal);
}
public:
/**
* Create a Java/Kotlin-based enum with the given C++ enum's value.
*/
[[maybe_unused]]
static jni::alias_ref<JPlayerStatus> fromCpp(PlayerStatus value) {
static const auto clazz = javaClassStatic();
switch (value) {
case PlayerStatus::IDLE:
static const auto fieldIDLE = clazz->getStaticField<JPlayerStatus>("IDLE");
return clazz->getStaticFieldValue(fieldIDLE);
case PlayerStatus::LOADING:
static const auto fieldLOADING = clazz->getStaticField<JPlayerStatus>("LOADING");
return clazz->getStaticFieldValue(fieldLOADING);
case PlayerStatus::READYTOPLAY:
static const auto fieldREADYTOPLAY = clazz->getStaticField<JPlayerStatus>("READYTOPLAY");
return clazz->getStaticFieldValue(fieldREADYTOPLAY);
case PlayerStatus::ERROR:
static const auto fieldERROR = clazz->getStaticField<JPlayerStatus>("ERROR");
return clazz->getStaticFieldValue(fieldERROR);
default:
std::string stringValue = std::to_string(static_cast<int>(value));
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
}
}
};
} // namespace margelo::nitro::omni