added C++ setup for FabricUIManager

Reviewed By: shergin

Differential Revision: D7077312

fbshipit-source-id: e284c151438eb4d1f67a8386580ab54e3dce7c17
This commit is contained in:
Kevin Gozali 2018-02-23 19:32:36 -08:00 committed by Facebook Github Bot
parent d8bb990abc
commit 0ee03178a0
5 changed files with 163 additions and 0 deletions

46
ReactCommon/fabric/BUCK Normal file
View File

@ -0,0 +1,46 @@
load("@xplat//configurations/buck/apple:flag_defs.bzl", "DEBUG_PREPROCESSOR_FLAGS")
load("//ReactNative:DEFS.bzl", "IS_OSS_BUILD", "rn_xplat_cxx_library", "APPLE_INSPECTOR_FLAGS")
CXX_LIBRARY_COMPILER_FLAGS = [
"-std=c++14",
"-Wall",
]
APPLE_COMPILER_FLAGS = []
if not IS_OSS_BUILD:
load("@xplat//configurations/buck/apple:flag_defs.bzl", "STATIC_LIBRARY_IOS_FLAGS", "flags")
APPLE_COMPILER_FLAGS = flags.get_flag_value(STATIC_LIBRARY_IOS_FLAGS, 'compiler_flags')
rn_xplat_cxx_library(
name = "fabric",
srcs = glob(["**/*.cpp"]),
header_namespace = "",
exported_headers = subdir_glob(
[
("", "**/*.h"),
],
prefix = "fabric",
),
compiler_flags = CXX_LIBRARY_COMPILER_FLAGS + [
"-fexceptions",
"-frtti",
],
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
fbobjc_preprocessor_flags = DEBUG_PREPROCESSOR_FLAGS + APPLE_INSPECTOR_FLAGS,
force_static = True,
preprocessor_flags = [
"-DLOG_TAG=\"ReactNative\"",
"-DWITH_FBSYSTRACE=1",
],
visibility = [
"PUBLIC",
],
deps = [
"xplat//fbsystrace:fbsystrace",
"xplat//folly:headers_only",
"xplat//folly:memory",
"xplat//folly:molly",
"xplat//third-party/glog:glog",
],
)

View File

@ -0,0 +1,46 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#include "FabricUIManager.h"
#include "ShadowNode.h"
namespace facebook {
namespace react {
FabricUIManager::FabricUIManager() {}
ShadowNodeRef FabricUIManager::createNode(int reactTag, std::string viewName, int rootTag, folly::dynamic props, void *instanceHandle) {
return std::make_shared<ShadowNode>(reactTag, viewName, rootTag, props, instanceHandle);
}
ShadowNodeRef FabricUIManager::cloneNode(const ShadowNodeRef &node) {
return nullptr;
}
ShadowNodeRef FabricUIManager::cloneNodeWithNewChildren(const ShadowNodeRef &node) {
return nullptr;
}
ShadowNodeRef FabricUIManager::cloneNodeWithNewProps(const ShadowNodeRef &node, folly::dynamic props) {
return nullptr;
}
ShadowNodeRef FabricUIManager::cloneNodeWithNewChildrenAndProps(const ShadowNodeRef &node, folly::dynamic newProps) {
return nullptr;
}
void FabricUIManager::appendChild(const ShadowNodeRef &parentNode, const ShadowNodeRef &childNode) {
}
ShadowNodeSetRef FabricUIManager::createChildSet(int rootTag) {
return nullptr;
}
void FabricUIManager::appendChildToSet(const ShadowNodeSetRef &childSet, const ShadowNodeRef &childNode) {
}
void FabricUIManager::completeRoot(int rootTag) {
}
}}

View File

@ -0,0 +1,34 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#pragma once
#include <folly/dynamic.h>
#include <folly/FBVector.h>
#include <memory>
namespace facebook {
namespace react {
class ShadowNode;
typedef std::shared_ptr<const ShadowNode> ShadowNodeRef;
typedef folly::fbvector<const ShadowNodeRef> ShadowNodeSet;
typedef std::shared_ptr<const ShadowNodeSet> ShadowNodeSetRef;
class FabricUIManager {
public:
FabricUIManager();
ShadowNodeRef createNode(int reactTag, std::string viewName, int rootTag, folly::dynamic props, void *instanceHandle);
ShadowNodeRef cloneNode(const ShadowNodeRef &node);
ShadowNodeRef cloneNodeWithNewChildren(const ShadowNodeRef &node);
ShadowNodeRef cloneNodeWithNewProps(const ShadowNodeRef &node, folly::dynamic props);
ShadowNodeRef cloneNodeWithNewChildrenAndProps(const ShadowNodeRef &node, folly::dynamic newProps);
void appendChild(const ShadowNodeRef &parentNode, const ShadowNodeRef &childNode);
ShadowNodeSetRef createChildSet(int rootTag);
void appendChildToSet(const ShadowNodeSetRef &childSet, const ShadowNodeRef &childNode);
void completeRoot(int rootTag);
};
}}

View File

@ -0,0 +1,15 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#include "ShadowNode.h"
namespace facebook {
namespace react {
ShadowNode::ShadowNode(int reactTag, std::string viewName, int rootTag, folly::dynamic props, void *instanceHandle) :
reactTag_(reactTag),
viewName_(viewName),
rootTag_(rootTag),
props_(props),
instanceHandle_(instanceHandle) {}
}}

View File

@ -0,0 +1,22 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#pragma once
#include <folly/dynamic.h>
#include <memory>
namespace facebook {
namespace react {
class ShadowNode {
public:
int reactTag_;
std::string viewName_;
int rootTag_;
folly::dynamic props_;
void *instanceHandle_;
ShadowNode(int reactTag, std::string viewName, int rootTag, folly::dynamic props, void *instanceHandle);
};
}}