106 lines
6.0 KiB
C++
Generated
106 lines
6.0 KiB
C++
Generated
///
|
|
/// NativeHeartbeatSeriesSummary.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(<NitroModules/JSIConverter.hpp>)
|
|
#include <NitroModules/JSIConverter.hpp>
|
|
#else
|
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
#endif
|
|
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
#include <NitroModules/NitroDefines.hpp>
|
|
#else
|
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
#endif
|
|
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
#include <NitroModules/JSIHelpers.hpp>
|
|
#else
|
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
#endif
|
|
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
#include <NitroModules/PropNameIDCache.hpp>
|
|
#else
|
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
#endif
|
|
|
|
|
|
|
|
#include <string>
|
|
#include <optional>
|
|
#include <vector>
|
|
|
|
namespace margelo::nitro::haptika::ppg {
|
|
|
|
/**
|
|
* A struct which can be represented as a JavaScript object (NativeHeartbeatSeriesSummary).
|
|
*/
|
|
struct NativeHeartbeatSeriesSummary final {
|
|
public:
|
|
std::string startDate SWIFT_PRIVATE;
|
|
std::string endDate SWIFT_PRIVATE;
|
|
std::optional<std::string> sourceName SWIFT_PRIVATE;
|
|
std::optional<std::string> sourceBundleIdentifier SWIFT_PRIVATE;
|
|
std::vector<double> heartbeatTimesSinceSeriesStartSeconds SWIFT_PRIVATE;
|
|
std::vector<double> precededByGapIndexes SWIFT_PRIVATE;
|
|
|
|
public:
|
|
NativeHeartbeatSeriesSummary() = default;
|
|
explicit NativeHeartbeatSeriesSummary(std::string startDate, std::string endDate, std::optional<std::string> sourceName, std::optional<std::string> sourceBundleIdentifier, std::vector<double> heartbeatTimesSinceSeriesStartSeconds, std::vector<double> precededByGapIndexes): startDate(startDate), endDate(endDate), sourceName(sourceName), sourceBundleIdentifier(sourceBundleIdentifier), heartbeatTimesSinceSeriesStartSeconds(heartbeatTimesSinceSeriesStartSeconds), precededByGapIndexes(precededByGapIndexes) {}
|
|
|
|
public:
|
|
friend bool operator==(const NativeHeartbeatSeriesSummary& lhs, const NativeHeartbeatSeriesSummary& rhs) = default;
|
|
};
|
|
|
|
} // namespace margelo::nitro::haptika::ppg
|
|
|
|
namespace margelo::nitro {
|
|
|
|
// C++ NativeHeartbeatSeriesSummary <> JS NativeHeartbeatSeriesSummary (object)
|
|
template <>
|
|
struct JSIConverter<margelo::nitro::haptika::ppg::NativeHeartbeatSeriesSummary> final {
|
|
static inline margelo::nitro::haptika::ppg::NativeHeartbeatSeriesSummary fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
jsi::Object obj = arg.asObject(runtime);
|
|
return margelo::nitro::haptika::ppg::NativeHeartbeatSeriesSummary(
|
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate"))),
|
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate"))),
|
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceName"))),
|
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceBundleIdentifier"))),
|
|
JSIConverter<std::vector<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "heartbeatTimesSinceSeriesStartSeconds"))),
|
|
JSIConverter<std::vector<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "precededByGapIndexes")))
|
|
);
|
|
}
|
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::haptika::ppg::NativeHeartbeatSeriesSummary& arg) {
|
|
jsi::Object obj(runtime);
|
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "startDate"), JSIConverter<std::string>::toJSI(runtime, arg.startDate));
|
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "endDate"), JSIConverter<std::string>::toJSI(runtime, arg.endDate));
|
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "sourceName"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.sourceName));
|
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "sourceBundleIdentifier"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.sourceBundleIdentifier));
|
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "heartbeatTimesSinceSeriesStartSeconds"), JSIConverter<std::vector<double>>::toJSI(runtime, arg.heartbeatTimesSinceSeriesStartSeconds));
|
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "precededByGapIndexes"), JSIConverter<std::vector<double>>::toJSI(runtime, arg.precededByGapIndexes));
|
|
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<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate")))) return false;
|
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate")))) return false;
|
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceName")))) return false;
|
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceBundleIdentifier")))) return false;
|
|
if (!JSIConverter<std::vector<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "heartbeatTimesSinceSeriesStartSeconds")))) return false;
|
|
if (!JSIConverter<std::vector<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "precededByGapIndexes")))) return false;
|
|
return true;
|
|
}
|
|
};
|
|
|
|
} // namespace margelo::nitro
|