• 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 PRINTER_INFO_H
17 #define PRINTER_INFO_H
18 
19 #include "parcel.h"
20 #include "printer_capability.h"
21 
22 namespace OHOS::Print {
23 class PrinterInfo final : public Parcelable {
24 public:
25     explicit PrinterInfo();
26 
27     PrinterInfo(const PrinterInfo &right);
28 
29     PrinterInfo &operator=(const PrinterInfo &right);
30 
31     virtual ~PrinterInfo();
32 
33     void SetPrinterId(const std::string &printerId);
34 
35     void SetPrinterName(std::string printerName);
36 
37     void SetPrinterIcon(uint32_t printIcon);
38 
39     void SetPrinterState(uint32_t printerState);
40 
41     void SetDescription(std::string description);
42 
43     void SetCapability(const PrinterCapability &capability);
44 
45     void SetOption(const std::string &option);
46 
47     [[nodiscard]] const std::string &GetPrinterId() const;
48 
49     [[nodiscard]] const std::string &GetPrinterName() const;
50 
51     [[nodiscard]] uint32_t GetPrinterIcon() const;
52 
53     [[nodiscard]] uint32_t GetPrinterState() const;
54 
55     [[nodiscard]] const std::string &GetDescription() const;
56 
57     [[nodiscard]] bool HasCapability() const;
58 
59     void GetCapability(PrinterCapability &cap) const;
60 
61     [[nodiscard]] bool HasOption() const;
62 
63     [[nodiscard]] std::string GetOption() const;
64 
65     virtual bool Marshalling(Parcel &parcel) const override;
66 
67     static std::shared_ptr<PrinterInfo> Unmarshalling(Parcel &parcel);
68 
69     void Dump();
70 
71 private:
72     bool ReadFromParcel(Parcel &parcel);
73 
74 private:
75     std::string printerId_;
76 
77     std::string printerName_;
78 
79     uint32_t printerState_;
80 
81     uint32_t printerIcon_;
82 
83     std::string description_;
84 
85     bool hasCapability_;
86 
87     PrinterCapability capability_;
88 
89     bool hasOption_;
90 
91     std::string option_;
92 };
93 }  // namespace OHOS::Print
94 #endif  // PRINTER_INFO_H
95