mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
clang-format | Format fbsource with clang-format 21.
Reviewed By: ChristianK275 Differential Revision: D85317706 fbshipit-source-id: b399c5c4b75252999442b7d7d2778e7a241b0025
This commit is contained in:
committed by
meta-codesync[bot]
parent
43f464b218
commit
59affc38a6
@@ -23,35 +23,28 @@
|
||||
namespace facebook::react {
|
||||
|
||||
#pragma mark - Structs
|
||||
using ConstantsStruct =
|
||||
NativeCxxModuleExampleConstantsStruct<bool, int32_t, std::string>;
|
||||
using ConstantsStruct = NativeCxxModuleExampleConstantsStruct<bool, int32_t, std::string>;
|
||||
|
||||
template <>
|
||||
struct Bridging<ConstantsStruct>
|
||||
: NativeCxxModuleExampleConstantsStructBridging<ConstantsStruct> {};
|
||||
struct Bridging<ConstantsStruct> : NativeCxxModuleExampleConstantsStructBridging<ConstantsStruct> {};
|
||||
|
||||
using ObjectStruct = NativeCxxModuleExampleObjectStruct<
|
||||
int32_t,
|
||||
std::string,
|
||||
std::optional<std::string>>;
|
||||
using ObjectStruct = NativeCxxModuleExampleObjectStruct<int32_t, std::string, std::optional<std::string>>;
|
||||
|
||||
template <>
|
||||
struct Bridging<ObjectStruct>
|
||||
: NativeCxxModuleExampleObjectStructBridging<ObjectStruct> {};
|
||||
struct Bridging<ObjectStruct> : NativeCxxModuleExampleObjectStructBridging<ObjectStruct> {};
|
||||
|
||||
using ValueStruct =
|
||||
NativeCxxModuleExampleValueStruct<double, std::string, ObjectStruct>;
|
||||
using ValueStruct = NativeCxxModuleExampleValueStruct<double, std::string, ObjectStruct>;
|
||||
|
||||
template <>
|
||||
struct Bridging<ValueStruct>
|
||||
: NativeCxxModuleExampleValueStructBridging<ValueStruct> {};
|
||||
struct Bridging<ValueStruct> : NativeCxxModuleExampleValueStructBridging<ValueStruct> {};
|
||||
|
||||
#pragma mark - enums
|
||||
enum class CustomEnumInt : int32_t { A = 23, B = 42 };
|
||||
|
||||
template <>
|
||||
struct Bridging<CustomEnumInt> {
|
||||
static CustomEnumInt fromJs(jsi::Runtime& rt, jsi::Value rawValue) {
|
||||
static CustomEnumInt fromJs(jsi::Runtime &rt, jsi::Value rawValue)
|
||||
{
|
||||
auto value = static_cast<int32_t>(rawValue.asNumber());
|
||||
if (value == 23) {
|
||||
return CustomEnumInt::A;
|
||||
@@ -62,7 +55,8 @@ struct Bridging<CustomEnumInt> {
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t toJs(jsi::Runtime& rt, CustomEnumInt value) {
|
||||
static int32_t toJs(jsi::Runtime &rt, CustomEnumInt value)
|
||||
{
|
||||
return bridging::toJs(rt, static_cast<int32_t>(value));
|
||||
}
|
||||
};
|
||||
@@ -73,7 +67,8 @@ class HostObjectWrapper : public jsi::HostObject {
|
||||
public:
|
||||
HostObjectWrapper(std::shared_ptr<T> value) : value_(std::move(value)) {}
|
||||
|
||||
std::shared_ptr<T> getValue() const {
|
||||
std::shared_ptr<T> getValue() const
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
|
||||
@@ -96,121 +91,96 @@ using CustomHostObject = HostObjectWrapper<CustomHostObjectRef>;
|
||||
using BinaryTreeNode = NativeCxxModuleExampleBinaryTreeNode<int32_t>;
|
||||
|
||||
template <>
|
||||
struct Bridging<BinaryTreeNode>
|
||||
: NativeCxxModuleExampleBinaryTreeNodeBridging<BinaryTreeNode> {};
|
||||
struct Bridging<BinaryTreeNode> : NativeCxxModuleExampleBinaryTreeNodeBridging<BinaryTreeNode> {};
|
||||
|
||||
using GraphNode = NativeCxxModuleExampleGraphNode<std::string>;
|
||||
|
||||
template <>
|
||||
struct Bridging<GraphNode>
|
||||
: NativeCxxModuleExampleGraphNodeBridging<GraphNode> {};
|
||||
struct Bridging<GraphNode> : NativeCxxModuleExampleGraphNodeBridging<GraphNode> {};
|
||||
|
||||
#pragma mark - functional object properties
|
||||
|
||||
using MenuItem = NativeCxxModuleExampleMenuItem<
|
||||
std::string,
|
||||
AsyncCallback<std::string, bool>,
|
||||
std::optional<std::string>>;
|
||||
using MenuItem =
|
||||
NativeCxxModuleExampleMenuItem<std::string, AsyncCallback<std::string, bool>, std::optional<std::string>>;
|
||||
|
||||
template <>
|
||||
struct Bridging<MenuItem> : NativeCxxModuleExampleMenuItemBridging<MenuItem> {};
|
||||
|
||||
#pragma mark - RCTDeviceEventEmitter events
|
||||
|
||||
using CustomDeviceEvent = NativeCxxModuleExampleCustomDeviceEvent<
|
||||
std::string,
|
||||
int32_t,
|
||||
std::optional<float>>;
|
||||
using CustomDeviceEvent = NativeCxxModuleExampleCustomDeviceEvent<std::string, int32_t, std::optional<float>>;
|
||||
|
||||
template <>
|
||||
struct Bridging<CustomDeviceEvent>
|
||||
: NativeCxxModuleExampleCustomDeviceEventBridging<CustomDeviceEvent> {};
|
||||
struct Bridging<CustomDeviceEvent> : NativeCxxModuleExampleCustomDeviceEventBridging<CustomDeviceEvent> {};
|
||||
|
||||
#pragma mark - implementation
|
||||
class NativeCxxModuleExample
|
||||
: public NativeCxxModuleExampleCxxSpec<NativeCxxModuleExample> {
|
||||
class NativeCxxModuleExample : public NativeCxxModuleExampleCxxSpec<NativeCxxModuleExample> {
|
||||
public:
|
||||
NativeCxxModuleExample(std::shared_ptr<CallInvoker> jsInvoker);
|
||||
|
||||
void getValueWithCallback(
|
||||
jsi::Runtime& rt,
|
||||
const AsyncCallback<std::string>& callback);
|
||||
void getValueWithCallback(jsi::Runtime &rt, const AsyncCallback<std::string> &callback);
|
||||
|
||||
std::function<void()> setValueCallbackWithSubscription(
|
||||
jsi::Runtime& rt,
|
||||
AsyncCallback<std::string> callback);
|
||||
std::function<void()> setValueCallbackWithSubscription(jsi::Runtime &rt, AsyncCallback<std::string> callback);
|
||||
|
||||
std::vector<std::optional<ObjectStruct>> getArray(
|
||||
jsi::Runtime& rt,
|
||||
std::vector<std::optional<ObjectStruct>> arg);
|
||||
std::vector<std::optional<ObjectStruct>> getArray(jsi::Runtime &rt, std::vector<std::optional<ObjectStruct>> arg);
|
||||
|
||||
bool getBool(jsi::Runtime& rt, bool arg);
|
||||
bool getBool(jsi::Runtime &rt, bool arg);
|
||||
|
||||
ConstantsStruct getConstants(jsi::Runtime& rt);
|
||||
ConstantsStruct getConstants(jsi::Runtime &rt);
|
||||
|
||||
CustomEnumInt getCustomEnum(jsi::Runtime& rt, CustomEnumInt arg);
|
||||
CustomEnumInt getCustomEnum(jsi::Runtime &rt, CustomEnumInt arg);
|
||||
|
||||
std::shared_ptr<CustomHostObject> getCustomHostObject(jsi::Runtime& rt);
|
||||
std::shared_ptr<CustomHostObject> getCustomHostObject(jsi::Runtime &rt);
|
||||
|
||||
std::string consumeCustomHostObject(
|
||||
jsi::Runtime& rt,
|
||||
std::shared_ptr<CustomHostObject> arg);
|
||||
std::string consumeCustomHostObject(jsi::Runtime &rt, std::shared_ptr<CustomHostObject> arg);
|
||||
|
||||
BinaryTreeNode getBinaryTreeNode(jsi::Runtime& rt, BinaryTreeNode arg);
|
||||
BinaryTreeNode getBinaryTreeNode(jsi::Runtime &rt, BinaryTreeNode arg);
|
||||
|
||||
GraphNode getGraphNode(jsi::Runtime& rt, GraphNode arg);
|
||||
GraphNode getGraphNode(jsi::Runtime &rt, GraphNode arg);
|
||||
|
||||
NativeCxxModuleExampleEnumInt getNumEnum(
|
||||
jsi::Runtime& rt,
|
||||
NativeCxxModuleExampleEnumInt arg);
|
||||
NativeCxxModuleExampleEnumInt getNumEnum(jsi::Runtime &rt, NativeCxxModuleExampleEnumInt arg);
|
||||
|
||||
NativeCxxModuleExampleEnumStr getStrEnum(
|
||||
jsi::Runtime& rt,
|
||||
NativeCxxModuleExampleEnumNone arg);
|
||||
NativeCxxModuleExampleEnumStr getStrEnum(jsi::Runtime &rt, NativeCxxModuleExampleEnumNone arg);
|
||||
|
||||
std::map<std::string, std::optional<int32_t>> getMap(
|
||||
jsi::Runtime& rt,
|
||||
jsi::Runtime &rt,
|
||||
std::map<std::string, std::optional<int32_t>> arg);
|
||||
|
||||
double getNumber(jsi::Runtime& rt, double arg);
|
||||
double getNumber(jsi::Runtime &rt, double arg);
|
||||
|
||||
ObjectStruct getObject(jsi::Runtime& rt, ObjectStruct arg);
|
||||
ObjectStruct getObject(jsi::Runtime &rt, ObjectStruct arg);
|
||||
|
||||
std::set<float> getSet(jsi::Runtime& rt, std::set<float> arg);
|
||||
std::set<float> getSet(jsi::Runtime &rt, std::set<float> arg);
|
||||
|
||||
std::string getString(jsi::Runtime& rt, std::string arg);
|
||||
std::string getString(jsi::Runtime &rt, std::string arg);
|
||||
|
||||
std::string
|
||||
getUnion(jsi::Runtime& rt, float x, const std::string& y, jsi::Object z);
|
||||
std::string getUnion(jsi::Runtime &rt, float x, const std::string &y, jsi::Object z);
|
||||
|
||||
ValueStruct
|
||||
getValue(jsi::Runtime& rt, double x, std::string y, ObjectStruct z);
|
||||
ValueStruct getValue(jsi::Runtime &rt, double x, std::string y, ObjectStruct z);
|
||||
|
||||
AsyncPromise<std::string> getValueWithPromise(jsi::Runtime& rt, bool error);
|
||||
AsyncPromise<std::string> getValueWithPromise(jsi::Runtime &rt, bool error);
|
||||
|
||||
std::optional<bool> getWithWithOptionalArgs(
|
||||
jsi::Runtime& rt,
|
||||
std::optional<bool> optionalArg);
|
||||
std::optional<bool> getWithWithOptionalArgs(jsi::Runtime &rt, std::optional<bool> optionalArg);
|
||||
|
||||
void voidFunc(jsi::Runtime& rt);
|
||||
void voidFunc(jsi::Runtime &rt);
|
||||
|
||||
AsyncPromise<> voidPromise(jsi::Runtime& rt);
|
||||
AsyncPromise<> voidPromise(jsi::Runtime &rt);
|
||||
|
||||
void setMenu(jsi::Runtime& rt, MenuItem menuItem);
|
||||
void setMenu(jsi::Runtime &rt, MenuItem menuItem);
|
||||
|
||||
void emitCustomDeviceEvent(jsi::Runtime& rt, const std::string& eventName);
|
||||
void emitCustomDeviceEvent(jsi::Runtime &rt, const std::string &eventName);
|
||||
|
||||
void voidFuncThrows(jsi::Runtime& rt);
|
||||
void voidFuncThrows(jsi::Runtime &rt);
|
||||
|
||||
ObjectStruct getObjectThrows(jsi::Runtime& rt, const ObjectStruct& arg);
|
||||
ObjectStruct getObjectThrows(jsi::Runtime &rt, const ObjectStruct &arg);
|
||||
|
||||
AsyncPromise<> promiseThrows(jsi::Runtime& rt);
|
||||
AsyncPromise<> promiseThrows(jsi::Runtime &rt);
|
||||
|
||||
void voidFuncAssert(jsi::Runtime& rt);
|
||||
void voidFuncAssert(jsi::Runtime &rt);
|
||||
|
||||
ObjectStruct getObjectAssert(jsi::Runtime& rt, const ObjectStruct& arg);
|
||||
ObjectStruct getObjectAssert(jsi::Runtime &rt, const ObjectStruct &arg);
|
||||
|
||||
AsyncPromise<> promiseAssert(jsi::Runtime& rt);
|
||||
AsyncPromise<> promiseAssert(jsi::Runtime &rt);
|
||||
|
||||
private:
|
||||
std::optional<AsyncCallback<std::string>> valueCallback_;
|
||||
|
||||
Reference in New Issue
Block a user