1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include "frameworks/core/components_ng/base/view_advanced_register.h" 17 18 namespace OHOS::Ace::NG { 19 thread_local ViewAdvancedRegister* ViewAdvancedRegister::instance_ = nullptr; 20 GetInstance()21ViewAdvancedRegister* ViewAdvancedRegister::GetInstance() 22 { 23 if (ViewAdvancedRegister::instance_ == nullptr) { 24 ViewAdvancedRegister::instance_ = new ViewAdvancedRegister(); 25 } 26 return ViewAdvancedRegister::instance_; 27 } 28 CreatePagePattern(const RefPtr<PageInfo> & pageInfo)29RefPtr<PagePattern> ViewAdvancedRegister::CreatePagePattern(const RefPtr<PageInfo>& pageInfo) 30 { 31 return AceType::MakeRefPtr<PagePattern>(pageInfo); 32 } 33 GeneratePattern(const std::string & patternName)34RefPtr<Pattern> ViewAdvancedRegister::GeneratePattern(const std::string& patternName) 35 { 36 if (patternName == V2::STAGE_ETS_TAG) { 37 return AceType::MakeRefPtr<StagePattern>(); 38 } 39 return nullptr; 40 } 41 GenerateStageManager(const RefPtr<FrameNode> & stage)42RefPtr<StageManager> ViewAdvancedRegister::GenerateStageManager(const RefPtr<FrameNode>& stage) 43 { 44 return AceType::MakeRefPtr<StageManager>(stage); 45 } 46 } // namespace OHOS::Ace::NG