-
-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathRNNitroSQLiteOnLoad.cpp
More file actions
64 lines (53 loc) · 2.37 KB
/
RNNitroSQLiteOnLoad.cpp
File metadata and controls
64 lines (53 loc) · 2.37 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
///
/// RNNitroSQLiteOnLoad.cpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///
#ifndef BUILDING_RNNITROSQLITE_WITH_GENERATED_CMAKE_PROJECT
#error RNNitroSQLiteOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
#endif
#include "RNNitroSQLiteOnLoad.hpp"
#include <jni.h>
#include <fbjni/fbjni.h>
#include <NitroModules/HybridObjectRegistry.hpp>
#include "JHybridNitroSQLiteOnLoadSpec.hpp"
#include "HybridNitroSQLite.hpp"
#include <NitroModules/DefaultConstructableObject.hpp>
namespace margelo::nitro::rnnitrosqlite {
int initialize(JavaVM* vm) {
return facebook::jni::initialize(vm, []() {
::margelo::nitro::rnnitrosqlite::registerAllNatives();
});
}
struct JHybridNitroSQLiteOnLoadSpecImpl: public jni::JavaClass<JHybridNitroSQLiteOnLoadSpecImpl, JHybridNitroSQLiteOnLoadSpec::JavaPart> {
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/rnnitrosqlite/HybridNitroSQLiteOnLoad;";
static std::shared_ptr<JHybridNitroSQLiteOnLoadSpec> create() {
static auto constructorFn = javaClassStatic()->getConstructor<JHybridNitroSQLiteOnLoadSpecImpl::javaobject()>();
jni::local_ref<JHybridNitroSQLiteOnLoadSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
return javaPart->getJHybridNitroSQLiteOnLoadSpec();
}
};
void registerAllNatives() {
using namespace margelo::nitro;
using namespace margelo::nitro::rnnitrosqlite;
// Register native JNI methods
margelo::nitro::rnnitrosqlite::JHybridNitroSQLiteOnLoadSpec::CxxPart::registerNatives();
// Register Nitro Hybrid Objects
HybridObjectRegistry::registerHybridObjectConstructor(
"NitroSQLite",
[]() -> std::shared_ptr<HybridObject> {
static_assert(std::is_default_constructible_v<HybridNitroSQLite>,
"The HybridObject \"HybridNitroSQLite\" is not default-constructible! "
"Create a public constructor that takes zero arguments to be able to autolink this HybridObject.");
return std::make_shared<HybridNitroSQLite>();
}
);
HybridObjectRegistry::registerHybridObjectConstructor(
"NitroSQLiteOnLoad",
[]() -> std::shared_ptr<HybridObject> {
return JHybridNitroSQLiteOnLoadSpecImpl::create();
}
);
}
} // namespace margelo::nitro::rnnitrosqlite