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