mirror of
https://github.com/zoriya/react-native-omni.git
synced 2026-08-16 02:44:51 +00:00
wip: Implement events
This commit is contained in:
+75
@@ -0,0 +1,75 @@
|
||||
///
|
||||
/// JFunc_void.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 <functional>
|
||||
|
||||
#include <functional>
|
||||
#include <NitroModules/JNICallable.hpp>
|
||||
|
||||
namespace margelo::nitro::omni {
|
||||
|
||||
using namespace facebook;
|
||||
|
||||
/**
|
||||
* Represents the Java/Kotlin callback `() -> Unit`.
|
||||
* This can be passed around between C++ and Java/Kotlin.
|
||||
*/
|
||||
struct JFunc_void: public jni::JavaClass<JFunc_void> {
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/Func_void;";
|
||||
|
||||
public:
|
||||
/**
|
||||
* Invokes the function this `JFunc_void` instance holds through JNI.
|
||||
*/
|
||||
void invoke() const {
|
||||
static const auto method = javaClassStatic()->getMethod<void()>("invoke");
|
||||
method(self());
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* An implementation of Func_void that is backed by a C++ implementation (using `std::function<...>`)
|
||||
*/
|
||||
class JFunc_void_cxx final: public jni::HybridClass<JFunc_void_cxx, JFunc_void> {
|
||||
public:
|
||||
static jni::local_ref<JFunc_void::javaobject> fromCpp(const std::function<void()>& func) {
|
||||
return JFunc_void_cxx::newObjectCxxArgs(func);
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Invokes the C++ `std::function<...>` this `JFunc_void_cxx` instance holds.
|
||||
*/
|
||||
void invoke_cxx() {
|
||||
_func();
|
||||
}
|
||||
|
||||
public:
|
||||
[[nodiscard]]
|
||||
inline const std::function<void()>& getFunction() const {
|
||||
return _func;
|
||||
}
|
||||
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/Func_void_cxx;";
|
||||
static void registerNatives() {
|
||||
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_cxx::invoke_cxx)});
|
||||
}
|
||||
|
||||
private:
|
||||
explicit JFunc_void_cxx(const std::function<void()>& func): _func(func) { }
|
||||
|
||||
private:
|
||||
friend HybridBase;
|
||||
std::function<void()> _func;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::omni
|
||||
@@ -0,0 +1,78 @@
|
||||
///
|
||||
/// JFunc_void_Rendition.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 <functional>
|
||||
|
||||
#include "Rendition.hpp"
|
||||
#include <functional>
|
||||
#include <NitroModules/JNICallable.hpp>
|
||||
#include "JRendition.hpp"
|
||||
#include <string>
|
||||
|
||||
namespace margelo::nitro::omni {
|
||||
|
||||
using namespace facebook;
|
||||
|
||||
/**
|
||||
* Represents the Java/Kotlin callback `(rendition: Rendition) -> Unit`.
|
||||
* This can be passed around between C++ and Java/Kotlin.
|
||||
*/
|
||||
struct JFunc_void_Rendition: public jni::JavaClass<JFunc_void_Rendition> {
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/Func_void_Rendition;";
|
||||
|
||||
public:
|
||||
/**
|
||||
* Invokes the function this `JFunc_void_Rendition` instance holds through JNI.
|
||||
*/
|
||||
void invoke(const Rendition& rendition) const {
|
||||
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JRendition> /* rendition */)>("invoke");
|
||||
method(self(), JRendition::fromCpp(rendition));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* An implementation of Func_void_Rendition that is backed by a C++ implementation (using `std::function<...>`)
|
||||
*/
|
||||
class JFunc_void_Rendition_cxx final: public jni::HybridClass<JFunc_void_Rendition_cxx, JFunc_void_Rendition> {
|
||||
public:
|
||||
static jni::local_ref<JFunc_void_Rendition::javaobject> fromCpp(const std::function<void(const Rendition& /* rendition */)>& func) {
|
||||
return JFunc_void_Rendition_cxx::newObjectCxxArgs(func);
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Invokes the C++ `std::function<...>` this `JFunc_void_Rendition_cxx` instance holds.
|
||||
*/
|
||||
void invoke_cxx(jni::alias_ref<JRendition> rendition) {
|
||||
_func(rendition->toCpp());
|
||||
}
|
||||
|
||||
public:
|
||||
[[nodiscard]]
|
||||
inline const std::function<void(const Rendition& /* rendition */)>& getFunction() const {
|
||||
return _func;
|
||||
}
|
||||
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/Func_void_Rendition_cxx;";
|
||||
static void registerNatives() {
|
||||
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_Rendition_cxx::invoke_cxx)});
|
||||
}
|
||||
|
||||
private:
|
||||
explicit JFunc_void_Rendition_cxx(const std::function<void(const Rendition& /* rendition */)>& func): _func(func) { }
|
||||
|
||||
private:
|
||||
friend HybridBase;
|
||||
std::function<void(const Rendition& /* rendition */)> _func;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::omni
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
///
|
||||
/// JFunc_void_Track.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 <functional>
|
||||
|
||||
#include "Track.hpp"
|
||||
#include <functional>
|
||||
#include <NitroModules/JNICallable.hpp>
|
||||
#include "JTrack.hpp"
|
||||
#include <string>
|
||||
#include <optional>
|
||||
|
||||
namespace margelo::nitro::omni {
|
||||
|
||||
using namespace facebook;
|
||||
|
||||
/**
|
||||
* Represents the Java/Kotlin callback `(track: Track) -> Unit`.
|
||||
* This can be passed around between C++ and Java/Kotlin.
|
||||
*/
|
||||
struct JFunc_void_Track: public jni::JavaClass<JFunc_void_Track> {
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/Func_void_Track;";
|
||||
|
||||
public:
|
||||
/**
|
||||
* Invokes the function this `JFunc_void_Track` instance holds through JNI.
|
||||
*/
|
||||
void invoke(const Track& track) const {
|
||||
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JTrack> /* track */)>("invoke");
|
||||
method(self(), JTrack::fromCpp(track));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* An implementation of Func_void_Track that is backed by a C++ implementation (using `std::function<...>`)
|
||||
*/
|
||||
class JFunc_void_Track_cxx final: public jni::HybridClass<JFunc_void_Track_cxx, JFunc_void_Track> {
|
||||
public:
|
||||
static jni::local_ref<JFunc_void_Track::javaobject> fromCpp(const std::function<void(const Track& /* track */)>& func) {
|
||||
return JFunc_void_Track_cxx::newObjectCxxArgs(func);
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Invokes the C++ `std::function<...>` this `JFunc_void_Track_cxx` instance holds.
|
||||
*/
|
||||
void invoke_cxx(jni::alias_ref<JTrack> track) {
|
||||
_func(track->toCpp());
|
||||
}
|
||||
|
||||
public:
|
||||
[[nodiscard]]
|
||||
inline const std::function<void(const Track& /* track */)>& getFunction() const {
|
||||
return _func;
|
||||
}
|
||||
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/Func_void_Track_cxx;";
|
||||
static void registerNatives() {
|
||||
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_Track_cxx::invoke_cxx)});
|
||||
}
|
||||
|
||||
private:
|
||||
explicit JFunc_void_Track_cxx(const std::function<void(const Track& /* track */)>& func): _func(func) { }
|
||||
|
||||
private:
|
||||
friend HybridBase;
|
||||
std::function<void(const Track& /* track */)> _func;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::omni
|
||||
@@ -0,0 +1,79 @@
|
||||
///
|
||||
/// JFunc_void_std__optional_Track_.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 <functional>
|
||||
|
||||
#include "Track.hpp"
|
||||
#include <optional>
|
||||
#include <functional>
|
||||
#include <NitroModules/JNICallable.hpp>
|
||||
#include "JTrack.hpp"
|
||||
#include <string>
|
||||
|
||||
namespace margelo::nitro::omni {
|
||||
|
||||
using namespace facebook;
|
||||
|
||||
/**
|
||||
* Represents the Java/Kotlin callback `(track: Track?) -> Unit`.
|
||||
* This can be passed around between C++ and Java/Kotlin.
|
||||
*/
|
||||
struct JFunc_void_std__optional_Track_: public jni::JavaClass<JFunc_void_std__optional_Track_> {
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/Func_void_std__optional_Track_;";
|
||||
|
||||
public:
|
||||
/**
|
||||
* Invokes the function this `JFunc_void_std__optional_Track_` instance holds through JNI.
|
||||
*/
|
||||
void invoke(const std::optional<Track>& track) const {
|
||||
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JTrack> /* track */)>("invoke");
|
||||
method(self(), track.has_value() ? JTrack::fromCpp(track.value()) : nullptr);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* An implementation of Func_void_std__optional_Track_ that is backed by a C++ implementation (using `std::function<...>`)
|
||||
*/
|
||||
class JFunc_void_std__optional_Track__cxx final: public jni::HybridClass<JFunc_void_std__optional_Track__cxx, JFunc_void_std__optional_Track_> {
|
||||
public:
|
||||
static jni::local_ref<JFunc_void_std__optional_Track_::javaobject> fromCpp(const std::function<void(const std::optional<Track>& /* track */)>& func) {
|
||||
return JFunc_void_std__optional_Track__cxx::newObjectCxxArgs(func);
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Invokes the C++ `std::function<...>` this `JFunc_void_std__optional_Track__cxx` instance holds.
|
||||
*/
|
||||
void invoke_cxx(jni::alias_ref<JTrack> track) {
|
||||
_func(track != nullptr ? std::make_optional(track->toCpp()) : std::nullopt);
|
||||
}
|
||||
|
||||
public:
|
||||
[[nodiscard]]
|
||||
inline const std::function<void(const std::optional<Track>& /* track */)>& getFunction() const {
|
||||
return _func;
|
||||
}
|
||||
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/Func_void_std__optional_Track__cxx;";
|
||||
static void registerNatives() {
|
||||
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__optional_Track__cxx::invoke_cxx)});
|
||||
}
|
||||
|
||||
private:
|
||||
explicit JFunc_void_std__optional_Track__cxx(const std::function<void(const std::optional<Track>& /* track */)>& func): _func(func) { }
|
||||
|
||||
private:
|
||||
friend HybridBase;
|
||||
std::function<void(const std::optional<Track>& /* track */)> _func;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::omni
|
||||
@@ -0,0 +1,76 @@
|
||||
///
|
||||
/// JFunc_void_std__string.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 <functional>
|
||||
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <NitroModules/JNICallable.hpp>
|
||||
|
||||
namespace margelo::nitro::omni {
|
||||
|
||||
using namespace facebook;
|
||||
|
||||
/**
|
||||
* Represents the Java/Kotlin callback `(status: String) -> Unit`.
|
||||
* This can be passed around between C++ and Java/Kotlin.
|
||||
*/
|
||||
struct JFunc_void_std__string: public jni::JavaClass<JFunc_void_std__string> {
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/Func_void_std__string;";
|
||||
|
||||
public:
|
||||
/**
|
||||
* Invokes the function this `JFunc_void_std__string` instance holds through JNI.
|
||||
*/
|
||||
void invoke(const std::string& status) const {
|
||||
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* status */)>("invoke");
|
||||
method(self(), jni::make_jstring(status));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* An implementation of Func_void_std__string that is backed by a C++ implementation (using `std::function<...>`)
|
||||
*/
|
||||
class JFunc_void_std__string_cxx final: public jni::HybridClass<JFunc_void_std__string_cxx, JFunc_void_std__string> {
|
||||
public:
|
||||
static jni::local_ref<JFunc_void_std__string::javaobject> fromCpp(const std::function<void(const std::string& /* status */)>& func) {
|
||||
return JFunc_void_std__string_cxx::newObjectCxxArgs(func);
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Invokes the C++ `std::function<...>` this `JFunc_void_std__string_cxx` instance holds.
|
||||
*/
|
||||
void invoke_cxx(jni::alias_ref<jni::JString> status) {
|
||||
_func(status->toStdString());
|
||||
}
|
||||
|
||||
public:
|
||||
[[nodiscard]]
|
||||
inline const std::function<void(const std::string& /* status */)>& getFunction() const {
|
||||
return _func;
|
||||
}
|
||||
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/Func_void_std__string_cxx;";
|
||||
static void registerNatives() {
|
||||
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__string_cxx::invoke_cxx)});
|
||||
}
|
||||
|
||||
private:
|
||||
explicit JFunc_void_std__string_cxx(const std::function<void(const std::string& /* status */)>& func): _func(func) { }
|
||||
|
||||
private:
|
||||
friend HybridBase;
|
||||
std::function<void(const std::string& /* status */)> _func;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::omni
|
||||
@@ -0,0 +1,76 @@
|
||||
///
|
||||
/// JFunc_void_std__string_std__string.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 <functional>
|
||||
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <NitroModules/JNICallable.hpp>
|
||||
|
||||
namespace margelo::nitro::omni {
|
||||
|
||||
using namespace facebook;
|
||||
|
||||
/**
|
||||
* Represents the Java/Kotlin callback `(type: String, message: String) -> Unit`.
|
||||
* This can be passed around between C++ and Java/Kotlin.
|
||||
*/
|
||||
struct JFunc_void_std__string_std__string: public jni::JavaClass<JFunc_void_std__string_std__string> {
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/Func_void_std__string_std__string;";
|
||||
|
||||
public:
|
||||
/**
|
||||
* Invokes the function this `JFunc_void_std__string_std__string` instance holds through JNI.
|
||||
*/
|
||||
void invoke(const std::string& type, const std::string& message) const {
|
||||
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* type */, jni::alias_ref<jni::JString> /* message */)>("invoke");
|
||||
method(self(), jni::make_jstring(type), jni::make_jstring(message));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* An implementation of Func_void_std__string_std__string that is backed by a C++ implementation (using `std::function<...>`)
|
||||
*/
|
||||
class JFunc_void_std__string_std__string_cxx final: public jni::HybridClass<JFunc_void_std__string_std__string_cxx, JFunc_void_std__string_std__string> {
|
||||
public:
|
||||
static jni::local_ref<JFunc_void_std__string_std__string::javaobject> fromCpp(const std::function<void(const std::string& /* type */, const std::string& /* message */)>& func) {
|
||||
return JFunc_void_std__string_std__string_cxx::newObjectCxxArgs(func);
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Invokes the C++ `std::function<...>` this `JFunc_void_std__string_std__string_cxx` instance holds.
|
||||
*/
|
||||
void invoke_cxx(jni::alias_ref<jni::JString> type, jni::alias_ref<jni::JString> message) {
|
||||
_func(type->toStdString(), message->toStdString());
|
||||
}
|
||||
|
||||
public:
|
||||
[[nodiscard]]
|
||||
inline const std::function<void(const std::string& /* type */, const std::string& /* message */)>& getFunction() const {
|
||||
return _func;
|
||||
}
|
||||
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/Func_void_std__string_std__string_cxx;";
|
||||
static void registerNatives() {
|
||||
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__string_std__string_cxx::invoke_cxx)});
|
||||
}
|
||||
|
||||
private:
|
||||
explicit JFunc_void_std__string_std__string_cxx(const std::function<void(const std::string& /* type */, const std::string& /* message */)>& func): _func(func) { }
|
||||
|
||||
private:
|
||||
friend HybridBase;
|
||||
std::function<void(const std::string& /* type */, const std::string& /* message */)> _func;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::omni
|
||||
@@ -0,0 +1,136 @@
|
||||
///
|
||||
/// JHybridOmniEventMapSpec.cpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#include "JHybridOmniEventMapSpec.hpp"
|
||||
|
||||
// Forward declaration of `Track` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { struct Track; }
|
||||
// Forward declaration of `Rendition` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { struct Rendition; }
|
||||
|
||||
#include <functional>
|
||||
#include "JFunc_void.hpp"
|
||||
#include <NitroModules/JNICallable.hpp>
|
||||
#include <string>
|
||||
#include "JFunc_void_std__string_std__string.hpp"
|
||||
#include "JFunc_void_std__string.hpp"
|
||||
#include "Track.hpp"
|
||||
#include "JFunc_void_Track.hpp"
|
||||
#include "JTrack.hpp"
|
||||
#include <optional>
|
||||
#include "JFunc_void_std__optional_Track_.hpp"
|
||||
#include "Rendition.hpp"
|
||||
#include "JFunc_void_Rendition.hpp"
|
||||
#include "JRendition.hpp"
|
||||
|
||||
namespace margelo::nitro::omni {
|
||||
|
||||
std::shared_ptr<JHybridOmniEventMapSpec> JHybridOmniEventMapSpec::JavaPart::getJHybridOmniEventMapSpec() {
|
||||
auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
|
||||
auto castHybridObject = std::dynamic_pointer_cast<JHybridOmniEventMapSpec>(hybridObject);
|
||||
if (castHybridObject == nullptr) [[unlikely]] {
|
||||
throw std::runtime_error("Failed to downcast JHybridObject to JHybridOmniEventMapSpec!");
|
||||
}
|
||||
return castHybridObject;
|
||||
}
|
||||
|
||||
jni::local_ref<JHybridOmniEventMapSpec::CxxPart::jhybriddata> JHybridOmniEventMapSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
||||
return makeCxxInstance(jThis);
|
||||
}
|
||||
|
||||
std::shared_ptr<JHybridObject> JHybridOmniEventMapSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
|
||||
auto castJavaPart = jni::dynamic_ref_cast<JHybridOmniEventMapSpec::JavaPart>(javaPart);
|
||||
if (castJavaPart == nullptr) [[unlikely]] {
|
||||
throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridOmniEventMapSpec::JavaPart!");
|
||||
}
|
||||
return std::make_shared<JHybridOmniEventMapSpec>(castJavaPart);
|
||||
}
|
||||
|
||||
void JHybridOmniEventMapSpec::CxxPart::registerNatives() {
|
||||
registerHybrid({
|
||||
makeNativeMethod("initHybrid", JHybridOmniEventMapSpec::CxxPart::initHybrid),
|
||||
});
|
||||
}
|
||||
|
||||
// Properties
|
||||
|
||||
|
||||
// Methods
|
||||
void JHybridOmniEventMapSpec::addOnEndListener(const std::function<void()>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void::javaobject> /* cb */)>("addOnEndListener_cxx");
|
||||
method(_javaPart, JFunc_void_cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::removeOnEndListener(const std::function<void()>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void::javaobject> /* cb */)>("removeOnEndListener_cxx");
|
||||
method(_javaPart, JFunc_void_cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::addOnPrevListener(const std::function<void()>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void::javaobject> /* cb */)>("addOnPrevListener_cxx");
|
||||
method(_javaPart, JFunc_void_cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::removeOnPrevListener(const std::function<void()>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void::javaobject> /* cb */)>("removeOnPrevListener_cxx");
|
||||
method(_javaPart, JFunc_void_cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::addOnNextListener(const std::function<void()>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void::javaobject> /* cb */)>("addOnNextListener_cxx");
|
||||
method(_javaPart, JFunc_void_cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::removeOnNextListener(const std::function<void()>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void::javaobject> /* cb */)>("removeOnNextListener_cxx");
|
||||
method(_javaPart, JFunc_void_cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::addOnErrorListener(const std::function<void(const std::string& /* type */, const std::string& /* message */)>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__string_std__string::javaobject> /* cb */)>("addOnErrorListener_cxx");
|
||||
method(_javaPart, JFunc_void_std__string_std__string_cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::removeOnErrorListener(const std::function<void(const std::string& /* type */, const std::string& /* message */)>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__string_std__string::javaobject> /* cb */)>("removeOnErrorListener_cxx");
|
||||
method(_javaPart, JFunc_void_std__string_std__string_cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::addOnAudioFocusChangeListener(const std::function<void(const std::string& /* status */)>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__string::javaobject> /* cb */)>("addOnAudioFocusChangeListener_cxx");
|
||||
method(_javaPart, JFunc_void_std__string_cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::removeOnAudioFocusChangeListener(const std::function<void(const std::string& /* status */)>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__string::javaobject> /* cb */)>("removeOnAudioFocusChangeListener_cxx");
|
||||
method(_javaPart, JFunc_void_std__string_cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::addOnVideoTrackChangeListener(const std::function<void(const Track& /* track */)>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_Track::javaobject> /* cb */)>("addOnVideoTrackChangeListener_cxx");
|
||||
method(_javaPart, JFunc_void_Track_cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::removeOnVideoTrackChangeListener(const std::function<void(const Track& /* track */)>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_Track::javaobject> /* cb */)>("removeOnVideoTrackChangeListener_cxx");
|
||||
method(_javaPart, JFunc_void_Track_cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::addOnAudioTrackChangeListener(const std::function<void(const Track& /* track */)>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_Track::javaobject> /* cb */)>("addOnAudioTrackChangeListener_cxx");
|
||||
method(_javaPart, JFunc_void_Track_cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::removeOnAudioTrackChangeListener(const std::function<void(const Track& /* track */)>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_Track::javaobject> /* cb */)>("removeOnAudioTrackChangeListener_cxx");
|
||||
method(_javaPart, JFunc_void_Track_cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::addOnSubtitleChangeListener(const std::function<void(const std::optional<Track>& /* track */)>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__optional_Track_::javaobject> /* cb */)>("addOnSubtitleChangeListener_cxx");
|
||||
method(_javaPart, JFunc_void_std__optional_Track__cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::removeOnSubtitleChangeListener(const std::function<void(const std::optional<Track>& /* track */)>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__optional_Track_::javaobject> /* cb */)>("removeOnSubtitleChangeListener_cxx");
|
||||
method(_javaPart, JFunc_void_std__optional_Track__cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::addOnRenditionChangeListener(const std::function<void(const Rendition& /* rendition */)>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_Rendition::javaobject> /* cb */)>("addOnRenditionChangeListener_cxx");
|
||||
method(_javaPart, JFunc_void_Rendition_cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::removeOnRenditionChangeListener(const std::function<void(const Rendition& /* rendition */)>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_Rendition::javaobject> /* cb */)>("removeOnRenditionChangeListener_cxx");
|
||||
method(_javaPart, JFunc_void_Rendition_cxx::fromCpp(cb));
|
||||
}
|
||||
|
||||
} // namespace margelo::nitro::omni
|
||||
@@ -0,0 +1,80 @@
|
||||
///
|
||||
/// HybridOmniEventMapSpec.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <NitroModules/JHybridObject.hpp>
|
||||
#include <fbjni/fbjni.h>
|
||||
#include "HybridOmniEventMapSpec.hpp"
|
||||
|
||||
|
||||
|
||||
|
||||
namespace margelo::nitro::omni {
|
||||
|
||||
using namespace facebook;
|
||||
|
||||
class JHybridOmniEventMapSpec: public virtual HybridOmniEventMapSpec, public virtual JHybridObject {
|
||||
public:
|
||||
struct JavaPart: public jni::JavaClass<JavaPart, JHybridObject::JavaPart> {
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/HybridOmniEventMapSpec;";
|
||||
std::shared_ptr<JHybridOmniEventMapSpec> getJHybridOmniEventMapSpec();
|
||||
};
|
||||
struct CxxPart: public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/HybridOmniEventMapSpec$CxxPart;";
|
||||
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
||||
static void registerNatives();
|
||||
using HybridBase::HybridBase;
|
||||
protected:
|
||||
std::shared_ptr<JHybridObject> createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) override;
|
||||
};
|
||||
|
||||
public:
|
||||
explicit JHybridOmniEventMapSpec(const jni::local_ref<JHybridOmniEventMapSpec::JavaPart>& javaPart):
|
||||
HybridObject(HybridOmniEventMapSpec::TAG),
|
||||
JHybridObject(javaPart),
|
||||
_javaPart(jni::make_global(javaPart)) {}
|
||||
~JHybridOmniEventMapSpec() override {
|
||||
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
||||
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
||||
}
|
||||
|
||||
public:
|
||||
inline const jni::global_ref<JHybridOmniEventMapSpec::JavaPart>& getJavaPart() const noexcept {
|
||||
return _javaPart;
|
||||
}
|
||||
|
||||
public:
|
||||
// Properties
|
||||
|
||||
|
||||
public:
|
||||
// Methods
|
||||
void addOnEndListener(const std::function<void()>& cb) override;
|
||||
void removeOnEndListener(const std::function<void()>& cb) override;
|
||||
void addOnPrevListener(const std::function<void()>& cb) override;
|
||||
void removeOnPrevListener(const std::function<void()>& cb) override;
|
||||
void addOnNextListener(const std::function<void()>& cb) override;
|
||||
void removeOnNextListener(const std::function<void()>& cb) override;
|
||||
void addOnErrorListener(const std::function<void(const std::string& /* type */, const std::string& /* message */)>& cb) override;
|
||||
void removeOnErrorListener(const std::function<void(const std::string& /* type */, const std::string& /* message */)>& cb) override;
|
||||
void addOnAudioFocusChangeListener(const std::function<void(const std::string& /* status */)>& cb) override;
|
||||
void removeOnAudioFocusChangeListener(const std::function<void(const std::string& /* status */)>& cb) override;
|
||||
void addOnVideoTrackChangeListener(const std::function<void(const Track& /* track */)>& cb) override;
|
||||
void removeOnVideoTrackChangeListener(const std::function<void(const Track& /* track */)>& cb) override;
|
||||
void addOnAudioTrackChangeListener(const std::function<void(const Track& /* track */)>& cb) override;
|
||||
void removeOnAudioTrackChangeListener(const std::function<void(const Track& /* track */)>& cb) override;
|
||||
void addOnSubtitleChangeListener(const std::function<void(const std::optional<Track>& /* track */)>& cb) override;
|
||||
void removeOnSubtitleChangeListener(const std::function<void(const std::optional<Track>& /* track */)>& cb) override;
|
||||
void addOnRenditionChangeListener(const std::function<void(const Rendition& /* rendition */)>& cb) override;
|
||||
void removeOnRenditionChangeListener(const std::function<void(const Rendition& /* rendition */)>& cb) override;
|
||||
|
||||
private:
|
||||
jni::global_ref<JHybridOmniEventMapSpec::JavaPart> _javaPart;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::omni
|
||||
+61
-51
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "JHybridOmniPlayerSpec.hpp"
|
||||
|
||||
// Forward declaration of `HybridOmniEventMapSpec` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { class HybridOmniEventMapSpec; }
|
||||
// Forward declaration of `Source` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { struct Source; }
|
||||
// Forward declaration of `VideoSrc` to properly resolve imports.
|
||||
@@ -17,13 +19,16 @@ namespace margelo::nitro::omni { struct Subtitle; }
|
||||
namespace margelo::nitro::omni { struct Metadata; }
|
||||
// Forward declaration of `MixAudioMode` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { enum class MixAudioMode; }
|
||||
// Forward declaration of `PlayerStatus` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { enum class PlayerStatus; }
|
||||
// Forward declaration of `Track` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { struct Track; }
|
||||
// Forward declaration of `Rendition` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { struct Rendition; }
|
||||
// Forward declaration of `PlayerStatus` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { enum class PlayerStatus; }
|
||||
|
||||
#include <memory>
|
||||
#include "HybridOmniEventMapSpec.hpp"
|
||||
#include "JHybridOmniEventMapSpec.hpp"
|
||||
#include "Source.hpp"
|
||||
#include "JSource.hpp"
|
||||
#include "VideoSrc.hpp"
|
||||
@@ -38,12 +43,12 @@ namespace margelo::nitro::omni { struct Rendition; }
|
||||
#include "JMetadata.hpp"
|
||||
#include "MixAudioMode.hpp"
|
||||
#include "JMixAudioMode.hpp"
|
||||
#include "PlayerStatus.hpp"
|
||||
#include "JPlayerStatus.hpp"
|
||||
#include "Track.hpp"
|
||||
#include "JTrack.hpp"
|
||||
#include "Rendition.hpp"
|
||||
#include "JRendition.hpp"
|
||||
#include "PlayerStatus.hpp"
|
||||
#include "JPlayerStatus.hpp"
|
||||
|
||||
namespace margelo::nitro::omni {
|
||||
|
||||
@@ -75,6 +80,11 @@ namespace margelo::nitro::omni {
|
||||
}
|
||||
|
||||
// Properties
|
||||
std::shared_ptr<HybridOmniEventMapSpec> JHybridOmniPlayerSpec::getEventMap() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JHybridOmniEventMapSpec::JavaPart>()>("getEventMap");
|
||||
auto __result = method(_javaPart);
|
||||
return __result->getJHybridOmniEventMapSpec();
|
||||
}
|
||||
Source JHybridOmniPlayerSpec::getSource() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JSource>()>("getSource");
|
||||
auto __result = method(_javaPart);
|
||||
@@ -94,53 +104,6 @@ namespace margelo::nitro::omni {
|
||||
auto __result = method(_javaPart);
|
||||
return static_cast<bool>(__result);
|
||||
}
|
||||
PlayerStatus JHybridOmniPlayerSpec::getStatus() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPlayerStatus>()>("getStatus");
|
||||
auto __result = method(_javaPart);
|
||||
return __result->toCpp();
|
||||
}
|
||||
bool JHybridOmniPlayerSpec::getIsPlaying() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("isPlaying");
|
||||
auto __result = method(_javaPart);
|
||||
return static_cast<bool>(__result);
|
||||
}
|
||||
double JHybridOmniPlayerSpec::getCurrentTime() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getCurrentTime");
|
||||
auto __result = method(_javaPart);
|
||||
return __result;
|
||||
}
|
||||
void JHybridOmniPlayerSpec::setCurrentTime(double currentTime) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* currentTime */)>("setCurrentTime");
|
||||
method(_javaPart, currentTime);
|
||||
}
|
||||
double JHybridOmniPlayerSpec::getBuffered() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getBuffered");
|
||||
auto __result = method(_javaPart);
|
||||
return __result;
|
||||
}
|
||||
double JHybridOmniPlayerSpec::getDuration() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getDuration");
|
||||
auto __result = method(_javaPart);
|
||||
return __result;
|
||||
}
|
||||
double JHybridOmniPlayerSpec::getPlaybackRate() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getPlaybackRate");
|
||||
auto __result = method(_javaPart);
|
||||
return __result;
|
||||
}
|
||||
void JHybridOmniPlayerSpec::setPlaybackRate(double playbackRate) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* playbackRate */)>("setPlaybackRate");
|
||||
method(_javaPart, playbackRate);
|
||||
}
|
||||
double JHybridOmniPlayerSpec::getVolume() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getVolume");
|
||||
auto __result = method(_javaPart);
|
||||
return __result;
|
||||
}
|
||||
void JHybridOmniPlayerSpec::setVolume(double volume) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* volume */)>("setVolume");
|
||||
method(_javaPart, volume);
|
||||
}
|
||||
std::vector<Track> JHybridOmniPlayerSpec::getVideos() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JArrayClass<JTrack>>()>("getVideos");
|
||||
auto __result = method(_javaPart);
|
||||
@@ -197,6 +160,53 @@ namespace margelo::nitro::omni {
|
||||
return __vector;
|
||||
}();
|
||||
}
|
||||
PlayerStatus JHybridOmniPlayerSpec::getStatus() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPlayerStatus>()>("getStatus");
|
||||
auto __result = method(_javaPart);
|
||||
return __result->toCpp();
|
||||
}
|
||||
bool JHybridOmniPlayerSpec::getIsPlaying() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("isPlaying");
|
||||
auto __result = method(_javaPart);
|
||||
return static_cast<bool>(__result);
|
||||
}
|
||||
double JHybridOmniPlayerSpec::getCurrentTime() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getCurrentTime");
|
||||
auto __result = method(_javaPart);
|
||||
return __result;
|
||||
}
|
||||
void JHybridOmniPlayerSpec::setCurrentTime(double currentTime) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* currentTime */)>("setCurrentTime");
|
||||
method(_javaPart, currentTime);
|
||||
}
|
||||
double JHybridOmniPlayerSpec::getBuffered() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getBuffered");
|
||||
auto __result = method(_javaPart);
|
||||
return __result;
|
||||
}
|
||||
double JHybridOmniPlayerSpec::getDuration() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getDuration");
|
||||
auto __result = method(_javaPart);
|
||||
return __result;
|
||||
}
|
||||
double JHybridOmniPlayerSpec::getPlaybackRate() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getPlaybackRate");
|
||||
auto __result = method(_javaPart);
|
||||
return __result;
|
||||
}
|
||||
void JHybridOmniPlayerSpec::setPlaybackRate(double playbackRate) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* playbackRate */)>("setPlaybackRate");
|
||||
method(_javaPart, playbackRate);
|
||||
}
|
||||
double JHybridOmniPlayerSpec::getVolume() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getVolume");
|
||||
auto __result = method(_javaPart);
|
||||
return __result;
|
||||
}
|
||||
void JHybridOmniPlayerSpec::setVolume(double volume) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* volume */)>("setVolume");
|
||||
method(_javaPart, volume);
|
||||
}
|
||||
|
||||
// Methods
|
||||
void JHybridOmniPlayerSpec::play() {
|
||||
|
||||
+5
-4
@@ -50,10 +50,15 @@ namespace margelo::nitro::omni {
|
||||
|
||||
public:
|
||||
// Properties
|
||||
std::shared_ptr<HybridOmniEventMapSpec> getEventMap() override;
|
||||
Source getSource() override;
|
||||
void setSource(const Source& source) override;
|
||||
bool getHasPrev() override;
|
||||
bool getHasNext() override;
|
||||
std::vector<Track> getVideos() override;
|
||||
std::vector<Track> getAudios() override;
|
||||
std::vector<Track> getSubtitles() override;
|
||||
std::vector<Rendition> getRendition() override;
|
||||
PlayerStatus getStatus() override;
|
||||
bool getIsPlaying() override;
|
||||
double getCurrentTime() override;
|
||||
@@ -64,10 +69,6 @@ namespace margelo::nitro::omni {
|
||||
void setPlaybackRate(double playbackRate) override;
|
||||
double getVolume() override;
|
||||
void setVolume(double volume) override;
|
||||
std::vector<Track> getVideos() override;
|
||||
std::vector<Track> getAudios() override;
|
||||
std::vector<Track> getSubtitles() override;
|
||||
std::vector<Rendition> getRendition() override;
|
||||
|
||||
public:
|
||||
// Methods
|
||||
|
||||
+3
-3
@@ -42,6 +42,9 @@ namespace margelo::nitro::omni {
|
||||
static jni::alias_ref<JPlayerStatus> fromCpp(PlayerStatus value) {
|
||||
static const auto clazz = javaClassStatic();
|
||||
switch (value) {
|
||||
case PlayerStatus::ERROR:
|
||||
static const auto fieldERROR = clazz->getStaticField<JPlayerStatus>("ERROR");
|
||||
return clazz->getStaticFieldValue(fieldERROR);
|
||||
case PlayerStatus::IDLE:
|
||||
static const auto fieldIDLE = clazz->getStaticField<JPlayerStatus>("IDLE");
|
||||
return clazz->getStaticFieldValue(fieldIDLE);
|
||||
@@ -51,9 +54,6 @@ namespace margelo::nitro::omni {
|
||||
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 + "!");
|
||||
|
||||
Reference in New Issue
Block a user