• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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 "oper_factory.h"
17 
18 #include "external_storage_oper.h"
19 #include "file_manager_service_def.h"
20 #include "file_oper.h"
21 #include "log.h"
22 #include "media_file_oper.h"
23 
24 using namespace std;
25 namespace OHOS {
26 namespace FileManagerService {
GetFileOper(int equipmentId)27 unique_ptr<FileOper> OperFactory::GetFileOper(int equipmentId)
28 {
29     unique_ptr<FileOper> fp;
30     DEBUG_LOG("FileOper %{public}d.", equipmentId);
31     switch (equipmentId) {
32         case Equipment::INTERNAL_STORAGE: {
33             fp = make_unique<MediaFileOper>();
34             break;
35         }
36         case Equipment::EXTERNAL_STORAGE: {
37             fp = make_unique<ExternalStorageOper>();
38             break;
39         }
40         default: {
41             DEBUG_LOG("default FileOper %{public}d.", equipmentId);
42             break;
43         }
44     }
45     return fp;
46 }
47 } // namespace FileManagerService
48 } // namespace OHOS