1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef LATINIME_DICT_TOOLKIT_COMMAND_UTILS_H 18 #define LATINIME_DICT_TOOLKIT_COMMAND_UTILS_H 19 20 #include <functional> 21 #include <memory> 22 #include <string> 23 24 #include "dict_toolkit_defines.h" 25 26 namespace latinime { 27 namespace dicttoolkit { 28 29 enum class CommandType : int { 30 Info, 31 Diff, 32 Makedict, 33 Header, 34 Help, 35 Unknown 36 }; 37 38 class CommandUtils { 39 public: 40 static CommandType getCommandType(const std::string &commandName); 41 static void printCommandUnknownMessage(const std::string &programName, 42 const std::string &commandName); 43 static std::function<int(int, char **)> getCommandExecutor(const CommandType commandType); 44 45 private: 46 DISALLOW_IMPLICIT_CONSTRUCTORS(CommandUtils); 47 }; 48 } // namespace dicttoolkit 49 } // namespace latinime 50 #endif // LATINIME_DICT_TOOLKIT_COMMAND_UTILS_H 51