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