• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef FRAMEWORKS_MEDIATOOLS_COMMAND_LS_COMMAND_H_
16 #define FRAMEWORKS_MEDIATOOLS_COMMAND_LS_COMMAND_H_
17 
18 #include "command/command.h"
19 
20 #include <nlohmann/json.hpp>
21 
22 namespace OHOS {
23 namespace Media {
24 namespace MediaTool {
25 class LSCommand : public Command {
26 public:
27     LSCommand() = default;
28     ~LSCommand() override = default;
29     LSCommand(const LSCommand &lsCommand) = delete;
30     LSCommand(LSCommand &&lsCommand) = delete;
31     LSCommand &operator=(const LSCommand &lsCommand) = delete;
32     LSCommand &operator=(LSCommand &&lsCommand) = delete;
33     int32_t Start(const ExecEnv &env) override;
34 
35     bool ParseArgs(const std::vector<std::string>& args);
36     bool ParsePositionalArgs(const std::vector<std::string>& positionalArgs);
37     bool ParseFlagsArgs(const std::vector<std::string>& flags);
38     bool CheckArgs();
39     string ToString();
40     string ErrorCodeToMsg(int32_t errorCode);
41     int32_t PrintFileInfo(const std::string& fileInfoJSONString);
42     int32_t Execute();
43 
44 private:
45     bool longFormat_ = false;
46     string inputPath_;
47     string lsPath_;
48 
49     static const int LS_POS_ARG_MIN;
50     static const int LS_POS_ARG_MAX;
51 };
52 } // namespace MediaTool
53 } // namespace Media
54 } // namespace OHOS
55 #endif // FRAMEWORKS_MEDIATOOLS_COMMAND_LIST_COMMAND_V10_H_
56