/// /// Source.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 `VideoSrc` to properly resolve imports. namespace margelo::nitro::omni { struct VideoSrc; } // Forward declaration of `Subtitle` to properly resolve imports. namespace margelo::nitro::omni { struct Subtitle; } // Forward declaration of `Metadata` to properly resolve imports. namespace margelo::nitro::omni { struct Metadata; } // Forward declaration of `MixAudioMode` to properly resolve imports. namespace margelo::nitro::omni { enum class MixAudioMode; } #include "VideoSrc.hpp" #include #include "Subtitle.hpp" #include #include #include "Metadata.hpp" #include "MixAudioMode.hpp" #include namespace margelo::nitro::omni { /** * A struct which can be represented as a JavaScript object (Source). */ struct Source final { public: VideoSrc src SWIFT_PRIVATE; std::optional startTime SWIFT_PRIVATE; std::vector subtitles SWIFT_PRIVATE; std::optional> fonts SWIFT_PRIVATE; std::optional metadata SWIFT_PRIVATE; std::optional mixAudio SWIFT_PRIVATE; std::optional castId SWIFT_PRIVATE; std::optional> castData SWIFT_PRIVATE; public: Source() = default; explicit Source(VideoSrc src, std::optional startTime, std::vector subtitles, std::optional> fonts, std::optional metadata, std::optional mixAudio, std::optional castId, std::optional> castData): src(src), startTime(startTime), subtitles(subtitles), fonts(fonts), metadata(metadata), mixAudio(mixAudio), castId(castId), castData(castData) {} public: friend bool operator==(const Source& lhs, const Source& rhs) = default; }; } // namespace margelo::nitro::omni namespace margelo::nitro { // C++ Source <> JS Source (object) template <> struct JSIConverter final { static inline margelo::nitro::omni::Source fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { jsi::Object obj = arg.asObject(runtime); return margelo::nitro::omni::Source( JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "src"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startTime"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subtitles"))), JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fonts"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mixAudio"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "castId"))), JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "castData"))) ); } static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::omni::Source& arg) { jsi::Object obj(runtime); obj.setProperty(runtime, PropNameIDCache::get(runtime, "src"), JSIConverter::toJSI(runtime, arg.src)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "startTime"), JSIConverter>::toJSI(runtime, arg.startTime)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "subtitles"), JSIConverter>::toJSI(runtime, arg.subtitles)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "fonts"), JSIConverter>>::toJSI(runtime, arg.fonts)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadata"), JSIConverter>::toJSI(runtime, arg.metadata)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "mixAudio"), JSIConverter>::toJSI(runtime, arg.mixAudio)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "castId"), JSIConverter>::toJSI(runtime, arg.castId)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "castData"), JSIConverter>>::toJSI(runtime, arg.castData)); 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, "src")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startTime")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subtitles")))) return false; if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fonts")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mixAudio")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "castId")))) return false; if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "castData")))) return false; return true; } }; } // namespace margelo::nitro