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_VALUE_H 17 #define SCAN_OPTION_VALUE_H 18 19 #include <vector> 20 #include "parcel.h" 21 #include "scan_constant.h" 22 23 namespace OHOS::Scan { 24 class ScanOptionValue final : public Parcelable { 25 public: 26 explicit ScanOptionValue(); 27 28 ScanOptionValue(const ScanOptionValue &right); 29 30 ScanOptionValue &operator=(const ScanOptionValue &right); 31 32 virtual ~ScanOptionValue(); 33 34 void Reset(); 35 void Dump(); 36 37 void SetScanOptionValueType(const ScanOptionValueType &valueType); 38 void SetValueSize(const int32_t &valueSize); 39 void SetNumValue(const int32_t &numValue); 40 void SetNumListValue(const std::vector<int32_t> &numListValue); 41 void SetStrValue(const std::string &strValue); 42 void SetBoolValue(const bool &boolValue); 43 44 [[nodiscard]] ScanOptionValueType GetScanOptionValueType() const; 45 [[nodiscard]] int32_t GetValueSize() const; 46 [[nodiscard]] int32_t GetNumValue() const; 47 void GetNumListValue(std::vector<int32_t> &numListValue) const; 48 [[nodiscard]] std::string GetStrValue() const; 49 [[nodiscard]] bool GetBoolValue() const; 50 51 virtual bool Marshalling(Parcel &parcel) const override; 52 static std::shared_ptr<ScanOptionValue> Unmarshalling(Parcel &parcel); 53 private: 54 void ReadFromParcel(Parcel &parcel); 55 56 private: 57 ScanOptionValueType valueType_; 58 int32_t valueSize_; 59 int32_t numValue_; 60 std::vector<int32_t> numListValue_; 61 std::string strValue_; 62 bool boolValue_; 63 }; 64 } // namespace OHOS::Scan 65 #endif // SCAN_OPTION_VALUE_H 66