/* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include #include #include #include #include using namespace ::android::vintf; static const std::string kColumnSeperator = " "; std::string existString(bool value) { return value ? "GOOD" : "DOES NOT EXIST"; } std::string compatibleString(int32_t value) { switch (value) { case COMPATIBLE: return "GOOD"; case INCOMPATIBLE: return "INCOMPATIBLE"; default: return strerror(-value); } } std::string boolCompatString(bool value) { return compatibleString(value ? COMPATIBLE : INCOMPATIBLE); } std::string deprecateString(int32_t value) { switch (value) { case NO_DEPRECATED_HALS: return "GOOD"; case DEPRECATED: return "DEPRECATED"; default: return strerror(-value); } } enum Status : int { OK = 0, USAGE, }; struct ParsedOptions { bool verbose = false; }; struct Option { char shortOption = '\0'; std::string longOption; std::string help; std::function op; }; std::string getShortOptions(const std::vector