• 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 implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef OHOS_MEDIA_BACKUP_EXTERNAL_FILES_COUNT_STATISTIC_H
16 #define OHOS_MEDIA_BACKUP_EXTERNAL_FILES_COUNT_STATISTIC_H
17 
18 #include <string>
19 #include <vector>
20 
21 #include "rdb_store.h"
22 #include "result_set_utils.h"
23 #include "media_backup_report_data_type.h"
24 
25 namespace OHOS::Media {
26 class ExternalFilesCountStatistic {
27 public:
SetExternalRdb(std::shared_ptr<NativeRdb::RdbStore> externalRdb)28     ExternalFilesCountStatistic &SetExternalRdb(std::shared_ptr<NativeRdb::RdbStore> externalRdb)
29     {
30         this->externalRdb_ = externalRdb;
31         return *this;
32     }
SetSceneCode(int32_t sceneCode)33     ExternalFilesCountStatistic &SetSceneCode(int32_t sceneCode)
34     {
35         this->sceneCode_ = sceneCode;
36         return *this;
37     }
SetTaskId(const std::string & taskId)38     ExternalFilesCountStatistic &SetTaskId(const std::string &taskId)
39     {
40         this->taskId_ = taskId;
41         return *this;
42     }
43     std::vector<AlbumMediaStatisticInfo> Load();
44 
45 private:
46     int32_t QueryExternalImageCount();
47     int32_t QueryExternalVideoCount();
48     int32_t QueryExternalAudioCount();
49     AlbumMediaStatisticInfo GetMediaStatInfo();
50     AlbumMediaStatisticInfo GetAudioStatInfo();
51 
52 private:
53     std::shared_ptr<NativeRdb::RdbStore> externalRdb_;
54     int32_t sceneCode_;
55     std::string taskId_;
56 };
57 }  // namespace OHOS::Media
58 #endif  // OHOS_MEDIA_BACKUP_EXTERNAL_FILES_COUNT_STATISTIC_H