• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 {
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)
PageInfo(pageId,url,path)35         : PageInfo(pageId, url, path), initParams_(params), params_(std::move(params)), recoverable_(recoverable),
36         isCreateByNamedRouter_(isCreateByNamedRouter)
37     {}
38     ~EntryPageInfo() override = default;
39 
GetPageInitParams()40     const std::string& GetPageInitParams() const
41     {
42         return initParams_;
43     }
44 
GetPageParams()45     const std::string& GetPageParams() const
46     {
47         return params_;
48     }
49 
ReplacePageParams(const std::string & param)50     std::string ReplacePageParams(const std::string& param)
51     {
52         std::string old(std::move(params_));
53         params_ = param;
54         return old;
55     }
56 
IsRecoverable()57     bool IsRecoverable() const
58     {
59         return recoverable_;
60     }
61 
ReplaceRecoverable(bool recoverable)62     bool ReplaceRecoverable(bool recoverable)
63     {
64         bool old = recoverable_;
65         recoverable_ = recoverable;
66         return old;
67     }
68 
IsCreateByNamedRouter()69     bool IsCreateByNamedRouter() const
70     {
71         return isCreateByNamedRouter_;
72     }
73 
SetPageMap(const RefPtr<Framework::RevSourceMap> & pageMap)74     void SetPageMap(const RefPtr<Framework::RevSourceMap>& pageMap)
75     {
76         pageMap_ = pageMap;
77     }
78 
GetPageMap()79     const RefPtr<Framework::RevSourceMap>& GetPageMap() const
80     {
81         return pageMap_;
82     }
83 
SetShowTime(int64_t time)84     void SetShowTime(int64_t time)
85     {
86         showTime_ = time;
87     }
88 
GetShowTime()89     int64_t GetShowTime() const
90     {
91         return showTime_;
92     }
93 
94 private:
95     std::string initParams_;
96     std::string params_;
97     bool recoverable_ = true;
98     bool isCreateByNamedRouter_ = false;
99     int64_t showTime_ = 0;
100     RefPtr<Framework::RevSourceMap> pageMap_;
101 
102     ACE_DISALLOW_COPY_AND_MOVE(EntryPageInfo);
103 };
104 
105 } // namespace OHOS::Ace::NG
106 
107 #endif // FOUNDATION_ACE_FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_NG_ENTRY_PAGE_INFO_H