-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
116 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/react-native-nitro-modules/cpp/templates/FutureType.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// BorrowingReference.hpp | ||
// NitroModules | ||
// | ||
// Created by Marc Rousavy on 21.06.24. | ||
// | ||
|
||
#pragma once | ||
|
||
#include <future> | ||
#include <type_traits> | ||
|
||
namespace margelo::nitro { | ||
|
||
// Gets the `T` in `std::future<T>`. | ||
template <typename T> | ||
struct future_type { | ||
using type = void; | ||
}; | ||
template <typename T> | ||
struct future_type<std::future<T>> { | ||
using type = T; | ||
}; | ||
|
||
template <typename T> | ||
using future_type_v = typename future_type<std::remove_reference_t<T>>::type; | ||
|
||
} // namespace margelo::nitro |
27 changes: 27 additions & 0 deletions
27
packages/react-native-nitro-modules/cpp/templates/IsHostObject.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// BorrowingReference.hpp | ||
// NitroModules | ||
// | ||
// Created by Marc Rousavy on 21.06.24. | ||
// | ||
|
||
#pragma once | ||
|
||
#include <jsi/jsi.h> | ||
#include <type_traits> | ||
|
||
namespace margelo::nitro { | ||
|
||
using namespace facebook; | ||
|
||
// Returns whether the given type `T` is a `shared_ptr` to a `HostObject` | ||
template <typename T> | ||
struct is_shared_ptr_to_host_object : std::false_type {}; | ||
|
||
template <typename T> | ||
struct is_shared_ptr_to_host_object<std::shared_ptr<T>> : std::is_base_of<jsi::HostObject, T> {}; | ||
|
||
template <typename T> | ||
using is_shared_ptr_to_host_object_v = typename is_shared_ptr_to_host_object<std::remove_reference_t<T>>::value; | ||
|
||
} // namespace margelo::nitro |
22 changes: 22 additions & 0 deletions
22
packages/react-native-nitro-modules/cpp/templates/IsInPack.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// BorrowingReference.hpp | ||
// NitroModules | ||
// | ||
// Created by Marc Rousavy on 21.06.24. | ||
// | ||
|
||
#pragma once | ||
|
||
#include <future> | ||
#include <type_traits> | ||
|
||
namespace margelo::nitro { | ||
|
||
// Returns whether the given type `T` is inside `Types...` | ||
template <typename T, typename... Types> | ||
struct is_in_pack : std::disjunction<std::is_same<T, Types>...> {}; | ||
|
||
template <typename T, typename... Types> | ||
inline constexpr bool is_in_pack_v = is_in_pack<T, Types...>::value; | ||
|
||
} // namespace margelo::nitro |
27 changes: 27 additions & 0 deletions
27
packages/react-native-nitro-modules/cpp/templates/IsNativeState.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// BorrowingReference.hpp | ||
// NitroModules | ||
// | ||
// Created by Marc Rousavy on 21.06.24. | ||
// | ||
|
||
#pragma once | ||
|
||
#include <jsi/jsi.h> | ||
#include <type_traits> | ||
|
||
namespace margelo::nitro { | ||
|
||
using namespace facebook; | ||
|
||
// Returns whether the given type `T` is a `shared_ptr` to a `NativeStaet` | ||
template <typename T> | ||
struct is_shared_ptr_to_native_state : std::false_type {}; | ||
|
||
template <typename T> | ||
struct is_shared_ptr_to_native_state<std::shared_ptr<T>> : std::is_base_of<jsi::NativeState, T> {}; | ||
|
||
template <typename T> | ||
using is_shared_ptr_to_native_state_v = typename is_shared_ptr_to_native_state<std::remove_reference_t<T>>::value; | ||
|
||
} // namespace margelo::nitro |
26 changes: 0 additions & 26 deletions
26
packages/react-native-nitro-modules/cpp/utils/DoesClassExist.hpp
This file was deleted.
Oops, something went wrong.