• 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 #ifndef PRINT_PREVIEW_ATTRIBUTE_H
16 #define PRINT_PREVIEW_ATTRIBUTE_H
17 
18 #include "parcel.h"
19 #include "print_range.h"
20  #include <json/json.h>
21 
22 namespace OHOS::Print {
23 class PrintPreviewAttribute final : public Parcelable {
24 public:
25     explicit PrintPreviewAttribute();
26 
27     PrintPreviewAttribute(const PrintPreviewAttribute &right);
28 
29     PrintPreviewAttribute &operator=(const PrintPreviewAttribute &PrintPreviewAttribute);
30 
31     virtual ~PrintPreviewAttribute();
32 
33     void Reset();
34 
35     [[nodiscard]] bool HasResult() const;
36 
37     [[nodiscard]] uint32_t GetResult() const;
38 
39     void GetPreviewRange(PrintRange &previewRange) const;
40 
41     void SetResult(uint32_t result);
42 
43     void SetPreviewRange(const PrintRange &previewRange);
44 
45     virtual bool Marshalling(Parcel &parcel) const override;
46 
47     static std::shared_ptr<PrintPreviewAttribute> Unmarshalling(Parcel &parcel);
48 
49     void Dump();
50 
51     Json::Value ConvertToJsonObject() const;
52 
53 private:
54     void ReadFromParcel(Parcel &parcel);
55 
56 private:
57     bool hasResult_;
58     uint32_t result_;
59     PrintRange previewRange_;
60 };
61 }  // namespace OHOS::Print
62 #endif  // PRINT_PREVIEW_ATTRIBUTE_H
63