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 PRINT_RANGE_H 17 #define PRINT_RANGE_H 18 19 #include <vector> 20 #include "parcel.h" 21 22 namespace OHOS::Print { 23 class PrintRange final : public Parcelable { 24 public: 25 explicit PrintRange(); 26 27 PrintRange(const PrintRange &right); 28 29 PrintRange &operator=(const PrintRange &right); 30 31 virtual ~PrintRange(); 32 33 void Reset(); 34 35 [[nodiscard]] bool HasStartPage() const; 36 37 [[nodiscard]] uint32_t GetStartPage() const; 38 39 [[nodiscard]] bool HasEndPage() const; 40 41 [[nodiscard]] uint32_t GetEndPage() const; 42 43 [[nodiscard]] bool HasPages() const; 44 45 void GetPages(std::vector<uint32_t> &pages) const; 46 47 void SetStartPage(uint32_t startPage); 48 49 void SetEndPage(uint32_t endPage); 50 51 void SetPages(const std::vector<uint32_t> &pages); 52 53 virtual bool Marshalling(Parcel &parcel) const override; 54 55 static std::shared_ptr<PrintRange> Unmarshalling(Parcel &parcel); 56 57 void Dump(); 58 59 private: 60 void ReadFromParcel(Parcel &parcel); 61 62 private: 63 bool hasStartPage_; 64 uint32_t startPage_; 65 66 bool hasEndPage_; 67 uint32_t endPage_; 68 69 bool hasPages_; 70 std::vector<uint32_t> pages_; 71 }; 72 } // namespace OHOS::Print 73 #endif // PRINT_RANGE_H 74