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 SetOptionIndex(const uint32_t& optionIndex); 33 void SetOptionTitle(const std::string &optionTitle); 34 void SetOptionDesc(const std::string &optionDesc); 35 void SetOptionType(const uint32_t &optionType); 36 void SetOptionUnit(const uint32_t &optionUnit); 37 void SetOptionConstraintType(const uint32_t &optionConstraintType); 38 void SetOptionConstraintString(const std::vector<std::string> &optionConstraintString); 39 void SetOptionConstraintNumber(const std::vector<int32_t> &optionConstraintNumber); 40 void SetOptionConstraintRange(const ScanRange& optionConstraintRange); 41 42 [[nodiscard]] std::string GetOptionName() const; 43 [[nodiscard]] uint32_t GetOptionIndex() const; 44 [[nodiscard]] std::string GetOptionTitle() const; 45 [[nodiscard]] std::string GetOptionDesc() const; 46 [[nodiscard]] uint32_t GetOptionType() const; 47 [[nodiscard]] uint32_t GetOptionUnit() const; 48 [[nodiscard]] uint32_t GetOptionConstraintType() const; 49 void GetOptionConstraintString(std::vector<std::string> &optionConstraintString) const; 50 void GetOptionConstraintNumber(std::vector<int32_t> &optionConstraintNumber) const; 51 void GetOptionConstraintRange(ScanRange &optionConstraintRange) const; 52 53 virtual bool Marshalling(Parcel &parcel) const override; 54 55 static std::shared_ptr<ScanOptionDescriptor> Unmarshalling(Parcel &parcel); 56 57 void Dump(); 58 59 private: 60 void ReadFromParcel(Parcel &parcel); 61 62 private: 63 std::string optionName_; 64 uint32_t optionIndex_; 65 std::string optionTitle_; 66 std::string optionDesc_; 67 uint32_t optionType_; 68 uint32_t optionUnit_; 69 uint32_t optionConstraintType_; 70 std::vector<std::string> optionConstraintString_; 71 std::vector<std::int32_t> optionConstraintNumber_; 72 ScanRange optionConstraintRange_; 73 }; 74 } // namespace OHOS::Scan 75 #endif // SCAN_OPTION_DESCRIPTOR_H 76