mirror of
https://github.com/zoriya/react-native-omni.git
synced 2026-08-16 02:44:51 +00:00
Cleanup prev/next
This commit is contained in:
-111
@@ -1,111 +0,0 @@
|
||||
///
|
||||
/// BaseSource.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
|
||||
|
||||
// Forward declaration of `VideoSrc` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { struct VideoSrc; }
|
||||
// Forward declaration of `Subtitle` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { struct Subtitle; }
|
||||
// Forward declaration of `Metadata` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { struct Metadata; }
|
||||
// Forward declaration of `MixAudioMode` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { enum class MixAudioMode; }
|
||||
|
||||
#include "VideoSrc.hpp"
|
||||
#include <vector>
|
||||
#include <optional>
|
||||
#include "Subtitle.hpp"
|
||||
#include "Metadata.hpp"
|
||||
#include "MixAudioMode.hpp"
|
||||
|
||||
namespace margelo::nitro::omni {
|
||||
|
||||
/**
|
||||
* A struct which can be represented as a JavaScript object (BaseSource).
|
||||
*/
|
||||
struct BaseSource final {
|
||||
public:
|
||||
std::vector<VideoSrc> src SWIFT_PRIVATE;
|
||||
std::optional<double> startTime SWIFT_PRIVATE;
|
||||
std::vector<Subtitle> subtitles SWIFT_PRIVATE;
|
||||
std::optional<Metadata> metadata SWIFT_PRIVATE;
|
||||
std::optional<MixAudioMode> mixAudio SWIFT_PRIVATE;
|
||||
|
||||
public:
|
||||
BaseSource() = default;
|
||||
explicit BaseSource(std::vector<VideoSrc> src, std::optional<double> startTime, std::vector<Subtitle> subtitles, std::optional<Metadata> metadata, std::optional<MixAudioMode> mixAudio): src(src), startTime(startTime), subtitles(subtitles), metadata(metadata), mixAudio(mixAudio) {}
|
||||
|
||||
public:
|
||||
friend bool operator==(const BaseSource& lhs, const BaseSource& rhs) = default;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::omni
|
||||
|
||||
namespace margelo::nitro {
|
||||
|
||||
// C++ BaseSource <> JS BaseSource (object)
|
||||
template <>
|
||||
struct JSIConverter<margelo::nitro::omni::BaseSource> final {
|
||||
static inline margelo::nitro::omni::BaseSource fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
||||
jsi::Object obj = arg.asObject(runtime);
|
||||
return margelo::nitro::omni::BaseSource(
|
||||
JSIConverter<std::vector<margelo::nitro::omni::VideoSrc>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "src"))),
|
||||
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startTime"))),
|
||||
JSIConverter<std::vector<margelo::nitro::omni::Subtitle>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subtitles"))),
|
||||
JSIConverter<std::optional<margelo::nitro::omni::Metadata>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata"))),
|
||||
JSIConverter<std::optional<margelo::nitro::omni::MixAudioMode>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mixAudio")))
|
||||
);
|
||||
}
|
||||
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::omni::BaseSource& arg) {
|
||||
jsi::Object obj(runtime);
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "src"), JSIConverter<std::vector<margelo::nitro::omni::VideoSrc>>::toJSI(runtime, arg.src));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "startTime"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.startTime));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "subtitles"), JSIConverter<std::vector<margelo::nitro::omni::Subtitle>>::toJSI(runtime, arg.subtitles));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadata"), JSIConverter<std::optional<margelo::nitro::omni::Metadata>>::toJSI(runtime, arg.metadata));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "mixAudio"), JSIConverter<std::optional<margelo::nitro::omni::MixAudioMode>>::toJSI(runtime, arg.mixAudio));
|
||||
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::vector<margelo::nitro::omni::VideoSrc>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "src")))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startTime")))) return false;
|
||||
if (!JSIConverter<std::vector<margelo::nitro::omni::Subtitle>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subtitles")))) return false;
|
||||
if (!JSIConverter<std::optional<margelo::nitro::omni::Metadata>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata")))) return false;
|
||||
if (!JSIConverter<std::optional<margelo::nitro::omni::MixAudioMode>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mixAudio")))) return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro
|
||||
+10
-2
@@ -44,10 +44,12 @@ namespace margelo::nitro::omni {
|
||||
std::optional<std::string> album SWIFT_PRIVATE;
|
||||
std::optional<std::string> artist SWIFT_PRIVATE;
|
||||
std::optional<std::string> imageLink SWIFT_PRIVATE;
|
||||
std::optional<bool> hasPrev SWIFT_PRIVATE;
|
||||
std::optional<bool> hasNext SWIFT_PRIVATE;
|
||||
|
||||
public:
|
||||
Metadata() = default;
|
||||
explicit Metadata(std::string title, std::optional<std::string> album, std::optional<std::string> artist, std::optional<std::string> imageLink): title(title), album(album), artist(artist), imageLink(imageLink) {}
|
||||
explicit Metadata(std::string title, std::optional<std::string> album, std::optional<std::string> artist, std::optional<std::string> imageLink, std::optional<bool> hasPrev, std::optional<bool> hasNext): title(title), album(album), artist(artist), imageLink(imageLink), hasPrev(hasPrev), hasNext(hasNext) {}
|
||||
|
||||
public:
|
||||
friend bool operator==(const Metadata& lhs, const Metadata& rhs) = default;
|
||||
@@ -66,7 +68,9 @@ namespace margelo::nitro {
|
||||
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "title"))),
|
||||
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "album"))),
|
||||
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "artist"))),
|
||||
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "imageLink")))
|
||||
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "imageLink"))),
|
||||
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hasPrev"))),
|
||||
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hasNext")))
|
||||
);
|
||||
}
|
||||
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::omni::Metadata& arg) {
|
||||
@@ -75,6 +79,8 @@ namespace margelo::nitro {
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "album"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.album));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "artist"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.artist));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "imageLink"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.imageLink));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "hasPrev"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.hasPrev));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "hasNext"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.hasNext));
|
||||
return obj;
|
||||
}
|
||||
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
||||
@@ -89,6 +95,8 @@ namespace margelo::nitro {
|
||||
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "album")))) return false;
|
||||
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "artist")))) return false;
|
||||
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "imageLink")))) return false;
|
||||
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hasPrev")))) return false;
|
||||
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hasNext")))) return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
Generated
+2
-13
@@ -28,8 +28,6 @@
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
// Forward declaration of `BaseSource` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { struct BaseSource; }
|
||||
// Forward declaration of `VideoSrc` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { struct VideoSrc; }
|
||||
// Forward declaration of `Subtitle` to properly resolve imports.
|
||||
@@ -39,10 +37,9 @@ namespace margelo::nitro::omni { struct Metadata; }
|
||||
// Forward declaration of `MixAudioMode` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { enum class MixAudioMode; }
|
||||
|
||||
#include "BaseSource.hpp"
|
||||
#include <optional>
|
||||
#include "VideoSrc.hpp"
|
||||
#include <vector>
|
||||
#include <optional>
|
||||
#include "Subtitle.hpp"
|
||||
#include "Metadata.hpp"
|
||||
#include "MixAudioMode.hpp"
|
||||
@@ -54,8 +51,6 @@ namespace margelo::nitro::omni {
|
||||
*/
|
||||
struct Source final {
|
||||
public:
|
||||
std::optional<BaseSource> prev SWIFT_PRIVATE;
|
||||
std::optional<BaseSource> next SWIFT_PRIVATE;
|
||||
std::vector<VideoSrc> src SWIFT_PRIVATE;
|
||||
std::optional<double> startTime SWIFT_PRIVATE;
|
||||
std::vector<Subtitle> subtitles SWIFT_PRIVATE;
|
||||
@@ -64,7 +59,7 @@ namespace margelo::nitro::omni {
|
||||
|
||||
public:
|
||||
Source() = default;
|
||||
explicit Source(std::optional<BaseSource> prev, std::optional<BaseSource> next, std::vector<VideoSrc> src, std::optional<double> startTime, std::vector<Subtitle> subtitles, std::optional<Metadata> metadata, std::optional<MixAudioMode> mixAudio): prev(prev), next(next), src(src), startTime(startTime), subtitles(subtitles), metadata(metadata), mixAudio(mixAudio) {}
|
||||
explicit Source(std::vector<VideoSrc> src, std::optional<double> startTime, std::vector<Subtitle> subtitles, std::optional<Metadata> metadata, std::optional<MixAudioMode> mixAudio): src(src), startTime(startTime), subtitles(subtitles), metadata(metadata), mixAudio(mixAudio) {}
|
||||
|
||||
public:
|
||||
friend bool operator==(const Source& lhs, const Source& rhs) = default;
|
||||
@@ -80,8 +75,6 @@ namespace margelo::nitro {
|
||||
static inline margelo::nitro::omni::Source fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
||||
jsi::Object obj = arg.asObject(runtime);
|
||||
return margelo::nitro::omni::Source(
|
||||
JSIConverter<std::optional<margelo::nitro::omni::BaseSource>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "prev"))),
|
||||
JSIConverter<std::optional<margelo::nitro::omni::BaseSource>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "next"))),
|
||||
JSIConverter<std::vector<margelo::nitro::omni::VideoSrc>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "src"))),
|
||||
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startTime"))),
|
||||
JSIConverter<std::vector<margelo::nitro::omni::Subtitle>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subtitles"))),
|
||||
@@ -91,8 +84,6 @@ namespace margelo::nitro {
|
||||
}
|
||||
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::omni::Source& arg) {
|
||||
jsi::Object obj(runtime);
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "prev"), JSIConverter<std::optional<margelo::nitro::omni::BaseSource>>::toJSI(runtime, arg.prev));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "next"), JSIConverter<std::optional<margelo::nitro::omni::BaseSource>>::toJSI(runtime, arg.next));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "src"), JSIConverter<std::vector<margelo::nitro::omni::VideoSrc>>::toJSI(runtime, arg.src));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "startTime"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.startTime));
|
||||
obj.setProperty(runtime, PropNameIDCache::get(runtime, "subtitles"), JSIConverter<std::vector<margelo::nitro::omni::Subtitle>>::toJSI(runtime, arg.subtitles));
|
||||
@@ -108,8 +99,6 @@ namespace margelo::nitro {
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<std::optional<margelo::nitro::omni::BaseSource>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "prev")))) return false;
|
||||
if (!JSIConverter<std::optional<margelo::nitro::omni::BaseSource>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "next")))) return false;
|
||||
if (!JSIConverter<std::vector<margelo::nitro::omni::VideoSrc>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "src")))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startTime")))) return false;
|
||||
if (!JSIConverter<std::vector<margelo::nitro::omni::Subtitle>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subtitles")))) return false;
|
||||
|
||||
Reference in New Issue
Block a user