@thatkid02/react-native-pdf-viewer 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/PdfViewer.podspec +28 -0
- package/README.md +290 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +121 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/pdfviewer/HybridPdfViewer.kt +169 -0
- package/android/src/main/java/com/margelo/nitro/pdfviewer/PdfViewer.kt +996 -0
- package/android/src/main/java/com/margelo/nitro/pdfviewer/PdfViewerPackage.kt +26 -0
- package/ios/PdfViewer.swift +696 -0
- package/lib/module/PdfViewer.nitro.js +4 -0
- package/lib/module/PdfViewer.nitro.js.map +1 -0
- package/lib/module/index.js +13 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/PdfViewer.nitro.d.ts +67 -0
- package/lib/typescript/src/PdfViewer.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +8 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +17 -0
- package/nitrogen/generated/android/c++/JErrorEvent.hpp +57 -0
- package/nitrogen/generated/android/c++/JFunc_void_ErrorEvent.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_LoadCompleteEvent.hpp +76 -0
- package/nitrogen/generated/android/c++/JFunc_void_LoadingChangeEvent.hpp +76 -0
- package/nitrogen/generated/android/c++/JFunc_void_PageChangeEvent.hpp +76 -0
- package/nitrogen/generated/android/c++/JFunc_void_ScaleChangeEvent.hpp +76 -0
- package/nitrogen/generated/android/c++/JFunc_void_ThumbnailGeneratedEvent.hpp +77 -0
- package/nitrogen/generated/android/c++/JHybridPdfViewerSpec.cpp +273 -0
- package/nitrogen/generated/android/c++/JHybridPdfViewerSpec.hpp +94 -0
- package/nitrogen/generated/android/c++/JLoadCompleteEvent.hpp +61 -0
- package/nitrogen/generated/android/c++/JLoadingChangeEvent.hpp +53 -0
- package/nitrogen/generated/android/c++/JPageChangeEvent.hpp +57 -0
- package/nitrogen/generated/android/c++/JScaleChangeEvent.hpp +53 -0
- package/nitrogen/generated/android/c++/JThumbnailGeneratedEvent.hpp +57 -0
- package/nitrogen/generated/android/c++/views/JHybridPdfViewerStateUpdater.cpp +108 -0
- package/nitrogen/generated/android/c++/views/JHybridPdfViewerStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/ErrorEvent.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/Func_void_ErrorEvent.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/Func_void_LoadCompleteEvent.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/Func_void_LoadingChangeEvent.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/Func_void_PageChangeEvent.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/Func_void_ScaleChangeEvent.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/Func_void_ThumbnailGeneratedEvent.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/HybridPdfViewerSpec.kt +195 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/LoadCompleteEvent.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/LoadingChangeEvent.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/PageChangeEvent.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/ScaleChangeEvent.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/ThumbnailGeneratedEvent.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/pdfviewerOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/views/HybridPdfViewerManager.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/pdfviewer/views/HybridPdfViewerStateUpdater.kt +23 -0
- package/nitrogen/generated/android/pdfviewer+autolinking.cmake +83 -0
- package/nitrogen/generated/android/pdfviewer+autolinking.gradle +27 -0
- package/nitrogen/generated/android/pdfviewerOnLoad.cpp +58 -0
- package/nitrogen/generated/android/pdfviewerOnLoad.hpp +25 -0
- package/nitrogen/generated/ios/PdfViewer+autolinking.rb +60 -0
- package/nitrogen/generated/ios/PdfViewer-Swift-Cxx-Bridge.cpp +80 -0
- package/nitrogen/generated/ios/PdfViewer-Swift-Cxx-Bridge.hpp +339 -0
- package/nitrogen/generated/ios/PdfViewer-Swift-Cxx-Umbrella.hpp +64 -0
- package/nitrogen/generated/ios/PdfViewerAutolinking.mm +33 -0
- package/nitrogen/generated/ios/PdfViewerAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridPdfViewerSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridPdfViewerSpecSwift.hpp +205 -0
- package/nitrogen/generated/ios/c++/views/HybridPdfViewerComponent.mm +161 -0
- package/nitrogen/generated/ios/swift/ErrorEvent.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_ErrorEvent.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_LoadCompleteEvent.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_LoadingChangeEvent.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_PageChangeEvent.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_ScaleChangeEvent.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_ThumbnailGeneratedEvent.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridPdfViewerSpec.swift +65 -0
- package/nitrogen/generated/ios/swift/HybridPdfViewerSpec_cxx.swift +500 -0
- package/nitrogen/generated/ios/swift/LoadCompleteEvent.swift +57 -0
- package/nitrogen/generated/ios/swift/LoadingChangeEvent.swift +35 -0
- package/nitrogen/generated/ios/swift/PageChangeEvent.swift +46 -0
- package/nitrogen/generated/ios/swift/ScaleChangeEvent.swift +35 -0
- package/nitrogen/generated/ios/swift/ThumbnailGeneratedEvent.swift +46 -0
- package/nitrogen/generated/shared/c++/ErrorEvent.hpp +71 -0
- package/nitrogen/generated/shared/c++/HybridPdfViewerSpec.cpp +52 -0
- package/nitrogen/generated/shared/c++/HybridPdfViewerSpec.hpp +111 -0
- package/nitrogen/generated/shared/c++/LoadCompleteEvent.hpp +75 -0
- package/nitrogen/generated/shared/c++/LoadingChangeEvent.hpp +67 -0
- package/nitrogen/generated/shared/c++/PageChangeEvent.hpp +71 -0
- package/nitrogen/generated/shared/c++/ScaleChangeEvent.hpp +67 -0
- package/nitrogen/generated/shared/c++/ThumbnailGeneratedEvent.hpp +71 -0
- package/nitrogen/generated/shared/c++/views/HybridPdfViewerComponent.cpp +243 -0
- package/nitrogen/generated/shared/c++/views/HybridPdfViewerComponent.hpp +127 -0
- package/nitrogen/generated/shared/json/PdfViewerConfig.json +23 -0
- package/package.json +175 -0
- package/src/PdfViewer.nitro.ts +97 -0
- package/src/index.tsx +27 -0
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridPdfViewerSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "JHybridPdfViewerSpec.hpp"
|
|
9
|
+
|
|
10
|
+
// Forward declaration of `LoadCompleteEvent` to properly resolve imports.
|
|
11
|
+
namespace margelo::nitro::pdfviewer { struct LoadCompleteEvent; }
|
|
12
|
+
// Forward declaration of `PageChangeEvent` to properly resolve imports.
|
|
13
|
+
namespace margelo::nitro::pdfviewer { struct PageChangeEvent; }
|
|
14
|
+
// Forward declaration of `ScaleChangeEvent` to properly resolve imports.
|
|
15
|
+
namespace margelo::nitro::pdfviewer { struct ScaleChangeEvent; }
|
|
16
|
+
// Forward declaration of `ErrorEvent` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::pdfviewer { struct ErrorEvent; }
|
|
18
|
+
// Forward declaration of `ThumbnailGeneratedEvent` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::pdfviewer { struct ThumbnailGeneratedEvent; }
|
|
20
|
+
// Forward declaration of `LoadingChangeEvent` to properly resolve imports.
|
|
21
|
+
namespace margelo::nitro::pdfviewer { struct LoadingChangeEvent; }
|
|
22
|
+
|
|
23
|
+
#include <string>
|
|
24
|
+
#include <optional>
|
|
25
|
+
#include "LoadCompleteEvent.hpp"
|
|
26
|
+
#include <functional>
|
|
27
|
+
#include "JFunc_void_LoadCompleteEvent.hpp"
|
|
28
|
+
#include "JLoadCompleteEvent.hpp"
|
|
29
|
+
#include "PageChangeEvent.hpp"
|
|
30
|
+
#include "JFunc_void_PageChangeEvent.hpp"
|
|
31
|
+
#include "JPageChangeEvent.hpp"
|
|
32
|
+
#include "ScaleChangeEvent.hpp"
|
|
33
|
+
#include "JFunc_void_ScaleChangeEvent.hpp"
|
|
34
|
+
#include "JScaleChangeEvent.hpp"
|
|
35
|
+
#include "ErrorEvent.hpp"
|
|
36
|
+
#include "JFunc_void_ErrorEvent.hpp"
|
|
37
|
+
#include "JErrorEvent.hpp"
|
|
38
|
+
#include "ThumbnailGeneratedEvent.hpp"
|
|
39
|
+
#include "JFunc_void_ThumbnailGeneratedEvent.hpp"
|
|
40
|
+
#include "JThumbnailGeneratedEvent.hpp"
|
|
41
|
+
#include "LoadingChangeEvent.hpp"
|
|
42
|
+
#include "JFunc_void_LoadingChangeEvent.hpp"
|
|
43
|
+
#include "JLoadingChangeEvent.hpp"
|
|
44
|
+
|
|
45
|
+
namespace margelo::nitro::pdfviewer {
|
|
46
|
+
|
|
47
|
+
jni::local_ref<JHybridPdfViewerSpec::jhybriddata> JHybridPdfViewerSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
48
|
+
return makeCxxInstance(jThis);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
void JHybridPdfViewerSpec::registerNatives() {
|
|
52
|
+
registerHybrid({
|
|
53
|
+
makeNativeMethod("initHybrid", JHybridPdfViewerSpec::initHybrid),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
size_t JHybridPdfViewerSpec::getExternalMemorySize() noexcept {
|
|
58
|
+
static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
|
|
59
|
+
return method(_javaPart);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
void JHybridPdfViewerSpec::dispose() noexcept {
|
|
63
|
+
static const auto method = javaClassStatic()->getMethod<void()>("dispose");
|
|
64
|
+
method(_javaPart);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Properties
|
|
68
|
+
std::optional<std::string> JHybridPdfViewerSpec::getSource() {
|
|
69
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getSource");
|
|
70
|
+
auto __result = method(_javaPart);
|
|
71
|
+
return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
|
|
72
|
+
}
|
|
73
|
+
void JHybridPdfViewerSpec::setSource(const std::optional<std::string>& source) {
|
|
74
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* source */)>("setSource");
|
|
75
|
+
method(_javaPart, source.has_value() ? jni::make_jstring(source.value()) : nullptr);
|
|
76
|
+
}
|
|
77
|
+
std::optional<bool> JHybridPdfViewerSpec::getHorizontal() {
|
|
78
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JBoolean>()>("getHorizontal");
|
|
79
|
+
auto __result = method(_javaPart);
|
|
80
|
+
return __result != nullptr ? std::make_optional(static_cast<bool>(__result->value())) : std::nullopt;
|
|
81
|
+
}
|
|
82
|
+
void JHybridPdfViewerSpec::setHorizontal(std::optional<bool> horizontal) {
|
|
83
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* horizontal */)>("setHorizontal");
|
|
84
|
+
method(_javaPart, horizontal.has_value() ? jni::JBoolean::valueOf(horizontal.value()) : nullptr);
|
|
85
|
+
}
|
|
86
|
+
std::optional<bool> JHybridPdfViewerSpec::getEnablePaging() {
|
|
87
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JBoolean>()>("getEnablePaging");
|
|
88
|
+
auto __result = method(_javaPart);
|
|
89
|
+
return __result != nullptr ? std::make_optional(static_cast<bool>(__result->value())) : std::nullopt;
|
|
90
|
+
}
|
|
91
|
+
void JHybridPdfViewerSpec::setEnablePaging(std::optional<bool> enablePaging) {
|
|
92
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* enablePaging */)>("setEnablePaging");
|
|
93
|
+
method(_javaPart, enablePaging.has_value() ? jni::JBoolean::valueOf(enablePaging.value()) : nullptr);
|
|
94
|
+
}
|
|
95
|
+
std::optional<double> JHybridPdfViewerSpec::getSpacing() {
|
|
96
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getSpacing");
|
|
97
|
+
auto __result = method(_javaPart);
|
|
98
|
+
return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
|
|
99
|
+
}
|
|
100
|
+
void JHybridPdfViewerSpec::setSpacing(std::optional<double> spacing) {
|
|
101
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* spacing */)>("setSpacing");
|
|
102
|
+
method(_javaPart, spacing.has_value() ? jni::JDouble::valueOf(spacing.value()) : nullptr);
|
|
103
|
+
}
|
|
104
|
+
std::optional<bool> JHybridPdfViewerSpec::getEnableZoom() {
|
|
105
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JBoolean>()>("getEnableZoom");
|
|
106
|
+
auto __result = method(_javaPart);
|
|
107
|
+
return __result != nullptr ? std::make_optional(static_cast<bool>(__result->value())) : std::nullopt;
|
|
108
|
+
}
|
|
109
|
+
void JHybridPdfViewerSpec::setEnableZoom(std::optional<bool> enableZoom) {
|
|
110
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* enableZoom */)>("setEnableZoom");
|
|
111
|
+
method(_javaPart, enableZoom.has_value() ? jni::JBoolean::valueOf(enableZoom.value()) : nullptr);
|
|
112
|
+
}
|
|
113
|
+
std::optional<double> JHybridPdfViewerSpec::getMinScale() {
|
|
114
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getMinScale");
|
|
115
|
+
auto __result = method(_javaPart);
|
|
116
|
+
return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
|
|
117
|
+
}
|
|
118
|
+
void JHybridPdfViewerSpec::setMinScale(std::optional<double> minScale) {
|
|
119
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* minScale */)>("setMinScale");
|
|
120
|
+
method(_javaPart, minScale.has_value() ? jni::JDouble::valueOf(minScale.value()) : nullptr);
|
|
121
|
+
}
|
|
122
|
+
std::optional<double> JHybridPdfViewerSpec::getMaxScale() {
|
|
123
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getMaxScale");
|
|
124
|
+
auto __result = method(_javaPart);
|
|
125
|
+
return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
|
|
126
|
+
}
|
|
127
|
+
void JHybridPdfViewerSpec::setMaxScale(std::optional<double> maxScale) {
|
|
128
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* maxScale */)>("setMaxScale");
|
|
129
|
+
method(_javaPart, maxScale.has_value() ? jni::JDouble::valueOf(maxScale.value()) : nullptr);
|
|
130
|
+
}
|
|
131
|
+
std::optional<bool> JHybridPdfViewerSpec::getShowsActivityIndicator() {
|
|
132
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JBoolean>()>("getShowsActivityIndicator");
|
|
133
|
+
auto __result = method(_javaPart);
|
|
134
|
+
return __result != nullptr ? std::make_optional(static_cast<bool>(__result->value())) : std::nullopt;
|
|
135
|
+
}
|
|
136
|
+
void JHybridPdfViewerSpec::setShowsActivityIndicator(std::optional<bool> showsActivityIndicator) {
|
|
137
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* showsActivityIndicator */)>("setShowsActivityIndicator");
|
|
138
|
+
method(_javaPart, showsActivityIndicator.has_value() ? jni::JBoolean::valueOf(showsActivityIndicator.value()) : nullptr);
|
|
139
|
+
}
|
|
140
|
+
std::optional<std::function<void(const LoadCompleteEvent& /* event */)>> JHybridPdfViewerSpec::getOnLoadComplete() {
|
|
141
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_LoadCompleteEvent::javaobject>()>("getOnLoadComplete_cxx");
|
|
142
|
+
auto __result = method(_javaPart);
|
|
143
|
+
return __result != nullptr ? std::make_optional([&]() -> std::function<void(const LoadCompleteEvent& /* event */)> {
|
|
144
|
+
if (__result->isInstanceOf(JFunc_void_LoadCompleteEvent_cxx::javaClassStatic())) [[likely]] {
|
|
145
|
+
auto downcast = jni::static_ref_cast<JFunc_void_LoadCompleteEvent_cxx::javaobject>(__result);
|
|
146
|
+
return downcast->cthis()->getFunction();
|
|
147
|
+
} else {
|
|
148
|
+
auto __resultRef = jni::make_global(__result);
|
|
149
|
+
return [__resultRef](LoadCompleteEvent event) -> void {
|
|
150
|
+
return __resultRef->invoke(event);
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
}()) : std::nullopt;
|
|
154
|
+
}
|
|
155
|
+
void JHybridPdfViewerSpec::setOnLoadComplete(const std::optional<std::function<void(const LoadCompleteEvent& /* event */)>>& onLoadComplete) {
|
|
156
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_LoadCompleteEvent::javaobject> /* onLoadComplete */)>("setOnLoadComplete_cxx");
|
|
157
|
+
method(_javaPart, onLoadComplete.has_value() ? JFunc_void_LoadCompleteEvent_cxx::fromCpp(onLoadComplete.value()) : nullptr);
|
|
158
|
+
}
|
|
159
|
+
std::optional<std::function<void(const PageChangeEvent& /* event */)>> JHybridPdfViewerSpec::getOnPageChange() {
|
|
160
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_PageChangeEvent::javaobject>()>("getOnPageChange_cxx");
|
|
161
|
+
auto __result = method(_javaPart);
|
|
162
|
+
return __result != nullptr ? std::make_optional([&]() -> std::function<void(const PageChangeEvent& /* event */)> {
|
|
163
|
+
if (__result->isInstanceOf(JFunc_void_PageChangeEvent_cxx::javaClassStatic())) [[likely]] {
|
|
164
|
+
auto downcast = jni::static_ref_cast<JFunc_void_PageChangeEvent_cxx::javaobject>(__result);
|
|
165
|
+
return downcast->cthis()->getFunction();
|
|
166
|
+
} else {
|
|
167
|
+
auto __resultRef = jni::make_global(__result);
|
|
168
|
+
return [__resultRef](PageChangeEvent event) -> void {
|
|
169
|
+
return __resultRef->invoke(event);
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
}()) : std::nullopt;
|
|
173
|
+
}
|
|
174
|
+
void JHybridPdfViewerSpec::setOnPageChange(const std::optional<std::function<void(const PageChangeEvent& /* event */)>>& onPageChange) {
|
|
175
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_PageChangeEvent::javaobject> /* onPageChange */)>("setOnPageChange_cxx");
|
|
176
|
+
method(_javaPart, onPageChange.has_value() ? JFunc_void_PageChangeEvent_cxx::fromCpp(onPageChange.value()) : nullptr);
|
|
177
|
+
}
|
|
178
|
+
std::optional<std::function<void(const ScaleChangeEvent& /* event */)>> JHybridPdfViewerSpec::getOnScaleChange() {
|
|
179
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_ScaleChangeEvent::javaobject>()>("getOnScaleChange_cxx");
|
|
180
|
+
auto __result = method(_javaPart);
|
|
181
|
+
return __result != nullptr ? std::make_optional([&]() -> std::function<void(const ScaleChangeEvent& /* event */)> {
|
|
182
|
+
if (__result->isInstanceOf(JFunc_void_ScaleChangeEvent_cxx::javaClassStatic())) [[likely]] {
|
|
183
|
+
auto downcast = jni::static_ref_cast<JFunc_void_ScaleChangeEvent_cxx::javaobject>(__result);
|
|
184
|
+
return downcast->cthis()->getFunction();
|
|
185
|
+
} else {
|
|
186
|
+
auto __resultRef = jni::make_global(__result);
|
|
187
|
+
return [__resultRef](ScaleChangeEvent event) -> void {
|
|
188
|
+
return __resultRef->invoke(event);
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}()) : std::nullopt;
|
|
192
|
+
}
|
|
193
|
+
void JHybridPdfViewerSpec::setOnScaleChange(const std::optional<std::function<void(const ScaleChangeEvent& /* event */)>>& onScaleChange) {
|
|
194
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_ScaleChangeEvent::javaobject> /* onScaleChange */)>("setOnScaleChange_cxx");
|
|
195
|
+
method(_javaPart, onScaleChange.has_value() ? JFunc_void_ScaleChangeEvent_cxx::fromCpp(onScaleChange.value()) : nullptr);
|
|
196
|
+
}
|
|
197
|
+
std::optional<std::function<void(const ErrorEvent& /* event */)>> JHybridPdfViewerSpec::getOnError() {
|
|
198
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_ErrorEvent::javaobject>()>("getOnError_cxx");
|
|
199
|
+
auto __result = method(_javaPart);
|
|
200
|
+
return __result != nullptr ? std::make_optional([&]() -> std::function<void(const ErrorEvent& /* event */)> {
|
|
201
|
+
if (__result->isInstanceOf(JFunc_void_ErrorEvent_cxx::javaClassStatic())) [[likely]] {
|
|
202
|
+
auto downcast = jni::static_ref_cast<JFunc_void_ErrorEvent_cxx::javaobject>(__result);
|
|
203
|
+
return downcast->cthis()->getFunction();
|
|
204
|
+
} else {
|
|
205
|
+
auto __resultRef = jni::make_global(__result);
|
|
206
|
+
return [__resultRef](ErrorEvent event) -> void {
|
|
207
|
+
return __resultRef->invoke(event);
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
}()) : std::nullopt;
|
|
211
|
+
}
|
|
212
|
+
void JHybridPdfViewerSpec::setOnError(const std::optional<std::function<void(const ErrorEvent& /* event */)>>& onError) {
|
|
213
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_ErrorEvent::javaobject> /* onError */)>("setOnError_cxx");
|
|
214
|
+
method(_javaPart, onError.has_value() ? JFunc_void_ErrorEvent_cxx::fromCpp(onError.value()) : nullptr);
|
|
215
|
+
}
|
|
216
|
+
std::optional<std::function<void(const ThumbnailGeneratedEvent& /* event */)>> JHybridPdfViewerSpec::getOnThumbnailGenerated() {
|
|
217
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_ThumbnailGeneratedEvent::javaobject>()>("getOnThumbnailGenerated_cxx");
|
|
218
|
+
auto __result = method(_javaPart);
|
|
219
|
+
return __result != nullptr ? std::make_optional([&]() -> std::function<void(const ThumbnailGeneratedEvent& /* event */)> {
|
|
220
|
+
if (__result->isInstanceOf(JFunc_void_ThumbnailGeneratedEvent_cxx::javaClassStatic())) [[likely]] {
|
|
221
|
+
auto downcast = jni::static_ref_cast<JFunc_void_ThumbnailGeneratedEvent_cxx::javaobject>(__result);
|
|
222
|
+
return downcast->cthis()->getFunction();
|
|
223
|
+
} else {
|
|
224
|
+
auto __resultRef = jni::make_global(__result);
|
|
225
|
+
return [__resultRef](ThumbnailGeneratedEvent event) -> void {
|
|
226
|
+
return __resultRef->invoke(event);
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
}()) : std::nullopt;
|
|
230
|
+
}
|
|
231
|
+
void JHybridPdfViewerSpec::setOnThumbnailGenerated(const std::optional<std::function<void(const ThumbnailGeneratedEvent& /* event */)>>& onThumbnailGenerated) {
|
|
232
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_ThumbnailGeneratedEvent::javaobject> /* onThumbnailGenerated */)>("setOnThumbnailGenerated_cxx");
|
|
233
|
+
method(_javaPart, onThumbnailGenerated.has_value() ? JFunc_void_ThumbnailGeneratedEvent_cxx::fromCpp(onThumbnailGenerated.value()) : nullptr);
|
|
234
|
+
}
|
|
235
|
+
std::optional<std::function<void(const LoadingChangeEvent& /* event */)>> JHybridPdfViewerSpec::getOnLoadingChange() {
|
|
236
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_LoadingChangeEvent::javaobject>()>("getOnLoadingChange_cxx");
|
|
237
|
+
auto __result = method(_javaPart);
|
|
238
|
+
return __result != nullptr ? std::make_optional([&]() -> std::function<void(const LoadingChangeEvent& /* event */)> {
|
|
239
|
+
if (__result->isInstanceOf(JFunc_void_LoadingChangeEvent_cxx::javaClassStatic())) [[likely]] {
|
|
240
|
+
auto downcast = jni::static_ref_cast<JFunc_void_LoadingChangeEvent_cxx::javaobject>(__result);
|
|
241
|
+
return downcast->cthis()->getFunction();
|
|
242
|
+
} else {
|
|
243
|
+
auto __resultRef = jni::make_global(__result);
|
|
244
|
+
return [__resultRef](LoadingChangeEvent event) -> void {
|
|
245
|
+
return __resultRef->invoke(event);
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
}()) : std::nullopt;
|
|
249
|
+
}
|
|
250
|
+
void JHybridPdfViewerSpec::setOnLoadingChange(const std::optional<std::function<void(const LoadingChangeEvent& /* event */)>>& onLoadingChange) {
|
|
251
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_LoadingChangeEvent::javaobject> /* onLoadingChange */)>("setOnLoadingChange_cxx");
|
|
252
|
+
method(_javaPart, onLoadingChange.has_value() ? JFunc_void_LoadingChangeEvent_cxx::fromCpp(onLoadingChange.value()) : nullptr);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Methods
|
|
256
|
+
void JHybridPdfViewerSpec::goToPage(double page) {
|
|
257
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* page */)>("goToPage");
|
|
258
|
+
method(_javaPart, page);
|
|
259
|
+
}
|
|
260
|
+
void JHybridPdfViewerSpec::setScale(double scale) {
|
|
261
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* scale */)>("setScale");
|
|
262
|
+
method(_javaPart, scale);
|
|
263
|
+
}
|
|
264
|
+
void JHybridPdfViewerSpec::generateThumbnail(double page) {
|
|
265
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* page */)>("generateThumbnail");
|
|
266
|
+
method(_javaPart, page);
|
|
267
|
+
}
|
|
268
|
+
void JHybridPdfViewerSpec::generateAllThumbnails() {
|
|
269
|
+
static const auto method = javaClassStatic()->getMethod<void()>("generateAllThumbnails");
|
|
270
|
+
method(_javaPart);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
} // namespace margelo::nitro::pdfviewer
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridPdfViewerSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <NitroModules/JHybridObject.hpp>
|
|
11
|
+
#include <fbjni/fbjni.h>
|
|
12
|
+
#include "HybridPdfViewerSpec.hpp"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::pdfviewer {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
class JHybridPdfViewerSpec: public jni::HybridClass<JHybridPdfViewerSpec, JHybridObject>,
|
|
22
|
+
public virtual HybridPdfViewerSpec {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/pdfviewer/HybridPdfViewerSpec;";
|
|
25
|
+
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
26
|
+
static void registerNatives();
|
|
27
|
+
|
|
28
|
+
protected:
|
|
29
|
+
// C++ constructor (called from Java via `initHybrid()`)
|
|
30
|
+
explicit JHybridPdfViewerSpec(jni::alias_ref<jhybridobject> jThis) :
|
|
31
|
+
HybridObject(HybridPdfViewerSpec::TAG),
|
|
32
|
+
HybridBase(jThis),
|
|
33
|
+
_javaPart(jni::make_global(jThis)) {}
|
|
34
|
+
|
|
35
|
+
public:
|
|
36
|
+
~JHybridPdfViewerSpec() override {
|
|
37
|
+
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
38
|
+
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
size_t getExternalMemorySize() noexcept override;
|
|
43
|
+
void dispose() noexcept override;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
inline const jni::global_ref<JHybridPdfViewerSpec::javaobject>& getJavaPart() const noexcept {
|
|
47
|
+
return _javaPart;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
// Properties
|
|
52
|
+
std::optional<std::string> getSource() override;
|
|
53
|
+
void setSource(const std::optional<std::string>& source) override;
|
|
54
|
+
std::optional<bool> getHorizontal() override;
|
|
55
|
+
void setHorizontal(std::optional<bool> horizontal) override;
|
|
56
|
+
std::optional<bool> getEnablePaging() override;
|
|
57
|
+
void setEnablePaging(std::optional<bool> enablePaging) override;
|
|
58
|
+
std::optional<double> getSpacing() override;
|
|
59
|
+
void setSpacing(std::optional<double> spacing) override;
|
|
60
|
+
std::optional<bool> getEnableZoom() override;
|
|
61
|
+
void setEnableZoom(std::optional<bool> enableZoom) override;
|
|
62
|
+
std::optional<double> getMinScale() override;
|
|
63
|
+
void setMinScale(std::optional<double> minScale) override;
|
|
64
|
+
std::optional<double> getMaxScale() override;
|
|
65
|
+
void setMaxScale(std::optional<double> maxScale) override;
|
|
66
|
+
std::optional<bool> getShowsActivityIndicator() override;
|
|
67
|
+
void setShowsActivityIndicator(std::optional<bool> showsActivityIndicator) override;
|
|
68
|
+
std::optional<std::function<void(const LoadCompleteEvent& /* event */)>> getOnLoadComplete() override;
|
|
69
|
+
void setOnLoadComplete(const std::optional<std::function<void(const LoadCompleteEvent& /* event */)>>& onLoadComplete) override;
|
|
70
|
+
std::optional<std::function<void(const PageChangeEvent& /* event */)>> getOnPageChange() override;
|
|
71
|
+
void setOnPageChange(const std::optional<std::function<void(const PageChangeEvent& /* event */)>>& onPageChange) override;
|
|
72
|
+
std::optional<std::function<void(const ScaleChangeEvent& /* event */)>> getOnScaleChange() override;
|
|
73
|
+
void setOnScaleChange(const std::optional<std::function<void(const ScaleChangeEvent& /* event */)>>& onScaleChange) override;
|
|
74
|
+
std::optional<std::function<void(const ErrorEvent& /* event */)>> getOnError() override;
|
|
75
|
+
void setOnError(const std::optional<std::function<void(const ErrorEvent& /* event */)>>& onError) override;
|
|
76
|
+
std::optional<std::function<void(const ThumbnailGeneratedEvent& /* event */)>> getOnThumbnailGenerated() override;
|
|
77
|
+
void setOnThumbnailGenerated(const std::optional<std::function<void(const ThumbnailGeneratedEvent& /* event */)>>& onThumbnailGenerated) override;
|
|
78
|
+
std::optional<std::function<void(const LoadingChangeEvent& /* event */)>> getOnLoadingChange() override;
|
|
79
|
+
void setOnLoadingChange(const std::optional<std::function<void(const LoadingChangeEvent& /* event */)>>& onLoadingChange) override;
|
|
80
|
+
|
|
81
|
+
public:
|
|
82
|
+
// Methods
|
|
83
|
+
void goToPage(double page) override;
|
|
84
|
+
void setScale(double scale) override;
|
|
85
|
+
void generateThumbnail(double page) override;
|
|
86
|
+
void generateAllThumbnails() override;
|
|
87
|
+
|
|
88
|
+
private:
|
|
89
|
+
friend HybridBase;
|
|
90
|
+
using HybridBase::HybridBase;
|
|
91
|
+
jni::global_ref<JHybridPdfViewerSpec::javaobject> _javaPart;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
} // namespace margelo::nitro::pdfviewer
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JLoadCompleteEvent.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "LoadCompleteEvent.hpp"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::pdfviewer {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "LoadCompleteEvent" and the the Kotlin data class "LoadCompleteEvent".
|
|
21
|
+
*/
|
|
22
|
+
struct JLoadCompleteEvent final: public jni::JavaClass<JLoadCompleteEvent> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/pdfviewer/LoadCompleteEvent;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct LoadCompleteEvent by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
LoadCompleteEvent toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldPageCount = clazz->getField<double>("pageCount");
|
|
35
|
+
double pageCount = this->getFieldValue(fieldPageCount);
|
|
36
|
+
static const auto fieldPageWidth = clazz->getField<double>("pageWidth");
|
|
37
|
+
double pageWidth = this->getFieldValue(fieldPageWidth);
|
|
38
|
+
static const auto fieldPageHeight = clazz->getField<double>("pageHeight");
|
|
39
|
+
double pageHeight = this->getFieldValue(fieldPageHeight);
|
|
40
|
+
return LoadCompleteEvent(
|
|
41
|
+
pageCount,
|
|
42
|
+
pageWidth,
|
|
43
|
+
pageHeight
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
/**
|
|
49
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
50
|
+
*/
|
|
51
|
+
[[maybe_unused]]
|
|
52
|
+
static jni::local_ref<JLoadCompleteEvent::javaobject> fromCpp(const LoadCompleteEvent& value) {
|
|
53
|
+
return newInstance(
|
|
54
|
+
value.pageCount,
|
|
55
|
+
value.pageWidth,
|
|
56
|
+
value.pageHeight
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace margelo::nitro::pdfviewer
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JLoadingChangeEvent.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "LoadingChangeEvent.hpp"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::pdfviewer {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "LoadingChangeEvent" and the the Kotlin data class "LoadingChangeEvent".
|
|
21
|
+
*/
|
|
22
|
+
struct JLoadingChangeEvent final: public jni::JavaClass<JLoadingChangeEvent> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/pdfviewer/LoadingChangeEvent;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct LoadingChangeEvent by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
LoadingChangeEvent toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldIsLoading = clazz->getField<jboolean>("isLoading");
|
|
35
|
+
jboolean isLoading = this->getFieldValue(fieldIsLoading);
|
|
36
|
+
return LoadingChangeEvent(
|
|
37
|
+
static_cast<bool>(isLoading)
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
/**
|
|
43
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
44
|
+
*/
|
|
45
|
+
[[maybe_unused]]
|
|
46
|
+
static jni::local_ref<JLoadingChangeEvent::javaobject> fromCpp(const LoadingChangeEvent& value) {
|
|
47
|
+
return newInstance(
|
|
48
|
+
value.isLoading
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
} // namespace margelo::nitro::pdfviewer
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JPageChangeEvent.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "PageChangeEvent.hpp"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::pdfviewer {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "PageChangeEvent" and the the Kotlin data class "PageChangeEvent".
|
|
21
|
+
*/
|
|
22
|
+
struct JPageChangeEvent final: public jni::JavaClass<JPageChangeEvent> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/pdfviewer/PageChangeEvent;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct PageChangeEvent by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
PageChangeEvent toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldPage = clazz->getField<double>("page");
|
|
35
|
+
double page = this->getFieldValue(fieldPage);
|
|
36
|
+
static const auto fieldPageCount = clazz->getField<double>("pageCount");
|
|
37
|
+
double pageCount = this->getFieldValue(fieldPageCount);
|
|
38
|
+
return PageChangeEvent(
|
|
39
|
+
page,
|
|
40
|
+
pageCount
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public:
|
|
45
|
+
/**
|
|
46
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
47
|
+
*/
|
|
48
|
+
[[maybe_unused]]
|
|
49
|
+
static jni::local_ref<JPageChangeEvent::javaobject> fromCpp(const PageChangeEvent& value) {
|
|
50
|
+
return newInstance(
|
|
51
|
+
value.page,
|
|
52
|
+
value.pageCount
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
} // namespace margelo::nitro::pdfviewer
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JScaleChangeEvent.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "ScaleChangeEvent.hpp"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::pdfviewer {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "ScaleChangeEvent" and the the Kotlin data class "ScaleChangeEvent".
|
|
21
|
+
*/
|
|
22
|
+
struct JScaleChangeEvent final: public jni::JavaClass<JScaleChangeEvent> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/pdfviewer/ScaleChangeEvent;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct ScaleChangeEvent by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
ScaleChangeEvent toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldScale = clazz->getField<double>("scale");
|
|
35
|
+
double scale = this->getFieldValue(fieldScale);
|
|
36
|
+
return ScaleChangeEvent(
|
|
37
|
+
scale
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
/**
|
|
43
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
44
|
+
*/
|
|
45
|
+
[[maybe_unused]]
|
|
46
|
+
static jni::local_ref<JScaleChangeEvent::javaobject> fromCpp(const ScaleChangeEvent& value) {
|
|
47
|
+
return newInstance(
|
|
48
|
+
value.scale
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
} // namespace margelo::nitro::pdfviewer
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JThumbnailGeneratedEvent.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "ThumbnailGeneratedEvent.hpp"
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::pdfviewer {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "ThumbnailGeneratedEvent" and the the Kotlin data class "ThumbnailGeneratedEvent".
|
|
21
|
+
*/
|
|
22
|
+
struct JThumbnailGeneratedEvent final: public jni::JavaClass<JThumbnailGeneratedEvent> {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/pdfviewer/ThumbnailGeneratedEvent;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct ThumbnailGeneratedEvent by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
ThumbnailGeneratedEvent toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldPage = clazz->getField<double>("page");
|
|
35
|
+
double page = this->getFieldValue(fieldPage);
|
|
36
|
+
static const auto fieldUri = clazz->getField<jni::JString>("uri");
|
|
37
|
+
jni::local_ref<jni::JString> uri = this->getFieldValue(fieldUri);
|
|
38
|
+
return ThumbnailGeneratedEvent(
|
|
39
|
+
page,
|
|
40
|
+
uri->toStdString()
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public:
|
|
45
|
+
/**
|
|
46
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
47
|
+
*/
|
|
48
|
+
[[maybe_unused]]
|
|
49
|
+
static jni::local_ref<JThumbnailGeneratedEvent::javaobject> fromCpp(const ThumbnailGeneratedEvent& value) {
|
|
50
|
+
return newInstance(
|
|
51
|
+
value.page,
|
|
52
|
+
jni::make_jstring(value.uri)
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
} // namespace margelo::nitro::pdfviewer
|