diff --git a/packages/nitrogen/src/syntax/swift/SwiftCxxBridgedType.ts b/packages/nitrogen/src/syntax/swift/SwiftCxxBridgedType.ts index ab3eacba68..5f2b70071f 100644 --- a/packages/nitrogen/src/syntax/swift/SwiftCxxBridgedType.ts +++ b/packages/nitrogen/src/syntax/swift/SwiftCxxBridgedType.ts @@ -128,7 +128,13 @@ export class SwiftCxxBridgedType implements BridgedType<'swift', 'c++'> { return bridge } - getRequiredImports(language: Language): SourceImport[] { + getRequiredImports( + language: Language, + visited = new Set() + ): SourceImport[] { + if (visited.has(this.type)) return [] + visited.add(this.type) + const imports = this.type.getRequiredImports(language) if (language === 'c++') { @@ -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()): SourceFile[] { + if (visited.has(this.type)) return [] + visited.add(this.type) + const files: SourceFile[] = [] switch (this.type.kind) { @@ -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 } @@ -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 diff --git a/packages/react-native-nitro-test/android/src/main/java/com/margelo/nitro/test/HybridTestObjectKotlin.kt b/packages/react-native-nitro-test/android/src/main/java/com/margelo/nitro/test/HybridTestObjectKotlin.kt index 7a99055fbd..1626afde25 100644 --- a/packages/react-native-nitro-test/android/src/main/java/com/margelo/nitro/test/HybridTestObjectKotlin.kt +++ b/packages/react-native-nitro-test/android/src/main/java/com/margelo/nitro/test/HybridTestObjectKotlin.kt @@ -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( diff --git a/packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp b/packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp index 563a74bb53..a7673986e7 100644 --- a/packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp +++ b/packages/react-native-nitro-test/cpp/HybridTestObjectCpp.cpp @@ -645,8 +645,11 @@ OptionalCallback HybridTestObjectCpp::bounceOptionalCallback(const OptionalCallb std::optional HybridTestObjectCpp::bounceOptionalEnumStruct(const std::optional& value) { return value; +Gallery HybridTestObjectCpp::bounceGallery(const Gallery& gallery) { + return gallery; } + std::shared_ptr HybridTestObjectCpp::createArrayBufferFromNativeBuffer(bool /* copy */) { // Let's just use the move method here for native buffer to test this too. std::vector data; diff --git a/packages/react-native-nitro-test/cpp/HybridTestObjectCpp.hpp b/packages/react-native-nitro-test/cpp/HybridTestObjectCpp.hpp index 2668dfe806..193145360e 100644 --- a/packages/react-native-nitro-test/cpp/HybridTestObjectCpp.hpp +++ b/packages/react-native-nitro-test/cpp/HybridTestObjectCpp.hpp @@ -201,6 +201,7 @@ class HybridTestObjectCpp : public HybridTestObjectCppSpec { OptionalWrapper bounceOptionalWrapper(const OptionalWrapper& wrapper) override; OptionalCallback bounceOptionalCallback(const OptionalCallback& value) override; std::optional bounceOptionalEnumStruct(const std::optional& value) override; + Gallery bounceGallery(const Gallery& gallery) override; std::shared_ptr createArrayBufferFromNativeBuffer(bool /* copy */) override; std::shared_ptr createArrayBuffer() override; std::shared_ptr copyBuffer(const std::shared_ptr& buffer) override; diff --git a/packages/react-native-nitro-test/ios/HybridTestObjectSwift.swift b/packages/react-native-nitro-test/ios/HybridTestObjectSwift.swift index 77aebc259a..30dcb4a87c 100644 --- a/packages/react-native-nitro-test/ios/HybridTestObjectSwift.swift +++ b/packages/react-native-nitro-test/ios/HybridTestObjectSwift.swift @@ -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 { diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JAlbumItem.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JAlbumItem.hpp new file mode 100644 index 0000000000..d7dcebb528 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JAlbumItem.hpp @@ -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 +#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 +#include +#include + +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 { + 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("albumId"); + double albumId = this->getFieldValue(fieldAlbumId); + static const auto fieldName = clazz->getField("name"); + jni::local_ref name = this->getFieldValue(fieldName); + static const auto fieldCover = clazz->getField("cover"); + jni::local_ref cover = this->getFieldValue(fieldCover); + static const auto fieldItems = clazz->getField>("items"); + jni::local_ref> items = this->getFieldValue(fieldItems); + static const auto fieldOwner = clazz->getField("owner"); + jni::local_ref 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 __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 fromCpp(const AlbumItem& value) { + using JSignature = JAlbumItem(double, jni::alias_ref, jni::alias_ref, jni::alias_ref>, jni::alias_ref); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("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> __array = jni::JArrayClass::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 diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JEntityInfo.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JEntityInfo.hpp new file mode 100644 index 0000000000..1f71c5f277 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JEntityInfo.hpp @@ -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 +#include "EntityInfo.hpp" + +#include "JMediaInfo.hpp" +#include "MediaInfo.hpp" +#include +#include +#include + +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 { + 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("entityId"); + double entityId = this->getFieldValue(fieldEntityId); + static const auto fieldTitle = clazz->getField("title"); + jni::local_ref title = this->getFieldValue(fieldTitle); + static const auto fieldMedia = clazz->getField("media"); + jni::local_ref 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 fromCpp(const EntityInfo& value) { + using JSignature = JEntityInfo(double, jni::alias_ref, jni::alias_ref); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("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 diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JGallery.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JGallery.hpp new file mode 100644 index 0000000000..b455e82304 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JGallery.hpp @@ -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 +#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 +#include +#include + +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 { + 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>("albums"); + jni::local_ref> albums = this->getFieldValue(fieldAlbums); + static const auto fieldFeatured = clazz->getField("featured"); + jni::local_ref featured = this->getFieldValue(fieldFeatured); + static const auto fieldOwner = clazz->getField("owner"); + jni::local_ref owner = this->getFieldValue(fieldOwner); + return Gallery( + [&](auto&& __input) { + size_t __size = __input->size(); + std::vector __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 fromCpp(const Gallery& value) { + using JSignature = JGallery(jni::alias_ref>, jni::alias_ref, jni::alias_ref); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + [&](auto&& __input) { + size_t __size = __input.size(); + jni::local_ref> __array = jni::JArrayClass::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 diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JGalleryItem.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JGalleryItem.hpp new file mode 100644 index 0000000000..8a6cbab28a --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JGalleryItem.hpp @@ -0,0 +1,105 @@ +/// +/// JGalleryItem.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "GalleryItem.hpp" + +#include "EntityInfo.hpp" +#include "JEntityInfo.hpp" +#include "JMediaInfo.hpp" +#include "JTagInfo.hpp" +#include "JUserInfo.hpp" +#include "MediaInfo.hpp" +#include "TagInfo.hpp" +#include "UserInfo.hpp" +#include +#include +#include + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "GalleryItem" and the Kotlin data class "GalleryItem". + */ + struct JGalleryItem final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/test/GalleryItem;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct GalleryItem by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + GalleryItem toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldMediaId = clazz->getField("mediaId"); + double mediaId = this->getFieldValue(fieldMediaId); + static const auto fieldUri = clazz->getField("uri"); + jni::local_ref uri = this->getFieldValue(fieldUri); + static const auto fieldMedia = clazz->getField("media"); + jni::local_ref media = this->getFieldValue(fieldMedia); + static const auto fieldTags = clazz->getField>("tags"); + jni::local_ref> tags = this->getFieldValue(fieldTags); + static const auto fieldOwner = clazz->getField("owner"); + jni::local_ref owner = this->getFieldValue(fieldOwner); + static const auto fieldEntity = clazz->getField("entity"); + jni::local_ref entity = this->getFieldValue(fieldEntity); + return GalleryItem( + mediaId, + uri->toStdString(), + media->toCpp(), + tags != nullptr ? std::make_optional([&](auto&& __input) { + size_t __size = __input->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = __input->getElement(__i); + __vector.push_back(__element->toCpp()); + } + return __vector; + }(tags)) : std::nullopt, + owner != nullptr ? std::make_optional(owner->toCpp()) : std::nullopt, + entity != nullptr ? std::make_optional(entity->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 fromCpp(const GalleryItem& value) { + using JSignature = JGalleryItem(double, jni::alias_ref, jni::alias_ref, jni::alias_ref>, jni::alias_ref, jni::alias_ref); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + value.mediaId, + jni::make_jstring(value.uri), + JMediaInfo::fromCpp(value.media), + value.tags.has_value() ? [&](auto&& __input) { + size_t __size = __input.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = __input[__i]; + auto __elementJni = JTagInfo::fromCpp(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }(value.tags.value()) : nullptr, + value.owner.has_value() ? JUserInfo::fromCpp(value.owner.value()) : nullptr, + value.entity.has_value() ? JEntityInfo::fromCpp(value.entity.value()) : nullptr + ); + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JHybridTestObjectSwiftKotlinSpec.cpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JHybridTestObjectSwiftKotlinSpec.cpp index 2ef5373f2b..79f61ebe23 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JHybridTestObjectSwiftKotlinSpec.cpp +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JHybridTestObjectSwiftKotlinSpec.cpp @@ -33,6 +33,20 @@ namespace margelo::nitro::test { struct OptionalWrapper; } namespace margelo::nitro::test { struct OptionalCallback; } // Forward declaration of `OptionalEnumWrapper` to properly resolve imports. namespace margelo::nitro::test { struct OptionalEnumWrapper; } +// Forward declaration of `Gallery` to properly resolve imports. +namespace margelo::nitro::test { struct Gallery; } +// Forward declaration of `AlbumItem` to properly resolve imports. +namespace margelo::nitro::test { struct AlbumItem; } +// Forward declaration of `MediaInfo` to properly resolve imports. +namespace margelo::nitro::test { struct MediaInfo; } +// Forward declaration of `GalleryItem` to properly resolve imports. +namespace margelo::nitro::test { struct GalleryItem; } +// Forward declaration of `TagInfo` to properly resolve imports. +namespace margelo::nitro::test { struct TagInfo; } +// Forward declaration of `EntityInfo` to properly resolve imports. +namespace margelo::nitro::test { struct EntityInfo; } +// Forward declaration of `UserInfo` to properly resolve imports. +namespace margelo::nitro::test { struct UserInfo; } // Forward declaration of `WeirdNumbersEnum` to properly resolve imports. namespace margelo::nitro::test { enum class WeirdNumbersEnum; } // Forward declaration of `HybridBaseSpec` to properly resolve imports. @@ -100,6 +114,20 @@ namespace margelo::nitro::test { class HybridTestViewSpec; } #include "JVariant_______Unit_Double.hpp" #include "OptionalEnumWrapper.hpp" #include "JOptionalEnumWrapper.hpp" +#include "Gallery.hpp" +#include "JGallery.hpp" +#include "AlbumItem.hpp" +#include "JAlbumItem.hpp" +#include "MediaInfo.hpp" +#include "JMediaInfo.hpp" +#include "GalleryItem.hpp" +#include "JGalleryItem.hpp" +#include "TagInfo.hpp" +#include "JTagInfo.hpp" +#include "EntityInfo.hpp" +#include "JEntityInfo.hpp" +#include "UserInfo.hpp" +#include "JUserInfo.hpp" #include "JVariant_OldEnum_Boolean.hpp" #include "JVariant_Powertrain_Car.hpp" #include "WeirdNumbersEnum.hpp" @@ -1241,6 +1269,11 @@ namespace margelo::nitro::test { auto __result = method(_javaPart, value.has_value() ? JOptionalEnumWrapper::fromCpp(value.value()) : nullptr); return __result != nullptr ? std::make_optional(__result->toCpp()) : std::nullopt; } + Gallery JHybridTestObjectSwiftKotlinSpec::bounceGallery(const Gallery& gallery) { + static const auto method = _javaPart->javaClassStatic()->getMethod(jni::alias_ref /* gallery */)>("bounceGallery"); + auto __result = method(_javaPart, JGallery::fromCpp(gallery)); + return __result->toCpp(); + } std::shared_ptr JHybridTestObjectSwiftKotlinSpec::createArrayBuffer() { static const auto method = _javaPart->javaClassStatic()->getMethod()>("createArrayBuffer"); auto __result = method(_javaPart); diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JHybridTestObjectSwiftKotlinSpec.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JHybridTestObjectSwiftKotlinSpec.hpp index a2dbc3f939..baeabddcff 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JHybridTestObjectSwiftKotlinSpec.hpp +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JHybridTestObjectSwiftKotlinSpec.hpp @@ -164,6 +164,7 @@ namespace margelo::nitro::test { OptionalWrapper bounceOptionalWrapper(const OptionalWrapper& wrapper) override; OptionalCallback bounceOptionalCallback(const OptionalCallback& value) override; std::optional bounceOptionalEnumStruct(const std::optional& value) override; + Gallery bounceGallery(const Gallery& gallery) override; std::shared_ptr createArrayBuffer() override; std::shared_ptr createArrayBufferFromNativeBuffer(bool copy) override; std::shared_ptr copyBuffer(const std::shared_ptr& buffer) override; diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JMediaInfo.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JMediaInfo.hpp new file mode 100644 index 0000000000..096caea567 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JMediaInfo.hpp @@ -0,0 +1,89 @@ +/// +/// JMediaInfo.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "MediaInfo.hpp" + +#include +#include +#include + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "MediaInfo" and the Kotlin data class "MediaInfo". + */ + struct JMediaInfo final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/test/MediaInfo;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct MediaInfo by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + MediaInfo toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldTitle = clazz->getField("title"); + jni::local_ref title = this->getFieldValue(fieldTitle); + static const auto fieldDescription = clazz->getField("description"); + jni::local_ref description = this->getFieldValue(fieldDescription); + static const auto fieldTags = clazz->getField>("tags"); + jni::local_ref> tags = this->getFieldValue(fieldTags); + static const auto fieldCoverUrl = clazz->getField("coverUrl"); + jni::local_ref coverUrl = this->getFieldValue(fieldCoverUrl); + return MediaInfo( + title->toStdString(), + description != nullptr ? std::make_optional(description->toStdString()) : std::nullopt, + tags != nullptr ? std::make_optional([&](auto&& __input) { + size_t __size = __input->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = __input->getElement(__i); + __vector.push_back(__element->toStdString()); + } + return __vector; + }(tags)) : std::nullopt, + coverUrl != nullptr ? std::make_optional(coverUrl->toStdString()) : 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 fromCpp(const MediaInfo& value) { + using JSignature = JMediaInfo(jni::alias_ref, jni::alias_ref, jni::alias_ref>, jni::alias_ref); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + jni::make_jstring(value.title), + value.description.has_value() ? jni::make_jstring(value.description.value()) : nullptr, + value.tags.has_value() ? [&](auto&& __input) { + size_t __size = __input.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = __input[__i]; + auto __elementJni = jni::make_jstring(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }(value.tags.value()) : nullptr, + value.coverUrl.has_value() ? jni::make_jstring(value.coverUrl.value()) : nullptr + ); + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JTagInfo.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JTagInfo.hpp new file mode 100644 index 0000000000..433742466e --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JTagInfo.hpp @@ -0,0 +1,77 @@ +/// +/// JTagInfo.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "TagInfo.hpp" + +#include "EntityInfo.hpp" +#include "JEntityInfo.hpp" +#include "JMediaInfo.hpp" +#include "JUserInfo.hpp" +#include "MediaInfo.hpp" +#include "UserInfo.hpp" +#include +#include +#include + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "TagInfo" and the Kotlin data class "TagInfo". + */ + struct JTagInfo final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/test/TagInfo;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct TagInfo by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + TagInfo toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldX = clazz->getField("x"); + double x = this->getFieldValue(fieldX); + static const auto fieldY = clazz->getField("y"); + double y = this->getFieldValue(fieldY); + static const auto fieldEntity = clazz->getField("entity"); + jni::local_ref entity = this->getFieldValue(fieldEntity); + static const auto fieldUser = clazz->getField("user"); + jni::local_ref user = this->getFieldValue(fieldUser); + return TagInfo( + x, + y, + entity != nullptr ? std::make_optional(entity->toCpp()) : std::nullopt, + user != nullptr ? std::make_optional(user->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 fromCpp(const TagInfo& value) { + using JSignature = JTagInfo(double, double, jni::alias_ref, jni::alias_ref); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + value.x, + value.y, + value.entity.has_value() ? JEntityInfo::fromCpp(value.entity.value()) : nullptr, + value.user.has_value() ? JUserInfo::fromCpp(value.user.value()) : nullptr + ); + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JUserInfo.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JUserInfo.hpp new file mode 100644 index 0000000000..b2e18a864d --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JUserInfo.hpp @@ -0,0 +1,75 @@ +/// +/// JUserInfo.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "UserInfo.hpp" + +#include "EntityInfo.hpp" +#include "JEntityInfo.hpp" +#include "JMediaInfo.hpp" +#include "MediaInfo.hpp" +#include +#include +#include + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "UserInfo" and the Kotlin data class "UserInfo". + */ + struct JUserInfo final: public jni::JavaClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/test/UserInfo;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct UserInfo by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + UserInfo toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldUserId = clazz->getField("userId"); + double userId = this->getFieldValue(fieldUserId); + static const auto fieldName = clazz->getField("name"); + jni::local_ref name = this->getFieldValue(fieldName); + static const auto fieldAvatar = clazz->getField("avatar"); + jni::local_ref avatar = this->getFieldValue(fieldAvatar); + static const auto fieldEntity = clazz->getField("entity"); + jni::local_ref entity = this->getFieldValue(fieldEntity); + return UserInfo( + userId, + name->toStdString(), + avatar != nullptr ? std::make_optional(avatar->toCpp()) : std::nullopt, + entity != nullptr ? std::make_optional(entity->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 fromCpp(const UserInfo& value) { + using JSignature = JUserInfo(double, jni::alias_ref, jni::alias_ref, jni::alias_ref); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + value.userId, + jni::make_jstring(value.name), + value.avatar.has_value() ? JMediaInfo::fromCpp(value.avatar.value()) : nullptr, + value.entity.has_value() ? JEntityInfo::fromCpp(value.entity.value()) : nullptr + ); + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/AlbumItem.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/AlbumItem.kt new file mode 100644 index 0000000000..55479f28c1 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/AlbumItem.kt @@ -0,0 +1,71 @@ +/// +/// AlbumItem.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.test + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip +import java.util.Objects + + +/** + * Represents the JavaScript object/struct "AlbumItem". + */ +@DoNotStrip +@Keep +data class AlbumItem( + @DoNotStrip + @Keep + val albumId: Double, + @DoNotStrip + @Keep + val name: String, + @DoNotStrip + @Keep + val cover: MediaInfo?, + @DoNotStrip + @Keep + val items: Array?, + @DoNotStrip + @Keep + val owner: UserInfo? +) { + /* primary constructor */ + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is AlbumItem) return false + return Objects.deepEquals(this.albumId, other.albumId) + && Objects.deepEquals(this.name, other.name) + && Objects.deepEquals(this.cover, other.cover) + && Objects.deepEquals(this.items, other.items) + && Objects.deepEquals(this.owner, other.owner) + } + + override fun hashCode(): Int { + return arrayOf( + albumId, + name, + cover, + items, + owner + ).contentDeepHashCode() + } + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(albumId: Double, name: String, cover: MediaInfo?, items: Array?, owner: UserInfo?): AlbumItem { + return AlbumItem(albumId, name, cover, items, owner) + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/EntityInfo.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/EntityInfo.kt new file mode 100644 index 0000000000..6812451f99 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/EntityInfo.kt @@ -0,0 +1,61 @@ +/// +/// EntityInfo.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.test + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip +import java.util.Objects + + +/** + * Represents the JavaScript object/struct "EntityInfo". + */ +@DoNotStrip +@Keep +data class EntityInfo( + @DoNotStrip + @Keep + val entityId: Double, + @DoNotStrip + @Keep + val title: String, + @DoNotStrip + @Keep + val media: MediaInfo? +) { + /* primary constructor */ + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is EntityInfo) return false + return Objects.deepEquals(this.entityId, other.entityId) + && Objects.deepEquals(this.title, other.title) + && Objects.deepEquals(this.media, other.media) + } + + override fun hashCode(): Int { + return arrayOf( + entityId, + title, + media + ).contentDeepHashCode() + } + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(entityId: Double, title: String, media: MediaInfo?): EntityInfo { + return EntityInfo(entityId, title, media) + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/Gallery.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/Gallery.kt new file mode 100644 index 0000000000..111f3438f8 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/Gallery.kt @@ -0,0 +1,61 @@ +/// +/// Gallery.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.test + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip +import java.util.Objects + + +/** + * Represents the JavaScript object/struct "Gallery". + */ +@DoNotStrip +@Keep +data class Gallery( + @DoNotStrip + @Keep + val albums: Array, + @DoNotStrip + @Keep + val featured: GalleryItem?, + @DoNotStrip + @Keep + val owner: UserInfo +) { + /* primary constructor */ + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Gallery) return false + return Objects.deepEquals(this.albums, other.albums) + && Objects.deepEquals(this.featured, other.featured) + && Objects.deepEquals(this.owner, other.owner) + } + + override fun hashCode(): Int { + return arrayOf( + albums, + featured, + owner + ).contentDeepHashCode() + } + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(albums: Array, featured: GalleryItem?, owner: UserInfo): Gallery { + return Gallery(albums, featured, owner) + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/GalleryItem.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/GalleryItem.kt new file mode 100644 index 0000000000..bd0b690488 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/GalleryItem.kt @@ -0,0 +1,76 @@ +/// +/// GalleryItem.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.test + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip +import java.util.Objects + + +/** + * Represents the JavaScript object/struct "GalleryItem". + */ +@DoNotStrip +@Keep +data class GalleryItem( + @DoNotStrip + @Keep + val mediaId: Double, + @DoNotStrip + @Keep + val uri: String, + @DoNotStrip + @Keep + val media: MediaInfo, + @DoNotStrip + @Keep + val tags: Array?, + @DoNotStrip + @Keep + val owner: UserInfo?, + @DoNotStrip + @Keep + val entity: EntityInfo? +) { + /* primary constructor */ + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is GalleryItem) return false + return Objects.deepEquals(this.mediaId, other.mediaId) + && Objects.deepEquals(this.uri, other.uri) + && Objects.deepEquals(this.media, other.media) + && Objects.deepEquals(this.tags, other.tags) + && Objects.deepEquals(this.owner, other.owner) + && Objects.deepEquals(this.entity, other.entity) + } + + override fun hashCode(): Int { + return arrayOf( + mediaId, + uri, + media, + tags, + owner, + entity + ).contentDeepHashCode() + } + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(mediaId: Double, uri: String, media: MediaInfo, tags: Array?, owner: UserInfo?, entity: EntityInfo?): GalleryItem { + return GalleryItem(mediaId, uri, media, tags, owner, entity) + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/HybridTestObjectSwiftKotlinSpec.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/HybridTestObjectSwiftKotlinSpec.kt index 6b66a01108..60bc18ccbc 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/HybridTestObjectSwiftKotlinSpec.kt +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/HybridTestObjectSwiftKotlinSpec.kt @@ -530,6 +530,10 @@ abstract class HybridTestObjectSwiftKotlinSpec: HybridObject() { @Keep abstract fun bounceOptionalEnumStruct(value: OptionalEnumWrapper?): OptionalEnumWrapper? + @DoNotStrip + @Keep + abstract fun bounceGallery(gallery: Gallery): Gallery + @DoNotStrip @Keep abstract fun createArrayBuffer(): ArrayBuffer diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/MediaInfo.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/MediaInfo.kt new file mode 100644 index 0000000000..d9d390d3d8 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/MediaInfo.kt @@ -0,0 +1,66 @@ +/// +/// MediaInfo.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.test + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip +import java.util.Objects + + +/** + * Represents the JavaScript object/struct "MediaInfo". + */ +@DoNotStrip +@Keep +data class MediaInfo( + @DoNotStrip + @Keep + val title: String, + @DoNotStrip + @Keep + val description: String?, + @DoNotStrip + @Keep + val tags: Array?, + @DoNotStrip + @Keep + val coverUrl: String? +) { + /* primary constructor */ + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is MediaInfo) return false + return Objects.deepEquals(this.title, other.title) + && Objects.deepEquals(this.description, other.description) + && Objects.deepEquals(this.tags, other.tags) + && Objects.deepEquals(this.coverUrl, other.coverUrl) + } + + override fun hashCode(): Int { + return arrayOf( + title, + description, + tags, + coverUrl + ).contentDeepHashCode() + } + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(title: String, description: String?, tags: Array?, coverUrl: String?): MediaInfo { + return MediaInfo(title, description, tags, coverUrl) + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/TagInfo.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/TagInfo.kt new file mode 100644 index 0000000000..ec4f809dc5 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/TagInfo.kt @@ -0,0 +1,66 @@ +/// +/// TagInfo.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.test + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip +import java.util.Objects + + +/** + * Represents the JavaScript object/struct "TagInfo". + */ +@DoNotStrip +@Keep +data class TagInfo( + @DoNotStrip + @Keep + val x: Double, + @DoNotStrip + @Keep + val y: Double, + @DoNotStrip + @Keep + val entity: EntityInfo?, + @DoNotStrip + @Keep + val user: UserInfo? +) { + /* primary constructor */ + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is TagInfo) return false + return Objects.deepEquals(this.x, other.x) + && Objects.deepEquals(this.y, other.y) + && Objects.deepEquals(this.entity, other.entity) + && Objects.deepEquals(this.user, other.user) + } + + override fun hashCode(): Int { + return arrayOf( + x, + y, + entity, + user + ).contentDeepHashCode() + } + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(x: Double, y: Double, entity: EntityInfo?, user: UserInfo?): TagInfo { + return TagInfo(x, y, entity, user) + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/UserInfo.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/UserInfo.kt new file mode 100644 index 0000000000..194a925889 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/UserInfo.kt @@ -0,0 +1,66 @@ +/// +/// UserInfo.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.test + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip +import java.util.Objects + + +/** + * Represents the JavaScript object/struct "UserInfo". + */ +@DoNotStrip +@Keep +data class UserInfo( + @DoNotStrip + @Keep + val userId: Double, + @DoNotStrip + @Keep + val name: String, + @DoNotStrip + @Keep + val avatar: MediaInfo?, + @DoNotStrip + @Keep + val entity: EntityInfo? +) { + /* primary constructor */ + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is UserInfo) return false + return Objects.deepEquals(this.userId, other.userId) + && Objects.deepEquals(this.name, other.name) + && Objects.deepEquals(this.avatar, other.avatar) + && Objects.deepEquals(this.entity, other.entity) + } + + override fun hashCode(): Int { + return arrayOf( + userId, + name, + avatar, + entity + ).contentDeepHashCode() + } + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(userId: Double, name: String, avatar: MediaInfo?, entity: EntityInfo?): UserInfo { + return UserInfo(userId, name, avatar, entity) + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/NitroTest-Swift-Cxx-Bridge.hpp b/packages/react-native-nitro-test/nitrogen/generated/ios/NitroTest-Swift-Cxx-Bridge.hpp index 52d5cce021..00cb4ced9d 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/ios/NitroTest-Swift-Cxx-Bridge.hpp +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/NitroTest-Swift-Cxx-Bridge.hpp @@ -8,12 +8,20 @@ #pragma once // Forward declarations of C++ defined types +// Forward declaration of `AlbumItem` to properly resolve imports. +namespace margelo::nitro::test { struct AlbumItem; } // Forward declaration of `ArrayBufferHolder` to properly resolve imports. namespace NitroModules { class ArrayBufferHolder; } // Forward declaration of `Car` to properly resolve imports. namespace margelo::nitro::test { struct Car; } +// Forward declaration of `EntityInfo` to properly resolve imports. +namespace margelo::nitro::test { struct EntityInfo; } // Forward declaration of `ExternalObjectStruct` to properly resolve imports. namespace margelo::nitro::test { struct ExternalObjectStruct; } +// Forward declaration of `GalleryItem` to properly resolve imports. +namespace margelo::nitro::test { struct GalleryItem; } +// Forward declaration of `Gallery` to properly resolve imports. +namespace margelo::nitro::test { struct Gallery; } // Forward declaration of `HybridBaseSpec` to properly resolve imports. namespace margelo::nitro::test { class HybridBaseSpec; } // Forward declaration of `HybridChildSpec` to properly resolve imports. @@ -30,6 +38,8 @@ namespace margelo::nitro::test { class HybridTestObjectSwiftKotlinSpec; } namespace margelo::nitro::test { class HybridTestViewSpec; } // Forward declaration of `JsStyleStruct` to properly resolve imports. namespace margelo::nitro::test { struct JsStyleStruct; } +// Forward declaration of `MediaInfo` to properly resolve imports. +namespace margelo::nitro::test { struct MediaInfo; } // Forward declaration of `OldEnum` to properly resolve imports. namespace margelo::nitro::test { enum class OldEnum; } // Forward declaration of `OptionalCallback` to properly resolve imports. @@ -44,8 +54,12 @@ namespace margelo::nitro::test { struct PartialPerson; } namespace margelo::nitro::test { struct Person; } // Forward declaration of `Powertrain` to properly resolve imports. namespace margelo::nitro::test { enum class Powertrain; } +// Forward declaration of `TagInfo` to properly resolve imports. +namespace margelo::nitro::test { struct TagInfo; } // Forward declaration of `TruckPowertrain` to properly resolve imports. namespace margelo::nitro::test { enum class TruckPowertrain; } +// Forward declaration of `UserInfo` to properly resolve imports. +namespace margelo::nitro::test { struct UserInfo; } // Forward declaration of `WeirdNumbersEnum` to properly resolve imports. namespace margelo::nitro::test { enum class WeirdNumbersEnum; } // Forward declaration of `WrappedJsStruct` to properly resolve imports. @@ -68,8 +82,12 @@ namespace NitroTest { class HybridTestObjectSwiftKotlinSpec_cxx; } namespace NitroTest { class HybridTestViewSpec_cxx; } // Include C++ defined types +#include "AlbumItem.hpp" #include "Car.hpp" +#include "EntityInfo.hpp" #include "ExternalObjectStruct.hpp" +#include "Gallery.hpp" +#include "GalleryItem.hpp" #include "HybridBaseSpec.hpp" #include "HybridChildSpec.hpp" #include "HybridPlatformObjectSpec.hpp" @@ -77,6 +95,7 @@ namespace NitroTest { class HybridTestViewSpec_cxx; } #include "HybridTestObjectSwiftKotlinSpec.hpp" #include "HybridTestViewSpec.hpp" #include "JsStyleStruct.hpp" +#include "MediaInfo.hpp" #include "OldEnum.hpp" #include "OptionalCallback.hpp" #include "OptionalEnumWrapper.hpp" @@ -84,7 +103,9 @@ namespace NitroTest { class HybridTestViewSpec_cxx; } #include "PartialPerson.hpp" #include "Person.hpp" #include "Powertrain.hpp" +#include "TagInfo.hpp" #include "TruckPowertrain.hpp" +#include "UserInfo.hpp" #include "WeirdNumbersEnum.hpp" #include "WrappedJsStruct.hpp" #include @@ -1331,6 +1352,129 @@ namespace margelo::nitro::test::bridge::swift { return optional.value(); } + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_MediaInfo_ = std::optional; + inline std::optional create_std__optional_MediaInfo_(const MediaInfo& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_MediaInfo_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline MediaInfo get_std__optional_MediaInfo_(const std::optional& optional) noexcept { + return optional.value(); + } + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_EntityInfo_ = std::optional; + inline std::optional create_std__optional_EntityInfo_(const EntityInfo& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_EntityInfo_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline EntityInfo get_std__optional_EntityInfo_(const std::optional& optional) noexcept { + return optional.value(); + } + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_UserInfo_ = std::optional; + inline std::optional create_std__optional_UserInfo_(const UserInfo& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_UserInfo_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline UserInfo get_std__optional_UserInfo_(const std::optional& optional) noexcept { + return optional.value(); + } + + // pragma MARK: std::vector + /** + * Specialized version of `std::vector`. + */ + using std__vector_TagInfo_ = std::vector; + inline std::vector create_std__vector_TagInfo_(size_t size) noexcept { + std::vector vector; + vector.reserve(size); + return vector; + } + + // pragma MARK: std::optional> + /** + * Specialized version of `std::optional>`. + */ + using std__optional_std__vector_TagInfo__ = std::optional>; + inline std::optional> create_std__optional_std__vector_TagInfo__(const std::vector& value) noexcept { + return std::optional>(value); + } + inline bool has_value_std__optional_std__vector_TagInfo__(const std::optional>& optional) noexcept { + return optional.has_value(); + } + inline std::vector get_std__optional_std__vector_TagInfo__(const std::optional>& optional) noexcept { + return optional.value(); + } + + // pragma MARK: std::vector + /** + * Specialized version of `std::vector`. + */ + using std__vector_GalleryItem_ = std::vector; + inline std::vector create_std__vector_GalleryItem_(size_t size) noexcept { + std::vector vector; + vector.reserve(size); + return vector; + } + + // pragma MARK: std::optional> + /** + * Specialized version of `std::optional>`. + */ + using std__optional_std__vector_GalleryItem__ = std::optional>; + inline std::optional> create_std__optional_std__vector_GalleryItem__(const std::vector& value) noexcept { + return std::optional>(value); + } + inline bool has_value_std__optional_std__vector_GalleryItem__(const std::optional>& optional) noexcept { + return optional.has_value(); + } + inline std::vector get_std__optional_std__vector_GalleryItem__(const std::optional>& optional) noexcept { + return optional.value(); + } + + // pragma MARK: std::vector + /** + * Specialized version of `std::vector`. + */ + using std__vector_AlbumItem_ = std::vector; + inline std::vector create_std__vector_AlbumItem_(size_t size) noexcept { + std::vector vector; + vector.reserve(size); + return vector; + } + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_GalleryItem_ = std::optional; + inline std::optional create_std__optional_GalleryItem_(const GalleryItem& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_GalleryItem_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline GalleryItem get_std__optional_GalleryItem_(const std::optional& optional) noexcept { + return optional.value(); + } + // pragma MARK: std::variant, std::vector, double, std::string> /** * Wrapper struct for `std::variant, std::vector, double, std::string>`. @@ -2026,6 +2170,15 @@ namespace margelo::nitro::test::bridge::swift { return Result>::withError(error); } + // pragma MARK: Result + using Result_Gallery_ = Result; + inline Result_Gallery_ create_Result_Gallery_(const Gallery& value) noexcept { + return Result::withValue(value); + } + inline Result_Gallery_ create_Result_Gallery_(const std::exception_ptr& error) noexcept { + return Result::withError(error); + } + // pragma MARK: Result> using Result_std__shared_ptr_ArrayBuffer__ = Result>; inline Result_std__shared_ptr_ArrayBuffer__ create_Result_std__shared_ptr_ArrayBuffer__(const std::shared_ptr& value) noexcept { diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/NitroTest-Swift-Cxx-Umbrella.hpp b/packages/react-native-nitro-test/nitrogen/generated/ios/NitroTest-Swift-Cxx-Umbrella.hpp index 89a8b77d90..4cf206cdf9 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/ios/NitroTest-Swift-Cxx-Umbrella.hpp +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/NitroTest-Swift-Cxx-Umbrella.hpp @@ -8,12 +8,20 @@ #pragma once // Forward declarations of C++ defined types +// Forward declaration of `AlbumItem` to properly resolve imports. +namespace margelo::nitro::test { struct AlbumItem; } // Forward declaration of `Car` to properly resolve imports. namespace margelo::nitro::test { struct Car; } // Forward declaration of `ColorScheme` to properly resolve imports. namespace margelo::nitro::test { enum class ColorScheme; } +// Forward declaration of `EntityInfo` to properly resolve imports. +namespace margelo::nitro::test { struct EntityInfo; } // Forward declaration of `ExternalObjectStruct` to properly resolve imports. namespace margelo::nitro::test { struct ExternalObjectStruct; } +// Forward declaration of `GalleryItem` to properly resolve imports. +namespace margelo::nitro::test { struct GalleryItem; } +// Forward declaration of `Gallery` to properly resolve imports. +namespace margelo::nitro::test { struct Gallery; } // Forward declaration of `HybridBaseSpec` to properly resolve imports. namespace margelo::nitro::test { class HybridBaseSpec; } // Forward declaration of `HybridChildSpec` to properly resolve imports. @@ -32,6 +40,8 @@ namespace margelo::nitro::test { class HybridTestViewSpec; } namespace margelo::nitro::test { struct JsStyleStruct; } // Forward declaration of `MapWrapper` to properly resolve imports. namespace margelo::nitro::test { struct MapWrapper; } +// Forward declaration of `MediaInfo` to properly resolve imports. +namespace margelo::nitro::test { struct MediaInfo; } // Forward declaration of `OldEnum` to properly resolve imports. namespace margelo::nitro::test { enum class OldEnum; } // Forward declaration of `OptionalCallback` to properly resolve imports. @@ -48,17 +58,25 @@ namespace margelo::nitro::test { struct Person; } namespace margelo::nitro::test { enum class Powertrain; } // Forward declaration of `SecondMapWrapper` to properly resolve imports. namespace margelo::nitro::test { struct SecondMapWrapper; } +// Forward declaration of `TagInfo` to properly resolve imports. +namespace margelo::nitro::test { struct TagInfo; } // Forward declaration of `TruckPowertrain` to properly resolve imports. namespace margelo::nitro::test { enum class TruckPowertrain; } +// Forward declaration of `UserInfo` to properly resolve imports. +namespace margelo::nitro::test { struct UserInfo; } // Forward declaration of `WeirdNumbersEnum` to properly resolve imports. namespace margelo::nitro::test { enum class WeirdNumbersEnum; } // Forward declaration of `WrappedJsStruct` to properly resolve imports. namespace margelo::nitro::test { struct WrappedJsStruct; } // Include C++ defined types +#include "AlbumItem.hpp" #include "Car.hpp" #include "ColorScheme.hpp" +#include "EntityInfo.hpp" #include "ExternalObjectStruct.hpp" +#include "Gallery.hpp" +#include "GalleryItem.hpp" #include "HybridBaseSpec.hpp" #include "HybridChildSpec.hpp" #include "HybridPlatformObjectSpec.hpp" @@ -67,6 +85,7 @@ namespace margelo::nitro::test { struct WrappedJsStruct; } #include "HybridTestViewSpec.hpp" #include "JsStyleStruct.hpp" #include "MapWrapper.hpp" +#include "MediaInfo.hpp" #include "OldEnum.hpp" #include "OptionalCallback.hpp" #include "OptionalEnumWrapper.hpp" @@ -75,7 +94,9 @@ namespace margelo::nitro::test { struct WrappedJsStruct; } #include "Person.hpp" #include "Powertrain.hpp" #include "SecondMapWrapper.hpp" +#include "TagInfo.hpp" #include "TruckPowertrain.hpp" +#include "UserInfo.hpp" #include "WeirdNumbersEnum.hpp" #include "WrappedJsStruct.hpp" #include diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/c++/HybridTestObjectSwiftKotlinSpecSwift.hpp b/packages/react-native-nitro-test/nitrogen/generated/ios/c++/HybridTestObjectSwiftKotlinSpecSwift.hpp index b37f339c16..a0ad3b6bfe 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/ios/c++/HybridTestObjectSwiftKotlinSpecSwift.hpp +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/c++/HybridTestObjectSwiftKotlinSpecSwift.hpp @@ -44,6 +44,20 @@ namespace margelo::nitro::test { struct OptionalWrapper; } namespace margelo::nitro::test { struct OptionalCallback; } // Forward declaration of `OptionalEnumWrapper` to properly resolve imports. namespace margelo::nitro::test { struct OptionalEnumWrapper; } +// Forward declaration of `Gallery` to properly resolve imports. +namespace margelo::nitro::test { struct Gallery; } +// Forward declaration of `AlbumItem` to properly resolve imports. +namespace margelo::nitro::test { struct AlbumItem; } +// Forward declaration of `MediaInfo` to properly resolve imports. +namespace margelo::nitro::test { struct MediaInfo; } +// Forward declaration of `GalleryItem` to properly resolve imports. +namespace margelo::nitro::test { struct GalleryItem; } +// Forward declaration of `TagInfo` to properly resolve imports. +namespace margelo::nitro::test { struct TagInfo; } +// Forward declaration of `EntityInfo` to properly resolve imports. +namespace margelo::nitro::test { struct EntityInfo; } +// Forward declaration of `UserInfo` to properly resolve imports. +namespace margelo::nitro::test { struct UserInfo; } // Forward declaration of `WeirdNumbersEnum` to properly resolve imports. namespace margelo::nitro::test { enum class WeirdNumbersEnum; } // Forward declaration of `HybridBaseSpec` to properly resolve imports. @@ -84,6 +98,13 @@ namespace margelo::nitro::test { struct ExternalObjectStruct; } #include "OptionalWrapper.hpp" #include "OptionalCallback.hpp" #include "OptionalEnumWrapper.hpp" +#include "Gallery.hpp" +#include "AlbumItem.hpp" +#include "MediaInfo.hpp" +#include "GalleryItem.hpp" +#include "TagInfo.hpp" +#include "EntityInfo.hpp" +#include "UserInfo.hpp" #include "WeirdNumbersEnum.hpp" #include "HybridBaseSpec.hpp" #include "HybridTestViewSpec.hpp" @@ -825,6 +846,14 @@ namespace margelo::nitro::test { auto __value = std::move(__result.value()); return __value; } + inline Gallery bounceGallery(const Gallery& gallery) override { + auto __result = _swiftPart.bounceGallery(std::forward(gallery)); + if (__result.hasError()) [[unlikely]] { + std::rethrow_exception(__result.error()); + } + auto __value = std::move(__result.value()); + return __value; + } inline std::shared_ptr createArrayBuffer() override { auto __result = _swiftPart.createArrayBuffer(); if (__result.hasError()) [[unlikely]] { diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/AlbumItem.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/AlbumItem.swift new file mode 100644 index 0000000000..35a3089a2e --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/AlbumItem.swift @@ -0,0 +1,80 @@ +/// +/// AlbumItem.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `AlbumItem`, backed by a C++ struct. + */ +public typealias AlbumItem = margelo.nitro.test.AlbumItem + +public extension AlbumItem { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `AlbumItem`. + */ + init(albumId: Double, name: String, cover: MediaInfo?, items: [GalleryItem]?, owner: UserInfo?) { + self.init(albumId, std.string(name), { () -> bridge.std__optional_MediaInfo_ in + if let __unwrappedValue = cover { + return bridge.create_std__optional_MediaInfo_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_std__vector_GalleryItem__ in + if let __unwrappedValue = items { + return bridge.create_std__optional_std__vector_GalleryItem__({ () -> bridge.std__vector_GalleryItem_ in + var __vector = bridge.create_std__vector_GalleryItem_(__unwrappedValue.count) + for __item in __unwrappedValue { + __vector.push_back(__item) + } + return __vector + }()) + } else { + return .init() + } + }(), { () -> bridge.std__optional_UserInfo_ in + if let __unwrappedValue = owner { + return bridge.create_std__optional_UserInfo_(__unwrappedValue) + } else { + return .init() + } + }()) + } + + @inline(__always) + var albumId: Double { + return self.__albumId + } + + @inline(__always) + var name: String { + return String(self.__name) + } + + @inline(__always) + var cover: MediaInfo? { + return self.__cover.value + } + + @inline(__always) + var items: [GalleryItem]? { + return { () -> [GalleryItem]? in + if bridge.has_value_std__optional_std__vector_GalleryItem__(self.__items) { + let __unwrapped = bridge.get_std__optional_std__vector_GalleryItem__(self.__items) + return __unwrapped.map({ __item in __item }) + } else { + return nil + } + }() + } + + @inline(__always) + var owner: UserInfo? { + return self.__owner.value + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/EntityInfo.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/EntityInfo.swift new file mode 100644 index 0000000000..88d7515242 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/EntityInfo.swift @@ -0,0 +1,45 @@ +/// +/// EntityInfo.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `EntityInfo`, backed by a C++ struct. + */ +public typealias EntityInfo = margelo.nitro.test.EntityInfo + +public extension EntityInfo { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `EntityInfo`. + */ + init(entityId: Double, title: String, media: MediaInfo?) { + self.init(entityId, std.string(title), { () -> bridge.std__optional_MediaInfo_ in + if let __unwrappedValue = media { + return bridge.create_std__optional_MediaInfo_(__unwrappedValue) + } else { + return .init() + } + }()) + } + + @inline(__always) + var entityId: Double { + return self.__entityId + } + + @inline(__always) + var title: String { + return String(self.__title) + } + + @inline(__always) + var media: MediaInfo? { + return self.__media.value + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/Gallery.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/Gallery.swift new file mode 100644 index 0000000000..3f1eedc099 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/Gallery.swift @@ -0,0 +1,51 @@ +/// +/// Gallery.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `Gallery`, backed by a C++ struct. + */ +public typealias Gallery = margelo.nitro.test.Gallery + +public extension Gallery { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `Gallery`. + */ + init(albums: [AlbumItem], featured: GalleryItem?, owner: UserInfo) { + self.init({ () -> bridge.std__vector_AlbumItem_ in + var __vector = bridge.create_std__vector_AlbumItem_(albums.count) + for __item in albums { + __vector.push_back(__item) + } + return __vector + }(), { () -> bridge.std__optional_GalleryItem_ in + if let __unwrappedValue = featured { + return bridge.create_std__optional_GalleryItem_(__unwrappedValue) + } else { + return .init() + } + }(), owner) + } + + @inline(__always) + var albums: [AlbumItem] { + return self.__albums.map({ __item in __item }) + } + + @inline(__always) + var featured: GalleryItem? { + return self.__featured.value + } + + @inline(__always) + var owner: UserInfo { + return self.__owner + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/GalleryItem.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/GalleryItem.swift new file mode 100644 index 0000000000..657916485c --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/GalleryItem.swift @@ -0,0 +1,85 @@ +/// +/// GalleryItem.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `GalleryItem`, backed by a C++ struct. + */ +public typealias GalleryItem = margelo.nitro.test.GalleryItem + +public extension GalleryItem { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `GalleryItem`. + */ + init(mediaId: Double, uri: String, media: MediaInfo, tags: [TagInfo]?, owner: UserInfo?, entity: EntityInfo?) { + self.init(mediaId, std.string(uri), media, { () -> bridge.std__optional_std__vector_TagInfo__ in + if let __unwrappedValue = tags { + return bridge.create_std__optional_std__vector_TagInfo__({ () -> bridge.std__vector_TagInfo_ in + var __vector = bridge.create_std__vector_TagInfo_(__unwrappedValue.count) + for __item in __unwrappedValue { + __vector.push_back(__item) + } + return __vector + }()) + } else { + return .init() + } + }(), { () -> bridge.std__optional_UserInfo_ in + if let __unwrappedValue = owner { + return bridge.create_std__optional_UserInfo_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_EntityInfo_ in + if let __unwrappedValue = entity { + return bridge.create_std__optional_EntityInfo_(__unwrappedValue) + } else { + return .init() + } + }()) + } + + @inline(__always) + var mediaId: Double { + return self.__mediaId + } + + @inline(__always) + var uri: String { + return String(self.__uri) + } + + @inline(__always) + var media: MediaInfo { + return self.__media + } + + @inline(__always) + var tags: [TagInfo]? { + return { () -> [TagInfo]? in + if bridge.has_value_std__optional_std__vector_TagInfo__(self.__tags) { + let __unwrapped = bridge.get_std__optional_std__vector_TagInfo__(self.__tags) + return __unwrapped.map({ __item in __item }) + } else { + return nil + } + }() + } + + @inline(__always) + var owner: UserInfo? { + return self.__owner.value + } + + @inline(__always) + var entity: EntityInfo? { + return self.__entity.value + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/HybridTestObjectSwiftKotlinSpec.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/HybridTestObjectSwiftKotlinSpec.swift index 30c10fb45d..16a15d58b7 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/HybridTestObjectSwiftKotlinSpec.swift +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/HybridTestObjectSwiftKotlinSpec.swift @@ -106,6 +106,7 @@ public protocol HybridTestObjectSwiftKotlinSpec_protocol: HybridObject { func bounceOptionalWrapper(wrapper: OptionalWrapper) throws -> OptionalWrapper func bounceOptionalCallback(value: OptionalCallback) throws -> OptionalCallback func bounceOptionalEnumStruct(value: OptionalEnumWrapper?) throws -> OptionalEnumWrapper? + func bounceGallery(gallery: Gallery) throws -> Gallery func createArrayBuffer() throws -> ArrayBuffer func createArrayBufferFromNativeBuffer(copy: Bool) throws -> ArrayBuffer func copyBuffer(buffer: ArrayBuffer) throws -> ArrayBuffer diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/HybridTestObjectSwiftKotlinSpec_cxx.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/HybridTestObjectSwiftKotlinSpec_cxx.swift index eebb54ebd7..968417821d 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/HybridTestObjectSwiftKotlinSpec_cxx.swift +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/HybridTestObjectSwiftKotlinSpec_cxx.swift @@ -2019,6 +2019,18 @@ open class HybridTestObjectSwiftKotlinSpec_cxx { } } + @inline(__always) + public final func bounceGallery(gallery: Gallery) -> bridge.Result_Gallery_ { + do { + let __result = try self.__implementation.bounceGallery(gallery: gallery) + let __resultCpp = __result + return bridge.create_Result_Gallery_(__resultCpp) + } catch (let __error) { + let __exceptionPtr = __error.toCpp() + return bridge.create_Result_Gallery_(__exceptionPtr) + } + } + @inline(__always) public final func createArrayBuffer() -> bridge.Result_std__shared_ptr_ArrayBuffer__ { do { diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/MediaInfo.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/MediaInfo.swift new file mode 100644 index 0000000000..5d0c4a33ed --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/MediaInfo.swift @@ -0,0 +1,89 @@ +/// +/// MediaInfo.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `MediaInfo`, backed by a C++ struct. + */ +public typealias MediaInfo = margelo.nitro.test.MediaInfo + +public extension MediaInfo { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `MediaInfo`. + */ + init(title: String, description: String?, tags: [String]?, coverUrl: String?) { + self.init(std.string(title), { () -> bridge.std__optional_std__string_ in + if let __unwrappedValue = description { + return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) + } else { + return .init() + } + }(), { () -> bridge.std__optional_std__vector_std__string__ in + if let __unwrappedValue = tags { + return bridge.create_std__optional_std__vector_std__string__({ () -> bridge.std__vector_std__string_ in + var __vector = bridge.create_std__vector_std__string_(__unwrappedValue.count) + for __item in __unwrappedValue { + __vector.push_back(std.string(__item)) + } + return __vector + }()) + } else { + return .init() + } + }(), { () -> bridge.std__optional_std__string_ in + if let __unwrappedValue = coverUrl { + return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) + } else { + return .init() + } + }()) + } + + @inline(__always) + var title: String { + return String(self.__title) + } + + @inline(__always) + var description: String? { + return { () -> String? in + if bridge.has_value_std__optional_std__string_(self.__description) { + let __unwrapped = bridge.get_std__optional_std__string_(self.__description) + return String(__unwrapped) + } else { + return nil + } + }() + } + + @inline(__always) + var tags: [String]? { + return { () -> [String]? in + if bridge.has_value_std__optional_std__vector_std__string__(self.__tags) { + let __unwrapped = bridge.get_std__optional_std__vector_std__string__(self.__tags) + return __unwrapped.map({ __item in String(__item) }) + } else { + return nil + } + }() + } + + @inline(__always) + var coverUrl: String? { + return { () -> String? in + if bridge.has_value_std__optional_std__string_(self.__coverUrl) { + let __unwrapped = bridge.get_std__optional_std__string_(self.__coverUrl) + return String(__unwrapped) + } else { + return nil + } + }() + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/TagInfo.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/TagInfo.swift new file mode 100644 index 0000000000..a5e0fbf663 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/TagInfo.swift @@ -0,0 +1,56 @@ +/// +/// TagInfo.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `TagInfo`, backed by a C++ struct. + */ +public typealias TagInfo = margelo.nitro.test.TagInfo + +public extension TagInfo { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `TagInfo`. + */ + init(x: Double, y: Double, entity: EntityInfo?, user: UserInfo?) { + self.init(x, y, { () -> bridge.std__optional_EntityInfo_ in + if let __unwrappedValue = entity { + return bridge.create_std__optional_EntityInfo_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_UserInfo_ in + if let __unwrappedValue = user { + return bridge.create_std__optional_UserInfo_(__unwrappedValue) + } else { + return .init() + } + }()) + } + + @inline(__always) + var x: Double { + return self.__x + } + + @inline(__always) + var y: Double { + return self.__y + } + + @inline(__always) + var entity: EntityInfo? { + return self.__entity.value + } + + @inline(__always) + var user: UserInfo? { + return self.__user.value + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/UserInfo.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/UserInfo.swift new file mode 100644 index 0000000000..e864a38f4b --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/UserInfo.swift @@ -0,0 +1,56 @@ +/// +/// UserInfo.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `UserInfo`, backed by a C++ struct. + */ +public typealias UserInfo = margelo.nitro.test.UserInfo + +public extension UserInfo { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `UserInfo`. + */ + init(userId: Double, name: String, avatar: MediaInfo?, entity: EntityInfo?) { + self.init(userId, std.string(name), { () -> bridge.std__optional_MediaInfo_ in + if let __unwrappedValue = avatar { + return bridge.create_std__optional_MediaInfo_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_EntityInfo_ in + if let __unwrappedValue = entity { + return bridge.create_std__optional_EntityInfo_(__unwrappedValue) + } else { + return .init() + } + }()) + } + + @inline(__always) + var userId: Double { + return self.__userId + } + + @inline(__always) + var name: String { + return String(self.__name) + } + + @inline(__always) + var avatar: MediaInfo? { + return self.__avatar.value + } + + @inline(__always) + var entity: EntityInfo? { + return self.__entity.value + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/AlbumItem.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/AlbumItem.hpp new file mode 100644 index 0000000000..e82612ebf9 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/AlbumItem.hpp @@ -0,0 +1,109 @@ +/// +/// AlbumItem.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `MediaInfo` to properly resolve imports. +namespace margelo::nitro::test { struct MediaInfo; } +// Forward declaration of `GalleryItem` to properly resolve imports. +namespace margelo::nitro::test { struct GalleryItem; } +// Forward declaration of `UserInfo` to properly resolve imports. +namespace margelo::nitro::test { struct UserInfo; } + +#include +#include "MediaInfo.hpp" +#include +#include "GalleryItem.hpp" +#include +#include "UserInfo.hpp" + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (AlbumItem). + */ + struct AlbumItem final { + public: + double albumId SWIFT_PRIVATE; + std::string name SWIFT_PRIVATE; + std::optional cover SWIFT_PRIVATE; + std::optional> items SWIFT_PRIVATE; + std::optional owner SWIFT_PRIVATE; + + public: + AlbumItem() = default; + explicit AlbumItem(double albumId, std::string name, std::optional cover, std::optional> items, std::optional owner): albumId(albumId), name(name), cover(cover), items(items), owner(owner) {} + + public: + friend bool operator==(const AlbumItem& lhs, const AlbumItem& rhs) = default; + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ AlbumItem <> JS AlbumItem (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::AlbumItem fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::AlbumItem( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "albumId"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cover"))), + JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "items"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "owner"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::AlbumItem& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "albumId"), JSIConverter::toJSI(runtime, arg.albumId)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter::toJSI(runtime, arg.name)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "cover"), JSIConverter>::toJSI(runtime, arg.cover)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "items"), JSIConverter>>::toJSI(runtime, arg.items)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "owner"), JSIConverter>::toJSI(runtime, arg.owner)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "albumId")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cover")))) return false; + if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "items")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "owner")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/EntityInfo.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/EntityInfo.hpp new file mode 100644 index 0000000000..9ff2b6d719 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/EntityInfo.hpp @@ -0,0 +1,94 @@ +/// +/// EntityInfo.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `MediaInfo` to properly resolve imports. +namespace margelo::nitro::test { struct MediaInfo; } + +#include +#include "MediaInfo.hpp" +#include + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (EntityInfo). + */ + struct EntityInfo final { + public: + double entityId SWIFT_PRIVATE; + std::string title SWIFT_PRIVATE; + std::optional media SWIFT_PRIVATE; + + public: + EntityInfo() = default; + explicit EntityInfo(double entityId, std::string title, std::optional media): entityId(entityId), title(title), media(media) {} + + public: + friend bool operator==(const EntityInfo& lhs, const EntityInfo& rhs) = default; + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ EntityInfo <> JS EntityInfo (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::EntityInfo fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::EntityInfo( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "entityId"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "title"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "media"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::EntityInfo& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "entityId"), JSIConverter::toJSI(runtime, arg.entityId)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "title"), JSIConverter::toJSI(runtime, arg.title)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "media"), JSIConverter>::toJSI(runtime, arg.media)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "entityId")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "title")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "media")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/Gallery.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/Gallery.hpp new file mode 100644 index 0000000000..e7aefce71e --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/Gallery.hpp @@ -0,0 +1,100 @@ +/// +/// Gallery.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `AlbumItem` to properly resolve imports. +namespace margelo::nitro::test { struct AlbumItem; } +// Forward declaration of `GalleryItem` to properly resolve imports. +namespace margelo::nitro::test { struct GalleryItem; } +// Forward declaration of `UserInfo` to properly resolve imports. +namespace margelo::nitro::test { struct UserInfo; } + +#include "AlbumItem.hpp" +#include +#include "GalleryItem.hpp" +#include +#include "UserInfo.hpp" + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (Gallery). + */ + struct Gallery final { + public: + std::vector albums SWIFT_PRIVATE; + std::optional featured SWIFT_PRIVATE; + UserInfo owner SWIFT_PRIVATE; + + public: + Gallery() = default; + explicit Gallery(std::vector albums, std::optional featured, UserInfo owner): albums(albums), featured(featured), owner(owner) {} + + public: + friend bool operator==(const Gallery& lhs, const Gallery& rhs) = default; + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ Gallery <> JS Gallery (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::Gallery fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::Gallery( + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "albums"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "featured"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "owner"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::Gallery& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "albums"), JSIConverter>::toJSI(runtime, arg.albums)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "featured"), JSIConverter>::toJSI(runtime, arg.featured)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "owner"), JSIConverter::toJSI(runtime, arg.owner)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "albums")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "featured")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "owner")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/GalleryItem.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/GalleryItem.hpp new file mode 100644 index 0000000000..b726a3877e --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/GalleryItem.hpp @@ -0,0 +1,116 @@ +/// +/// GalleryItem.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `MediaInfo` to properly resolve imports. +namespace margelo::nitro::test { struct MediaInfo; } +// Forward declaration of `TagInfo` to properly resolve imports. +namespace margelo::nitro::test { struct TagInfo; } +// Forward declaration of `UserInfo` to properly resolve imports. +namespace margelo::nitro::test { struct UserInfo; } +// Forward declaration of `EntityInfo` to properly resolve imports. +namespace margelo::nitro::test { struct EntityInfo; } + +#include +#include "MediaInfo.hpp" +#include "TagInfo.hpp" +#include +#include +#include "UserInfo.hpp" +#include "EntityInfo.hpp" + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (GalleryItem). + */ + struct GalleryItem final { + public: + double mediaId SWIFT_PRIVATE; + std::string uri SWIFT_PRIVATE; + MediaInfo media SWIFT_PRIVATE; + std::optional> tags SWIFT_PRIVATE; + std::optional owner SWIFT_PRIVATE; + std::optional entity SWIFT_PRIVATE; + + public: + GalleryItem() = default; + explicit GalleryItem(double mediaId, std::string uri, MediaInfo media, std::optional> tags, std::optional owner, std::optional entity): mediaId(mediaId), uri(uri), media(media), tags(tags), owner(owner), entity(entity) {} + + public: + friend bool operator==(const GalleryItem& lhs, const GalleryItem& rhs) = default; + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ GalleryItem <> JS GalleryItem (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::GalleryItem fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::GalleryItem( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mediaId"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uri"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "media"))), + JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "tags"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "owner"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "entity"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::GalleryItem& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "mediaId"), JSIConverter::toJSI(runtime, arg.mediaId)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "uri"), JSIConverter::toJSI(runtime, arg.uri)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "media"), JSIConverter::toJSI(runtime, arg.media)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "tags"), JSIConverter>>::toJSI(runtime, arg.tags)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "owner"), JSIConverter>::toJSI(runtime, arg.owner)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "entity"), JSIConverter>::toJSI(runtime, arg.entity)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mediaId")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uri")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "media")))) return false; + if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "tags")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "owner")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "entity")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/HybridTestObjectCppSpec.cpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/HybridTestObjectCppSpec.cpp index e285c1e002..5358a5e91f 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/HybridTestObjectCppSpec.cpp +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/HybridTestObjectCppSpec.cpp @@ -133,6 +133,7 @@ namespace margelo::nitro::test { prototype.registerHybridMethod("bounceOptionalWrapper", &HybridTestObjectCppSpec::bounceOptionalWrapper); prototype.registerHybridMethod("bounceOptionalCallback", &HybridTestObjectCppSpec::bounceOptionalCallback); prototype.registerHybridMethod("bounceOptionalEnumStruct", &HybridTestObjectCppSpec::bounceOptionalEnumStruct); + prototype.registerHybridMethod("bounceGallery", &HybridTestObjectCppSpec::bounceGallery); prototype.registerHybridMethod("createArrayBuffer", &HybridTestObjectCppSpec::createArrayBuffer); prototype.registerHybridMethod("createArrayBufferFromNativeBuffer", &HybridTestObjectCppSpec::createArrayBufferFromNativeBuffer); prototype.registerHybridMethod("copyBuffer", &HybridTestObjectCppSpec::copyBuffer); diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/HybridTestObjectCppSpec.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/HybridTestObjectCppSpec.hpp index 7b43759042..ba5616530b 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/HybridTestObjectCppSpec.hpp +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/HybridTestObjectCppSpec.hpp @@ -43,6 +43,8 @@ namespace margelo::nitro::test { struct OptionalWrapper; } namespace margelo::nitro::test { struct OptionalCallback; } // Forward declaration of `OptionalEnumWrapper` to properly resolve imports. namespace margelo::nitro::test { struct OptionalEnumWrapper; } +// Forward declaration of `Gallery` to properly resolve imports. +namespace margelo::nitro::test { struct Gallery; } // Forward declaration of `WeirdNumbersEnum` to properly resolve imports. namespace margelo::nitro::test { enum class WeirdNumbersEnum; } // Forward declaration of `HybridBaseSpec` to properly resolve imports. @@ -84,6 +86,7 @@ namespace margelo::nitro::test { struct ExternalObjectStruct; } #include "OptionalWrapper.hpp" #include "OptionalCallback.hpp" #include "OptionalEnumWrapper.hpp" +#include "Gallery.hpp" #include "WeirdNumbersEnum.hpp" #include "HybridBaseSpec.hpp" #include "HybridTestViewSpec.hpp" @@ -239,6 +242,7 @@ namespace margelo::nitro::test { virtual OptionalWrapper bounceOptionalWrapper(const OptionalWrapper& wrapper) = 0; virtual OptionalCallback bounceOptionalCallback(const OptionalCallback& value) = 0; virtual std::optional bounceOptionalEnumStruct(const std::optional& value) = 0; + virtual Gallery bounceGallery(const Gallery& gallery) = 0; virtual std::shared_ptr createArrayBuffer() = 0; virtual std::shared_ptr createArrayBufferFromNativeBuffer(bool copy) = 0; virtual std::shared_ptr copyBuffer(const std::shared_ptr& buffer) = 0; diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/HybridTestObjectSwiftKotlinSpec.cpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/HybridTestObjectSwiftKotlinSpec.cpp index 4eda843e04..dc678d8601 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/HybridTestObjectSwiftKotlinSpec.cpp +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/HybridTestObjectSwiftKotlinSpec.cpp @@ -125,6 +125,7 @@ namespace margelo::nitro::test { prototype.registerHybridMethod("bounceOptionalWrapper", &HybridTestObjectSwiftKotlinSpec::bounceOptionalWrapper); prototype.registerHybridMethod("bounceOptionalCallback", &HybridTestObjectSwiftKotlinSpec::bounceOptionalCallback); prototype.registerHybridMethod("bounceOptionalEnumStruct", &HybridTestObjectSwiftKotlinSpec::bounceOptionalEnumStruct); + prototype.registerHybridMethod("bounceGallery", &HybridTestObjectSwiftKotlinSpec::bounceGallery); prototype.registerHybridMethod("createArrayBuffer", &HybridTestObjectSwiftKotlinSpec::createArrayBuffer); prototype.registerHybridMethod("createArrayBufferFromNativeBuffer", &HybridTestObjectSwiftKotlinSpec::createArrayBufferFromNativeBuffer); prototype.registerHybridMethod("copyBuffer", &HybridTestObjectSwiftKotlinSpec::copyBuffer); diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/HybridTestObjectSwiftKotlinSpec.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/HybridTestObjectSwiftKotlinSpec.hpp index b618cf43a3..ac4491c10f 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/HybridTestObjectSwiftKotlinSpec.hpp +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/HybridTestObjectSwiftKotlinSpec.hpp @@ -41,6 +41,8 @@ namespace margelo::nitro::test { struct OptionalWrapper; } namespace margelo::nitro::test { struct OptionalCallback; } // Forward declaration of `OptionalEnumWrapper` to properly resolve imports. namespace margelo::nitro::test { struct OptionalEnumWrapper; } +// Forward declaration of `Gallery` to properly resolve imports. +namespace margelo::nitro::test { struct Gallery; } // Forward declaration of `WeirdNumbersEnum` to properly resolve imports. namespace margelo::nitro::test { enum class WeirdNumbersEnum; } // Forward declaration of `HybridBaseSpec` to properly resolve imports. @@ -79,6 +81,7 @@ namespace margelo::nitro::test { struct ExternalObjectStruct; } #include "OptionalWrapper.hpp" #include "OptionalCallback.hpp" #include "OptionalEnumWrapper.hpp" +#include "Gallery.hpp" #include "WeirdNumbersEnum.hpp" #include "HybridBaseSpec.hpp" #include "HybridTestViewSpec.hpp" @@ -226,6 +229,7 @@ namespace margelo::nitro::test { virtual OptionalWrapper bounceOptionalWrapper(const OptionalWrapper& wrapper) = 0; virtual OptionalCallback bounceOptionalCallback(const OptionalCallback& value) = 0; virtual std::optional bounceOptionalEnumStruct(const std::optional& value) = 0; + virtual Gallery bounceGallery(const Gallery& gallery) = 0; virtual std::shared_ptr createArrayBuffer() = 0; virtual std::shared_ptr createArrayBufferFromNativeBuffer(bool copy) = 0; virtual std::shared_ptr copyBuffer(const std::shared_ptr& buffer) = 0; diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/MediaInfo.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/MediaInfo.hpp new file mode 100644 index 0000000000..f6564790e6 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/MediaInfo.hpp @@ -0,0 +1,97 @@ +/// +/// MediaInfo.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + + + +#include +#include +#include + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (MediaInfo). + */ + struct MediaInfo final { + public: + std::string title SWIFT_PRIVATE; + std::optional description SWIFT_PRIVATE; + std::optional> tags SWIFT_PRIVATE; + std::optional coverUrl SWIFT_PRIVATE; + + public: + MediaInfo() = default; + explicit MediaInfo(std::string title, std::optional description, std::optional> tags, std::optional coverUrl): title(title), description(description), tags(tags), coverUrl(coverUrl) {} + + public: + friend bool operator==(const MediaInfo& lhs, const MediaInfo& rhs) = default; + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ MediaInfo <> JS MediaInfo (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::MediaInfo fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::MediaInfo( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "title"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "description"))), + JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "tags"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "coverUrl"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::MediaInfo& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "title"), JSIConverter::toJSI(runtime, arg.title)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "description"), JSIConverter>::toJSI(runtime, arg.description)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "tags"), JSIConverter>>::toJSI(runtime, arg.tags)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "coverUrl"), JSIConverter>::toJSI(runtime, arg.coverUrl)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "title")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "description")))) return false; + if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "tags")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "coverUrl")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/TagInfo.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/TagInfo.hpp new file mode 100644 index 0000000000..e90e291042 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/TagInfo.hpp @@ -0,0 +1,100 @@ +/// +/// TagInfo.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `EntityInfo` to properly resolve imports. +namespace margelo::nitro::test { struct EntityInfo; } +// Forward declaration of `UserInfo` to properly resolve imports. +namespace margelo::nitro::test { struct UserInfo; } + +#include "EntityInfo.hpp" +#include +#include "UserInfo.hpp" + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (TagInfo). + */ + struct TagInfo final { + public: + double x SWIFT_PRIVATE; + double y SWIFT_PRIVATE; + std::optional entity SWIFT_PRIVATE; + std::optional user SWIFT_PRIVATE; + + public: + TagInfo() = default; + explicit TagInfo(double x, double y, std::optional entity, std::optional user): x(x), y(y), entity(entity), user(user) {} + + public: + friend bool operator==(const TagInfo& lhs, const TagInfo& rhs) = default; + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ TagInfo <> JS TagInfo (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::TagInfo fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::TagInfo( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "x"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "y"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "entity"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "user"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::TagInfo& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "x"), JSIConverter::toJSI(runtime, arg.x)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "y"), JSIConverter::toJSI(runtime, arg.y)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "entity"), JSIConverter>::toJSI(runtime, arg.entity)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "user"), JSIConverter>::toJSI(runtime, arg.user)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "x")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "y")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "entity")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "user")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/UserInfo.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/UserInfo.hpp new file mode 100644 index 0000000000..36b6c641b5 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/UserInfo.hpp @@ -0,0 +1,101 @@ +/// +/// UserInfo.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `MediaInfo` to properly resolve imports. +namespace margelo::nitro::test { struct MediaInfo; } +// Forward declaration of `EntityInfo` to properly resolve imports. +namespace margelo::nitro::test { struct EntityInfo; } + +#include +#include "MediaInfo.hpp" +#include +#include "EntityInfo.hpp" + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (UserInfo). + */ + struct UserInfo final { + public: + double userId SWIFT_PRIVATE; + std::string name SWIFT_PRIVATE; + std::optional avatar SWIFT_PRIVATE; + std::optional entity SWIFT_PRIVATE; + + public: + UserInfo() = default; + explicit UserInfo(double userId, std::string name, std::optional avatar, std::optional entity): userId(userId), name(name), avatar(avatar), entity(entity) {} + + public: + friend bool operator==(const UserInfo& lhs, const UserInfo& rhs) = default; + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ UserInfo <> JS UserInfo (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::UserInfo fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::UserInfo( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "userId"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "avatar"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "entity"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::UserInfo& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "userId"), JSIConverter::toJSI(runtime, arg.userId)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter::toJSI(runtime, arg.name)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "avatar"), JSIConverter>::toJSI(runtime, arg.avatar)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "entity"), JSIConverter>::toJSI(runtime, arg.entity)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "userId")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "avatar")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "entity")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/src/specs/TestObject.nitro.ts b/packages/react-native-nitro-test/src/specs/TestObject.nitro.ts index a6ca9cd71a..62c276a6c6 100644 --- a/packages/react-native-nitro-test/src/specs/TestObject.nitro.ts +++ b/packages/react-native-nitro-test/src/specs/TestObject.nitro.ts @@ -105,6 +105,54 @@ interface OptionalCallback { callback?: (() => void) | number } +// A deep/wide struct graph where multiple structs reference the same shared +// types from many paths. This exercises the BridgedType visited-set fix: +// without it, shared types get re-traversed from every path, causing +// exponential blowup and stack overflow during code generation (#1079). +interface MediaInfo { + title: string + description?: string + tags?: string[] + coverUrl?: string +} +interface EntityInfo { + entityId: number + title: string + media?: MediaInfo +} +interface UserInfo { + userId: number + name: string + avatar?: MediaInfo + entity?: EntityInfo +} +interface TagInfo { + x: number + y: number + entity?: EntityInfo + user?: UserInfo +} +interface GalleryItem { + mediaId: number + uri: string + media: MediaInfo + tags?: TagInfo[] + owner?: UserInfo + entity?: EntityInfo +} +interface AlbumItem { + albumId: number + name: string + cover?: MediaInfo + items?: GalleryItem[] + owner?: UserInfo +} +export interface Gallery { + albums: AlbumItem[] + featured?: GalleryItem + owner: UserInfo +} + interface SecondMapWrapper { second: Record } @@ -275,6 +323,7 @@ interface SharedTestObjectProps { bounceOptionalEnumStruct( value?: OptionalEnumWrapper ): OptionalEnumWrapper | undefined + bounceGallery(gallery: Gallery): Gallery // ArrayBuffers createArrayBuffer(): ArrayBuffer