Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions packages/nitrogen/src/syntax/swift/SwiftCxxBridgedType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,13 @@ export class SwiftCxxBridgedType implements BridgedType<'swift', 'c++'> {
return bridge
}

getRequiredImports(language: Language): SourceImport[] {
getRequiredImports(
language: Language,
visited = new Set<Type>()
): SourceImport[] {
if (visited.has(this.type)) return []
visited.add(this.type)

const imports = this.type.getRequiredImports(language)

if (language === 'c++') {
Expand All @@ -154,13 +160,16 @@ export class SwiftCxxBridgedType implements BridgedType<'swift', 'c++'> {
return
}
const bridged = new SwiftCxxBridgedType(t)
imports.push(...bridged.getRequiredImports(language))
imports.push(...bridged.getRequiredImports(language, visited))
})

return imports
}

getExtraFiles(): SourceFile[] {
getExtraFiles(visited = new Set<Type>()): SourceFile[] {
if (visited.has(this.type)) return []
visited.add(this.type)

const files: SourceFile[] = []

switch (this.type.kind) {
Expand All @@ -170,7 +179,7 @@ export class SwiftCxxBridgedType implements BridgedType<'swift', 'c++'> {
files.push(extensionFile)
extensionFile.referencedTypes.forEach((t) => {
const bridge = new SwiftCxxBridgedType(t)
files.push(...bridge.getExtraFiles())
files.push(...bridge.getExtraFiles(visited))
})
break
}
Expand Down Expand Up @@ -209,7 +218,7 @@ export class SwiftCxxBridgedType implements BridgedType<'swift', 'c++'> {
return
}
const bridged = new SwiftCxxBridgedType(t)
files.push(...bridged.getExtraFiles())
files.push(...bridged.getExtraFiles(visited))
})

return files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,11 @@ class HybridTestObjectKotlin : HybridTestObjectSwiftKotlinSpec() {
return value
}

override fun bounceGallery(gallery: Gallery): Gallery {
return gallery
}


override fun createArrayBufferFromNativeBuffer(copy: Boolean): ArrayBuffer {
val hardwareBuffer =
HardwareBuffer.create(
Expand Down
3 changes: 3 additions & 0 deletions packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,9 +645,12 @@

std::optional<OptionalEnumWrapper> HybridTestObjectCpp::bounceOptionalEnumStruct(const std::optional<OptionalEnumWrapper>& value) {
return value;
Gallery HybridTestObjectCpp::bounceGallery(const Gallery& gallery) {

Check failure on line 648 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Build iOS Example App (static_frameworks, static)

function definition is not allowed here

Check failure on line 648 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (TSan, new architecture)

function definition is not allowed here

Check failure on line 648 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (Default, new architecture)

function definition is not allowed here

Check failure on line 648 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (ASan, new architecture)

function definition is not allowed here
return gallery;
}


std::shared_ptr<ArrayBuffer> HybridTestObjectCpp::createArrayBufferFromNativeBuffer(bool /* copy */) {

Check failure on line 653 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Build iOS Example App (static_frameworks, static)

function definition is not allowed here

Check failure on line 653 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (TSan, new architecture)

function definition is not allowed here

Check failure on line 653 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (Default, new architecture)

function definition is not allowed here

Check failure on line 653 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (ASan, new architecture)

function definition is not allowed here
// Let's just use the move method here for native buffer to test this too.
std::vector<uint8_t> data;
data.resize(1024 * 1024 * 10); // 10 MB
Expand All @@ -657,21 +660,21 @@
return ArrayBuffer::move(std::move(data));
}

std::shared_ptr<ArrayBuffer> HybridTestObjectCpp::createArrayBuffer() {

Check failure on line 663 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Build iOS Example App (static_frameworks, static)

function definition is not allowed here

Check failure on line 663 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (TSan, new architecture)

function definition is not allowed here

Check failure on line 663 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (Default, new architecture)

function definition is not allowed here

Check failure on line 663 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (ASan, new architecture)

function definition is not allowed here
size_t size = 1024 * 1024 * 10; // 10MB
uint8_t* buffer = new uint8_t[size];
return std::make_shared<NativeArrayBuffer>(buffer, size, [=]() { delete[] buffer; });
}

std::shared_ptr<ArrayBuffer> HybridTestObjectCpp::copyBuffer(const std::shared_ptr<ArrayBuffer>& buffer) {

Check failure on line 669 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Build iOS Example App (static_frameworks, static)

function definition is not allowed here

Check failure on line 669 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (TSan, new architecture)

function definition is not allowed here

Check failure on line 669 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (Default, new architecture)

function definition is not allowed here

Check failure on line 669 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (ASan, new architecture)

function definition is not allowed here
return ArrayBuffer::copy(buffer);
}

std::shared_ptr<ArrayBuffer> HybridTestObjectCpp::bounceArrayBuffer(const std::shared_ptr<ArrayBuffer>& buffer) {

Check failure on line 673 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Build iOS Example App (static_frameworks, static)

function definition is not allowed here

Check failure on line 673 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (TSan, new architecture)

function definition is not allowed here

Check failure on line 673 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (Default, new architecture)

function definition is not allowed here

Check failure on line 673 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (ASan, new architecture)

function definition is not allowed here
return buffer;
}

double HybridTestObjectCpp::getBufferLastItem(const std::shared_ptr<ArrayBuffer>& buffer) {

Check failure on line 677 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Build iOS Example App (static_frameworks, static)

function definition is not allowed here

Check failure on line 677 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (TSan, new architecture)

function definition is not allowed here

Check failure on line 677 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (Default, new architecture)

function definition is not allowed here

Check failure on line 677 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (ASan, new architecture)

function definition is not allowed here
size_t size = buffer->size();
if (size == 0) {
throw std::runtime_error("ArrayBuffer's size is 0!");
Expand All @@ -684,7 +687,7 @@
return static_cast<double>(lastItem);
}

void HybridTestObjectCpp::setAllValuesTo(const std::shared_ptr<ArrayBuffer>& buffer, double value) {

Check failure on line 690 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Build iOS Example App (static_frameworks, static)

function definition is not allowed here

Check failure on line 690 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (TSan, new architecture)

function definition is not allowed here

Check failure on line 690 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (Default, new architecture)

function definition is not allowed here

Check failure on line 690 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (ASan, new architecture)

function definition is not allowed here
size_t size = buffer->size();
if (size == 0) {
throw std::runtime_error("ArrayBuffer's size is 0!");
Expand All @@ -699,15 +702,15 @@
}
}

std::shared_ptr<Promise<std::shared_ptr<ArrayBuffer>>> HybridTestObjectCpp::createArrayBufferAsync() {

Check failure on line 705 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Build iOS Example App (static_frameworks, static)

function definition is not allowed here

Check failure on line 705 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (TSan, new architecture)

function definition is not allowed here

Check failure on line 705 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (Default, new architecture)

function definition is not allowed here

Check failure on line 705 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (ASan, new architecture)

function definition is not allowed here
return Promise<std::shared_ptr<ArrayBuffer>>::async([this]() -> std::shared_ptr<ArrayBuffer> { return this->createArrayBuffer(); });
}

std::shared_ptr<HybridTestObjectCppSpec> HybridTestObjectCpp::newTestObject() {

Check failure on line 709 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Build iOS Example App (static_frameworks, static)

function definition is not allowed here

Check failure on line 709 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (TSan, new architecture)

function definition is not allowed here

Check failure on line 709 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (Default, new architecture)

function definition is not allowed here

Check failure on line 709 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (ASan, new architecture)

function definition is not allowed here
return std::make_shared<HybridTestObjectCpp>();
}

std::shared_ptr<Promise<std::shared_ptr<HybridTestObjectCppSpec>>> HybridTestObjectCpp::newTestObjectAsync() {

Check failure on line 713 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Build iOS Example App (static_frameworks, static)

function definition is not allowed here

Check failure on line 713 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (TSan, new architecture)

function definition is not allowed here

Check failure on line 713 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (Default, new architecture)

function definition is not allowed here

Check failure on line 713 in packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp

View workflow job for this annotation

GitHub Actions / Harness iOS (ASan, new architecture)

function definition is not allowed here
// Resolves a HybridObject off the JS thread (on the Nitro ThreadPool). The near-instant closure
// keeps the resolve()-vs-toJSI window wide so the C++ Promise `_state` race surfaces under TSan.
return Promise<std::shared_ptr<HybridTestObjectCppSpec>>::async(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ class HybridTestObjectCpp : public HybridTestObjectCppSpec {
OptionalWrapper bounceOptionalWrapper(const OptionalWrapper& wrapper) override;
OptionalCallback bounceOptionalCallback(const OptionalCallback& value) override;
std::optional<OptionalEnumWrapper> bounceOptionalEnumStruct(const std::optional<OptionalEnumWrapper>& value) override;
Gallery bounceGallery(const Gallery& gallery) override;
std::shared_ptr<ArrayBuffer> createArrayBufferFromNativeBuffer(bool /* copy */) override;
std::shared_ptr<ArrayBuffer> createArrayBuffer() override;
std::shared_ptr<ArrayBuffer> copyBuffer(const std::shared_ptr<ArrayBuffer>& buffer) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,11 @@ class HybridTestObjectSwift: HybridTestObjectSwiftKotlinSpec {
return value
}

func bounceGallery(gallery: Gallery) throws -> Gallery {
return gallery
}


func createArrayBufferFromNativeBuffer(copy: Bool) throws -> ArrayBuffer {
let data = Data(count: 1024 * 1024 * 10) // 10 MB
if copy {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
///
/// JAlbumItem.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 "AlbumItem.hpp"

#include "EntityInfo.hpp"
#include "GalleryItem.hpp"
#include "JEntityInfo.hpp"
#include "JGalleryItem.hpp"
#include "JMediaInfo.hpp"
#include "JTagInfo.hpp"
#include "JUserInfo.hpp"
#include "MediaInfo.hpp"
#include "TagInfo.hpp"
#include "UserInfo.hpp"
#include <optional>
#include <string>
#include <vector>

namespace margelo::nitro::test {

using namespace facebook;

/**
* The C++ JNI bridge between the C++ struct "AlbumItem" and the Kotlin data class "AlbumItem".
*/
struct JAlbumItem final: public jni::JavaClass<JAlbumItem> {
public:
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/test/AlbumItem;";

public:
/**
* Convert this Java/Kotlin-based struct to the C++ struct AlbumItem by copying all values to C++.
*/
[[maybe_unused]]
[[nodiscard]]
AlbumItem toCpp() const {
static const auto clazz = javaClassStatic();
static const auto fieldAlbumId = clazz->getField<double>("albumId");
double albumId = this->getFieldValue(fieldAlbumId);
static const auto fieldName = clazz->getField<jni::JString>("name");
jni::local_ref<jni::JString> name = this->getFieldValue(fieldName);
static const auto fieldCover = clazz->getField<JMediaInfo>("cover");
jni::local_ref<JMediaInfo> cover = this->getFieldValue(fieldCover);
static const auto fieldItems = clazz->getField<jni::JArrayClass<JGalleryItem>>("items");
jni::local_ref<jni::JArrayClass<JGalleryItem>> items = this->getFieldValue(fieldItems);
static const auto fieldOwner = clazz->getField<JUserInfo>("owner");
jni::local_ref<JUserInfo> owner = this->getFieldValue(fieldOwner);
return AlbumItem(
albumId,
name->toStdString(),
cover != nullptr ? std::make_optional(cover->toCpp()) : std::nullopt,
items != nullptr ? std::make_optional([&](auto&& __input) {
size_t __size = __input->size();
std::vector<GalleryItem> __vector;
__vector.reserve(__size);
for (size_t __i = 0; __i < __size; __i++) {
auto __element = __input->getElement(__i);
__vector.push_back(__element->toCpp());
}
return __vector;
}(items)) : std::nullopt,
owner != nullptr ? std::make_optional(owner->toCpp()) : 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<JAlbumItem::javaobject> fromCpp(const AlbumItem& value) {
using JSignature = JAlbumItem(double, jni::alias_ref<jni::JString>, jni::alias_ref<JMediaInfo>, jni::alias_ref<jni::JArrayClass<JGalleryItem>>, jni::alias_ref<JUserInfo>);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
value.albumId,
jni::make_jstring(value.name),
value.cover.has_value() ? JMediaInfo::fromCpp(value.cover.value()) : nullptr,
value.items.has_value() ? [&](auto&& __input) {
size_t __size = __input.size();
jni::local_ref<jni::JArrayClass<JGalleryItem>> __array = jni::JArrayClass<JGalleryItem>::newArray(__size);
for (size_t __i = 0; __i < __size; __i++) {
const auto& __element = __input[__i];
auto __elementJni = JGalleryItem::fromCpp(__element);
__array->setElement(__i, *__elementJni);
}
return __array;
}(value.items.value()) : nullptr,
value.owner.has_value() ? JUserInfo::fromCpp(value.owner.value()) : nullptr
);
}
};

} // namespace margelo::nitro::test
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
///
/// JEntityInfo.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 "EntityInfo.hpp"

#include "JMediaInfo.hpp"
#include "MediaInfo.hpp"
#include <optional>
#include <string>
#include <vector>

namespace margelo::nitro::test {

using namespace facebook;

/**
* The C++ JNI bridge between the C++ struct "EntityInfo" and the Kotlin data class "EntityInfo".
*/
struct JEntityInfo final: public jni::JavaClass<JEntityInfo> {
public:
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/test/EntityInfo;";

public:
/**
* Convert this Java/Kotlin-based struct to the C++ struct EntityInfo by copying all values to C++.
*/
[[maybe_unused]]
[[nodiscard]]
EntityInfo toCpp() const {
static const auto clazz = javaClassStatic();
static const auto fieldEntityId = clazz->getField<double>("entityId");
double entityId = this->getFieldValue(fieldEntityId);
static const auto fieldTitle = clazz->getField<jni::JString>("title");
jni::local_ref<jni::JString> title = this->getFieldValue(fieldTitle);
static const auto fieldMedia = clazz->getField<JMediaInfo>("media");
jni::local_ref<JMediaInfo> media = this->getFieldValue(fieldMedia);
return EntityInfo(
entityId,
title->toStdString(),
media != nullptr ? std::make_optional(media->toCpp()) : 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<JEntityInfo::javaobject> fromCpp(const EntityInfo& value) {
using JSignature = JEntityInfo(double, jni::alias_ref<jni::JString>, jni::alias_ref<JMediaInfo>);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
value.entityId,
jni::make_jstring(value.title),
value.media.has_value() ? JMediaInfo::fromCpp(value.media.value()) : nullptr
);
}
};

} // namespace margelo::nitro::test
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
///
/// JGallery.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 "Gallery.hpp"

#include "AlbumItem.hpp"
#include "EntityInfo.hpp"
#include "GalleryItem.hpp"
#include "JAlbumItem.hpp"
#include "JEntityInfo.hpp"
#include "JGalleryItem.hpp"
#include "JMediaInfo.hpp"
#include "JTagInfo.hpp"
#include "JUserInfo.hpp"
#include "MediaInfo.hpp"
#include "TagInfo.hpp"
#include "UserInfo.hpp"
#include <optional>
#include <string>
#include <vector>

namespace margelo::nitro::test {

using namespace facebook;

/**
* The C++ JNI bridge between the C++ struct "Gallery" and the Kotlin data class "Gallery".
*/
struct JGallery final: public jni::JavaClass<JGallery> {
public:
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/test/Gallery;";

public:
/**
* Convert this Java/Kotlin-based struct to the C++ struct Gallery by copying all values to C++.
*/
[[maybe_unused]]
[[nodiscard]]
Gallery toCpp() const {
static const auto clazz = javaClassStatic();
static const auto fieldAlbums = clazz->getField<jni::JArrayClass<JAlbumItem>>("albums");
jni::local_ref<jni::JArrayClass<JAlbumItem>> albums = this->getFieldValue(fieldAlbums);
static const auto fieldFeatured = clazz->getField<JGalleryItem>("featured");
jni::local_ref<JGalleryItem> featured = this->getFieldValue(fieldFeatured);
static const auto fieldOwner = clazz->getField<JUserInfo>("owner");
jni::local_ref<JUserInfo> owner = this->getFieldValue(fieldOwner);
return Gallery(
[&](auto&& __input) {
size_t __size = __input->size();
std::vector<AlbumItem> __vector;
__vector.reserve(__size);
for (size_t __i = 0; __i < __size; __i++) {
auto __element = __input->getElement(__i);
__vector.push_back(__element->toCpp());
}
return __vector;
}(albums),
featured != nullptr ? std::make_optional(featured->toCpp()) : std::nullopt,
owner->toCpp()
);
}

public:
/**
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
*/
[[maybe_unused]]
static jni::local_ref<JGallery::javaobject> fromCpp(const Gallery& value) {
using JSignature = JGallery(jni::alias_ref<jni::JArrayClass<JAlbumItem>>, jni::alias_ref<JGalleryItem>, jni::alias_ref<JUserInfo>);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
[&](auto&& __input) {
size_t __size = __input.size();
jni::local_ref<jni::JArrayClass<JAlbumItem>> __array = jni::JArrayClass<JAlbumItem>::newArray(__size);
for (size_t __i = 0; __i < __size; __i++) {
const auto& __element = __input[__i];
auto __elementJni = JAlbumItem::fromCpp(__element);
__array->setElement(__i, *__elementJni);
}
return __array;
}(value.albums),
value.featured.has_value() ? JGalleryItem::fromCpp(value.featured.value()) : nullptr,
JUserInfo::fromCpp(value.owner)
);
}
};

} // namespace margelo::nitro::test
Loading
Loading