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_MARGIN_H 17 #define PRINT_MARGIN_H 18 19 #include "parcel.h" 20 21 namespace OHOS::Print { 22 class PrintMargin final : public Parcelable { 23 public: 24 explicit PrintMargin(); 25 26 PrintMargin(const PrintMargin &right); 27 28 void Set(const PrintMargin &right); 29 30 PrintMargin &operator=(const PrintMargin &right); 31 32 virtual ~PrintMargin(); 33 34 void Reset(); 35 36 [[nodiscard]] bool HasTop() const; 37 38 [[nodiscard]] uint32_t GetTop() const; 39 40 [[nodiscard]] bool HasBottom() const; 41 42 [[nodiscard]] uint32_t GetBottom() const; 43 44 [[nodiscard]] bool HasLeft() const; 45 46 [[nodiscard]] uint32_t GetLeft() const; 47 48 [[nodiscard]] bool HasRight() const; 49 50 [[nodiscard]] uint32_t GetRight() const; 51 52 void SetTop(uint32_t top); 53 54 void SetBottom(uint32_t bottom); 55 56 void SetLeft(uint32_t left); 57 58 void SetRight(uint32_t right); 59 60 virtual bool Marshalling(Parcel &parcel) const override; 61 62 static std::shared_ptr<PrintMargin> Unmarshalling(Parcel &parcel); 63 64 void Dump(); 65 66 private: 67 void ReadFromParcel(Parcel &parcel); 68 69 private: 70 bool hasTop_; 71 uint32_t top_; 72 73 bool hasBottom_; 74 uint32_t bottom_; 75 76 bool hasLeft_; 77 uint32_t left_; 78 79 bool hasRight_; 80 uint32_t right_; 81 }; 82 } // namespace OHOS::Print 83 #endif // PRINT_MARGIN_H 84