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 implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "ohos_nweb/bridge/ark_web_native_embed_info_wrapper.h"
17 
18 #include "base/bridge/ark_web_bridge_macros.h"
19 
20 namespace OHOS::ArkWeb {
21 
ArkWebNativeEmbedInfoWrapper(ArkWebRefPtr<ArkWebNativeEmbedInfo> ark_web_native_embed_info)22 ArkWebNativeEmbedInfoWrapper::ArkWebNativeEmbedInfoWrapper(
23     ArkWebRefPtr<ArkWebNativeEmbedInfo> ark_web_native_embed_info)
24     : ark_web_native_embed_info_(ark_web_native_embed_info)
25 {}
26 
GetWidth()27 int32_t ArkWebNativeEmbedInfoWrapper::GetWidth()
28 {
29     return ark_web_native_embed_info_->GetWidth();
30 }
31 
GetHeight()32 int32_t ArkWebNativeEmbedInfoWrapper::GetHeight()
33 {
34     return ark_web_native_embed_info_->GetHeight();
35 }
36 
GetId()37 std::string ArkWebNativeEmbedInfoWrapper::GetId()
38 {
39     ArkWebString stId = ark_web_native_embed_info_->GetId();
40 
41     std::string objId = ArkWebStringStructToClass(stId);
42     ArkWebStringStructRelease(stId);
43     return objId;
44 }
45 
GetSrc()46 std::string ArkWebNativeEmbedInfoWrapper::GetSrc()
47 {
48     ArkWebString stSrc = ark_web_native_embed_info_->GetSrc();
49 
50     std::string objSrc = ArkWebStringStructToClass(stSrc);
51     ArkWebStringStructRelease(stSrc);
52     return objSrc;
53 }
54 
GetUrl()55 std::string ArkWebNativeEmbedInfoWrapper::GetUrl()
56 {
57     ArkWebString stUrl = ark_web_native_embed_info_->GetUrl();
58 
59     std::string objUrl = ArkWebStringStructToClass(stUrl);
60     ArkWebStringStructRelease(stUrl);
61     return objUrl;
62 }
63 
GetType()64 std::string ArkWebNativeEmbedInfoWrapper::GetType()
65 {
66     ArkWebString stType = ark_web_native_embed_info_->GetType();
67 
68     std::string objType = ArkWebStringStructToClass(stType);
69     ArkWebStringStructRelease(stType);
70     return objType;
71 }
72 
GetTag()73 std::string ArkWebNativeEmbedInfoWrapper::GetTag()
74 {
75     ArkWebString stType = ark_web_native_embed_info_->GetTag();
76 
77     std::string objType = ArkWebStringStructToClass(stType);
78     ArkWebStringStructRelease(stType);
79     return objType;
80 }
81 
GetParams()82 std::map<std::string, std::string> ArkWebNativeEmbedInfoWrapper::GetParams()
83 {
84     ArkWebStringMap stType = ark_web_native_embed_info_->GetParams();
85 
86     std::map<std::string, std::string> objType = ArkWebStringMapStructToClass(stType);
87     ArkWebStringMapStructRelease(stType);
88     return objType;
89 }
90 
GetX()91 int32_t ArkWebNativeEmbedInfoWrapper::GetX()
92 {
93     return ark_web_native_embed_info_->GetX();
94 }
95 
GetY()96 int32_t ArkWebNativeEmbedInfoWrapper::GetY()
97 {
98     return ark_web_native_embed_info_->GetY();
99 }
100 
101 } // namespace OHOS::ArkWeb
102