/// /// CustomVideoMetadata.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © Marc Rousavy @ Margelo /// #pragma once #if __has_include() #include #else #error NitroModules cannot be found! Are you sure you installed NitroModules properly? #endif #if __has_include() #include #else #error NitroModules cannot be found! Are you sure you installed NitroModules properly? #endif #if __has_include() #include #else #error NitroModules cannot be found! Are you sure you installed NitroModules properly? #endif #if __has_include() #include #else #error NitroModules cannot be found! Are you sure you installed NitroModules properly? #endif #include #include namespace margelo::nitro::video { /** * A struct which can be represented as a JavaScript object (CustomVideoMetadata). */ struct CustomVideoMetadata final { public: std::optional title SWIFT_PRIVATE; std::optional subtitle SWIFT_PRIVATE; std::optional description SWIFT_PRIVATE; std::optional artist SWIFT_PRIVATE; std::optional imageUri SWIFT_PRIVATE; public: CustomVideoMetadata() = default; explicit CustomVideoMetadata(std::optional title, std::optional subtitle, std::optional description, std::optional artist, std::optional imageUri): title(title), subtitle(subtitle), description(description), artist(artist), imageUri(imageUri) {} public: friend bool operator==(const CustomVideoMetadata& lhs, const CustomVideoMetadata& rhs) = default; }; } // namespace margelo::nitro::video namespace margelo::nitro { // C++ CustomVideoMetadata <> JS CustomVideoMetadata (object) template <> struct JSIConverter final { static inline margelo::nitro::video::CustomVideoMetadata fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { jsi::Object obj = arg.asObject(runtime); return margelo::nitro::video::CustomVideoMetadata( JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "title"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subtitle"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "description"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "artist"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "imageUri"))) ); } static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::video::CustomVideoMetadata& arg) { jsi::Object obj(runtime); obj.setProperty(runtime, PropNameIDCache::get(runtime, "title"), JSIConverter>::toJSI(runtime, arg.title)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "subtitle"), JSIConverter>::toJSI(runtime, arg.subtitle)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "description"), JSIConverter>::toJSI(runtime, arg.description)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "artist"), JSIConverter>::toJSI(runtime, arg.artist)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "imageUri"), JSIConverter>::toJSI(runtime, arg.imageUri)); return obj; } static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { if (!value.isObject()) { return false; } jsi::Object obj = value.getObject(runtime); if (!nitro::isPlainObject(runtime, obj)) { return false; } if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "title")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subtitle")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "description")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "artist")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "imageUri")))) return false; return true; } }; } // namespace margelo::nitro