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 #include "ohos_adapter/bridge/ark_ohos_file_mapper_wrapper.h"
17 
18 namespace OHOS::ArkWeb {
19 
ArkOhosFileMapperWrapper(ArkWebRefPtr<ArkOhosFileMapper> ref)20 ArkOhosFileMapperWrapper::ArkOhosFileMapperWrapper(ArkWebRefPtr<ArkOhosFileMapper> ref) : ctocpp_(ref) {}
21 
GetFd()22 int32_t ArkOhosFileMapperWrapper::GetFd()
23 {
24     return ctocpp_->GetFd();
25 }
26 
GetOffset()27 int32_t ArkOhosFileMapperWrapper::GetOffset()
28 {
29     return ctocpp_->GetOffset();
30 }
31 
GetFileName()32 std::string ArkOhosFileMapperWrapper::GetFileName()
33 {
34     ArkWebString str = ctocpp_->GetFileName();
35     std::string result = ArkWebStringStructToClass(ctocpp_->GetFileName());
36     ArkWebStringStructRelease(str);
37     return result;
38 }
39 
IsCompressed()40 bool ArkOhosFileMapperWrapper::IsCompressed()
41 {
42     return ctocpp_->IsCompressed();
43 }
44 
GetDataPtr()45 void* ArkOhosFileMapperWrapper::GetDataPtr()
46 {
47     return ctocpp_->GetDataPtr();
48 }
49 
GetDataLen()50 size_t ArkOhosFileMapperWrapper::GetDataLen()
51 {
52     return ctocpp_->GetDataLen();
53 }
54 
UnzipData(uint8_t ** dest,size_t & len)55 bool ArkOhosFileMapperWrapper::UnzipData(uint8_t** dest, size_t& len)
56 {
57     return ctocpp_->UnzipData(dest, len);
58 }
59 
60 } // namespace OHOS::ArkWeb
61