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_CORE_COMPONENTS_NG_PATTERNS_STAGE_PAGE_INFO_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_STAGE_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 "core/components/dialog/dialog_properties.h" 26 27 namespace OHOS::Ace::NG { 28 29 class ACE_EXPORT PageInfo : public AceType { 30 DECLARE_ACE_TYPE(PageInfo, AceType); 31 32 public: 33 PageInfo() = default; 34 ~PageInfo() override = default; PageInfo(int32_t pageId,std::string url,std::string path)35 PageInfo(int32_t pageId, std::string url, std::string path) 36 : pageId_(pageId), url_(std::move(url)), path_(std::move(path)) 37 {} 38 GetPageId()39 int32_t GetPageId() const 40 { 41 return pageId_; 42 } 43 GetPageUrl()44 const std::string& GetPageUrl() const 45 { 46 return url_; 47 } 48 GetPagePath()49 const std::string& GetPagePath() const 50 { 51 return path_; 52 } 53 GetAlertCallback()54 const std::function<void(int32_t)>& GetAlertCallback() const 55 { 56 return alertCallback_; 57 } 58 GetDialogProperties()59 const DialogProperties& GetDialogProperties() const 60 { 61 return dialogProperties_; 62 } 63 SetAlertCallback(std::function<void (int32_t)> && callback)64 void SetAlertCallback(std::function<void(int32_t)>&& callback) 65 { 66 alertCallback_ = callback; 67 } 68 SetDialogProperties(const DialogProperties & dialogProperties)69 void SetDialogProperties(const DialogProperties& dialogProperties) 70 { 71 dialogProperties_ = dialogProperties; 72 } 73 SetPageIndex(int32_t pageIndex)74 void SetPageIndex(int32_t pageIndex) 75 { 76 pageIndex_ = pageIndex; 77 } 78 GetPageIndex()79 int32_t GetPageIndex() const 80 { 81 return pageIndex_; 82 } 83 private: 84 int32_t pageId_ = 0; 85 int32_t pageIndex_ = -1; 86 std::string url_; 87 std::string path_; 88 89 std::function<void(int32_t)> alertCallback_; 90 DialogProperties dialogProperties_; 91 92 ACE_DISALLOW_COPY_AND_MOVE(PageInfo); 93 }; 94 } // namespace OHOS::Ace::NG 95 96 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_STAGE_PAGE_INFO_H 97