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 void SetIsDefaultPrinter(bool isDefaultPrinter); 48 49 void SetIsLastUsedPrinter(bool isLastUsedPrinter); 50 51 void SetPrinterStatus(uint32_t printerStatus); 52 53 [[nodiscard]] const std::string &GetPrinterId() const; 54 55 [[nodiscard]] const std::string &GetPrinterName() const; 56 57 [[nodiscard]] uint32_t GetPrinterIcon() const; 58 59 [[nodiscard]] uint32_t GetPrinterState() const; 60 61 [[nodiscard]] const std::string &GetDescription() const; 62 63 [[nodiscard]] bool HasCapability() const; 64 65 void GetCapability(PrinterCapability &cap) const; 66 67 [[nodiscard]] bool HasOption() const; 68 69 [[nodiscard]] std::string GetOption() const; 70 71 [[nodiscard]] bool HasIsDefaultPrinter() const; 72 73 [[nodiscard]] bool GetIsDefaultPrinter() const; 74 75 [[nodiscard]] bool HasIsLastUsedPrinter() const; 76 77 [[nodiscard]] bool GetIsLastUsedPrinter() const; 78 79 [[nodiscard]] bool HasPrinterStatus() const; 80 81 [[nodiscard]] uint32_t GetPrinterStatus() const; 82 83 virtual bool Marshalling(Parcel &parcel) const override; 84 85 static std::shared_ptr<PrinterInfo> Unmarshalling(Parcel &parcel); 86 87 void Dump(); 88 89 private: 90 bool ReadFromParcel(Parcel &parcel); 91 92 private: 93 std::string printerId_; 94 95 std::string printerName_; 96 97 uint32_t printerState_; 98 99 uint32_t printerIcon_; 100 101 std::string description_; 102 103 bool hasCapability_; 104 105 PrinterCapability capability_; 106 107 bool hasOption_; 108 109 std::string option_; 110 111 bool hasIsDefaultPrinter_; 112 113 bool isDefaultPrinter_; 114 115 bool hasIsLastUsedPrinter_; 116 117 bool isLastUsedPrinter_; 118 119 bool hasPrinterStatus_; 120 121 uint32_t printerStatus_; 122 }; 123 } // namespace OHOS::Print 124 #endif // PRINTER_INFO_H 125