1 /* 2 * Copyright (c) 2025 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 OHOS_FILEMGMT_MULTI_DOWNLOAD_PROGRESS_CORE_H 17 #define OHOS_FILEMGMT_MULTI_DOWNLOAD_PROGRESS_CORE_H 18 19 #include <memory> 20 21 #include "download_progress_ani.h" 22 #include "filemgmt_libfs.h" 23 24 namespace OHOS::FileManagement::CloudSync { 25 struct FailedFileInfo { FailedFileInfoFailedFileInfo26 FailedFileInfo(const std::string &file, int32_t err) : uri(file), error(err) {} 27 std::string uri; 28 int32_t error{0}; 29 }; 30 31 class MultiDlProgressCore { 32 public: 33 MultiDlProgressCore() = default; 34 ~MultiDlProgressCore() = default; 35 36 static ModuleFileIO::FsResult<MultiDlProgressCore *> Constructor(); 37 int32_t GetStatus(); 38 int64_t GetTaskId(); 39 int64_t GetDownloadedNum(); 40 int64_t GetFailedNum(); 41 int64_t GetTotalNum(); 42 int64_t GetDownloadedSize(); 43 int64_t GetTotalSize(); 44 int32_t GetErrorType(); 45 ModuleFileIO::FsResult<std::vector<FailedFileInfo>> GetFailedFileList(); 46 ModuleFileIO::FsResult<std::vector<std::string>> GetDownloadedFileList(); 47 48 std::shared_ptr<BatchProgressAni> downloadProgress_{nullptr}; 49 }; 50 } // namespace OHOS::FileManagement::CloudSync 51 #endif // OHOS_FILEMGMT_MULTI_DOWNLOAD_PROGRESS_CORE_H