• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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 #include "command/command.h"
16 
17 #include "command/list_command_v10.h"
18 #include "command/ls_command.h"
19 #include "command/recv_command_v10.h"
20 #include "command/send_command_v10.h"
21 #include "command/delete_command_v10.h"
22 #include "command/query_command_v10.h"
23 #include "option_args.h"
24 
25 namespace OHOS {
26 namespace Media {
27 namespace MediaTool {
Create(const ExecEnv & env)28 std::unique_ptr<Command> Command::Create(const ExecEnv &env)
29 {
30     if (env.optArgs.cmdType == OptCmdType::TYPE_LIST) {
31         return std::make_unique<ListCommandV10>();
32     }
33     if (env.optArgs.cmdType == OptCmdType::TYPE_RECV) {
34         return std::make_unique<RecvCommandV10>();
35     }
36     if (env.optArgs.cmdType == OptCmdType::TYPE_SEND) {
37         return std::make_unique<SendCommandV10>();
38     }
39     if (env.optArgs.cmdType == OptCmdType::TYPE_DELETE) {
40         return std::make_unique<DeleteCommandV10>();
41     }
42     if (env.optArgs.cmdType == OptCmdType::TYPE_QUERY) {
43         return std::make_unique<QueryCommandV10>();
44     }
45     if (env.optArgs.cmdType == OptCmdType::TYPE_LS) {
46         return std::make_unique<LSCommand>();
47     }
48     return nullptr;
49 }
50 } // namespace MediaTool
51 } // namespace Media
52 } // namespace OHOS
53