-
-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathJAsyncImageLoadOptions.hpp
More file actions
100 lines (91 loc) · 6.44 KB
/
JAsyncImageLoadOptions.hpp
File metadata and controls
100 lines (91 loc) · 6.44 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
///
/// JAsyncImageLoadOptions.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 "AsyncImageLoadOptions.hpp"
#include "AsyncImagePriority.hpp"
#include "JAsyncImagePriority.hpp"
#include <optional>
#include <string>
namespace margelo::nitro::web::image {
using namespace facebook;
/**
* The C++ JNI bridge between the C++ struct "AsyncImageLoadOptions" and the the Kotlin data class "AsyncImageLoadOptions".
*/
struct JAsyncImageLoadOptions final: public jni::JavaClass<JAsyncImageLoadOptions> {
public:
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/web/image/AsyncImageLoadOptions;";
public:
/**
* Convert this Java/Kotlin-based struct to the C++ struct AsyncImageLoadOptions by copying all values to C++.
*/
[[maybe_unused]]
[[nodiscard]]
AsyncImageLoadOptions toCpp() const {
static const auto clazz = javaClassStatic();
static const auto fieldPriority = clazz->getField<JAsyncImagePriority>("priority");
jni::local_ref<JAsyncImagePriority> priority = this->getFieldValue(fieldPriority);
static const auto fieldForceRefresh = clazz->getField<jni::JBoolean>("forceRefresh");
jni::local_ref<jni::JBoolean> forceRefresh = this->getFieldValue(fieldForceRefresh);
static const auto fieldCacheKey = clazz->getField<jni::JString>("cacheKey");
jni::local_ref<jni::JString> cacheKey = this->getFieldValue(fieldCacheKey);
static const auto fieldContinueInBackground = clazz->getField<jni::JBoolean>("continueInBackground");
jni::local_ref<jni::JBoolean> continueInBackground = this->getFieldValue(fieldContinueInBackground);
static const auto fieldAllowInvalidSSLCertificates = clazz->getField<jni::JBoolean>("allowInvalidSSLCertificates");
jni::local_ref<jni::JBoolean> allowInvalidSSLCertificates = this->getFieldValue(fieldAllowInvalidSSLCertificates);
static const auto fieldScaleDownLargeImages = clazz->getField<jni::JBoolean>("scaleDownLargeImages");
jni::local_ref<jni::JBoolean> scaleDownLargeImages = this->getFieldValue(fieldScaleDownLargeImages);
static const auto fieldQueryMemoryDataSync = clazz->getField<jni::JBoolean>("queryMemoryDataSync");
jni::local_ref<jni::JBoolean> queryMemoryDataSync = this->getFieldValue(fieldQueryMemoryDataSync);
static const auto fieldQueryDiskDataSync = clazz->getField<jni::JBoolean>("queryDiskDataSync");
jni::local_ref<jni::JBoolean> queryDiskDataSync = this->getFieldValue(fieldQueryDiskDataSync);
static const auto fieldDecodeImage = clazz->getField<jni::JBoolean>("decodeImage");
jni::local_ref<jni::JBoolean> decodeImage = this->getFieldValue(fieldDecodeImage);
static const auto fieldAllowHardware = clazz->getField<jni::JBoolean>("allowHardware");
jni::local_ref<jni::JBoolean> allowHardware = this->getFieldValue(fieldAllowHardware);
static const auto fieldProgressive = clazz->getField<jni::JBoolean>("progressive");
jni::local_ref<jni::JBoolean> progressive = this->getFieldValue(fieldProgressive);
return AsyncImageLoadOptions(
priority != nullptr ? std::make_optional(priority->toCpp()) : std::nullopt,
forceRefresh != nullptr ? std::make_optional(static_cast<bool>(forceRefresh->value())) : std::nullopt,
cacheKey != nullptr ? std::make_optional(cacheKey->toStdString()) : std::nullopt,
continueInBackground != nullptr ? std::make_optional(static_cast<bool>(continueInBackground->value())) : std::nullopt,
allowInvalidSSLCertificates != nullptr ? std::make_optional(static_cast<bool>(allowInvalidSSLCertificates->value())) : std::nullopt,
scaleDownLargeImages != nullptr ? std::make_optional(static_cast<bool>(scaleDownLargeImages->value())) : std::nullopt,
queryMemoryDataSync != nullptr ? std::make_optional(static_cast<bool>(queryMemoryDataSync->value())) : std::nullopt,
queryDiskDataSync != nullptr ? std::make_optional(static_cast<bool>(queryDiskDataSync->value())) : std::nullopt,
decodeImage != nullptr ? std::make_optional(static_cast<bool>(decodeImage->value())) : std::nullopt,
allowHardware != nullptr ? std::make_optional(static_cast<bool>(allowHardware->value())) : std::nullopt,
progressive != nullptr ? std::make_optional(static_cast<bool>(progressive->value())) : std::nullopt
);
}
public:
/**
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
*/
[[maybe_unused]]
static jni::local_ref<JAsyncImageLoadOptions::javaobject> fromCpp(const AsyncImageLoadOptions& value) {
using JSignature = JAsyncImageLoadOptions(jni::alias_ref<JAsyncImagePriority>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JBoolean>);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
value.priority.has_value() ? JAsyncImagePriority::fromCpp(value.priority.value()) : nullptr,
value.forceRefresh.has_value() ? jni::JBoolean::valueOf(value.forceRefresh.value()) : nullptr,
value.cacheKey.has_value() ? jni::make_jstring(value.cacheKey.value()) : nullptr,
value.continueInBackground.has_value() ? jni::JBoolean::valueOf(value.continueInBackground.value()) : nullptr,
value.allowInvalidSSLCertificates.has_value() ? jni::JBoolean::valueOf(value.allowInvalidSSLCertificates.value()) : nullptr,
value.scaleDownLargeImages.has_value() ? jni::JBoolean::valueOf(value.scaleDownLargeImages.value()) : nullptr,
value.queryMemoryDataSync.has_value() ? jni::JBoolean::valueOf(value.queryMemoryDataSync.value()) : nullptr,
value.queryDiskDataSync.has_value() ? jni::JBoolean::valueOf(value.queryDiskDataSync.value()) : nullptr,
value.decodeImage.has_value() ? jni::JBoolean::valueOf(value.decodeImage.value()) : nullptr,
value.allowHardware.has_value() ? jni::JBoolean::valueOf(value.allowHardware.value()) : nullptr,
value.progressive.has_value() ? jni::JBoolean::valueOf(value.progressive.value()) : nullptr
);
}
};
} // namespace margelo::nitro::web::image