-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathJHybridViewModelBooleanPropertySpec.cpp
More file actions
75 lines (62 loc) · 2.82 KB
/
JHybridViewModelBooleanPropertySpec.cpp
File metadata and controls
75 lines (62 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
///
/// JHybridViewModelBooleanPropertySpec.cpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © 2025 Marc Rousavy @ Margelo
///
#include "JHybridViewModelBooleanPropertySpec.hpp"
#include <functional>
#include "JFunc_void.hpp"
#include <NitroModules/JNICallable.hpp>
#include "JFunc_void_bool.hpp"
namespace margelo::nitro::rive {
jni::local_ref<JHybridViewModelBooleanPropertySpec::jhybriddata> JHybridViewModelBooleanPropertySpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
return makeCxxInstance(jThis);
}
void JHybridViewModelBooleanPropertySpec::registerNatives() {
registerHybrid({
makeNativeMethod("initHybrid", JHybridViewModelBooleanPropertySpec::initHybrid),
});
}
size_t JHybridViewModelBooleanPropertySpec::getExternalMemorySize() noexcept {
static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
return method(_javaPart);
}
void JHybridViewModelBooleanPropertySpec::dispose() noexcept {
static const auto method = javaClassStatic()->getMethod<void()>("dispose");
method(_javaPart);
}
std::string JHybridViewModelBooleanPropertySpec::toString() {
static const auto method = javaClassStatic()->getMethod<jni::JString()>("toString");
auto javaString = method(_javaPart);
return javaString->toStdString();
}
// Properties
bool JHybridViewModelBooleanPropertySpec::getValue() {
static const auto method = javaClassStatic()->getMethod<jboolean()>("getValue");
auto __result = method(_javaPart);
return static_cast<bool>(__result);
}
void JHybridViewModelBooleanPropertySpec::setValue(bool value) {
static const auto method = javaClassStatic()->getMethod<void(jboolean /* value */)>("setValue");
method(_javaPart, value);
}
// Methods
std::function<void()> JHybridViewModelBooleanPropertySpec::addListener(const std::function<void(bool /* value */)>& onChanged) {
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void::javaobject>(jni::alias_ref<JFunc_void_bool::javaobject> /* onChanged */)>("addListener_cxx");
auto __result = method(_javaPart, JFunc_void_bool_cxx::fromCpp(onChanged));
return [&]() -> std::function<void()> {
if (__result->isInstanceOf(JFunc_void_cxx::javaClassStatic())) [[likely]] {
auto downcast = jni::static_ref_cast<JFunc_void_cxx::javaobject>(__result);
return downcast->cthis()->getFunction();
} else {
auto __resultRef = jni::make_global(__result);
return JNICallable<JFunc_void, void()>(std::move(__resultRef));
}
}();
}
void JHybridViewModelBooleanPropertySpec::removeListeners() {
static const auto method = javaClassStatic()->getMethod<void()>("removeListeners");
method(_javaPart);
}
} // namespace margelo::nitro::rive