1eace7efcSopenharmony_ci/* 2eace7efcSopenharmony_ci* Copyright (c) 2024 Huawei Device Co., Ltd. 3eace7efcSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4eace7efcSopenharmony_ci * you may not use this file except in compliance with the License. 5eace7efcSopenharmony_ci * You may obtain a copy of the License at 6eace7efcSopenharmony_ci * 7eace7efcSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8eace7efcSopenharmony_ci * 9eace7efcSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10eace7efcSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11eace7efcSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12eace7efcSopenharmony_ci * See the License for the specific language governing permissions and 13eace7efcSopenharmony_ci * limitations under the License. 14eace7efcSopenharmony_ci */ 15eace7efcSopenharmony_ci 16eace7efcSopenharmony_ci#include "utils/dump_utils.h" 17eace7efcSopenharmony_ci 18eace7efcSopenharmony_cinamespace OHOS { 19eace7efcSopenharmony_cinamespace AAFwk { 20eace7efcSopenharmony_cistd::pair<bool, DumpUtils::DumpKey> DumpUtils::DumpMapOne(std::string argString) 21eace7efcSopenharmony_ci{ 22eace7efcSopenharmony_ci std::pair<bool, DumpUtils::DumpKey> result(false, KEY_DUMP_ALL); 23eace7efcSopenharmony_ci 24eace7efcSopenharmony_ci if (argString.compare("-a") == 0 || argString.compare("--all") == 0) { 25eace7efcSopenharmony_ci result.first = true; 26eace7efcSopenharmony_ci result.second = KEY_DUMP_ALL; 27eace7efcSopenharmony_ci } else if (argString.compare("-l") == 0 || argString.compare("--stack-list") == 0) { 28eace7efcSopenharmony_ci result.first = true; 29eace7efcSopenharmony_ci result.second = KEY_DUMP_STACK_LIST; 30eace7efcSopenharmony_ci } else if (argString.compare("-s") == 0 || argString.compare("--stack") == 0) { 31eace7efcSopenharmony_ci result.first = true; 32eace7efcSopenharmony_ci result.second = KEY_DUMP_STACK; 33eace7efcSopenharmony_ci } else if (argString.compare("-m") == 0 || argString.compare("--mission") == 0) { 34eace7efcSopenharmony_ci result.first = true; 35eace7efcSopenharmony_ci result.second = KEY_DUMP_MISSION; 36eace7efcSopenharmony_ci } else if (argString.compare("-t") == 0 || argString.compare("--top") == 0) { 37eace7efcSopenharmony_ci result.first = true; 38eace7efcSopenharmony_ci result.second = KEY_DUMP_TOP_ABILITY; 39eace7efcSopenharmony_ci } else if (argString.compare("-w") == 0 || argString.compare("--waiting-queue") == 0) { 40eace7efcSopenharmony_ci result.first = true; 41eace7efcSopenharmony_ci result.second = KEY_DUMP_WAIT_QUEUE; 42eace7efcSopenharmony_ci } else if (argString.compare("-e") == 0 || argString.compare("--serv") == 0) { 43eace7efcSopenharmony_ci result.first = true; 44eace7efcSopenharmony_ci result.second = KEY_DUMP_SERVICE; 45eace7efcSopenharmony_ci } else if (argString.compare("-d") == 0 || argString.compare("--data") == 0) { 46eace7efcSopenharmony_ci result.first = true; 47eace7efcSopenharmony_ci result.second = KEY_DUMP_DATA; 48eace7efcSopenharmony_ci } else if (argString.compare("-f") == 0 || argString.compare("-focus") == 0) { 49eace7efcSopenharmony_ci result.first = true; 50eace7efcSopenharmony_ci result.second = KEY_DUMP_FOCUS_ABILITY; 51eace7efcSopenharmony_ci } 52eace7efcSopenharmony_ci return result; 53eace7efcSopenharmony_ci} 54eace7efcSopenharmony_ci 55eace7efcSopenharmony_cistd::pair<bool, DumpUtils::DumpKey> DumpUtils::DumpMapTwo(std::string argString) 56eace7efcSopenharmony_ci{ 57eace7efcSopenharmony_ci std::pair<bool, DumpUtils::DumpKey> result(false, KEY_DUMP_ALL); 58eace7efcSopenharmony_ci 59eace7efcSopenharmony_ci if (argString.compare("-z") == 0 || argString.compare("--win-mode") == 0) { 60eace7efcSopenharmony_ci result.first = true; 61eace7efcSopenharmony_ci result.second = KEY_DUMP_WINDOW_MODE; 62eace7efcSopenharmony_ci } else if (argString.compare("-L") == 0 || argString.compare("--mission-list") == 0) { 63eace7efcSopenharmony_ci result.first = true; 64eace7efcSopenharmony_ci result.second = KEY_DUMP_MISSION_LIST; 65eace7efcSopenharmony_ci } else if (argString.compare("-S") == 0 || argString.compare("--mission-infos") == 0) { 66eace7efcSopenharmony_ci result.first = true; 67eace7efcSopenharmony_ci result.second = KEY_DUMP_MISSION_INFOS; 68eace7efcSopenharmony_ci } 69eace7efcSopenharmony_ci return result; 70eace7efcSopenharmony_ci} 71eace7efcSopenharmony_ci 72eace7efcSopenharmony_cistd::pair<bool, DumpUtils::DumpKey> DumpUtils::DumpMap(std::string argString) 73eace7efcSopenharmony_ci{ 74eace7efcSopenharmony_ci std::pair<bool, DumpUtils::DumpKey> result(false, KEY_DUMP_ALL); 75eace7efcSopenharmony_ci 76eace7efcSopenharmony_ci auto dumpMapOne = DumpMapOne(argString); 77eace7efcSopenharmony_ci if (dumpMapOne.first) { 78eace7efcSopenharmony_ci return dumpMapOne; 79eace7efcSopenharmony_ci } 80eace7efcSopenharmony_ci auto dumpMapTwo = DumpMapTwo(argString); 81eace7efcSopenharmony_ci if (dumpMapTwo.first) { 82eace7efcSopenharmony_ci return dumpMapTwo; 83eace7efcSopenharmony_ci } 84eace7efcSopenharmony_ci return result; 85eace7efcSopenharmony_ci} 86eace7efcSopenharmony_ci 87eace7efcSopenharmony_cistd::pair<bool, DumpUtils::DumpsysKey> DumpUtils::DumpsysMap(std::string argString) 88eace7efcSopenharmony_ci{ 89eace7efcSopenharmony_ci std::pair<bool, DumpUtils::DumpsysKey> result(false, KEY_DUMP_SYS_ALL); 90eace7efcSopenharmony_ci 91eace7efcSopenharmony_ci if (argString.compare("-a") == 0 || argString.compare("--all") == 0) { 92eace7efcSopenharmony_ci result.first = true; 93eace7efcSopenharmony_ci result.second = KEY_DUMP_SYS_ALL; 94eace7efcSopenharmony_ci } else if (argString.compare("-l") == 0 || argString.compare("--mission-list") == 0) { 95eace7efcSopenharmony_ci result.first = true; 96eace7efcSopenharmony_ci result.second = KEY_DUMP_SYS_MISSION_LIST; 97eace7efcSopenharmony_ci } else if (argString.compare("-i") == 0 || argString.compare("--ability") == 0) { 98eace7efcSopenharmony_ci result.first = true; 99eace7efcSopenharmony_ci result.second = KEY_DUMP_SYS_ABILITY; 100eace7efcSopenharmony_ci } else if (argString.compare("-e") == 0 || argString.compare("--extension") == 0) { 101eace7efcSopenharmony_ci result.first = true; 102eace7efcSopenharmony_ci result.second = KEY_DUMP_SYS_SERVICE; 103eace7efcSopenharmony_ci } else if (argString.compare("-p") == 0 || argString.compare("--pending") == 0) { 104eace7efcSopenharmony_ci result.first = true; 105eace7efcSopenharmony_ci result.second = KEY_DUMP_SYS_PENDING; 106eace7efcSopenharmony_ci } else if (argString.compare("-r") == 0 || argString.compare("--process") == 0) { 107eace7efcSopenharmony_ci result.first = true; 108eace7efcSopenharmony_ci result.second = KEY_DUMP_SYS_PROCESS; 109eace7efcSopenharmony_ci } else if (argString.compare("-d") == 0 || argString.compare("--data") == 0) { 110eace7efcSopenharmony_ci result.first = true; 111eace7efcSopenharmony_ci result.second = KEY_DUMP_SYS_DATA; 112eace7efcSopenharmony_ci } 113eace7efcSopenharmony_ci return result; 114eace7efcSopenharmony_ci} 115eace7efcSopenharmony_ci} // namespace AAFwk 116eace7efcSopenharmony_ci} // namespace OHOS 117