Skip to content

Commit 1f62f96

Browse files
committed
chore: regenerate nitro specs for Gallery test graph
Generated output for the Gallery struct graph, produced by `bun run specs` with the SwiftCxxBridgedType fix in place. Mechanical codegen — verifiable by re-running nitrogen, which yields a zero diff.
1 parent 9357421 commit 1f62f96

40 files changed

Lines changed: 2525 additions & 0 deletions
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
///
2+
/// JAlbumItem.hpp
3+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4+
/// https://github.com/mrousavy/nitro
5+
/// Copyright © Marc Rousavy @ Margelo
6+
///
7+
8+
#pragma once
9+
10+
#include <fbjni/fbjni.h>
11+
#include "AlbumItem.hpp"
12+
13+
#include "EntityInfo.hpp"
14+
#include "GalleryItem.hpp"
15+
#include "JEntityInfo.hpp"
16+
#include "JGalleryItem.hpp"
17+
#include "JMediaInfo.hpp"
18+
#include "JTagInfo.hpp"
19+
#include "JUserInfo.hpp"
20+
#include "MediaInfo.hpp"
21+
#include "TagInfo.hpp"
22+
#include "UserInfo.hpp"
23+
#include <optional>
24+
#include <string>
25+
#include <vector>
26+
27+
namespace margelo::nitro::test {
28+
29+
using namespace facebook;
30+
31+
/**
32+
* The C++ JNI bridge between the C++ struct "AlbumItem" and the Kotlin data class "AlbumItem".
33+
*/
34+
struct JAlbumItem final: public jni::JavaClass<JAlbumItem> {
35+
public:
36+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/test/AlbumItem;";
37+
38+
public:
39+
/**
40+
* Convert this Java/Kotlin-based struct to the C++ struct AlbumItem by copying all values to C++.
41+
*/
42+
[[maybe_unused]]
43+
[[nodiscard]]
44+
AlbumItem toCpp() const {
45+
static const auto clazz = javaClassStatic();
46+
static const auto fieldAlbumId = clazz->getField<double>("albumId");
47+
double albumId = this->getFieldValue(fieldAlbumId);
48+
static const auto fieldName = clazz->getField<jni::JString>("name");
49+
jni::local_ref<jni::JString> name = this->getFieldValue(fieldName);
50+
static const auto fieldCover = clazz->getField<JMediaInfo>("cover");
51+
jni::local_ref<JMediaInfo> cover = this->getFieldValue(fieldCover);
52+
static const auto fieldItems = clazz->getField<jni::JArrayClass<JGalleryItem>>("items");
53+
jni::local_ref<jni::JArrayClass<JGalleryItem>> items = this->getFieldValue(fieldItems);
54+
static const auto fieldOwner = clazz->getField<JUserInfo>("owner");
55+
jni::local_ref<JUserInfo> owner = this->getFieldValue(fieldOwner);
56+
return AlbumItem(
57+
albumId,
58+
name->toStdString(),
59+
cover != nullptr ? std::make_optional(cover->toCpp()) : std::nullopt,
60+
items != nullptr ? std::make_optional([&](auto&& __input) {
61+
size_t __size = __input->size();
62+
std::vector<GalleryItem> __vector;
63+
__vector.reserve(__size);
64+
for (size_t __i = 0; __i < __size; __i++) {
65+
auto __element = __input->getElement(__i);
66+
__vector.push_back(__element->toCpp());
67+
}
68+
return __vector;
69+
}(items)) : std::nullopt,
70+
owner != nullptr ? std::make_optional(owner->toCpp()) : std::nullopt
71+
);
72+
}
73+
74+
public:
75+
/**
76+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
77+
*/
78+
[[maybe_unused]]
79+
static jni::local_ref<JAlbumItem::javaobject> fromCpp(const AlbumItem& value) {
80+
using JSignature = JAlbumItem(double, jni::alias_ref<jni::JString>, jni::alias_ref<JMediaInfo>, jni::alias_ref<jni::JArrayClass<JGalleryItem>>, jni::alias_ref<JUserInfo>);
81+
static const auto clazz = javaClassStatic();
82+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
83+
return create(
84+
clazz,
85+
value.albumId,
86+
jni::make_jstring(value.name),
87+
value.cover.has_value() ? JMediaInfo::fromCpp(value.cover.value()) : nullptr,
88+
value.items.has_value() ? [&](auto&& __input) {
89+
size_t __size = __input.size();
90+
jni::local_ref<jni::JArrayClass<JGalleryItem>> __array = jni::JArrayClass<JGalleryItem>::newArray(__size);
91+
for (size_t __i = 0; __i < __size; __i++) {
92+
const auto& __element = __input[__i];
93+
auto __elementJni = JGalleryItem::fromCpp(__element);
94+
__array->setElement(__i, *__elementJni);
95+
}
96+
return __array;
97+
}(value.items.value()) : nullptr,
98+
value.owner.has_value() ? JUserInfo::fromCpp(value.owner.value()) : nullptr
99+
);
100+
}
101+
};
102+
103+
} // namespace margelo::nitro::test
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
///
2+
/// JEntityInfo.hpp
3+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4+
/// https://github.com/mrousavy/nitro
5+
/// Copyright © Marc Rousavy @ Margelo
6+
///
7+
8+
#pragma once
9+
10+
#include <fbjni/fbjni.h>
11+
#include "EntityInfo.hpp"
12+
13+
#include "JMediaInfo.hpp"
14+
#include "MediaInfo.hpp"
15+
#include <optional>
16+
#include <string>
17+
#include <vector>
18+
19+
namespace margelo::nitro::test {
20+
21+
using namespace facebook;
22+
23+
/**
24+
* The C++ JNI bridge between the C++ struct "EntityInfo" and the Kotlin data class "EntityInfo".
25+
*/
26+
struct JEntityInfo final: public jni::JavaClass<JEntityInfo> {
27+
public:
28+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/test/EntityInfo;";
29+
30+
public:
31+
/**
32+
* Convert this Java/Kotlin-based struct to the C++ struct EntityInfo by copying all values to C++.
33+
*/
34+
[[maybe_unused]]
35+
[[nodiscard]]
36+
EntityInfo toCpp() const {
37+
static const auto clazz = javaClassStatic();
38+
static const auto fieldEntityId = clazz->getField<double>("entityId");
39+
double entityId = this->getFieldValue(fieldEntityId);
40+
static const auto fieldTitle = clazz->getField<jni::JString>("title");
41+
jni::local_ref<jni::JString> title = this->getFieldValue(fieldTitle);
42+
static const auto fieldMedia = clazz->getField<JMediaInfo>("media");
43+
jni::local_ref<JMediaInfo> media = this->getFieldValue(fieldMedia);
44+
return EntityInfo(
45+
entityId,
46+
title->toStdString(),
47+
media != nullptr ? std::make_optional(media->toCpp()) : std::nullopt
48+
);
49+
}
50+
51+
public:
52+
/**
53+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
54+
*/
55+
[[maybe_unused]]
56+
static jni::local_ref<JEntityInfo::javaobject> fromCpp(const EntityInfo& value) {
57+
using JSignature = JEntityInfo(double, jni::alias_ref<jni::JString>, jni::alias_ref<JMediaInfo>);
58+
static const auto clazz = javaClassStatic();
59+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
60+
return create(
61+
clazz,
62+
value.entityId,
63+
jni::make_jstring(value.title),
64+
value.media.has_value() ? JMediaInfo::fromCpp(value.media.value()) : nullptr
65+
);
66+
}
67+
};
68+
69+
} // namespace margelo::nitro::test
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
///
2+
/// JGallery.hpp
3+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4+
/// https://github.com/mrousavy/nitro
5+
/// Copyright © Marc Rousavy @ Margelo
6+
///
7+
8+
#pragma once
9+
10+
#include <fbjni/fbjni.h>
11+
#include "Gallery.hpp"
12+
13+
#include "AlbumItem.hpp"
14+
#include "EntityInfo.hpp"
15+
#include "GalleryItem.hpp"
16+
#include "JAlbumItem.hpp"
17+
#include "JEntityInfo.hpp"
18+
#include "JGalleryItem.hpp"
19+
#include "JMediaInfo.hpp"
20+
#include "JTagInfo.hpp"
21+
#include "JUserInfo.hpp"
22+
#include "MediaInfo.hpp"
23+
#include "TagInfo.hpp"
24+
#include "UserInfo.hpp"
25+
#include <optional>
26+
#include <string>
27+
#include <vector>
28+
29+
namespace margelo::nitro::test {
30+
31+
using namespace facebook;
32+
33+
/**
34+
* The C++ JNI bridge between the C++ struct "Gallery" and the Kotlin data class "Gallery".
35+
*/
36+
struct JGallery final: public jni::JavaClass<JGallery> {
37+
public:
38+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/test/Gallery;";
39+
40+
public:
41+
/**
42+
* Convert this Java/Kotlin-based struct to the C++ struct Gallery by copying all values to C++.
43+
*/
44+
[[maybe_unused]]
45+
[[nodiscard]]
46+
Gallery toCpp() const {
47+
static const auto clazz = javaClassStatic();
48+
static const auto fieldAlbums = clazz->getField<jni::JArrayClass<JAlbumItem>>("albums");
49+
jni::local_ref<jni::JArrayClass<JAlbumItem>> albums = this->getFieldValue(fieldAlbums);
50+
static const auto fieldFeatured = clazz->getField<JGalleryItem>("featured");
51+
jni::local_ref<JGalleryItem> featured = this->getFieldValue(fieldFeatured);
52+
static const auto fieldOwner = clazz->getField<JUserInfo>("owner");
53+
jni::local_ref<JUserInfo> owner = this->getFieldValue(fieldOwner);
54+
return Gallery(
55+
[&](auto&& __input) {
56+
size_t __size = __input->size();
57+
std::vector<AlbumItem> __vector;
58+
__vector.reserve(__size);
59+
for (size_t __i = 0; __i < __size; __i++) {
60+
auto __element = __input->getElement(__i);
61+
__vector.push_back(__element->toCpp());
62+
}
63+
return __vector;
64+
}(albums),
65+
featured != nullptr ? std::make_optional(featured->toCpp()) : std::nullopt,
66+
owner->toCpp()
67+
);
68+
}
69+
70+
public:
71+
/**
72+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
73+
*/
74+
[[maybe_unused]]
75+
static jni::local_ref<JGallery::javaobject> fromCpp(const Gallery& value) {
76+
using JSignature = JGallery(jni::alias_ref<jni::JArrayClass<JAlbumItem>>, jni::alias_ref<JGalleryItem>, jni::alias_ref<JUserInfo>);
77+
static const auto clazz = javaClassStatic();
78+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
79+
return create(
80+
clazz,
81+
[&](auto&& __input) {
82+
size_t __size = __input.size();
83+
jni::local_ref<jni::JArrayClass<JAlbumItem>> __array = jni::JArrayClass<JAlbumItem>::newArray(__size);
84+
for (size_t __i = 0; __i < __size; __i++) {
85+
const auto& __element = __input[__i];
86+
auto __elementJni = JAlbumItem::fromCpp(__element);
87+
__array->setElement(__i, *__elementJni);
88+
}
89+
return __array;
90+
}(value.albums),
91+
value.featured.has_value() ? JGalleryItem::fromCpp(value.featured.value()) : nullptr,
92+
JUserInfo::fromCpp(value.owner)
93+
);
94+
}
95+
};
96+
97+
} // namespace margelo::nitro::test
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
///
2+
/// JGalleryItem.hpp
3+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4+
/// https://github.com/mrousavy/nitro
5+
/// Copyright © Marc Rousavy @ Margelo
6+
///
7+
8+
#pragma once
9+
10+
#include <fbjni/fbjni.h>
11+
#include "GalleryItem.hpp"
12+
13+
#include "EntityInfo.hpp"
14+
#include "JEntityInfo.hpp"
15+
#include "JMediaInfo.hpp"
16+
#include "JTagInfo.hpp"
17+
#include "JUserInfo.hpp"
18+
#include "MediaInfo.hpp"
19+
#include "TagInfo.hpp"
20+
#include "UserInfo.hpp"
21+
#include <optional>
22+
#include <string>
23+
#include <vector>
24+
25+
namespace margelo::nitro::test {
26+
27+
using namespace facebook;
28+
29+
/**
30+
* The C++ JNI bridge between the C++ struct "GalleryItem" and the Kotlin data class "GalleryItem".
31+
*/
32+
struct JGalleryItem final: public jni::JavaClass<JGalleryItem> {
33+
public:
34+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/test/GalleryItem;";
35+
36+
public:
37+
/**
38+
* Convert this Java/Kotlin-based struct to the C++ struct GalleryItem by copying all values to C++.
39+
*/
40+
[[maybe_unused]]
41+
[[nodiscard]]
42+
GalleryItem toCpp() const {
43+
static const auto clazz = javaClassStatic();
44+
static const auto fieldMediaId = clazz->getField<double>("mediaId");
45+
double mediaId = this->getFieldValue(fieldMediaId);
46+
static const auto fieldUri = clazz->getField<jni::JString>("uri");
47+
jni::local_ref<jni::JString> uri = this->getFieldValue(fieldUri);
48+
static const auto fieldMedia = clazz->getField<JMediaInfo>("media");
49+
jni::local_ref<JMediaInfo> media = this->getFieldValue(fieldMedia);
50+
static const auto fieldTags = clazz->getField<jni::JArrayClass<JTagInfo>>("tags");
51+
jni::local_ref<jni::JArrayClass<JTagInfo>> tags = this->getFieldValue(fieldTags);
52+
static const auto fieldOwner = clazz->getField<JUserInfo>("owner");
53+
jni::local_ref<JUserInfo> owner = this->getFieldValue(fieldOwner);
54+
static const auto fieldEntity = clazz->getField<JEntityInfo>("entity");
55+
jni::local_ref<JEntityInfo> entity = this->getFieldValue(fieldEntity);
56+
return GalleryItem(
57+
mediaId,
58+
uri->toStdString(),
59+
media->toCpp(),
60+
tags != nullptr ? std::make_optional([&](auto&& __input) {
61+
size_t __size = __input->size();
62+
std::vector<TagInfo> __vector;
63+
__vector.reserve(__size);
64+
for (size_t __i = 0; __i < __size; __i++) {
65+
auto __element = __input->getElement(__i);
66+
__vector.push_back(__element->toCpp());
67+
}
68+
return __vector;
69+
}(tags)) : std::nullopt,
70+
owner != nullptr ? std::make_optional(owner->toCpp()) : std::nullopt,
71+
entity != nullptr ? std::make_optional(entity->toCpp()) : std::nullopt
72+
);
73+
}
74+
75+
public:
76+
/**
77+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
78+
*/
79+
[[maybe_unused]]
80+
static jni::local_ref<JGalleryItem::javaobject> fromCpp(const GalleryItem& value) {
81+
using JSignature = JGalleryItem(double, jni::alias_ref<jni::JString>, jni::alias_ref<JMediaInfo>, jni::alias_ref<jni::JArrayClass<JTagInfo>>, jni::alias_ref<JUserInfo>, jni::alias_ref<JEntityInfo>);
82+
static const auto clazz = javaClassStatic();
83+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
84+
return create(
85+
clazz,
86+
value.mediaId,
87+
jni::make_jstring(value.uri),
88+
JMediaInfo::fromCpp(value.media),
89+
value.tags.has_value() ? [&](auto&& __input) {
90+
size_t __size = __input.size();
91+
jni::local_ref<jni::JArrayClass<JTagInfo>> __array = jni::JArrayClass<JTagInfo>::newArray(__size);
92+
for (size_t __i = 0; __i < __size; __i++) {
93+
const auto& __element = __input[__i];
94+
auto __elementJni = JTagInfo::fromCpp(__element);
95+
__array->setElement(__i, *__elementJni);
96+
}
97+
return __array;
98+
}(value.tags.value()) : nullptr,
99+
value.owner.has_value() ? JUserInfo::fromCpp(value.owner.value()) : nullptr,
100+
value.entity.has_value() ? JEntityInfo::fromCpp(value.entity.value()) : nullptr
101+
);
102+
}
103+
};
104+
105+
} // namespace margelo::nitro::test

0 commit comments

Comments
 (0)