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 SCAN_OPTION_DESCRIPTOR_H 17 #define SCAN_OPTION_DESCRIPTOR_H 18 19 #include "parcel.h" 20 #include "scan_range.h" 21 22 namespace OHOS::Scan { 23 class ScanOptionDescriptor final : public Parcelable { 24 public: 25 explicit ScanOptionDescriptor(); 26 ScanOptionDescriptor(const ScanOptionDescriptor &right); 27 ~ScanOptionDescriptor() = default; 28 29 ScanOptionDescriptor &operator=(const ScanOptionDescriptor &right); 30 31 void SetOptionName(const std::string &optionName); 32 void SetOptionTitle(const std::string &optionTitle); 33 void SetOptionDesc(const std::string &optionDesc); 34 void SetOptionType(const uint32_t &optionType); 35 void SetOptionUnit(const uint32_t &optionUnit); 36 37 void SetOptionSize(const int32_t &optionSize); 38 void SetOptionCap(const int32_t &optionCap); 39 40 void SetOptionConstraintType(const uint32_t &optionConstraintType); 41 void SetOptionConstraintString(const std::vector<std::string> &optionConstraintString); 42 void SetOptionConstraintNumber(const std::vector<int32_t> &optionConstraintNumber); 43 void SetOptionConstraintRange(const ScanRange& optionConstraintRange); 44 45 [[nodiscard]] std::string GetOptionName() const; 46 [[nodiscard]] std::string GetOptionTitle() const; 47 [[nodiscard]] std::string GetOptionDesc() const; 48 [[nodiscard]] uint32_t GetOptionType() const; 49 [[nodiscard]] uint32_t GetOptionUnit() const; 50 51 [[nodiscard]] int32_t GetOptionSize() const; 52 [[nodiscard]] int32_t GetOptionCap() const; 53 54 [[nodiscard]] uint32_t GetOptionConstraintType() const; 55 void GetOptionConstraintString(std::vector<std::string> &optionConstraintString) const; 56 void GetOptionConstraintNumber(std::vector<int32_t> &optionConstraintNumber) const; 57 void GetOptionConstraintRange(ScanRange &optionConstraintRange) const; 58 59 virtual bool Marshalling(Parcel &parcel) const override; 60 61 static std::shared_ptr<ScanOptionDescriptor> Unmarshalling(Parcel &parcel); 62 63 void Dump(); 64 65 private: 66 void ReadFromParcel(Parcel &parcel); 67 68 private: 69 std::string optionName_; 70 std::string optionTitle_; 71 std::string optionDesc_; 72 uint32_t optionType_; 73 uint32_t optionUnit_; 74 75 int32_t optionSize_; 76 int32_t optionCap_; 77 78 uint32_t optionConstraintType_; 79 std::vector<std::string> optionConstraintString_; 80 std::vector<std::int32_t> optionConstraintNumber_; 81 ScanRange optionConstraintRange_; 82 }; 83 } // namespace OHOS::Scan 84 #endif // SCAN_OPTION_DESCRIPTOR_H 85