diff --git a/example/ios/NitroExample.xcodeproj/project.pbxproj b/example/ios/NitroExample.xcodeproj/project.pbxproj index 8ccffb976..6ba3f49e0 100644 --- a/example/ios/NitroExample.xcodeproj/project.pbxproj +++ b/example/ios/NitroExample.xcodeproj/project.pbxproj @@ -255,10 +255,14 @@ inputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-NitroExample/Pods-NitroExample-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); + inputPaths = ( + ); name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-NitroExample/Pods-NitroExample-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); + outputPaths = ( + ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-NitroExample/Pods-NitroExample-frameworks.sh\"\n"; @@ -294,10 +298,14 @@ inputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-NitroExample/Pods-NitroExample-resources-${CONFIGURATION}-input-files.xcfilelist", ); + inputPaths = ( + ); name = "[CP] Copy Pods Resources"; outputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-NitroExample/Pods-NitroExample-resources-${CONFIGURATION}-output-files.xcfilelist", ); + outputPaths = ( + ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-NitroExample/Pods-NitroExample-resources.sh\"\n"; @@ -389,7 +397,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = CJW62Q77E7; + DEVELOPMENT_TEAM = SCHCH5LRT6; ENABLE_BITCODE = NO; INFOPLIST_FILE = NitroExample/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "Nitro Example"; @@ -424,7 +432,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = CJW62Q77E7; + DEVELOPMENT_TEAM = SCHCH5LRT6; INFOPLIST_FILE = NitroExample/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "Nitro Example"; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.developer-tools"; @@ -524,10 +532,7 @@ "-DFOLLY_CFG_NO_COROUTINES=1", "-DFOLLY_HAVE_CLOCK_GETTIME=1", ); - OTHER_LDFLAGS = ( - "$(inherited)", - " ", - ); + OTHER_LDFLAGS = "$(inherited) "; REACT_NATIVE_PATH = "${PODS_ROOT}/../../../node_modules/react-native"; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG"; @@ -603,10 +608,7 @@ "-DFOLLY_CFG_NO_COROUTINES=1", "-DFOLLY_HAVE_CLOCK_GETTIME=1", ); - OTHER_LDFLAGS = ( - "$(inherited)", - " ", - ); + OTHER_LDFLAGS = "$(inherited) "; REACT_NATIVE_PATH = "${PODS_ROOT}/../../../node_modules/react-native"; SDKROOT = iphoneos; SWIFT_ENABLE_EXPLICIT_MODULES = NO; diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index d4c3ffe6e..6f9c85911 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -2217,7 +2217,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: FBLazyVector: 7c1d69992204c5ec452eeefa4a24b0ff311709c8 - hermes-engine: 16e781d7fca74c8bb3ca59b99527d9633ee9ee36 + hermes-engine: 8b78a0b773116bfcfd324d0ad50bcf419171e6ae NitroModules: 61a246a8e9ef0c478d6d97f0d95c6f5dcdfcca71 NitroTest: 71bbd6e350ca62daeb2f4156c1fca24c5bb96439 NitroTestExternal: 74e7a5db8a645a3800a17fde4030e3c1485ad305 @@ -2229,7 +2229,7 @@ SPEC CHECKSUMS: React: f6f8fc5c01e77349cdfaf49102bcb928ac31d8ed React-callinvoker: 3e62a849bda1522c6422309c02f5dc3210bc5359 React-Core: 0b765bc7c2b83dff178c2b03ed8a0390df26f18c - React-Core-prebuilt: 88810feb58457484bff17e9e91a15453407d745a + React-Core-prebuilt: cce101ef82279b4b60e96236d53d0db8e4a30c8a React-CoreModules: 55b932564ba696301cb683a86385be6a6f137e57 React-cxxreact: 5bfb95256fde56cc0f9ce425f38cfaa085e71ad2 React-debug: f9dda2791d3ebe2078bc6102641edab77917efb7 @@ -2292,10 +2292,10 @@ SPEC CHECKSUMS: ReactAppDependencyProvider: 23e2bca1661f8781e55fcc05a151fc1df97bc1fb ReactCodegen: c049d7e966ed24be56d8e21cb1b8880316975e76 ReactCommon: 89ccc6cb100ca5a0303b46483037ef8f3e06e2e0 - ReactNativeDependencies: 1a7e3c3ffa57533d8118dd9bc01790ffa9e02a3b + ReactNativeDependencies: 251232958c0c6ce4b994497a2cea85b9cdb0e31c RNScreens: dd61bc3a3e6f6901ad833efa411917d44827cf51 Yoga: 21f482cbc18b56cdc477cd3a0c5b8c2c83ac27ce PODFILE CHECKSUM: b10c50487e0abdde430dd55fff9d2c50a2e3a09c -COCOAPODS: 1.15.2 +COCOAPODS: 1.16.2 diff --git a/packages/react-native-nitro-test/ios/HybridTestObjectSwift.swift b/packages/react-native-nitro-test/ios/HybridTestObjectSwift.swift index a45be4982..cfa4a4dc1 100644 --- a/packages/react-native-nitro-test/ios/HybridTestObjectSwift.swift +++ b/packages/react-native-nitro-test/ios/HybridTestObjectSwift.swift @@ -9,6 +9,12 @@ import NitroModules import NitroTestExternal class HybridTestObjectSwift: HybridTestObjectSwiftKotlinSpec { + func updateTravelEstimates(templateId: String, steps: [TripPoint]) throws -> Void { + } + + func updateManeuvers(templateId: String, maneuvers: [NitroRoutingManeuver]) throws -> Void { + } + var optionalArray: [String]? = [] var someVariant: Variant_String_Double = .second(55) diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/NitroTest+autolinking.cmake b/packages/react-native-nitro-test/nitrogen/generated/android/NitroTest+autolinking.cmake index 453148d1b..742baba9a 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/android/NitroTest+autolinking.cmake +++ b/packages/react-native-nitro-test/nitrogen/generated/android/NitroTest+autolinking.cmake @@ -61,6 +61,9 @@ target_sources( ../nitrogen/generated/android/c++/JVariant_HybridBaseSpec_OptionalWrapper.cpp ../nitrogen/generated/android/c++/JCoreTypesVariant.cpp ../nitrogen/generated/android/c++/JStringOrExternal.cpp + ../nitrogen/generated/android/c++/JNitroImage.cpp + ../nitrogen/generated/android/c++/JVariant_AssetImage_GlyphImage.cpp + ../nitrogen/generated/android/c++/JVariant_PreferredImageLane_ImageLane.cpp ../nitrogen/generated/android/c++/JVariant_Boolean_DoubleArray_Array_String__String_Double.cpp ../nitrogen/generated/android/c++/JHybridTestViewSpec.cpp ../nitrogen/generated/android/c++/views/JHybridTestViewStateUpdater.cpp diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JAssetImage.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JAssetImage.hpp new file mode 100644 index 000000000..6e5a240cb --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JAssetImage.hpp @@ -0,0 +1,80 @@ +/// +/// JAssetImage.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 "AssetImage.hpp" + +#include "JNitroColor.hpp" +#include "NitroColor.hpp" +#include +#include + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "AssetImage" and the the Kotlin data class "AssetImage". + */ + struct JAssetImage final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/AssetImage;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct AssetImage by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + AssetImage toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldColor = clazz->getField("color"); + jni::local_ref color = this->getFieldValue(fieldColor); + static const auto fieldPackager_asset = clazz->getField("packager_asset"); + jboolean packager_asset = this->getFieldValue(fieldPackager_asset); + static const auto fieldHeight = clazz->getField("height"); + double height = this->getFieldValue(fieldHeight); + static const auto fieldWidth = clazz->getField("width"); + double width = this->getFieldValue(fieldWidth); + static const auto fieldScale = clazz->getField("scale"); + double scale = this->getFieldValue(fieldScale); + static const auto fieldUri = clazz->getField("uri"); + jni::local_ref uri = this->getFieldValue(fieldUri); + return AssetImage( + color != nullptr ? std::make_optional(color->toCpp()) : std::nullopt, + static_cast(packager_asset), + height, + width, + scale, + uri->toStdString() + ); + } + + 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 AssetImage& value) { + using JSignature = JAssetImage(jni::alias_ref, jboolean, double, double, double, jni::alias_ref); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + value.color.has_value() ? JNitroColor::fromCpp(value.color.value()) : nullptr, + value.packager_asset, + value.height, + value.width, + value.scale, + jni::make_jstring(value.uri) + ); + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JAutoText.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JAutoText.hpp new file mode 100644 index 000000000..4ee86eac4 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JAutoText.hpp @@ -0,0 +1,70 @@ +/// +/// JAutoText.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 "AutoText.hpp" + +#include "Distance.hpp" +#include "DistanceUnits.hpp" +#include "JDistance.hpp" +#include "JDistanceUnits.hpp" +#include +#include + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "AutoText" and the the Kotlin data class "AutoText". + */ + struct JAutoText final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/AutoText;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct AutoText by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + AutoText toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldText = clazz->getField("text"); + jni::local_ref text = this->getFieldValue(fieldText); + static const auto fieldDistance = clazz->getField("distance"); + jni::local_ref distance = this->getFieldValue(fieldDistance); + static const auto fieldDuration = clazz->getField("duration"); + jni::local_ref duration = this->getFieldValue(fieldDuration); + return AutoText( + text->toStdString(), + distance != nullptr ? std::make_optional(distance->toCpp()) : std::nullopt, + duration != nullptr ? std::make_optional(duration->value()) : std::nullopt + ); + } + + public: + /** + * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java. + */ + [[maybe_unused]] + static jni::local_ref fromCpp(const AutoText& value) { + using JSignature = JAutoText(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.text), + value.distance.has_value() ? JDistance::fromCpp(value.distance.value()) : nullptr, + value.duration.has_value() ? jni::JDouble::valueOf(value.duration.value()) : nullptr + ); + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JDistance.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JDistance.hpp new file mode 100644 index 000000000..ec832a91e --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JDistance.hpp @@ -0,0 +1,62 @@ +/// +/// JDistance.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 "Distance.hpp" + +#include "DistanceUnits.hpp" +#include "JDistanceUnits.hpp" + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "Distance" and the the Kotlin data class "Distance". + */ + struct JDistance final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/Distance;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct Distance by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + Distance toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldValue = clazz->getField("value"); + double value = this->getFieldValue(fieldValue); + static const auto fieldUnit = clazz->getField("unit"); + jni::local_ref unit = this->getFieldValue(fieldUnit); + return Distance( + value, + unit->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 Distance& value) { + using JSignature = JDistance(double, jni::alias_ref); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + value.value, + JDistanceUnits::fromCpp(value.unit) + ); + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JDistanceUnits.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JDistanceUnits.hpp new file mode 100644 index 000000000..c5f68baf7 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JDistanceUnits.hpp @@ -0,0 +1,67 @@ +/// +/// JDistanceUnits.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 "DistanceUnits.hpp" + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ enum "DistanceUnits" and the the Kotlin enum "DistanceUnits". + */ + struct JDistanceUnits final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/DistanceUnits;"; + + public: + /** + * Convert this Java/Kotlin-based enum to the C++ enum DistanceUnits. + */ + [[maybe_unused]] + [[nodiscard]] + DistanceUnits toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldOrdinal = clazz->getField("value"); + int ordinal = this->getFieldValue(fieldOrdinal); + return static_cast(ordinal); + } + + public: + /** + * Create a Java/Kotlin-based enum with the given C++ enum's value. + */ + [[maybe_unused]] + static jni::alias_ref fromCpp(DistanceUnits value) { + static const auto clazz = javaClassStatic(); + switch (value) { + case DistanceUnits::METERS: + static const auto fieldMETERS = clazz->getStaticField("METERS"); + return clazz->getStaticFieldValue(fieldMETERS); + case DistanceUnits::MILES: + static const auto fieldMILES = clazz->getStaticField("MILES"); + return clazz->getStaticFieldValue(fieldMILES); + case DistanceUnits::KILOMETERS: + static const auto fieldKILOMETERS = clazz->getStaticField("KILOMETERS"); + return clazz->getStaticFieldValue(fieldKILOMETERS); + case DistanceUnits::YARDS: + static const auto fieldYARDS = clazz->getStaticField("YARDS"); + return clazz->getStaticFieldValue(fieldYARDS); + case DistanceUnits::FEET: + static const auto fieldFEET = clazz->getStaticField("FEET"); + return clazz->getStaticFieldValue(fieldFEET); + default: + std::string stringValue = std::to_string(static_cast(value)); + throw std::invalid_argument("Invalid enum value (" + stringValue + "!"); + } + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JDurationWithTimeZone.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JDurationWithTimeZone.hpp new file mode 100644 index 000000000..6323c8aec --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JDurationWithTimeZone.hpp @@ -0,0 +1,61 @@ +/// +/// JDurationWithTimeZone.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 "DurationWithTimeZone.hpp" + +#include + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "DurationWithTimeZone" and the the Kotlin data class "DurationWithTimeZone". + */ + struct JDurationWithTimeZone final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/DurationWithTimeZone;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct DurationWithTimeZone by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + DurationWithTimeZone toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldTimezone = clazz->getField("timezone"); + jni::local_ref timezone = this->getFieldValue(fieldTimezone); + static const auto fieldSeconds = clazz->getField("seconds"); + double seconds = this->getFieldValue(fieldSeconds); + return DurationWithTimeZone( + timezone->toStdString(), + seconds + ); + } + + 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 DurationWithTimeZone& value) { + using JSignature = JDurationWithTimeZone(jni::alias_ref, double); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + jni::make_jstring(value.timezone), + value.seconds + ); + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JForkType.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JForkType.hpp new file mode 100644 index 000000000..29fc708f6 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JForkType.hpp @@ -0,0 +1,58 @@ +/// +/// JForkType.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 "ForkType.hpp" + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ enum "ForkType" and the the Kotlin enum "ForkType". + */ + struct JForkType final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/ForkType;"; + + public: + /** + * Convert this Java/Kotlin-based enum to the C++ enum ForkType. + */ + [[maybe_unused]] + [[nodiscard]] + ForkType toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldOrdinal = clazz->getField("value"); + int ordinal = this->getFieldValue(fieldOrdinal); + return static_cast(ordinal); + } + + public: + /** + * Create a Java/Kotlin-based enum with the given C++ enum's value. + */ + [[maybe_unused]] + static jni::alias_ref fromCpp(ForkType value) { + static const auto clazz = javaClassStatic(); + switch (value) { + case ForkType::LEFT: + static const auto fieldLEFT = clazz->getStaticField("LEFT"); + return clazz->getStaticFieldValue(fieldLEFT); + case ForkType::RIGHT: + static const auto fieldRIGHT = clazz->getStaticField("RIGHT"); + return clazz->getStaticFieldValue(fieldRIGHT); + default: + std::string stringValue = std::to_string(static_cast(value)); + throw std::invalid_argument("Invalid enum value (" + stringValue + "!"); + } + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JGlyphImage.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JGlyphImage.hpp new file mode 100644 index 000000000..e7e8a370d --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JGlyphImage.hpp @@ -0,0 +1,71 @@ +/// +/// JGlyphImage.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 "GlyphImage.hpp" + +#include "JNitroColor.hpp" +#include "NitroColor.hpp" +#include + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "GlyphImage" and the the Kotlin data class "GlyphImage". + */ + struct JGlyphImage final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/GlyphImage;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct GlyphImage by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + GlyphImage toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldGlyph = clazz->getField("glyph"); + double glyph = this->getFieldValue(fieldGlyph); + static const auto fieldColor = clazz->getField("color"); + jni::local_ref color = this->getFieldValue(fieldColor); + static const auto fieldBackgroundColor = clazz->getField("backgroundColor"); + jni::local_ref backgroundColor = this->getFieldValue(fieldBackgroundColor); + static const auto fieldFontScale = clazz->getField("fontScale"); + jni::local_ref fontScale = this->getFieldValue(fieldFontScale); + return GlyphImage( + glyph, + color->toCpp(), + backgroundColor->toCpp(), + fontScale != nullptr ? std::make_optional(fontScale->value()) : std::nullopt + ); + } + + public: + /** + * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java. + */ + [[maybe_unused]] + static jni::local_ref fromCpp(const GlyphImage& value) { + using JSignature = JGlyphImage(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.glyph, + JNitroColor::fromCpp(value.color), + JNitroColor::fromCpp(value.backgroundColor), + value.fontScale.has_value() ? jni::JDouble::valueOf(value.fontScale.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 e83785faf..7548dd7f9 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 @@ -37,6 +37,50 @@ namespace margelo::nitro::test { class HybridBaseSpec; } namespace margelo::nitro::test::external { class HybridSomeExternalObjectSpec; } // Forward declaration of `ExternalObjectStruct` to properly resolve imports. namespace margelo::nitro::test { struct ExternalObjectStruct; } +// Forward declaration of `TripPoint` to properly resolve imports. +namespace margelo::nitro::test { struct TripPoint; } +// Forward declaration of `TravelEstimates` to properly resolve imports. +namespace margelo::nitro::test { struct TravelEstimates; } +// Forward declaration of `Distance` to properly resolve imports. +namespace margelo::nitro::test { struct Distance; } +// Forward declaration of `DistanceUnits` to properly resolve imports. +namespace margelo::nitro::test { enum class DistanceUnits; } +// Forward declaration of `DurationWithTimeZone` to properly resolve imports. +namespace margelo::nitro::test { struct DurationWithTimeZone; } +// Forward declaration of `AutoText` to properly resolve imports. +namespace margelo::nitro::test { struct AutoText; } +// Forward declaration of `NitroRoutingManeuver` to properly resolve imports. +namespace margelo::nitro::test { struct NitroRoutingManeuver; } +// Forward declaration of `NitroAttributedString` to properly resolve imports. +namespace margelo::nitro::test { struct NitroAttributedString; } +// Forward declaration of `NitroAttributedStringImage` to properly resolve imports. +namespace margelo::nitro::test { struct NitroAttributedStringImage; } +// Forward declaration of `AssetImage` to properly resolve imports. +namespace margelo::nitro::test { struct AssetImage; } +// Forward declaration of `GlyphImage` to properly resolve imports. +namespace margelo::nitro::test { struct GlyphImage; } +// Forward declaration of `NitroColor` to properly resolve imports. +namespace margelo::nitro::test { struct NitroColor; } +// Forward declaration of `TurnType` to properly resolve imports. +namespace margelo::nitro::test { enum class TurnType; } +// Forward declaration of `OffRampType` to properly resolve imports. +namespace margelo::nitro::test { enum class OffRampType; } +// Forward declaration of `OnRampType` to properly resolve imports. +namespace margelo::nitro::test { enum class OnRampType; } +// Forward declaration of `ForkType` to properly resolve imports. +namespace margelo::nitro::test { enum class ForkType; } +// Forward declaration of `KeepType` to properly resolve imports. +namespace margelo::nitro::test { enum class KeepType; } +// Forward declaration of `LaneGuidance` to properly resolve imports. +namespace margelo::nitro::test { struct LaneGuidance; } +// Forward declaration of `PreferredImageLane` to properly resolve imports. +namespace margelo::nitro::test { struct PreferredImageLane; } +// Forward declaration of `ImageLane` to properly resolve imports. +namespace margelo::nitro::test { struct ImageLane; } +// Forward declaration of `TrafficSide` to properly resolve imports. +namespace margelo::nitro::test { enum class TrafficSide; } +// Forward declaration of `ManeuverType` to properly resolve imports. +namespace margelo::nitro::test { enum class ManeuverType; } // Forward declaration of `MapWrapper` to properly resolve imports. namespace margelo::nitro::test { struct MapWrapper; } // Forward declaration of `SecondMapWrapper` to properly resolve imports. @@ -107,6 +151,53 @@ namespace margelo::nitro::test { class HybridTestViewSpec; } #include "ExternalObjectStruct.hpp" #include "JExternalObjectStruct.hpp" #include "JStringOrExternal.hpp" +#include "TripPoint.hpp" +#include "JTripPoint.hpp" +#include "TravelEstimates.hpp" +#include "JTravelEstimates.hpp" +#include "Distance.hpp" +#include "JDistance.hpp" +#include "DistanceUnits.hpp" +#include "JDistanceUnits.hpp" +#include "DurationWithTimeZone.hpp" +#include "JDurationWithTimeZone.hpp" +#include "AutoText.hpp" +#include "JAutoText.hpp" +#include "NitroRoutingManeuver.hpp" +#include "JNitroRoutingManeuver.hpp" +#include "NitroAttributedString.hpp" +#include "JNitroAttributedString.hpp" +#include "NitroAttributedStringImage.hpp" +#include "JNitroAttributedStringImage.hpp" +#include "AssetImage.hpp" +#include "GlyphImage.hpp" +#include "JNitroImage.hpp" +#include "JAssetImage.hpp" +#include "NitroColor.hpp" +#include "JNitroColor.hpp" +#include "JGlyphImage.hpp" +#include "JVariant_AssetImage_GlyphImage.hpp" +#include "TurnType.hpp" +#include "JTurnType.hpp" +#include "OffRampType.hpp" +#include "JOffRampType.hpp" +#include "OnRampType.hpp" +#include "JOnRampType.hpp" +#include "ForkType.hpp" +#include "JForkType.hpp" +#include "KeepType.hpp" +#include "JKeepType.hpp" +#include "LaneGuidance.hpp" +#include "JLaneGuidance.hpp" +#include "PreferredImageLane.hpp" +#include "ImageLane.hpp" +#include "JVariant_PreferredImageLane_ImageLane.hpp" +#include "JPreferredImageLane.hpp" +#include "JImageLane.hpp" +#include "TrafficSide.hpp" +#include "JTrafficSide.hpp" +#include "ManeuverType.hpp" +#include "JManeuverType.hpp" #include "JFunc_void_std__vector_Powertrain_.hpp" #include "MapWrapper.hpp" #include "JMapWrapper.hpp" @@ -332,6 +423,32 @@ namespace margelo::nitro::test { auto __result = method(_javaPart, JVariant_HybridTestObjectSwiftKotlinSpec_Person::fromCpp(variant)); return __result->toCpp(); } + void JHybridTestObjectSwiftKotlinSpec::updateTravelEstimates(const std::string& templateId, const std::vector& steps) { + static const auto method = javaClassStatic()->getMethod /* templateId */, jni::alias_ref> /* steps */)>("updateTravelEstimates"); + method(_javaPart, jni::make_jstring(templateId), [&]() { + size_t __size = steps.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = steps[__i]; + auto __elementJni = JTripPoint::fromCpp(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }()); + } + void JHybridTestObjectSwiftKotlinSpec::updateManeuvers(const std::string& templateId, const std::vector& maneuvers) { + static const auto method = javaClassStatic()->getMethod /* templateId */, jni::alias_ref> /* maneuvers */)>("updateManeuvers"); + method(_javaPart, jni::make_jstring(templateId), [&]() { + size_t __size = maneuvers.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = maneuvers[__i]; + auto __elementJni = JNitroRoutingManeuver::fromCpp(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }()); + } void JHybridTestObjectSwiftKotlinSpec::simpleFunc() { static const auto method = javaClassStatic()->getMethod("simpleFunc"); 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 7d756705f..dfacc6500 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 @@ -85,6 +85,8 @@ namespace margelo::nitro::test { // Methods std::shared_ptr newTestObject() override; std::variant, Person> getVariantHybrid(const std::variant, Person>& variant) override; + void updateTravelEstimates(const std::string& templateId, const std::vector& steps) override; + void updateManeuvers(const std::string& templateId, const std::vector& maneuvers) override; void simpleFunc() override; double addNumbers(double a, double b) override; std::string addStrings(const std::string& a, const std::string& b) override; diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JImageLane.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JImageLane.hpp new file mode 100644 index 000000000..7801caa37 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JImageLane.hpp @@ -0,0 +1,81 @@ +/// +/// JImageLane.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 "ImageLane.hpp" + +#include "AssetImage.hpp" +#include "GlyphImage.hpp" +#include "JAssetImage.hpp" +#include "JGlyphImage.hpp" +#include "JNitroColor.hpp" +#include "JNitroImage.hpp" +#include "NitroColor.hpp" +#include +#include +#include +#include + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "ImageLane" and the the Kotlin data class "ImageLane". + */ + struct JImageLane final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/ImageLane;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct ImageLane by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + ImageLane toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldImage = clazz->getField("image"); + jni::local_ref image = this->getFieldValue(fieldImage); + static const auto fieldAngles = clazz->getField("angles"); + jni::local_ref angles = this->getFieldValue(fieldAngles); + return ImageLane( + image->toCpp(), + [&]() { + size_t __size = angles->size(); + std::vector __vector(__size); + angles->getRegion(0, __size, __vector.data()); + return __vector; + }() + ); + } + + 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 ImageLane& value) { + using JSignature = JImageLane(jni::alias_ref, jni::alias_ref); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + JNitroImage::fromCpp(value.image), + [&]() { + size_t __size = value.angles.size(); + jni::local_ref __array = jni::JArrayDouble::newArray(__size); + __array->setRegion(0, __size, value.angles.data()); + return __array; + }() + ); + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JKeepType.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JKeepType.hpp new file mode 100644 index 000000000..3ef26fec3 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JKeepType.hpp @@ -0,0 +1,61 @@ +/// +/// JKeepType.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 "KeepType.hpp" + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ enum "KeepType" and the the Kotlin enum "KeepType". + */ + struct JKeepType final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/KeepType;"; + + public: + /** + * Convert this Java/Kotlin-based enum to the C++ enum KeepType. + */ + [[maybe_unused]] + [[nodiscard]] + KeepType toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldOrdinal = clazz->getField("value"); + int ordinal = this->getFieldValue(fieldOrdinal); + return static_cast(ordinal); + } + + public: + /** + * Create a Java/Kotlin-based enum with the given C++ enum's value. + */ + [[maybe_unused]] + static jni::alias_ref fromCpp(KeepType value) { + static const auto clazz = javaClassStatic(); + switch (value) { + case KeepType::LEFT: + static const auto fieldLEFT = clazz->getStaticField("LEFT"); + return clazz->getStaticFieldValue(fieldLEFT); + case KeepType::RIGHT: + static const auto fieldRIGHT = clazz->getStaticField("RIGHT"); + return clazz->getStaticFieldValue(fieldRIGHT); + case KeepType::FOLLOWROAD: + static const auto fieldFOLLOWROAD = clazz->getStaticField("FOLLOWROAD"); + return clazz->getStaticFieldValue(fieldFOLLOWROAD); + default: + std::string stringValue = std::to_string(static_cast(value)); + throw std::invalid_argument("Invalid enum value (" + stringValue + "!"); + } + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JLaneGuidance.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JLaneGuidance.hpp new file mode 100644 index 000000000..edd531e09 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JLaneGuidance.hpp @@ -0,0 +1,112 @@ +/// +/// JLaneGuidance.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 "LaneGuidance.hpp" + +#include "AssetImage.hpp" +#include "GlyphImage.hpp" +#include "ImageLane.hpp" +#include "JAssetImage.hpp" +#include "JGlyphImage.hpp" +#include "JImageLane.hpp" +#include "JNitroColor.hpp" +#include "JNitroImage.hpp" +#include "JPreferredImageLane.hpp" +#include "JVariant_PreferredImageLane_ImageLane.hpp" +#include "NitroColor.hpp" +#include "PreferredImageLane.hpp" +#include +#include +#include +#include + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "LaneGuidance" and the the Kotlin data class "LaneGuidance". + */ + struct JLaneGuidance final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/LaneGuidance;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct LaneGuidance by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + LaneGuidance toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldInstructionVariants = clazz->getField>("instructionVariants"); + jni::local_ref> instructionVariants = this->getFieldValue(fieldInstructionVariants); + static const auto fieldLanes = clazz->getField>("lanes"); + jni::local_ref> lanes = this->getFieldValue(fieldLanes); + return LaneGuidance( + [&]() { + size_t __size = instructionVariants->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = instructionVariants->getElement(__i); + __vector.push_back(__element->toStdString()); + } + return __vector; + }(), + [&]() { + size_t __size = lanes->size(); + std::vector> __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = lanes->getElement(__i); + __vector.push_back(__element->toCpp()); + } + return __vector; + }() + ); + } + + 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 LaneGuidance& value) { + using JSignature = JLaneGuidance(jni::alias_ref>, jni::alias_ref>); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + [&]() { + size_t __size = value.instructionVariants.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = value.instructionVariants[__i]; + auto __elementJni = jni::make_jstring(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }(), + [&]() { + size_t __size = value.lanes.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = value.lanes[__i]; + auto __elementJni = JVariant_PreferredImageLane_ImageLane::fromCpp(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }() + ); + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JManeuverType.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JManeuverType.hpp new file mode 100644 index 000000000..a064a2fdc --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JManeuverType.hpp @@ -0,0 +1,88 @@ +/// +/// JManeuverType.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 "ManeuverType.hpp" + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ enum "ManeuverType" and the the Kotlin enum "ManeuverType". + */ + struct JManeuverType final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/ManeuverType;"; + + public: + /** + * Convert this Java/Kotlin-based enum to the C++ enum ManeuverType. + */ + [[maybe_unused]] + [[nodiscard]] + ManeuverType toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldOrdinal = clazz->getField("value"); + int ordinal = this->getFieldValue(fieldOrdinal); + return static_cast(ordinal); + } + + public: + /** + * Create a Java/Kotlin-based enum with the given C++ enum's value. + */ + [[maybe_unused]] + static jni::alias_ref fromCpp(ManeuverType value) { + static const auto clazz = javaClassStatic(); + switch (value) { + case ManeuverType::DEPART: + static const auto fieldDEPART = clazz->getStaticField("DEPART"); + return clazz->getStaticFieldValue(fieldDEPART); + case ManeuverType::ARRIVE: + static const auto fieldARRIVE = clazz->getStaticField("ARRIVE"); + return clazz->getStaticFieldValue(fieldARRIVE); + case ManeuverType::ARRIVELEFT: + static const auto fieldARRIVELEFT = clazz->getStaticField("ARRIVELEFT"); + return clazz->getStaticFieldValue(fieldARRIVELEFT); + case ManeuverType::ARRIVERIGHT: + static const auto fieldARRIVERIGHT = clazz->getStaticField("ARRIVERIGHT"); + return clazz->getStaticFieldValue(fieldARRIVERIGHT); + case ManeuverType::STRAIGHT: + static const auto fieldSTRAIGHT = clazz->getStaticField("STRAIGHT"); + return clazz->getStaticFieldValue(fieldSTRAIGHT); + case ManeuverType::TURN: + static const auto fieldTURN = clazz->getStaticField("TURN"); + return clazz->getStaticFieldValue(fieldTURN); + case ManeuverType::ROUNDABOUT: + static const auto fieldROUNDABOUT = clazz->getStaticField("ROUNDABOUT"); + return clazz->getStaticFieldValue(fieldROUNDABOUT); + case ManeuverType::OFFRAMP: + static const auto fieldOFFRAMP = clazz->getStaticField("OFFRAMP"); + return clazz->getStaticFieldValue(fieldOFFRAMP); + case ManeuverType::ONRAMP: + static const auto fieldONRAMP = clazz->getStaticField("ONRAMP"); + return clazz->getStaticFieldValue(fieldONRAMP); + case ManeuverType::FORK: + static const auto fieldFORK = clazz->getStaticField("FORK"); + return clazz->getStaticFieldValue(fieldFORK); + case ManeuverType::ENTERFERRY: + static const auto fieldENTERFERRY = clazz->getStaticField("ENTERFERRY"); + return clazz->getStaticFieldValue(fieldENTERFERRY); + case ManeuverType::KEEP: + static const auto fieldKEEP = clazz->getStaticField("KEEP"); + return clazz->getStaticFieldValue(fieldKEEP); + default: + std::string stringValue = std::to_string(static_cast(value)); + throw std::invalid_argument("Invalid enum value (" + stringValue + "!"); + } + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JNitroAttributedString.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JNitroAttributedString.hpp new file mode 100644 index 000000000..c380a6d41 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JNitroAttributedString.hpp @@ -0,0 +1,91 @@ +/// +/// JNitroAttributedString.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 "NitroAttributedString.hpp" + +#include "AssetImage.hpp" +#include "GlyphImage.hpp" +#include "JAssetImage.hpp" +#include "JGlyphImage.hpp" +#include "JNitroAttributedStringImage.hpp" +#include "JNitroColor.hpp" +#include "JNitroImage.hpp" +#include "NitroAttributedStringImage.hpp" +#include "NitroColor.hpp" +#include +#include +#include +#include + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "NitroAttributedString" and the the Kotlin data class "NitroAttributedString". + */ + struct JNitroAttributedString final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/NitroAttributedString;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct NitroAttributedString by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + NitroAttributedString toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldText = clazz->getField("text"); + jni::local_ref text = this->getFieldValue(fieldText); + static const auto fieldImages = clazz->getField>("images"); + jni::local_ref> images = this->getFieldValue(fieldImages); + return NitroAttributedString( + text->toStdString(), + images != nullptr ? std::make_optional([&]() { + size_t __size = images->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = images->getElement(__i); + __vector.push_back(__element->toCpp()); + } + return __vector; + }()) : 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 NitroAttributedString& value) { + using JSignature = JNitroAttributedString(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.text), + value.images.has_value() ? [&]() { + size_t __size = value.images.value().size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = value.images.value()[__i]; + auto __elementJni = JNitroAttributedStringImage::fromCpp(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }() : nullptr + ); + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JNitroAttributedStringImage.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JNitroAttributedStringImage.hpp new file mode 100644 index 000000000..a27f22d0d --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JNitroAttributedStringImage.hpp @@ -0,0 +1,70 @@ +/// +/// JNitroAttributedStringImage.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 "NitroAttributedStringImage.hpp" + +#include "AssetImage.hpp" +#include "GlyphImage.hpp" +#include "JAssetImage.hpp" +#include "JGlyphImage.hpp" +#include "JNitroColor.hpp" +#include "JNitroImage.hpp" +#include "NitroColor.hpp" +#include +#include +#include + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "NitroAttributedStringImage" and the the Kotlin data class "NitroAttributedStringImage". + */ + struct JNitroAttributedStringImage final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/NitroAttributedStringImage;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct NitroAttributedStringImage by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + NitroAttributedStringImage toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldImage = clazz->getField("image"); + jni::local_ref image = this->getFieldValue(fieldImage); + static const auto fieldPosition = clazz->getField("position"); + double position = this->getFieldValue(fieldPosition); + return NitroAttributedStringImage( + image->toCpp(), + position + ); + } + + 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 NitroAttributedStringImage& value) { + using JSignature = JNitroAttributedStringImage(jni::alias_ref, double); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + JNitroImage::fromCpp(value.image), + value.position + ); + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JNitroColor.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JNitroColor.hpp new file mode 100644 index 000000000..d8c48a22f --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JNitroColor.hpp @@ -0,0 +1,61 @@ +/// +/// JNitroColor.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 "NitroColor.hpp" + + + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "NitroColor" and the the Kotlin data class "NitroColor". + */ + struct JNitroColor final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/NitroColor;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct NitroColor by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + NitroColor toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldLightColor = clazz->getField("lightColor"); + double lightColor = this->getFieldValue(fieldLightColor); + static const auto fieldDarkColor = clazz->getField("darkColor"); + double darkColor = this->getFieldValue(fieldDarkColor); + return NitroColor( + lightColor, + darkColor + ); + } + + 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 NitroColor& value) { + using JSignature = JNitroColor(double, double); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + value.lightColor, + value.darkColor + ); + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JNitroImage.cpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JNitroImage.cpp new file mode 100644 index 000000000..3cc3440be --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JNitroImage.cpp @@ -0,0 +1,26 @@ +/// +/// JNitroImage.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include "JNitroImage.hpp" + +namespace margelo::nitro::test { + /** + * Converts JNitroImage to std::variant + */ + std::variant JNitroImage::toCpp() const { + if (isInstanceOf(JNitroImage_impl::First::javaClassStatic())) { + // It's a `AssetImage` + auto jniValue = static_cast(this)->getValue(); + return jniValue->toCpp(); + } else if (isInstanceOf(JNitroImage_impl::Second::javaClassStatic())) { + // It's a `GlyphImage` + auto jniValue = static_cast(this)->getValue(); + return jniValue->toCpp(); + } + throw std::invalid_argument("Variant is unknown Kotlin instance!"); + } +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JNitroImage.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JNitroImage.hpp new file mode 100644 index 000000000..ca95f0411 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JNitroImage.hpp @@ -0,0 +1,75 @@ +/// +/// JNitroImage.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 + +#include "AssetImage.hpp" +#include "GlyphImage.hpp" +#include +#include "JAssetImage.hpp" +#include "NitroColor.hpp" +#include +#include "JNitroColor.hpp" +#include +#include "JGlyphImage.hpp" + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ std::variant and the Java class "NitroImage". + */ + class JNitroImage: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/NitroImage;"; + + static jni::local_ref create_0(jni::alias_ref value) { + static const auto method = javaClassStatic()->getStaticMethod)>("create"); + return method(javaClassStatic(), value); + } + static jni::local_ref create_1(jni::alias_ref value) { + static const auto method = javaClassStatic()->getStaticMethod)>("create"); + return method(javaClassStatic(), value); + } + + static jni::local_ref fromCpp(const std::variant& variant) { + switch (variant.index()) { + case 0: return create_0(JAssetImage::fromCpp(std::get<0>(variant))); + case 1: return create_1(JGlyphImage::fromCpp(std::get<1>(variant))); + default: throw std::invalid_argument("Variant holds unknown index! (" + std::to_string(variant.index()) + ")"); + } + } + + [[nodiscard]] std::variant toCpp() const; + }; + + namespace JNitroImage_impl { + class First final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/NitroImage$First;"; + + [[nodiscard]] jni::local_ref getValue() const { + static const auto field = javaClassStatic()->getField("value"); + return getFieldValue(field); + } + }; + + class Second final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/NitroImage$Second;"; + + [[nodiscard]] jni::local_ref getValue() const { + static const auto field = javaClassStatic()->getField("value"); + return getFieldValue(field); + } + }; + } // namespace JNitroImage_impl +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JNitroRoutingManeuver.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JNitroRoutingManeuver.hpp new file mode 100644 index 000000000..09cc835d7 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JNitroRoutingManeuver.hpp @@ -0,0 +1,224 @@ +/// +/// JNitroRoutingManeuver.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 "NitroRoutingManeuver.hpp" + +#include "AssetImage.hpp" +#include "AutoText.hpp" +#include "Distance.hpp" +#include "DistanceUnits.hpp" +#include "DurationWithTimeZone.hpp" +#include "ForkType.hpp" +#include "GlyphImage.hpp" +#include "ImageLane.hpp" +#include "JAssetImage.hpp" +#include "JAutoText.hpp" +#include "JDistance.hpp" +#include "JDistanceUnits.hpp" +#include "JDurationWithTimeZone.hpp" +#include "JForkType.hpp" +#include "JFunc_void.hpp" +#include "JGlyphImage.hpp" +#include "JImageLane.hpp" +#include "JKeepType.hpp" +#include "JLaneGuidance.hpp" +#include "JManeuverType.hpp" +#include "JNitroAttributedString.hpp" +#include "JNitroAttributedStringImage.hpp" +#include "JNitroColor.hpp" +#include "JNitroImage.hpp" +#include "JOffRampType.hpp" +#include "JOnRampType.hpp" +#include "JPreferredImageLane.hpp" +#include "JTrafficSide.hpp" +#include "JTravelEstimates.hpp" +#include "JTurnType.hpp" +#include "JVariant_AssetImage_GlyphImage.hpp" +#include "JVariant_PreferredImageLane_ImageLane.hpp" +#include "KeepType.hpp" +#include "LaneGuidance.hpp" +#include "ManeuverType.hpp" +#include "NitroAttributedString.hpp" +#include "NitroAttributedStringImage.hpp" +#include "NitroColor.hpp" +#include "OffRampType.hpp" +#include "OnRampType.hpp" +#include "PreferredImageLane.hpp" +#include "TrafficSide.hpp" +#include "TravelEstimates.hpp" +#include "TurnType.hpp" +#include +#include +#include +#include +#include +#include + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "NitroRoutingManeuver" and the the Kotlin data class "NitroRoutingManeuver". + */ + struct JNitroRoutingManeuver final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/NitroRoutingManeuver;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct NitroRoutingManeuver by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + NitroRoutingManeuver toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldAttributedInstructionVariants = clazz->getField>("attributedInstructionVariants"); + jni::local_ref> attributedInstructionVariants = this->getFieldValue(fieldAttributedInstructionVariants); + static const auto fieldSymbolImage = clazz->getField("symbolImage"); + jni::local_ref symbolImage = this->getFieldValue(fieldSymbolImage); + static const auto fieldJunctionImage = clazz->getField("junctionImage"); + jni::local_ref junctionImage = this->getFieldValue(fieldJunctionImage); + static const auto fieldTurnType = clazz->getField("turnType"); + jni::local_ref turnType = this->getFieldValue(fieldTurnType); + static const auto fieldAngle = clazz->getField("angle"); + jni::local_ref angle = this->getFieldValue(fieldAngle); + static const auto fieldElementAngles = clazz->getField("elementAngles"); + jni::local_ref elementAngles = this->getFieldValue(fieldElementAngles); + static const auto fieldExitNumber = clazz->getField("exitNumber"); + jni::local_ref exitNumber = this->getFieldValue(fieldExitNumber); + static const auto fieldOffRampType = clazz->getField("offRampType"); + jni::local_ref offRampType = this->getFieldValue(fieldOffRampType); + static const auto fieldOnRampType = clazz->getField("onRampType"); + jni::local_ref onRampType = this->getFieldValue(fieldOnRampType); + static const auto fieldForkType = clazz->getField("forkType"); + jni::local_ref forkType = this->getFieldValue(fieldForkType); + static const auto fieldKeepType = clazz->getField("keepType"); + jni::local_ref keepType = this->getFieldValue(fieldKeepType); + static const auto fieldLinkedLaneGuidance = clazz->getField("linkedLaneGuidance"); + jni::local_ref linkedLaneGuidance = this->getFieldValue(fieldLinkedLaneGuidance); + static const auto fieldCardBackgroundColor = clazz->getField("cardBackgroundColor"); + jni::local_ref cardBackgroundColor = this->getFieldValue(fieldCardBackgroundColor); + static const auto fieldId = clazz->getField("id"); + jni::local_ref id = this->getFieldValue(fieldId); + static const auto fieldTravelEstimates = clazz->getField("travelEstimates"); + jni::local_ref travelEstimates = this->getFieldValue(fieldTravelEstimates); + static const auto fieldTrafficSide = clazz->getField("trafficSide"); + jni::local_ref trafficSide = this->getFieldValue(fieldTrafficSide); + static const auto fieldManeuverType = clazz->getField("maneuverType"); + jni::local_ref maneuverType = this->getFieldValue(fieldManeuverType); + static const auto fieldRoadName = clazz->getField>("roadName"); + jni::local_ref> roadName = this->getFieldValue(fieldRoadName); + static const auto fieldHighwayExitLabel = clazz->getField("highwayExitLabel"); + jni::local_ref highwayExitLabel = this->getFieldValue(fieldHighwayExitLabel); + return NitroRoutingManeuver( + [&]() { + size_t __size = attributedInstructionVariants->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = attributedInstructionVariants->getElement(__i); + __vector.push_back(__element->toCpp()); + } + return __vector; + }(), + symbolImage->toCpp(), + junctionImage != nullptr ? std::make_optional(junctionImage->toCpp()) : std::nullopt, + turnType != nullptr ? std::make_optional(turnType->toCpp()) : std::nullopt, + angle != nullptr ? std::make_optional(angle->value()) : std::nullopt, + elementAngles != nullptr ? std::make_optional([&]() { + size_t __size = elementAngles->size(); + std::vector __vector(__size); + elementAngles->getRegion(0, __size, __vector.data()); + return __vector; + }()) : std::nullopt, + exitNumber != nullptr ? std::make_optional(exitNumber->value()) : std::nullopt, + offRampType != nullptr ? std::make_optional(offRampType->toCpp()) : std::nullopt, + onRampType != nullptr ? std::make_optional(onRampType->toCpp()) : std::nullopt, + forkType != nullptr ? std::make_optional(forkType->toCpp()) : std::nullopt, + keepType != nullptr ? std::make_optional(keepType->toCpp()) : std::nullopt, + linkedLaneGuidance != nullptr ? std::make_optional(linkedLaneGuidance->toCpp()) : std::nullopt, + cardBackgroundColor->toCpp(), + id->toStdString(), + travelEstimates->toCpp(), + trafficSide->toCpp(), + maneuverType->toCpp(), + roadName != nullptr ? std::make_optional([&]() { + size_t __size = roadName->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = roadName->getElement(__i); + __vector.push_back(__element->toStdString()); + } + return __vector; + }()) : std::nullopt, + highwayExitLabel != nullptr ? std::make_optional(highwayExitLabel->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 NitroRoutingManeuver& value) { + using JSignature = JNitroRoutingManeuver(jni::alias_ref>, jni::alias_ref, jni::alias_ref, jni::alias_ref, jni::alias_ref, jni::alias_ref, jni::alias_ref, jni::alias_ref, jni::alias_ref, jni::alias_ref, jni::alias_ref, jni::alias_ref, jni::alias_ref, jni::alias_ref, 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, + [&]() { + size_t __size = value.attributedInstructionVariants.size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = value.attributedInstructionVariants[__i]; + auto __elementJni = JNitroAttributedString::fromCpp(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }(), + JNitroImage::fromCpp(value.symbolImage), + value.junctionImage.has_value() ? JVariant_AssetImage_GlyphImage::fromCpp(value.junctionImage.value()) : nullptr, + value.turnType.has_value() ? JTurnType::fromCpp(value.turnType.value()) : nullptr, + value.angle.has_value() ? jni::JDouble::valueOf(value.angle.value()) : nullptr, + value.elementAngles.has_value() ? [&]() { + size_t __size = value.elementAngles.value().size(); + jni::local_ref __array = jni::JArrayDouble::newArray(__size); + __array->setRegion(0, __size, value.elementAngles.value().data()); + return __array; + }() : nullptr, + value.exitNumber.has_value() ? jni::JDouble::valueOf(value.exitNumber.value()) : nullptr, + value.offRampType.has_value() ? JOffRampType::fromCpp(value.offRampType.value()) : nullptr, + value.onRampType.has_value() ? JOnRampType::fromCpp(value.onRampType.value()) : nullptr, + value.forkType.has_value() ? JForkType::fromCpp(value.forkType.value()) : nullptr, + value.keepType.has_value() ? JKeepType::fromCpp(value.keepType.value()) : nullptr, + value.linkedLaneGuidance.has_value() ? JLaneGuidance::fromCpp(value.linkedLaneGuidance.value()) : nullptr, + JNitroColor::fromCpp(value.cardBackgroundColor), + jni::make_jstring(value.id), + JTravelEstimates::fromCpp(value.travelEstimates), + JTrafficSide::fromCpp(value.trafficSide), + JManeuverType::fromCpp(value.maneuverType), + value.roadName.has_value() ? [&]() { + size_t __size = value.roadName.value().size(); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); + for (size_t __i = 0; __i < __size; __i++) { + const auto& __element = value.roadName.value()[__i]; + auto __elementJni = jni::make_jstring(__element); + __array->setElement(__i, *__elementJni); + } + return __array; + }() : nullptr, + value.highwayExitLabel.has_value() ? jni::make_jstring(value.highwayExitLabel.value()) : nullptr + ); + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JOffRampType.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JOffRampType.hpp new file mode 100644 index 000000000..cca5579f7 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JOffRampType.hpp @@ -0,0 +1,64 @@ +/// +/// JOffRampType.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 "OffRampType.hpp" + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ enum "OffRampType" and the the Kotlin enum "OffRampType". + */ + struct JOffRampType final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/OffRampType;"; + + public: + /** + * Convert this Java/Kotlin-based enum to the C++ enum OffRampType. + */ + [[maybe_unused]] + [[nodiscard]] + OffRampType toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldOrdinal = clazz->getField("value"); + int ordinal = this->getFieldValue(fieldOrdinal); + return static_cast(ordinal); + } + + public: + /** + * Create a Java/Kotlin-based enum with the given C++ enum's value. + */ + [[maybe_unused]] + static jni::alias_ref fromCpp(OffRampType value) { + static const auto clazz = javaClassStatic(); + switch (value) { + case OffRampType::SLIGHTLEFT: + static const auto fieldSLIGHTLEFT = clazz->getStaticField("SLIGHTLEFT"); + return clazz->getStaticFieldValue(fieldSLIGHTLEFT); + case OffRampType::SLIGHTRIGHT: + static const auto fieldSLIGHTRIGHT = clazz->getStaticField("SLIGHTRIGHT"); + return clazz->getStaticFieldValue(fieldSLIGHTRIGHT); + case OffRampType::NORMALLEFT: + static const auto fieldNORMALLEFT = clazz->getStaticField("NORMALLEFT"); + return clazz->getStaticFieldValue(fieldNORMALLEFT); + case OffRampType::NORMALRIGHT: + static const auto fieldNORMALRIGHT = clazz->getStaticField("NORMALRIGHT"); + return clazz->getStaticFieldValue(fieldNORMALRIGHT); + default: + std::string stringValue = std::to_string(static_cast(value)); + throw std::invalid_argument("Invalid enum value (" + stringValue + "!"); + } + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JOnRampType.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JOnRampType.hpp new file mode 100644 index 000000000..9938b0ed0 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JOnRampType.hpp @@ -0,0 +1,76 @@ +/// +/// JOnRampType.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 "OnRampType.hpp" + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ enum "OnRampType" and the the Kotlin enum "OnRampType". + */ + struct JOnRampType final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/OnRampType;"; + + public: + /** + * Convert this Java/Kotlin-based enum to the C++ enum OnRampType. + */ + [[maybe_unused]] + [[nodiscard]] + OnRampType toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldOrdinal = clazz->getField("value"); + int ordinal = this->getFieldValue(fieldOrdinal); + return static_cast(ordinal); + } + + public: + /** + * Create a Java/Kotlin-based enum with the given C++ enum's value. + */ + [[maybe_unused]] + static jni::alias_ref fromCpp(OnRampType value) { + static const auto clazz = javaClassStatic(); + switch (value) { + case OnRampType::SLIGHTLEFT: + static const auto fieldSLIGHTLEFT = clazz->getStaticField("SLIGHTLEFT"); + return clazz->getStaticFieldValue(fieldSLIGHTLEFT); + case OnRampType::SLIGHTRIGHT: + static const auto fieldSLIGHTRIGHT = clazz->getStaticField("SLIGHTRIGHT"); + return clazz->getStaticFieldValue(fieldSLIGHTRIGHT); + case OnRampType::NORMALLEFT: + static const auto fieldNORMALLEFT = clazz->getStaticField("NORMALLEFT"); + return clazz->getStaticFieldValue(fieldNORMALLEFT); + case OnRampType::NORMALRIGHT: + static const auto fieldNORMALRIGHT = clazz->getStaticField("NORMALRIGHT"); + return clazz->getStaticFieldValue(fieldNORMALRIGHT); + case OnRampType::SHARPLEFT: + static const auto fieldSHARPLEFT = clazz->getStaticField("SHARPLEFT"); + return clazz->getStaticFieldValue(fieldSHARPLEFT); + case OnRampType::SHARPRIGHT: + static const auto fieldSHARPRIGHT = clazz->getStaticField("SHARPRIGHT"); + return clazz->getStaticFieldValue(fieldSHARPRIGHT); + case OnRampType::UTURNLEFT: + static const auto fieldUTURNLEFT = clazz->getStaticField("UTURNLEFT"); + return clazz->getStaticFieldValue(fieldUTURNLEFT); + case OnRampType::UTURNRIGHT: + static const auto fieldUTURNRIGHT = clazz->getStaticField("UTURNRIGHT"); + return clazz->getStaticFieldValue(fieldUTURNRIGHT); + default: + std::string stringValue = std::to_string(static_cast(value)); + throw std::invalid_argument("Invalid enum value (" + stringValue + "!"); + } + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JPreferredImageLane.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JPreferredImageLane.hpp new file mode 100644 index 000000000..9e9bc5093 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JPreferredImageLane.hpp @@ -0,0 +1,89 @@ +/// +/// JPreferredImageLane.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 "PreferredImageLane.hpp" + +#include "AssetImage.hpp" +#include "GlyphImage.hpp" +#include "JAssetImage.hpp" +#include "JGlyphImage.hpp" +#include "JNitroColor.hpp" +#include "JNitroImage.hpp" +#include "NitroColor.hpp" +#include +#include +#include +#include + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "PreferredImageLane" and the the Kotlin data class "PreferredImageLane". + */ + struct JPreferredImageLane final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/PreferredImageLane;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct PreferredImageLane by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + PreferredImageLane toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldImage = clazz->getField("image"); + jni::local_ref image = this->getFieldValue(fieldImage); + static const auto fieldHighlightedAngle = clazz->getField("highlightedAngle"); + double highlightedAngle = this->getFieldValue(fieldHighlightedAngle); + static const auto fieldIsPreferred = clazz->getField("isPreferred"); + jboolean isPreferred = this->getFieldValue(fieldIsPreferred); + static const auto fieldAngles = clazz->getField("angles"); + jni::local_ref angles = this->getFieldValue(fieldAngles); + return PreferredImageLane( + image->toCpp(), + highlightedAngle, + static_cast(isPreferred), + [&]() { + size_t __size = angles->size(); + std::vector __vector(__size); + angles->getRegion(0, __size, __vector.data()); + return __vector; + }() + ); + } + + 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 PreferredImageLane& value) { + using JSignature = JPreferredImageLane(jni::alias_ref, double, jboolean, jni::alias_ref); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + JNitroImage::fromCpp(value.image), + value.highlightedAngle, + value.isPreferred, + [&]() { + size_t __size = value.angles.size(); + jni::local_ref __array = jni::JArrayDouble::newArray(__size); + __array->setRegion(0, __size, value.angles.data()); + return __array; + }() + ); + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JTrafficSide.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JTrafficSide.hpp new file mode 100644 index 000000000..1aaeae413 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JTrafficSide.hpp @@ -0,0 +1,58 @@ +/// +/// JTrafficSide.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 "TrafficSide.hpp" + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ enum "TrafficSide" and the the Kotlin enum "TrafficSide". + */ + struct JTrafficSide final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/TrafficSide;"; + + public: + /** + * Convert this Java/Kotlin-based enum to the C++ enum TrafficSide. + */ + [[maybe_unused]] + [[nodiscard]] + TrafficSide toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldOrdinal = clazz->getField("value"); + int ordinal = this->getFieldValue(fieldOrdinal); + return static_cast(ordinal); + } + + public: + /** + * Create a Java/Kotlin-based enum with the given C++ enum's value. + */ + [[maybe_unused]] + static jni::alias_ref fromCpp(TrafficSide value) { + static const auto clazz = javaClassStatic(); + switch (value) { + case TrafficSide::RIGHT: + static const auto fieldRIGHT = clazz->getStaticField("RIGHT"); + return clazz->getStaticFieldValue(fieldRIGHT); + case TrafficSide::LEFT: + static const auto fieldLEFT = clazz->getStaticField("LEFT"); + return clazz->getStaticFieldValue(fieldLEFT); + default: + std::string stringValue = std::to_string(static_cast(value)); + throw std::invalid_argument("Invalid enum value (" + stringValue + "!"); + } + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JTravelEstimates.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JTravelEstimates.hpp new file mode 100644 index 000000000..ca10f9418 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JTravelEstimates.hpp @@ -0,0 +1,89 @@ +/// +/// JTravelEstimates.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 "TravelEstimates.hpp" + +#include "AutoText.hpp" +#include "Distance.hpp" +#include "DistanceUnits.hpp" +#include "DurationWithTimeZone.hpp" +#include "JAutoText.hpp" +#include "JDistance.hpp" +#include "JDistanceUnits.hpp" +#include "JDurationWithTimeZone.hpp" +#include "JFunc_void.hpp" +#include +#include +#include +#include + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "TravelEstimates" and the the Kotlin data class "TravelEstimates". + */ + struct JTravelEstimates final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/TravelEstimates;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct TravelEstimates by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + TravelEstimates toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldDistanceRemaining = clazz->getField("distanceRemaining"); + jni::local_ref distanceRemaining = this->getFieldValue(fieldDistanceRemaining); + static const auto fieldTimeRemaining = clazz->getField("timeRemaining"); + jni::local_ref timeRemaining = this->getFieldValue(fieldTimeRemaining); + static const auto fieldTripText = clazz->getField("tripText"); + jni::local_ref tripText = this->getFieldValue(fieldTripText); + static const auto field_doNotUse = clazz->getField("_doNotUse"); + jni::local_ref _doNotUse = this->getFieldValue(field_doNotUse); + return TravelEstimates( + distanceRemaining->toCpp(), + timeRemaining->toCpp(), + tripText != nullptr ? std::make_optional(tripText->toCpp()) : std::nullopt, + _doNotUse != nullptr ? std::make_optional([&]() -> std::function { + if (_doNotUse->isInstanceOf(JFunc_void_cxx::javaClassStatic())) [[likely]] { + auto downcast = jni::static_ref_cast(_doNotUse); + return downcast->cthis()->getFunction(); + } else { + auto _doNotUseRef = jni::make_global(_doNotUse); + return JNICallable(std::move(_doNotUseRef)); + } + }()) : 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 TravelEstimates& value) { + using JSignature = JTravelEstimates(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, + JDistance::fromCpp(value.distanceRemaining), + JDurationWithTimeZone::fromCpp(value.timeRemaining), + value.tripText.has_value() ? JAutoText::fromCpp(value.tripText.value()) : nullptr, + value._doNotUse.has_value() ? JFunc_void_cxx::fromCpp(value._doNotUse.value()) : nullptr + ); + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JTripPoint.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JTripPoint.hpp new file mode 100644 index 000000000..2881d4a17 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JTripPoint.hpp @@ -0,0 +1,83 @@ +/// +/// JTripPoint.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 "TripPoint.hpp" + +#include "AutoText.hpp" +#include "Distance.hpp" +#include "DistanceUnits.hpp" +#include "DurationWithTimeZone.hpp" +#include "JAutoText.hpp" +#include "JDistance.hpp" +#include "JDistanceUnits.hpp" +#include "JDurationWithTimeZone.hpp" +#include "JFunc_void.hpp" +#include "JTravelEstimates.hpp" +#include "TravelEstimates.hpp" +#include +#include +#include +#include + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "TripPoint" and the the Kotlin data class "TripPoint". + */ + struct JTripPoint final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/TripPoint;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct TripPoint by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + TripPoint toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldLatitude = clazz->getField("latitude"); + double latitude = this->getFieldValue(fieldLatitude); + static const auto fieldLongitude = clazz->getField("longitude"); + double longitude = this->getFieldValue(fieldLongitude); + static const auto fieldName = clazz->getField("name"); + jni::local_ref name = this->getFieldValue(fieldName); + static const auto fieldTravelEstimates = clazz->getField("travelEstimates"); + jni::local_ref travelEstimates = this->getFieldValue(fieldTravelEstimates); + return TripPoint( + latitude, + longitude, + name->toStdString(), + travelEstimates->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 TripPoint& value) { + using JSignature = JTripPoint(double, double, jni::alias_ref, jni::alias_ref); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + value.latitude, + value.longitude, + jni::make_jstring(value.name), + JTravelEstimates::fromCpp(value.travelEstimates) + ); + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JTurnType.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JTurnType.hpp new file mode 100644 index 000000000..15b508df1 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JTurnType.hpp @@ -0,0 +1,79 @@ +/// +/// JTurnType.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 "TurnType.hpp" + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ enum "TurnType" and the the Kotlin enum "TurnType". + */ + struct JTurnType final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/TurnType;"; + + public: + /** + * Convert this Java/Kotlin-based enum to the C++ enum TurnType. + */ + [[maybe_unused]] + [[nodiscard]] + TurnType toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldOrdinal = clazz->getField("value"); + int ordinal = this->getFieldValue(fieldOrdinal); + return static_cast(ordinal); + } + + public: + /** + * Create a Java/Kotlin-based enum with the given C++ enum's value. + */ + [[maybe_unused]] + static jni::alias_ref fromCpp(TurnType value) { + static const auto clazz = javaClassStatic(); + switch (value) { + case TurnType::NOTURN: + static const auto fieldNOTURN = clazz->getStaticField("NOTURN"); + return clazz->getStaticFieldValue(fieldNOTURN); + case TurnType::SLIGHTLEFT: + static const auto fieldSLIGHTLEFT = clazz->getStaticField("SLIGHTLEFT"); + return clazz->getStaticFieldValue(fieldSLIGHTLEFT); + case TurnType::SLIGHTRIGHT: + static const auto fieldSLIGHTRIGHT = clazz->getStaticField("SLIGHTRIGHT"); + return clazz->getStaticFieldValue(fieldSLIGHTRIGHT); + case TurnType::NORMALLEFT: + static const auto fieldNORMALLEFT = clazz->getStaticField("NORMALLEFT"); + return clazz->getStaticFieldValue(fieldNORMALLEFT); + case TurnType::NORMALRIGHT: + static const auto fieldNORMALRIGHT = clazz->getStaticField("NORMALRIGHT"); + return clazz->getStaticFieldValue(fieldNORMALRIGHT); + case TurnType::SHARPLEFT: + static const auto fieldSHARPLEFT = clazz->getStaticField("SHARPLEFT"); + return clazz->getStaticFieldValue(fieldSHARPLEFT); + case TurnType::SHARPRIGHT: + static const auto fieldSHARPRIGHT = clazz->getStaticField("SHARPRIGHT"); + return clazz->getStaticFieldValue(fieldSHARPRIGHT); + case TurnType::UTURNLEFT: + static const auto fieldUTURNLEFT = clazz->getStaticField("UTURNLEFT"); + return clazz->getStaticFieldValue(fieldUTURNLEFT); + case TurnType::UTURNRIGHT: + static const auto fieldUTURNRIGHT = clazz->getStaticField("UTURNRIGHT"); + return clazz->getStaticFieldValue(fieldUTURNRIGHT); + default: + std::string stringValue = std::to_string(static_cast(value)); + throw std::invalid_argument("Invalid enum value (" + stringValue + "!"); + } + } + }; + +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JVariant_AssetImage_GlyphImage.cpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JVariant_AssetImage_GlyphImage.cpp new file mode 100644 index 000000000..6cb9d21e0 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JVariant_AssetImage_GlyphImage.cpp @@ -0,0 +1,26 @@ +/// +/// JVariant_AssetImage_GlyphImage.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include "JVariant_AssetImage_GlyphImage.hpp" + +namespace margelo::nitro::test { + /** + * Converts JVariant_AssetImage_GlyphImage to std::variant + */ + std::variant JVariant_AssetImage_GlyphImage::toCpp() const { + if (isInstanceOf(JVariant_AssetImage_GlyphImage_impl::First::javaClassStatic())) { + // It's a `AssetImage` + auto jniValue = static_cast(this)->getValue(); + return jniValue->toCpp(); + } else if (isInstanceOf(JVariant_AssetImage_GlyphImage_impl::Second::javaClassStatic())) { + // It's a `GlyphImage` + auto jniValue = static_cast(this)->getValue(); + return jniValue->toCpp(); + } + throw std::invalid_argument("Variant is unknown Kotlin instance!"); + } +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JVariant_AssetImage_GlyphImage.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JVariant_AssetImage_GlyphImage.hpp new file mode 100644 index 000000000..3d24f417a --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JVariant_AssetImage_GlyphImage.hpp @@ -0,0 +1,75 @@ +/// +/// JVariant_AssetImage_GlyphImage.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 + +#include "AssetImage.hpp" +#include "GlyphImage.hpp" +#include +#include "JAssetImage.hpp" +#include "NitroColor.hpp" +#include +#include "JNitroColor.hpp" +#include +#include "JGlyphImage.hpp" + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ std::variant and the Java class "Variant_AssetImage_GlyphImage". + */ + class JVariant_AssetImage_GlyphImage: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/Variant_AssetImage_GlyphImage;"; + + static jni::local_ref create_0(jni::alias_ref value) { + static const auto method = javaClassStatic()->getStaticMethod)>("create"); + return method(javaClassStatic(), value); + } + static jni::local_ref create_1(jni::alias_ref value) { + static const auto method = javaClassStatic()->getStaticMethod)>("create"); + return method(javaClassStatic(), value); + } + + static jni::local_ref fromCpp(const std::variant& variant) { + switch (variant.index()) { + case 0: return create_0(JAssetImage::fromCpp(std::get<0>(variant))); + case 1: return create_1(JGlyphImage::fromCpp(std::get<1>(variant))); + default: throw std::invalid_argument("Variant holds unknown index! (" + std::to_string(variant.index()) + ")"); + } + } + + [[nodiscard]] std::variant toCpp() const; + }; + + namespace JVariant_AssetImage_GlyphImage_impl { + class First final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/Variant_AssetImage_GlyphImage$First;"; + + [[nodiscard]] jni::local_ref getValue() const { + static const auto field = javaClassStatic()->getField("value"); + return getFieldValue(field); + } + }; + + class Second final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/Variant_AssetImage_GlyphImage$Second;"; + + [[nodiscard]] jni::local_ref getValue() const { + static const auto field = javaClassStatic()->getField("value"); + return getFieldValue(field); + } + }; + } // namespace JVariant_AssetImage_GlyphImage_impl +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JVariant_PreferredImageLane_ImageLane.cpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JVariant_PreferredImageLane_ImageLane.cpp new file mode 100644 index 000000000..1fd975706 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JVariant_PreferredImageLane_ImageLane.cpp @@ -0,0 +1,26 @@ +/// +/// JVariant_PreferredImageLane_ImageLane.cpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +#include "JVariant_PreferredImageLane_ImageLane.hpp" + +namespace margelo::nitro::test { + /** + * Converts JVariant_PreferredImageLane_ImageLane to std::variant + */ + std::variant JVariant_PreferredImageLane_ImageLane::toCpp() const { + if (isInstanceOf(JVariant_PreferredImageLane_ImageLane_impl::First::javaClassStatic())) { + // It's a `PreferredImageLane` + auto jniValue = static_cast(this)->getValue(); + return jniValue->toCpp(); + } else if (isInstanceOf(JVariant_PreferredImageLane_ImageLane_impl::Second::javaClassStatic())) { + // It's a `ImageLane` + auto jniValue = static_cast(this)->getValue(); + return jniValue->toCpp(); + } + throw std::invalid_argument("Variant is unknown Kotlin instance!"); + } +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/JVariant_PreferredImageLane_ImageLane.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JVariant_PreferredImageLane_ImageLane.hpp new file mode 100644 index 000000000..ac8f1c306 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/JVariant_PreferredImageLane_ImageLane.hpp @@ -0,0 +1,81 @@ +/// +/// JVariant_PreferredImageLane_ImageLane.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 + +#include "PreferredImageLane.hpp" +#include "ImageLane.hpp" +#include +#include "JPreferredImageLane.hpp" +#include "AssetImage.hpp" +#include "GlyphImage.hpp" +#include "JNitroImage.hpp" +#include "JAssetImage.hpp" +#include "NitroColor.hpp" +#include +#include "JNitroColor.hpp" +#include +#include "JGlyphImage.hpp" +#include +#include "JImageLane.hpp" + +namespace margelo::nitro::test { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ std::variant and the Java class "Variant_PreferredImageLane_ImageLane". + */ + class JVariant_PreferredImageLane_ImageLane: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/Variant_PreferredImageLane_ImageLane;"; + + static jni::local_ref create_0(jni::alias_ref value) { + static const auto method = javaClassStatic()->getStaticMethod)>("create"); + return method(javaClassStatic(), value); + } + static jni::local_ref create_1(jni::alias_ref value) { + static const auto method = javaClassStatic()->getStaticMethod)>("create"); + return method(javaClassStatic(), value); + } + + static jni::local_ref fromCpp(const std::variant& variant) { + switch (variant.index()) { + case 0: return create_0(JPreferredImageLane::fromCpp(std::get<0>(variant))); + case 1: return create_1(JImageLane::fromCpp(std::get<1>(variant))); + default: throw std::invalid_argument("Variant holds unknown index! (" + std::to_string(variant.index()) + ")"); + } + } + + [[nodiscard]] std::variant toCpp() const; + }; + + namespace JVariant_PreferredImageLane_ImageLane_impl { + class First final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/Variant_PreferredImageLane_ImageLane$First;"; + + [[nodiscard]] jni::local_ref getValue() const { + static const auto field = javaClassStatic()->getField("value"); + return getFieldValue(field); + } + }; + + class Second final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/test/Variant_PreferredImageLane_ImageLane$Second;"; + + [[nodiscard]] jni::local_ref getValue() const { + static const auto field = javaClassStatic()->getField("value"); + return getFieldValue(field); + } + }; + } // namespace JVariant_PreferredImageLane_ImageLane_impl +} // namespace margelo::nitro::test diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/views/JHybridRecyclableTestViewStateUpdater.cpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/views/JHybridRecyclableTestViewStateUpdater.cpp index d292d3166..9dffa95a1 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/android/c++/views/JHybridRecyclableTestViewStateUpdater.cpp +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/views/JHybridRecyclableTestViewStateUpdater.cpp @@ -28,7 +28,7 @@ void JHybridRecyclableTestViewStateUpdater::updateViewProps(jni::alias_ref(rawStateWrapper)}; std::shared_ptr state = stateWrapper->cthis()->getState(); - auto concreteState = std::static_pointer_cast(state); + auto concreteState = std::dynamic_pointer_cast(state); const HybridRecyclableTestViewState& data = concreteState->getData(); const std::optional& maybeProps = data.getProps(); if (!maybeProps.has_value()) { diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/views/JHybridRecyclableTestViewStateUpdater.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/views/JHybridRecyclableTestViewStateUpdater.hpp index 1b86fab31..8d38fb9c0 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/android/c++/views/JHybridRecyclableTestViewStateUpdater.hpp +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/views/JHybridRecyclableTestViewStateUpdater.hpp @@ -24,7 +24,7 @@ namespace margelo::nitro::test::views { using namespace facebook; -class JHybridRecyclableTestViewStateUpdater final: public jni::JavaClass { +class JHybridRecyclableTestViewStateUpdater: public jni::JavaClass { public: static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/test/views/HybridRecyclableTestViewStateUpdater;"; diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/views/JHybridTestViewStateUpdater.cpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/views/JHybridTestViewStateUpdater.cpp index c736601cf..e284ad638 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/android/c++/views/JHybridTestViewStateUpdater.cpp +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/views/JHybridTestViewStateUpdater.cpp @@ -28,7 +28,7 @@ void JHybridTestViewStateUpdater::updateViewProps(jni::alias_ref /* static_cast(rawStateWrapper)}; std::shared_ptr state = stateWrapper->cthis()->getState(); - auto concreteState = std::static_pointer_cast(state); + auto concreteState = std::dynamic_pointer_cast(state); const HybridTestViewState& data = concreteState->getData(); const std::optional& maybeProps = data.getProps(); if (!maybeProps.has_value()) { diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/c++/views/JHybridTestViewStateUpdater.hpp b/packages/react-native-nitro-test/nitrogen/generated/android/c++/views/JHybridTestViewStateUpdater.hpp index db43b65d2..7a0cfccc8 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/android/c++/views/JHybridTestViewStateUpdater.hpp +++ b/packages/react-native-nitro-test/nitrogen/generated/android/c++/views/JHybridTestViewStateUpdater.hpp @@ -24,7 +24,7 @@ namespace margelo::nitro::test::views { using namespace facebook; -class JHybridTestViewStateUpdater final: public jni::JavaClass { +class JHybridTestViewStateUpdater: public jni::JavaClass { public: static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/test/views/HybridTestViewStateUpdater;"; diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/AssetImage.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/AssetImage.kt new file mode 100644 index 000000000..f15bedb81 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/AssetImage.kt @@ -0,0 +1,53 @@ +/// +/// AssetImage.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 + + +/** + * Represents the JavaScript object/struct "AssetImage". + */ +@DoNotStrip +@Keep +data class AssetImage( + @DoNotStrip + @Keep + val color: NitroColor?, + @DoNotStrip + @Keep + val packager_asset: Boolean, + @DoNotStrip + @Keep + val height: Double, + @DoNotStrip + @Keep + val width: Double, + @DoNotStrip + @Keep + val scale: Double, + @DoNotStrip + @Keep + val uri: String +) { + /* primary constructor */ + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(color: NitroColor?, packager_asset: Boolean, height: Double, width: Double, scale: Double, uri: String): AssetImage { + return AssetImage(color, packager_asset, height, width, scale, uri) + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/AutoText.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/AutoText.kt new file mode 100644 index 000000000..3b0b3ee36 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/AutoText.kt @@ -0,0 +1,44 @@ +/// +/// AutoText.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 + + +/** + * Represents the JavaScript object/struct "AutoText". + */ +@DoNotStrip +@Keep +data class AutoText( + @DoNotStrip + @Keep + val text: String, + @DoNotStrip + @Keep + val distance: Distance?, + @DoNotStrip + @Keep + val duration: Double? +) { + /* primary constructor */ + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(text: String, distance: Distance?, duration: Double?): AutoText { + return AutoText(text, distance, duration) + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/Distance.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/Distance.kt new file mode 100644 index 000000000..63bdf1743 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/Distance.kt @@ -0,0 +1,41 @@ +/// +/// Distance.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 + + +/** + * Represents the JavaScript object/struct "Distance". + */ +@DoNotStrip +@Keep +data class Distance( + @DoNotStrip + @Keep + val value: Double, + @DoNotStrip + @Keep + val unit: DistanceUnits +) { + /* primary constructor */ + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(value: Double, unit: DistanceUnits): Distance { + return Distance(value, unit) + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/DistanceUnits.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/DistanceUnits.kt new file mode 100644 index 000000000..dc28c306a --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/DistanceUnits.kt @@ -0,0 +1,26 @@ +/// +/// DistanceUnits.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 + +/** + * Represents the JavaScript enum/union "DistanceUnits". + */ +@DoNotStrip +@Keep +enum class DistanceUnits(@DoNotStrip @Keep val value: Int) { + METERS(0), + MILES(1), + KILOMETERS(2), + YARDS(3), + FEET(4); + + companion object +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/DurationWithTimeZone.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/DurationWithTimeZone.kt new file mode 100644 index 000000000..aefd884d0 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/DurationWithTimeZone.kt @@ -0,0 +1,41 @@ +/// +/// DurationWithTimeZone.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 + + +/** + * Represents the JavaScript object/struct "DurationWithTimeZone". + */ +@DoNotStrip +@Keep +data class DurationWithTimeZone( + @DoNotStrip + @Keep + val timezone: String, + @DoNotStrip + @Keep + val seconds: Double +) { + /* primary constructor */ + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(timezone: String, seconds: Double): DurationWithTimeZone { + return DurationWithTimeZone(timezone, seconds) + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/ForkType.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/ForkType.kt new file mode 100644 index 000000000..69370a4a7 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/ForkType.kt @@ -0,0 +1,23 @@ +/// +/// ForkType.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 + +/** + * Represents the JavaScript enum/union "ForkType". + */ +@DoNotStrip +@Keep +enum class ForkType(@DoNotStrip @Keep val value: Int) { + LEFT(0), + RIGHT(1); + + companion object +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/GlyphImage.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/GlyphImage.kt new file mode 100644 index 000000000..82967c83d --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/GlyphImage.kt @@ -0,0 +1,47 @@ +/// +/// GlyphImage.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 + + +/** + * Represents the JavaScript object/struct "GlyphImage". + */ +@DoNotStrip +@Keep +data class GlyphImage( + @DoNotStrip + @Keep + val glyph: Double, + @DoNotStrip + @Keep + val color: NitroColor, + @DoNotStrip + @Keep + val backgroundColor: NitroColor, + @DoNotStrip + @Keep + val fontScale: Double? +) { + /* primary constructor */ + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(glyph: Double, color: NitroColor, backgroundColor: NitroColor, fontScale: Double?): GlyphImage { + return GlyphImage(glyph, color, backgroundColor, fontScale) + } + } +} 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 49a02d5b0..7cf2fc5b9 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 @@ -152,6 +152,14 @@ abstract class HybridTestObjectSwiftKotlinSpec: HybridObject() { @Keep abstract fun getVariantHybrid(variant: Variant_HybridTestObjectSwiftKotlinSpec_Person): Variant_HybridTestObjectSwiftKotlinSpec_Person + @DoNotStrip + @Keep + abstract fun updateTravelEstimates(templateId: String, steps: Array): Unit + + @DoNotStrip + @Keep + abstract fun updateManeuvers(templateId: String, maneuvers: Array): Unit + @DoNotStrip @Keep abstract fun simpleFunc(): Unit diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/ImageLane.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/ImageLane.kt new file mode 100644 index 000000000..285e53d78 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/ImageLane.kt @@ -0,0 +1,41 @@ +/// +/// ImageLane.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 + + +/** + * Represents the JavaScript object/struct "ImageLane". + */ +@DoNotStrip +@Keep +data class ImageLane( + @DoNotStrip + @Keep + val image: NitroImage, + @DoNotStrip + @Keep + val angles: DoubleArray +) { + /* primary constructor */ + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(image: NitroImage, angles: DoubleArray): ImageLane { + return ImageLane(image, angles) + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/KeepType.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/KeepType.kt new file mode 100644 index 000000000..6976a8c31 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/KeepType.kt @@ -0,0 +1,24 @@ +/// +/// KeepType.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 + +/** + * Represents the JavaScript enum/union "KeepType". + */ +@DoNotStrip +@Keep +enum class KeepType(@DoNotStrip @Keep val value: Int) { + LEFT(0), + RIGHT(1), + FOLLOWROAD(2); + + companion object +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/LaneGuidance.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/LaneGuidance.kt new file mode 100644 index 000000000..656d1cc7b --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/LaneGuidance.kt @@ -0,0 +1,41 @@ +/// +/// LaneGuidance.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 + + +/** + * Represents the JavaScript object/struct "LaneGuidance". + */ +@DoNotStrip +@Keep +data class LaneGuidance( + @DoNotStrip + @Keep + val instructionVariants: Array, + @DoNotStrip + @Keep + val lanes: Array +) { + /* primary constructor */ + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(instructionVariants: Array, lanes: Array): LaneGuidance { + return LaneGuidance(instructionVariants, lanes) + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/ManeuverType.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/ManeuverType.kt new file mode 100644 index 000000000..013305748 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/ManeuverType.kt @@ -0,0 +1,33 @@ +/// +/// ManeuverType.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 + +/** + * Represents the JavaScript enum/union "ManeuverType". + */ +@DoNotStrip +@Keep +enum class ManeuverType(@DoNotStrip @Keep val value: Int) { + DEPART(0), + ARRIVE(10), + ARRIVELEFT(11), + ARRIVERIGHT(12), + STRAIGHT(20), + TURN(30), + ROUNDABOUT(40), + OFFRAMP(50), + ONRAMP(60), + FORK(70), + ENTERFERRY(80), + KEEP(90); + + companion object +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/NitroAttributedString.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/NitroAttributedString.kt new file mode 100644 index 000000000..300823240 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/NitroAttributedString.kt @@ -0,0 +1,41 @@ +/// +/// NitroAttributedString.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 + + +/** + * Represents the JavaScript object/struct "NitroAttributedString". + */ +@DoNotStrip +@Keep +data class NitroAttributedString( + @DoNotStrip + @Keep + val text: String, + @DoNotStrip + @Keep + val images: Array? +) { + /* primary constructor */ + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(text: String, images: Array?): NitroAttributedString { + return NitroAttributedString(text, images) + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/NitroAttributedStringImage.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/NitroAttributedStringImage.kt new file mode 100644 index 000000000..71a3569e7 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/NitroAttributedStringImage.kt @@ -0,0 +1,41 @@ +/// +/// NitroAttributedStringImage.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 + + +/** + * Represents the JavaScript object/struct "NitroAttributedStringImage". + */ +@DoNotStrip +@Keep +data class NitroAttributedStringImage( + @DoNotStrip + @Keep + val image: NitroImage, + @DoNotStrip + @Keep + val position: Double +) { + /* primary constructor */ + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(image: NitroImage, position: Double): NitroAttributedStringImage { + return NitroAttributedStringImage(image, position) + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/NitroColor.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/NitroColor.kt new file mode 100644 index 000000000..163d22ac0 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/NitroColor.kt @@ -0,0 +1,41 @@ +/// +/// NitroColor.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 + + +/** + * Represents the JavaScript object/struct "NitroColor". + */ +@DoNotStrip +@Keep +data class NitroColor( + @DoNotStrip + @Keep + val lightColor: Double, + @DoNotStrip + @Keep + val darkColor: Double +) { + /* primary constructor */ + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(lightColor: Double, darkColor: Double): NitroColor { + return NitroColor(lightColor, darkColor) + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/NitroImage.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/NitroImage.kt new file mode 100644 index 000000000..f19b770d4 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/NitroImage.kt @@ -0,0 +1,59 @@ +/// +/// NitroImage.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 com.facebook.proguard.annotations.DoNotStrip + + +/** + * Represents the TypeScript variant "AssetImage | GlyphImage". + */ +@Suppress("ClassName") +@DoNotStrip +sealed class NitroImage { + @DoNotStrip + data class First(@DoNotStrip val value: AssetImage): NitroImage() + @DoNotStrip + data class Second(@DoNotStrip val value: GlyphImage): NitroImage() + + @Deprecated("getAs() is not type-safe. Use fold/asFirstOrNull/asSecondOrNull instead.", level = DeprecationLevel.ERROR) + inline fun getAs(): T? = when (this) { + is First -> value as? T + is Second -> value as? T + } + + val isFirst: Boolean + get() = this is First + val isSecond: Boolean + get() = this is Second + + fun asFirstOrNull(): AssetImage? { + val value = (this as? First)?.value ?: return null + return value + } + fun asSecondOrNull(): GlyphImage? { + val value = (this as? Second)?.value ?: return null + return value + } + + inline fun match(first: (AssetImage) -> R, second: (GlyphImage) -> R): R { + return when (this) { + is First -> first(value) + is Second -> second(value) + } + } + + companion object { + @JvmStatic + @DoNotStrip + fun create(value: AssetImage): NitroImage = First(value) + @JvmStatic + @DoNotStrip + fun create(value: GlyphImage): NitroImage = Second(value) + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/NitroRoutingManeuver.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/NitroRoutingManeuver.kt new file mode 100644 index 000000000..9acb3baeb --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/NitroRoutingManeuver.kt @@ -0,0 +1,92 @@ +/// +/// NitroRoutingManeuver.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 + + +/** + * Represents the JavaScript object/struct "NitroRoutingManeuver". + */ +@DoNotStrip +@Keep +data class NitroRoutingManeuver( + @DoNotStrip + @Keep + val attributedInstructionVariants: Array, + @DoNotStrip + @Keep + val symbolImage: NitroImage, + @DoNotStrip + @Keep + val junctionImage: Variant_AssetImage_GlyphImage?, + @DoNotStrip + @Keep + val turnType: TurnType?, + @DoNotStrip + @Keep + val angle: Double?, + @DoNotStrip + @Keep + val elementAngles: DoubleArray?, + @DoNotStrip + @Keep + val exitNumber: Double?, + @DoNotStrip + @Keep + val offRampType: OffRampType?, + @DoNotStrip + @Keep + val onRampType: OnRampType?, + @DoNotStrip + @Keep + val forkType: ForkType?, + @DoNotStrip + @Keep + val keepType: KeepType?, + @DoNotStrip + @Keep + val linkedLaneGuidance: LaneGuidance?, + @DoNotStrip + @Keep + val cardBackgroundColor: NitroColor, + @DoNotStrip + @Keep + val id: String, + @DoNotStrip + @Keep + val travelEstimates: TravelEstimates, + @DoNotStrip + @Keep + val trafficSide: TrafficSide, + @DoNotStrip + @Keep + val maneuverType: ManeuverType, + @DoNotStrip + @Keep + val roadName: Array?, + @DoNotStrip + @Keep + val highwayExitLabel: String? +) { + /* primary constructor */ + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(attributedInstructionVariants: Array, symbolImage: NitroImage, junctionImage: Variant_AssetImage_GlyphImage?, turnType: TurnType?, angle: Double?, elementAngles: DoubleArray?, exitNumber: Double?, offRampType: OffRampType?, onRampType: OnRampType?, forkType: ForkType?, keepType: KeepType?, linkedLaneGuidance: LaneGuidance?, cardBackgroundColor: NitroColor, id: String, travelEstimates: TravelEstimates, trafficSide: TrafficSide, maneuverType: ManeuverType, roadName: Array?, highwayExitLabel: String?): NitroRoutingManeuver { + return NitroRoutingManeuver(attributedInstructionVariants, symbolImage, junctionImage, turnType, angle, elementAngles, exitNumber, offRampType, onRampType, forkType, keepType, linkedLaneGuidance, cardBackgroundColor, id, travelEstimates, trafficSide, maneuverType, roadName, highwayExitLabel) + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/OffRampType.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/OffRampType.kt new file mode 100644 index 000000000..0a49a12b1 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/OffRampType.kt @@ -0,0 +1,25 @@ +/// +/// OffRampType.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 + +/** + * Represents the JavaScript enum/union "OffRampType". + */ +@DoNotStrip +@Keep +enum class OffRampType(@DoNotStrip @Keep val value: Int) { + SLIGHTLEFT(0), + SLIGHTRIGHT(1), + NORMALLEFT(2), + NORMALRIGHT(3); + + companion object +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/OnRampType.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/OnRampType.kt new file mode 100644 index 000000000..d08d57de6 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/OnRampType.kt @@ -0,0 +1,29 @@ +/// +/// OnRampType.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 + +/** + * Represents the JavaScript enum/union "OnRampType". + */ +@DoNotStrip +@Keep +enum class OnRampType(@DoNotStrip @Keep val value: Int) { + SLIGHTLEFT(0), + SLIGHTRIGHT(1), + NORMALLEFT(2), + NORMALRIGHT(3), + SHARPLEFT(4), + SHARPRIGHT(5), + UTURNLEFT(6), + UTURNRIGHT(7); + + companion object +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/PreferredImageLane.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/PreferredImageLane.kt new file mode 100644 index 000000000..d78083cbc --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/PreferredImageLane.kt @@ -0,0 +1,47 @@ +/// +/// PreferredImageLane.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 + + +/** + * Represents the JavaScript object/struct "PreferredImageLane". + */ +@DoNotStrip +@Keep +data class PreferredImageLane( + @DoNotStrip + @Keep + val image: NitroImage, + @DoNotStrip + @Keep + val highlightedAngle: Double, + @DoNotStrip + @Keep + val isPreferred: Boolean, + @DoNotStrip + @Keep + val angles: DoubleArray +) { + /* primary constructor */ + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(image: NitroImage, highlightedAngle: Double, isPreferred: Boolean, angles: DoubleArray): PreferredImageLane { + return PreferredImageLane(image, highlightedAngle, isPreferred, angles) + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/TrafficSide.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/TrafficSide.kt new file mode 100644 index 000000000..6e2acc035 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/TrafficSide.kt @@ -0,0 +1,23 @@ +/// +/// TrafficSide.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 + +/** + * Represents the JavaScript enum/union "TrafficSide". + */ +@DoNotStrip +@Keep +enum class TrafficSide(@DoNotStrip @Keep val value: Int) { + RIGHT(0), + LEFT(1); + + companion object +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/TravelEstimates.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/TravelEstimates.kt new file mode 100644 index 000000000..61cec717e --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/TravelEstimates.kt @@ -0,0 +1,51 @@ +/// +/// TravelEstimates.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 + + +/** + * Represents the JavaScript object/struct "TravelEstimates". + */ +@DoNotStrip +@Keep +data class TravelEstimates( + @DoNotStrip + @Keep + val distanceRemaining: Distance, + @DoNotStrip + @Keep + val timeRemaining: DurationWithTimeZone, + @DoNotStrip + @Keep + val tripText: AutoText?, + @DoNotStrip + @Keep + val _doNotUse: Func_void? +) { + /** + * Create a new instance of TravelEstimates from Kotlin + */ + constructor(distanceRemaining: Distance, timeRemaining: DurationWithTimeZone, tripText: AutoText?, _doNotUse: (() -> Unit)?): + this(distanceRemaining, timeRemaining, tripText, _doNotUse?.let { Func_void_java(it) }) + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(distanceRemaining: Distance, timeRemaining: DurationWithTimeZone, tripText: AutoText?, _doNotUse: Func_void?): TravelEstimates { + return TravelEstimates(distanceRemaining, timeRemaining, tripText, _doNotUse) + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/TripPoint.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/TripPoint.kt new file mode 100644 index 000000000..52a66bb04 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/TripPoint.kt @@ -0,0 +1,47 @@ +/// +/// TripPoint.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 + + +/** + * Represents the JavaScript object/struct "TripPoint". + */ +@DoNotStrip +@Keep +data class TripPoint( + @DoNotStrip + @Keep + val latitude: Double, + @DoNotStrip + @Keep + val longitude: Double, + @DoNotStrip + @Keep + val name: String, + @DoNotStrip + @Keep + val travelEstimates: TravelEstimates +) { + /* primary constructor */ + + companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(latitude: Double, longitude: Double, name: String, travelEstimates: TravelEstimates): TripPoint { + return TripPoint(latitude, longitude, name, travelEstimates) + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/TurnType.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/TurnType.kt new file mode 100644 index 000000000..e9483f721 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/TurnType.kt @@ -0,0 +1,30 @@ +/// +/// TurnType.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 + +/** + * Represents the JavaScript enum/union "TurnType". + */ +@DoNotStrip +@Keep +enum class TurnType(@DoNotStrip @Keep val value: Int) { + NOTURN(0), + SLIGHTLEFT(1), + SLIGHTRIGHT(2), + NORMALLEFT(3), + NORMALRIGHT(4), + SHARPLEFT(5), + SHARPRIGHT(6), + UTURNLEFT(7), + UTURNRIGHT(8); + + companion object +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/Variant_AssetImage_GlyphImage.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/Variant_AssetImage_GlyphImage.kt new file mode 100644 index 000000000..647e6d749 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/Variant_AssetImage_GlyphImage.kt @@ -0,0 +1,59 @@ +/// +/// Variant_AssetImage_GlyphImage.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 com.facebook.proguard.annotations.DoNotStrip + + +/** + * Represents the TypeScript variant "AssetImage | GlyphImage". + */ +@Suppress("ClassName") +@DoNotStrip +sealed class Variant_AssetImage_GlyphImage { + @DoNotStrip + data class First(@DoNotStrip val value: AssetImage): Variant_AssetImage_GlyphImage() + @DoNotStrip + data class Second(@DoNotStrip val value: GlyphImage): Variant_AssetImage_GlyphImage() + + @Deprecated("getAs() is not type-safe. Use fold/asFirstOrNull/asSecondOrNull instead.", level = DeprecationLevel.ERROR) + inline fun getAs(): T? = when (this) { + is First -> value as? T + is Second -> value as? T + } + + val isFirst: Boolean + get() = this is First + val isSecond: Boolean + get() = this is Second + + fun asFirstOrNull(): AssetImage? { + val value = (this as? First)?.value ?: return null + return value + } + fun asSecondOrNull(): GlyphImage? { + val value = (this as? Second)?.value ?: return null + return value + } + + inline fun match(first: (AssetImage) -> R, second: (GlyphImage) -> R): R { + return when (this) { + is First -> first(value) + is Second -> second(value) + } + } + + companion object { + @JvmStatic + @DoNotStrip + fun create(value: AssetImage): Variant_AssetImage_GlyphImage = First(value) + @JvmStatic + @DoNotStrip + fun create(value: GlyphImage): Variant_AssetImage_GlyphImage = Second(value) + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/Variant_PreferredImageLane_ImageLane.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/Variant_PreferredImageLane_ImageLane.kt new file mode 100644 index 000000000..d679a3eca --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/Variant_PreferredImageLane_ImageLane.kt @@ -0,0 +1,59 @@ +/// +/// Variant_PreferredImageLane_ImageLane.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 com.facebook.proguard.annotations.DoNotStrip + + +/** + * Represents the TypeScript variant "PreferredImageLane | ImageLane". + */ +@Suppress("ClassName") +@DoNotStrip +sealed class Variant_PreferredImageLane_ImageLane { + @DoNotStrip + data class First(@DoNotStrip val value: PreferredImageLane): Variant_PreferredImageLane_ImageLane() + @DoNotStrip + data class Second(@DoNotStrip val value: ImageLane): Variant_PreferredImageLane_ImageLane() + + @Deprecated("getAs() is not type-safe. Use fold/asFirstOrNull/asSecondOrNull instead.", level = DeprecationLevel.ERROR) + inline fun getAs(): T? = when (this) { + is First -> value as? T + is Second -> value as? T + } + + val isFirst: Boolean + get() = this is First + val isSecond: Boolean + get() = this is Second + + fun asFirstOrNull(): PreferredImageLane? { + val value = (this as? First)?.value ?: return null + return value + } + fun asSecondOrNull(): ImageLane? { + val value = (this as? Second)?.value ?: return null + return value + } + + inline fun match(first: (PreferredImageLane) -> R, second: (ImageLane) -> R): R { + return when (this) { + is First -> first(value) + is Second -> second(value) + } + } + + companion object { + @JvmStatic + @DoNotStrip + fun create(value: PreferredImageLane): Variant_PreferredImageLane_ImageLane = First(value) + @JvmStatic + @DoNotStrip + fun create(value: ImageLane): Variant_PreferredImageLane_ImageLane = Second(value) + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/views/HybridRecyclableTestViewManager.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/views/HybridRecyclableTestViewManager.kt index 19b59924a..4ed96ed4f 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/views/HybridRecyclableTestViewManager.kt +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/views/HybridRecyclableTestViewManager.kt @@ -19,7 +19,7 @@ import com.margelo.nitro.test.* /** * Represents the React Native `ViewManager` for the "RecyclableTestView" Nitro HybridView. */ -public class HybridRecyclableTestViewManager: SimpleViewManager() { +open class HybridRecyclableTestViewManager: SimpleViewManager() { init { if (RecyclableView::class.java.isAssignableFrom(HybridRecyclableTestView::class.java)) { // Enable view recycling diff --git a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/views/HybridTestViewManager.kt b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/views/HybridTestViewManager.kt index a157d5dcc..567ff4f87 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/views/HybridTestViewManager.kt +++ b/packages/react-native-nitro-test/nitrogen/generated/android/kotlin/com/margelo/nitro/test/views/HybridTestViewManager.kt @@ -19,7 +19,7 @@ import com.margelo.nitro.test.* /** * Represents the React Native `ViewManager` for the "TestView" Nitro HybridView. */ -public class HybridTestViewManager: SimpleViewManager() { +open class HybridTestViewManager: SimpleViewManager() { init { if (RecyclableView::class.java.isAssignableFrom(HybridTestView::class.java)) { // Enable view recycling diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/NitroTest-Swift-Cxx-Bridge.cpp b/packages/react-native-nitro-test/nitrogen/generated/ios/NitroTest-Swift-Cxx-Bridge.cpp index 7b54268b1..c2a9f3d35 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/ios/NitroTest-Swift-Cxx-Bridge.cpp +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/NitroTest-Swift-Cxx-Bridge.cpp @@ -100,6 +100,14 @@ namespace margelo::nitro::test::bridge::swift { return swiftPart.toUnsafe(); } + // pragma MARK: std::function + Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept { + auto swiftClosure = NitroTest::Func_void::fromUnsafe(swiftClosureWrapper); + return [swiftClosure = std::move(swiftClosure)]() mutable -> void { + swiftClosure.call(); + }; + } + // pragma MARK: std::function Func_void_double create_Func_void_double(void* NON_NULL swiftClosureWrapper) noexcept { auto swiftClosure = NitroTest::Func_void_double::fromUnsafe(swiftClosureWrapper); @@ -116,14 +124,6 @@ namespace margelo::nitro::test::bridge::swift { }; } - // pragma MARK: std::function - Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept { - auto swiftClosure = NitroTest::Func_void::fromUnsafe(swiftClosureWrapper); - return [swiftClosure = std::move(swiftClosure)]() mutable -> void { - swiftClosure.call(); - }; - } - // pragma MARK: std::function Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept { auto swiftClosure = NitroTest::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper); 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 8188237c9..e2c022437 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 @@ -10,10 +10,24 @@ // Forward declarations of C++ defined types // Forward declaration of `ArrayBufferHolder` to properly resolve imports. namespace NitroModules { class ArrayBufferHolder; } +// Forward declaration of `AssetImage` to properly resolve imports. +namespace margelo::nitro::test { struct AssetImage; } +// Forward declaration of `AutoText` to properly resolve imports. +namespace margelo::nitro::test { struct AutoText; } // Forward declaration of `Car` to properly resolve imports. namespace margelo::nitro::test { struct Car; } +// Forward declaration of `DistanceUnits` to properly resolve imports. +namespace margelo::nitro::test { enum class DistanceUnits; } +// Forward declaration of `Distance` to properly resolve imports. +namespace margelo::nitro::test { struct Distance; } +// Forward declaration of `DurationWithTimeZone` to properly resolve imports. +namespace margelo::nitro::test { struct DurationWithTimeZone; } // Forward declaration of `ExternalObjectStruct` to properly resolve imports. namespace margelo::nitro::test { struct ExternalObjectStruct; } +// Forward declaration of `ForkType` to properly resolve imports. +namespace margelo::nitro::test { enum class ForkType; } +// Forward declaration of `GlyphImage` to properly resolve imports. +namespace margelo::nitro::test { struct GlyphImage; } // Forward declaration of `HybridBaseSpec` to properly resolve imports. namespace margelo::nitro::test { class HybridBaseSpec; } // Forward declaration of `HybridChildSpec` to properly resolve imports. @@ -28,10 +42,30 @@ namespace margelo::nitro::test::external { class HybridSomeExternalObjectSpec; } namespace margelo::nitro::test { class HybridTestObjectSwiftKotlinSpec; } // Forward declaration of `HybridTestViewSpec` to properly resolve imports. namespace margelo::nitro::test { class HybridTestViewSpec; } +// Forward declaration of `ImageLane` to properly resolve imports. +namespace margelo::nitro::test { struct ImageLane; } // Forward declaration of `JsStyleStruct` to properly resolve imports. namespace margelo::nitro::test { struct JsStyleStruct; } +// Forward declaration of `KeepType` to properly resolve imports. +namespace margelo::nitro::test { enum class KeepType; } +// Forward declaration of `LaneGuidance` to properly resolve imports. +namespace margelo::nitro::test { struct LaneGuidance; } +// Forward declaration of `ManeuverType` to properly resolve imports. +namespace margelo::nitro::test { enum class ManeuverType; } +// Forward declaration of `NitroAttributedStringImage` to properly resolve imports. +namespace margelo::nitro::test { struct NitroAttributedStringImage; } +// Forward declaration of `NitroAttributedString` to properly resolve imports. +namespace margelo::nitro::test { struct NitroAttributedString; } +// Forward declaration of `NitroColor` to properly resolve imports. +namespace margelo::nitro::test { struct NitroColor; } +// Forward declaration of `NitroRoutingManeuver` to properly resolve imports. +namespace margelo::nitro::test { struct NitroRoutingManeuver; } +// Forward declaration of `OffRampType` to properly resolve imports. +namespace margelo::nitro::test { enum class OffRampType; } // Forward declaration of `OldEnum` to properly resolve imports. namespace margelo::nitro::test { enum class OldEnum; } +// Forward declaration of `OnRampType` to properly resolve imports. +namespace margelo::nitro::test { enum class OnRampType; } // Forward declaration of `OptionalCallback` to properly resolve imports. namespace margelo::nitro::test { struct OptionalCallback; } // Forward declaration of `OptionalWrapper` to properly resolve imports. @@ -42,6 +76,16 @@ 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 `PreferredImageLane` to properly resolve imports. +namespace margelo::nitro::test { struct PreferredImageLane; } +// Forward declaration of `TrafficSide` to properly resolve imports. +namespace margelo::nitro::test { enum class TrafficSide; } +// Forward declaration of `TravelEstimates` to properly resolve imports. +namespace margelo::nitro::test { struct TravelEstimates; } +// Forward declaration of `TripPoint` to properly resolve imports. +namespace margelo::nitro::test { struct TripPoint; } +// Forward declaration of `TurnType` to properly resolve imports. +namespace margelo::nitro::test { enum class TurnType; } // Forward declaration of `WeirdNumbersEnum` to properly resolve imports. namespace margelo::nitro::test { enum class WeirdNumbersEnum; } // Forward declaration of `WrappedJsStruct` to properly resolve imports. @@ -64,21 +108,43 @@ namespace NitroTest { class HybridTestObjectSwiftKotlinSpec_cxx; } namespace NitroTest { class HybridTestViewSpec_cxx; } // Include C++ defined types +#include "AssetImage.hpp" +#include "AutoText.hpp" #include "Car.hpp" +#include "Distance.hpp" +#include "DistanceUnits.hpp" +#include "DurationWithTimeZone.hpp" #include "ExternalObjectStruct.hpp" +#include "ForkType.hpp" +#include "GlyphImage.hpp" #include "HybridBaseSpec.hpp" #include "HybridChildSpec.hpp" #include "HybridPlatformObjectSpec.hpp" #include "HybridRecyclableTestViewSpec.hpp" #include "HybridTestObjectSwiftKotlinSpec.hpp" #include "HybridTestViewSpec.hpp" +#include "ImageLane.hpp" #include "JsStyleStruct.hpp" +#include "KeepType.hpp" +#include "LaneGuidance.hpp" +#include "ManeuverType.hpp" +#include "NitroAttributedString.hpp" +#include "NitroAttributedStringImage.hpp" +#include "NitroColor.hpp" +#include "NitroRoutingManeuver.hpp" +#include "OffRampType.hpp" #include "OldEnum.hpp" +#include "OnRampType.hpp" #include "OptionalCallback.hpp" #include "OptionalWrapper.hpp" #include "PartialPerson.hpp" #include "Person.hpp" #include "Powertrain.hpp" +#include "PreferredImageLane.hpp" +#include "TrafficSide.hpp" +#include "TravelEstimates.hpp" +#include "TripPoint.hpp" +#include "TurnType.hpp" #include "WeirdNumbersEnum.hpp" #include "WrappedJsStruct.hpp" #include @@ -370,33 +436,283 @@ namespace margelo::nitro::test::bridge::swift { return std__variant_std__shared_ptr_HybridTestObjectSwiftKotlinSpec___Person_(value); } - // pragma MARK: std::variant + // pragma MARK: std::optional /** - * Wrapper struct for `std::variant`. + * Specialized version of `std::optional`. + */ + using std__optional_Distance_ = std::optional; + inline std::optional create_std__optional_Distance_(const Distance& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_Distance_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline Distance get_std__optional_Distance_(const std::optional& optional) noexcept { + return *optional; + } + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_double_ = std::optional; + inline std::optional create_std__optional_double_(const double& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_double_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline double get_std__optional_double_(const std::optional& optional) noexcept { + return *optional; + } + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_AutoText_ = std::optional; + inline std::optional create_std__optional_AutoText_(const AutoText& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_AutoText_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline AutoText get_std__optional_AutoText_(const std::optional& optional) noexcept { + return *optional; + } + + // pragma MARK: std::function + /** + * Specialized version of `std::function`. + */ + using Func_void = std::function; + /** + * Wrapper class for a `std::function`, this can be used from Swift. + */ + class Func_void_Wrapper final { + public: + explicit Func_void_Wrapper(std::function&& func): _function(std::make_unique>(std::move(func))) {} + inline void call() const noexcept { + _function->operator()(); + } + private: + std::unique_ptr> _function; + } SWIFT_NONCOPYABLE; + Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept; + inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept { + return Func_void_Wrapper(std::move(value)); + } + + // pragma MARK: std::optional> + /** + * Specialized version of `std::optional>`. + */ + using std__optional_std__function_void____ = std::optional>; + inline std::optional> create_std__optional_std__function_void____(const std::function& value) noexcept { + return std::optional>(value); + } + inline bool has_value_std__optional_std__function_void____(const std::optional>& optional) noexcept { + return optional.has_value(); + } + inline std::function get_std__optional_std__function_void____(const std::optional>& optional) noexcept { + return *optional; + } + + // pragma MARK: std::vector + /** + * Specialized version of `std::vector`. + */ + using std__vector_TripPoint_ = std::vector; + inline std::vector create_std__vector_TripPoint_(size_t size) noexcept { + std::vector vector; + vector.reserve(size); + return vector; + } + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_NitroColor_ = std::optional; + inline std::optional create_std__optional_NitroColor_(const NitroColor& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_NitroColor_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline NitroColor get_std__optional_NitroColor_(const std::optional& optional) noexcept { + return *optional; + } + + // pragma MARK: std::variant + /** + * Wrapper struct for `std::variant`. * std::variant cannot be used in Swift because of a Swift bug. * Not even specializing it works. So we create a wrapper struct. */ - struct std__variant_nitro__NullType__std__string_ final { - std::variant variant; - std__variant_nitro__NullType__std__string_(std::variant variant): variant(variant) { } - operator std::variant() const noexcept { + struct std__variant_AssetImage__GlyphImage_ final { + std::variant variant; + std__variant_AssetImage__GlyphImage_(std::variant variant): variant(variant) { } + operator std::variant() const noexcept { return variant; } inline size_t index() const noexcept { return variant.index(); } - inline nitro::NullType get_0() const noexcept { + inline AssetImage get_0() const noexcept { return std::get<0>(variant); } - inline std::string get_1() const noexcept { + inline GlyphImage get_1() const noexcept { return std::get<1>(variant); } }; - inline std__variant_nitro__NullType__std__string_ create_std__variant_nitro__NullType__std__string_(nitro::NullType value) noexcept { - return std__variant_nitro__NullType__std__string_(value); + inline std__variant_AssetImage__GlyphImage_ create_std__variant_AssetImage__GlyphImage_(const AssetImage& value) noexcept { + return std__variant_AssetImage__GlyphImage_(value); } - inline std__variant_nitro__NullType__std__string_ create_std__variant_nitro__NullType__std__string_(const std::string& value) noexcept { - return std__variant_nitro__NullType__std__string_(value); + inline std__variant_AssetImage__GlyphImage_ create_std__variant_AssetImage__GlyphImage_(const GlyphImage& value) noexcept { + return std__variant_AssetImage__GlyphImage_(value); + } + + // pragma MARK: std::vector + /** + * Specialized version of `std::vector`. + */ + using std__vector_NitroAttributedStringImage_ = std::vector; + inline std::vector create_std__vector_NitroAttributedStringImage_(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_NitroAttributedStringImage__ = std::optional>; + inline std::optional> create_std__optional_std__vector_NitroAttributedStringImage__(const std::vector& value) noexcept { + return std::optional>(value); + } + inline bool has_value_std__optional_std__vector_NitroAttributedStringImage__(const std::optional>& optional) noexcept { + return optional.has_value(); + } + inline std::vector get_std__optional_std__vector_NitroAttributedStringImage__(const std::optional>& optional) noexcept { + return *optional; + } + + // pragma MARK: std::vector + /** + * Specialized version of `std::vector`. + */ + using std__vector_NitroAttributedString_ = std::vector; + inline std::vector create_std__vector_NitroAttributedString_(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__variant_AssetImage__GlyphImage__ = std::optional>; + inline std::optional> create_std__optional_std__variant_AssetImage__GlyphImage__(const std::variant& value) noexcept { + return std::optional>(value); + } + inline bool has_value_std__optional_std__variant_AssetImage__GlyphImage__(const std::optional>& optional) noexcept { + return optional.has_value(); + } + inline std::variant get_std__optional_std__variant_AssetImage__GlyphImage__(const std::optional>& optional) noexcept { + return *optional; + } + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_TurnType_ = std::optional; + inline std::optional create_std__optional_TurnType_(const TurnType& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_TurnType_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline TurnType get_std__optional_TurnType_(const std::optional& optional) noexcept { + return *optional; + } + + // pragma MARK: std::optional> + /** + * Specialized version of `std::optional>`. + */ + using std__optional_std__vector_double__ = std::optional>; + inline std::optional> create_std__optional_std__vector_double__(const std::vector& value) noexcept { + return std::optional>(value); + } + inline bool has_value_std__optional_std__vector_double__(const std::optional>& optional) noexcept { + return optional.has_value(); + } + inline std::vector get_std__optional_std__vector_double__(const std::optional>& optional) noexcept { + return *optional; + } + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_OffRampType_ = std::optional; + inline std::optional create_std__optional_OffRampType_(const OffRampType& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_OffRampType_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline OffRampType get_std__optional_OffRampType_(const std::optional& optional) noexcept { + return *optional; + } + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_OnRampType_ = std::optional; + inline std::optional create_std__optional_OnRampType_(const OnRampType& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_OnRampType_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline OnRampType get_std__optional_OnRampType_(const std::optional& optional) noexcept { + return *optional; + } + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_ForkType_ = std::optional; + inline std::optional create_std__optional_ForkType_(const ForkType& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_ForkType_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline ForkType get_std__optional_ForkType_(const std::optional& optional) noexcept { + return *optional; + } + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_KeepType_ = std::optional; + inline std::optional create_std__optional_KeepType_(const KeepType& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_KeepType_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline KeepType get_std__optional_KeepType_(const std::optional& optional) noexcept { + return *optional; } // pragma MARK: std::vector @@ -410,6 +726,61 @@ namespace margelo::nitro::test::bridge::swift { return vector; } + // pragma MARK: std::variant + /** + * Wrapper struct for `std::variant`. + * std::variant cannot be used in Swift because of a Swift bug. + * Not even specializing it works. So we create a wrapper struct. + */ + struct std__variant_PreferredImageLane__ImageLane_ final { + std::variant variant; + std__variant_PreferredImageLane__ImageLane_(std::variant variant): variant(variant) { } + operator std::variant() const noexcept { + return variant; + } + inline size_t index() const noexcept { + return variant.index(); + } + inline PreferredImageLane get_0() const noexcept { + return std::get<0>(variant); + } + inline ImageLane get_1() const noexcept { + return std::get<1>(variant); + } + }; + inline std__variant_PreferredImageLane__ImageLane_ create_std__variant_PreferredImageLane__ImageLane_(const PreferredImageLane& value) noexcept { + return std__variant_PreferredImageLane__ImageLane_(value); + } + inline std__variant_PreferredImageLane__ImageLane_ create_std__variant_PreferredImageLane__ImageLane_(const ImageLane& value) noexcept { + return std__variant_PreferredImageLane__ImageLane_(value); + } + + // pragma MARK: std::vector> + /** + * Specialized version of `std::vector>`. + */ + using std__vector_std__variant_PreferredImageLane__ImageLane__ = std::vector>; + inline std::vector> create_std__vector_std__variant_PreferredImageLane__ImageLane__(size_t size) noexcept { + std::vector> vector; + vector.reserve(size); + return vector; + } + + // pragma MARK: std::optional + /** + * Specialized version of `std::optional`. + */ + using std__optional_LaneGuidance_ = std::optional; + inline std::optional create_std__optional_LaneGuidance_(const LaneGuidance& value) noexcept { + return std::optional(value); + } + inline bool has_value_std__optional_LaneGuidance_(const std::optional& optional) noexcept { + return optional.has_value(); + } + inline LaneGuidance get_std__optional_LaneGuidance_(const std::optional& optional) noexcept { + return *optional; + } + // pragma MARK: std::optional> /** * Specialized version of `std::optional>`. @@ -425,6 +796,46 @@ namespace margelo::nitro::test::bridge::swift { return *optional; } + // pragma MARK: std::vector + /** + * Specialized version of `std::vector`. + */ + using std__vector_NitroRoutingManeuver_ = std::vector; + inline std::vector create_std__vector_NitroRoutingManeuver_(size_t size) noexcept { + std::vector vector; + vector.reserve(size); + return vector; + } + + // pragma MARK: std::variant + /** + * Wrapper struct for `std::variant`. + * std::variant cannot be used in Swift because of a Swift bug. + * Not even specializing it works. So we create a wrapper struct. + */ + struct std__variant_nitro__NullType__std__string_ final { + std::variant variant; + std__variant_nitro__NullType__std__string_(std::variant variant): variant(variant) { } + operator std::variant() const noexcept { + return variant; + } + inline size_t index() const noexcept { + return variant.index(); + } + inline nitro::NullType get_0() const noexcept { + return std::get<0>(variant); + } + inline std::string get_1() const noexcept { + return std::get<1>(variant); + } + }; + inline std__variant_nitro__NullType__std__string_ create_std__variant_nitro__NullType__std__string_(nitro::NullType value) noexcept { + return std__variant_nitro__NullType__std__string_(value); + } + inline std__variant_nitro__NullType__std__string_ create_std__variant_nitro__NullType__std__string_(const std::string& value) noexcept { + return std__variant_nitro__NullType__std__string_(value); + } + // pragma MARK: std::optional /** * Specialized version of `std::optional`. @@ -492,21 +903,6 @@ namespace margelo::nitro::test::bridge::swift { return *optional; } - // pragma MARK: std::optional - /** - * Specialized version of `std::optional`. - */ - using std__optional_double_ = std::optional; - inline std::optional create_std__optional_double_(const double& value) noexcept { - return std::optional(value); - } - inline bool has_value_std__optional_double_(const std::optional& optional) noexcept { - return optional.has_value(); - } - inline double get_std__optional_double_(const std::optional& optional) noexcept { - return *optional; - } - // pragma MARK: std::vector /** * Specialized version of `std::vector`. @@ -562,28 +958,6 @@ namespace margelo::nitro::test::bridge::swift { return vector; } - // pragma MARK: std::function - /** - * Specialized version of `std::function`. - */ - using Func_void = std::function; - /** - * Wrapper class for a `std::function`, this can be used from Swift. - */ - class Func_void_Wrapper final { - public: - explicit Func_void_Wrapper(std::function&& func): _function(std::make_unique>(std::move(func))) {} - inline void call() const noexcept { - _function->operator()(); - } - private: - std::unique_ptr> _function; - } SWIFT_NONCOPYABLE; - Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept; - inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept { - return Func_void_Wrapper(std::move(value)); - } - // pragma MARK: std::vector> /** * Specialized version of `std::vector>`. 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 861fc58f4..8061205c0 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,26 @@ #pragma once // Forward declarations of C++ defined types +// Forward declaration of `AssetImage` to properly resolve imports. +namespace margelo::nitro::test { struct AssetImage; } +// Forward declaration of `AutoText` to properly resolve imports. +namespace margelo::nitro::test { struct AutoText; } // 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 `DistanceUnits` to properly resolve imports. +namespace margelo::nitro::test { enum class DistanceUnits; } +// Forward declaration of `Distance` to properly resolve imports. +namespace margelo::nitro::test { struct Distance; } +// Forward declaration of `DurationWithTimeZone` to properly resolve imports. +namespace margelo::nitro::test { struct DurationWithTimeZone; } // Forward declaration of `ExternalObjectStruct` to properly resolve imports. namespace margelo::nitro::test { struct ExternalObjectStruct; } +// Forward declaration of `ForkType` to properly resolve imports. +namespace margelo::nitro::test { enum class ForkType; } +// Forward declaration of `GlyphImage` to properly resolve imports. +namespace margelo::nitro::test { struct GlyphImage; } // Forward declaration of `HybridBaseSpec` to properly resolve imports. namespace margelo::nitro::test { class HybridBaseSpec; } // Forward declaration of `HybridChildSpec` to properly resolve imports. @@ -28,12 +42,32 @@ namespace margelo::nitro::test::external { class HybridSomeExternalObjectSpec; } namespace margelo::nitro::test { class HybridTestObjectSwiftKotlinSpec; } // Forward declaration of `HybridTestViewSpec` to properly resolve imports. namespace margelo::nitro::test { class HybridTestViewSpec; } +// Forward declaration of `ImageLane` to properly resolve imports. +namespace margelo::nitro::test { struct ImageLane; } // Forward declaration of `JsStyleStruct` to properly resolve imports. namespace margelo::nitro::test { struct JsStyleStruct; } +// Forward declaration of `KeepType` to properly resolve imports. +namespace margelo::nitro::test { enum class KeepType; } +// Forward declaration of `LaneGuidance` to properly resolve imports. +namespace margelo::nitro::test { struct LaneGuidance; } +// Forward declaration of `ManeuverType` to properly resolve imports. +namespace margelo::nitro::test { enum class ManeuverType; } // Forward declaration of `MapWrapper` to properly resolve imports. namespace margelo::nitro::test { struct MapWrapper; } +// Forward declaration of `NitroAttributedStringImage` to properly resolve imports. +namespace margelo::nitro::test { struct NitroAttributedStringImage; } +// Forward declaration of `NitroAttributedString` to properly resolve imports. +namespace margelo::nitro::test { struct NitroAttributedString; } +// Forward declaration of `NitroColor` to properly resolve imports. +namespace margelo::nitro::test { struct NitroColor; } +// Forward declaration of `NitroRoutingManeuver` to properly resolve imports. +namespace margelo::nitro::test { struct NitroRoutingManeuver; } +// Forward declaration of `OffRampType` to properly resolve imports. +namespace margelo::nitro::test { enum class OffRampType; } // Forward declaration of `OldEnum` to properly resolve imports. namespace margelo::nitro::test { enum class OldEnum; } +// Forward declaration of `OnRampType` to properly resolve imports. +namespace margelo::nitro::test { enum class OnRampType; } // Forward declaration of `OptionalCallback` to properly resolve imports. namespace margelo::nitro::test { struct OptionalCallback; } // Forward declaration of `OptionalWrapper` to properly resolve imports. @@ -44,32 +78,64 @@ 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 `PreferredImageLane` to properly resolve imports. +namespace margelo::nitro::test { struct PreferredImageLane; } // Forward declaration of `SecondMapWrapper` to properly resolve imports. namespace margelo::nitro::test { struct SecondMapWrapper; } +// Forward declaration of `TrafficSide` to properly resolve imports. +namespace margelo::nitro::test { enum class TrafficSide; } +// Forward declaration of `TravelEstimates` to properly resolve imports. +namespace margelo::nitro::test { struct TravelEstimates; } +// Forward declaration of `TripPoint` to properly resolve imports. +namespace margelo::nitro::test { struct TripPoint; } +// Forward declaration of `TurnType` to properly resolve imports. +namespace margelo::nitro::test { enum class TurnType; } // 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 "AssetImage.hpp" +#include "AutoText.hpp" #include "Car.hpp" #include "ColorScheme.hpp" +#include "Distance.hpp" +#include "DistanceUnits.hpp" +#include "DurationWithTimeZone.hpp" #include "ExternalObjectStruct.hpp" +#include "ForkType.hpp" +#include "GlyphImage.hpp" #include "HybridBaseSpec.hpp" #include "HybridChildSpec.hpp" #include "HybridPlatformObjectSpec.hpp" #include "HybridRecyclableTestViewSpec.hpp" #include "HybridTestObjectSwiftKotlinSpec.hpp" #include "HybridTestViewSpec.hpp" +#include "ImageLane.hpp" #include "JsStyleStruct.hpp" +#include "KeepType.hpp" +#include "LaneGuidance.hpp" +#include "ManeuverType.hpp" #include "MapWrapper.hpp" +#include "NitroAttributedString.hpp" +#include "NitroAttributedStringImage.hpp" +#include "NitroColor.hpp" +#include "NitroRoutingManeuver.hpp" +#include "OffRampType.hpp" #include "OldEnum.hpp" +#include "OnRampType.hpp" #include "OptionalCallback.hpp" #include "OptionalWrapper.hpp" #include "PartialPerson.hpp" #include "Person.hpp" #include "Powertrain.hpp" +#include "PreferredImageLane.hpp" #include "SecondMapWrapper.hpp" +#include "TrafficSide.hpp" +#include "TravelEstimates.hpp" +#include "TripPoint.hpp" +#include "TurnType.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 afefb88dc..d733c0810 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 @@ -20,6 +20,50 @@ namespace margelo::nitro::test { enum class Powertrain; } namespace margelo::nitro::test { enum class OldEnum; } // Forward declaration of `Person` to properly resolve imports. namespace margelo::nitro::test { struct Person; } +// Forward declaration of `TripPoint` to properly resolve imports. +namespace margelo::nitro::test { struct TripPoint; } +// Forward declaration of `TravelEstimates` to properly resolve imports. +namespace margelo::nitro::test { struct TravelEstimates; } +// Forward declaration of `Distance` to properly resolve imports. +namespace margelo::nitro::test { struct Distance; } +// Forward declaration of `DistanceUnits` to properly resolve imports. +namespace margelo::nitro::test { enum class DistanceUnits; } +// Forward declaration of `DurationWithTimeZone` to properly resolve imports. +namespace margelo::nitro::test { struct DurationWithTimeZone; } +// Forward declaration of `AutoText` to properly resolve imports. +namespace margelo::nitro::test { struct AutoText; } +// Forward declaration of `NitroRoutingManeuver` to properly resolve imports. +namespace margelo::nitro::test { struct NitroRoutingManeuver; } +// Forward declaration of `NitroAttributedString` to properly resolve imports. +namespace margelo::nitro::test { struct NitroAttributedString; } +// Forward declaration of `NitroAttributedStringImage` to properly resolve imports. +namespace margelo::nitro::test { struct NitroAttributedStringImage; } +// Forward declaration of `AssetImage` to properly resolve imports. +namespace margelo::nitro::test { struct AssetImage; } +// Forward declaration of `GlyphImage` to properly resolve imports. +namespace margelo::nitro::test { struct GlyphImage; } +// Forward declaration of `NitroColor` to properly resolve imports. +namespace margelo::nitro::test { struct NitroColor; } +// Forward declaration of `TurnType` to properly resolve imports. +namespace margelo::nitro::test { enum class TurnType; } +// Forward declaration of `OffRampType` to properly resolve imports. +namespace margelo::nitro::test { enum class OffRampType; } +// Forward declaration of `OnRampType` to properly resolve imports. +namespace margelo::nitro::test { enum class OnRampType; } +// Forward declaration of `ForkType` to properly resolve imports. +namespace margelo::nitro::test { enum class ForkType; } +// Forward declaration of `KeepType` to properly resolve imports. +namespace margelo::nitro::test { enum class KeepType; } +// Forward declaration of `LaneGuidance` to properly resolve imports. +namespace margelo::nitro::test { struct LaneGuidance; } +// Forward declaration of `PreferredImageLane` to properly resolve imports. +namespace margelo::nitro::test { struct PreferredImageLane; } +// Forward declaration of `ImageLane` to properly resolve imports. +namespace margelo::nitro::test { struct ImageLane; } +// Forward declaration of `TrafficSide` to properly resolve imports. +namespace margelo::nitro::test { enum class TrafficSide; } +// Forward declaration of `ManeuverType` to properly resolve imports. +namespace margelo::nitro::test { enum class ManeuverType; } // Forward declaration of `PartialPerson` to properly resolve imports. namespace margelo::nitro::test { struct PartialPerson; } // Forward declaration of `Car` to properly resolve imports. @@ -62,6 +106,28 @@ namespace margelo::nitro::test { struct ExternalObjectStruct; } #include "OldEnum.hpp" #include #include "Person.hpp" +#include "TripPoint.hpp" +#include "TravelEstimates.hpp" +#include "Distance.hpp" +#include "DistanceUnits.hpp" +#include "DurationWithTimeZone.hpp" +#include "AutoText.hpp" +#include "NitroRoutingManeuver.hpp" +#include "NitroAttributedString.hpp" +#include "NitroAttributedStringImage.hpp" +#include "AssetImage.hpp" +#include "GlyphImage.hpp" +#include "NitroColor.hpp" +#include "TurnType.hpp" +#include "OffRampType.hpp" +#include "OnRampType.hpp" +#include "ForkType.hpp" +#include "KeepType.hpp" +#include "LaneGuidance.hpp" +#include "PreferredImageLane.hpp" +#include "ImageLane.hpp" +#include "TrafficSide.hpp" +#include "ManeuverType.hpp" #include "PartialPerson.hpp" #include "Car.hpp" #include "HybridChildSpec.hpp" @@ -248,6 +314,18 @@ namespace margelo::nitro::test { auto __value = std::move(__result.value()); return __value; } + inline void updateTravelEstimates(const std::string& templateId, const std::vector& steps) override { + auto __result = _swiftPart.updateTravelEstimates(templateId, steps); + if (__result.hasError()) [[unlikely]] { + std::rethrow_exception(__result.error()); + } + } + inline void updateManeuvers(const std::string& templateId, const std::vector& maneuvers) override { + auto __result = _swiftPart.updateManeuvers(templateId, maneuvers); + if (__result.hasError()) [[unlikely]] { + std::rethrow_exception(__result.error()); + } + } inline void simpleFunc() override { auto __result = _swiftPart.simpleFunc(); if (__result.hasError()) [[unlikely]] { diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/AssetImage.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/AssetImage.swift new file mode 100644 index 000000000..30af1a6b1 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/AssetImage.swift @@ -0,0 +1,60 @@ +/// +/// AssetImage.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 `AssetImage`, backed by a C++ struct. + */ +public typealias AssetImage = margelo.nitro.test.AssetImage + +public extension AssetImage { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `AssetImage`. + */ + init(color: NitroColor?, packager_asset: Bool, height: Double, width: Double, scale: Double, uri: String) { + self.init({ () -> bridge.std__optional_NitroColor_ in + if let __unwrappedValue = color { + return bridge.create_std__optional_NitroColor_(__unwrappedValue) + } else { + return .init() + } + }(), packager_asset, height, width, scale, std.string(uri)) + } + + @inline(__always) + var color: NitroColor? { + return self.__color.value + } + + @inline(__always) + var packager_asset: Bool { + return self.__packager_asset + } + + @inline(__always) + var height: Double { + return self.__height + } + + @inline(__always) + var width: Double { + return self.__width + } + + @inline(__always) + var scale: Double { + return self.__scale + } + + @inline(__always) + var uri: String { + return String(self.__uri) + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/AutoText.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/AutoText.swift new file mode 100644 index 000000000..670339043 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/AutoText.swift @@ -0,0 +1,51 @@ +/// +/// AutoText.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 `AutoText`, backed by a C++ struct. + */ +public typealias AutoText = margelo.nitro.test.AutoText + +public extension AutoText { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `AutoText`. + */ + init(text: String, distance: Distance?, duration: Double?) { + self.init(std.string(text), { () -> bridge.std__optional_Distance_ in + if let __unwrappedValue = distance { + return bridge.create_std__optional_Distance_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_double_ in + if let __unwrappedValue = duration { + return bridge.create_std__optional_double_(__unwrappedValue) + } else { + return .init() + } + }()) + } + + @inline(__always) + var text: String { + return String(self.__text) + } + + @inline(__always) + var distance: Distance? { + return self.__distance.value + } + + @inline(__always) + var duration: Double? { + return self.__duration.value + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/Distance.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/Distance.swift new file mode 100644 index 000000000..a560d9a3e --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/Distance.swift @@ -0,0 +1,34 @@ +/// +/// Distance.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 `Distance`, backed by a C++ struct. + */ +public typealias Distance = margelo.nitro.test.Distance + +public extension Distance { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `Distance`. + */ + init(value: Double, unit: DistanceUnits) { + self.init(value, unit) + } + + @inline(__always) + var value: Double { + return self.__value + } + + @inline(__always) + var unit: DistanceUnits { + return self.__unit + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/DistanceUnits.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/DistanceUnits.swift new file mode 100644 index 000000000..d94218b8b --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/DistanceUnits.swift @@ -0,0 +1,52 @@ +/// +/// DistanceUnits.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +/** + * Represents the JS union `DistanceUnits`, backed by a C++ enum. + */ +public typealias DistanceUnits = margelo.nitro.test.DistanceUnits + +public extension DistanceUnits { + /** + * Get a DistanceUnits for the given String value, or + * return `nil` if the given value was invalid/unknown. + */ + init?(fromString string: String) { + switch string { + case "meters": + self = .meters + case "miles": + self = .miles + case "kilometers": + self = .kilometers + case "yards": + self = .yards + case "feet": + self = .feet + default: + return nil + } + } + + /** + * Get the String value this DistanceUnits represents. + */ + var stringValue: String { + switch self { + case .meters: + return "meters" + case .miles: + return "miles" + case .kilometers: + return "kilometers" + case .yards: + return "yards" + case .feet: + return "feet" + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/DurationWithTimeZone.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/DurationWithTimeZone.swift new file mode 100644 index 000000000..d5268539d --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/DurationWithTimeZone.swift @@ -0,0 +1,34 @@ +/// +/// DurationWithTimeZone.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 `DurationWithTimeZone`, backed by a C++ struct. + */ +public typealias DurationWithTimeZone = margelo.nitro.test.DurationWithTimeZone + +public extension DurationWithTimeZone { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `DurationWithTimeZone`. + */ + init(timezone: String, seconds: Double) { + self.init(std.string(timezone), seconds) + } + + @inline(__always) + var timezone: String { + return String(self.__timezone) + } + + @inline(__always) + var seconds: Double { + return self.__seconds + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/ForkType.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/ForkType.swift new file mode 100644 index 000000000..d37e75074 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/ForkType.swift @@ -0,0 +1,40 @@ +/// +/// ForkType.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +/** + * Represents the JS enum `ForkType`, backed by a C++ enum. + */ +public typealias ForkType = margelo.nitro.test.ForkType + +public extension ForkType { + /** + * Get a ForkType for the given String value, or + * return `nil` if the given value was invalid/unknown. + */ + init?(fromString string: String) { + switch string { + case "Left": + self = .left + case "Right": + self = .right + default: + return nil + } + } + + /** + * Get the String value this ForkType represents. + */ + var stringValue: String { + switch self { + case .left: + return "Left" + case .right: + return "Right" + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/GlyphImage.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/GlyphImage.swift new file mode 100644 index 000000000..bb6508530 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/GlyphImage.swift @@ -0,0 +1,50 @@ +/// +/// GlyphImage.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 `GlyphImage`, backed by a C++ struct. + */ +public typealias GlyphImage = margelo.nitro.test.GlyphImage + +public extension GlyphImage { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `GlyphImage`. + */ + init(glyph: Double, color: NitroColor, backgroundColor: NitroColor, fontScale: Double?) { + self.init(glyph, color, backgroundColor, { () -> bridge.std__optional_double_ in + if let __unwrappedValue = fontScale { + return bridge.create_std__optional_double_(__unwrappedValue) + } else { + return .init() + } + }()) + } + + @inline(__always) + var glyph: Double { + return self.__glyph + } + + @inline(__always) + var color: NitroColor { + return self.__color + } + + @inline(__always) + var backgroundColor: NitroColor { + return self.__backgroundColor + } + + @inline(__always) + var fontScale: Double? { + return self.__fontScale.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 63f6bfd5a..b50b6923b 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 @@ -30,6 +30,8 @@ public protocol HybridTestObjectSwiftKotlinSpec_protocol: HybridObject { // Methods func newTestObject() throws -> (any HybridTestObjectSwiftKotlinSpec) func getVariantHybrid(variant: Variant__any_HybridTestObjectSwiftKotlinSpec__Person) throws -> Variant__any_HybridTestObjectSwiftKotlinSpec__Person + func updateTravelEstimates(templateId: String, steps: [TripPoint]) throws -> Void + func updateManeuvers(templateId: String, maneuvers: [NitroRoutingManeuver]) throws -> Void func simpleFunc() throws -> Void func addNumbers(a: Double, b: Double) throws -> Double func addStrings(a: String, b: String) throws -> String 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 4782b5a3f..7eefeb78a 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 @@ -476,6 +476,28 @@ open class HybridTestObjectSwiftKotlinSpec_cxx { } } + @inline(__always) + public final func updateTravelEstimates(templateId: std.string, steps: bridge.std__vector_TripPoint_) -> bridge.Result_void_ { + do { + try self.__implementation.updateTravelEstimates(templateId: String(templateId), steps: steps.map({ __item in __item })) + return bridge.create_Result_void_() + } catch (let __error) { + let __exceptionPtr = __error.toCpp() + return bridge.create_Result_void_(__exceptionPtr) + } + } + + @inline(__always) + public final func updateManeuvers(templateId: std.string, maneuvers: bridge.std__vector_NitroRoutingManeuver_) -> bridge.Result_void_ { + do { + try self.__implementation.updateManeuvers(templateId: String(templateId), maneuvers: maneuvers.map({ __item in __item })) + return bridge.create_Result_void_() + } catch (let __error) { + let __exceptionPtr = __error.toCpp() + return bridge.create_Result_void_(__exceptionPtr) + } + } + @inline(__always) public final func simpleFunc() -> bridge.Result_void_ { do { diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/ImageLane.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/ImageLane.swift new file mode 100644 index 000000000..06534d974 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/ImageLane.swift @@ -0,0 +1,59 @@ +/// +/// ImageLane.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 `ImageLane`, backed by a C++ struct. + */ +public typealias ImageLane = margelo.nitro.test.ImageLane + +public extension ImageLane { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `ImageLane`. + */ + init(image: NitroImage, angles: [Double]) { + self.init({ () -> bridge.std__variant_AssetImage__GlyphImage_ in + switch image { + case .first(let __value): + return bridge.create_std__variant_AssetImage__GlyphImage_(__value) + case .second(let __value): + return bridge.create_std__variant_AssetImage__GlyphImage_(__value) + } + }().variant, { () -> bridge.std__vector_double_ in + var __vector = bridge.create_std__vector_double_(angles.count) + for __item in angles { + __vector.push_back(__item) + } + return __vector + }()) + } + + @inline(__always) + var image: NitroImage { + return { () -> NitroImage in + let __variant = bridge.std__variant_AssetImage__GlyphImage_(self.__image) + switch __variant.index() { + case 0: + let __actual = __variant.get_0() + return .first(__actual) + case 1: + let __actual = __variant.get_1() + return .second(__actual) + default: + fatalError("Variant can never have index \(__variant.index())!") + } + }() + } + + @inline(__always) + var angles: [Double] { + return self.__angles.map({ __item in __item }) + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/KeepType.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/KeepType.swift new file mode 100644 index 000000000..e603a807e --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/KeepType.swift @@ -0,0 +1,44 @@ +/// +/// KeepType.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +/** + * Represents the JS enum `KeepType`, backed by a C++ enum. + */ +public typealias KeepType = margelo.nitro.test.KeepType + +public extension KeepType { + /** + * Get a KeepType for the given String value, or + * return `nil` if the given value was invalid/unknown. + */ + init?(fromString string: String) { + switch string { + case "Left": + self = .left + case "Right": + self = .right + case "FollowRoad": + self = .followroad + default: + return nil + } + } + + /** + * Get the String value this KeepType represents. + */ + var stringValue: String { + switch self { + case .left: + return "Left" + case .right: + return "Right" + case .followroad: + return "FollowRoad" + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/LaneGuidance.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/LaneGuidance.swift new file mode 100644 index 000000000..fb3983410 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/LaneGuidance.swift @@ -0,0 +1,65 @@ +/// +/// LaneGuidance.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 `LaneGuidance`, backed by a C++ struct. + */ +public typealias LaneGuidance = margelo.nitro.test.LaneGuidance + +public extension LaneGuidance { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `LaneGuidance`. + */ + init(instructionVariants: [String], lanes: [Variant_PreferredImageLane_ImageLane]) { + self.init({ () -> bridge.std__vector_std__string_ in + var __vector = bridge.create_std__vector_std__string_(instructionVariants.count) + for __item in instructionVariants { + __vector.push_back(std.string(__item)) + } + return __vector + }(), { () -> bridge.std__vector_std__variant_PreferredImageLane__ImageLane__ in + var __vector = bridge.create_std__vector_std__variant_PreferredImageLane__ImageLane__(lanes.count) + for __item in lanes { + __vector.push_back({ () -> bridge.std__variant_PreferredImageLane__ImageLane_ in + switch __item { + case .first(let __value): + return bridge.create_std__variant_PreferredImageLane__ImageLane_(__value) + case .second(let __value): + return bridge.create_std__variant_PreferredImageLane__ImageLane_(__value) + } + }().variant) + } + return __vector + }()) + } + + @inline(__always) + var instructionVariants: [String] { + return self.__instructionVariants.map({ __item in String(__item) }) + } + + @inline(__always) + var lanes: [Variant_PreferredImageLane_ImageLane] { + return self.__lanes.map({ __item in { () -> Variant_PreferredImageLane_ImageLane in + let __variant = bridge.std__variant_PreferredImageLane__ImageLane_(__item) + switch __variant.index() { + case 0: + let __actual = __variant.get_0() + return .first(__actual) + case 1: + let __actual = __variant.get_1() + return .second(__actual) + default: + fatalError("Variant can never have index \(__variant.index())!") + } + }() }) + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/ManeuverType.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/ManeuverType.swift new file mode 100644 index 000000000..6090dcc13 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/ManeuverType.swift @@ -0,0 +1,80 @@ +/// +/// ManeuverType.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +/** + * Represents the JS enum `ManeuverType`, backed by a C++ enum. + */ +public typealias ManeuverType = margelo.nitro.test.ManeuverType + +public extension ManeuverType { + /** + * Get a ManeuverType for the given String value, or + * return `nil` if the given value was invalid/unknown. + */ + init?(fromString string: String) { + switch string { + case "Depart": + self = .depart + case "Arrive": + self = .arrive + case "ArriveLeft": + self = .arriveleft + case "ArriveRight": + self = .arriveright + case "Straight": + self = .straight + case "Turn": + self = .turn + case "Roundabout": + self = .roundabout + case "OffRamp": + self = .offramp + case "OnRamp": + self = .onramp + case "Fork": + self = .fork + case "EnterFerry": + self = .enterferry + case "Keep": + self = .keep + default: + return nil + } + } + + /** + * Get the String value this ManeuverType represents. + */ + var stringValue: String { + switch self { + case .depart: + return "Depart" + case .arrive: + return "Arrive" + case .arriveleft: + return "ArriveLeft" + case .arriveright: + return "ArriveRight" + case .straight: + return "Straight" + case .turn: + return "Turn" + case .roundabout: + return "Roundabout" + case .offramp: + return "OffRamp" + case .onramp: + return "OnRamp" + case .fork: + return "Fork" + case .enterferry: + return "EnterFerry" + case .keep: + return "Keep" + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/NitroAttributedString.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/NitroAttributedString.swift new file mode 100644 index 000000000..d857cb3b7 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/NitroAttributedString.swift @@ -0,0 +1,53 @@ +/// +/// NitroAttributedString.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 `NitroAttributedString`, backed by a C++ struct. + */ +public typealias NitroAttributedString = margelo.nitro.test.NitroAttributedString + +public extension NitroAttributedString { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `NitroAttributedString`. + */ + init(text: String, images: [NitroAttributedStringImage]?) { + self.init(std.string(text), { () -> bridge.std__optional_std__vector_NitroAttributedStringImage__ in + if let __unwrappedValue = images { + return bridge.create_std__optional_std__vector_NitroAttributedStringImage__({ () -> bridge.std__vector_NitroAttributedStringImage_ in + var __vector = bridge.create_std__vector_NitroAttributedStringImage_(__unwrappedValue.count) + for __item in __unwrappedValue { + __vector.push_back(__item) + } + return __vector + }()) + } else { + return .init() + } + }()) + } + + @inline(__always) + var text: String { + return String(self.__text) + } + + @inline(__always) + var images: [NitroAttributedStringImage]? { + return { () -> [NitroAttributedStringImage]? in + if bridge.has_value_std__optional_std__vector_NitroAttributedStringImage__(self.__images) { + let __unwrapped = bridge.get_std__optional_std__vector_NitroAttributedStringImage__(self.__images) + return __unwrapped.map({ __item in __item }) + } else { + return nil + } + }() + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/NitroAttributedStringImage.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/NitroAttributedStringImage.swift new file mode 100644 index 000000000..383a8b305 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/NitroAttributedStringImage.swift @@ -0,0 +1,53 @@ +/// +/// NitroAttributedStringImage.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 `NitroAttributedStringImage`, backed by a C++ struct. + */ +public typealias NitroAttributedStringImage = margelo.nitro.test.NitroAttributedStringImage + +public extension NitroAttributedStringImage { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `NitroAttributedStringImage`. + */ + init(image: NitroImage, position: Double) { + self.init({ () -> bridge.std__variant_AssetImage__GlyphImage_ in + switch image { + case .first(let __value): + return bridge.create_std__variant_AssetImage__GlyphImage_(__value) + case .second(let __value): + return bridge.create_std__variant_AssetImage__GlyphImage_(__value) + } + }().variant, position) + } + + @inline(__always) + var image: NitroImage { + return { () -> NitroImage in + let __variant = bridge.std__variant_AssetImage__GlyphImage_(self.__image) + switch __variant.index() { + case 0: + let __actual = __variant.get_0() + return .first(__actual) + case 1: + let __actual = __variant.get_1() + return .second(__actual) + default: + fatalError("Variant can never have index \(__variant.index())!") + } + }() + } + + @inline(__always) + var position: Double { + return self.__position + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/NitroColor.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/NitroColor.swift new file mode 100644 index 000000000..84a31f5a2 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/NitroColor.swift @@ -0,0 +1,34 @@ +/// +/// NitroColor.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 `NitroColor`, backed by a C++ struct. + */ +public typealias NitroColor = margelo.nitro.test.NitroColor + +public extension NitroColor { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `NitroColor`. + */ + init(lightColor: Double, darkColor: Double) { + self.init(lightColor, darkColor) + } + + @inline(__always) + var lightColor: Double { + return self.__lightColor + } + + @inline(__always) + var darkColor: Double { + return self.__darkColor + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/NitroImage.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/NitroImage.swift new file mode 100644 index 000000000..3a59a5530 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/NitroImage.swift @@ -0,0 +1,18 @@ +/// +/// NitroImage.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + + + +/** + * An Swift enum with associated values representing a Variant/Union type. + * JS type: `struct | struct` + */ +@frozen +public indirect enum NitroImage { + case first(AssetImage) + case second(GlyphImage) +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/NitroRoutingManeuver.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/NitroRoutingManeuver.swift new file mode 100644 index 000000000..6dafbc6f2 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/NitroRoutingManeuver.swift @@ -0,0 +1,275 @@ +/// +/// NitroRoutingManeuver.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 `NitroRoutingManeuver`, backed by a C++ struct. + */ +public typealias NitroRoutingManeuver = margelo.nitro.test.NitroRoutingManeuver + +public extension NitroRoutingManeuver { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `NitroRoutingManeuver`. + */ + init(attributedInstructionVariants: [NitroAttributedString], symbolImage: NitroImage, junctionImage: Variant_AssetImage_GlyphImage?, turnType: TurnType?, angle: Double?, elementAngles: [Double]?, exitNumber: Double?, offRampType: OffRampType?, onRampType: OnRampType?, forkType: ForkType?, keepType: KeepType?, linkedLaneGuidance: LaneGuidance?, cardBackgroundColor: NitroColor, id: String, travelEstimates: TravelEstimates, trafficSide: TrafficSide, maneuverType: ManeuverType, roadName: [String]?, highwayExitLabel: String?) { + self.init({ () -> bridge.std__vector_NitroAttributedString_ in + var __vector = bridge.create_std__vector_NitroAttributedString_(attributedInstructionVariants.count) + for __item in attributedInstructionVariants { + __vector.push_back(__item) + } + return __vector + }(), { () -> bridge.std__variant_AssetImage__GlyphImage_ in + switch symbolImage { + case .first(let __value): + return bridge.create_std__variant_AssetImage__GlyphImage_(__value) + case .second(let __value): + return bridge.create_std__variant_AssetImage__GlyphImage_(__value) + } + }().variant, { () -> bridge.std__optional_std__variant_AssetImage__GlyphImage__ in + if let __unwrappedValue = junctionImage { + return bridge.create_std__optional_std__variant_AssetImage__GlyphImage__({ () -> bridge.std__variant_AssetImage__GlyphImage_ in + switch __unwrappedValue { + case .first(let __value): + return bridge.create_std__variant_AssetImage__GlyphImage_(__value) + case .second(let __value): + return bridge.create_std__variant_AssetImage__GlyphImage_(__value) + } + }().variant) + } else { + return .init() + } + }(), { () -> bridge.std__optional_TurnType_ in + if let __unwrappedValue = turnType { + return bridge.create_std__optional_TurnType_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_double_ in + if let __unwrappedValue = angle { + return bridge.create_std__optional_double_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_std__vector_double__ in + if let __unwrappedValue = elementAngles { + return bridge.create_std__optional_std__vector_double__({ () -> bridge.std__vector_double_ in + var __vector = bridge.create_std__vector_double_(__unwrappedValue.count) + for __item in __unwrappedValue { + __vector.push_back(__item) + } + return __vector + }()) + } else { + return .init() + } + }(), { () -> bridge.std__optional_double_ in + if let __unwrappedValue = exitNumber { + return bridge.create_std__optional_double_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_OffRampType_ in + if let __unwrappedValue = offRampType { + return bridge.create_std__optional_OffRampType_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_OnRampType_ in + if let __unwrappedValue = onRampType { + return bridge.create_std__optional_OnRampType_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_ForkType_ in + if let __unwrappedValue = forkType { + return bridge.create_std__optional_ForkType_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_KeepType_ in + if let __unwrappedValue = keepType { + return bridge.create_std__optional_KeepType_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_LaneGuidance_ in + if let __unwrappedValue = linkedLaneGuidance { + return bridge.create_std__optional_LaneGuidance_(__unwrappedValue) + } else { + return .init() + } + }(), cardBackgroundColor, std.string(id), travelEstimates, trafficSide, maneuverType, { () -> bridge.std__optional_std__vector_std__string__ in + if let __unwrappedValue = roadName { + 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 = highwayExitLabel { + return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) + } else { + return .init() + } + }()) + } + + @inline(__always) + var attributedInstructionVariants: [NitroAttributedString] { + return self.__attributedInstructionVariants.map({ __item in __item }) + } + + @inline(__always) + var symbolImage: NitroImage { + return { () -> NitroImage in + let __variant = bridge.std__variant_AssetImage__GlyphImage_(self.__symbolImage) + switch __variant.index() { + case 0: + let __actual = __variant.get_0() + return .first(__actual) + case 1: + let __actual = __variant.get_1() + return .second(__actual) + default: + fatalError("Variant can never have index \(__variant.index())!") + } + }() + } + + @inline(__always) + var junctionImage: Variant_AssetImage_GlyphImage? { + return { () -> Variant_AssetImage_GlyphImage? in + if bridge.has_value_std__optional_std__variant_AssetImage__GlyphImage__(self.__junctionImage) { + let __unwrapped = bridge.get_std__optional_std__variant_AssetImage__GlyphImage__(self.__junctionImage) + return { () -> Variant_AssetImage_GlyphImage in + let __variant = bridge.std__variant_AssetImage__GlyphImage_(__unwrapped) + switch __variant.index() { + case 0: + let __actual = __variant.get_0() + return .first(__actual) + case 1: + let __actual = __variant.get_1() + return .second(__actual) + default: + fatalError("Variant can never have index \(__variant.index())!") + } + }() + } else { + return nil + } + }() + } + + @inline(__always) + var turnType: TurnType? { + return self.__turnType.has_value() ? self.__turnType.pointee : nil + } + + @inline(__always) + var angle: Double? { + return self.__angle.value + } + + @inline(__always) + var elementAngles: [Double]? { + return { () -> [Double]? in + if bridge.has_value_std__optional_std__vector_double__(self.__elementAngles) { + let __unwrapped = bridge.get_std__optional_std__vector_double__(self.__elementAngles) + return __unwrapped.map({ __item in __item }) + } else { + return nil + } + }() + } + + @inline(__always) + var exitNumber: Double? { + return self.__exitNumber.value + } + + @inline(__always) + var offRampType: OffRampType? { + return self.__offRampType.has_value() ? self.__offRampType.pointee : nil + } + + @inline(__always) + var onRampType: OnRampType? { + return self.__onRampType.has_value() ? self.__onRampType.pointee : nil + } + + @inline(__always) + var forkType: ForkType? { + return self.__forkType.has_value() ? self.__forkType.pointee : nil + } + + @inline(__always) + var keepType: KeepType? { + return self.__keepType.has_value() ? self.__keepType.pointee : nil + } + + @inline(__always) + var linkedLaneGuidance: LaneGuidance? { + return self.__linkedLaneGuidance.value + } + + @inline(__always) + var cardBackgroundColor: NitroColor { + return self.__cardBackgroundColor + } + + @inline(__always) + var id: String { + return String(self.__id) + } + + @inline(__always) + var travelEstimates: TravelEstimates { + return self.__travelEstimates + } + + @inline(__always) + var trafficSide: TrafficSide { + return self.__trafficSide + } + + @inline(__always) + var maneuverType: ManeuverType { + return self.__maneuverType + } + + @inline(__always) + var roadName: [String]? { + return { () -> [String]? in + if bridge.has_value_std__optional_std__vector_std__string__(self.__roadName) { + let __unwrapped = bridge.get_std__optional_std__vector_std__string__(self.__roadName) + return __unwrapped.map({ __item in String(__item) }) + } else { + return nil + } + }() + } + + @inline(__always) + var highwayExitLabel: String? { + return { () -> String? in + if bridge.has_value_std__optional_std__string_(self.__highwayExitLabel) { + let __unwrapped = bridge.get_std__optional_std__string_(self.__highwayExitLabel) + return String(__unwrapped) + } else { + return nil + } + }() + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/OffRampType.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/OffRampType.swift new file mode 100644 index 000000000..8fddd68d6 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/OffRampType.swift @@ -0,0 +1,48 @@ +/// +/// OffRampType.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +/** + * Represents the JS enum `OffRampType`, backed by a C++ enum. + */ +public typealias OffRampType = margelo.nitro.test.OffRampType + +public extension OffRampType { + /** + * Get a OffRampType for the given String value, or + * return `nil` if the given value was invalid/unknown. + */ + init?(fromString string: String) { + switch string { + case "SlightLeft": + self = .slightleft + case "SlightRight": + self = .slightright + case "NormalLeft": + self = .normalleft + case "NormalRight": + self = .normalright + default: + return nil + } + } + + /** + * Get the String value this OffRampType represents. + */ + var stringValue: String { + switch self { + case .slightleft: + return "SlightLeft" + case .slightright: + return "SlightRight" + case .normalleft: + return "NormalLeft" + case .normalright: + return "NormalRight" + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/OnRampType.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/OnRampType.swift new file mode 100644 index 000000000..d20640032 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/OnRampType.swift @@ -0,0 +1,64 @@ +/// +/// OnRampType.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +/** + * Represents the JS enum `OnRampType`, backed by a C++ enum. + */ +public typealias OnRampType = margelo.nitro.test.OnRampType + +public extension OnRampType { + /** + * Get a OnRampType for the given String value, or + * return `nil` if the given value was invalid/unknown. + */ + init?(fromString string: String) { + switch string { + case "SlightLeft": + self = .slightleft + case "SlightRight": + self = .slightright + case "NormalLeft": + self = .normalleft + case "NormalRight": + self = .normalright + case "SharpLeft": + self = .sharpleft + case "SharpRight": + self = .sharpright + case "UTurnLeft": + self = .uturnleft + case "UTurnRight": + self = .uturnright + default: + return nil + } + } + + /** + * Get the String value this OnRampType represents. + */ + var stringValue: String { + switch self { + case .slightleft: + return "SlightLeft" + case .slightright: + return "SlightRight" + case .normalleft: + return "NormalLeft" + case .normalright: + return "NormalRight" + case .sharpleft: + return "SharpLeft" + case .sharpright: + return "SharpRight" + case .uturnleft: + return "UTurnLeft" + case .uturnright: + return "UTurnRight" + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/PreferredImageLane.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/PreferredImageLane.swift new file mode 100644 index 000000000..37b7d5a1b --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/PreferredImageLane.swift @@ -0,0 +1,69 @@ +/// +/// PreferredImageLane.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 `PreferredImageLane`, backed by a C++ struct. + */ +public typealias PreferredImageLane = margelo.nitro.test.PreferredImageLane + +public extension PreferredImageLane { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `PreferredImageLane`. + */ + init(image: NitroImage, highlightedAngle: Double, isPreferred: Bool, angles: [Double]) { + self.init({ () -> bridge.std__variant_AssetImage__GlyphImage_ in + switch image { + case .first(let __value): + return bridge.create_std__variant_AssetImage__GlyphImage_(__value) + case .second(let __value): + return bridge.create_std__variant_AssetImage__GlyphImage_(__value) + } + }().variant, highlightedAngle, isPreferred, { () -> bridge.std__vector_double_ in + var __vector = bridge.create_std__vector_double_(angles.count) + for __item in angles { + __vector.push_back(__item) + } + return __vector + }()) + } + + @inline(__always) + var image: NitroImage { + return { () -> NitroImage in + let __variant = bridge.std__variant_AssetImage__GlyphImage_(self.__image) + switch __variant.index() { + case 0: + let __actual = __variant.get_0() + return .first(__actual) + case 1: + let __actual = __variant.get_1() + return .second(__actual) + default: + fatalError("Variant can never have index \(__variant.index())!") + } + }() + } + + @inline(__always) + var highlightedAngle: Double { + return self.__highlightedAngle + } + + @inline(__always) + var isPreferred: Bool { + return self.__isPreferred + } + + @inline(__always) + var angles: [Double] { + return self.__angles.map({ __item in __item }) + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/TrafficSide.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/TrafficSide.swift new file mode 100644 index 000000000..b231baed3 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/TrafficSide.swift @@ -0,0 +1,40 @@ +/// +/// TrafficSide.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +/** + * Represents the JS enum `TrafficSide`, backed by a C++ enum. + */ +public typealias TrafficSide = margelo.nitro.test.TrafficSide + +public extension TrafficSide { + /** + * Get a TrafficSide for the given String value, or + * return `nil` if the given value was invalid/unknown. + */ + init?(fromString string: String) { + switch string { + case "Right": + self = .right + case "Left": + self = .left + default: + return nil + } + } + + /** + * Get the String value this TrafficSide represents. + */ + var stringValue: String { + switch self { + case .right: + return "Right" + case .left: + return "Left" + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/TravelEstimates.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/TravelEstimates.swift new file mode 100644 index 000000000..d4c90c750 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/TravelEstimates.swift @@ -0,0 +1,71 @@ +/// +/// TravelEstimates.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 `TravelEstimates`, backed by a C++ struct. + */ +public typealias TravelEstimates = margelo.nitro.test.TravelEstimates + +public extension TravelEstimates { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `TravelEstimates`. + */ + init(distanceRemaining: Distance, timeRemaining: DurationWithTimeZone, tripText: AutoText?, _doNotUse: (() -> Void)?) { + self.init(distanceRemaining, timeRemaining, { () -> bridge.std__optional_AutoText_ in + if let __unwrappedValue = tripText { + return bridge.create_std__optional_AutoText_(__unwrappedValue) + } else { + return .init() + } + }(), { () -> bridge.std__optional_std__function_void____ in + if let __unwrappedValue = _doNotUse { + return bridge.create_std__optional_std__function_void____({ () -> bridge.Func_void in + let __closureWrapper = Func_void(__unwrappedValue) + return bridge.create_Func_void(__closureWrapper.toUnsafe()) + }()) + } else { + return .init() + } + }()) + } + + @inline(__always) + var distanceRemaining: Distance { + return self.__distanceRemaining + } + + @inline(__always) + var timeRemaining: DurationWithTimeZone { + return self.__timeRemaining + } + + @inline(__always) + var tripText: AutoText? { + return self.__tripText.value + } + + @inline(__always) + var _doNotUse: (() -> Void)? { + return { () -> (() -> Void)? in + if bridge.has_value_std__optional_std__function_void____(self.___doNotUse) { + let __unwrapped = bridge.get_std__optional_std__function_void____(self.___doNotUse) + return { () -> () -> Void in + let __wrappedFunction = bridge.wrap_Func_void(__unwrapped) + return { () -> Void in + __wrappedFunction.call() + } + }() + } else { + return nil + } + }() + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/TripPoint.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/TripPoint.swift new file mode 100644 index 000000000..5eea70d82 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/TripPoint.swift @@ -0,0 +1,44 @@ +/// +/// TripPoint.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 `TripPoint`, backed by a C++ struct. + */ +public typealias TripPoint = margelo.nitro.test.TripPoint + +public extension TripPoint { + private typealias bridge = margelo.nitro.test.bridge.swift + + /** + * Create a new instance of `TripPoint`. + */ + init(latitude: Double, longitude: Double, name: String, travelEstimates: TravelEstimates) { + self.init(latitude, longitude, std.string(name), travelEstimates) + } + + @inline(__always) + var latitude: Double { + return self.__latitude + } + + @inline(__always) + var longitude: Double { + return self.__longitude + } + + @inline(__always) + var name: String { + return String(self.__name) + } + + @inline(__always) + var travelEstimates: TravelEstimates { + return self.__travelEstimates + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/TurnType.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/TurnType.swift new file mode 100644 index 000000000..381beb223 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/TurnType.swift @@ -0,0 +1,68 @@ +/// +/// TurnType.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + +/** + * Represents the JS enum `TurnType`, backed by a C++ enum. + */ +public typealias TurnType = margelo.nitro.test.TurnType + +public extension TurnType { + /** + * Get a TurnType for the given String value, or + * return `nil` if the given value was invalid/unknown. + */ + init?(fromString string: String) { + switch string { + case "NoTurn": + self = .noturn + case "SlightLeft": + self = .slightleft + case "SlightRight": + self = .slightright + case "NormalLeft": + self = .normalleft + case "NormalRight": + self = .normalright + case "SharpLeft": + self = .sharpleft + case "SharpRight": + self = .sharpright + case "UTurnLeft": + self = .uturnleft + case "UTurnRight": + self = .uturnright + default: + return nil + } + } + + /** + * Get the String value this TurnType represents. + */ + var stringValue: String { + switch self { + case .noturn: + return "NoTurn" + case .slightleft: + return "SlightLeft" + case .slightright: + return "SlightRight" + case .normalleft: + return "NormalLeft" + case .normalright: + return "NormalRight" + case .sharpleft: + return "SharpLeft" + case .sharpright: + return "SharpRight" + case .uturnleft: + return "UTurnLeft" + case .uturnright: + return "UTurnRight" + } + } +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/Variant_AssetImage_GlyphImage.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/Variant_AssetImage_GlyphImage.swift new file mode 100644 index 000000000..66ca5e1ff --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/Variant_AssetImage_GlyphImage.swift @@ -0,0 +1,18 @@ +/// +/// Variant_AssetImage_GlyphImage.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + + + +/** + * An Swift enum with associated values representing a Variant/Union type. + * JS type: `struct | struct` + */ +@frozen +public indirect enum Variant_AssetImage_GlyphImage { + case first(AssetImage) + case second(GlyphImage) +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/ios/swift/Variant_PreferredImageLane_ImageLane.swift b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/Variant_PreferredImageLane_ImageLane.swift new file mode 100644 index 000000000..463b48ee2 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/ios/swift/Variant_PreferredImageLane_ImageLane.swift @@ -0,0 +1,18 @@ +/// +/// Variant_PreferredImageLane_ImageLane.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © Marc Rousavy @ Margelo +/// + + + +/** + * An Swift enum with associated values representing a Variant/Union type. + * JS type: `struct | struct` + */ +@frozen +public indirect enum Variant_PreferredImageLane_ImageLane { + case first(PreferredImageLane) + case second(ImageLane) +} diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/AssetImage.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/AssetImage.hpp new file mode 100644 index 000000000..b78e142b2 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/AssetImage.hpp @@ -0,0 +1,106 @@ +/// +/// AssetImage.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 `NitroColor` to properly resolve imports. +namespace margelo::nitro::test { struct NitroColor; } + +#include "NitroColor.hpp" +#include +#include + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (AssetImage). + */ + struct AssetImage final { + public: + std::optional color SWIFT_PRIVATE; + bool packager_asset SWIFT_PRIVATE; + double height SWIFT_PRIVATE; + double width SWIFT_PRIVATE; + double scale SWIFT_PRIVATE; + std::string uri SWIFT_PRIVATE; + + public: + AssetImage() = default; + explicit AssetImage(std::optional color, bool packager_asset, double height, double width, double scale, std::string uri): color(color), packager_asset(packager_asset), height(height), width(width), scale(scale), uri(uri) {} + + public: + friend bool operator==(const AssetImage& lhs, const AssetImage& rhs) = default; + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ AssetImage <> JS AssetImage (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::AssetImage fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::AssetImage( + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "color"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "packager_asset"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "scale"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uri"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::AssetImage& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "color"), JSIConverter>::toJSI(runtime, arg.color)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "packager_asset"), JSIConverter::toJSI(runtime, arg.packager_asset)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "height"), JSIConverter::toJSI(runtime, arg.height)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "width"), JSIConverter::toJSI(runtime, arg.width)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "scale"), JSIConverter::toJSI(runtime, arg.scale)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "uri"), JSIConverter::toJSI(runtime, arg.uri)); + 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, "color")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "packager_asset")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "scale")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uri")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/AutoText.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/AutoText.hpp new file mode 100644 index 000000000..d86839dd7 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/AutoText.hpp @@ -0,0 +1,94 @@ +/// +/// AutoText.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 `Distance` to properly resolve imports. +namespace margelo::nitro::test { struct Distance; } + +#include +#include "Distance.hpp" +#include + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (AutoText). + */ + struct AutoText final { + public: + std::string text SWIFT_PRIVATE; + std::optional distance SWIFT_PRIVATE; + std::optional duration SWIFT_PRIVATE; + + public: + AutoText() = default; + explicit AutoText(std::string text, std::optional distance, std::optional duration): text(text), distance(distance), duration(duration) {} + + public: + friend bool operator==(const AutoText& lhs, const AutoText& rhs) = default; + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ AutoText <> JS AutoText (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::AutoText fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::AutoText( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "distance"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::AutoText& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "text"), JSIConverter::toJSI(runtime, arg.text)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "distance"), JSIConverter>::toJSI(runtime, arg.distance)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "duration"), JSIConverter>::toJSI(runtime, arg.duration)); + 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, "text")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "distance")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/Distance.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/Distance.hpp new file mode 100644 index 000000000..4025c742a --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/Distance.hpp @@ -0,0 +1,88 @@ +/// +/// Distance.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 `DistanceUnits` to properly resolve imports. +namespace margelo::nitro::test { enum class DistanceUnits; } + +#include "DistanceUnits.hpp" + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (Distance). + */ + struct Distance final { + public: + double value SWIFT_PRIVATE; + DistanceUnits unit SWIFT_PRIVATE; + + public: + Distance() = default; + explicit Distance(double value, DistanceUnits unit): value(value), unit(unit) {} + + public: + friend bool operator==(const Distance& lhs, const Distance& rhs) = default; + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ Distance <> JS Distance (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::Distance fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::Distance( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "value"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unit"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::Distance& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "value"), JSIConverter::toJSI(runtime, arg.value)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "unit"), JSIConverter::toJSI(runtime, arg.unit)); + 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, "value")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unit")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/DistanceUnits.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/DistanceUnits.hpp new file mode 100644 index 000000000..4dc558ab8 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/DistanceUnits.hpp @@ -0,0 +1,88 @@ +/// +/// DistanceUnits.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 + +namespace margelo::nitro::test { + + /** + * An enum which can be represented as a JavaScript union (DistanceUnits). + */ + enum class DistanceUnits { + METERS SWIFT_NAME(meters) = 0, + MILES SWIFT_NAME(miles) = 1, + KILOMETERS SWIFT_NAME(kilometers) = 2, + YARDS SWIFT_NAME(yards) = 3, + FEET SWIFT_NAME(feet) = 4, + } CLOSED_ENUM; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ DistanceUnits <> JS DistanceUnits (union) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::DistanceUnits fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + std::string unionValue = JSIConverter::fromJSI(runtime, arg); + switch (hashString(unionValue.c_str(), unionValue.size())) { + case hashString("meters"): return margelo::nitro::test::DistanceUnits::METERS; + case hashString("miles"): return margelo::nitro::test::DistanceUnits::MILES; + case hashString("kilometers"): return margelo::nitro::test::DistanceUnits::KILOMETERS; + case hashString("yards"): return margelo::nitro::test::DistanceUnits::YARDS; + case hashString("feet"): return margelo::nitro::test::DistanceUnits::FEET; + default: [[unlikely]] + throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum DistanceUnits - invalid value!"); + } + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::test::DistanceUnits arg) { + switch (arg) { + case margelo::nitro::test::DistanceUnits::METERS: return JSIConverter::toJSI(runtime, "meters"); + case margelo::nitro::test::DistanceUnits::MILES: return JSIConverter::toJSI(runtime, "miles"); + case margelo::nitro::test::DistanceUnits::KILOMETERS: return JSIConverter::toJSI(runtime, "kilometers"); + case margelo::nitro::test::DistanceUnits::YARDS: return JSIConverter::toJSI(runtime, "yards"); + case margelo::nitro::test::DistanceUnits::FEET: return JSIConverter::toJSI(runtime, "feet"); + default: [[unlikely]] + throw std::invalid_argument("Cannot convert DistanceUnits to JS - invalid value: " + + std::to_string(static_cast(arg)) + "!"); + } + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isString()) { + return false; + } + std::string unionValue = JSIConverter::fromJSI(runtime, value); + switch (hashString(unionValue.c_str(), unionValue.size())) { + case hashString("meters"): + case hashString("miles"): + case hashString("kilometers"): + case hashString("yards"): + case hashString("feet"): + return true; + default: + return false; + } + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/DurationWithTimeZone.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/DurationWithTimeZone.hpp new file mode 100644 index 000000000..01af813ac --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/DurationWithTimeZone.hpp @@ -0,0 +1,87 @@ +/// +/// DurationWithTimeZone.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 + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (DurationWithTimeZone). + */ + struct DurationWithTimeZone final { + public: + std::string timezone SWIFT_PRIVATE; + double seconds SWIFT_PRIVATE; + + public: + DurationWithTimeZone() = default; + explicit DurationWithTimeZone(std::string timezone, double seconds): timezone(timezone), seconds(seconds) {} + + public: + friend bool operator==(const DurationWithTimeZone& lhs, const DurationWithTimeZone& rhs) = default; + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ DurationWithTimeZone <> JS DurationWithTimeZone (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::DurationWithTimeZone fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::DurationWithTimeZone( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timezone"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "seconds"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::DurationWithTimeZone& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "timezone"), JSIConverter::toJSI(runtime, arg.timezone)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "seconds"), JSIConverter::toJSI(runtime, arg.seconds)); + 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, "timezone")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "seconds")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/ForkType.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/ForkType.hpp new file mode 100644 index 000000000..63ff5de0a --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/ForkType.hpp @@ -0,0 +1,62 @@ +/// +/// ForkType.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 + +namespace margelo::nitro::test { + + /** + * An enum which can be represented as a JavaScript enum (ForkType). + */ + enum class ForkType { + LEFT SWIFT_NAME(left) = 0, + RIGHT SWIFT_NAME(right) = 1, + } CLOSED_ENUM; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ ForkType <> JS ForkType (enum) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::ForkType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + int enumValue = JSIConverter::fromJSI(runtime, arg); + return static_cast(enumValue); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::test::ForkType arg) { + int enumValue = static_cast(arg); + return JSIConverter::toJSI(runtime, enumValue); + } + static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) { + if (!value.isNumber()) { + return false; + } + double number = value.getNumber(); + int integer = static_cast(number); + if (number != integer) { + // The integer is not the same value as the double - we truncated floating points. + // Enums are all integers, so the input floating point number is obviously invalid. + return false; + } + // Check if we are within the bounds of the enum. + return integer >= 0 && integer <= 1; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/GlyphImage.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/GlyphImage.hpp new file mode 100644 index 000000000..6b2a70596 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/GlyphImage.hpp @@ -0,0 +1,97 @@ +/// +/// GlyphImage.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 `NitroColor` to properly resolve imports. +namespace margelo::nitro::test { struct NitroColor; } + +#include "NitroColor.hpp" +#include + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (GlyphImage). + */ + struct GlyphImage final { + public: + double glyph SWIFT_PRIVATE; + NitroColor color SWIFT_PRIVATE; + NitroColor backgroundColor SWIFT_PRIVATE; + std::optional fontScale SWIFT_PRIVATE; + + public: + GlyphImage() = default; + explicit GlyphImage(double glyph, NitroColor color, NitroColor backgroundColor, std::optional fontScale): glyph(glyph), color(color), backgroundColor(backgroundColor), fontScale(fontScale) {} + + public: + friend bool operator==(const GlyphImage& lhs, const GlyphImage& rhs) = default; + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ GlyphImage <> JS GlyphImage (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::GlyphImage fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::GlyphImage( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "glyph"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "color"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "backgroundColor"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fontScale"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::GlyphImage& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "glyph"), JSIConverter::toJSI(runtime, arg.glyph)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "color"), JSIConverter::toJSI(runtime, arg.color)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "backgroundColor"), JSIConverter::toJSI(runtime, arg.backgroundColor)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "fontScale"), JSIConverter>::toJSI(runtime, arg.fontScale)); + 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, "glyph")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "color")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "backgroundColor")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fontScale")))) return false; + return true; + } + }; + +} // namespace margelo::nitro 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 d47810115..68e2818ca 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 @@ -45,6 +45,8 @@ namespace margelo::nitro::test { prototype.registerHybridSetter("someVariant", &HybridTestObjectSwiftKotlinSpec::setSomeVariant); prototype.registerHybridMethod("newTestObject", &HybridTestObjectSwiftKotlinSpec::newTestObject); prototype.registerHybridMethod("getVariantHybrid", &HybridTestObjectSwiftKotlinSpec::getVariantHybrid); + prototype.registerHybridMethod("updateTravelEstimates", &HybridTestObjectSwiftKotlinSpec::updateTravelEstimates); + prototype.registerHybridMethod("updateManeuvers", &HybridTestObjectSwiftKotlinSpec::updateManeuvers); prototype.registerHybridMethod("simpleFunc", &HybridTestObjectSwiftKotlinSpec::simpleFunc); prototype.registerHybridMethod("addNumbers", &HybridTestObjectSwiftKotlinSpec::addNumbers); prototype.registerHybridMethod("addStrings", &HybridTestObjectSwiftKotlinSpec::addStrings); 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 c4c5c75b5..c51c40537 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 @@ -21,6 +21,10 @@ namespace margelo::nitro::test { enum class Powertrain; } namespace margelo::nitro::test { enum class OldEnum; } // Forward declaration of `Person` to properly resolve imports. namespace margelo::nitro::test { struct Person; } +// Forward declaration of `TripPoint` to properly resolve imports. +namespace margelo::nitro::test { struct TripPoint; } +// Forward declaration of `NitroRoutingManeuver` to properly resolve imports. +namespace margelo::nitro::test { struct NitroRoutingManeuver; } // Forward declaration of `PartialPerson` to properly resolve imports. namespace margelo::nitro::test { struct PartialPerson; } // Forward declaration of `Car` to properly resolve imports. @@ -59,6 +63,8 @@ namespace margelo::nitro::test { struct ExternalObjectStruct; } #include "OldEnum.hpp" #include #include "Person.hpp" +#include "TripPoint.hpp" +#include "NitroRoutingManeuver.hpp" #include "PartialPerson.hpp" #include "Car.hpp" #include "HybridChildSpec.hpp" @@ -140,6 +146,8 @@ namespace margelo::nitro::test { // Methods virtual std::shared_ptr newTestObject() = 0; virtual std::variant, Person> getVariantHybrid(const std::variant, Person>& variant) = 0; + virtual void updateTravelEstimates(const std::string& templateId, const std::vector& steps) = 0; + virtual void updateManeuvers(const std::string& templateId, const std::vector& maneuvers) = 0; virtual void simpleFunc() = 0; virtual double addNumbers(double a, double b) = 0; virtual std::string addStrings(const std::string& a, const std::string& b) = 0; diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/ImageLane.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/ImageLane.hpp new file mode 100644 index 000000000..d7e4eebee --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/ImageLane.hpp @@ -0,0 +1,93 @@ +/// +/// ImageLane.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 `AssetImage` to properly resolve imports. +namespace margelo::nitro::test { struct AssetImage; } +// Forward declaration of `GlyphImage` to properly resolve imports. +namespace margelo::nitro::test { struct GlyphImage; } + +#include "AssetImage.hpp" +#include "GlyphImage.hpp" +#include +#include + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (ImageLane). + */ + struct ImageLane final { + public: + std::variant image SWIFT_PRIVATE; + std::vector angles SWIFT_PRIVATE; + + public: + ImageLane() = default; + explicit ImageLane(std::variant image, std::vector angles): image(image), angles(angles) {} + + public: + friend bool operator==(const ImageLane& lhs, const ImageLane& rhs) = default; + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ ImageLane <> JS ImageLane (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::ImageLane fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::ImageLane( + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "image"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "angles"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::ImageLane& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "image"), JSIConverter>::toJSI(runtime, arg.image)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "angles"), JSIConverter>::toJSI(runtime, arg.angles)); + 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, "image")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "angles")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/KeepType.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/KeepType.hpp new file mode 100644 index 000000000..47a2abb08 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/KeepType.hpp @@ -0,0 +1,63 @@ +/// +/// KeepType.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 + +namespace margelo::nitro::test { + + /** + * An enum which can be represented as a JavaScript enum (KeepType). + */ + enum class KeepType { + LEFT SWIFT_NAME(left) = 0, + RIGHT SWIFT_NAME(right) = 1, + FOLLOWROAD SWIFT_NAME(followroad) = 2, + } CLOSED_ENUM; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ KeepType <> JS KeepType (enum) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::KeepType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + int enumValue = JSIConverter::fromJSI(runtime, arg); + return static_cast(enumValue); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::test::KeepType arg) { + int enumValue = static_cast(arg); + return JSIConverter::toJSI(runtime, enumValue); + } + static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) { + if (!value.isNumber()) { + return false; + } + double number = value.getNumber(); + int integer = static_cast(number); + if (number != integer) { + // The integer is not the same value as the double - we truncated floating points. + // Enums are all integers, so the input floating point number is obviously invalid. + return false; + } + // Check if we are within the bounds of the enum. + return integer >= 0 && integer <= 2; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/LaneGuidance.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/LaneGuidance.hpp new file mode 100644 index 000000000..3eb05d7ae --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/LaneGuidance.hpp @@ -0,0 +1,94 @@ +/// +/// LaneGuidance.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 `PreferredImageLane` to properly resolve imports. +namespace margelo::nitro::test { struct PreferredImageLane; } +// Forward declaration of `ImageLane` to properly resolve imports. +namespace margelo::nitro::test { struct ImageLane; } + +#include +#include +#include "PreferredImageLane.hpp" +#include "ImageLane.hpp" +#include + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (LaneGuidance). + */ + struct LaneGuidance final { + public: + std::vector instructionVariants SWIFT_PRIVATE; + std::vector> lanes SWIFT_PRIVATE; + + public: + LaneGuidance() = default; + explicit LaneGuidance(std::vector instructionVariants, std::vector> lanes): instructionVariants(instructionVariants), lanes(lanes) {} + + public: + friend bool operator==(const LaneGuidance& lhs, const LaneGuidance& rhs) = default; + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ LaneGuidance <> JS LaneGuidance (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::LaneGuidance fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::LaneGuidance( + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "instructionVariants"))), + JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "lanes"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::LaneGuidance& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "instructionVariants"), JSIConverter>::toJSI(runtime, arg.instructionVariants)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "lanes"), JSIConverter>>::toJSI(runtime, arg.lanes)); + 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, "instructionVariants")))) return false; + if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "lanes")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/ManeuverType.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/ManeuverType.hpp new file mode 100644 index 000000000..a3c5a897e --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/ManeuverType.hpp @@ -0,0 +1,85 @@ +/// +/// ManeuverType.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 + +namespace margelo::nitro::test { + + /** + * An enum which can be represented as a JavaScript enum (ManeuverType). + */ + enum class ManeuverType { + DEPART SWIFT_NAME(depart) = 0, + ARRIVE SWIFT_NAME(arrive) = 10, + ARRIVELEFT SWIFT_NAME(arriveleft) = 11, + ARRIVERIGHT SWIFT_NAME(arriveright) = 12, + STRAIGHT SWIFT_NAME(straight) = 20, + TURN SWIFT_NAME(turn) = 30, + ROUNDABOUT SWIFT_NAME(roundabout) = 40, + OFFRAMP SWIFT_NAME(offramp) = 50, + ONRAMP SWIFT_NAME(onramp) = 60, + FORK SWIFT_NAME(fork) = 70, + ENTERFERRY SWIFT_NAME(enterferry) = 80, + KEEP SWIFT_NAME(keep) = 90, + } CLOSED_ENUM; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ ManeuverType <> JS ManeuverType (enum) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::ManeuverType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + int enumValue = JSIConverter::fromJSI(runtime, arg); + return static_cast(enumValue); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::test::ManeuverType arg) { + int enumValue = static_cast(arg); + return JSIConverter::toJSI(runtime, enumValue); + } + static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) { + if (!value.isNumber()) { + return false; + } + double number = value.getNumber(); + int integer = static_cast(number); + if (number != integer) { + // The integer is not the same value as the double - we truncated floating points. + // Enums are all integers, so the input floating point number is obviously invalid. + return false; + } + switch (integer) { + case 0 /* DEPART */: return true; + case 10 /* ARRIVE */: return true; + case 11 /* ARRIVELEFT */: return true; + case 12 /* ARRIVERIGHT */: return true; + case 20 /* STRAIGHT */: return true; + case 30 /* TURN */: return true; + case 40 /* ROUNDABOUT */: return true; + case 50 /* OFFRAMP */: return true; + case 60 /* ONRAMP */: return true; + case 70 /* FORK */: return true; + case 80 /* ENTERFERRY */: return true; + case 90 /* KEEP */: return true; + default: return false; + } + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/NitroAttributedString.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/NitroAttributedString.hpp new file mode 100644 index 000000000..1340a328c --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/NitroAttributedString.hpp @@ -0,0 +1,91 @@ +/// +/// NitroAttributedString.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 `NitroAttributedStringImage` to properly resolve imports. +namespace margelo::nitro::test { struct NitroAttributedStringImage; } + +#include +#include "NitroAttributedStringImage.hpp" +#include +#include + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (NitroAttributedString). + */ + struct NitroAttributedString final { + public: + std::string text SWIFT_PRIVATE; + std::optional> images SWIFT_PRIVATE; + + public: + NitroAttributedString() = default; + explicit NitroAttributedString(std::string text, std::optional> images): text(text), images(images) {} + + public: + friend bool operator==(const NitroAttributedString& lhs, const NitroAttributedString& rhs) = default; + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ NitroAttributedString <> JS NitroAttributedString (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::NitroAttributedString fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::NitroAttributedString( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text"))), + JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "images"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::NitroAttributedString& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "text"), JSIConverter::toJSI(runtime, arg.text)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "images"), JSIConverter>>::toJSI(runtime, arg.images)); + 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, "text")))) return false; + if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "images")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/NitroAttributedStringImage.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/NitroAttributedStringImage.hpp new file mode 100644 index 000000000..c41aae01c --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/NitroAttributedStringImage.hpp @@ -0,0 +1,92 @@ +/// +/// NitroAttributedStringImage.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 `AssetImage` to properly resolve imports. +namespace margelo::nitro::test { struct AssetImage; } +// Forward declaration of `GlyphImage` to properly resolve imports. +namespace margelo::nitro::test { struct GlyphImage; } + +#include "AssetImage.hpp" +#include "GlyphImage.hpp" +#include + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (NitroAttributedStringImage). + */ + struct NitroAttributedStringImage final { + public: + std::variant image SWIFT_PRIVATE; + double position SWIFT_PRIVATE; + + public: + NitroAttributedStringImage() = default; + explicit NitroAttributedStringImage(std::variant image, double position): image(image), position(position) {} + + public: + friend bool operator==(const NitroAttributedStringImage& lhs, const NitroAttributedStringImage& rhs) = default; + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ NitroAttributedStringImage <> JS NitroAttributedStringImage (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::NitroAttributedStringImage fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::NitroAttributedStringImage( + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "image"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "position"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::NitroAttributedStringImage& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "image"), JSIConverter>::toJSI(runtime, arg.image)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "position"), JSIConverter::toJSI(runtime, arg.position)); + 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, "image")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "position")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/NitroColor.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/NitroColor.hpp new file mode 100644 index 000000000..e118c6289 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/NitroColor.hpp @@ -0,0 +1,87 @@ +/// +/// NitroColor.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 + + + + + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (NitroColor). + */ + struct NitroColor final { + public: + double lightColor SWIFT_PRIVATE; + double darkColor SWIFT_PRIVATE; + + public: + NitroColor() = default; + explicit NitroColor(double lightColor, double darkColor): lightColor(lightColor), darkColor(darkColor) {} + + public: + friend bool operator==(const NitroColor& lhs, const NitroColor& rhs) = default; + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ NitroColor <> JS NitroColor (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::NitroColor fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::NitroColor( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "lightColor"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "darkColor"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::NitroColor& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "lightColor"), JSIConverter::toJSI(runtime, arg.lightColor)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "darkColor"), JSIConverter::toJSI(runtime, arg.darkColor)); + 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, "lightColor")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "darkColor")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/NitroRoutingManeuver.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/NitroRoutingManeuver.hpp new file mode 100644 index 000000000..727f198df --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/NitroRoutingManeuver.hpp @@ -0,0 +1,196 @@ +/// +/// NitroRoutingManeuver.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 `NitroAttributedString` to properly resolve imports. +namespace margelo::nitro::test { struct NitroAttributedString; } +// Forward declaration of `AssetImage` to properly resolve imports. +namespace margelo::nitro::test { struct AssetImage; } +// Forward declaration of `GlyphImage` to properly resolve imports. +namespace margelo::nitro::test { struct GlyphImage; } +// Forward declaration of `TurnType` to properly resolve imports. +namespace margelo::nitro::test { enum class TurnType; } +// Forward declaration of `OffRampType` to properly resolve imports. +namespace margelo::nitro::test { enum class OffRampType; } +// Forward declaration of `OnRampType` to properly resolve imports. +namespace margelo::nitro::test { enum class OnRampType; } +// Forward declaration of `ForkType` to properly resolve imports. +namespace margelo::nitro::test { enum class ForkType; } +// Forward declaration of `KeepType` to properly resolve imports. +namespace margelo::nitro::test { enum class KeepType; } +// Forward declaration of `LaneGuidance` to properly resolve imports. +namespace margelo::nitro::test { struct LaneGuidance; } +// Forward declaration of `NitroColor` to properly resolve imports. +namespace margelo::nitro::test { struct NitroColor; } +// Forward declaration of `TravelEstimates` to properly resolve imports. +namespace margelo::nitro::test { struct TravelEstimates; } +// Forward declaration of `TrafficSide` to properly resolve imports. +namespace margelo::nitro::test { enum class TrafficSide; } +// Forward declaration of `ManeuverType` to properly resolve imports. +namespace margelo::nitro::test { enum class ManeuverType; } + +#include "NitroAttributedString.hpp" +#include +#include "AssetImage.hpp" +#include "GlyphImage.hpp" +#include +#include +#include "TurnType.hpp" +#include "OffRampType.hpp" +#include "OnRampType.hpp" +#include "ForkType.hpp" +#include "KeepType.hpp" +#include "LaneGuidance.hpp" +#include "NitroColor.hpp" +#include +#include "TravelEstimates.hpp" +#include "TrafficSide.hpp" +#include "ManeuverType.hpp" + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (NitroRoutingManeuver). + */ + struct NitroRoutingManeuver final { + public: + std::vector attributedInstructionVariants SWIFT_PRIVATE; + std::variant symbolImage SWIFT_PRIVATE; + std::optional> junctionImage SWIFT_PRIVATE; + std::optional turnType SWIFT_PRIVATE; + std::optional angle SWIFT_PRIVATE; + std::optional> elementAngles SWIFT_PRIVATE; + std::optional exitNumber SWIFT_PRIVATE; + std::optional offRampType SWIFT_PRIVATE; + std::optional onRampType SWIFT_PRIVATE; + std::optional forkType SWIFT_PRIVATE; + std::optional keepType SWIFT_PRIVATE; + std::optional linkedLaneGuidance SWIFT_PRIVATE; + NitroColor cardBackgroundColor SWIFT_PRIVATE; + std::string id SWIFT_PRIVATE; + TravelEstimates travelEstimates SWIFT_PRIVATE; + TrafficSide trafficSide SWIFT_PRIVATE; + ManeuverType maneuverType SWIFT_PRIVATE; + std::optional> roadName SWIFT_PRIVATE; + std::optional highwayExitLabel SWIFT_PRIVATE; + + public: + NitroRoutingManeuver() = default; + explicit NitroRoutingManeuver(std::vector attributedInstructionVariants, std::variant symbolImage, std::optional> junctionImage, std::optional turnType, std::optional angle, std::optional> elementAngles, std::optional exitNumber, std::optional offRampType, std::optional onRampType, std::optional forkType, std::optional keepType, std::optional linkedLaneGuidance, NitroColor cardBackgroundColor, std::string id, TravelEstimates travelEstimates, TrafficSide trafficSide, ManeuverType maneuverType, std::optional> roadName, std::optional highwayExitLabel): attributedInstructionVariants(attributedInstructionVariants), symbolImage(symbolImage), junctionImage(junctionImage), turnType(turnType), angle(angle), elementAngles(elementAngles), exitNumber(exitNumber), offRampType(offRampType), onRampType(onRampType), forkType(forkType), keepType(keepType), linkedLaneGuidance(linkedLaneGuidance), cardBackgroundColor(cardBackgroundColor), id(id), travelEstimates(travelEstimates), trafficSide(trafficSide), maneuverType(maneuverType), roadName(roadName), highwayExitLabel(highwayExitLabel) {} + + public: + // NitroRoutingManeuver is not equatable because these properties are not equatable: travelEstimates + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ NitroRoutingManeuver <> JS NitroRoutingManeuver (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::NitroRoutingManeuver fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::NitroRoutingManeuver( + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "attributedInstructionVariants"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "symbolImage"))), + JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "junctionImage"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "turnType"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "angle"))), + JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "elementAngles"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "exitNumber"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "offRampType"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onRampType"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "forkType"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "keepType"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "linkedLaneGuidance"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cardBackgroundColor"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "travelEstimates"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "trafficSide"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maneuverType"))), + JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "roadName"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "highwayExitLabel"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::NitroRoutingManeuver& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "attributedInstructionVariants"), JSIConverter>::toJSI(runtime, arg.attributedInstructionVariants)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "symbolImage"), JSIConverter>::toJSI(runtime, arg.symbolImage)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "junctionImage"), JSIConverter>>::toJSI(runtime, arg.junctionImage)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "turnType"), JSIConverter>::toJSI(runtime, arg.turnType)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "angle"), JSIConverter>::toJSI(runtime, arg.angle)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "elementAngles"), JSIConverter>>::toJSI(runtime, arg.elementAngles)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "exitNumber"), JSIConverter>::toJSI(runtime, arg.exitNumber)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "offRampType"), JSIConverter>::toJSI(runtime, arg.offRampType)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "onRampType"), JSIConverter>::toJSI(runtime, arg.onRampType)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "forkType"), JSIConverter>::toJSI(runtime, arg.forkType)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "keepType"), JSIConverter>::toJSI(runtime, arg.keepType)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "linkedLaneGuidance"), JSIConverter>::toJSI(runtime, arg.linkedLaneGuidance)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "cardBackgroundColor"), JSIConverter::toJSI(runtime, arg.cardBackgroundColor)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "id"), JSIConverter::toJSI(runtime, arg.id)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "travelEstimates"), JSIConverter::toJSI(runtime, arg.travelEstimates)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "trafficSide"), JSIConverter::toJSI(runtime, arg.trafficSide)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "maneuverType"), JSIConverter::toJSI(runtime, arg.maneuverType)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "roadName"), JSIConverter>>::toJSI(runtime, arg.roadName)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "highwayExitLabel"), JSIConverter>::toJSI(runtime, arg.highwayExitLabel)); + 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, "attributedInstructionVariants")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "symbolImage")))) return false; + if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "junctionImage")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "turnType")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "angle")))) return false; + if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "elementAngles")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "exitNumber")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "offRampType")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onRampType")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "forkType")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "keepType")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "linkedLaneGuidance")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cardBackgroundColor")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "travelEstimates")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "trafficSide")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maneuverType")))) return false; + if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "roadName")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "highwayExitLabel")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/OffRampType.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/OffRampType.hpp new file mode 100644 index 000000000..d75642968 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/OffRampType.hpp @@ -0,0 +1,64 @@ +/// +/// OffRampType.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 + +namespace margelo::nitro::test { + + /** + * An enum which can be represented as a JavaScript enum (OffRampType). + */ + enum class OffRampType { + SLIGHTLEFT SWIFT_NAME(slightleft) = 0, + SLIGHTRIGHT SWIFT_NAME(slightright) = 1, + NORMALLEFT SWIFT_NAME(normalleft) = 2, + NORMALRIGHT SWIFT_NAME(normalright) = 3, + } CLOSED_ENUM; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ OffRampType <> JS OffRampType (enum) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::OffRampType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + int enumValue = JSIConverter::fromJSI(runtime, arg); + return static_cast(enumValue); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::test::OffRampType arg) { + int enumValue = static_cast(arg); + return JSIConverter::toJSI(runtime, enumValue); + } + static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) { + if (!value.isNumber()) { + return false; + } + double number = value.getNumber(); + int integer = static_cast(number); + if (number != integer) { + // The integer is not the same value as the double - we truncated floating points. + // Enums are all integers, so the input floating point number is obviously invalid. + return false; + } + // Check if we are within the bounds of the enum. + return integer >= 0 && integer <= 3; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/OnRampType.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/OnRampType.hpp new file mode 100644 index 000000000..b3c68081c --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/OnRampType.hpp @@ -0,0 +1,68 @@ +/// +/// OnRampType.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 + +namespace margelo::nitro::test { + + /** + * An enum which can be represented as a JavaScript enum (OnRampType). + */ + enum class OnRampType { + SLIGHTLEFT SWIFT_NAME(slightleft) = 0, + SLIGHTRIGHT SWIFT_NAME(slightright) = 1, + NORMALLEFT SWIFT_NAME(normalleft) = 2, + NORMALRIGHT SWIFT_NAME(normalright) = 3, + SHARPLEFT SWIFT_NAME(sharpleft) = 4, + SHARPRIGHT SWIFT_NAME(sharpright) = 5, + UTURNLEFT SWIFT_NAME(uturnleft) = 6, + UTURNRIGHT SWIFT_NAME(uturnright) = 7, + } CLOSED_ENUM; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ OnRampType <> JS OnRampType (enum) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::OnRampType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + int enumValue = JSIConverter::fromJSI(runtime, arg); + return static_cast(enumValue); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::test::OnRampType arg) { + int enumValue = static_cast(arg); + return JSIConverter::toJSI(runtime, enumValue); + } + static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) { + if (!value.isNumber()) { + return false; + } + double number = value.getNumber(); + int integer = static_cast(number); + if (number != integer) { + // The integer is not the same value as the double - we truncated floating points. + // Enums are all integers, so the input floating point number is obviously invalid. + return false; + } + // Check if we are within the bounds of the enum. + return integer >= 0 && integer <= 7; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/PreferredImageLane.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/PreferredImageLane.hpp new file mode 100644 index 000000000..dcc7aaf9e --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/PreferredImageLane.hpp @@ -0,0 +1,101 @@ +/// +/// PreferredImageLane.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 `AssetImage` to properly resolve imports. +namespace margelo::nitro::test { struct AssetImage; } +// Forward declaration of `GlyphImage` to properly resolve imports. +namespace margelo::nitro::test { struct GlyphImage; } + +#include "AssetImage.hpp" +#include "GlyphImage.hpp" +#include +#include + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (PreferredImageLane). + */ + struct PreferredImageLane final { + public: + std::variant image SWIFT_PRIVATE; + double highlightedAngle SWIFT_PRIVATE; + bool isPreferred SWIFT_PRIVATE; + std::vector angles SWIFT_PRIVATE; + + public: + PreferredImageLane() = default; + explicit PreferredImageLane(std::variant image, double highlightedAngle, bool isPreferred, std::vector angles): image(image), highlightedAngle(highlightedAngle), isPreferred(isPreferred), angles(angles) {} + + public: + friend bool operator==(const PreferredImageLane& lhs, const PreferredImageLane& rhs) = default; + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ PreferredImageLane <> JS PreferredImageLane (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::PreferredImageLane fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::PreferredImageLane( + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "image"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "highlightedAngle"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isPreferred"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "angles"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::PreferredImageLane& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "image"), JSIConverter>::toJSI(runtime, arg.image)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "highlightedAngle"), JSIConverter::toJSI(runtime, arg.highlightedAngle)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "isPreferred"), JSIConverter::toJSI(runtime, arg.isPreferred)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "angles"), JSIConverter>::toJSI(runtime, arg.angles)); + 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, "image")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "highlightedAngle")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isPreferred")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "angles")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/TrafficSide.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/TrafficSide.hpp new file mode 100644 index 000000000..fb3eb3b92 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/TrafficSide.hpp @@ -0,0 +1,62 @@ +/// +/// TrafficSide.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 + +namespace margelo::nitro::test { + + /** + * An enum which can be represented as a JavaScript enum (TrafficSide). + */ + enum class TrafficSide { + RIGHT SWIFT_NAME(right) = 0, + LEFT SWIFT_NAME(left) = 1, + } CLOSED_ENUM; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ TrafficSide <> JS TrafficSide (enum) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::TrafficSide fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + int enumValue = JSIConverter::fromJSI(runtime, arg); + return static_cast(enumValue); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::test::TrafficSide arg) { + int enumValue = static_cast(arg); + return JSIConverter::toJSI(runtime, enumValue); + } + static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) { + if (!value.isNumber()) { + return false; + } + double number = value.getNumber(); + int integer = static_cast(number); + if (number != integer) { + // The integer is not the same value as the double - we truncated floating points. + // Enums are all integers, so the input floating point number is obviously invalid. + return false; + } + // Check if we are within the bounds of the enum. + return integer >= 0 && integer <= 1; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/TravelEstimates.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/TravelEstimates.hpp new file mode 100644 index 000000000..e72e0c59f --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/TravelEstimates.hpp @@ -0,0 +1,104 @@ +/// +/// TravelEstimates.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 `Distance` to properly resolve imports. +namespace margelo::nitro::test { struct Distance; } +// Forward declaration of `DurationWithTimeZone` to properly resolve imports. +namespace margelo::nitro::test { struct DurationWithTimeZone; } +// Forward declaration of `AutoText` to properly resolve imports. +namespace margelo::nitro::test { struct AutoText; } + +#include "Distance.hpp" +#include "DurationWithTimeZone.hpp" +#include "AutoText.hpp" +#include +#include + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (TravelEstimates). + */ + struct TravelEstimates final { + public: + Distance distanceRemaining SWIFT_PRIVATE; + DurationWithTimeZone timeRemaining SWIFT_PRIVATE; + std::optional tripText SWIFT_PRIVATE; + std::optional> _doNotUse SWIFT_PRIVATE; + + public: + TravelEstimates() = default; + explicit TravelEstimates(Distance distanceRemaining, DurationWithTimeZone timeRemaining, std::optional tripText, std::optional> _doNotUse): distanceRemaining(distanceRemaining), timeRemaining(timeRemaining), tripText(tripText), _doNotUse(_doNotUse) {} + + public: + // TravelEstimates is not equatable because these properties are not equatable: _doNotUse + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ TravelEstimates <> JS TravelEstimates (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::TravelEstimates fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::TravelEstimates( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "distanceRemaining"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timeRemaining"))), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "tripText"))), + JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "_doNotUse"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::TravelEstimates& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "distanceRemaining"), JSIConverter::toJSI(runtime, arg.distanceRemaining)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "timeRemaining"), JSIConverter::toJSI(runtime, arg.timeRemaining)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "tripText"), JSIConverter>::toJSI(runtime, arg.tripText)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "_doNotUse"), JSIConverter>>::toJSI(runtime, arg._doNotUse)); + 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, "distanceRemaining")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timeRemaining")))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "tripText")))) return false; + if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "_doNotUse")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/TripPoint.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/TripPoint.hpp new file mode 100644 index 000000000..0cafe1bc4 --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/TripPoint.hpp @@ -0,0 +1,97 @@ +/// +/// TripPoint.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 `TravelEstimates` to properly resolve imports. +namespace margelo::nitro::test { struct TravelEstimates; } + +#include +#include "TravelEstimates.hpp" + +namespace margelo::nitro::test { + + /** + * A struct which can be represented as a JavaScript object (TripPoint). + */ + struct TripPoint final { + public: + double latitude SWIFT_PRIVATE; + double longitude SWIFT_PRIVATE; + std::string name SWIFT_PRIVATE; + TravelEstimates travelEstimates SWIFT_PRIVATE; + + public: + TripPoint() = default; + explicit TripPoint(double latitude, double longitude, std::string name, TravelEstimates travelEstimates): latitude(latitude), longitude(longitude), name(name), travelEstimates(travelEstimates) {} + + public: + // TripPoint is not equatable because these properties are not equatable: travelEstimates + }; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ TripPoint <> JS TripPoint (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::TripPoint fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::test::TripPoint( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latitude"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "longitude"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "travelEstimates"))) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::test::TripPoint& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "latitude"), JSIConverter::toJSI(runtime, arg.latitude)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "longitude"), JSIConverter::toJSI(runtime, arg.longitude)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter::toJSI(runtime, arg.name)); + obj.setProperty(runtime, PropNameIDCache::get(runtime, "travelEstimates"), JSIConverter::toJSI(runtime, arg.travelEstimates)); + 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, "latitude")))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "longitude")))) 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, "travelEstimates")))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/TurnType.hpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/TurnType.hpp new file mode 100644 index 000000000..8cce5907f --- /dev/null +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/TurnType.hpp @@ -0,0 +1,69 @@ +/// +/// TurnType.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 + +namespace margelo::nitro::test { + + /** + * An enum which can be represented as a JavaScript enum (TurnType). + */ + enum class TurnType { + NOTURN SWIFT_NAME(noturn) = 0, + SLIGHTLEFT SWIFT_NAME(slightleft) = 1, + SLIGHTRIGHT SWIFT_NAME(slightright) = 2, + NORMALLEFT SWIFT_NAME(normalleft) = 3, + NORMALRIGHT SWIFT_NAME(normalright) = 4, + SHARPLEFT SWIFT_NAME(sharpleft) = 5, + SHARPRIGHT SWIFT_NAME(sharpright) = 6, + UTURNLEFT SWIFT_NAME(uturnleft) = 7, + UTURNRIGHT SWIFT_NAME(uturnright) = 8, + } CLOSED_ENUM; + +} // namespace margelo::nitro::test + +namespace margelo::nitro { + + // C++ TurnType <> JS TurnType (enum) + template <> + struct JSIConverter final { + static inline margelo::nitro::test::TurnType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + int enumValue = JSIConverter::fromJSI(runtime, arg); + return static_cast(enumValue); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::test::TurnType arg) { + int enumValue = static_cast(arg); + return JSIConverter::toJSI(runtime, enumValue); + } + static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) { + if (!value.isNumber()) { + return false; + } + double number = value.getNumber(); + int integer = static_cast(number); + if (number != integer) { + // The integer is not the same value as the double - we truncated floating points. + // Enums are all integers, so the input floating point number is obviously invalid. + return false; + } + // Check if we are within the bounds of the enum. + return integer >= 0 && integer <= 8; + } + }; + +} // namespace margelo::nitro diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/views/HybridRecyclableTestViewComponent.cpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/views/HybridRecyclableTestViewComponent.cpp index 13d15b486..29782dcf8 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/views/HybridRecyclableTestViewComponent.cpp +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/views/HybridRecyclableTestViewComponent.cpp @@ -77,7 +77,7 @@ namespace margelo::nitro::test::views { void HybridRecyclableTestViewComponentDescriptor::adopt(react::ShadowNode& shadowNode) const { // This is called immediately after `ShadowNode` is created, cloned or in progress. // On Android, we need to wrap props in our state, which gets routed through Java and later unwrapped in JNI/C++. - auto& concreteShadowNode = static_cast(shadowNode); + auto& concreteShadowNode = dynamic_cast(shadowNode); const HybridRecyclableTestViewProps& props = concreteShadowNode.getConcreteProps(); HybridRecyclableTestViewState state; state.setProps(props); diff --git a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/views/HybridTestViewComponent.cpp b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/views/HybridTestViewComponent.cpp index 1fd97c322..920c93ed3 100644 --- a/packages/react-native-nitro-test/nitrogen/generated/shared/c++/views/HybridTestViewComponent.cpp +++ b/packages/react-native-nitro-test/nitrogen/generated/shared/c++/views/HybridTestViewComponent.cpp @@ -113,7 +113,7 @@ namespace margelo::nitro::test::views { void HybridTestViewComponentDescriptor::adopt(react::ShadowNode& shadowNode) const { // This is called immediately after `ShadowNode` is created, cloned or in progress. // On Android, we need to wrap props in our state, which gets routed through Java and later unwrapped in JNI/C++. - auto& concreteShadowNode = static_cast(shadowNode); + auto& concreteShadowNode = dynamic_cast(shadowNode); const HybridTestViewProps& props = concreteShadowNode.getConcreteProps(); HybridTestViewState state; state.setProps(props); 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 2ad492bfb..cedcf1f95 100644 --- a/packages/react-native-nitro-test/src/specs/TestObject.nitro.ts +++ b/packages/react-native-nitro-test/src/specs/TestObject.nitro.ts @@ -9,6 +9,7 @@ import type { TestView } from './TestView.nitro' import type { SomeExternalObject } from 'react-native-nitro-test-external' import type { Child } from './Child.nitro' import type { Base } from './Base.nitro' +import type { ImageResolvedAssetSource } from 'react-native' // Tuples become `std::tuple<...>` in C++. // In contrast to arrays, they are length-checked, and can have different types inside them. @@ -105,6 +106,181 @@ type CoreTypesVariant = // Prefer `interface` + `extends` over `type` so TS doesn't flatten it interface PartialPerson extends Partial {} + + + +type DistanceUnits = 'meters' | 'miles' | 'kilometers' | 'yards' | 'feet'; + +type Distance = { + value: number; + unit: DistanceUnits; +}; + +type DurationWithTimeZone = { + timezone: string; + seconds: number; +}; + +type AutoText = { + text: string; + distance?: Distance; + duration?: number; +}; + +type TravelEstimates = { + distanceRemaining: Distance; + timeRemaining: DurationWithTimeZone; + tripText?: AutoText; + /** + * This makes TravelEstimates.hpp not equatable and solves an "map" not available on vector build issue. + */ + _doNotUse?: () => void; +}; + +type TripPoint = { + latitude: number; + longitude: number; + name: string; + travelEstimates: TravelEstimates; +}; + +type NitroAttributedStringImage = { + image: NitroImage; + position: number; +}; + +type NitroAttributedString = { + text: string; + images?: Array; +}; + +enum TrafficSide { + Right = 0, // counterclockwise for roundabouts + Left = 1, // clockwise for roundabouts +} + +enum ManeuverType { + Depart = 0, + Arrive = 10, + ArriveLeft = 11, + ArriveRight = 12, + Straight = 20, + Turn = 30, + Roundabout = 40, + OffRamp = 50, + OnRamp = 60, + Fork = 70, + EnterFerry = 80, + Keep = 90, +} + +interface BaseManeuver { + id: string; + travelEstimates: TravelEstimates; + trafficSide: TrafficSide; + maneuverType: ManeuverType; + roadName?: Array; + highwayExitLabel?: string; +} + +type NitroColor = { lightColor: number; darkColor: number }; + +interface AssetImage extends ImageResolvedAssetSource { + color?: NitroColor; + packager_asset: boolean; +} + +interface GlyphImage { + glyph: number; + color: NitroColor; + backgroundColor: NitroColor; + fontScale?: number; +} + +type NitroImage = GlyphImage | AssetImage; + +enum TurnType { + NoTurn = 0, // Android TYPE_UNKNOWN, iOS noTurn + SlightLeft = 1, // Android TYPE_TURN_SLIGHT_LEFT, iOS slightLeftTurn + SlightRight = 2, // Android TYPE_TURN_SLIGHT_RIGHT, iOS slightRightTurn + NormalLeft = 3, // Android TYPE_TURN_NORMAL_LEFT, iOS leftTurn + NormalRight = 4, // Android TYPE_TURN_NORMAL_RIGHT, iOS rightTurn + SharpLeft = 5, // Android TYPE_TURN_SHARP_LEFT, iOS sharpLeftTurn + SharpRight = 6, // Android TYPE_TURN_SHARP_RIGHT, iOS sharpRightTurn + UTurnLeft = 7, // Android TYPE_U_TURN_LEFT, iOS uTurn + UTurnRight = 8, // Android TYPE_U_TURN_RIGHT, iOS uTurn +} + +enum OffRampType { + SlightLeft = 0, // Android TYPE_OFF_RAMP_SLIGHT_LEFT + SlightRight = 1, // Android TYPE_OFF_RAMP_SLIGHT_RIGHT + NormalLeft = 2, // Android TYPE_OFF_RAMP_NORMAL_LEFT + NormalRight = 3, // Android TYPE_OFF_RAMP_NORMAL_RIGHT +} + +enum OnRampType { + SlightLeft = 0, // Android TYPE_ON_RAMP_SLIGHT_LEFT + SlightRight = 1, // Android TYPE_ON_RAMP_SLIGHT_RIGHT + NormalLeft = 2, // Android TYPE_ON_RAMP_NORMAL_LEFT + NormalRight = 3, // Android TYPE_ON_RAMP_NORMAL_RIGHT + SharpLeft = 4, // Android TYPE_ON_RAMP_SHARP_LEFT + SharpRight = 5, // Android TYPE_ON_RAMP_SHARP_RIGHT + UTurnLeft = 6, // Android TYPE_ON_RAMP_U_TURN_LEFT + UTurnRight = 7, // Android TYPE_ON_RAMP_U_TURN_RIGHT +} + +enum ForkType { + Left = 0, // Android TYPE_FORK_LEFT + Right = 1, // Android TYPE_FORK_RIGHT +} + +enum KeepType { + Left = 0, // Android TYPE_KEEP_LEFT, iOS keepLeft + Right = 1, // Android TYPE_KEEP_RIGHT, iOS keepRight + FollowRoad = 2, +} + +interface Lane { + angles: Array; +} + +interface PreferredLane extends Lane { + /** + * highlightedAngle must not be included in angles, if you have no more angles you can specify an empty angles array + */ + highlightedAngle: number; + isPreferred: boolean; +} + +interface PreferredImageLane extends PreferredLane { + image: NitroImage; +} + +interface ImageLane extends Lane { + image: NitroImage; +} + +interface LaneGuidance { + instructionVariants: Array; + lanes: Array; +} + +interface NitroRoutingManeuver extends BaseManeuver { + attributedInstructionVariants: Array; + symbolImage: NitroImage; + junctionImage?: NitroImage; + turnType?: TurnType; + angle?: number; + elementAngles?: Array; + exitNumber?: number; + offRampType?: OffRampType; + onRampType?: OnRampType; + forkType?: ForkType; + keepType?: KeepType; + linkedLaneGuidance?: LaneGuidance; + cardBackgroundColor: NitroColor; +} + // This is an `interface` we're going to use as a base in both of our `HybridObject`s later. // In this case, the `HybridObject`s will just flatten out and copy over all properties here. // There is no separate type for `SharedTestObjectProps` on the native side. @@ -330,4 +506,6 @@ export interface TestObjectSwiftKotlin getVariantHybrid( variant: TestObjectSwiftKotlin | Person ): TestObjectSwiftKotlin | Person + updateTravelEstimates(templateId: string, steps: Array): void; + updateManeuvers(templateId: string, maneuvers: Array): void; }