|
| 1 | +/// |
| 2 | +/// NativeSQLiteNullValue.hpp |
| 3 | +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. |
| 4 | +/// https://github.com/mrousavy/nitro |
| 5 | +/// Copyright © 2025 Marc Rousavy @ Margelo |
| 6 | +/// |
| 7 | + |
| 8 | +#pragma once |
| 9 | + |
| 10 | +#if __has_include(<NitroModules/JSIConverter.hpp>) |
| 11 | +#include <NitroModules/JSIConverter.hpp> |
| 12 | +#else |
| 13 | +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? |
| 14 | +#endif |
| 15 | +#if __has_include(<NitroModules/NitroDefines.hpp>) |
| 16 | +#include <NitroModules/NitroDefines.hpp> |
| 17 | +#else |
| 18 | +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? |
| 19 | +#endif |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +namespace margelo::nitro::rnnitrosqlite { |
| 26 | + |
| 27 | + /** |
| 28 | + * A struct which can be represented as a JavaScript object (NativeSQLiteNullValue). |
| 29 | + */ |
| 30 | + struct NativeSQLiteNullValue { |
| 31 | + public: |
| 32 | + bool isNull SWIFT_PRIVATE; |
| 33 | + |
| 34 | + public: |
| 35 | + explicit NativeSQLiteNullValue(bool isNull): isNull(isNull) {} |
| 36 | + }; |
| 37 | + |
| 38 | +} // namespace margelo::nitro::rnnitrosqlite |
| 39 | + |
| 40 | +namespace margelo::nitro { |
| 41 | + |
| 42 | + using namespace margelo::nitro::rnnitrosqlite; |
| 43 | + |
| 44 | + // C++ NativeSQLiteNullValue <> JS NativeSQLiteNullValue (object) |
| 45 | + template <> |
| 46 | + struct JSIConverter<NativeSQLiteNullValue> { |
| 47 | + static inline NativeSQLiteNullValue fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { |
| 48 | + jsi::Object obj = arg.asObject(runtime); |
| 49 | + return NativeSQLiteNullValue( |
| 50 | + JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isNull")) |
| 51 | + ); |
| 52 | + } |
| 53 | + static inline jsi::Value toJSI(jsi::Runtime& runtime, const NativeSQLiteNullValue& arg) { |
| 54 | + jsi::Object obj(runtime); |
| 55 | + obj.setProperty(runtime, "isNull", JSIConverter<bool>::toJSI(runtime, arg.isNull)); |
| 56 | + return obj; |
| 57 | + } |
| 58 | + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { |
| 59 | + if (!value.isObject()) { |
| 60 | + return false; |
| 61 | + } |
| 62 | + jsi::Object obj = value.getObject(runtime); |
| 63 | + if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isNull"))) return false; |
| 64 | + return true; |
| 65 | + } |
| 66 | + }; |
| 67 | + |
| 68 | +} // namespace margelo::nitro |
0 commit comments