13920e296Sopenharmony_ci/* 23920e296Sopenharmony_ci * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 33920e296Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 43920e296Sopenharmony_ci * you may not use this file except in compliance with the License. 53920e296Sopenharmony_ci * You may obtain a copy of the License at 63920e296Sopenharmony_ci * 73920e296Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 83920e296Sopenharmony_ci * 93920e296Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 103920e296Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 113920e296Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 123920e296Sopenharmony_ci * See the License for the specific language governing permissions and 133920e296Sopenharmony_ci * limitations under the License. 143920e296Sopenharmony_ci */ 153920e296Sopenharmony_ci 163920e296Sopenharmony_ci#ifndef OHOS_RESTOOL_BINARY_FILE_PACKER_H 173920e296Sopenharmony_ci#define OHOS_RESTOOL_BINARY_FILE_PACKER_H 183920e296Sopenharmony_ci 193920e296Sopenharmony_ci#include "cmd_parser.h" 203920e296Sopenharmony_ci#include "resource_util.h" 213920e296Sopenharmony_ci#include "thread_pool.h" 223920e296Sopenharmony_ci 233920e296Sopenharmony_cinamespace OHOS { 243920e296Sopenharmony_cinamespace Global { 253920e296Sopenharmony_cinamespace Restool { 263920e296Sopenharmony_ciclass BinaryFilePacker { 273920e296Sopenharmony_cipublic: 283920e296Sopenharmony_ci explicit BinaryFilePacker(const PackageParser &packageParser, const std::string &moduleName); 293920e296Sopenharmony_ci ~BinaryFilePacker(); 303920e296Sopenharmony_ci std::future<uint32_t> CopyBinaryFileAsync(const std::vector<std::string> &inputs); 313920e296Sopenharmony_ci void StopCopy(); 323920e296Sopenharmony_ci 333920e296Sopenharmony_ciprivate: 343920e296Sopenharmony_ci uint32_t CopyBinaryFile(const std::vector<std::string> &inputs); 353920e296Sopenharmony_ci uint32_t CopyBinaryFile(const std::string &filePath, const std::string &fileType); 363920e296Sopenharmony_ci uint32_t CopyBinaryFileImpl(const std::string &src, const std::string &dst); 373920e296Sopenharmony_ci uint32_t CopySingleFile(const std::string &path, std::string &subPath); 383920e296Sopenharmony_ci PackageParser packageParser_; 393920e296Sopenharmony_ci std::string moduleName_; 403920e296Sopenharmony_ci ThreadPool threadPool_; 413920e296Sopenharmony_ci std::vector<std::future<uint32_t>> copyResults_; 423920e296Sopenharmony_ci std::atomic<bool> stopCopy_{false}; 433920e296Sopenharmony_ci}; 443920e296Sopenharmony_ci} // namespace Restool 453920e296Sopenharmony_ci} // namespace Global 463920e296Sopenharmony_ci} // namespace OHOS 473920e296Sopenharmony_ci#endif 48