/** * Copyright (c) 2015-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #include #include #include #include #include #include namespace facebook { namespace react { class ShadowNode; using SharedShadowNode = std::shared_ptr; using SharedShadowNodeList = std::vector>; using SharedShadowNodeSharedList = std::shared_ptr; using SharedShadowNodeUnsharedList = std::shared_ptr; class ShadowNode: public virtual Sealable, public virtual DebugStringConvertible { public: static SharedShadowNodeSharedList emptySharedShadowNodeSharedList(); #pragma mark - Constructors ShadowNode( Tag tag, Tag rootTag, InstanceHandle instanceHandle, SharedProps props = SharedProps(), SharedShadowNodeSharedList children = SharedShadowNodeSharedList() ); ShadowNode( SharedShadowNode shadowNode, SharedProps props = nullptr, SharedShadowNodeSharedList children = nullptr ); #pragma mark - Getters virtual ComponentHandle getComponentHandle() const = 0; virtual ComponentName getComponentName() const = 0; SharedShadowNodeSharedList getChildren() const; SharedProps getProps() const; Tag getTag() const; SharedShadowNode getSourceNode() const; void sealRecursive() const; #pragma mark - Mutating Methods void appendChild(const SharedShadowNode &child); void replaceChild(const SharedShadowNode &oldChild, const SharedShadowNode &newChild); void clearSourceNode(); #pragma mark - DebugStringConvertible std::string getDebugName() const override; std::string getDebugValue() const override; SharedDebugStringConvertibleList getDebugChildren() const override; SharedDebugStringConvertibleList getDebugProps() const override; protected: Tag tag_; Tag rootTag_; InstanceHandle instanceHandle_; SharedProps props_; SharedShadowNodeSharedList children_; SharedShadowNode sourceNode_; }; } // namespace react } // namespace facebook