• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 wrapperied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef ARK_WEB_HAP_VALUE_WRAPPER_H_
17 #define ARK_WEB_HAP_VALUE_WRAPPER_H_
18 #pragma once
19 
20 #include "include/nweb_hap_value.h"
21 #include "ohos_nweb/include/ark_web_hap_value.h"
22 
23 namespace OHOS::ArkWeb {
24 
25 using ArkWebHapValueType = OHOS::NWeb::NWebHapValue::Type;
26 
27 class ArkWebHapValueWrapper : public OHOS::NWeb::NWebHapValue {
28 public:
29     ArkWebHapValueWrapper(ArkWebRefPtr<ArkWebHapValue> ark_web_hap_value);
30     ~ArkWebHapValueWrapper() = default;
31 
32     ArkWebHapValueType GetType() override;
33 
34     void SetType(ArkWebHapValueType type) override;
35 
36     int GetInt() override;
37 
38     void SetInt(int value) override;
39 
40     bool GetBool() override;
41 
42     void SetBool(bool value) override;
43 
44     double GetDouble() override;
45 
46     void SetDouble(double value) override;
47 
48     std::string GetString() override;
49 
50     void SetString(const std::string& value) override;
51 
52     const char* GetBinary(int& length) override;
53 
54     void SetBinary(int length, const char* value) override;
55 
56     std::map<std::string, std::shared_ptr<OHOS::NWeb::NWebHapValue>> GetDictValue() override;
57 
58     std::vector<std::shared_ptr<OHOS::NWeb::NWebHapValue>> GetListValue() override;
59 
60     std::shared_ptr<OHOS::NWeb::NWebHapValue> NewChildValue() override;
61 
62     void SaveDictChildValue(const std::string& key) override;
63 
64     void SaveListChildValue() override;
65 
66     int64_t GetInt64() override;
67 
68     void SetInt64(int64_t value) override;
69 
70     std::vector<uint8_t> GetBinary() override;
71 
72     void SetBinary(const std::vector<uint8_t>& value) override;
73 
74     std::vector<bool> GetBoolArray() override;
75 
76     void SetBoolArray(const std::vector<bool>& value) override;
77 
78     std::vector<int64_t> GetInt64Array() override;
79 
80     void SetInt64Array(const std::vector<int64_t>& value) override;
81 
82     std::vector<double> GetDoubleArray() override;
83 
84     void SetDoubleArray(const std::vector<double>& value) override;
85 
86     std::vector<std::string> GetStringArray() override;
87 
88     void SetStringArray(const std::vector<std::string>& value) override;
89 
90     std::string GetErrMsg() override;
91 
92     void SetErrMsg(const std::string& msg) override;
93 
94     std::string GetErrName() override;
95 
96     void SetErrName(const std::string& name) override;
97 
98 private:
99     ArkWebRefPtr<ArkWebHapValue> ark_web_hap_value_;
100 };
101 
102 } // namespace OHOS::ArkWeb
103 
104 #endif // ARK_WEB_HAP_VALUE_WRAPPER_H_
105