1 /* 2 * Copyright (c) 2022 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 #ifndef FOUNDATION_ACE_FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_NG_ENTRY_PAGE_INFO_H 17 #define FOUNDATION_ACE_FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_NG_ENTRY_PAGE_INFO_H 18 19 #include <cstdint> 20 #include <string> 21 #include <utility> 22 23 #include "base/memory/ace_type.h" 24 #include "base/utils/noncopyable.h" 25 #include "bridge/common/utils/source_map.h" 26 #include "core/components_ng/pattern/stage/page_info.h" 27 28 namespace OHOS::Ace::NG { 29 30 class ACE_EXPORT EntryPageInfo : public PageInfo { DECLARE_ACE_TYPE(EntryPageInfo,PageInfo)31 DECLARE_ACE_TYPE(EntryPageInfo, PageInfo) 32 public: 33 EntryPageInfo(int32_t pageId, const std::string& url, const std::string& path, std::string params, 34 bool recoverable = true, bool isCreateByNamedRouter = false) 35 : PageInfo(pageId, url, path), params_(std::move(params)), recoverable_(recoverable), 36 isCreateByNamedRouter_(isCreateByNamedRouter) 37 {} 38 ~EntryPageInfo() override = default; 39 GetPageParams()40 const std::string& GetPageParams() const 41 { 42 return params_; 43 } 44 ReplacePageParams(const std::string & param)45 std::string ReplacePageParams(const std::string& param) 46 { 47 std::string old(std::move(params_)); 48 params_ = param; 49 return old; 50 } 51 IsRecoverable()52 bool IsRecoverable() const 53 { 54 return recoverable_; 55 } 56 ReplaceRecoverable(bool recoverable)57 bool ReplaceRecoverable(bool recoverable) 58 { 59 bool old = recoverable_; 60 recoverable_ = recoverable; 61 return old; 62 } 63 IsCreateByNamedRouter()64 bool IsCreateByNamedRouter() const 65 { 66 return isCreateByNamedRouter_; 67 } 68 SetPageMap(const RefPtr<Framework::RevSourceMap> & pageMap)69 void SetPageMap(const RefPtr<Framework::RevSourceMap>& pageMap) 70 { 71 pageMap_ = pageMap; 72 } 73 GetPageMap()74 const RefPtr<Framework::RevSourceMap>& GetPageMap() const 75 { 76 return pageMap_; 77 } 78 SetShowTime(int64_t time)79 void SetShowTime(int64_t time) 80 { 81 showTime_ = time; 82 } 83 GetShowTime()84 int64_t GetShowTime() const 85 { 86 return showTime_; 87 } 88 89 private: 90 std::string params_; 91 bool recoverable_ = true; 92 bool isCreateByNamedRouter_ = false; 93 int64_t showTime_ = 0; 94 RefPtr<Framework::RevSourceMap> pageMap_; 95 96 ACE_DISALLOW_COPY_AND_MOVE(EntryPageInfo); 97 }; 98 99 } // namespace OHOS::Ace::NG 100 101 #endif // FOUNDATION_ACE_FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_NG_ENTRY_PAGE_INFO_H