/// /// NativeInsets.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::codepad { /** * A struct which can be represented as a JavaScript object (NativeInsets). */ struct NativeInsets final { public: std::optional top SWIFT_PRIVATE; std::optional bottom SWIFT_PRIVATE; std::optional left SWIFT_PRIVATE; std::optional right SWIFT_PRIVATE; public: NativeInsets() = default; explicit NativeInsets(std::optional top, std::optional bottom, std::optional left, std::optional right): top(top), bottom(bottom), left(left), right(right) {} public: friend bool operator==(const NativeInsets& lhs, const NativeInsets& rhs) = default; }; } // namespace margelo::nitro::codepad namespace margelo::nitro { // C++ NativeInsets <> JS NativeInsets (object) template <> struct JSIConverter final { static inline margelo::nitro::codepad::NativeInsets fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { jsi::Object obj = arg.asObject(runtime); return margelo::nitro::codepad::NativeInsets( JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "top"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bottom"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "left"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "right"))) ); } static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::codepad::NativeInsets& arg) { jsi::Object obj(runtime); obj.setProperty(runtime, PropNameIDCache::get(runtime, "top"), JSIConverter>::toJSI(runtime, arg.top)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "bottom"), JSIConverter>::toJSI(runtime, arg.bottom)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "left"), JSIConverter>::toJSI(runtime, arg.left)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "right"), JSIConverter>::toJSI(runtime, arg.right)); 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, "top")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bottom")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "left")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "right")))) return false; return true; } }; } // namespace margelo::nitro